ReactOS  0.4.13-dev-259-g5ca9c9c
registrar.c File Reference
#include "wine/atlbase.h"
#include "wine/debug.h"
#include "wine/unicode.h"
Include dependency graph for registrar.c:

Go to the source code of this file.

Classes

struct  rep_list_str
 
struct  Registrar
 
struct  strbuf
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct rep_list_str rep_list
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (atl)
 
static Registrarimpl_from_IRegistrar (IRegistrar *iface)
 
static void strbuf_init (strbuf *buf)
 
static void strbuf_write (LPCOLESTR str, strbuf *buf, int len)
 
static HRESULT get_word (LPCOLESTR *str, strbuf *buf)
 
static HRESULT do_preprocess (const Registrar *This, LPCOLESTR data, strbuf *buf)
 
static HRESULT do_process_key (LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOOL do_register)
 
static HRESULT do_process_root_key (LPCOLESTR data, BOOL do_register)
 
static HRESULT string_register (Registrar *This, LPCOLESTR data, BOOL do_register)
 
static HRESULT resource_register (Registrar *This, LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType, BOOL do_register)
 
static HRESULT file_register (Registrar *This, LPCOLESTR fileName, BOOL do_register)
 
static HRESULT WINAPI Registrar_QueryInterface (IRegistrar *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI Registrar_AddRef (IRegistrar *iface)
 
static ULONG WINAPI Registrar_Release (IRegistrar *iface)
 
static HRESULT WINAPI Registrar_AddReplacement (IRegistrar *iface, LPCOLESTR Key, LPCOLESTR item)
 
static HRESULT WINAPI Registrar_ClearReplacements (IRegistrar *iface)
 
static HRESULT WINAPI Registrar_ResourceRegisterSz (IRegistrar *iface, LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
 
static HRESULT WINAPI Registrar_ResourceUnregisterSz (IRegistrar *iface, LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
 
static HRESULT WINAPI Registrar_FileRegister (IRegistrar *iface, LPCOLESTR fileName)
 
static HRESULT WINAPI Registrar_FileUnregister (IRegistrar *iface, LPCOLESTR fileName)
 
static HRESULT WINAPI Registrar_StringRegister (IRegistrar *iface, LPCOLESTR data)
 
static HRESULT WINAPI Registrar_StringUnregister (IRegistrar *iface, LPCOLESTR data)
 
static HRESULT WINAPI Registrar_ResourceRegister (IRegistrar *iface, LPCOLESTR resFileName, UINT nID, LPCOLESTR szType)
 
static HRESULT WINAPI Registrar_ResourceUnregister (IRegistrar *iface, LPCOLESTR resFileName, UINT nID, LPCOLESTR szType)
 
HRESULT WINAPI AtlCreateRegistrar (IRegistrar **ret)
 
HRESULT WINAPI AtlUpdateRegistryFromResourceD (HINSTANCE inst, LPCOLESTR res, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries, IRegistrar *pReg)
 

Variables

struct {
   WCHAR   name [22]
 
   HKEY   key
 
root_keys []
 
static const IRegistrarVtbl RegistrarVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file registrar.c.

Typedef Documentation

◆ rep_list

Function Documentation

◆ AtlCreateRegistrar()

HRESULT WINAPI AtlCreateRegistrar ( IRegistrar **  ret)

Definition at line 688 of file registrar.c.

689 {
690  Registrar *registrar;
691 
692  registrar = HeapAlloc(GetProcessHeap(), 0, sizeof(*registrar));
693  if(!registrar)
694  return E_OUTOFMEMORY;
695 
696  registrar->IRegistrar_iface.lpVtbl = &RegistrarVtbl;
697  registrar->ref = 1;
698  registrar->rep = NULL;
699 
700  *ret = &registrar->IRegistrar_iface;
701  return S_OK;
702 }
LONG ref
Definition: registrar.c:68
IRegistrar IRegistrar_iface
Definition: registrar.c:67
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
rep_list * rep
Definition: registrar.c:69
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static const IRegistrarVtbl RegistrarVtbl
Definition: registrar.c:669
int ret
#define S_OK
Definition: intsafe.h:59

Referenced by AtlUpdateRegistryFromResourceD(), and RegistrarCF_CreateInstance().

◆ AtlUpdateRegistryFromResourceD()

HRESULT WINAPI AtlUpdateRegistryFromResourceD ( HINSTANCE  inst,
LPCOLESTR  res,
BOOL  bRegister,
struct _ATL_REGMAP_ENTRY pMapEntries,
IRegistrar pReg 
)

Definition at line 707 of file registrar.c.

709 {
710  const struct _ATL_REGMAP_ENTRY *iter;
712  IRegistrar *registrar;
713  HRESULT hres;
714 
715  static const WCHAR moduleW[] = {'M','O','D','U','L','E',0};
716  static const WCHAR registryW[] = {'R','E','G','I','S','T','R','Y',0};
717 
719  FIXME("hinst %p: did not get module name\n", inst);
720  return E_FAIL;
721  }
722 
723  TRACE("%p (%s), %s, %d, %p, %p\n", inst, debugstr_w(module_name),
724  debugstr_w(res), bRegister, pMapEntries, pReg);
725 
726  if(pReg) {
727  registrar = pReg;
728  }else {
729  hres = AtlCreateRegistrar(&registrar);
730  if(FAILED(hres))
731  return hres;
732  }
733 
734  IRegistrar_AddReplacement(registrar, moduleW, module_name);
735 
736  for (iter = pMapEntries; iter && iter->szKey; iter++)
737  IRegistrar_AddReplacement(registrar, iter->szKey, iter->szData);
738 
739  if(bRegister)
740  hres = IRegistrar_ResourceRegisterSz(registrar, module_name, res, registryW);
741  else
742  hres = IRegistrar_ResourceUnregisterSz(registrar, module_name, res, registryW);
743 
744  if(registrar != pReg)
745  IRegistrar_Release(registrar);
746  return hres;
747 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:607
LPCOLESTR szData
Definition: atlbase.h:244
HRESULT WINAPI AtlCreateRegistrar(IRegistrar **ret)
Definition: registrar.c:688
static LPCWSTR LPCWSTR module_name
Definition: db.cpp:168
#define E_FAIL
Definition: ddrawi.h:102
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
LPCOLESTR szKey
Definition: atlbase.h:243
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
Definition: atlbase.h:241
static const WCHAR moduleW[]
Definition: register.c:35
GLuint res
Definition: glext.h:9613

Referenced by AtlModuleUpdateRegistryFromResourceD().

◆ do_preprocess()

static HRESULT do_preprocess ( const Registrar This,
LPCOLESTR  data,
strbuf buf 
)
static

Definition at line 142 of file registrar.c.

143 {
144  LPCOLESTR iter, iter2 = data;
145  rep_list *rep_iter;
146  static const WCHAR wstr[] = {'%',0};
147 
148  iter = strchrW(data, '%');
149  while(iter) {
150  strbuf_write(iter2, buf, iter-iter2);
151 
152  iter2 = ++iter;
153  if(!*iter2)
154  return DISP_E_EXCEPTION;
155  iter = strchrW(iter2, '%');
156  if(!iter)
157  return DISP_E_EXCEPTION;
158 
159  if(iter == iter2) {
160  strbuf_write(wstr, buf, 1);
161  }else {
162  for(rep_iter = This->rep; rep_iter; rep_iter = rep_iter->next) {
163  if(rep_iter->key_len == iter-iter2
164  && !memicmpW(iter2, rep_iter->key, rep_iter->key_len))
165  break;
166  }
167  if(!rep_iter) {
168  WARN("Could not find replacement: %s\n", debugstr_wn(iter2, iter-iter2));
169  return DISP_E_EXCEPTION;
170  }
171 
172  strbuf_write(rep_iter->item, buf, -1);
173  }
174 
175  iter2 = ++iter;
176  iter = strchrW(iter, '%');
177  }
178 
179  strbuf_write(iter2, buf, -1);
180  TRACE("%s\n", debugstr_w(buf->str));
181 
182  return S_OK;
183 }
#define DISP_E_EXCEPTION
Definition: winerror.h:2518
LPOLESTR key
Definition: registrar.c:60
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define WARN(fmt,...)
Definition: debug.h:111
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct rep_list_str * next
Definition: registrar.c:63
LPOLESTR item
Definition: registrar.c:61
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define debugstr_wn
Definition: kernel32.h:33
#define S_OK
Definition: intsafe.h:59
static void strbuf_write(LPCOLESTR str, strbuf *buf, int len)
Definition: registrar.c:90
#define memicmpW(s1, s2, n)
Definition: unicode.h:27

Referenced by string_register().

◆ do_process_key()

static HRESULT do_process_key ( LPCOLESTR *  pstr,
HKEY  parent_key,
strbuf buf,
BOOL  do_register 
)
static

Definition at line 185 of file registrar.c.

186 {
187  LPCOLESTR iter;
188  HRESULT hres;
189  LONG lres;
190  HKEY hkey = 0;
191  strbuf name;
192 
193  enum {
194  NORMAL,
195  NO_REMOVE,
196  IS_VAL,
197  FORCE_REMOVE,
198  DO_DELETE
199  } key_type = NORMAL;
200 
201  static const WCHAR wstrNoRemove[] = {'N','o','R','e','m','o','v','e',0};
202  static const WCHAR wstrForceRemove[] = {'F','o','r','c','e','R','e','m','o','v','e',0};
203  static const WCHAR wstrDelete[] = {'D','e','l','e','t','e',0};
204  static const WCHAR wstrval[] = {'v','a','l',0};
205 
206  iter = *pstr;
207  hres = get_word(&iter, buf);
208  if(FAILED(hres))
209  return hres;
210  strbuf_init(&name);
211 
212  while(buf->str[1] || buf->str[0] != '}') {
213  key_type = NORMAL;
214  if(!lstrcmpiW(buf->str, wstrNoRemove))
215  key_type = NO_REMOVE;
216  else if(!lstrcmpiW(buf->str, wstrForceRemove))
217  key_type = FORCE_REMOVE;
218  else if(!lstrcmpiW(buf->str, wstrval))
219  key_type = IS_VAL;
220  else if(!lstrcmpiW(buf->str, wstrDelete))
221  key_type = DO_DELETE;
222 
223  if(key_type != NORMAL) {
224  hres = get_word(&iter, buf);
225  if(FAILED(hres))
226  break;
227  }
228  TRACE("name = %s\n", debugstr_w(buf->str));
229 
230  if(do_register) {
231  if(key_type == IS_VAL) {
232  hkey = parent_key;
233  strbuf_write(buf->str, &name, -1);
234  }else if(key_type == DO_DELETE) {
235  TRACE("Deleting %s\n", debugstr_w(buf->str));
236  RegDeleteTreeW(parent_key, buf->str);
237  }else {
238  if(key_type == FORCE_REMOVE)
239  RegDeleteTreeW(parent_key, buf->str);
240  lres = RegCreateKeyW(parent_key, buf->str, &hkey);
241  if(lres != ERROR_SUCCESS) {
242  WARN("Could not create(open) key: %08x\n", lres);
243  hres = HRESULT_FROM_WIN32(lres);
244  break;
245  }
246  }
247  }else if(key_type != IS_VAL && key_type != DO_DELETE) {
248  strbuf_write(buf->str, &name, -1);
249  lres = RegOpenKeyW(parent_key, buf->str, &hkey);
250  if(lres != ERROR_SUCCESS)
251  WARN("Could not open key %s: %08x\n", debugstr_w(name.str), lres);
252  }
253 
254  if(key_type != DO_DELETE && *iter == '=') {
255  iter++;
256  hres = get_word(&iter, buf);
257  if(FAILED(hres))
258  break;
259  if(buf->len != 1) {
260  WARN("Wrong registry type: %s\n", debugstr_w(buf->str));
262  break;
263  }
264  if(do_register) {
265  switch(buf->str[0]) {
266  case 's':
267  hres = get_word(&iter, buf);
268  if(FAILED(hres))
269  break;
270  lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_SZ, (PBYTE)buf->str,
271  (lstrlenW(buf->str)+1)*sizeof(WCHAR));
272  if(lres != ERROR_SUCCESS) {
273  WARN("Could set value of key: %08x\n", lres);
274  hres = HRESULT_FROM_WIN32(lres);
275  break;
276  }
277  break;
278  case 'd': {
279  DWORD dw;
280  hres = get_word(&iter, buf);
281  if(FAILED(hres))
282  break;
283  dw = atoiW(buf->str);
284  lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_DWORD,
285  (PBYTE)&dw, sizeof(dw));
286  if(lres != ERROR_SUCCESS) {
287  WARN("Could set value of key: %08x\n", lres);
288  hres = HRESULT_FROM_WIN32(lres);
289  break;
290  }
291  break;
292  }
293  case 'b': {
294  BYTE *bytes;
295  DWORD count;
296  DWORD i;
297  hres = get_word(&iter, buf);
298  if(FAILED(hres))
299  break;
300  count = (lstrlenW(buf->str) + 1) / 2;
302  if(bytes == NULL) {
304  break;
305  }
306  for(i = 0; i < count && buf->str[2*i]; i++) {
307  WCHAR digits[3];
308  if(!isxdigitW(buf->str[2*i]) || !isxdigitW(buf->str[2*i + 1])) {
309  hres = E_FAIL;
310  break;
311  }
312  digits[0] = buf->str[2*i];
313  digits[1] = buf->str[2*i + 1];
314  digits[2] = 0;
315  bytes[i] = (BYTE) strtoulW(digits, NULL, 16);
316  }
317  if(SUCCEEDED(hres)) {
318  lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_BINARY,
319  bytes, count);
320  if(lres != ERROR_SUCCESS) {
321  WARN("Could not set value of key: 0x%08x\n", lres);
322  hres = HRESULT_FROM_WIN32(lres);
323  }
324  }
326  break;
327  }
328  default:
329  WARN("Wrong resource type: %s\n", debugstr_w(buf->str));
331  };
332  if(FAILED(hres))
333  break;
334  }else {
335  if(*iter == '-')
336  iter++;
337  hres = get_word(&iter, buf);
338  if(FAILED(hres))
339  break;
340  }
341  }else if(key_type == IS_VAL) {
342  WARN("value not set!\n");
344  break;
345  }
346 
347  if(key_type != IS_VAL && key_type != DO_DELETE && *iter == '{' && isspaceW(iter[1])) {
348  hres = get_word(&iter, buf);
349  if(FAILED(hres))
350  break;
351  hres = do_process_key(&iter, hkey, buf, do_register);
352  if(FAILED(hres))
353  break;
354  }
355 
356  TRACE("%x %x\n", do_register, key_type);
357  if(!do_register && (key_type == NORMAL || key_type == FORCE_REMOVE)) {
358  TRACE("Deleting %s\n", debugstr_w(name.str));
359  RegDeleteKeyW(parent_key, name.str);
360  }
361 
362  if(hkey && key_type != IS_VAL)
363  RegCloseKey(hkey);
364  hkey = 0;
365  name.len = 0;
366 
367  hres = get_word(&iter, buf);
368  if(FAILED(hres))
369  break;
370  }
371 
372  HeapFree(GetProcessHeap(), 0, name.str);
373  if(hkey && key_type != IS_VAL)
374  RegCloseKey(hkey);
375  *pstr = iter;
376  return hres;
377 }
#define DISP_E_EXCEPTION
Definition: winerror.h:2518
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_SUCCESS
Definition: deptool.c:10
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define REG_BINARY
Definition: nt_native.h:1496
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1240
Definition: cdmake.c:189
#define lstrlenW
Definition: compat.h:407
#define E_FAIL
Definition: ddrawi.h:102
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
WCHAR name[22]
Definition: registrar.c:33
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
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3311
static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOOL do_register)
Definition: registrar.c:185
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4917
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static void strbuf_init(strbuf *buf)
Definition: registrar.c:83
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
WINE_UNICODE_INLINE int isxdigitW(WCHAR wc)
Definition: unicode.h:175
#define NO_REMOVE
Definition: classpnp.h:93
unsigned char BYTE
Definition: mem.h:68
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1202
LSTATUS WINAPI RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
Definition: reg.c:1755
static void strbuf_write(LPCOLESTR str, strbuf *buf, int len)
Definition: registrar.c:90
static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
Definition: registrar.c:103
Definition: name.c:36
#define strtoulW(s1, s2, b)
Definition: unicode.h:41
#define REG_DWORD
Definition: sdbapi.c:596
BYTE * PBYTE
Definition: pedump.c:66
static const int digits[]
Definition: decode.c:71
#define HeapFree(x, y, z)
Definition: compat.h:394
#define SUCCEEDED(hr)
Definition: intsafe.h:57
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315
#define REG_SZ
Definition: layer.c:22

