Changeset 3948 for trunk/src/kernel32/hmfile.cpp
- Timestamp:
- Aug 4, 2000, 11:12:10 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/hmfile.cpp
r3836 r3948 1 /* $Id: hmfile.cpp,v 1.1 3 2000-07-17 00:34:05 phallerExp $ */1 /* $Id: hmfile.cpp,v 1.14 2000-08-04 21:12:07 sandervl Exp $ */ 2 2 3 3 /* … … 5 5 * 6 6 * Copyright 1999-2000 Sander van Leeuwen 7 * 8 * Notes: (#define SHARE_WORKAROUND) 9 * - Temporary workaround for differences in share mode between 10 * OS/2 & NT (for opening the same file multiple times): 11 * NT: CreateFile with FILE_SHARE_READ 12 * CreateFile with FILE_SHARE_READ | FILE_SHARE_WRITE 13 * -> 2nd CreateFile overrides share flags of first one 14 * -> CreateFile with GENERIC_WRITE is now allowed 15 * OS2: DosOpen with OPEN_SHARE_DENYWRITE 16 * DosOpen with OPEN_SHARE_DENYNONE 17 * -> sharing violation; can't change share flags while 18 * handle returned by 1st DosOpen isn't closed 19 * --> 'Solution': always open files in FILE_SHARE_DENYNONE mode 20 * (several installation programs depend on this behaviour) 21 * 22 * - Only for CreateFile; might also be necessary for OpenFile, but I haven't 23 * seen any apps that require it (yet). 7 24 * 8 25 * Project Odin Software License can be found in LICENSE.TXT … … 37 54 #define DBG_LOCALLOG DBG_hmfile 38 55 #include "dbglocal.h" 56 57 //SvL: Share violation workaround for CreateFile 58 #define SHARE_WORKAROUND 39 59 40 60 /***************************************************************************** … … 92 112 pHMHandleData->dwShare &= ~FILE_SHARE_DELETE; 93 113 } 94 114 #ifdef SHARE_WORKAROUND 115 pHMHandleData->dwShare = FILE_SHARE_READ | FILE_SHARE_WRITE; 116 #endif 95 117 hFile = OSLibDosCreateFile((LPSTR)lpFileName, 96 118 pHMHandleData->dwAccess, … … 286 308 DWORD fdwAccess, 287 309 BOOL fInherit, 288 DWORD fdwOptions) 310 DWORD fdwOptions, 311 DWORD fdwOdinOptions) 289 312 { 290 313 HMFileInfo *srcfileinfo = (HMFileInfo *)pHMSrcHandle->dwUserData; … … 309 332 if(srcfileinfo) 310 333 { 311 #if 0 312 // @@@PH Why createfile here? Why not OSLibDupHandle() ? 313 if(CreateFile(srcfileinfo->lpszFileName, pHMHandleData, 314 srcfileinfo->lpSecurityAttributes, NULL) == NO_ERROR) 334 //SvL: Special duplicatehandle option used by memory mapped class to duplicate 335 // file handle 336 // Can't use DosDupHandle or else there can be a sharing violation 337 // when an app tries to access the same file again 338 if(fdwOdinOptions) 315 339 { 316 return TRUE; 340 if(CreateFile(srcfileinfo->lpszFileName, pHMHandleData, 341 srcfileinfo->lpSecurityAttributes, NULL) == NO_ERROR) 342 { 343 return TRUE; 344 } 345 dprintf(("ERROR: DuplicateHandle; CreateFile %s failed!", 346 srcfileinfo->lpszFileName)); 347 return FALSE; 317 348 } 318 dprintf(("ERROR: DuplicateHandle; CreateFile %s failed!",319 srcfileinfo->lpszFileName));320 return FALSE;321 #else322 349 323 350 if(!(fdwOptions & DUPLICATE_SAME_ACCESS) && fdwAccess != pHMSrcHandle->dwAccess) { … … 339 366 return TRUE; // OK 340 367 } 341 #endif342 368 } 343 369 else
Note:
See TracChangeset
for help on using the changeset viewer.