mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 05:20:54 +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
|
else
|
||||||
ShowWindow(pContext->hDialogs[Index], SW_HIDE);
|
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);
|
UNREFERENCED_PARAMETER(nCmdShow);
|
||||||
|
|
||||||
InitControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
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);
|
InitCommonControlsEx(&InitControls);
|
||||||
|
|
||||||
hInst = hInstance;
|
hInst = hInstance;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
typedef struct
|
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 InputPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
INT_PTR CALLBACK NetworkPageWndProc(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);
|
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
|
#endif
|
||||||
|
|
|
@ -9,14 +9,40 @@
|
||||||
|
|
||||||
#include "precomp.h"
|
#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
|
static
|
||||||
BOOL
|
BOOL
|
||||||
GetDirectXVersion(WCHAR * szBuffer)
|
GetDirectXVersion(WCHAR * szBuffer)
|
||||||
{
|
{
|
||||||
WCHAR szVer[20];
|
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;
|
return FALSE;
|
||||||
|
|
||||||
if(!wcscmp(szVer, L"4.02.0095"))
|
if(!wcscmp(szVer, L"4.02.0095"))
|
||||||
|
@ -218,8 +244,7 @@ InitializeSystemPage(HWND hwndDlg)
|
||||||
|
|
||||||
/* set system manufacturer */
|
/* set system manufacturer */
|
||||||
szTime[0] = L'\0';
|
szTime[0] = L'\0';
|
||||||
Length = sizeof(szTime) / sizeof(WCHAR);
|
if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemManufacturer", REG_SZ, szTime, sizeof(szTime)))
|
||||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemManufacturer", RRF_RT_REG_SZ, NULL, szTime, &Length) == ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
szTime[199] = L'\0';
|
szTime[199] = L'\0';
|
||||||
SendDlgItemMessageW(hwndDlg, IDC_STATIC_MANU, WM_SETTEXT, 0, (LPARAM)szTime);
|
SendDlgItemMessageW(hwndDlg, IDC_STATIC_MANU, WM_SETTEXT, 0, (LPARAM)szTime);
|
||||||
|
@ -227,37 +252,36 @@ InitializeSystemPage(HWND hwndDlg)
|
||||||
|
|
||||||
/* set motherboard model */
|
/* set motherboard model */
|
||||||
szTime[0] = L'\0';
|
szTime[0] = L'\0';
|
||||||
Length = sizeof(szTime) / sizeof(WCHAR);
|
if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemProductName", REG_SZ, szTime, sizeof(szTime)))
|
||||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemProductName", RRF_RT_REG_SZ, NULL, szTime, &Length) == ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
szTime[199] = L'\0';
|
|
||||||
SendDlgItemMessageW(hwndDlg, IDC_STATIC_MODEL, WM_SETTEXT, 0, (LPARAM)szTime);
|
SendDlgItemMessageW(hwndDlg, IDC_STATIC_MODEL, WM_SETTEXT, 0, (LPARAM)szTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set bios model */
|
/* set bios model */
|
||||||
szTime[0] = L'\0';
|
szTime[0] = L'\0';
|
||||||
Length = sizeof(szTime) / sizeof(WCHAR);
|
if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"BIOSVendor", REG_SZ, szTime, sizeof(szTime)))
|
||||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"BIOSVendor", RRF_RT_REG_SZ, NULL, szTime, &Length) == ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
DWORD Index;
|
DWORD Index;
|
||||||
DWORD StrLength = (sizeof(szTime) / sizeof(WCHAR)) - (Length/sizeof(WCHAR));
|
DWORD StrLength = (sizeof(szTime) / sizeof(WCHAR));
|
||||||
|
|
||||||
Index = (Length/sizeof(WCHAR));
|
Index = wcslen(szTime);
|
||||||
szTime[Index-1] = L' ';
|
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 */
|
/* set processor string */
|
||||||
Length = sizeof(szDesc);
|
if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\CentralProcessor\\0", L"ProcessorNameString", REG_SZ, szDesc, sizeof(szDesc)))
|
||||||
if (RegGetValueW(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\CentralProcessor\\0", L"ProcessorNameString", RRF_RT_REG_SZ, NULL, szDesc, &Length) == ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
/* FIXME retrieve current speed */
|
/* FIXME retrieve current speed */
|
||||||
szFormat[0] = L'\0';
|
szFormat[0] = L'\0';
|
||||||
|
|
Loading…
Reference in a new issue