ReactOS  0.4.15-dev-3453-gff89651
reg.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wbemcli.h"
#include "wine/debug.h"
#include "wbemprox_private.h"
Include dependency graph for reg.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wbemprox)
 
static HRESULT to_bstr_array (BSTR *strings, DWORD count, VARIANT *var)
 
static void free_bstr_array (BSTR *strings, DWORD count)
 
static HRESULT to_i4_array (DWORD *values, DWORD count, VARIANT *var)
 
static HRESULT create_key (HKEY root, const WCHAR *subkey, VARIANT *retval)
 
HRESULT reg_create_key (IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
 
static HRESULT enum_key (HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT *retval)
 
HRESULT reg_enum_key (IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
 
static HRESULT enum_values (HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT *types, VARIANT *retval)
 
HRESULT reg_enum_values (IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
 
static HRESULT get_stringvalue (HKEY root, const WCHAR *subkey, const WCHAR *name, VARIANT *value, VARIANT *retval)
 
HRESULT reg_get_stringvalue (IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObject **out)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file reg.c.

Function Documentation

◆ create_key()

static HRESULT create_key ( HKEY  root,
const WCHAR subkey,
VARIANT retval 
)
static

Definition at line 82 of file reg.c.

83 {
84  LONG res;
85  HKEY hkey;
86 
87  TRACE("%p, %s\n", root, debugstr_w(subkey));
88 
89  res = RegCreateKeyExW( root, subkey, 0, NULL, 0, 0, NULL, &hkey, NULL );
90  set_variant( VT_UI4, res, NULL, retval );
91  if (!res)
92  {
93  RegCloseKey( hkey );
94  return S_OK;
95  }
96  return HRESULT_FROM_WIN32( res );
97 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
void set_variant(VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret)
Definition: query.c:1093
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613

Referenced by reg_create_key().

◆ enum_key()

static HRESULT enum_key ( HKEY  root,
const WCHAR subkey,
VARIANT names,
VARIANT retval 
)
static

Definition at line 143 of file reg.c.

144 {
145  HKEY hkey;
146  HRESULT hr = S_OK;
147  WCHAR buf[256];
148  BSTR *strings, *tmp;
149  DWORD count = 2, len = ARRAY_SIZE( buf );
150  LONG res, i = 0;
151 
152  TRACE("%p, %s\n", root, debugstr_w(subkey));
153 
154  if (!(strings = heap_alloc( count * sizeof(BSTR) ))) return E_OUTOFMEMORY;
155  if ((res = RegOpenKeyExW( root, subkey, 0, KEY_ENUMERATE_SUB_KEYS, &hkey )))
156  {
157  set_variant( VT_UI4, res, NULL, retval );
158  heap_free( strings );
159  return S_OK;
160  }
161  for (;;)
162  {
163  if (i >= count)
164  {
165  count *= 2;
166  if (!(tmp = heap_realloc( strings, count * sizeof(BSTR) )))
167  {
168  RegCloseKey( hkey );
169  return E_OUTOFMEMORY;
170  }
171  strings = tmp;
172  }
173  if ((res = RegEnumKeyW( hkey, i, buf, len )) == ERROR_NO_MORE_ITEMS)
174  {
175  if (i) res = ERROR_SUCCESS;
176  break;
177  }
178  if (res) break;
179  if (!(strings[i] = SysAllocString( buf )))
180  {
181  for (i--; i >= 0; i--) SysFreeString( strings[i] );
182  hr = E_OUTOFMEMORY;
183  break;
184  }
185  i++;
186  }
187  if (hr == S_OK && !res)
188  {
189  hr = to_bstr_array( strings, i, names );
191  }
192  set_variant( VT_UI4, res, NULL, retval );
193  RegCloseKey( hkey );
194  heap_free( strings );
195  return hr;
196 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
GLuint GLuint GLsizei count
Definition: gl.h:1545
OLECHAR * BSTR
Definition: compat.h:2152
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLuint GLuint * names
Definition: glext.h:11545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void set_variant(VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret)
Definition: query.c:1093
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
static void free_bstr_array(BSTR *strings, DWORD count)
Definition: reg.c:57
static HRESULT to_bstr_array(BSTR *strings, DWORD count, VARIANT *var)
Definition: reg.c:38
GLsizei const GLchar *const * strings
Definition: glext.h:7622
GLenum GLsizei len
Definition: glext.h:6722
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
#define S_OK
Definition: intsafe.h:52
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 ARRAY_SIZE(a)
Definition: main.h:24
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019

Referenced by reg_enum_key().

◆ enum_values()

static HRESULT enum_values ( HKEY  root,
const WCHAR subkey,
VARIANT names,
VARIANT types,
VARIANT retval 
)
static

Definition at line 253 of file reg.c.

254 {
255  HKEY hkey = NULL;
256  HRESULT hr = S_OK;
257  BSTR *value_names = NULL;
258  DWORD count, buflen, len, *value_types = NULL;
259  LONG res, i = 0;
260  WCHAR *buf = NULL;
261 
262  TRACE("%p, %s\n", root, debugstr_w(subkey));
263 
264  if ((res = RegOpenKeyExW( root, subkey, 0, KEY_QUERY_VALUE, &hkey ))) goto done;
265  if ((res = RegQueryInfoKeyW( hkey, NULL, NULL, NULL, NULL, NULL, NULL, &count, &buflen, NULL, NULL, NULL )))
266  goto done;
267 
268  hr = E_OUTOFMEMORY;
269  if (!(buf = heap_alloc( (buflen + 1) * sizeof(WCHAR) ))) goto done;
270  if (!(value_names = heap_alloc( count * sizeof(BSTR) ))) goto done;
271  if (!(value_types = heap_alloc( count * sizeof(DWORD) ))) goto done;
272 
273  hr = S_OK;
274  for (;;)
275  {
276  len = buflen + 1;
277  res = RegEnumValueW( hkey, i, buf, &len, NULL, &value_types[i], NULL, NULL );
278  if (res == ERROR_NO_MORE_ITEMS)
279  {
280  if (i) res = ERROR_SUCCESS;
281  break;
282  }
283  if (res) break;
284  if (!(value_names[i] = SysAllocString( buf )))
285  {
286  for (i--; i >= 0; i--) SysFreeString( value_names[i] );
287  hr = E_OUTOFMEMORY;
288  break;
289  }
290  i++;
291  }
292  if (hr == S_OK && !res)
293  {
294  hr = to_bstr_array( value_names, i, names );
295  free_bstr_array( value_names, i );
296  if (hr == S_OK) hr = to_i4_array( value_types, i, types );
297  }
298 
299 done:
300  set_variant( VT_UI4, res, NULL, retval );
301  RegCloseKey( hkey );
302  heap_free( value_names );
303  heap_free( value_types );
304  heap_free( buf );
305  return hr;
306 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
GLuint GLuint GLsizei count
Definition: gl.h:1545
OLECHAR * BSTR
Definition: compat.h:2152
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
GLuint GLuint * names
Definition: glext.h:11545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void set_variant(VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret)
Definition: query.c:1093
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cmds.c:130
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
static void free_bstr_array(BSTR *strings, DWORD count)
Definition: reg.c:57
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3690
static HRESULT to_bstr_array(BSTR *strings, DWORD count, VARIANT *var)
Definition: reg.c:38
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:52
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 KEY_QUERY_VALUE
Definition: nt_native.h:1016
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
static HRESULT to_i4_array(DWORD *values, DWORD count, VARIANT *var)
Definition: reg.c:63
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by reg_enum_values().

◆ free_bstr_array()

static void free_bstr_array ( BSTR strings,
DWORD  count 
)
static

Definition at line 57 of file reg.c.

58 {
59  while (count--)
60  SysFreeString( *(strings++) );
61 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei const GLchar *const * strings
Definition: glext.h:7622
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

Referenced by enum_key(), and enum_values().

◆ get_stringvalue()

static HRESULT get_stringvalue ( HKEY  root,
const WCHAR subkey,
const WCHAR name,
VARIANT value,
VARIANT retval 
)
static

Definition at line 367 of file reg.c.

368 {
369  HRESULT hr = S_OK;
370  BSTR str = NULL;
371  DWORD size;
372  LONG res;
373 
374  TRACE("%p, %s, %s\n", root, debugstr_w(subkey), debugstr_w(name));
375 
376  if ((res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, NULL, &size ))) goto done;
377  if (!(str = SysAllocStringLen( NULL, size / sizeof(WCHAR) - 1 )))
378  {
379  hr = E_OUTOFMEMORY;
380  goto done;
381  }
382  if (!(res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, str, &size )))
383  set_variant( VT_BSTR, 0, str, value );
384 
385 done:
386  set_variant( VT_UI4, res, NULL, retval );
387  if (res) SysFreeString( str );
388  return hr;
389 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
Definition: pdh_main.c:93
HRESULT hr
Definition: shlfolder.c:183
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define RRF_RT_REG_SZ
Definition: driver.c:575
OLECHAR * BSTR
Definition: compat.h:2152
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
const WCHAR * str
void set_variant(VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret)
Definition: query.c:1093
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define NULL
Definition: types.h:112
Definition: name.c:38
GLuint res
Definition: glext.h:9613

Referenced by reg_get_stringvalue().

◆ reg_create_key()

HRESULT reg_create_key ( IWbemClassObject obj,
IWbemClassObject in,
IWbemClassObject **  out 
)

Definition at line 99 of file reg.c.

100 {
101  VARIANT defkey, subkey, retval;
103  HRESULT hr;
104 
105  TRACE("%p, %p\n", in, out);
106 
107  hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL );
108  if (hr != S_OK) return hr;
109  hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL );
110  if (hr != S_OK) return hr;
111 
113  if (hr != S_OK)
114  {
115  VariantClear( &subkey );
116  return hr;
117  }
118  if (out)
119  {
120  hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
121  if (hr != S_OK)
122  {
123  VariantClear( &subkey );
124  IWbemClassObject_Release( sig );
125  return hr;
126  }
127  }
128  hr = create_key( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &retval );
129  if (hr == S_OK && out_params)
130  hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
131 
132  VariantClear( &subkey );
133  IWbemClassObject_Release( sig );
134  if (hr == S_OK && out)
135  {
136  *out = out_params;
137  IWbemClassObject_AddRef( out_params );
138  }
139  if (out_params) IWbemClassObject_Release( out_params );
140  return hr;
141 }
HRESULT hr
Definition: shlfolder.c:183
int32_t INT_PTR
Definition: typedefs.h:64
static const WCHAR param_subkeynameW[]
#define V_I4(A)
Definition: oleauto.h:247
static HRESULT create_key(HKEY root, const WCHAR *subkey, VARIANT *retval)
Definition: reg.c:82
static const WCHAR class_stdregprovW[]
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
static FILE * out
Definition: regtests2xml.c:44
static void out_params(void)
Definition: nanoxwin.c:1413
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
static const WCHAR param_defkeyW[]
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:52
GLuint in
Definition: glext.h:9616
#define NULL
Definition: types.h:112
HRESULT create_signature(const WCHAR *class, const WCHAR *method, enum param_direction dir, IWbemClassObject **sig)
Definition: class.c:819
static const WCHAR method_createkeyW[]
static const WCHAR param_returnvalueW[]

◆ reg_enum_key()

HRESULT reg_enum_key ( IWbemClassObject obj,
IWbemClassObject in,
IWbemClassObject **  out 
)

Definition at line 198 of file reg.c.

199 {
200  VARIANT defkey, subkey, names, retval;
202  HRESULT hr;
203 
204  TRACE("%p, %p\n", in, out);
205 
206  hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL );
207  if (hr != S_OK) return hr;
208  hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL );
209  if (hr != S_OK) return hr;
210 
212  if (hr != S_OK)
213  {
214  VariantClear( &subkey );
215  return hr;
216  }
217  if (out)
218  {
219  hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
220  if (hr != S_OK)
221  {
222  VariantClear( &subkey );
223  IWbemClassObject_Release( sig );
224  return hr;
225  }
226  }
227  VariantInit( &names );
228  hr = enum_key( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &names, &retval );
229  if (hr != S_OK) goto done;
230  if (out_params)
231  {
232  if (!V_UI4( &retval ))
233  {
234  hr = IWbemClassObject_Put( out_params, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
235  if (hr != S_OK) goto done;
236  }
237  hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
238  }
239 
240 done:
241  VariantClear( &names );
242  VariantClear( &subkey );
243  IWbemClassObject_Release( sig );
244  if (hr == S_OK && out)
245  {
246  *out = out_params;
247  IWbemClassObject_AddRef( out_params );
248  }
249  if (out_params) IWbemClassObject_Release( out_params );
250  return hr;
251 }
static HRESULT enum_key(HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT *retval)
Definition: reg.c:143
HRESULT hr
Definition: shlfolder.c:183
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
int32_t INT_PTR
Definition: typedefs.h:64
static const WCHAR param_subkeynameW[]
static const WCHAR method_enumkeyW[]
#define V_I4(A)
Definition: oleauto.h:247
GLuint GLuint * names
Definition: glext.h:11545
static const WCHAR param_namesW[]
static const WCHAR class_stdregprovW[]
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
static FILE * out
Definition: regtests2xml.c:44
static void out_params(void)
Definition: nanoxwin.c:1413
#define V_UI4(A)
Definition: oleauto.h:270
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
static const WCHAR param_defkeyW[]
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:52
GLuint in
Definition: glext.h:9616
#define NULL
Definition: types.h:112
HRESULT create_signature(const WCHAR *class, const WCHAR *method, enum param_direction dir, IWbemClassObject **sig)
Definition: class.c:819
static const WCHAR param_returnvalueW[]

◆ reg_enum_values()

HRESULT reg_enum_values ( IWbemClassObject obj,
IWbemClassObject in,
IWbemClassObject **  out 
)

Definition at line 308 of file reg.c.

309 {
310  VARIANT defkey, subkey, names, types, retval;
312  HRESULT hr;
313 
314  TRACE("%p, %p\n", in, out);
315 
316  hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL );
317  if (hr != S_OK) return hr;
318  hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL );
319  if (hr != S_OK) return hr;
320 
322  if (hr != S_OK)
323  {
324  VariantClear( &subkey );
325  return hr;
326  }
327  if (out)
328  {
329  hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
330  if (hr != S_OK)
331  {
332  VariantClear( &subkey );
333  IWbemClassObject_Release( sig );
334  return hr;
335  }
336  }
337  VariantInit( &names );
338  VariantInit( &types );
339  hr = enum_values( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &names, &types, &retval );
340  if (hr != S_OK) goto done;
341  if (out_params)
342  {
343  if (!V_UI4( &retval ))
344  {
345  hr = IWbemClassObject_Put( out_params, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
346  if (hr != S_OK) goto done;
347  hr = IWbemClassObject_Put( out_params, param_typesW, 0, &types, CIM_SINT32|CIM_FLAG_ARRAY );
348  if (hr != S_OK) goto done;
349  }
350  hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
351  }
352 
353 done:
354  VariantClear( &types );
355  VariantClear( &names );
356  VariantClear( &subkey );
357  IWbemClassObject_Release( sig );
358  if (hr == S_OK && out)
359  {
360  *out = out_params;
361  IWbemClassObject_AddRef( out_params );
362  }
363  if (out_params) IWbemClassObject_Release( out_params );
364  return hr;
365 }
HRESULT hr
Definition: shlfolder.c:183
static const WCHAR method_enumvaluesW[]
GLsizei GLenum GLenum * types
Definition: glext.h:7753
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
int32_t INT_PTR
Definition: typedefs.h:64
static const WCHAR param_subkeynameW[]
#define V_I4(A)
Definition: oleauto.h:247
GLuint GLuint * names
Definition: glext.h:11545
static const WCHAR param_typesW[]
static const WCHAR param_namesW[]
static const WCHAR class_stdregprovW[]
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cmds.c:130
LONG HRESULT
Definition: typedefs.h:79
static FILE * out
Definition: regtests2xml.c:44
static void out_params(void)
Definition: nanoxwin.c:1413
static HRESULT enum_values(HKEY root, const WCHAR *subkey, VARIANT *names, VARIANT *types, VARIANT *retval)
Definition: reg.c:253
#define V_UI4(A)
Definition: oleauto.h:270
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
static const WCHAR param_defkeyW[]
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:52
GLuint in
Definition: glext.h:9616
#define NULL
Definition: types.h:112
HRESULT create_signature(const WCHAR *class, const WCHAR *method, enum param_direction dir, IWbemClassObject **sig)
Definition: class.c:819
static const WCHAR param_returnvalueW[]

◆ reg_get_stringvalue()

HRESULT reg_get_stringvalue ( IWbemClassObject obj,
IWbemClassObject in,
IWbemClassObject **  out 
)

Definition at line 391 of file reg.c.

392 {
393  VARIANT defkey, subkey, name, value, retval;
395  HRESULT hr;
396 
397  TRACE("%p, %p\n", in, out);
398 
399  hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL );
400  if (hr != S_OK) return hr;
401  hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL );
402  if (hr != S_OK) return hr;
403  hr = IWbemClassObject_Get( in, param_valuenameW, 0, &name, NULL, NULL );
404  if (hr != S_OK) return hr;
405 
407  if (hr != S_OK)
408  {
409  VariantClear( &name );
410  VariantClear( &subkey );
411  return hr;
412  }
413  if (out)
414  {
415  hr = IWbemClassObject_SpawnInstance( sig, 0, &out_params );
416  if (hr != S_OK)
417  {
418  VariantClear( &name );
419  VariantClear( &subkey );
420  IWbemClassObject_Release( sig );
421  return hr;
422  }
423  }
424  VariantInit( &value );
425  hr = get_stringvalue( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), V_BSTR(&name), &value, &retval );
426  if (hr != S_OK) goto done;
427  if (out_params)
428  {
429  if (!V_UI4( &retval ))
430  {
431  hr = IWbemClassObject_Put( out_params, param_valueW, 0, &value, CIM_STRING );
432  if (hr != S_OK) goto done;
433  }
434  hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
435  }
436 
437 done:
438  VariantClear( &name );
439  VariantClear( &subkey );
440  IWbemClassObject_Release( sig );
441  if (hr == S_OK && out)
442  {
443  *out = out_params;
444  IWbemClassObject_AddRef( out_params );
445  }
446  if (out_params) IWbemClassObject_Release( out_params );
447  return hr;
448 }
Definition: pdh_main.c:93
HRESULT hr
Definition: shlfolder.c:183
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
int32_t INT_PTR
Definition: typedefs.h:64
static const WCHAR param_subkeynameW[]
#define V_I4(A)
Definition: oleauto.h:247
static const WCHAR class_stdregprovW[]
static const WCHAR param_valuenameW[]
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
static FILE * out
Definition: regtests2xml.c:44
static void out_params(void)
Definition: nanoxwin.c:1413
#define V_UI4(A)
Definition: oleauto.h:270
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
static const WCHAR method_getstringvalueW[]
static const WCHAR param_defkeyW[]
GLsizei const GLfloat * value
Definition: glext.h:6069
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:52
GLuint in
Definition: glext.h:9616
#define NULL
Definition: types.h:112
static HRESULT get_stringvalue(HKEY root, const WCHAR *subkey, const WCHAR *name, VARIANT *value, VARIANT *retval)
Definition: reg.c:367
static const WCHAR param_valueW[]
HRESULT create_signature(const WCHAR *class, const WCHAR *method, enum param_direction dir, IWbemClassObject **sig)
Definition: class.c:819
Definition: name.c:38
static const WCHAR param_returnvalueW[]
const WCHAR * name
Definition: reg.c:67

