Changeset 36570 in vbox for trunk/src/VBox
- Timestamp:
- Apr 6, 2011 9:25:21 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71006
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Installer/InstallHelper/VBoxGuestInstallHelper.cpp
r36464 r36570 17 17 18 18 #include <windows.h> 19 #include <atlconv.h> 19 20 #include <stdlib.h> 20 21 #include <Strsafe.h> … … 27 28 HWND g_hwndParent; 28 29 29 typedef DWORD ( __stdcall*fnSfcFileException) (DWORD param1, PWCHAR param2, DWORD param3);30 typedef DWORD (WINAPI *fnSfcFileException) (DWORD param1, PWCHAR param2, DWORD param3); 30 31 fnSfcFileException g_pfnSfcFileException = NULL; 31 32 … … 76 77 *g_stacktop = pStack->next; 77 78 GlobalFree((HGLOBAL)pStack); 79 } 80 } 81 return hr; 82 } 83 84 void Char2WCharFree(PWCHAR pwString) 85 { 86 if (pwString) 87 HeapFree(GetProcessHeap(), 0, pwString); 88 } 89 90 HRESULT Char2WCharAlloc(const char *pszString, PWCHAR *ppwString) 91 { 92 HRESULT hr; 93 int iLen = strlen(pszString) + 2; 94 WCHAR *pwString = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, iLen * sizeof(WCHAR)); 95 if (!pwString) 96 hr = ERROR_NOT_ENOUGH_MEMORY; 97 else 98 { 99 if (MultiByteToWideChar(CP_ACP, 0, pszString, -1, pwString, iLen) == 0) 100 { 101 hr = HRESULT_FROM_WIN32(GetLastError()); 102 HeapFree(GetProcessHeap(), 0, pwString); 103 } 104 else 105 { 106 hr = S_OK; 107 *ppwString = pwString; 78 108 } 79 109 } … … 220 250 if (SUCCEEDED(hr)) 221 251 { 222 WCHAR wszFile[MAX_PATH + 1];223 hr = StringCchPrintfW(wszFile, sizeof(wszFile), L"%s",szFile);252 WCHAR *pwszFile; 253 hr = Char2WCharAlloc(szFile, &pwszFile); 224 254 if (SUCCEEDED(hr)) 225 hr = HRESULT_FROM_WIN32(g_pfnSfcFileException(0, wszFile, -1)); 255 { 256 if (g_pfnSfcFileException(0, pwszFile, -1) != 0) 257 hr = HRESULT_FROM_WIN32(GetLastError()); 258 Char2WCharFree(pwszFile); 259 } 226 260 } 227 261
Note:
See TracChangeset
for help on using the changeset viewer.