ReactOS 0.4.15-dev-5669-g09dde2c
provider.c File Reference
#include "initguid.h"
#include "wine/dxdiag.h"
#include "wine/test.h"
Include dependency graph for provider.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

static void test_Initialize (void)
 
static void test_GetRootContainer (void)
 
 START_TEST (provider)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file provider.c.

Function Documentation

◆ START_TEST()

START_TEST ( provider  )

Definition at line 154 of file provider.c.

155{
160}
#define NULL
Definition: types.h:112
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static void test_Initialize(void)
Definition: provider.c:27
static void test_GetRootContainer(void)
Definition: provider.c:93

◆ test_GetRootContainer()

static void test_GetRootContainer ( void  )
static

Definition at line 93 of file provider.c.

94{
95 HRESULT hr;
96 IDxDiagProvider *pddp;
97 IDxDiagContainer *pddc, *pddc2;
99
100 hr = CoCreateInstance(&CLSID_DxDiagProvider, NULL, CLSCTX_INPROC_SERVER,
101 &IID_IDxDiagProvider, (LPVOID*)&pddp);
102 ok(hr == S_OK ||
103 broken(hr == REGDB_E_CLASSNOTREG), /* Clean W2K3 */
104 "Creating a IDxDiagProvider instance failed with %x\n", hr);
105 if (FAILED(hr))
106 {
107 skip("Failed to create a IDxDiagProvider instance\n");
108 return;
109 }
110
111 /* Test calling IDxDiagProvider::GetRootContainer before initialization. */
114 "Expected IDxDiagProvider::GetRootContainer to return CO_E_NOTINITIALIZED, got %x\n", hr);
115
118 "Expected IDxDiagProvider::GetRootContainer to return CO_E_NOTINITIALIZED, got %x\n", hr);
119
120 params.dwSize = sizeof(params);
121 params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION;
122 params.bAllowWHQLChecks = FALSE;
123 params.pReserved = NULL;
125 ok(hr == S_OK, "Expected IDxDiagProvider::Initialize to return S_OK, got %x\n", hr);
126 if (FAILED(hr))
127 {
128 skip("IDxDiagProvider::Initialize failed\n");
130 return;
131 }
132
133 /* Passing NULL causes a crash on Windows. */
134 if (0)
135 {
137 trace("IDxDiagProvider::GetRootContainer returned %x\n", hr);
138 }
139
141 ok(hr == S_OK, "Expected IDxDiagProvider::GetRootContainer to return S_OK, got %x\n", hr);
142
143 /* IDxDiagProvider::GetRootContainer creates new instances of the root
144 * container rather than maintain a static root container. */
146 ok(hr == S_OK, "Expected IDxDiagProvider::GetRootContainer to return S_OK, got %x\n", hr);
147 ok(pddc != pddc2, "Expected the two pointers (%p vs. %p) to be unequal\n", pddc, pddc2);
148
152}
#define CO_E_NOTINITIALIZED
#define broken(x)
Definition: _sntprintf.h:21
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define FALSE
Definition: types.h:117
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define IDxDiagContainer_Release(p)
Definition: dxdiag.h:66
#define IDxDiagProvider_Release(p)
Definition: dxdiag.h:61
#define IDxDiagProvider_GetRootContainer(p, a)
Definition: dxdiag.h:63
#define DXDIAG_DX9_SDK_VERSION
Definition: dxdiag.h:6
#define IDxDiagProvider_Initialize(p, a, b)
Definition: dxdiag.h:62
GLenum const GLfloat * params
Definition: glext.h:5645
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
static IDxDiagContainer * pddc
Definition: container.c:35
static IDxDiagProvider * pddp
Definition: container.c:34
HRESULT hr
Definition: shlfolder.c:183
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696

Referenced by START_TEST().

◆ test_Initialize()

static void test_Initialize ( void  )
static

Definition at line 27 of file provider.c.

28{
29 HRESULT hr;
30 IDxDiagProvider *pddp;
32
33 hr = CoCreateInstance(&CLSID_DxDiagProvider, NULL, CLSCTX_INPROC_SERVER,
34 &IID_IDxDiagProvider, (LPVOID*)&pddp);
35 ok(hr == S_OK ||
36 broken(hr == REGDB_E_CLASSNOTREG), /* Clean W2K3 */
37 "Creating a IDxDiagProvider instance failed with %x\n", hr);
38 if (FAILED(hr))
39 {
40 skip("Failed to create a IDxDiagProvider instance\n");
41 return;
42 }
43
44 /* Test passing a NULL DXDIAG_INIT_PARAMS pointer. */
46 ok(hr == E_POINTER,
47 "Expected IDxDiagProvider::Initialize to return E_POINTER, got %x\n", hr);
48
49 /* Test passing invalid dwSize values. */
50 params.dwSize = 0;
53 "Expected IDxDiagProvider::Initialize to return E_INVALIDARG, got %x\n", hr);
54
55 params.dwSize = sizeof(params) + 1;
58 "Expected IDxDiagProvider::Initialize to return E_INVALIDARG, got %x\n", hr);
59
60 /* Test passing an unexpected dwDxDiagHeaderVersion value. */
61 params.dwSize = sizeof(params);
62 params.dwDxDiagHeaderVersion = 0;
63 params.bAllowWHQLChecks = FALSE;
64 params.pReserved = NULL;
67 "Expected IDxDiagProvider::Initialize to return E_INVALIDARG, got %x\n", hr);
68
69 /* Setting pReserved to a non-NULL value causes a crash on Windows. */
70 if (0)
71 {
72 params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION;
73 params.bAllowWHQLChecks = FALSE;
74 params.pReserved = (VOID*)0xdeadbeef;
76 trace("IDxDiagProvider::Initialize returned %x\n", hr);
77 }
78
79 /* Test passing an appropriately initialized DXDIAG_INIT_PARAMS. */
80 params.dwDxDiagHeaderVersion = DXDIAG_DX9_SDK_VERSION;
81 params.bAllowWHQLChecks = FALSE;
82 params.pReserved = NULL;
84 ok(hr == S_OK, "Expected IDxDiagProvider::Initialize to return S_OK, got %x\n", hr);
85
86 /* Test initializing multiple times. */
88 ok(hr == S_OK, "Expected IDxDiagProvider::Initialize to return S_OK, got %x\n", hr);
89
91}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_POINTER
Definition: winerror.h:2365

Referenced by START_TEST().