ReactOS 0.4.16-dev-297-gc569aee
services.c File Reference
#include <stdio.h>
#include "windows.h"
#include "objidl.h"
#include "wbemcli.h"
#include "wine/test.h"
Include dependency graph for services.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

static void test_IClientSecurity (void)
 
static void test_IWbemLocator (void)
 
 START_TEST (services)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file services.c.

Function Documentation

◆ START_TEST()

START_TEST ( services  )

Definition at line 180 of file services.c.

181{
186}
#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_IWbemLocator(void)
Definition: services.c:87
static void test_IClientSecurity(void)
Definition: services.c:27

◆ test_IClientSecurity()

static void test_IClientSecurity ( void  )
static

Definition at line 27 of file services.c.

28{
29 static const WCHAR rootW[] = {'R','O','O','T','\\','C','I','M','V','2',0};
30 HRESULT hr;
35 ULONG refs;
36
37 hr = CoCreateInstance( &CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (void **)&locator );
38 if (hr != S_OK)
39 {
40 win_skip("can't create instance of WbemLocator\n");
41 return;
42 }
43 ok( hr == S_OK, "failed to create IWbemLocator interface %08x\n", hr );
44
45 refs = IWbemLocator_Release( locator );
46 ok( refs == 0, "unexpected refcount %u\n", refs );
47
48 hr = CoCreateInstance( &CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (void **)&locator );
49 ok( hr == S_OK, "failed to create IWbemLocator interface %08x\n", hr );
50
51 hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services );
52 ok( hr == S_OK, "failed to get IWbemServices interface %08x\n", hr );
53
54 refs = IWbemServices_Release( services );
55 ok( refs == 0, "unexpected refcount %u\n", refs );
56
57 hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services );
58 ok( hr == S_OK, "failed to get IWbemServices interface %08x\n", hr );
59
60 hr = IWbemServices_QueryInterface( services, &IID_IClientSecurity, (void **)&security );
61 ok( hr == S_OK, "failed to query IClientSecurity interface %08x\n", hr );
62 ok( (void *)services != (void *)security, "expected pointers to be different\n" );
63
64 refs = IClientSecurity_Release( security );
65 ok( refs == 1, "unexpected refcount %u\n", refs );
66
67 refs = IWbemServices_Release( services );
68 ok( refs == 0, "unexpected refcount %u\n", refs );
69
70 hr = IWbemLocator_ConnectServer( locator, path, NULL, NULL, NULL, 0, NULL, NULL, &services );
71 ok( hr == S_OK, "failed to get IWbemServices interface %08x\n", hr );
72
73 hr = IWbemServices_QueryInterface( services, &IID_IClientSecurity, (void **)&security );
74 ok( hr == S_OK, "failed to query IClientSecurity interface %08x\n", hr );
75 ok( (void *)services != (void *)security, "expected pointers to be different\n" );
76
77 refs = IWbemServices_Release( services );
78 todo_wine ok( refs == 1, "unexpected refcount %u\n", refs );
79
80 refs = IClientSecurity_Release( security );
81 todo_wine ok( refs == 0, "unexpected refcount %u\n", refs );
82
83 IWbemLocator_Release( locator );
85}
#define ok(value,...)
Definition: atltest.h:57
static const WCHAR rootW[]
Definition: chain.c:69
OLECHAR * BSTR
Definition: compat.h:2293
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:52
#define todo_wine
Definition: custom.c:89
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define win_skip
Definition: test.h:163
HRESULT hr
Definition: shlfolder.c:183
uint32_t ULONG
Definition: typedefs.h:59
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_IWbemLocator()

static void test_IWbemLocator ( void  )
static

Definition at line 87 of file services.c.

