ReactOS  0.4.15-dev-489-g75a0787
register.c File Reference
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "ole2.h"
#include "rpcproxy.h"
#include "atliface.h"
Include dependency graph for register.c:

Go to the source code of this file.

Classes

struct  reg_info
 

Macros

#define COBJMACROS
 
#define ATL_INITGUID
 

Functions

static HRESULT (WINAPI *pAtlCreateRegistrar)(IRegistrar **)
 
static IRegistrarcreate_registrar (HMODULE inst, struct reg_info *info)
 
static BOOL CALLBACK register_resource (HMODULE module, LPCWSTR type, LPWSTR name, LONG_PTR arg)
 
HRESULT __wine_register_resources (HMODULE module)
 
HRESULT __wine_unregister_resources (HMODULE module)
 

Variables

static const WCHAR atl100W [] = {'a','t','l','1','0','0','.','d','l','l',0}
 
static const WCHAR regtypeW [] = {'W','I','N','E','_','R','E','G','I','S','T','R','Y',0}
 
static const WCHAR moduleW [] = {'M','O','D','U','L','E',0}
 
static HMODULE atl100
 

Macro Definition Documentation

◆ ATL_INITGUID

#define ATL_INITGUID

Definition at line 25 of file register.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file register.c.

Function Documentation

◆ __wine_register_resources()

HRESULT __wine_register_resources ( HMODULE  module)

Definition at line 98 of file register.c.

99 {
100  struct reg_info info;
101 
102  info.registrar = NULL;
103  info.do_register = TRUE;
104  info.result = S_OK;
106  if (info.registrar) IRegistrar_Release( info.registrar );
107  return info.result;
108 }
#define TRUE
Definition: types.h:120
static BOOL CALLBACK register_resource(HMODULE module, LPCWSTR type, LPWSTR name, LONG_PTR arg)
Definition: register.c:70
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR regtypeW[]
Definition: register.c:34
BOOL WINAPI EnumResourceNamesW(HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam)
Definition: res.c:358
#define S_OK
Definition: intsafe.h:59
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

Referenced by DllRegisterServer(), and RegisterTypeLibraries().

◆ __wine_unregister_resources()

HRESULT __wine_unregister_resources ( HMODULE  module)

Definition at line 110 of file register.c.

111 {
112  struct reg_info info;
113 
114  info.registrar = NULL;
115  info.do_register = FALSE;
116  info.result = S_OK;
118  if (info.registrar) IRegistrar_Release( info.registrar );
119  return info.result;
120 }
static BOOL CALLBACK register_resource(HMODULE module, LPCWSTR type, LPWSTR name, LONG_PTR arg)
Definition: register.c:70
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR regtypeW[]
Definition: register.c:34
BOOL WINAPI EnumResourceNamesW(HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam)
Definition: res.c:358
#define S_OK
Definition: intsafe.h:59
__int3264 LONG_PTR
Definition: mstsclib_h.h:276

Referenced by DllUnregisterServer().

◆ create_registrar()

static IRegistrar* create_registrar ( HMODULE  inst,
struct reg_info info 
)
static

Definition at line 47 of file register.c.

48 {
49  if (!pAtlCreateRegistrar)
50  {
51  if (!(atl100 = LoadLibraryW( atl100W )) ||
52  !(pAtlCreateRegistrar = (void *)GetProcAddress( atl100, "AtlCreateRegistrar" )))
53  {
54  info->result = E_NOINTERFACE;
55  return NULL;
56  }
57  }
58 
59  info->result = pAtlCreateRegistrar( &info->registrar );
60  if (SUCCEEDED( info->result ))
61  {
63 
65  IRegistrar_AddReplacement( info->registrar, moduleW, str );
66  }
67  return info->registrar;
68 }
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
#define E_NOINTERFACE
Definition: winerror.h:2364
const WCHAR * str
#define LoadLibraryW(x)
Definition: compat.h:413
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static const WCHAR atl100W[]
Definition: register.c:33
static HMODULE atl100
Definition: register.c:44
static const WCHAR moduleW[]
Definition: register.c:35
#define GetProcAddress(x, y)
Definition: compat.h:419
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by register_resource().

◆ HRESULT()

static HRESULT ( WINAPI pAtlCreateRegistrar)
static

◆ register_resource()

static BOOL CALLBACK register_resource ( HMODULE  module,
LPCWSTR  type,
LPWSTR  name,
LONG_PTR  arg 
)
static

Definition at line 70 of file register.c.

71 {
72  struct reg_info *info = (struct reg_info *)arg;
73  WCHAR *buffer;
74  HRSRC rsrc = FindResourceW( module, name, type );
75  char *str = LoadResource( module, rsrc );
76  DWORD lenW, lenA = SizeofResource( module, rsrc );
77 
78  if (!str) return FALSE;
79  if (!info->registrar && !create_registrar( module, info )) return FALSE;
80  lenW = MultiByteToWideChar( CP_UTF8, 0, str, lenA, NULL, 0 ) + 1;
81  if (!(buffer = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) )))
82  {
83  info->result = E_OUTOFMEMORY;
84  return FALSE;
85  }
86  MultiByteToWideChar( CP_UTF8, 0, str, lenA, buffer, lenW );
87  buffer[lenW - 1] = 0;
88 
89  if (info->do_register)
90  info->result = IRegistrar_StringRegister( info->registrar, buffer );
91  else
92  info->result = IRegistrar_StringUnregister( info->registrar, buffer );
93 
95  return SUCCEEDED(info->result);
96 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define CP_UTF8
Definition: nls.h:20
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
const WCHAR * str
static IRegistrar * create_registrar(HMODULE inst, struct reg_info *info)
Definition: register.c:47
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:38
#define HeapFree(x, y, z)
Definition: compat.h:403
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by __wine_register_resources(), and __wine_unregister_resources().

Variable Documentation

◆ atl100

HMODULE atl100
static

Definition at line 44 of file register.c.

Referenced by create_registrar().

◆ atl100W

const WCHAR atl100W[] = {'a','t','l','1','0','0','.','d','l','l',0}
static

Definition at line 33 of file register.c.

Referenced by create_registrar().

◆ moduleW

const WCHAR moduleW[] = {'M','O','D','U','L','E',0}
static

Definition at line 35 of file register.c.

Referenced by AtlUpdateRegistryFromResourceD(), and create_registrar().

◆ regtypeW

const WCHAR regtypeW[] = {'W','I','N','E','_','R','E','G','I','S','T','R','Y',0}
static

Definition at line 34 of file register.c.

Referenced by __wine_register_resources(), and __wine_unregister_resources().