Changeset 11632

Show
Ignore:
Timestamp:
07/14/08 17:12:27 (7 weeks ago)
Author:
cristy
Message:
 
Location:
WizardsToolkit/trunk/wizard
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • WizardsToolkit/trunk/wizard/nt-base.c

    r10630 r11632  
    799799{ 
    800800  DWORD 
    801     low, 
    802     high, 
    803     mode; 
     801    access_mode. 
     802    high_length, 
     803    high_offset, 
     804    low_length, 
     805    low_offset, 
     806    protection_mode; 
    804807 
    805808  HANDLE 
    806809    file_handle, 
    807     file_map; 
     810    map_handle; 
    808811 
    809812  void 
    810813    *map; 
    811814 
    812   mode=0; 
    813   if ((protection & PROT_WRITE) != 0) 
    814     { 
    815       mode=PAGE_READWRITE; 
    816       if ((flags & MAP_PRIVATE) != 0) 
    817         mode=PAGE_WRITECOPY; 
     815  access_mode=0; 
     816  file_handle=INVALID_HANDLE_VALUE; 
     817  low_length=(DWORD) (length & 0xFFFFFFFFUL); 
     818  high_length=(DWORD) ((((magick_off_t) length) >> 32) & 0xFFFFFFFFUL); 
     819  map_handle=INVALID_HANDLE_VALUE; 
     820  map=(void *) NULL; 
     821  low_offset=(DWORD) (offset & 0xFFFFFFFFUL); 
     822  high_offset=(DWORD) ((offset >> 32) & 0xFFFFFFFFUL); 
     823  protection_mode=0; 
     824  if (protection & PROT_WRITE) 
     825    { 
     826      access_mode=FILE_MAP_WRITE; 
     827      if (!(flags & MAP_PRIVATE)) 
     828        protection_mode=PAGE_READWRITE; 
     829      else 
     830        { 
     831          access_mode=FILE_MAP_COPY; 
     832          protection_mode=PAGE_WRITECOPY; 
     833        } 
    818834    } 
    819835  else 
    820     if ((protection & PROT_READ) != 0) 
    821       mode=PAGE_READONLY; 
    822   file_handle=INVALID_HANDLE_VALUE; 
    823   if ((file != -1) || ((flags & MAP_ANONYMOUS) == 0)) 
     836    if (protection & PROT_READ) 
     837      { 
     838        access_mode=FILE_MAP_READ; 
     839        protection_mode=PAGE_READONLY; 
     840      } 
     841  if ((file == -1) && (flags & MAP_ANON)) 
     842    file_handle=INVALID_HANDLE_VALUE; 
     843  else 
    824844    file_handle=(HANDLE) _get_osfhandle(file); 
    825   low=(DWORD) (length & 0xffffffffUL); 
    826   high=(DWORD) ((((WizardOffsetType) length) >> 32) & 0xffffffffUL); 
    827   file_map=CreateFileMapping(file_handle,0,mode,high,low,0); 
    828   map=(void *) NULL; 
    829   if (file_map != (HANDLE) NULL) 
    830     { 
    831       mode=0; 
    832       if ((protection & PROT_WRITE) != 0) 
    833         { 
    834           mode=FILE_MAP_WRITE; 
    835           if ((flags & MAP_PRIVATE) != 0) 
    836             mode=FILE_MAP_COPY; 
    837         } 
    838       else 
    839         if ((protection & PROT_READ) != 0) 
    840           mode=FILE_MAP_READ; 
    841       low=(DWORD) (offset & 0xffffffffUL); 
    842       high=(DWORD) ((offset >> 32) & 0xffffffffUL); 
    843       map=(void *) MapViewOfFile(file_map,mode,high,low,length); 
    844       CloseHandle(file_map); 
     845  map_handle=CreateFileMapping(file_handle,0,protection_mode,high_length, 
     846    low_length,0); 
     847  if (map_handle) 
     848    { 
     849      map=(void *) MapViewOfFile(map_handle,access_mode,high_offset,low_offset, 
     850        length); 
     851      CloseHandle(map_handle); 
    845852    } 
    846853  if (map == (void *) NULL) 
  • WizardsToolkit/trunk/wizard/nt-base.h

    r10856 r11632  
    8080#  define fileno  _fileno 
    8181#endif 
     82#if !defined(fsync) 
     83#  define fsync  _commit 
     84#endif 
    8285#if !defined(ftruncate) 
    8386#  define ftruncate(file,length)  NTFileTruncate(file,length)