Commit 61eb9833 authored by Alexandre Julliard's avatar Alexandre Julliard

hlink: Convert dll registration to the IRegistrar mechanism.

parent 26c71721
...@@ -9,4 +9,6 @@ C_SRCS = \ ...@@ -9,4 +9,6 @@ C_SRCS = \
hlink_main.c \ hlink_main.c \
link.c link.c
IDL_R_SRCS = hlink_classes.idl
@MAKE_DLL_RULES@ @MAKE_DLL_RULES@
...@@ -30,4 +30,4 @@ ...@@ -30,4 +30,4 @@
@ stdcall -private DllCanUnloadNow() @ stdcall -private DllCanUnloadNow()
@ stdcall -private DllGetClassObject(ptr ptr ptr) @ stdcall -private DllGetClassObject(ptr ptr ptr)
@ stdcall -private DllRegisterServer() @ stdcall -private DllRegisterServer()
# @ stub -private DllUnregisterServer @ stdcall -private DllUnregisterServer()
/*
* 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; }
...@@ -21,12 +21,15 @@ ...@@ -21,12 +21,15 @@
#include "hlink_private.h" #include "hlink_private.h"
#include "winreg.h" #include "winreg.h"
#include "rpcproxy.h"
#include "hlguids.h" #include "hlguids.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(hlink); WINE_DEFAULT_DEBUG_CHANNEL(hlink);
static HINSTANCE instance;
typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*); typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
typedef struct typedef struct
...@@ -42,6 +45,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) ...@@ -42,6 +45,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
switch (fdwReason) switch (fdwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
instance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL); DisableThreadLibraryCalls(hinstDLL);
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
...@@ -576,46 +580,18 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) ...@@ -576,46 +580,18 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
return IClassFactory_QueryInterface(pcf, iid, ppv); return IClassFactory_QueryInterface(pcf, iid, ppv);
} }
static HRESULT register_clsid(LPCGUID guid) /***********************************************************************
* DllRegisterServer (HLINK.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{ {
static const WCHAR clsid[] = return __wine_register_resources( instance, NULL );
{'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;
} }
/*********************************************************************** /***********************************************************************
* DllRegisterServer (HLINK.@) * DllUnregisterServer (HLINK.@)
*/ */
HRESULT WINAPI DllRegisterServer(void) HRESULT WINAPI DllUnregisterServer(void)
{ {
HRESULT r; return __wine_unregister_resources( instance, NULL );
r = register_clsid(&CLSID_StdHlink);
if (SUCCEEDED(r))
r = register_clsid(&CLSID_StdHlinkBrowseContext);
return S_OK;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment