Author: janderwald Date: Tue May 6 02:46:58 2008 New Revision: 33313
URL: http://svn.reactos.org/svn/reactos?rev=33313&view=rev Log: - check for WHQL for display adapters (using d3d9) - destroy all dialogs on exit - fix a bug in destroying the dialogs - halfplement checking WHQL for audio drivers
Modified: trunk/reactos/base/applications/dxdiag/display.c trunk/reactos/base/applications/dxdiag/dxdiag.c trunk/reactos/base/applications/dxdiag/dxdiag.rbuild trunk/reactos/base/applications/dxdiag/precomp.h trunk/reactos/base/applications/dxdiag/sound.c
Modified: trunk/reactos/base/applications/dxdiag/display.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/di... ============================================================================== --- trunk/reactos/base/applications/dxdiag/display.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/dxdiag/display.c [iso-8859-1] Tue May 6 02:46:58 2008 @@ -215,6 +215,36 @@ HWND hDlgCtrls[5]; DWORD dwMemory; DEVMODE DevMode; + IDirect3D9 * ppObj; + D3DADAPTER_IDENTIFIER9 Identifier; + HRESULT hResult; + + szText[0] = L'\0'; + ppObj = Direct3DCreate9(D3D_SDK_VERSION); + if (ppObj) + { + hResult = IDirect3D9_GetAdapterIdentifier(ppObj, D3DADAPTER_DEFAULT , 2/*D3DENUM_WHQL_LEVEL*/, &Identifier); + if (hResult == D3D_OK) + { + + if (Identifier.WHQLLevel) + { + /* adapter is WHQL certified */ + LoadStringW(hInst, IDS_OPTION_YES, szText, sizeof(szText)/sizeof(WCHAR)); + } + else + { + LoadStringW(hInst, IDS_OPTION_NO, szText, sizeof(szText)/sizeof(WCHAR)); + } + } + IDirect3D9_Release(ppObj); + } + else + { + LoadStringW(hInst, IDS_DEVICE_STATUS_UNKNOWN, szText, sizeof(szText)/sizeof(WCHAR)); + } + szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0'; + SendDlgItemMessageW(hwndDlg, IDC_STATIC_ADAPTER_LOGO, WM_SETTEXT, 0, (LPARAM)szText);
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, &pDispDevice->DeviceKey[18], 0, KEY_READ, &hKey) != ERROR_SUCCESS) return FALSE;
Modified: trunk/reactos/base/applications/dxdiag/dxdiag.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/dx... ============================================================================== --- trunk/reactos/base/applications/dxdiag/dxdiag.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/dxdiag/dxdiag.c [iso-8859-1] Tue May 6 02:46:58 2008 @@ -19,11 +19,27 @@ { UINT Index;
- for(Index = 0; Index < 7; Index++) + /* destroy default dialogs */ + for(Index = 0; Index < sizeof(pContext->hDialogs) / sizeof(HWND); Index++) { if (pContext->hDialogs[Index]) DestroyWindow(pContext->hDialogs[Index]); } + + /* destroy display dialogs */ + for(Index = 0; Index < pContext->NumDisplayAdapter; Index++) + { + if (pContext->hDisplayWnd[Index]) + DestroyWindow(pContext->hDisplayWnd[Index]); + } + + /* destroy audio dialogs */ + for(Index = 0; Index < pContext->NumSoundAdapter; Index++) + { + if (pContext->hSoundWnd[Index]) + DestroyWindow(pContext->hSoundWnd[Index]); + } + }
//---------------------------------------------------------------
Modified: trunk/reactos/base/applications/dxdiag/dxdiag.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/dx... ============================================================================== --- trunk/reactos/base/applications/dxdiag/dxdiag.rbuild [iso-8859-1] (original) +++ trunk/reactos/base/applications/dxdiag/dxdiag.rbuild [iso-8859-1] Tue May 6 02:46:58 2008 @@ -20,6 +20,8 @@ <library>version</library> <library>gdi32</library> <library>winmm</library> + <library>wintrust</library> + <library>d3d9</library> <file>system.c</file> <file>display.c</file> <file>sound.c</file>
Modified: trunk/reactos/base/applications/dxdiag/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/pr... ============================================================================== --- trunk/reactos/base/applications/dxdiag/precomp.h [iso-8859-1] (original) +++ trunk/reactos/base/applications/dxdiag/precomp.h [iso-8859-1] Tue May 6 02:46:58 2008 @@ -13,10 +13,15 @@ #include <setupapi.h> #include <commctrl.h> #include <dinput.h> +#include <d3d9.h> #include <ddraw.h> +
#include <dsound.h> #include <mmreg.h> +#include <wintrust.h> +#include <softpub.h> +#include <mscat.h> #include "resource.h"
typedef struct @@ -28,10 +33,7 @@ ULONG NumSoundAdapter; HWND * hSoundWnd; HWND hDialogs[5]; - }DXDIAG_CONTEXT, *PDXDIAG_CONTEXT; - -
/* globals */ extern HINSTANCE hInst; @@ -44,10 +46,7 @@ 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);
-VOID InsertTabCtrlItem(HWND hDlgCtrl, INT Position, LPWSTR uId); -VOID EnumerateDrivers(PVOID Context, HDEVINFO hList, PSP_DEVINFO_DATA pInfoData); /* DirectDraw tests */ VOID DDTests();
@@ -57,6 +56,11 @@ /* display adapter initialization */ void InitializeDisplayAdapters(PDXDIAG_CONTEXT pContext);
+/* general functions */ BOOL GetFileVersion(LPCWSTR szAppName, WCHAR * szVer, DWORD szVerSize); BOOL GetFileModifyTime(LPCWSTR pFullPath, WCHAR * szTime, int szTimeSize); +BOOL GetCatFileFromDriverPath(LPWSTR szFileName, LPWSTR szCatFileName); +BOOL GetRegValue(HKEY hBaseKey, LPWSTR SubKey, LPWSTR ValueName, DWORD Type, LPWSTR Result, DWORD Size); +VOID InsertTabCtrlItem(HWND hDlgCtrl, INT Position, LPWSTR uId); +VOID EnumerateDrivers(PVOID Context, HDEVINFO hList, PSP_DEVINFO_DATA pInfoData); #endif
Modified: trunk/reactos/base/applications/dxdiag/sound.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/dxdiag/so... ============================================================================== --- trunk/reactos/base/applications/dxdiag/sound.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/dxdiag/sound.c [iso-8859-1] Tue May 6 02:46:58 2008 @@ -11,6 +11,91 @@ //#include <initguid.h> #include <devguid.h>
+#if 0 +BOOL +GetCatFileFromDriverPath(LPWSTR szFileName, LPWSTR szCatFileName) +{ + GUID VerifyGuid = DRIVER_ACTION_VERIFY; + HANDLE hFile; + DWORD dwHash; + BYTE bHash[100]; + HCATINFO hCatInfo; + HCATADMIN hActAdmin; + BOOL bRet = FALSE; + CATALOG_INFO CatInfo; + + /* attempt to open file */ + hFile = CreateFileW(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) + return FALSE; + + /* calculate hash from file handle */ + dwHash = sizeof(bHash); + if (!CryptCATAdminCalcHashFromFileHandle(hFile, &dwHash, bHash, 0)) + { + CloseHandle(hFile); + return FALSE; + } + + /* try open the CAT admin */ + if (!CryptCATAdminAcquireContext(&hActAdmin, &VerifyGuid, 0)) + { + CloseHandle(hFile); + return FALSE; + } + + /* search catalog to find for catalog containing this hash */ + hCatInfo = CryptCATAdminEnumCatalogFromHash(hActAdmin, bHash, dwHash, 0, NULL); + if (hCatInfo != NULL) + { + /* theres a catalog get the filename */ + bRet = CryptCATCatalogInfoFromContext(hCatInfo, &CatInfo, 0); + if (bRet) + wcscpy(szCatFileName, CatInfo.wszCatalogFile); + CryptCATAdminReleaseCatalogContext(hActAdmin, hCatInfo, 0); + } + + /* perform cleanup */ + CloseHandle(hFile); + CryptCATAdminReleaseContext(hActAdmin, 0); + return bRet; +} + +BOOL +IsDriverWHQL(LPWSTR szFileName) +{ + WCHAR szCatFile[MAX_PATH]; + HANDLE hCat; + BOOL bRet = FALSE; + + /* get the driver's cat file */ + if (!GetCatFileFromDriverPath(szFileName, szCatFile)) + { + /* driver has no cat so its definately not WHQL signed */ + return FALSE; + } + + /* open the CAT file */ + hCat = CryptCATOpen(szCatFile, CRYPTCAT_OPEN_EXISTING, 0, 0, 0); + if (hCat == INVALID_HANDLE_VALUE) + { + /* couldnt open cat */ + return FALSE; + } + + /* FIXME + * build certificate chain with CertGetCertificateChain + * verify certificate chain (WinVerifyTrust) + * retrieve signer (WTHelperGetProvSignerFromChain) + */ + + + /* close CAT file */ + CryptCATClose(hCat); + return bRet; +} +#endif + static void SetDeviceDetails(HWND hwndDlg, LPCGUID classGUID, LPCWSTR lpcstrDescription) @@ -18,11 +103,12 @@ HDEVINFO hInfo; DWORD dwIndex = 0; SP_DEVINFO_DATA InfoData; - WCHAR szText[100]; + WCHAR szText[30]; HWND hDlgCtrls[3]; WAVEOUTCAPSW waveOut; UINT numDev; MMRESULT errCode; +
/* enumerate waveout devices */ numDev = waveOutGetNumDevs(); @@ -107,6 +193,9 @@ HWND hwndDlg; WCHAR szSound[20]; WCHAR szText[30]; + IDirectSound8 *pObj; + HRESULT hResult; + DWORD dwCertified;
if (!lpGuid) return TRUE; @@ -123,6 +212,26 @@ hwndDlg = CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_SOUND_DIALOG), pContext->hMainDialog, SoundPageWndProc, (LPARAM)pContext); if (!hwndDlg) return FALSE; + + hResult = DirectSoundCreate8(lpGuid, (LPDIRECTSOUND8*)&pObj, NULL); + if (hResult == DS_OK) + { + szText[0] = L'\0'; + if (IDirectSound8_VerifyCertification(pObj, &dwCertified) == DS_OK) + { + if (dwCertified == DS_CERTIFIED) + LoadStringW(hInst, IDS_OPTION_YES, szText, sizeof(szText)/sizeof(WCHAR)); + else if (dwCertified == DS_UNCERTIFIED) + LoadStringW(hInst, IDS_OPTION_NO, szText, sizeof(szText)/sizeof(WCHAR)); + } + else + { + LoadStringW(hInst, IDS_OPTION_NO, szText, sizeof(szText)/sizeof(WCHAR)); + } + szText[(sizeof(szText)/sizeof(WCHAR))-1] = L'\0'; + SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_LOGO, WM_SETTEXT, 0, (LPARAM)szText); + IDirectSound8_Release(pObj); + }
/* set device name */ SendDlgItemMessageW(hwndDlg, IDC_STATIC_DSOUND_NAME, WM_SETTEXT, 0, (LPARAM)lpcstrDescription); @@ -156,10 +265,10 @@ void InitializeDirectSoundPage(PDXDIAG_CONTEXT pContext) { HRESULT hResult; - //IDirectSound8 *pObj; +
/* create DSound object */ -// hResult = DirectSoundCreate8(NULL, (LPDIRECTSOUND8*)&pObj, NULL); + // if (hResult != DS_OK) // return; hResult = DirectSoundEnumerateW(DSEnumCallback, pContext);