ReactOS  0.4.12-dev-18-gf469aca
d3dtest.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactX Diagnosis Application
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: base/applications/dxdiag/d3dtest.c
5  * PURPOSE: ReactX Direct3D 7, 8 and 9 tests
6  * PROGRAMMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com>
7  */
8 
9 #include "precomp.h"
10 
11 #include <stdio.h>
12 
13 #define WIDTH 800
14 #define HEIGHT 600
15 
19 
21 {
22  WCHAR szTestDescriptionRaw[256];
23  WCHAR szTestDescription[256];
24  WCHAR szCaption[256];
25  WCHAR szResult[256];
26  WCHAR szError[256];
27  BOOL Result;
28 
29  LoadStringW(hInstance, IDS_MAIN_DIALOG, szCaption, sizeof(szCaption) / sizeof(WCHAR));
30  LoadStringW(hInstance, IDS_DDTEST_ERROR, szError, sizeof(szError) / sizeof(WCHAR));
31  LoadStringW(hInstance, IDS_D3DTEST_D3Dx, szTestDescriptionRaw, sizeof(szTestDescriptionRaw) / sizeof(WCHAR));
32  //LoadStringW(hInstance, resResult, szResult, sizeof(szResult) / sizeof(WCHAR));
33 
34  swprintf(szTestDescription, szTestDescriptionRaw, TestNr);
35  if (MessageBox(NULL, szTestDescription, szCaption, MB_YESNO | MB_ICONQUESTION) == IDNO)
36  return FALSE;
37 
38  ShowWindow(hWnd, SW_SHOW);
39 
40  switch(TestNr){
41  case 7:
42  Result = D3D7Test(hWnd);
43  break;
44  case 8:
45  Result = D3D8Test(hWnd);
46  break;
47  case 9:
48  Result = D3D9Test(hWnd);
49  break;
50  default:
51  Result = FALSE;
52  }
53 
54  ShowWindow(hWnd, SW_HIDE);
55 
56  if(!Result)
57  {
58  MessageBox(NULL, szError, szCaption, MB_OK | MB_ICONERROR);
59  return FALSE;
60  }
61 
62  if(MessageBox(NULL, szResult, szCaption, MB_YESNO | MB_ICONQUESTION) == IDYES)
63  return TRUE;
64 
65  return FALSE;
66 }
67 
69 {
70  return DefWindowProc(hWnd, msg, wParam, lParam);
71 }
72 
74 {
75  WNDCLASSEX winClass;
76  HWND hWnd;
78  WCHAR szDescription[256];
79  WCHAR szCaption[256];
80 
81  winClass.cbSize = sizeof(WNDCLASSEX);
83  winClass.lpfnWndProc = WindowProc;
84  winClass.cbClsExtra = 0;
85  winClass.cbWndExtra = 0;
86  winClass.hInstance = hInstance;
87  winClass.hIcon = 0;
88  winClass.hCursor = 0;
89  winClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
90  winClass.lpszMenuName = NULL;
91  winClass.lpszClassName = L"d3dtest";
92  winClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
93 
94  if (!RegisterClassEx(&winClass))
95  return;
96 
97  hWnd = CreateWindowEx(
98  0,
99  winClass.lpszClassName,
100  NULL,
101  WS_POPUP,
104  WIDTH,
105  HEIGHT,
106  NULL,
107  NULL,
108  hInstance,
109  NULL);
110 
111  if (!hWnd)
112  goto cleanup;
113 
114  LoadStringW(hInstance, IDS_D3DTEST_DESCRIPTION, szDescription, sizeof(szDescription) / sizeof(WCHAR));
115  LoadStringW(hInstance, IDS_MAIN_DIALOG, szCaption, sizeof(szCaption) / sizeof(WCHAR));
116  if(MessageBox(NULL, szDescription, szCaption, MB_YESNO | MB_ICONQUESTION) == IDNO)
117  goto cleanup;
118 
119  StartD3DTest(hWnd, hInstance, szCaption, 7);
120  StartD3DTest(hWnd, hInstance, szCaption, 8);
121  StartD3DTest(hWnd, hInstance, szCaption, 9);
122 
123 cleanup:
124  DestroyWindow(hWnd);
125  UnregisterClass(winClass.lpszClassName, hInstance);
126 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
UINT style
Definition: winuser.h:3155
LPCSTR lpszMenuName
Definition: winuser.h:3163
#define TRUE
Definition: types.h:120
#define RegisterClassEx
Definition: winuser.h:5703
HCURSOR hCursor
Definition: winuser.h:3161
WNDPROC lpfnWndProc
Definition: winuser.h:3156
#define IDYES
Definition: winuser.h:829
BOOL D3D8Test(HWND hWnd)
Definition: d3dtest8.c:11
LPCSTR lpszClassName
Definition: winuser.h:3164
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SW_HIDE
Definition: winuser.h:762
#define IDS_DDTEST_ERROR
Definition: resource.h:141
#define CALLBACK
Definition: compat.h:27
HWND hWnd
Definition: settings.c:17
#define CS_HREDRAW
Definition: winuser.h:648
BOOL D3D9Test(HWND hWnd)
Definition: d3dtest9.c:11
#define IDI_APPLICATION
Definition: winuser.h:699
HICON hIconSm
Definition: winuser.h:3165
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define CS_OWNDC
Definition: winuser.h:650
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
UINT_PTR WPARAM
Definition: windef.h:207
#define SM_CXSCREEN
Definition: winuser.h:949
HINSTANCE hInstance
Definition: charmap.c:20
#define MB_YESNO
Definition: winuser.h:811
HINSTANCE hInstance
Definition: winuser.h:3159
LONG_PTR LPARAM
Definition: windef.h:208
#define CreateWindowEx
Definition: winuser.h:5621
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: d3dtest.c:68
UINT msg
Definition: msvc.h:92
smooth NULL
Definition: ftsmooth.c:416
#define MB_ICONQUESTION
Definition: winuser.h:783
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
UINT cbSize
Definition: winuser.h:3154
#define SW_SHOW
Definition: winuser.h:769
HBRUSH hbrBackground
Definition: winuser.h:3162
#define DefWindowProc
Definition: ros2win.h:31
#define BLACK_BRUSH
Definition: wingdi.h:894
#define IDS_D3DTEST_DESCRIPTION
Definition: resource.h:153
#define CS_VREDRAW
Definition: winuser.h:653
#define SM_CYSCREEN
Definition: winuser.h:950
unsigned int BOOL
Definition: ntddk_ex.h:94
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned int UINT
Definition: ndis.h:50
int WINAPI GetSystemMetrics(_In_ int)
int cbWndExtra
Definition: winuser.h:3158
HICON hIcon
Definition: winuser.h:3160
static const WCHAR L[]
Definition: oid.c:1087
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5688
#define CS_DBLCLKS
Definition: winuser.h:646
BOOL StartD3DTest(HWND hWnd, HINSTANCE hInstance, WCHAR *pszCaption, INT TestNr)
Definition: d3dtest.c:20
#define IDS_D3DTEST_D3Dx
Definition: resource.h:154
int cbClsExtra
Definition: winuser.h:3157
BOOL D3D7Test(HWND hWnd)
Definition: d3dtest7.c:11
#define GetModuleHandle
Definition: winbase.h:3641
#define HEIGHT
Definition: d3dtest.c:14
#define WS_POPUP
Definition: pedump.c:616
#define MB_OK
Definition: winuser.h:784
#define WIDTH
Definition: d3dtest.c:13
VOID D3DTests()
Definition: d3dtest.c:73
char * cleanup(char *str)
Definition: wpickclick.c:99
WNDCLASSEXA WNDCLASSEX
Definition: winuser.h:5585
#define LoadIcon
Definition: winuser.h:5679
#define IDNO
Definition: winuser.h:830
LONG_PTR LRESULT
Definition: windef.h:209
#define IDS_MAIN_DIALOG
Definition: resource.h:103
#define UnregisterClass
Definition: winuser.h:5727
LPARAM lParam
Definition: combotst.c:139
static const WCHAR szDescription[]
Definition: provider.c:52