hlink: Convert dll registration to the IRegistrar mechanism.
This commit is contained in:
parent
26c7172177
commit
61eb983313
|
@ -9,4 +9,6 @@ C_SRCS = \
|
|||
hlink_main.c \
|
||||
link.c
|
||||
|
||||
IDL_R_SRCS = hlink_classes.idl
|
||||
|
||||
@MAKE_DLL_RULES@
|
||||
|
|
|
@ -30,4 +30,4 @@
|
|||
@ stdcall -private DllCanUnloadNow()
|
||||
@ stdcall -private DllGetClassObject(ptr ptr ptr)
|
||||
@ stdcall -private DllRegisterServer()
|
||||
# @ stub -private DllUnregisterServer
|
||||
@ stdcall -private DllUnregisterServer()
|
||||
|
|
|
@ -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; }
|
|
@ -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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllRegisterServer (HLINK.@)
|
||||
*/
|
||||
HRESULT WINAPI DllRegisterServer(void)
|
||||
{
|
||||
HRESULT r;
|
||||
|
||||
r = register_clsid(&CLSID_StdHlink);
|
||||
if (SUCCEEDED(r))
|
||||
r = register_clsid(&CLSID_StdHlinkBrowseContext);
|
||||
|
||||
return S_OK;
|
||||
return __wine_register_resources( instance, NULL );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllUnregisterServer (HLINK.@)
|
||||
*/
|
||||
HRESULT WINAPI DllUnregisterServer(void)
|
||||
{
|
||||
return __wine_unregister_resources( instance, NULL );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue