Changeset 21549 for trunk/src/kernel32/Fileio.cpp
- Timestamp:
- Jan 9, 2011, 5:54:29 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/Fileio.cpp
r21388 r21549 242 242 * If the function fails, the return value is INVALID_HANDLE_VALUE 243 243 * Remark : 244 * Status : 244 * Status : 245 245 * 246 246 * Author : SvL … … 251 251 LPVOID lpSearchFilter, 252 252 DWORD dwAdditionalFlags) 253 { 253 { 254 254 HANDLE hFind; 255 255 256 if(lpFileName == NULL || lpFindFileData == NULL || lpSearchFilter != NULL) 256 if(lpFileName == NULL || lpFindFileData == NULL || lpSearchFilter != NULL) 257 257 { 258 258 dprintf(("!ERROR!: invalid parameter(s)")); … … 267 267 } 268 268 else 269 if(fSearchOp == FindExSearchLimitToDirectories) { 269 if(fSearchOp == FindExSearchLimitToDirectories) { 270 270 //NOTE: According to the SDK docs we are allowed to silently ignore this option 271 271 dprintf(("!WARNING!: FindExSearchLimitToDirectories IGNORED")); … … 296 296 filename[namelen-1] = 0; 297 297 } 298 else 298 else 299 299 filename = (char *)lpFileName; 300 300 301 301 return (HANDLE)OSLibDosFindFirst(filename, (WIN32_FIND_DATAA *)lpFindFileData); 302 302 } … … 306 306 SetLastError(ERROR_INVALID_PARAMETER); 307 307 break; 308 } 308 } 309 309 return INVALID_HANDLE_VALUE; 310 310 } … … 334 334 * If the function fails, the return value is INVALID_HANDLE_VALUE 335 335 * Remark : 336 * Status : 336 * Status : 337 337 * 338 338 * Author : Wine … … 367 367 HeapFree( GetProcessHeap(), 0, pathA ); 368 368 if (handle == INVALID_HANDLE_VALUE) return handle; 369 369 370 370 switch(fInfoLevelId) 371 371 { … … 608 608 } 609 609 //If the app is deleting a shellink file (.lnk), then we must delete the WPS object 610 if(OSLibIsShellLink((LPSTR)lpszFile)) 610 if(OSLibIsShellLink((LPSTR)lpszFile)) 611 611 { 612 612 OSLibWinDeleteObject((LPSTR)lpszFile); … … 638 638 //****************************************************************************** 639 639 //****************************************************************************** 640 UINT WIN32API GetTempFileNameA(LPCSTR lpPathName, LPCSTR lpPrefixString, 640 UINT WIN32API GetTempFileNameA(LPCSTR lpPathName, LPCSTR lpPrefixString, 641 641 UINT uUnique, LPSTR lpTempFileName) 642 642 { … … 848 848 DWORD rc; 849 849 850 dprintf(("KERNEL32: GetFullPathName called with %s %d %x", lpFileName, nBufferLength, lpBuffer));850 dprintf(("KERNEL32: GetFullPathName(%s,%d,0x%X)", lpFileName, nBufferLength, lpBuffer)); 851 851 852 852 lpszFileName = strdup(lpFileName); … … 857 857 rc = O32_GetFullPathName(lpszFileName, nBufferLength, lpBuffer, lpFilePart); 858 858 859 #ifdef DEBUG 860 if (rc > nBufferLength) { 861 dprintf(("KERNEL32: GetFullPathName returns %d (needs a bgger buffer)", rc)); 862 } else if (rc > 0) { 863 dprintf(("KERNEL32: GetFullPathName returns %d (%s,%s)", lpBuffer, *lpFilePart)); 864 } 865 #endif 866 859 867 free(lpszFileName); 860 868 … … 876 884 rc = GetFullPathNameA(astring, nBufferLength, 877 885 asciibuffer, &asciipart); 878 879 dprintf(("KERNEL32: GetFullPathNameW %s returns %s\n%s",880 astring,881 asciibuffer, asciipart));882 886 883 887 if(rc>0 && rc<nBufferLength && asciibuffer) … … 925 929 DWORD fdwFlags) 926 930 { 927 dprintf(("KERNEL32: MoveFileExA %s to %s %x, not complete!\n", 928 lpszOldFilename, 931 dprintf(("KERNEL32: MoveFileExA %s to %s %x, not complete!\n", 932 lpszOldFilename, 929 933 lpszNewFilename, 930 934 fdwFlags)); 931 935 932 936 // this parameter combination is illegal 933 937 if ( (fdwFlags & MOVEFILE_DELAY_UNTIL_REBOOT) && … … 938 942 return FALSE; 939 943 } 940 944 941 945 // first, we take care about the special cases 942 946 if (fdwFlags && MOVEFILE_DELAY_UNTIL_REBOOT) … … 946 950 // this call is Microsoft ACMSETUP wanting to replace OLEPRO32.DLL 947 951 // in the ODIN system directory, we are better skipping the call. 948 952 949 953 // Anyway, this is only supported under Windows NT 950 954 fdwFlags &= ~MOVEFILE_DELAY_UNTIL_REBOOT; 951 955 952 956 // Until we support this, we have to intercept 953 957 // lpszNewFilename == NULL … … 957 961 dprintf(("KERNEL32-MoveFileExA: trying to delete file [%s], skipped.", 958 962 lpszOldFilename)); 959 963 960 964 SetLastError( NO_ERROR ); 961 965 return TRUE; 962 966 } 963 967 } 964 968 965 969 if (fdwFlags && MOVEFILE_COPY_ALLOWED) 966 970 { … … 968 972 // volumes, this flag controls if a copy operation is allowed. 969 973 } 970 974 971 975 if (fdwFlags && MOVEFILE_REPLACE_EXISTING) 972 976 { 973 // We can only attempt to 977 // We can only attempt to 974 978 // 1 move away the current file if existing, 975 979 // 2 do the current move operation … … 977 981 // otherwise restore the original file 978 982 } 979 980 return OSLibDosMoveFile(lpszOldFilename, 983 984 return OSLibDosMoveFile(lpszOldFilename, 981 985 lpszNewFilename); 982 986 } … … 999 1003 BOOL WIN32API MoveFileExW(LPCWSTR lpSrc, LPCWSTR lpDest, DWORD fdwFlags) 1000 1004 { 1001 dprintf(("KERNEL32: MoveFileExW %ls to %ls %x", 1002 lpSrc, 1005 dprintf(("KERNEL32: MoveFileExW %ls to %ls %x", 1006 lpSrc, 1003 1007 lpDest, 1004 1008 fdwFlags)); 1005 1006 char *asciisrc, 1009 1010 char *asciisrc, 1007 1011 *asciidest; 1008 1012 BOOL rc; … … 1013 1017 else 1014 1018 asciidest = NULL; 1015 1016 rc = MoveFileExA(asciisrc, 1019 1020 rc = MoveFileExA(asciisrc, 1017 1021 asciidest, 1018 1022 fdwFlags); 1019 1023 1020 1024 if (NULL != asciidest) 1021 1025 FreeAsciiString(asciidest); 1022 1026 1023 1027 FreeAsciiString(asciisrc); 1024 1028 1025 1029 return(rc); 1026 1030 } … … 1045 1049 DWORD attr, sp = 0, lp = 0; 1046 1050 int tmplen, drive; 1047 1051 1048 1052 dprintf(("KERNEL32: GetShortPathNameA %s", lpszLongPath)); 1049 1053 … … 1066 1070 return 0; 1067 1071 } 1068 1072 1069 1073 lstrcpyA(tmplongpath,lpszLongPath); 1070 1074 1071 1075 /* check for drive letter */ 1072 1076 if ( lpszLongPath[1] == ':' ) { … … 1083 1087 /* check for path delimiters and reproduce them */ 1084 1088 if ( lpszLongPath[lp] == '\\' || lpszLongPath[lp] == '/' ) { 1085 if (!sp || tmpshortpath[sp-1]!= '\\') 1089 if (!sp || tmpshortpath[sp-1]!= '\\') 1086 1090 { 1087 1091 /* strip double "\\" */ … … 1094 1098 } 1095 1099 1096 tmplen = strcspn ( lpszLongPath + lp, "\\/" ); 1100 tmplen = strcspn ( lpszLongPath + lp, "\\/" ); 1097 1101 lstrcpynA ( tmpshortpath+sp, lpszLongPath + lp, tmplen+1 ); 1098 1102 … … 1105 1109 1106 1110 if (tmplongpath[lp + tmplen] == '\\') 1107 { 1111 { 1108 1112 tmplongpath[lp + tmplen] = 0; 1109 1113 marker = 1; … … 1112 1116 attr = GetFileAttributesA(tmplongpath); 1113 1117 1114 if (attr == -1) 1118 if (attr == -1) 1115 1119 { 1116 1120 SetLastError ( ERROR_FILE_NOT_FOUND ); … … 1120 1124 } 1121 1125 1122 DOSFS_Hash(tmpshortpath+sp, short_name, FALSE, TRUE ); 1123 1126 DOSFS_Hash(tmpshortpath+sp, short_name, FALSE, TRUE ); 1127 1124 1128 strcpy( tmpshortpath+sp, short_name); 1125 1129 sp += strlen ( tmpshortpath+sp ); … … 1127 1131 tmplongpath[lp + tmplen] = '\\'; 1128 1132 lp += tmplen; 1129 1133 1130 1134 } 1131 1135 … … 1182 1186 1183 1187 dprintf(("GetLongPathNameA %s %x %d", lpszShortPath, lpszLongPath, cchBuffer)); 1184 1188 1185 1189 if(!lpszShortPath) { 1186 1190 SetLastError(ERROR_INVALID_PARAMETER); … … 1218 1222 /* check for path delimiters and reproduce them */ 1219 1223 if ( lpszShortPath1[lp] == '\\' || lpszShortPath1[lp] == '/' ) { 1220 if (!sp || tmplongpath[sp-1]!= '\\') 1224 if (!sp || tmplongpath[sp-1]!= '\\') 1221 1225 { 1222 1226 /* strip double "\\" */ … … 1233 1237 1234 1238 attr = GetFileAttributesA(tmplongpath); 1235 if (attr != -1) 1239 if (attr != -1) 1236 1240 { 1237 1241 sp += tmplen; … … 1249 1253 (tmplongpath+sp)[0] = '*'; 1250 1254 (tmplongpath+sp)[1] = 0; 1251 } 1255 } 1252 1256 else 1253 1257 { … … 1257 1261 hFind = FindFirstFileExA(tmplongpath, FindExInfoStandard, &FindFileData, 1258 1262 FindExSearchNameMatch, NULL, 0 ); 1259 1263 1260 1264 if (hFind == INVALID_HANDLE_VALUE) 1261 1265 { … … 1269 1273 do 1270 1274 { 1271 DOSFS_Hash(FindFileData.cFileName, short_name, FALSE, TRUE ); 1275 DOSFS_Hash(FindFileData.cFileName, short_name, FALSE, TRUE ); 1272 1276 //this happens on files like [hello world] 1273 1277 if (!lstrncmpA(short_name, lpszShortPath1+lp, (lpszShortPath1+lp+tmplen)[-1] == '.' ? tmplen-1 : tmplen )) … … 1280 1284 } 1281 1285 while (FindNextFileA(hFind, &FindFileData)); 1282 1283 // no FindClose() here or else GetLastError() will not give its error 1286 1287 // no FindClose() here or else GetLastError() will not give its error 1284 1288 if (GetLastError() == ERROR_NO_MORE_FILES) 1285 1289 { … … 1292 1296 FindClose(hFind); 1293 1297 } 1294 else 1298 else 1295 1299 { 1296 1300 // if this file can't be found in common or hashed files … … 1461 1465 *****************************************************************************/ 1462 1466 1463 BOOL WIN32API GetFileAttributesExW(LPCWSTR lpFileName, 1467 BOOL WIN32API GetFileAttributesExW(LPCWSTR lpFileName, 1464 1468 GET_FILEEX_INFO_LEVELS fInfoLevelId, 1465 1469 LPVOID lpFileInformation)
Note:
See TracChangeset
for help on using the changeset viewer.