- Timestamp:
- Aug 22, 2002, 4:21:27 PM (23 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/Fileio.cpp
r9011 r9095 1 /* $Id: Fileio.cpp,v 1.6 7 2002-08-16 09:56:30sandervl Exp $ */1 /* $Id: Fileio.cpp,v 1.68 2002-08-22 14:21:26 sandervl Exp $ */ 2 2 3 3 /* … … 293 293 else 294 294 filename = (char *)lpFileName; 295 295 296 296 return (HANDLE)OSLibDosFindFirst(filename, (WIN32_FIND_DATAA *)lpFindFileData); 297 297 … … 390 390 DWORD * count) 391 391 { 392 dprintf(("FindFirstFileMultiA %s %x %x", lpFileName, lpFindFileData, count)); 392 393 return (HANDLE)OSLibDosFindFirstMulti(lpFileName,lpFindFileData,count); 393 394 } … … 404 405 DWORD *count) 405 406 { 406 return OSLibDosFindNextMulti(hFindFile,lpFindFileData,count); 407 dprintf(("FindNextFileMultiA %x %x %x", hFindFile, lpFindFileData, count)); 408 return OSLibDosFindNextMulti(hFindFile,lpFindFileData,count); 407 409 } 408 410 //****************************************************************************** … … 810 812 DWORD rc, error; 811 813 812 if((NULL!=lpszFileName) && strlen(lpszFileName)==2 && lpszFileName[1] == ':') 813 { 814 char szDrive[4]; 815 szDrive[0] = lpszFileName[0]; 816 szDrive[1] = lpszFileName[1]; 817 szDrive[2] = '\\'; 818 szDrive[3] = 0x00; 819 rc = O32_GetFileAttributes((LPSTR)szDrive); 820 } 821 else { 822 rc = O32_GetFileAttributes((LPSTR)lpszFileName); 823 if(rc == -1 && lpszFileName[strlen(lpszFileName)-1] != '\\') { 824 char *filename = (char *)alloca(strlen(lpszFileName)+2); //+2!!!!!! 825 strcpy(filename, lpszFileName); 826 strcat(filename, "\\"); 827 rc = O32_GetFileAttributes((LPSTR)filename); 828 } 829 } 814 rc = OSLibGetFileAttributes((LPSTR)lpszFileName); 815 830 816 //SvL: Open32 returns FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_NORMAL for 831 817 // directories whereas NT 4 (SP6) only returns FILE_ATTRIBUTE_DIRECTORY -
trunk/src/kernel32/oslibdos.cpp
r8864 r9095 1 /* $Id: oslibdos.cpp,v 1.10 7 2002-07-13 15:58:20sandervl Exp $ */1 /* $Id: oslibdos.cpp,v 1.108 2002-08-22 14:21:26 sandervl Exp $ */ 2 2 /* 3 3 * Wrappers for OS/2 Dos* API … … 2272 2272 //****************************************************************************** 2273 2273 //****************************************************************************** 2274 BOOL 2274 BOOL OSLibDosFindClose(DWORD hFindFile) 2275 2275 { 2276 2276 APIRET rc = DosFindClose((HDIR)hFindFile); … … 2283 2283 SetLastError(ERROR_SUCCESS_W); 2284 2284 return TRUE; 2285 } 2286 //****************************************************************************** 2287 //****************************************************************************** 2288 DWORD OSLibGetFileAttributes(LPSTR lpFileName) 2289 { 2290 FILESTATUS3 statusBuf; 2291 char lOemFileName[CCHMAXPATH]; 2292 char *lpszBackslash, *lpszColon; 2293 APIRET rc; 2294 2295 //Convert file name from Windows to OS/2 codepage 2296 CharToOemA(lpFileName, lOemFileName); 2297 lpszBackslash = CharPrevA(lOemFileName, lOemFileName + strlen(lOemFileName)); 2298 if(lpszBackslash) 2299 { 2300 if(*lpszBackslash == '\\') 2301 { 2302 lpszColon = CharPrevA(lOemFileName, lpszBackslash); 2303 if(lpszColon && *lpszColon != ':') 2304 {//only rootdir is allowed to have terminating backslash 2305 *lpszBackslash = 0; 2306 } 2307 } 2308 else 2309 if(*lpszBackslash == ':') 2310 {//root dir must end with backslash 2311 strcat(lOemFileName, "\\"); 2312 } 2313 } 2314 2315 rc = DosQueryPathInfo(lOemFileName, FIL_STANDARD, &statusBuf, sizeof(statusBuf)); 2316 if(rc == ERROR_TOO_MANY_OPEN_FILES) 2317 { 2318 LONG reqCount = 2; 2319 ULONG maxFiles; 2320 2321 if(DosSetRelMaxFH(&reqCount, &maxFiles) == NO_ERROR) 2322 rc = DosQueryPathInfo(lOemFileName, FIL_STANDARD, &statusBuf, sizeof(statusBuf)); 2323 } 2324 2325 if(rc == NO_ERROR) 2326 { 2327 DWORD status = 0; 2328 if(!(statusBuf.attrFile & NOT_NORMAL)) 2329 status |= FILE_ATTRIBUTE_NORMAL_W; 2330 if(statusBuf.attrFile & FILE_READONLY) 2331 status |= FILE_ATTRIBUTE_READONLY_W; 2332 if(statusBuf.attrFile & FILE_HIDDEN) 2333 status |= FILE_ATTRIBUTE_HIDDEN_W; 2334 if(statusBuf.attrFile & FILE_SYSTEM) 2335 status |= FILE_ATTRIBUTE_SYSTEM_W; 2336 if(statusBuf.attrFile & FILE_DIRECTORY) 2337 status |= FILE_ATTRIBUTE_DIRECTORY_W; 2338 if(statusBuf.attrFile & FILE_ARCHIVED) 2339 status |= FILE_ATTRIBUTE_ARCHIVE_W; 2340 2341 SetLastError(ERROR_SUCCESS_W); 2342 return status; 2343 } 2344 SetLastError(error2WinError(rc)); 2345 return -1; 2285 2346 } 2286 2347 //****************************************************************************** -
trunk/src/kernel32/oslibdos.h
r8877 r9095 1 /* $Id: oslibdos.h,v 1.4 7 2002-07-15 14:28:52sandervl Exp $ */1 /* $Id: oslibdos.h,v 1.48 2002-08-22 14:21:27 sandervl Exp $ */ 2 2 3 3 /* … … 173 173 BOOL OSLibDosFindNextMulti(DWORD hFindFile,WIN32_FIND_DATAA *lpFindFileData,DWORD *count); 174 174 BOOL OSLibDosFindClose(DWORD hFindFile); 175 176 DWORD OSLibGetFileAttributes(LPSTR lpFileName); 175 177 176 178 DWORD OSLibDosQueryVolumeFS(int drive, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize);
Note:
See TracChangeset
for help on using the changeset viewer.