Referenced by do_process_root_key().

◆ do_process_root_key()

static HRESULT do_process_root_key ( LPCOLESTR  data,
BOOL  do_register 
)
static

Definition at line 379 of file registrar.c.

380 {
381  LPCOLESTR iter = data;
382  strbuf buf;
383  HRESULT hres;
384  unsigned int i;
385 
386  strbuf_init(&buf);
387  hres = get_word(&iter, &buf);
388  if(FAILED(hres))
389  return hres;
390 
391  while(*iter) {
392  if(!buf.len) {
393  WARN("ward.len == 0, failed\n");
395  break;
396  }
397  for(i=0; i<ARRAY_SIZE(root_keys); i++) {
398  if(!lstrcmpiW(buf.str, root_keys[i].name))
399  break;
400  }
401  if(i == ARRAY_SIZE(root_keys)) {
402  WARN("Wrong root key name: %s\n", debugstr_w(buf.str));
404  break;
405  }
406  hres = get_word(&iter, &buf);
407  if(FAILED(hres))
408  break;
409  if(buf.str[1] || buf.str[0] != '{') {
410  WARN("Failed, expected '{', got %s\n", debugstr_w(buf.str));
412  break;
413  }
414  hres = do_process_key(&iter, root_keys[i].key, &buf, do_register);
415  if(FAILED(hres)) {
416  WARN("Processing key failed: %08x\n", hres);
417  break;
418  }
419  hres = get_word(&iter, &buf);
420  if(FAILED(hres))
421  break;
422  }
423  HeapFree(GetProcessHeap(), 0, buf.str);
424  return hres;
425 }
#define DISP_E_EXCEPTION
Definition: winerror.h:2518
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WARN(fmt,...)
Definition: debug.h:111
static const struct @310 root_keys[]
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
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
static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOOL do_register)
Definition: registrar.c:185
#define debugstr_w
Definition: kernel32.h:32
HRESULT hres
Definition: protocol.c:465
#define GetProcessHeap()
Definition: compat.h:395
LONG HRESULT
Definition: typedefs.h:77
static void strbuf_init(strbuf *buf)
Definition: registrar.c:83
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define ARRAY_SIZE(a)
Definition: main.h:24
static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
Definition: registrar.c:103
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: path.c:42

