Changeset 49150 in vbox for trunk/src/VBox/Runtime/r3/nt
- Timestamp:
- Oct 17, 2013 7:22:02 AM (11 years ago)
- Location:
- trunk/src/VBox/Runtime/r3/nt
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/nt/direnum-r3-nt.cpp
r48935 r49150 105 105 bool fObjDir; 106 106 #endif 107 rc = rtNtPathOpenDir(pszPathBuf,107 rc = RTNtPathOpenDir(pszPathBuf, 108 108 FILE_READ_DATA | SYNCHRONIZE, 109 109 FILE_SHARE_READ | FILE_SHARE_WRITE, … … 149 149 */ 150 150 pDir->u32Magic = ~RTDIR_MAGIC; 151 if (pDir->hDir != MY_INVALID_HANDLE_VALUE)152 { 153 int rc = rtNtPathClose(pDir->hDir);151 if (pDir->hDir != RTNT_INVALID_HANDLE_VALUE) 152 { 153 int rc = RTNtPathClose(pDir->hDir); 154 154 AssertRC(rc); 155 pDir->hDir = MY_INVALID_HANDLE_VALUE;155 pDir->hDir = RTNT_INVALID_HANDLE_VALUE; 156 156 } 157 157 RTStrFree(pDir->pszName); … … 281 281 */ 282 282 NTSTATUS rcNt; 283 IO_STATUS_BLOCK Ios = MY_IO_STATUS_BLOCK_INITIALIZER;283 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 284 284 if (pThis->enmInfoClass != (FILE_INFORMATION_CLASS)0) 285 285 { -
trunk/src/VBox/Runtime/r3/nt/fs-nt.cpp
r48935 r49150 53 53 */ 54 54 HANDLE hFile; 55 int rc = rtNtPathOpen(pszFsPath,55 int rc = RTNtPathOpen(pszFsPath, 56 56 GENERIC_READ, 57 57 FILE_ATTRIBUTE_NORMAL, … … 68 68 */ 69 69 FILE_FS_SIZE_INFORMATION FsSizeInfo; 70 IO_STATUS_BLOCK Ios = MY_IO_STATUS_BLOCK_INITIALIZER;70 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 71 71 NTSTATUS rcNt = NtQueryVolumeInformationFile(hFile, &Ios, &FsSizeInfo, sizeof(FsSizeInfo), FileFsSizeInformation); 72 72 if (NT_SUCCESS(rcNt)) … … 108 108 rc = RTErrConvertFromNtStatus(rcNt); 109 109 110 rtNtPathClose(hFile);110 RTNtPathClose(hFile); 111 111 } 112 112 return rc; … … 126 126 */ 127 127 HANDLE hFile; 128 int rc = rtNtPathOpen(pszFsPath,128 int rc = RTNtPathOpen(pszFsPath, 129 129 GENERIC_READ, 130 130 FILE_ATTRIBUTE_NORMAL, … … 145 145 uint8_t abBuf[sizeof(FILE_FS_VOLUME_INFORMATION) + 4096]; 146 146 } u; 147 IO_STATUS_BLOCK Ios = MY_IO_STATUS_BLOCK_INITIALIZER;147 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 148 148 NTSTATUS rcNt = NtQueryVolumeInformationFile(hFile, &Ios, &u, sizeof(u), FileFsVolumeInformation); 149 149 if (NT_SUCCESS(rcNt)) … … 152 152 rc = RTErrConvertFromNtStatus(rcNt); 153 153 154 rtNtPathClose(hFile);154 RTNtPathClose(hFile); 155 155 } 156 156 return rc; … … 170 170 */ 171 171 HANDLE hFile; 172 int rc = rtNtPathOpen(pszFsPath,172 int rc = RTNtPathOpen(pszFsPath, 173 173 GENERIC_READ, 174 174 FILE_ATTRIBUTE_NORMAL, … … 189 189 uint8_t abBuf[sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 4096]; 190 190 } u; 191 IO_STATUS_BLOCK Ios = MY_IO_STATUS_BLOCK_INITIALIZER;191 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 192 192 NTSTATUS rcNt = NtQueryVolumeInformationFile(hFile, &Ios, &u, sizeof(u), FileFsAttributeInformation); 193 193 if (NT_SUCCESS(rcNt)) … … 220 220 rc = RTErrConvertFromNtStatus(rcNt); 221 221 222 rtNtPathClose(hFile);222 RTNtPathClose(hFile); 223 223 } 224 224 return rc; … … 240 240 */ 241 241 HANDLE hFile; 242 int rc = rtNtPathOpen(pszFsPath,242 int rc = RTNtPathOpen(pszFsPath, 243 243 GENERIC_READ, 244 244 FILE_ATTRIBUTE_NORMAL, … … 259 259 uint8_t abBuf[sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 4096]; 260 260 } u; 261 IO_STATUS_BLOCK Ios = MY_IO_STATUS_BLOCK_INITIALIZER;261 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 262 262 NTSTATUS rcNt = NtQueryVolumeInformationFile(hFile, &Ios, &u, sizeof(u), FileFsAttributeInformation); 263 263 if (NT_SUCCESS(rcNt)) … … 278 278 rc = RTErrConvertFromNtStatus(rcNt); 279 279 280 rtNtPathClose(hFile);281 } 282 return rc; 283 } 284 280 RTNtPathClose(hFile); 281 } 282 return rc; 283 } 284 -
trunk/src/VBox/Runtime/r3/nt/internal-r3-nt.h
r47535 r49150 5 5 6 6 /* 7 * Copyright (C) 2010-201 2Oracle Corporation7 * Copyright (C) 2010-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 30 31 31 32 /******************************************************************************* 33 * Header Files * 34 *******************************************************************************/ 35 #include <ntstatus.h> 36 #ifdef IPRT_NT_USE_WINTERNL 37 # define WIN32_NO_STATUS 38 # include <windef.h> 39 # include <winnt.h> 40 # include <winternl.h> 41 # define IPRT_NT_NEED_API_GROUP_1 42 43 #elif defined(IPRT_NT_USE_WDM) 44 # include <wdm.h> 45 # define IPRT_NT_NEED_API_GROUP_1 46 47 #else 48 # include <ntifs.h> 49 #endif 32 #include <iprt/nt/nt.h> 50 33 #include "internal/iprt.h" 51 34 52 53 /*******************************************************************************54 * Defined Constants And Macros *55 *******************************************************************************/56 /** Indicates that we're targetting native NT in the current source. */57 #define RT_USE_NATIVE_NT 158 /** Initializes a IO_STATUS_BLOCK. */59 #define MY_IO_STATUS_BLOCK_INITIALIZER { STATUS_FAILED_DRIVER_ENTRY, ~(uintptr_t)42 }60 /** Similar to INVALID_HANDLE_VALUE in the Windows environment. */61 #define MY_INVALID_HANDLE_VALUE ( (HANDLE)~(uintptr_t)0 )62 35 63 36 #ifdef DEBUG_bird … … 66 39 # define IPRT_WITH_NT_PATH_PASSTHRU 1 67 40 #endif 68 69 70 /*******************************************************************************71 * Internal Functions *72 *******************************************************************************/73 int rtNtPathOpen(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess,74 ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs,75 PHANDLE phHandle, PULONG_PTR puDisposition);76 int rtNtPathOpenDir(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fShareAccess, ULONG fCreateOptions,77 ULONG fObjAttribs, PHANDLE phHandle, bool *pfObjDir);78 int rtNtPathClose(HANDLE hHandle);79 41 80 42 … … 102 64 } 103 65 104 105 /*******************************************************************************106 * NT APIs *107 *******************************************************************************/108 109 RT_C_DECLS_BEGIN110 111 #ifdef IPRT_NT_NEED_API_GROUP_1112 113 typedef struct _FILE_FS_ATTRIBUTE_INFORMATION114 {115 ULONG FileSystemAttributes;116 LONG MaximumComponentNameLength;117 ULONG FileSystemNameLength;118 WCHAR FileSystemName[1];119 } FILE_FS_ATTRIBUTE_INFORMATION;120 typedef FILE_FS_ATTRIBUTE_INFORMATION *PFILE_FS_ATTRIBUTE_INFORMATION;121 extern "C" NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, FS_INFORMATION_CLASS);122 123 66 #endif 124 67 125 NTSTATUS NTAPI NtOpenDirectoryObject(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);126 127 typedef struct _OBJECT_DIRECTORY_INFORMATION128 {129 UNICODE_STRING Name;130 UNICODE_STRING TypeName;131 } OBJECT_DIRECTORY_INFORMATION;132 typedef OBJECT_DIRECTORY_INFORMATION *POBJECT_DIRECTORY_INFORMATION;133 134 NTSTATUS NTAPI NtQueryDirectoryObject(HANDLE, PVOID, ULONG, BOOLEAN, BOOLEAN, PULONG, PULONG);135 136 137 RT_C_DECLS_END138 139 #endif140 -
trunk/src/VBox/Runtime/r3/nt/pathint-nt.cpp
r47535 r49150 203 203 * @param puAction Where to return the action taken. Optional. 204 204 */ 205 int rtNtPathOpen(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess,206 ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs,207 PHANDLE phHandle, PULONG_PTR puAction)208 { 209 *phHandle = MY_INVALID_HANDLE_VALUE;205 RTDECL(int) RTNtPathOpen(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess, 206 ULONG fCreateDisposition, ULONG fCreateOptions, ULONG fObjAttribs, 207 PHANDLE phHandle, PULONG_PTR puAction) 208 { 209 *phHandle = RTNT_INVALID_HANDLE_VALUE; 210 210 211 211 HANDLE hRootDir; … … 214 214 if (RT_SUCCESS(rc)) 215 215 { 216 HANDLE hFile = MY_INVALID_HANDLE_VALUE;217 IO_STATUS_BLOCK Ios = MY_IO_STATUS_BLOCK_INITIALIZER;216 HANDLE hFile = RTNT_INVALID_HANDLE_VALUE; 217 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 218 218 OBJECT_ATTRIBUTES ObjAttr; 219 219 InitializeObjectAttributes(&ObjAttr, &NtName, fObjAttribs, hRootDir, NULL); … … 263 263 * directory). 264 264 */ 265 int rtNtPathOpenDir(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fShareAccess, ULONG fCreateOptions,266 ULONG fObjAttribs, PHANDLE phHandle, bool *pfObjDir)267 { 268 *phHandle = MY_INVALID_HANDLE_VALUE;265 RTDECL(int) RTNtPathOpenDir(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fShareAccess, ULONG fCreateOptions, 266 ULONG fObjAttribs, PHANDLE phHandle, bool *pfObjDir) 267 { 268 *phHandle = RTNT_INVALID_HANDLE_VALUE; 269 269 270 270 HANDLE hRootDir; … … 273 273 if (RT_SUCCESS(rc)) 274 274 { 275 HANDLE hFile = MY_INVALID_HANDLE_VALUE;276 IO_STATUS_BLOCK Ios = MY_IO_STATUS_BLOCK_INITIALIZER;275 HANDLE hFile = RTNT_INVALID_HANDLE_VALUE; 276 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 277 277 OBJECT_ATTRIBUTES ObjAttr; 278 278 InitializeObjectAttributes(&ObjAttr, &NtName, fObjAttribs, hRootDir, NULL); … … 347 347 * @param hHandle The handle value. 348 348 */ 349 int rtNtPathClose(HANDLE hHandle)349 RTDECL(int) RTNtPathClose(HANDLE hHandle) 350 350 { 351 351 NTSTATUS rcNt = NtClose(hHandle);
Note:
See TracChangeset
for help on using the changeset viewer.