reactos/dll/win32/atl/atl_ros.diff

77 lines
2.8 KiB
Diff

diff -prudN e:\Wine\dlls\atl/atl_main.c e:\reactos\dll\win32\atl/atl_main.c
--- e:\Wine\dlls\atl/atl_main.c 2013-09-03 23:09:36.308717300 +0100
+++ e:\reactos\dll\win32\atl/atl_main.c 2013-09-12 12:15:17.112785700 +0100
@@ -547,6 +555,53 @@ static const IClassFactoryVtbl IRegistra
static IClassFactory RegistrarCF = { &IRegistrarCFVtbl };
+static HRESULT do_register_dll_server(IRegistrar *pRegistrar, LPCOLESTR wszDll,
+ LPCOLESTR wszId, BOOL do_register,
+ const struct _ATL_REGMAP_ENTRY* pMapEntries)
+{
+ IRegistrar *registrar;
+ HRESULT hres;
+ const struct _ATL_REGMAP_ENTRY *pMapEntry;
+
+ static const WCHAR wszModule[] = {'M','O','D','U','L','E',0};
+ static const WCHAR wszRegistry[] = {'R','E','G','I','S','T','R','Y',0};
+
+ if(pRegistrar) {
+ registrar = pRegistrar;
+ }else {
+ hres = AtlCreateRegistrar(&registrar);
+ if(FAILED(hres))
+ return hres;
+ }
+
+ IRegistrar_AddReplacement(registrar, wszModule, wszDll);
+
+ for (pMapEntry = pMapEntries; pMapEntry && pMapEntry->szKey; pMapEntry++)
+ IRegistrar_AddReplacement(registrar, pMapEntry->szKey, pMapEntry->szData);
+
+ if(do_register)
+ hres = IRegistrar_ResourceRegisterSz(registrar, wszDll, wszId, wszRegistry);
+ else
+ hres = IRegistrar_ResourceUnregisterSz(registrar, wszDll, wszId, wszRegistry);
+
+ if(registrar != pRegistrar)
+ IRegistrar_Release(registrar);
+ return hres;
+}
+
+static HRESULT do_register_server(BOOL do_register)
+{
+ static const WCHAR CLSID_RegistrarW[] =
+ {'C','L','S','I','D','_','R','e','g','i','s','t','r','a','r',0};
+ static const WCHAR atl_dllW[] = {'a','t','l','.','d','l','l',0};
+
+ WCHAR clsid_str[40];
+ const struct _ATL_REGMAP_ENTRY reg_map[] = {{CLSID_RegistrarW, clsid_str}, {NULL,NULL}};
+
+ StringFromGUID2(&CLSID_Registrar, clsid_str, sizeof(clsid_str)/sizeof(WCHAR));
+ return do_register_dll_server(NULL, atl_dllW, MAKEINTRESOURCEW(101), do_register, reg_map);
+}
+
/**************************************************************
* DllGetClassObject (ATL.2)
*/
@@ -566,7 +621,8 @@ HRESULT WINAPI DllGetClassObject(REFCLSI
*/
HRESULT WINAPI DllRegisterServer(void)
{
- return __wine_register_resources( hInst );
+ /* Note: we can't use __wine_register_server here because it uses CLSID_Registrar which isn't registred yet */
+ return do_register_server(TRUE);
}
/***********************************************************************
@@ -574,7 +630,7 @@ HRESULT WINAPI DllRegisterServer(void)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
- return __wine_unregister_resources( hInst );
+ return do_register_server(FALSE);
}
/***********************************************************************