Referenced by string_register().

◆ file_register()

static HRESULT file_register ( Registrar This,
LPCOLESTR  fileName,
BOOL  do_register 
)
static

Definition at line 492 of file registrar.c.

493 {
494  HANDLE file;
495  DWORD filelen, len;
496  LPWSTR regstrw;
497  LPSTR regstra;
498  HRESULT hres;
499 
501  if(file != INVALID_HANDLE_VALUE) {
502  filelen = GetFileSize(file, NULL);
503  regstra = HeapAlloc(GetProcessHeap(), 0, filelen);
504  if(ReadFile(file, regstra, filelen, NULL, NULL)) {
505  len = MultiByteToWideChar(CP_ACP, 0, regstra, filelen, NULL, 0)+1;
506  regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
507  MultiByteToWideChar(CP_ACP, 0, regstra, filelen, regstrw, len);
508  regstrw[len-1] = '\0';
509 
510  hres = string_register(This, regstrw, do_register);
511 
512  HeapFree(GetProcessHeap(), 0, regstrw);
513  }else {
514  WARN("Failed to read file %s\n", debugstr_w(fileName));
516  }
517  HeapFree(GetProcessHeap(), 0, regstra);
518  CloseHandle(file);
519  }else {
520  WARN("Could not open file %s\n", debugstr_w(fileName));
522  }
523 
524  return hres;
525 }
#define CloseHandle
Definition: compat.h:398
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define CP_ACP
Definition: compat.h:99
#define WARN(fmt,...)
Definition: debug.h:111
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
char * LPSTR
Definition: xmlstorage.h:182
#define FILE_SHARE_READ
Definition: compat.h:125
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
HRESULT hres
Definition: protocol.c:465
static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register)
Definition: registrar.c:427
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
GLenum GLsizei len
Definition: glext.h:6722
#define GENERIC_READ
Definition: compat.h:124
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define MultiByteToWideChar
Definition: compat.h:100
#define CreateFileW
Definition: compat.h:400
WCHAR * LPWSTR
Definition: xmlstorage.h:184
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123
#define HeapFree(x, y, z)
Definition: compat.h:394
Definition: fci.c:126

