diff options
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r-- | src/Common/Dlgcode.c | 88 |
1 files changed, 45 insertions, 43 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index ba0173ac..e56c6b46 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -16,2 +16,3 @@ #include <windowsx.h> +#include <versionhelpers.h> #include <dbghelp.h> @@ -1085,5 +1086,2 @@ static BOOL GetWindowsVersion(LPOSVERSIONINFOW lpVersionInformation) - if (!bRet) - bRet = GetVersionExW (lpVersionInformation); - #ifdef SETUP_DLL @@ -3168,3 +3166,3 @@ BOOL LaunchElevatedProcess (HWND hwndDlg, const wchar_t* szModPath, const wchar_ - if ((int)ShellExecuteW (hWnd, L"runas", szModPath, newCmdLine, NULL, SW_SHOWNORMAL) <= 32) + if ((INT_PTR)ShellExecuteW (hWnd, L"runas", szModPath, newCmdLine, NULL, SW_SHOWNORMAL) <= 32) { @@ -3913,3 +3911,3 @@ BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize) DWORD fileSystemFlags; - wchar_t root[] = { L'A' + (wchar_t) driveNo, L':', L'\\', 0 }; + wchar_t root[] = { (wchar_t) (L'A' + driveNo), L':', L'\\', 0 }; @@ -3943,3 +3941,4 @@ BOOL GetSysDevicePaths (HWND hwndDlg) // Find extra boot partition - foreach (const HostDevice &drive, GetAvailableHostDevices (false, false)) + std::vector <HostDevice> devices = GetAvailableHostDevices(false, false); + for (const HostDevice& drive : devices) { @@ -3947,3 +3946,3 @@ BOOL GetSysDevicePaths (HWND hwndDlg) { - foreach (const HostDevice &sysDrivePartition, drive.Partitions) + for (const HostDevice &sysDrivePartition : drive.Partitions) { @@ -5391,3 +5390,3 @@ BOOL SelectMultipleFiles(HWND hwndDlg, const char *stringId, BOOL keepHistory, s -BOOL BrowseDirectories(HWND hwndDlg, char *lpszTitle, wchar_t *dirName, const wchar_t *initialDir) +BOOL BrowseDirectories(HWND hwndDlg, char *lpszDlgTitle, wchar_t *dirName, const wchar_t *initialDir) { @@ -5416,5 +5415,5 @@ BOOL BrowseDirectories(HWND hwndDlg, char *lpszTitle, wchar_t *dirName, const wc // Set the title. - if (lpszTitle) + if (lpszDlgTitle) { - pfd->SetTitle(GetString(lpszTitle)); + pfd->SetTitle(GetString(lpszDlgTitle)); } @@ -5756,3 +5755,3 @@ BOOL UpdateDriveCustomLabel (int driveNo, wchar_t* effectiveLabel, BOOL bSetValu wchar_t wszRegPath[MAX_PATH]; - wchar_t driveStr[] = {L'A' + (wchar_t) driveNo, 0}; + wchar_t driveStr[] = { (wchar_t) (L'A' + driveNo), 0}; HKEY hKey; @@ -8258,3 +8257,3 @@ void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap) { - wchar_t root[] = { (wchar_t) i + L'A', L':', L'\\', 0 }; + wchar_t root[] = { (wchar_t) (i + L'A'), L':', L'\\', 0 }; SHChangeNotify (eventId, SHCNF_PATH, root, NULL); @@ -8815,3 +8814,3 @@ retry: VOLUME_DISK_EXTENTS extents = {0}; - DWORD dwResult = 0; + DWORD cbReturnedBytes = 0; drivePath[4] = root[0]; @@ -8820,3 +8819,3 @@ retry: { - if (DeviceIoControl (dev, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, &extents, sizeof(extents), &dwResult, NULL)) + if (DeviceIoControl (dev, IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, NULL, 0, &extents, sizeof(extents), &cbReturnedBytes, NULL)) { @@ -8957,5 +8956,5 @@ retry: { - int driveNo; + int diskNo; - if (swscanf (volumePath, L"\\Device\\Harddisk%d\\Partition", &driveNo) == 1) + if (swscanf (volumePath, L"\\Device\\Harddisk%d\\Partition", &diskNo) == 1) { @@ -8965,6 +8964,6 @@ retry: openTestStruct.bDetectTCBootLoader = TRUE; - StringCchPrintfW ((wchar_t *) openTestStruct.wszFileName, array_capacity (openTestStruct.wszFileName), L"\\Device\\Harddisk%d\\Partition0", driveNo); + StringCchPrintfW ((wchar_t *) openTestStruct.wszFileName, array_capacity (openTestStruct.wszFileName), L"\\Device\\Harddisk%d\\Partition0", diskNo); - DWORD dwResult; - if (DeviceIoControl (hDriver, TC_IOCTL_OPEN_TEST, &openTestStruct, sizeof (OPEN_TEST_STRUCT), &openTestStruct, sizeof (OPEN_TEST_STRUCT), &dwResult, NULL) && openTestStruct.TCBootLoaderDetected) + DWORD cbBytesReturned; + if (DeviceIoControl (hDriver, TC_IOCTL_OPEN_TEST, &openTestStruct, sizeof (OPEN_TEST_STRUCT), &openTestStruct, sizeof (OPEN_TEST_STRUCT), &cbBytesReturned, NULL) && openTestStruct.TCBootLoaderDetected) WarningDirect ((GetWrongPasswordErrorMessage (hwndDlg) + L"\n\n" + GetString ("HIDDEN_VOL_PROT_PASSWORD_US_KEYB_LAYOUT")).c_str(), hwndDlg); @@ -9007,3 +9006,3 @@ retry: wchar_t msg[1024]; - wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 }; + wchar_t mountPoint[] = { (wchar_t) (L'A' + driveNo), L':', 0 }; StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_VOLUME_DIRTY"), mountPoint); @@ -9021,3 +9020,3 @@ retry: wchar_t msg[1024]; - wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 }; + wchar_t mountPoint[] = { (wchar_t) (L'A' + driveNo), L':', 0 }; StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_CONTAINER_FORCED_READ_ONLY"), mountPoint); @@ -9032,3 +9031,3 @@ retry: wchar_t msg[1024]; - wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 }; + wchar_t mountPoint[] = { (wchar_t)(L'A' + driveNo), L':', 0 }; StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_DEVICE_FORCED_READ_ONLY"), mountPoint); @@ -9043,3 +9042,3 @@ retry: wchar_t msg[1024]; - wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 }; + wchar_t mountPoint[] = { (wchar_t) (L'A' + driveNo), L':', 0 }; StringCbPrintfW (msg, sizeof(msg), GetString ("MOUNTED_DEVICE_FORCED_READ_ONLY_WRITE_PROTECTION"), mountPoint); @@ -9061,3 +9060,3 @@ retry: wchar_t msg[1024]; - wchar_t mountPoint[] = { L'A' + (wchar_t) driveNo, L':', 0 }; + wchar_t mountPoint[] = { (wchar_t) (L'A' + driveNo), L':', 0 }; StringCbPrintfW (msg, sizeof(msg), GetString ("PARTIAL_SYSENC_MOUNT_READONLY"), mountPoint); @@ -9154,3 +9153,3 @@ retry: // Undo SHCNE_DRIVEREMOVED - wchar_t root[] = { (wchar_t) nDosDriveNo + L'A', L':', L'\\', 0 }; + wchar_t root[] = { (wchar_t) (nDosDriveNo + L'A'), L':', L'\\', 0 }; SHChangeNotify (SHCNE_DRIVEADD, SHCNF_PATH, root, NULL); @@ -9508,3 +9507,3 @@ int GetDiskDeviceDriveLetter (PWSTR deviceName) { - WCHAR drive[] = { (WCHAR) i + L'A', L':', 0 }; + WCHAR drive[] = { (WCHAR) (i + L'A'), L':', 0 }; @@ -10706,3 +10705,3 @@ void OpenPageHelp (HWND hwndDlg, int nPage) { - int r = (int)ShellExecuteW (NULL, L"open", szHelpFile, NULL, NULL, SW_SHOWNORMAL); + INT_PTR r = (INT_PTR)ShellExecuteW (NULL, L"open", szHelpFile, NULL, NULL, SW_SHOWNORMAL); @@ -10711,3 +10710,3 @@ void OpenPageHelp (HWND hwndDlg, int nPage) // Try the secondary help file - r = (int)ShellExecuteW (NULL, L"open", szHelpFile2, NULL, NULL, SW_SHOWNORMAL); + r = (INT_PTR)ShellExecuteW (NULL, L"open", szHelpFile2, NULL, NULL, SW_SHOWNORMAL); @@ -10938,7 +10937,3 @@ BOOL IsServerOS () { - OSVERSIONINFOEXW osVer; - osVer.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW); - GetVersionExW ((LPOSVERSIONINFOW) &osVer); - - return (osVer.wProductType == VER_NT_SERVER || osVer.wProductType == VER_NT_DOMAIN_CONTROLLER); + return IsWindowsServer()? TRUE : FALSE; } @@ -10946,2 +10941,3 @@ BOOL IsServerOS () + // Returns TRUE, if the currently running operating system is installed in a hidden volume. If it's not, or if @@ -11020,5 +11016,6 @@ std::wstring GetWindowsEdition () - OSVERSIONINFOEXW osVer; + OSVERSIONINFOEXW osVer = { 0 }; osVer.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW); - GetVersionExW ((LPOSVERSIONINFOW) &osVer); + if (GetWindowsVersion((LPOSVERSIONINFOW)&osVer)) + { @@ -11115,2 +11112,7 @@ std::wstring GetWindowsEdition () } + else + { + return L""; + } +} @@ -11126,3 +11128,3 @@ void Applink (const char *dest) BOOL buildUrl = TRUE; - int r; + INT_PTR r; @@ -11330,3 +11332,3 @@ void Applink (const char *dest) { - r = (int) ShellExecuteW (NULL, L"open", url, NULL, NULL, SW_SHOWNORMAL); + r = (INT_PTR) ShellExecuteW (NULL, L"open", url, NULL, NULL, SW_SHOWNORMAL); @@ -13056,3 +13058,3 @@ void CheckFilesystem (HWND hwndDlg, int driveNo, BOOL fixErrors) wchar_t msg[1024], param[1024], cmdPath[MAX_PATH]; - wchar_t driveRoot[] = { L'A' + (wchar_t) driveNo, L':', 0 }; + wchar_t driveRoot[] = { (wchar_t) (L'A' + driveNo), L':', 0 }; @@ -13302,3 +13304,3 @@ BOOL LaunchWindowsIsoBurner (HWND hwnd, const wchar_t *isoPath) wchar_t path[MAX_PATH*2] = { 0 }; - int r; + INT_PTR r; @@ -13309,3 +13311,3 @@ BOOL LaunchWindowsIsoBurner (HWND hwnd, const wchar_t *isoPath) - r = (int) ShellExecute (hwnd, L"open", path, (wstring (L"\"") + isoPath + L"\"").c_str(), NULL, SW_SHOWNORMAL); + r = (INT_PTR) ShellExecute (hwnd, L"open", path, (wstring (L"\"") + isoPath + L"\"").c_str(), NULL, SW_SHOWNORMAL); @@ -13313,3 +13315,3 @@ BOOL LaunchWindowsIsoBurner (HWND hwnd, const wchar_t *isoPath) { - SetLastError (r); + SetLastError ((DWORD) r); handleWin32Error (hwnd, SRC_POS); @@ -15261,3 +15263,3 @@ DWORD PasswordEditDropTarget::GotEnter(void) TCHAR szClassName[64]; - DWORD dwStyles; + DWORD_PTR dwStyles; int maxLen; @@ -15287,3 +15289,3 @@ void PasswordEditDropTarget::GotDrop(CLIPFORMAT format) TCHAR szClassName[64]; - DWORD dwStyles; + DWORD_PTR dwStyles; int maxLen; |