Commit d12cb306 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

Use ATLRegistrar to register atl.dll.

parent 793fd564
......@@ -2,3 +2,4 @@ Makefile
atl.dll.dbg.c
atl.spec.def
atliface.h
rsrc.res
......@@ -8,12 +8,15 @@ EXTRALIBS = $(LIBUNICODE) -luuid
C_SRCS = \
atl_main.c \
registrar.c \
regsvr.c
registrar.c
RC_SRCS = rsrc.rc
IDL_SRCS = \
atliface.idl
rsrc.res: atl.rgs
@MAKE_DLL_RULES@
### Dependencies:
HKCR
{
ATL.Registrar = s 'Registrar Class'
{
CLSID = s '%CLSID_ATLRegistrar%'
}
NoRemove CLSID {
ForceRemove '%CLSID_ATLRegistrar%' = s 'Registrar Class'
{
ProgID = s 'ATL.Registrar'
InprocServer = s '%MODULE%'
{
ThreadingModel = s 'Both'
}
}
}
}
......@@ -35,11 +35,16 @@
WINE_DEFAULT_DEBUG_CHANNEL(atl);
HINSTANCE hInst;
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(0x%p, %ld, %p)\n",hinstDLL,fdwReason,lpvReserved);
if (fdwReason == DLL_PROCESS_ATTACH) DisableThreadLibraryCalls(hinstDLL);
if (fdwReason == DLL_PROCESS_ATTACH) {
DisableThreadLibraryCalls(hinstDLL);
hInst = hinstDLL;
}
return TRUE;
}
......
......@@ -605,6 +605,21 @@ static IRegistrarVtbl RegistrarVtbl = {
Registrar_ResourceUnregister,
};
static HRESULT Registrar_create(LPUNKNOWN pUnkOuter, REFIID riid, void **ppvObject)
{
Registrar *ret;
if(!IsEqualGUID(&IID_IUnknown, riid) && !IsEqualGUID(&IID_IRegistrar, riid))
return E_NOINTERFACE;
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(Registrar));
ret->lpVtbl = &RegistrarVtbl;
ret->ref = 1;
ret->rep = NULL;
*ppvObject = ret;
return S_OK;
}
/**************************************************************
* ClassFactory implementation
......@@ -632,21 +647,11 @@ static ULONG WINAPI RegistrarCF_Release(IClassFactory *iface)
return 1;
}
static HRESULT WINAPI RegistrarCF_CreateInstance(IClassFactory *iface, LPUNKNOWN pUnkOuter, REFIID riid, void **ppvObject)
static HRESULT WINAPI RegistrarCF_CreateInstance(IClassFactory *iface, LPUNKNOWN pUnkOuter,
REFIID riid, void **ppvObject)
{
Registrar *ret;
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
if(!IsEqualGUID(&IID_IUnknown, riid) && !IsEqualGUID(&IID_IRegistrar, riid))
return E_NOINTERFACE;
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(Registrar));
ret->lpVtbl = &RegistrarVtbl;
ret->ref = 1;
ret->rep = NULL;
*ppvObject = ret;
return S_OK;
return Registrar_create(pUnkOuter, riid, ppvObject);
}
static HRESULT WINAPI RegistrarCF_LockServer(IClassFactory *iface, BOOL lock)
......@@ -680,3 +685,50 @@ HRESULT WINAPI ATL_DllGetClassObject(REFCLSID clsid, REFIID riid, LPVOID *ppvObj
FIXME("Not supported class %s\n", debugstr_guid(clsid));
return CLASS_E_CLASSNOTAVAILABLE;
}
extern HINSTANCE hInst;
static HRESULT do_register_server(BOOL do_register)
{
WCHAR buf[MAX_PATH];
HRESULT hres;
IRegistrar *pRegistrar;
static const WCHAR wszModule[] = {'M','O','D','U','L','E',0};
static const WCHAR wszDll[] = {'a','t','l','.','d','l','l',0};
static const WCHAR wszRegistry[] = {'R','E','G','I','S','T','R','Y',0};
static const WCHAR wszCLSID_ATLRegistrar[] =
{'C','L','S','I','D','_','A','T','L','R','e','g','i','s','t','r','a','r',0};
Registrar_create(NULL, &IID_IRegistrar, (void**)&pRegistrar);
IRegistrar_AddReplacement(pRegistrar, wszModule, wszDll);
StringFromGUID2(&CLSID_ATLRegistrar, buf, sizeof(buf)/sizeof(buf[0]));
IRegistrar_AddReplacement(pRegistrar, wszCLSID_ATLRegistrar, buf);
if(do_register)
hres = IRegistrar_ResourceRegister(pRegistrar, wszDll, 1, wszRegistry);
else
hres = IRegistrar_ResourceUnregister(pRegistrar, wszDll, 1, wszRegistry);
IRegistrar_Release(pRegistrar);
return hres;
}
/***********************************************************************
* DllRegisterServer (ATL.@)
*/
HRESULT WINAPI ATL_DllRegisterServer(void)
{
TRACE("\n");
return do_register_server(TRUE);
}
/***********************************************************************
* DllRegisterServer (ATL.@)
*/
HRESULT WINAPI ATL_DllUnregisterServer(void)
{
TRACE("\n");
return do_register_server(FALSE);
}
/*
* Copyright 2005 Jacek Caban
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
1 REGISTRY atl.rgs
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