Changeset 36879 in vbox
- Timestamp:
- Apr 29, 2011 9:15:52 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71457
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/path-win.cpp
r36675 r36879 37 37 #include <iprt/string.h> 38 38 #include <iprt/time.h> 39 #include <iprt/ldr.h> 39 40 #include <iprt/mem.h> 40 41 #include <iprt/param.h> … … 44 45 #include "internal/fs.h" 45 46 47 /* Needed for lazy loading SHGetFolderPathW in RTPathUserDocuments(). */ 48 typedef HRESULT FNSHGETFOLDERPATHW(HWND, int, HANDLE, DWORD, LPWSTR); 49 typedef FNSHGETFOLDERPATHW *PFNSHGETFOLDERPATHW; 46 50 47 51 /** … … 191 195 AssertReturn(cchPath, VERR_INVALID_PARAMETER); 192 196 193 RTUTF16 wszPath[RTPATH_MAX]; 194 HRESULT rc = SHGetFolderPathW(0, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, wszPath); 195 if ( rc == S_OK /* Found */ 196 || rc == S_FALSE) /* Found, but doesn't exists */ 197 /* 198 * Convert and return. 199 */ 200 return RTUtf16ToUtf8Ex(&wszPath[0], RTSTR_MAX, &pszPath, cchPath, NULL); 201 197 RTLDRMOD hShell32; 198 int rc = RTLdrLoad("Shell32.dll", &hShell32); 199 if (RT_SUCCESS(rc)) 200 { 201 PFNSHGETFOLDERPATHW pfnSHGetFolderPathW; 202 rc = RTLdrGetSymbol(hShell32, "SHGetFolderPathW", (void**)&pfnSHGetFolderPathW); 203 if (RT_SUCCESS(rc)) 204 { 205 RTUTF16 wszPath[RTPATH_MAX]; 206 HRESULT hrc = pfnSHGetFolderPathW(0, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, wszPath); 207 if ( hrc == S_OK /* Found */ 208 || hrc == S_FALSE) /* Found, but doesn't exist */ 209 { 210 /* 211 * Convert and return. 212 */ 213 RTLdrClose(hShell32); 214 return RTUtf16ToUtf8Ex(&wszPath[0], RTSTR_MAX, &pszPath, cchPath, NULL); 215 } 216 } 217 RTLdrClose(hShell32); 218 } 202 219 return VERR_PATH_NOT_FOUND; 203 220 }
Note:
See TracChangeset
for help on using the changeset viewer.