Referenced by Registrar_FileRegister(), and Registrar_FileUnregister().

◆ get_word()

static HRESULT get_word ( LPCOLESTR *  str,
strbuf buf 
)
static

Definition at line 103 of file registrar.c.

104 {
105  LPCOLESTR iter, iter2 = *str;
106 
107  buf->len = 0;
108  buf->str[0] = '\0';
109 
110  while(isspaceW(*iter2))
111  iter2++;
112  iter = iter2;
113  if(!*iter) {
114  *str = iter;
115  return S_OK;
116  }
117 
118  if(*iter == '}' || *iter == '=') {
119  strbuf_write(iter++, buf, 1);
120  }else if(*iter == '\'') {
121  iter2 = ++iter;
122  iter = strchrW(iter, '\'');
123  if(!iter) {
124  WARN("Unexpected end of script\n");
125  *str = iter;
126  return DISP_E_EXCEPTION;
127  }
128  strbuf_write(iter2, buf, iter-iter2);
129  iter++;
130  }else {
131  while(*iter && !isspaceW(*iter))
132  iter++;
133  strbuf_write(iter2, buf, iter-iter2);
134  }
135 
136  while(isspaceW(*iter))
137  iter++;
138  *str = iter;
139  return S_OK;
140 }
#define DISP_E_EXCEPTION
Definition: winerror.h:2518
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
#define WARN(fmt,...)
Definition: debug.h:111
const WCHAR * str
#define S_OK
Definition: intsafe.h:59
static void strbuf_write(LPCOLESTR str, strbuf *buf, int len)
Definition: registrar.c:90

