mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
- avoid using BringWindowToTop as it creates display problems
- build a custom function GetRegValue to allow dxdiag be used on older Windows versions - try to fix potential buffer overflows svn path=/trunk/; revision=33050
This commit is contained in:
parent
6061afd624
commit
28c134ec41
3 changed files with 47 additions and 26 deletions
|
@ -66,9 +66,6 @@ TabCtrl_OnSelChange(PDXDIAG_CONTEXT pContext)
|
|||
else
|
||||
ShowWindow(pContext->hDialogs[Index], SW_HIDE);
|
||||
}
|
||||
|
||||
/* make sure its displayed */
|
||||
BringWindowToTop(pContext->hDialogs[CurSel]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -190,7 +187,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
UNREFERENCED_PARAMETER(nCmdShow);
|
||||
|
||||
InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||
InitControls.dwICC = ICC_TAB_CLASSES | ICC_LISTVIEW_CLASSES;
|
||||
InitControls.dwICC = ICC_TAB_CLASSES | ICC_LISTVIEW_CLASSES | ICC_STANDARD_CLASSES;
|
||||
InitCommonControlsEx(&InitControls);
|
||||
|
||||
hInst = hInstance;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
typedef struct
|
||||
|
@ -27,6 +26,7 @@ INT_PTR CALLBACK MusicPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
|
|||
INT_PTR CALLBACK InputPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR CALLBACK NetworkPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
INT_PTR CALLBACK HelpPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
BOOL GetRegValue(HKEY hBaseKey, LPWSTR SubKey, LPWSTR ValueName, DWORD Type, LPWSTR Result, DWORD Size);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -9,14 +9,40 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
BOOL
|
||||
GetRegValue(HKEY hBaseKey, LPWSTR SubKey, LPWSTR ValueName, DWORD Type, LPWSTR Result, DWORD Size)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG res;
|
||||
DWORD dwType;
|
||||
DWORD dwSize;
|
||||
|
||||
|
||||
if (RegOpenKeyExW(hBaseKey, SubKey, 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
dwSize = Size;
|
||||
res = RegQueryValueExW(hKey, ValueName, NULL, &dwType, (LPBYTE)Result, &dwSize);
|
||||
RegCloseKey(hKey);
|
||||
|
||||
if (dwType != Type)
|
||||
return FALSE;
|
||||
|
||||
if (res != ERROR_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
Result[(Size / sizeof(WCHAR))-1] = L'\0';
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
BOOL
|
||||
GetDirectXVersion(WCHAR * szBuffer)
|
||||
{
|
||||
WCHAR szVer[20];
|
||||
DWORD dwVer = sizeof(szVer);
|
||||
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\DirectX", L"Version", RRF_RT_REG_SZ, NULL, szVer, &dwVer) != ERROR_SUCCESS)
|
||||
if (!GetRegValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\DirectX", L"Version", REG_SZ, szVer, sizeof(szVer)))
|
||||
return FALSE;
|
||||
|
||||
if(!wcscmp(szVer, L"4.02.0095"))
|
||||
|
@ -218,8 +244,7 @@ InitializeSystemPage(HWND hwndDlg)
|
|||
|
||||
/* set system manufacturer */
|
||||
szTime[0] = L'\0';
|
||||
Length = sizeof(szTime) / sizeof(WCHAR);
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemManufacturer", RRF_RT_REG_SZ, NULL, szTime, &Length) == ERROR_SUCCESS)
|
||||
if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemManufacturer", REG_SZ, szTime, sizeof(szTime)))
|
||||
{
|
||||
szTime[199] = L'\0';
|
||||
SendDlgItemMessageW(hwndDlg, IDC_STATIC_MANU, WM_SETTEXT, 0, (LPARAM)szTime);
|
||||
|
@ -227,37 +252,36 @@ InitializeSystemPage(HWND hwndDlg)
|
|||
|
||||
/* set motherboard model */
|
||||
szTime[0] = L'\0';
|
||||
Length = sizeof(szTime) / sizeof(WCHAR);
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemProductName", RRF_RT_REG_SZ, NULL, szTime, &Length) == ERROR_SUCCESS)
|
||||
if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemProductName", REG_SZ, szTime, sizeof(szTime)))
|
||||
{
|
||||
szTime[199] = L'\0';
|
||||
SendDlgItemMessageW(hwndDlg, IDC_STATIC_MODEL, WM_SETTEXT, 0, (LPARAM)szTime);
|
||||
}
|
||||
|
||||
/* set bios model */
|
||||
szTime[0] = L'\0';
|
||||
Length = sizeof(szTime) / sizeof(WCHAR);
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"BIOSVendor", RRF_RT_REG_SZ, NULL, szTime, &Length) == ERROR_SUCCESS)
|
||||
if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"BIOSVendor", REG_SZ, szTime, sizeof(szTime)))
|
||||
{
|
||||
DWORD Index;
|
||||
DWORD StrLength = (sizeof(szTime) / sizeof(WCHAR)) - (Length/sizeof(WCHAR));
|
||||
DWORD StrLength = (sizeof(szTime) / sizeof(WCHAR));
|
||||
|
||||
Index = (Length/sizeof(WCHAR));
|
||||
szTime[Index-1] = L' ';
|
||||
Index = wcslen(szTime);
|
||||
StrLength -= Index;
|
||||
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"BIOSReleaseDate", RRF_RT_REG_SZ, NULL, &szTime[Index], &StrLength) == ERROR_SUCCESS)
|
||||
if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"BIOSReleaseDate", REG_SZ, &szTime[Index], StrLength))
|
||||
{
|
||||
StrLength = (StrLength/sizeof(WCHAR));
|
||||
if (Index + StrLength > (sizeof(szTime)/sizeof(WCHAR))- 15)
|
||||
{
|
||||
//FIXME retrieve BiosMajorRelease, BiosMinorRelease
|
||||
//StrLength = wcslen(&szTime[Index]);
|
||||
//szTime[Index+StrLength] = L' ';
|
||||
//wcscpy(&szTime[Index+StrLength], L"Ver: "); //FIXME NON-NLS
|
||||
//szTime[(sizeof(szTime)/sizeof(WCHAR))-1] = L'\0';
|
||||
}
|
||||
SendDlgItemMessageW(hwndDlg, IDC_STATIC_BIOS, WM_SETTEXT, 0, (LPARAM)szTime);
|
||||
}
|
||||
szTime[Index+StrLength] = L' ';
|
||||
wcscpy(&szTime[Index+StrLength], L"Ver: "); //FIXME NON-NLS
|
||||
szTime[199] = L'\0';
|
||||
SendDlgItemMessageW(hwndDlg, IDC_STATIC_BIOS, WM_SETTEXT, 0, (LPARAM)szTime);
|
||||
//FIXME retrieve BiosMajorRelease, BiosMinorRelease
|
||||
}
|
||||
/* set processor string */
|
||||
Length = sizeof(szDesc);
|
||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\CentralProcessor\\0", L"ProcessorNameString", RRF_RT_REG_SZ, NULL, szDesc, &Length) == ERROR_SUCCESS)
|
||||
if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\CentralProcessor\\0", L"ProcessorNameString", REG_SZ, szDesc, sizeof(szDesc)))
|
||||
{
|
||||
/* FIXME retrieve current speed */
|
||||
szFormat[0] = L'\0';
|
||||
|
|
Loading…
Reference in a new issue