Changeset 36455 in vbox for trunk/src/VBox/Additions/WINNT/Installer/InstallHelper
- Timestamp:
- Mar 29, 2011 11:37:01 AM (14 years ago)
- File:
-
- 1 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
Note:
See TracChangeset
for help on using the changeset viewer.