Referenced by do_process_key(), and do_process_root_key().

◆ impl_from_IRegistrar()

static Registrar* impl_from_IRegistrar ( IRegistrar iface)
inlinestatic

Definition at line 78 of file registrar.c.

79 {
80  return CONTAINING_RECORD(iface, Registrar, IRegistrar_iface);
81 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by Registrar_AddRef(), Registrar_AddReplacement(), Registrar_ClearReplacements(), Registrar_FileRegister(), Registrar_FileUnregister(), Registrar_Release(), Registrar_ResourceRegister(), Registrar_ResourceRegisterSz(), Registrar_ResourceUnregister(), Registrar_ResourceUnregisterSz(), Registrar_StringRegister(), and Registrar_StringUnregister().

◆ Registrar_AddRef()

static ULONG WINAPI Registrar_AddRef ( IRegistrar iface)
static

Definition at line 541 of file registrar.c.

542 {
545  TRACE("(%p) ->%d\n", This, ref);
546  return ref;
547 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ Registrar_AddReplacement()

static HRESULT WINAPI Registrar_AddReplacement ( IRegistrar iface,
LPCOLESTR  Key,
LPCOLESTR  item 
)
static

Definition at line 562 of file registrar.c.

563 {
565  int len;
566  rep_list *new_rep;
567 
568  TRACE("(%p)->(%s %s)\n", This, debugstr_w(Key), debugstr_w(item));
569 
570  new_rep = HeapAlloc(GetProcessHeap(), 0, sizeof(rep_list));
571 
572  new_rep->key_len = lstrlenW(Key);
573  new_rep->key = HeapAlloc(GetProcessHeap(), 0, (new_rep->key_len + 1) * sizeof(OLECHAR));
574  memcpy(new_rep->key, Key, (new_rep->key_len+1)*sizeof(OLECHAR));
575 
576  len = lstrlenW(item)+1;
577  new_rep->item = HeapAlloc(GetProcessHeap(), 0, len*sizeof(OLECHAR));
578  memcpy(new_rep->item, item, len*sizeof(OLECHAR));
579 
580  new_rep->next = This->rep;
581  This->rep = new_rep;
582 
583  return S_OK;
584 }
LPOLESTR key
Definition: registrar.c:60
WCHAR OLECHAR
Definition: compat.h:1933
#define lstrlenW
Definition: compat.h:407
#define debugstr_w
Definition: kernel32.h:32
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct rep_list_str * next
Definition: registrar.c:63
LPOLESTR item
Definition: registrar.c:61
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
static ATOM item
Definition: dde.c:856

◆ Registrar_ClearReplacements()

static HRESULT WINAPI Registrar_ClearReplacements ( IRegistrar iface)
static

Definition at line 586 of file registrar.c.

587 {
589  rep_list *iter, *iter2;
590 
591  TRACE("(%p)\n", This);
592 
593  if(!This->rep)
594  return S_OK;
595 
596  iter = This->rep;
597  while(iter) {
598  iter2 = iter->next;
599  HeapFree(GetProcessHeap(), 0, iter->key);
600  HeapFree(GetProcessHeap(), 0, iter->item);
601  HeapFree(GetProcessHeap(), 0, iter);
602  iter = iter2;
603  }
604 
605  This->rep = NULL;
606  return S_OK;
607 }
LPOLESTR key
Definition: registrar.c:60
smooth NULL
Definition: ftsmooth.c:416
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
struct rep_list_str * next
Definition: registrar.c:63
LPOLESTR item
Definition: registrar.c:61
#define S_OK
Definition: intsafe.h:59
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ Registrar_FileRegister()

static HRESULT WINAPI Registrar_FileRegister ( IRegistrar iface,
LPCOLESTR  fileName 
)
static

Definition at line 625 of file registrar.c.

626 {
628  TRACE("(%p)->(%s)\n", This, debugstr_w(fileName));
629  return file_register(This, fileName, TRUE);
630 }
#define TRUE
Definition: types.h:120
#define debugstr_w
Definition: kernel32.h:32
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_register)
Definition: registrar.c:492

◆ Registrar_FileUnregister()

static HRESULT WINAPI Registrar_FileUnregister ( IRegistrar iface,
LPCOLESTR  fileName 
)
static

Definition at line 632 of file registrar.c.

633 {
635  FIXME("(%p)->(%s)\n", This, debugstr_w(fileName));
636  return file_register(This, fileName, FALSE);
637 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_register)
Definition: registrar.c:492

◆ Registrar_QueryInterface()

static HRESULT WINAPI Registrar_QueryInterface ( IRegistrar iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 527 of file registrar.c.

528 {
529  TRACE("(%p)->(%s %p\n", iface, debugstr_guid(riid), ppvObject);
530 
532  || IsEqualGUID(&IID_IRegistrar, riid)
533  || IsEqualGUID(&IID_IRegistrarBase, riid)) {
534  IRegistrar_AddRef(iface);
535  *ppvObject = iface;
536  return S_OK;
537  }
538  return E_NOINTERFACE;
539 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ Registrar_Release()

static ULONG WINAPI Registrar_Release ( IRegistrar iface)
static

Definition at line 549 of file registrar.c.

550 {
553 
554  TRACE("(%p) ->%d\n", This, ref);
555  if(!ref) {
556  IRegistrar_ClearReplacements(iface);
558  }
559  return ref;
560 }
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ Registrar_ResourceRegister()

static HRESULT WINAPI Registrar_ResourceRegister ( IRegistrar iface,
LPCOLESTR  resFileName,
UINT  nID,
LPCOLESTR  szType 
)
static

Definition at line 653 of file registrar.c.

655 {
657  TRACE("(%p)->(%s %d %s)\n", iface, debugstr_w(resFileName), nID, debugstr_w(szType));
658  return resource_register(This, resFileName, MAKEINTRESOURCEW(nID), szType, TRUE);
659 }
#define TRUE
Definition: types.h:120
#define debugstr_w
Definition: kernel32.h:32
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT resource_register(Registrar *This, LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType, BOOL do_register)
Definition: registrar.c:450
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static const WCHAR szType[]
Definition: table.c:81

◆ Registrar_ResourceRegisterSz()

static HRESULT WINAPI Registrar_ResourceRegisterSz ( IRegistrar iface,
LPCOLESTR  resFileName,
LPCOLESTR  szID,
LPCOLESTR  szType 
)
static

Definition at line 609 of file registrar.c.

611 {
613  TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType));
614  return resource_register(This, resFileName, szID, szType, TRUE);
615 }
#define TRUE
Definition: types.h:120
#define debugstr_w
Definition: kernel32.h:32
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT resource_register(Registrar *This, LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType, BOOL do_register)
Definition: registrar.c:450
static const WCHAR szType[]
Definition: table.c:81