88{
89 static const WCHAR path0W[] = {0};
90 static const WCHAR path1W[] = {'\\',0};
91 static const WCHAR path2W[] = {'\\','\\',0};
92 static const WCHAR path3W[] = {'\\','\\','.',0};
93 static const WCHAR path4W[] = {'\\','\\','.','\\',0};
94 static const WCHAR path5W[] = {'\\','R','O','O','T',0};
95 static const WCHAR path6W[] = {'\\','\\','R','O','O','T',0};
96 static const WCHAR path7W[] = {'\\','\\','.','R','O','O','T',0};
97 static const WCHAR path8W[] = {'\\','\\','.','\\','N','O','N','E',0};
98 static const WCHAR path9W[] = {'\\','\\','.','\\','R','O','O','T',0};
99 static const WCHAR path10W[] = {'\\','\\','\\','.','\\','R','O','O','T',0};
100 static const WCHAR path11W[] = {'\\','/','.','\\','R','O','O','T',0};
101 static const WCHAR path12W[] = {'/','/','.','\\','R','O','O','T',0};
102 static const WCHAR path13W[] = {'\\','\\','.','/','R','O','O','T',0};
103 static const WCHAR path14W[] = {'/','/','.','/','R','O','O','T',0};
104 static const WCHAR path15W[] = {'N','O','N','E',0};
105 static const WCHAR path16W[] = {'R','O','O','T',0};
106 static const WCHAR path17W[] = {'R','O','O','T','\\','N','O','N','E',0};
107 static const WCHAR path18W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
108 static const WCHAR path19W[] = {'R','O','O','T','\\','\\','C','I','M','V','2',0};
109 static const WCHAR path20W[] = {'R','O','O','T','\\','C','I','M','V','2','\\',0};
110 static const WCHAR path21W[] = {'R','O','O','T','/','C','I','M','V','2',0};
111 static const WCHAR path22W[] = {'r','o','o','t','\\','d','e','f','a','u','l','t',0};
112 static const WCHAR path23W[] = {'r','o','o','t','\\','c','i','m','v','0',0};
113 static const WCHAR path24W[] = {'r','o','o','t','\\','c','i','m','v','1',0};
114 static const WCHAR path25W[] = {'\\','\\','l','o','c','a','l','h','o','s','t','\\','R','O','O','T',0};
115 static const WCHAR path26W[] = {'\\','\\','L','O','C','A','L','H','O','S','T','\\','R','O','O','T',0};
116 static const struct
117 {
118 const WCHAR *path;
120 BOOL todo;
121 HRESULT result_broken;
122 }
123 test[] =
124 {
125 { path0W, WBEM_E_INVALID_NAMESPACE },
126 { path1W, WBEM_E_INVALID_NAMESPACE },
127 { path2W, WBEM_E_INVALID_NAMESPACE },
128 { path3W, WBEM_E_INVALID_NAMESPACE },
130 { path5W, WBEM_E_INVALID_NAMESPACE },
131 { path6W, 0x800706ba, TRUE },
132 { path7W, 0x800706ba, TRUE },
133 { path8W, WBEM_E_INVALID_NAMESPACE },
134 { path9W, S_OK },
135 { path10W, WBEM_E_INVALID_PARAMETER },
136 { path11W, S_OK, FALSE, WBEM_E_INVALID_PARAMETER },
137 { path12W, S_OK },
138 { path13W, S_OK },
139 { path14W, S_OK },
140 { path15W, WBEM_E_INVALID_NAMESPACE },
141 { path16W, S_OK },
142 { path17W, WBEM_E_INVALID_NAMESPACE },
143 { path18W, S_OK },
146 { path21W, S_OK },
147 { path22W, S_OK },
148 { path23W, WBEM_E_INVALID_NAMESPACE },
149 { path24W, WBEM_E_INVALID_NAMESPACE },
150 { path25W, S_OK },
151 { path26W, S_OK }
152 };
155 unsigned int i;
156 HRESULT hr;
158
159 hr = CoCreateInstance( &CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, &IID_IWbemLocator, (void **)&locator );
160 if (hr != S_OK)
161 {
162 win_skip("can't create instance of WbemLocator\n");
163 return;
164 }
165 ok( hr == S_OK, "failed to create IWbemLocator interface %08x\n", hr );
166
167 for (i = 0; i < ARRAY_SIZE( test ); i++)
168 {
170 hr = IWbemLocator_ConnectServer( locator, resource, NULL, NULL, NULL, 0, NULL, NULL, &services );
172 ok( hr == test[i].result || broken(hr == test[i].result_broken),
173 "%u: expected %08x got %08x\n", i, test[i].result, hr );
175 if (hr == S_OK) IWbemServices_Release( services );
176 }
177 IWbemLocator_Release( locator );
178}
#define broken(x)
Definition: atltest.h:178
#define ARRAY_SIZE(A)
Definition: main.h:20
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define resource
Definition: kernel32.h:9
BOOL todo
Definition: filedlg.c:313
#define todo_wine_if(is_todo)
Definition: custom.c:86
#define test
Definition: rosglue.h:37
@ WBEM_E_INVALID_NAMESPACE
Definition: wbemcli.idl:64
@ WBEM_E_INVALID_PARAMETER
Definition: wbemcli.idl:58

Referenced by START_TEST().