Module: wine Branch: master Commit: 61eb983313fe04813bc8c6f64162ca434e642e23 URL: http://source.winehq.org/git/wine.git/?a=commit;h=61eb983313fe04813bc8c6f641...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Dec 2 14:40:00 2010 +0100
hlink: Convert dll registration to the IRegistrar mechanism.
---
dlls/hlink/Makefile.in | 2 + dlls/hlink/hlink.spec | 2 +- dlls/hlink/hlink_classes.idl | 36 +++++++++++++++++++++++++++++++ dlls/hlink/hlink_main.c | 48 ++++++++++------------------------------- 4 files changed, 51 insertions(+), 37 deletions(-)
diff --git a/dlls/hlink/Makefile.in b/dlls/hlink/Makefile.in index 2bf15c7..a387802 100644 --- a/dlls/hlink/Makefile.in +++ b/dlls/hlink/Makefile.in @@ -9,4 +9,6 @@ C_SRCS = \ hlink_main.c \ link.c
+IDL_R_SRCS = hlink_classes.idl + @MAKE_DLL_RULES@ diff --git a/dlls/hlink/hlink.spec b/dlls/hlink/hlink.spec index ca8144e..6a5bfdf 100644 --- a/dlls/hlink/hlink.spec +++ b/dlls/hlink/hlink.spec @@ -30,4 +30,4 @@ @ stdcall -private DllCanUnloadNow() @ stdcall -private DllGetClassObject(ptr ptr ptr) @ stdcall -private DllRegisterServer() -# @ stub -private DllUnregisterServer +@ stdcall -private DllUnregisterServer() diff --git a/dlls/hlink/hlink_classes.idl b/dlls/hlink/hlink_classes.idl new file mode 100644 index 0000000..98b5d32 --- /dev/null +++ b/dlls/hlink/hlink_classes.idl @@ -0,0 +1,36 @@ +/* + * COM Classes for hlink + * + * Copyright 2010 Alexandre Julliard + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +[ + threading(apartment), + uuid(79eac9d0-baf9-11ce-8c82-00aa004ba90b) +] +coclass StdHlink +{ + interface IHlink; + interface IPersistStream; + interface IDataObject; +} + +[ + threading(apartment), + uuid(79eac9d1-baf9-11ce-8c82-00aa004ba90b) +] +coclass StdHlinkBrowseContext { interface IHlinkBrowseContext; } diff --git a/dlls/hlink/hlink_main.c b/dlls/hlink/hlink_main.c index cda9683..0300fc0 100644 --- a/dlls/hlink/hlink_main.c +++ b/dlls/hlink/hlink_main.c @@ -21,12 +21,15 @@ #include "hlink_private.h"
#include "winreg.h" +#include "rpcproxy.h" #include "hlguids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(hlink);
+static HINSTANCE instance; + typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
typedef struct @@ -42,6 +45,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) switch (fdwReason) { case DLL_PROCESS_ATTACH: + instance = hinstDLL; DisableThreadLibraryCalls(hinstDLL); break; case DLL_PROCESS_DETACH: @@ -576,46 +580,18 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) return IClassFactory_QueryInterface(pcf, iid, ppv); }
-static HRESULT register_clsid(LPCGUID guid) +/*********************************************************************** + * DllRegisterServer (HLINK.@) + */ +HRESULT WINAPI DllRegisterServer(void) { - static const WCHAR clsid[] = - {'C','L','S','I','D','\',0}; - static const WCHAR ips[] = - {'\','I','n','p','r','o','c','S','e','r','v','e','r','3','2',0}; - static const WCHAR hlink[] = - {'h','l','i','n','k','.','d','l','l',0}; - static const WCHAR threading_model[] = - {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0}; - static const WCHAR apartment[] = - {'A','p','a','r','t','m','e','n','t',0}; - WCHAR path[80]; - HKEY key = NULL; - LONG r; - - lstrcpyW(path, clsid); - StringFromGUID2(guid, &path[6], 80); - lstrcatW(path, ips); - r = RegCreateKeyW(HKEY_CLASSES_ROOT, path, &key); - if (r != ERROR_SUCCESS) - return E_FAIL; - - RegSetValueExW(key, NULL, 0, REG_SZ, (const BYTE *)hlink, sizeof hlink); - RegSetValueExW(key, threading_model, 0, REG_SZ, (const BYTE *)apartment, sizeof apartment); - RegCloseKey(key); - - return S_OK; + return __wine_register_resources( instance, NULL ); }
/*********************************************************************** - * DllRegisterServer (HLINK.@) + * DllUnregisterServer (HLINK.@) */ -HRESULT WINAPI DllRegisterServer(void) +HRESULT WINAPI DllUnregisterServer(void) { - HRESULT r; - - r = register_clsid(&CLSID_StdHlink); - if (SUCCEEDED(r)) - r = register_clsid(&CLSID_StdHlinkBrowseContext); - - return S_OK; + return __wine_unregister_resources( instance, NULL ); }