◆ Registrar_ResourceUnregister()

static HRESULT WINAPI Registrar_ResourceUnregister ( IRegistrar iface,
LPCOLESTR  resFileName,
UINT  nID,
LPCOLESTR  szType 
)
static

Definition at line 661 of file registrar.c.

663 {
665  TRACE("(%p)->(%s %d %s)\n", This, debugstr_w(resFileName), nID, debugstr_w(szType));
666  return resource_register(This, resFileName, MAKEINTRESOURCEW(nID), szType, FALSE);
667 }
#define debugstr_w
Definition: kernel32.h:32
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT resource_register(Registrar *This, LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType, BOOL do_register)
Definition: registrar.c:450
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
static const WCHAR szType[]
Definition: table.c:81

◆ Registrar_ResourceUnregisterSz()

static HRESULT WINAPI Registrar_ResourceUnregisterSz ( IRegistrar iface,
LPCOLESTR  resFileName,
LPCOLESTR  szID,
LPCOLESTR  szType 
)
static

Definition at line 617 of file registrar.c.

619 {
621  TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType));
622  return resource_register(This, resFileName, szID, szType, FALSE);
623 }
#define debugstr_w
Definition: kernel32.h:32
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT resource_register(Registrar *This, LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType, BOOL do_register)
Definition: registrar.c:450
static const WCHAR szType[]
Definition: table.c:81

