Changeset 2713 in kBuild
- Timestamp:
- Nov 21, 2013 9:11:00 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmkbuiltin/mscfakes.h
r2702 r2713 40 40 #include <direct.h> 41 41 #include "nt/ntstat.h" 42 #include "nt/ntunlink.h" 42 43 #if defined(MSC_DO_64_BIT_IO) && _MSC_VER >= 1400 /* We want 64-bit file lengths here when possible. */ 43 44 # define off_t __int64 -
trunk/src/kmk/kmkbuiltin/rm.c
r2702 r2713 67 67 # include "haikufakes.h" 68 68 #endif 69 #ifdef _MSC_VER 70 # include "mscfakes.h" 69 #ifdef KBUILD_OS_WINDOWS 70 # ifdef _MSC_VER 71 # include "mscfakes.h" 72 # endif 73 # include "nt/ntunlink.h" 74 /* Use the special unlink implementation to do rmdir too. */ 75 # undef rmdir 76 # define rmdir(a_pszPath) birdUnlinkForced(a_pszPath) 71 77 #endif 72 78 #if defined(__OS2__) || defined(_MSC_VER) … … 77 83 #include "kbuild_protection.h" 78 84 79 #if defined(__EMX__) || defined( _MSC_VER)85 #if defined(__EMX__) || defined(KBUILD_OS_WINDOWS) 80 86 # define IS_SLASH(ch) ( (ch) == '/' || (ch) == '\\' ) 81 87 # define HAVE_DOS_PATHS 1 … … 100 106 101 107 static int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok; 108 #ifdef KBUILD_OS_WINDOWS 109 static int fUseNtDeleteFile; 110 #endif 102 111 static uid_t uid; 103 112 … … 114 123 { "disable-full-protection", no_argument, 0, 266 }, 115 124 { "protection-depth", required_argument, 0, 267 }, 125 #ifdef KBUILD_OS_WINDOWS 126 { "nt-delete-file", no_argument, 0, 268 }, 127 #endif 116 128 { 0, 0, 0, 0 }, 117 129 }; … … 149 161 argv0 = argv[0]; 150 162 dflag = eval = fflag = iflag = Pflag = vflag = Wflag = stdin_ok = 0; 163 #ifdef KBUILD_OS_WINDOWS 164 fUseNtDeleteFile = 0; 165 #endif 151 166 uid = 0; 152 167 kBuildProtectionInit(&g_ProtData); … … 215 230 } 216 231 break; 232 #ifdef KBUILD_OS_WINDOWS 233 case 268: 234 fUseNtDeleteFile = 1; 235 break; 236 #endif 217 237 case '?': 218 238 default: … … 404 424 if (!rm_overwrite(p->fts_accpath, NULL)) 405 425 continue; 426 #ifdef KBUILD_OS_WINDOWS 427 rval = birdUnlinkForcedFast(p->fts_accpath); 428 #else 406 429 rval = unlink(p->fts_accpath); 407 #ifdef _MSC_VER408 if (rval != 0) {409 chmod(p->fts_accpath, 0777);410 rval = unlink(p->fts_accpath);411 }412 430 #endif 413 431 … … 499 517 rval = undelete(f); 500 518 operation = "undelete"; 501 #ifndef _MSC_VER502 519 } else if (S_ISDIR(sb.st_mode)) { 503 #else504 } else if (S_ISDIR(sb.st_mode) || sb.st_dirsymlink) {505 #endif506 520 rval = rmdir(f); 507 521 operation = "rmdir"; … … 510 524 if (!rm_overwrite(f, &sb)) 511 525 continue; 526 #ifndef KBUILD_OS_WINDOWS 512 527 rval = unlink(f); 513 #ifdef _MSC_VER 514 if (rval != 0) { 515 chmod(f, 0777); 516 rval = unlink(f); 528 operation = "unlink"; 529 #else 530 if (fUseNtDeleteFile) { 531 rval = birdUnlinkForcedFast(f); 532 operation = "NtDeleteFile"; 533 } else { 534 rval = birdUnlinkForced(f); 535 operation = "unlink"; 517 536 } 518 537 #endif 519 operation = "unlink";520 538 } 521 539 } -
trunk/src/lib/Makefile.kmk
r2702 r2713 46 46 nt/nthlpfs.c \ 47 47 nt/ntdir.c \ 48 nt/ntstat.c 48 nt/ntstat.c \ 49 nt/ntunlink.c 49 50 kUtil_SOURCES.solaris = \ 50 51 restartable-syscall-wrappers.c -
trunk/src/lib/nt/nthlp.h
r2704 r2713 59 59 ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, 60 60 MY_UNICODE_STRING *pNameUniStr); 61 MY_NTSTATUS birdOpenFileUniStr(MY_UNICODE_STRING *pNtPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, 62 ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, 63 HANDLE *phFile); 61 64 void birdCloseFile(HANDLE hFile); 65 int birdDosToNtPath(const char *pszPath, MY_UNICODE_STRING *pNtPath); 62 66 void birdFreeNtPath(MY_UNICODE_STRING *pNtPath); 63 67 -
trunk/src/lib/nt/nthlpcore.c
r2703 r2713 45 45 MY_NTSTATUS (WINAPI *g_pfnNtCreateFile)(PHANDLE, MY_ACCESS_MASK, MY_OBJECT_ATTRIBUTES *, MY_IO_STATUS_BLOCK *, 46 46 PLARGE_INTEGER, ULONG, ULONG, ULONG, ULONG, PVOID, ULONG); 47 MY_NTSTATUS (WINAPI *g_pfnNtDeleteFile)(MY_OBJECT_ATTRIBUTES *); 47 48 MY_NTSTATUS (WINAPI *g_pfnNtQueryInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FILE_INFORMATION_CLASS); 48 49 MY_NTSTATUS (WINAPI *g_pfnNtQueryVolumeInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FS_INFORMATION_CLASS); … … 50 51 PVOID, ULONG, MY_FILE_INFORMATION_CLASS, BOOLEAN, 51 52 MY_UNICODE_STRING *, BOOLEAN); 53 MY_NTSTATUS (WINAPI *g_pfnNtSetInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FILE_INFORMATION_CLASS); 52 54 BOOLEAN (WINAPI *g_pfnRtlDosPathNameToNtPathName_U)(PCWSTR, MY_UNICODE_STRING *, PCWSTR *, MY_RTL_RELATIVE_NAME_U *); 53 55 MY_NTSTATUS (WINAPI *g_pfnRtlAnsiStringToUnicodeString)(MY_UNICODE_STRING *, MY_ANSI_STRING const *, BOOLEAN); … … 62 64 { (FARPROC *)&g_pfnNtClose, "NtClose" }, 63 65 { (FARPROC *)&g_pfnNtCreateFile, "NtCreateFile" }, 66 { (FARPROC *)&g_pfnNtDeleteFile, "NtDeleteFile" }, 64 67 { (FARPROC *)&g_pfnNtQueryInformationFile, "NtQueryInformationFile" }, 65 68 { (FARPROC *)&g_pfnNtQueryVolumeInformationFile, "NtQueryVolumeInformationFile" }, 66 69 { (FARPROC *)&g_pfnNtQueryDirectoryFile, "NtQueryDirectoryFile" }, 70 { (FARPROC *)&g_pfnNtSetInformationFile, "NtSetInformationFile" }, 67 71 { (FARPROC *)&g_pfnRtlDosPathNameToNtPathName_U, "RtlDosPathNameToNtPathName_U" }, 68 72 { (FARPROC *)&g_pfnRtlAnsiStringToUnicodeString, "RtlAnsiStringToUnicodeString" }, … … 137 141 { 138 142 /* EPERM = 1 */ 143 case STATUS_CANNOT_DELETE: 144 errno = EPERM; 145 break; 139 146 /* ENOENT = 2 */ 140 147 case STATUS_NOT_FOUND: -
trunk/src/lib/nt/nthlpfs.c
r2710 r2713 78 78 79 79 80 staticint birdDosToNtPath(const char *pszPath, MY_UNICODE_STRING *pNtPath)80 int birdDosToNtPath(const char *pszPath, MY_UNICODE_STRING *pNtPath) 81 81 { 82 82 MY_NTSTATUS rcNt; … … 128 128 129 129 130 static MY_NTSTATUS birdOpenFileInternal(MY_UNICODE_STRING *pNtPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs,131 132 130 MY_NTSTATUS birdOpenFileUniStr(MY_UNICODE_STRING *pNtPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, 131 ULONG fShareAccess, ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, 132 HANDLE *phFile) 133 133 { 134 134 MY_IO_STATUS_BLOCK Ios; … … 203 203 { 204 204 HANDLE hFile; 205 rcNt = birdOpenFile Internal(&NtPath, fDesiredAccess, fFileAttribs, fShareAccess,206 205 rcNt = birdOpenFileUniStr(&NtPath, fDesiredAccess, fFileAttribs, fShareAccess, 206 fCreateDisposition, fCreateOptions, fObjAttribs, &hFile); 207 207 if (MY_NT_SUCCESS(rcNt)) 208 208 { … … 278 278 */ 279 279 HANDLE hFile; 280 rcNt = birdOpenFile Internal(&NtPath, fDesiredAccess, fFileAttribs, fShareAccess,281 280 rcNt = birdOpenFileUniStr(&NtPath, fDesiredAccess, fFileAttribs, fShareAccess, 281 fCreateDisposition, fCreateOptions, fObjAttribs, &hFile); 282 282 if (MY_NT_SUCCESS(rcNt)) 283 283 { -
trunk/src/lib/nt/ntstuff.h
r2708 r2713 199 199 /** The sizeof(MY_FILE_NAMES_INFORMATION) without the FileName. */ 200 200 #define MIN_SIZEOF_MY_FILE_ID_FULL_DIR_INFORMATION ( (size_t)&((MY_FILE_ID_FULL_DIR_INFORMATION *)0)->FileName ) 201 202 203 typedef struct MY_FILE_DISPOSITION_INFORMATION 204 { 205 BOOLEAN DeleteFile; 206 } MY_FILE_DISPOSITION_INFORMATION; 201 207 202 208 … … 361 367 extern MY_NTSTATUS (WINAPI * g_pfnNtCreateFile)(PHANDLE, MY_ACCESS_MASK, MY_OBJECT_ATTRIBUTES *, MY_IO_STATUS_BLOCK *, 362 368 PLARGE_INTEGER, ULONG, ULONG, ULONG, ULONG, PVOID, ULONG); 369 extern MY_NTSTATUS (WINAPI * g_pfnNtDeleteFile)(MY_OBJECT_ATTRIBUTES *); 363 370 extern MY_NTSTATUS (WINAPI * g_pfnNtQueryInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, 364 371 PVOID, LONG, MY_FILE_INFORMATION_CLASS); … … 368 375 PVOID, ULONG, MY_FILE_INFORMATION_CLASS, BOOLEAN, 369 376 MY_UNICODE_STRING *, BOOLEAN); 377 extern MY_NTSTATUS (WINAPI * g_pfnNtSetInformationFile)(HANDLE, MY_IO_STATUS_BLOCK *, PVOID, LONG, MY_FILE_INFORMATION_CLASS); 370 378 extern BOOLEAN (WINAPI * g_pfnRtlDosPathNameToNtPathName_U)(PCWSTR, MY_UNICODE_STRING *, PCWSTR *, MY_RTL_RELATIVE_NAME_U *); 371 379 extern MY_NTSTATUS (WINAPI * g_pfnRtlAnsiStringToUnicodeString)(MY_UNICODE_STRING *, MY_ANSI_STRING const *, BOOLEAN);
Note:
See TracChangeset
for help on using the changeset viewer.