◆ to_bstr_array()

static HRESULT to_bstr_array ( BSTR strings,
DWORD  count,
VARIANT var 
)
static

Definition at line 38 of file reg.c.

39 {
40  SAFEARRAY *sa;
41  HRESULT hr;
42  LONG i;
43 
44  if (!(sa = SafeArrayCreateVector( VT_BSTR, 0, count ))) return E_OUTOFMEMORY;
45  for (i = 0; i < count; i++)
46  {
47  if ((hr = SafeArrayPutElement( sa, &i, strings[i] )) != S_OK)
48  {
50  return hr;
51  }
52  }
54  return S_OK;
55 }
const char * var
Definition: shader.c:5666
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
void set_variant(VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret)
Definition: query.c:1093
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1347
SAFEARRAY *WINAPI SafeArrayCreateVector(VARTYPE vt, LONG lLbound, ULONG cElements)
Definition: safearray.c:677
GLsizei const GLchar *const * strings
Definition: glext.h:7622
#define S_OK
Definition: intsafe.h:52
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
HRESULT WINAPI SafeArrayPutElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData)
Definition: safearray.c:864
static struct sockaddr_in sa
Definition: adnsresfilter.c:69

Referenced by enum_key(), and enum_values().

◆ to_i4_array()

static HRESULT to_i4_array ( DWORD values,
DWORD  count,
VARIANT var 
)
static

Definition at line 63 of file reg.c.

64 {
65  SAFEARRAY *sa;
66  HRESULT hr;
67  LONG i;
68 
69  if (!(sa = SafeArrayCreateVector( VT_I4, 0, count ))) return E_OUTOFMEMORY;
70  for (i = 0; i < count; i++)
71  {
72  if ((hr = SafeArrayPutElement( sa, &i, &values[i] )) != S_OK)
73  {
75  return hr;
76  }
77  }
79  return S_OK;
80 }
const char * var
Definition: shader.c:5666
Definition: compat.h:2157
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
void set_variant(VARTYPE type, LONGLONG val, void *val_ptr, VARIANT *ret)
Definition: query.c:1093
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1347
SAFEARRAY *WINAPI SafeArrayCreateVector(VARTYPE vt, LONG lLbound, ULONG cElements)
Definition: safearray.c:677
#define S_OK
Definition: intsafe.h:52
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
HRESULT WINAPI SafeArrayPutElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData)
Definition: safearray.c:864
static struct sockaddr_in sa
Definition: adnsresfilter.c:69

Referenced by enum_values().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wbemprox  )