◆ Registrar_StringRegister()

static HRESULT WINAPI Registrar_StringRegister ( IRegistrar iface,
LPCOLESTR  data 
)
static

Definition at line 639 of file registrar.c.

640 {
642  TRACE("(%p)->(%s)\n", This, debugstr_w(data));
643  return string_register(This, data, TRUE);
644 }
#define TRUE
Definition: types.h:120
#define debugstr_w
Definition: kernel32.h:32
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register)
Definition: registrar.c:427
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ Registrar_StringUnregister()

static HRESULT WINAPI Registrar_StringUnregister ( IRegistrar iface,
LPCOLESTR  data 
)
static

Definition at line 646 of file registrar.c.

647 {
649  TRACE("(%p)->(%s)\n", This, debugstr_w(data));
650  return string_register(This, data, FALSE);
651 }
#define debugstr_w
Definition: kernel32.h:32
static Registrar * impl_from_IRegistrar(IRegistrar *iface)
Definition: registrar.c:78
#define TRACE(s)
Definition: solgame.cpp:4
static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register)
Definition: registrar.c:427
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ resource_register()

static HRESULT resource_register ( Registrar This,
LPCOLESTR  resFileName,
LPCOLESTR  szID,
LPCOLESTR  szType,
BOOL  do_register 
)
static

Definition at line 450 of file registrar.c.

452 {
453  HINSTANCE hins;
454  HRSRC src;
455  LPSTR regstra;
456  LPWSTR regstrw;
457  DWORD len, reslen;
458  HRESULT hres;
459 
460  hins = LoadLibraryExW(resFileName, NULL, LOAD_LIBRARY_AS_DATAFILE);
461  if(hins) {
462  src = FindResourceW(hins, szID, szType);
463  if(src) {
464  regstra = LoadResource(hins, src);
465  reslen = SizeofResource(hins, src);
466  if(regstra) {
467  len = MultiByteToWideChar(CP_ACP, 0, regstra, reslen, NULL, 0)+1;
468  regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
469  MultiByteToWideChar(CP_ACP, 0, regstra, reslen, regstrw, len);
470  regstrw[len-1] = '\0';
471 
472  hres = string_register(This, regstrw, do_register);
473 
474  HeapFree(GetProcessHeap(), 0, regstrw);
475  }else {
476  WARN("could not load resource\n");
478  }
479  }else {
480  WARN("Could not find source\n");
482  }
483  FreeLibrary(hins);
484  }else {
485  WARN("Could not load resource file\n");
487  }
488 
489  return hres;
490 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define CP_ACP
Definition: compat.h:99
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:286
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
char * LPSTR
Definition: xmlstorage.h:182
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:405
HRESULT hres
Definition: protocol.c:465
static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register)
Definition: registrar.c:427
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:338
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define MultiByteToWideChar
Definition: compat.h:100
static DWORD LPDWORD reslen
Definition: directory.c:51
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
static const WCHAR szType[]
Definition: table.c:81

Referenced by Registrar_ResourceRegister(), Registrar_ResourceRegisterSz(), Registrar_ResourceUnregister(), and Registrar_ResourceUnregisterSz().

◆ strbuf_init()

static void strbuf_init ( strbuf buf)
static

Definition at line 83 of file registrar.c.

