Fix the following code:
+ HMODULE hndlShell32;
+ lpSHGetKnownFolderPath pSHGetKnownFolderPath;
+ TString tmpDir;
+
+ hndlShell32 = ::LoadLibrary(L"shell32");
+ if (NULL != hndlShell32) {
+
+ pSHGetKnownFolderPath = (lpSHGetKnownFolderPath)
+ GetProcAddress(hndlShell32, "SHGetKnownFolderPath");
+
+ if (pSHGetKnownFolderPath != NULL) {
+ PWSTR userDir = 0;
+ if (SUCCEEDED(pSHGetKnownFolderPath(
+ FOLDERID_Profile,
+ 0,
+ NULL,
+ &userDir))) {
+ tmpDir = userDir;
+ tmpDir += WINDOWS_PACKAGER_TMP_DIR;
+ CoTaskMemFree(userDir);
+ }
+ }
+ FreeLibrary(hndlShell32);
+ }
+ return tmpDir;
+}
+ HMODULE hndlShell32;
+ lpSHGetKnownFolderPath pSHGetKnownFolderPath;
+ TString tmpDir;
+
+ hndlShell32 = ::LoadLibrary(L"shell32");
+ if (NULL != hndlShell32) {
+
+ pSHGetKnownFolderPath = (lpSHGetKnownFolderPath)
+ GetProcAddress(hndlShell32, "SHGetKnownFolderPath");
+
+ if (pSHGetKnownFolderPath != NULL) {
+ PWSTR userDir = 0;
+ if (SUCCEEDED(pSHGetKnownFolderPath(
+ FOLDERID_Profile,
+ 0,
+ NULL,
+ &userDir))) {
+ tmpDir = userDir;
+ tmpDir += WINDOWS_PACKAGER_TMP_DIR;
+ CoTaskMemFree(userDir);
+ }
+ }
+ FreeLibrary(hndlShell32);
+ }
+ return tmpDir;
+}