Changeset 36455 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Mar 29, 2011 11:37:01 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 70837
- Location:
- trunk/src/VBox/Additions/WINNT/Installer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/VBoxGuestInstallHelper.cpp
r35351 r36455 5 5 6 6 /* 7 * Copyright (C) 201 0Oracle Corporation7 * Copyright (C) 2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 26 26 HINSTANCE g_hInstance; 27 27 HWND g_hwndParent; 28 29 typedef DWORD (__stdcall *fnSfcFileException) (DWORD param1, PWCHAR param2, DWORD param3); 30 fnSfcFileException g_pfnSfcFileException = NULL; 28 31 29 32 #define VBOXINSTALLHELPER_EXPORT extern "C" void __declspec(dllexport) … … 181 184 } 182 185 186 /** 187 * Disables the Windows File Protection for a specified file 188 * using an undocumented SFC API call. Don't try this at home! 189 * 190 * @param hwndParent Window handle of parent. 191 * @param string_size Size of variable string. 192 * @param variables The actual variable string. 193 * @param stacktop Pointer to a pointer to the current stack. 194 */ 195 VBOXINSTALLHELPER_EXPORT DisableWFP(HWND hwndParent, int string_size, 196 TCHAR *variables, stack_t **stacktop) 197 { 198 TCHAR szFile[MAX_PATH + 1]; 199 HRESULT hr = VBoxPopString(szFile, sizeof(szFile) / sizeof(TCHAR)); 200 if (SUCCEEDED(hr)) 201 { 202 HMODULE hSFC = LoadLibrary("sfc_os.dll"); 203 if (NULL != hSFC) 204 { 205 g_pfnSfcFileException = (fnSfcFileException)GetProcAddress(hSFC, "SfcFileException"); 206 if (g_pfnSfcFileException == NULL) 207 { 208 /* If we didn't get the proc address with the call above, try it harder with 209 * the (zero based) index of the function list. */ 210 g_pfnSfcFileException = (fnSfcFileException)GetProcAddress(hSFC, (LPCSTR)5); 211 if (g_pfnSfcFileException == NULL) 212 hr = HRESULT_FROM_WIN32(ERROR_PROC_NOT_FOUND); 213 } 214 } 215 else 216 hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); 217 218 if (SUCCEEDED(hr)) 219 { 220 WCHAR wszFile[MAX_PATH + 1]; 221 hr = StringCchPrintfW(wszFile, sizeof(wszFile), L"%s", szFile); 222 if (SUCCEEDED(hr)) 223 hr = HRESULT_FROM_WIN32(g_pfnSfcFileException(0, wszFile, -1)); 224 } 225 226 if (hSFC) 227 FreeLibrary(hSFC); 228 } 229 230 /* Push simple return value on stack. */ 231 SUCCEEDED(hr) ? pushstring("0") : pushstring("1"); 232 } 233 -
trunk/src/VBox/Additions/WINNT/Installer/VBoxGuestAdditions.nsi
r36404 r36455 27 27 28 28 ; Defines for special functions 29 !define WHQL_FAKE ; Turns on the faking of non WHQL signed / approved drivers 30 ; Needs the VBoxWHQLFake.exe in the additions output directory! 29 !define WHQL_FAKE ; Enables faking of non WHQL signed / approved drivers 30 ; Needs the VBoxWHQLFake.exe in the additions output directory! 31 !define WFP_FILE_EXCEPTION ; Enables setting a temporary file exception for WFP proctected files 31 32 32 33 !define VENDOR_ROOT_KEY "SOFTWARE\$%VBOX_VENDOR_SHORT%" 33 34 35 ; Product defines 34 36 !define PRODUCT_NAME "$%VBOX_PRODUCT% Guest Additions" 35 37 !define PRODUCT_DESC "$%VBOX_PRODUCT% Guest Additions" … … 730 732 731 733 Pop $0 734 735 !if $%VBOX_WITH_GUEST_INSTALL_HELPER% == "1" 736 !ifdef WFP_FILE_EXCEPTION 737 VBoxGuestInstallHelper::DisableWFP "$0" 738 Pop $1 ; Get return value (ignored for now) 739 DetailPrint "Setting WFP exception for '$0': $1" 740 !endif 741 !endif 742 732 743 IfFileExists "$g_strSystemDir\takeown.exe" 0 +2 733 744 nsExec::ExecToLog '"$g_strSystemDir\takeown.exe" /F "$0"' … … 871 882 872 883 done: 884 885 !ifndef WFP_FILE_EXCEPTION 873 886 MessageBox MB_ICONINFORMATION|MB_OK $(VBOX_WFP_WARN_REPLACE) /SD IDOK 887 !endif 874 888 Goto exit 875 889
Note:
See TracChangeset
for help on using the changeset viewer.