- Timestamp:
- Dec 20, 2019 3:46:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/VBoxGuestInstallHelper.cpp
r82627 r82629 62 62 HINSTANCE g_hInstance; 63 63 HWND g_hwndParent; 64 PFNSFCFILEEXCEPTION g_pfnSfcFileException = NULL;65 64 66 65 /** … … 241 240 if (RT_SUCCESS(rc)) 242 241 { 243 HMODULE hSFCNative = NULL; /* Native fallback. */244 245 242 RTLDRMOD hSFC; 246 rc = RTLdrLoadSystem("sfc_os.dll", true /* fNoUnload */, &hSFC);243 rc = RTLdrLoadSystem("sfc_os.dll", false /* fNoUnload */, &hSFC); 247 244 if (RT_SUCCESS(rc)) 248 245 { 249 rc = RTLdrGetSymbol(hSFC, "SfcFileException", (void **)&g_pfnSfcFileException); 246 PFNSFCFILEEXCEPTION pfnSfcFileException = NULL; 247 rc = RTLdrGetSymbol(hSFC, "SfcFileException", (void **)&pfnSfcFileException); 250 248 if (RT_FAILURE(rc)) 251 249 { 252 hSFCNative = (HMODULE)RTLdrGetNativeHandle(hSFC); 250 /* Native fallback. */ 251 HMODULE hSFCNative = (HMODULE)RTLdrGetNativeHandle(hSFC); 253 252 254 253 /* If we didn't get the proc address with the call above, try it harder with 255 254 * the (zero based) index of the function list (ordinal). */ 256 g_pfnSfcFileException = (PFNSFCFILEEXCEPTION)GetProcAddress(hSFCNative, (LPCSTR)5);257 if ( g_pfnSfcFileException)255 pfnSfcFileException = (PFNSFCFILEEXCEPTION)GetProcAddress(hSFCNative, (LPCSTR)5); 256 if (pfnSfcFileException) 258 257 rc = VINF_SUCCESS; 259 258 } 260 259 261 RTLdrClose(hSFC);262 }263 264 if (RT_SUCCESS(rc))265 {266 #ifndef UNICODE267 WCHAR *pwszFile;268 rc = vboxChar2WCharAlloc(szFile, &pwszFile);269 260 if (RT_SUCCESS(rc)) 270 261 { 262 #ifndef UNICODE 263 WCHAR *pwszFile; 264 rc = vboxChar2WCharAlloc(szFile, &pwszFile); 265 if (RT_SUCCESS(rc)) 266 { 271 267 #else 272 TCHAR *pwszFile = szFile;273 #endif 274 if (g_pfnSfcFileException(0, pwszFile, UINT32_MAX) != 0)275 rc = VERR_ACCESS_DENIED; /** @todo Find a better rc. */268 TCHAR *pwszFile = szFile; 269 #endif 270 if (pfnSfcFileException(0, pwszFile, UINT32_MAX) != 0) 271 rc = VERR_ACCESS_DENIED; /** @todo Find a better rc. */ 276 272 #ifndef UNICODE 277 vboxChar2WCharFree(pwszFile); 273 vboxChar2WCharFree(pwszFile); 274 } 275 #endif 278 276 } 279 #endif 280 } 281 282 if (hSFCNative) 283 FreeLibrary(hSFCNative); 277 278 RTLdrClose(hSFC); 279 } 284 280 } 285 281 … … 512 508 BOOL WINAPI DllMain(HANDLE hInst, ULONG uReason, LPVOID pReserved) 513 509 { 514 RT_NOREF(uReason, pReserved); 510 RT_NOREF(pReserved); 511 515 512 g_hInstance = (HINSTANCE)hInst; 513 514 switch (uReason) 515 { 516 case DLL_PROCESS_ATTACH: 517 RTR3InitDll(RTR3INIT_FLAGS_UNOBTRUSIVE); 518 break; 519 520 case DLL_PROCESS_DETACH: 521 break; 522 523 case DLL_THREAD_ATTACH: 524 break; 525 526 case DLL_THREAD_DETACH: 527 break; 528 529 default: 530 break; 531 } 532 516 533 return TRUE; 517 534 }
Note:
See TracChangeset
for help on using the changeset viewer.