84 {
85  buf->str = HeapAlloc(GetProcessHeap(), 0, 128*sizeof(WCHAR));
86  buf->alloc = 128;
87  buf->len = 0;
88 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by do_process_key(), do_process_root_key(), GetDocumentTitle(), parse_hhc(), parse_hhindex(), parse_index_sitemap_object(), parse_li(), parse_sitemap_object(), parse_ul(), SearchCHM_File(), and string_register().

◆ strbuf_write()

static void strbuf_write ( LPCOLESTR  str,
strbuf buf,
int  len 
)
static

Definition at line 90 of file registrar.c.

91 {
92  if(len == -1)
93  len = lstrlenW(str);
94  if(buf->len+len+1 >= buf->alloc) {
95  buf->alloc = (buf->len+len)<<1;
96  buf->str = HeapReAlloc(GetProcessHeap(), 0, buf->str, buf->alloc*sizeof(WCHAR));
97  }
98  memcpy(buf->str+buf->len, str, len*sizeof(OLECHAR));
99  buf->len += len;
100  buf->str[buf->len] = '\0';
101 }
WCHAR OLECHAR
Definition: compat.h:1933
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define lstrlenW
Definition: compat.h:407
const WCHAR * str
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define HeapReAlloc
Definition: compat.h:393

Referenced by do_preprocess(), do_process_key(), and get_word().

◆ string_register()

static HRESULT string_register ( Registrar This,
LPCOLESTR  data,
BOOL  do_register 
)
static

Definition at line 427 of file registrar.c.

428 {
429  strbuf buf;
430  HRESULT hres;
431 
432  TRACE("(%p %s %x)\n", This, debugstr_w(data), do_register);
433 
434  strbuf_init(&buf);
436  if(FAILED(hres)) {
437  WARN("preprocessing failed!\n");
438  HeapFree(GetProcessHeap(), 0, buf.str);
439  return hres;
440  }
441 
442  hres = do_process_root_key(buf.str, do_register);
443  if(FAILED(hres) && do_register)
445 
446  HeapFree(GetProcessHeap(), 0, buf.str);
447  return hres;
448 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WARN(fmt,...)
Definition: debug.h:111
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
#define GetProcessHeap()
Definition: compat.h:395
LONG HRESULT
Definition: typedefs.h:77
static void strbuf_init(strbuf *buf)
Definition: registrar.c:83
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register)
Definition: registrar.c:379
static HRESULT do_preprocess(const Registrar *This, LPCOLESTR data, strbuf *buf)
Definition: registrar.c:142
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by file_register(), Registrar_StringRegister(), Registrar_StringUnregister(), and resource_register().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( atl  )

Variable Documentation

◆ key

Definition at line 34 of file registrar.c.

Referenced by test_registrar().

◆ name

WCHAR name[22]

Definition at line 33 of file registrar.c.

Referenced by do_process_key().

◆ RegistrarVtbl

const IRegistrarVtbl RegistrarVtbl
static
Initial value:
= {
}
static HRESULT WINAPI Registrar_FileRegister(IRegistrar *iface, LPCOLESTR fileName)
Definition: registrar.c:625
static HRESULT WINAPI Registrar_ResourceRegister(IRegistrar *iface, LPCOLESTR resFileName, UINT nID, LPCOLESTR szType)
Definition: registrar.c:653
static HRESULT WINAPI Registrar_ResourceRegisterSz(IRegistrar *iface, LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
Definition: registrar.c:609
static HRESULT WINAPI Registrar_AddReplacement(IRegistrar *iface, LPCOLESTR Key, LPCOLESTR item)
Definition: registrar.c:562
static HRESULT WINAPI Registrar_QueryInterface(IRegistrar *iface, REFIID riid, void **ppvObject)
Definition: registrar.c:527
static HRESULT WINAPI Registrar_StringRegister(IRegistrar *iface, LPCOLESTR data)
Definition: registrar.c:639
static HRESULT WINAPI Registrar_ClearReplacements(IRegistrar *iface)
Definition: registrar.c:586
static HRESULT WINAPI Registrar_FileUnregister(IRegistrar *iface, LPCOLESTR fileName)
Definition: registrar.c:632
static HRESULT WINAPI Registrar_ResourceUnregister(IRegistrar *iface, LPCOLESTR resFileName, UINT nID, LPCOLESTR szType)
Definition: registrar.c:661
static HRESULT WINAPI Registrar_ResourceUnregisterSz(IRegistrar *iface, LPCOLESTR resFileName, LPCOLESTR szID, LPCOLESTR szType)
Definition: registrar.c:617
static ULONG WINAPI Registrar_Release(IRegistrar *iface)
Definition: registrar.c:549
static HRESULT WINAPI Registrar_StringUnregister(IRegistrar *iface, LPCOLESTR data)
Definition: registrar.c:646
static ULONG WINAPI Registrar_AddRef(IRegistrar *iface)
Definition: registrar.c:541

Definition at line 669 of file registrar.c.

Referenced by AtlCreateRegistrar().

◆ root_keys

const { ... } root_keys[]
Initial value:
= {
{{'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0},
{{'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0},
{{'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0},
{{'H','K','E','Y','_','U','S','E','R','S',0},
{{'H','K','E','Y','_','P','E','R','F','O','R','M','A','N','C','E','_','D','A','T','A',0},
{{'H','K','E','Y','_','D','Y','N','_','D','A','T','A',0},
{{'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0},
{{'H','K','C','R',0}, HKEY_CLASSES_ROOT},
{{'H','K','C','U',0}, HKEY_CURRENT_USER},
{{'H','K','L','M',0}, HKEY_LOCAL_MACHINE},
{{'H','K','U',0}, HKEY_USERS},
{{'H','K','P','D',0}, HKEY_PERFORMANCE_DATA},
{{'H','K','D','D',0}, HKEY_DYN_DATA},
{{'H','K','C','C',0}, HKEY_CURRENT_CONFIG}
}
#define HKEY_USERS
Definition: winreg.h:13
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_DYN_DATA
Definition: winreg.h:16
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_PERFORMANCE_DATA
Definition: winreg.h:14
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by do_process_root_key(), and ATL::CRegObject::do_process_root_key().