Changeset 4703 for trunk/src/kernel32/oslibdos.cpp
- Timestamp:
- Nov 26, 2000, 4:10:06 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/oslibdos.cpp
r4698 r4703 1 /* $Id: oslibdos.cpp,v 1.5 1 2000-11-25 16:56:57 sandervlExp $ */1 /* $Id: oslibdos.cpp,v 1.52 2000-11-26 15:10:06 bird Exp $ */ 2 2 /* 3 3 * Wrappers for OS/2 Dos* API … … 325 325 //****************************************************************************** 326 326 //NOTE: If name == NULL, allocated gettable unnamed shared memory 327 //OS/2 returns error 123 (invalid name) if the shared memory name includes 327 //OS/2 returns error 123 (invalid name) if the shared memory name includes 328 328 //colons. We need to replace them with underscores. 329 329 //****************************************************************************** … … 759 759 { 760 760 case CREATE_NEW_W: 761 openFlag |= OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS;761 openFlag |= OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_FAIL_IF_EXISTS; 762 762 break; 763 763 case CREATE_ALWAYS_W: 764 openFlag |= OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS; 764 /* kso 2000-11-26: Not sure if OPEN_ACTION_REPLACE_IF_EXISTS is correct here! It is correct according to 765 * MSDN, but not according to "The Win32 API SuperBible". Anyway I haven't got time to check it out in 766 * NT now. 767 * The problem is that OPEN_ACTION_REPLACE_IF_EXISTS requires write access. It failes with 768 * rc = ERROR_ACCESS_DENIED (5). Quick fix, use OPEN_IF_EXIST if readonly access. 769 */ 770 if (fuAccess & GENERIC_WRITE_W) 771 openFlag |= OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_REPLACE_IF_EXISTS; 772 else 773 openFlag |= OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS; 765 774 break; 766 775 case OPEN_EXISTING_W: … … 823 832 } 824 833 int retry = 0; 825 while (retry < 2)834 while (retry < 3) 826 835 { 827 836 dprintf(("DosOpen %s openFlag=%x openMode=%x", lpszFile, openFlag, openMode)); … … 834 843 openMode, 835 844 NULL); 836 if (rc == ERROR_TOO_MANY_OPEN_FILES)845 if (rc == ERROR_TOO_MANY_OPEN_FILES) 837 846 { 838 847 ULONG CurMaxFH; … … 847 856 dprintf(("DosOpen failed -> increased nr open files to %d", CurMaxFH)); 848 857 } 849 else break; 858 #if 0 859 else if (rc == ERROR_ACCESS_DENIED && (openFlag & OPEN_ACTION_REPLACE_IF_EXISTS)) 860 { /* kso: I have great problems with the REPLACE not working 861 * So, I guess this emulation may help... 862 * This problem exist on WS4eB SMP FP1 and Warp4 FP14/Kernel 14059 at least. 863 */ 864 rc = DosOpen((PSZ)lpszFile, 865 &hFile, 866 &actionTaken, 867 fileSize, 868 fileAttr, 869 (openFlag & ~OPEN_ACTION_REPLACE_IF_EXISTS) | OPEN_ACTION_OPEN_IF_EXISTS, 870 openMode, 871 NULL); 872 if (rc == NO_ERROR) 873 { 874 rc = DosSetFileSize(hFile, 0); 875 if (!rc && fileSize > 0) 876 rc = DosSetFileSize(hFile, fileSize); 877 if (rc) 878 { 879 DosClose(hFile); 880 hFile = NULLHANDLE; 881 882 if (rc != ERROR_TOO_MANY_OPEN_FILES) 883 break; 884 } 885 else break; 886 } 887 } 888 #endif 889 else break; 850 890 retry++; 851 891 } … … 2102 2142 len = strlen(lpszCurDriveAndDir) + 3; 2103 2143 2104 // Dir returned by DosQueryCurDir doesn't include drive, so add it 2144 // Dir returned by DosQueryCurDir doesn't include drive, so add it 2105 2145 DosQueryCurrentDisk(¤tdisk, &drivemap); 2106 2146
Note:
See TracChangeset
for help on using the changeset viewer.