mirror of
https://github.com/reactos/reactos.git
synced 2025-05-31 06:58:10 +00:00
- Import atl.dll from Wine
- Add atl to bootcd svn path=/trunk/; revision=32163
This commit is contained in:
parent
1e5a0b3061
commit
bd50edb2a5
13 changed files with 3141 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE group SYSTEM "tools/rbuild/project.dtd">
|
<!DOCTYPE group SYSTEM "tools/rbuild/project.dtd">
|
||||||
<group xmlns:xi="http://www.w3.org/2001/XInclude">
|
<group xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
|
<property name="BASEADDRESS_ATL" value="0x76a80000" />
|
||||||
<property name="BASEADDRESS_REGTESTS" value="0x07000000" />
|
<property name="BASEADDRESS_REGTESTS" value="0x07000000" />
|
||||||
<property name="BASEADDRESS_NOTIFYHOOK" value="0x08000000" />
|
<property name="BASEADDRESS_NOTIFYHOOK" value="0x08000000" />
|
||||||
<property name="BASEADDRESS_COMCAT" value="0x20A50000" />
|
<property name="BASEADDRESS_COMCAT" value="0x20A50000" />
|
||||||
|
|
|
@ -167,6 +167,7 @@ dll\win32\acledit\acledit.dll 1
|
||||||
dll\win32\aclui\aclui.dll 1
|
dll\win32\aclui\aclui.dll 1
|
||||||
dll\win32\advapi32\advapi32.dll 1
|
dll\win32\advapi32\advapi32.dll 1
|
||||||
dll\win32\advpack\advpack.dll 1
|
dll\win32\advpack\advpack.dll 1
|
||||||
|
dll\win32\atl\atl.dll 1
|
||||||
dll\win32\authz\authz.dll 1
|
dll\win32\authz\authz.dll 1
|
||||||
dll\win32\avifil32\avifil32.dll 1
|
dll\win32\avifil32\avifil32.dll 1
|
||||||
dll\win32\beepmidi\beepmidi.dll 1
|
dll\win32\beepmidi\beepmidi.dll 1
|
||||||
|
|
27
reactos/dll/win32/atl/atl.rbuild
Normal file
27
reactos/dll/win32/atl/atl.rbuild
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<module name="atl" type="win32dll" baseaddress="${BASEADDRESS_ATL}" installbase="system32" installname="atl.dll" allowwarnings="true" entrypoint="0">
|
||||||
|
<importlibrary definition="atl.spec.def" />
|
||||||
|
<include base="atl">.</include>
|
||||||
|
<include base="ReactOS">include/reactos/wine</include>
|
||||||
|
<define name="__REACTOS__" />
|
||||||
|
<define name="__WINESRC__" />
|
||||||
|
<define name="__USE_W32API" />
|
||||||
|
<define name="_WIN32_IE">0x600</define>
|
||||||
|
<define name="_WIN32_WINNT">0x600</define>
|
||||||
|
<define name="WINVER">0x501</define>
|
||||||
|
<library>wine</library>
|
||||||
|
<library>ole32</library>
|
||||||
|
<library>oleaut32</library>
|
||||||
|
<library>user32</library>
|
||||||
|
<library>gdi32</library>
|
||||||
|
<library>advapi32</library>
|
||||||
|
<library>kernel32</library>
|
||||||
|
<library>uuid</library>
|
||||||
|
<library>ntdll</library>
|
||||||
|
<file>atl_ax.c</file>
|
||||||
|
<file>atl_main.c</file>
|
||||||
|
<file>registrar.c</file>
|
||||||
|
<file>rsrc.rc</file>
|
||||||
|
<file>atliface.idl</file>
|
||||||
|
<include base="atl" root="intermediate">.</include>
|
||||||
|
<file>atl.spec</file>
|
||||||
|
</module>
|
17
reactos/dll/win32/atl/atl.rgs
Normal file
17
reactos/dll/win32/atl/atl.rgs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
HKCR
|
||||||
|
{
|
||||||
|
ATL.Registrar = s 'Registrar Class'
|
||||||
|
{
|
||||||
|
CLSID = s '%CLSID_ATLRegistrar%'
|
||||||
|
}
|
||||||
|
NoRemove CLSID {
|
||||||
|
ForceRemove '%CLSID_ATLRegistrar%' = s 'Registrar Class'
|
||||||
|
{
|
||||||
|
ProgID = s 'ATL.Registrar'
|
||||||
|
InprocServer32 = s '%MODULE%'
|
||||||
|
{
|
||||||
|
val ThreadingModel = s 'Both'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
52
reactos/dll/win32/atl/atl.spec
Normal file
52
reactos/dll/win32/atl/atl.spec
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
1 stdcall -private DllCanUnloadNow()
|
||||||
|
2 stdcall -private DllGetClassObject(ptr ptr ptr)
|
||||||
|
3 stdcall -private DllRegisterServer()
|
||||||
|
4 stdcall -private DllUnregisterServer()
|
||||||
|
10 stdcall AtlAdvise(ptr ptr ptr ptr)
|
||||||
|
11 stdcall AtlUnadvise(ptr ptr long)
|
||||||
|
12 stdcall AtlFreeMarshalStream(ptr)
|
||||||
|
13 stdcall AtlMarshalPtrInProc(ptr ptr ptr)
|
||||||
|
14 stdcall AtlUnmarshalPtr(ptr ptr ptr)
|
||||||
|
15 stdcall AtlModuleGetClassObject(ptr ptr ptr ptr)
|
||||||
|
16 stdcall AtlModuleInit(ptr long long)
|
||||||
|
17 stdcall AtlModuleRegisterClassObjects(ptr long long)
|
||||||
|
18 stdcall AtlModuleRegisterServer(ptr long ptr)
|
||||||
|
19 stdcall AtlModuleRegisterTypeLib(ptr wstr)
|
||||||
|
20 stdcall AtlModuleRevokeClassObjects(ptr)
|
||||||
|
21 stdcall AtlModuleTerm(ptr)
|
||||||
|
22 stdcall AtlModuleUnregisterServer(ptr ptr)
|
||||||
|
23 stdcall AtlModuleUpdateRegistryFromResourceD(ptr wstr long ptr ptr)
|
||||||
|
24 stub AtlWaitWithMessageLoop
|
||||||
|
25 stub AtlSetErrorInfo
|
||||||
|
26 stub AtlCreateTargetDC
|
||||||
|
27 stdcall AtlHiMetricToPixel(ptr ptr)
|
||||||
|
28 stdcall AtlPixelToHiMetric(ptr ptr)
|
||||||
|
29 stub AtlDevModeW2A
|
||||||
|
30 stdcall AtlComPtrAssign(ptr ptr)
|
||||||
|
31 stdcall AtlComQIPtrAssign(ptr ptr ptr)
|
||||||
|
32 stdcall AtlInternalQueryInterface(ptr ptr ptr ptr)
|
||||||
|
34 stub AtlGetVersion
|
||||||
|
35 stub AtlAxDialogBoxW
|
||||||
|
36 stub AtlAxDialogBoxA
|
||||||
|
37 stdcall AtlAxCreateDialogW(long wstr long ptr long)
|
||||||
|
38 stdcall AtlAxCreateDialogA(long str long ptr long)
|
||||||
|
39 stdcall AtlAxCreateControl(ptr ptr ptr ptr)
|
||||||
|
40 stdcall AtlAxCreateControlEx(ptr ptr ptr ptr ptr ptr ptr)
|
||||||
|
41 stdcall AtlAxAttachControl(ptr ptr ptr)
|
||||||
|
42 stdcall AtlAxWinInit()
|
||||||
|
43 stdcall AtlModuleAddCreateWndData(ptr ptr ptr)
|
||||||
|
44 stdcall AtlModuleExtractCreateWndData(ptr)
|
||||||
|
45 stdcall AtlModuleRegisterWndClassInfoW(ptr ptr ptr)
|
||||||
|
46 stub AtlModuleRegisterWndClassInfoA
|
||||||
|
47 stdcall AtlAxGetControl(long ptr)
|
||||||
|
48 stdcall AtlAxGetHost(long ptr)
|
||||||
|
49 stub AtlRegisterClassCategoriesHelper
|
||||||
|
50 stdcall AtlIPersistStreamInit_Load(ptr ptr ptr ptr)
|
||||||
|
51 stdcall AtlIPersistStreamInit_Save(ptr long ptr ptr ptr)
|
||||||
|
52 stub AtlIPersistPropertyBag_Load
|
||||||
|
53 stub AtlIPersistPropertyBag_Save
|
||||||
|
54 stub AtlGetObjectSourceInterface
|
||||||
|
55 stub AtlModuleUnRegisterTypeLib
|
||||||
|
56 stdcall AtlModuleLoadTypeLib(ptr wstr ptr ptr)
|
||||||
|
57 stdcall AtlModuleUnregisterServerEx(ptr long ptr)
|
||||||
|
58 stdcall AtlModuleAddTermFunc(ptr ptr long)
|
1306
reactos/dll/win32/atl/atl_ax.c
Normal file
1306
reactos/dll/win32/atl/atl_ax.c
Normal file
File diff suppressed because it is too large
Load diff
568
reactos/dll/win32/atl/atl_main.c
Normal file
568
reactos/dll/win32/atl/atl_main.c
Normal file
|
@ -0,0 +1,568 @@
|
||||||
|
/*
|
||||||
|
* Implementation of Active Template Library (atl.dll)
|
||||||
|
*
|
||||||
|
* Copyright 2004 Aric Stewart for CodeWeavers
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winerror.h"
|
||||||
|
#include "wingdi.h"
|
||||||
|
#include "winuser.h"
|
||||||
|
#include "wine/debug.h"
|
||||||
|
#include "objbase.h"
|
||||||
|
#include "objidl.h"
|
||||||
|
#include "ole2.h"
|
||||||
|
#include "atlbase.h"
|
||||||
|
#include "atliface.h"
|
||||||
|
#include "atlwin.h"
|
||||||
|
|
||||||
|
#include "wine/unicode.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(atl);
|
||||||
|
|
||||||
|
HINSTANCE hInst;
|
||||||
|
|
||||||
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
{
|
||||||
|
TRACE("(0x%p, %d, %p)\n",hinstDLL,fdwReason,lpvReserved);
|
||||||
|
|
||||||
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||||
|
DisableThreadLibraryCalls(hinstDLL);
|
||||||
|
hInst = hinstDLL;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ATLVer1Size 100
|
||||||
|
|
||||||
|
HRESULT WINAPI AtlModuleInit(_ATL_MODULEW* pM, _ATL_OBJMAP_ENTRYW* p, HINSTANCE h)
|
||||||
|
{
|
||||||
|
INT i;
|
||||||
|
UINT size;
|
||||||
|
|
||||||
|
FIXME("SEMI-STUB (%p %p %p)\n",pM,p,h);
|
||||||
|
|
||||||
|
size = pM->cbSize;
|
||||||
|
if (size != sizeof(_ATL_MODULEW) && size != ATLVer1Size)
|
||||||
|
{
|
||||||
|
FIXME("Unknown structure version (size %i)\n",size);
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(pM,0,pM->cbSize);
|
||||||
|
pM->cbSize = size;
|
||||||
|
pM->m_hInst = h;
|
||||||
|
pM->m_hInstResource = h;
|
||||||
|
pM->m_hInstTypeLib = h;
|
||||||
|
pM->m_pObjMap = p;
|
||||||
|
pM->m_hHeap = GetProcessHeap();
|
||||||
|
|
||||||
|
InitializeCriticalSection(&pM->u.m_csTypeInfoHolder);
|
||||||
|
InitializeCriticalSection(&pM->m_csWindowCreate);
|
||||||
|
InitializeCriticalSection(&pM->m_csObjMap);
|
||||||
|
|
||||||
|
/* call mains */
|
||||||
|
i = 0;
|
||||||
|
if (pM->m_pObjMap != NULL && size > ATLVer1Size)
|
||||||
|
{
|
||||||
|
while (pM->m_pObjMap[i].pclsid != NULL)
|
||||||
|
{
|
||||||
|
TRACE("Initializing object %i %p\n",i,p[i].pfnObjectMain);
|
||||||
|
if (p[i].pfnObjectMain)
|
||||||
|
p[i].pfnObjectMain(TRUE);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI AtlModuleLoadTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex,
|
||||||
|
BSTR *pbstrPath, ITypeLib **ppTypeLib)
|
||||||
|
{
|
||||||
|
HRESULT hRes;
|
||||||
|
OLECHAR path[MAX_PATH+8]; /* leave some space for index */
|
||||||
|
|
||||||
|
TRACE("(%p, %s, %p, %p)\n", pM, debugstr_w(lpszIndex), pbstrPath, ppTypeLib);
|
||||||
|
|
||||||
|
if (!pM)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
GetModuleFileNameW(pM->m_hInstTypeLib, path, MAX_PATH);
|
||||||
|
if (lpszIndex)
|
||||||
|
lstrcatW(path, lpszIndex);
|
||||||
|
|
||||||
|
hRes = LoadTypeLib(path, ppTypeLib);
|
||||||
|
if (FAILED(hRes))
|
||||||
|
return hRes;
|
||||||
|
|
||||||
|
*pbstrPath = SysAllocString(path);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI AtlModuleTerm(_ATL_MODULEW* pM)
|
||||||
|
{
|
||||||
|
_ATL_TERMFUNC_ELEM *iter = pM->m_pTermFuncs, *tmp;
|
||||||
|
|
||||||
|
TRACE("(%p)\n", pM);
|
||||||
|
|
||||||
|
while(iter) {
|
||||||
|
iter->pFunc(iter->dw);
|
||||||
|
tmp = iter;
|
||||||
|
iter = iter->pNext;
|
||||||
|
HeapFree(GetProcessHeap(), 0, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, pM);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULEW *pM, _ATL_TERMFUNC *pFunc, DWORD_PTR dw)
|
||||||
|
{
|
||||||
|
_ATL_TERMFUNC_ELEM *termfunc_elem;
|
||||||
|
|
||||||
|
TRACE("(%p %p %ld)\n", pM, pFunc, dw);
|
||||||
|
|
||||||
|
termfunc_elem = HeapAlloc(GetProcessHeap(), 0, sizeof(_ATL_TERMFUNC_ELEM));
|
||||||
|
termfunc_elem->pFunc = pFunc;
|
||||||
|
termfunc_elem->dw = dw;
|
||||||
|
termfunc_elem->pNext = pM->m_pTermFuncs;
|
||||||
|
|
||||||
|
pM->m_pTermFuncs = termfunc_elem;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEW *pM, DWORD dwClsContext,
|
||||||
|
DWORD dwFlags)
|
||||||
|
{
|
||||||
|
HRESULT hRes = S_OK;
|
||||||
|
int i=0;
|
||||||
|
|
||||||
|
TRACE("(%p %i %i)\n",pM, dwClsContext, dwFlags);
|
||||||
|
|
||||||
|
if (pM == NULL)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
while(pM->m_pObjMap[i].pclsid != NULL)
|
||||||
|
{
|
||||||
|
IUnknown* pUnknown;
|
||||||
|
_ATL_OBJMAP_ENTRYW *obj = &(pM->m_pObjMap[i]);
|
||||||
|
HRESULT rc;
|
||||||
|
|
||||||
|
TRACE("Registering object %i\n",i);
|
||||||
|
if (obj->pfnGetClassObject)
|
||||||
|
{
|
||||||
|
rc = obj->pfnGetClassObject(obj->pfnCreateInstance, &IID_IUnknown,
|
||||||
|
(LPVOID*)&pUnknown);
|
||||||
|
if (SUCCEEDED (rc) )
|
||||||
|
{
|
||||||
|
CoRegisterClassObject(obj->pclsid, pUnknown, dwClsContext,
|
||||||
|
dwFlags, &obj->dwRegister);
|
||||||
|
if (pUnknown)
|
||||||
|
IUnknown_Release(pUnknown);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI AtlModuleUnregisterServerEx(_ATL_MODULEW* pM, BOOL bUnRegTypeLib, const CLSID* pCLSID)
|
||||||
|
{
|
||||||
|
FIXME("(%p, %i, %p) stub\n", pM, bUnRegTypeLib, pCLSID);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IUnknown* WINAPI AtlComPtrAssign(IUnknown** pp, IUnknown *p)
|
||||||
|
{
|
||||||
|
TRACE("(%p %p)\n", pp, p);
|
||||||
|
|
||||||
|
if (p) IUnknown_AddRef(p);
|
||||||
|
if (*pp) IUnknown_Release(*pp);
|
||||||
|
*pp = p;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
IUnknown* WINAPI AtlComQIPtrAssign(IUnknown** pp, IUnknown *p, REFIID riid)
|
||||||
|
{
|
||||||
|
IUnknown *new_p = NULL;
|
||||||
|
|
||||||
|
TRACE("(%p %p %s)\n", pp, p, debugstr_guid(riid));
|
||||||
|
|
||||||
|
if (p) IUnknown_QueryInterface(p, riid, (void **)&new_p);
|
||||||
|
if (*pp) IUnknown_Release(*pp);
|
||||||
|
*pp = new_p;
|
||||||
|
return new_p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT WINAPI AtlInternalQueryInterface(void* this, const _ATL_INTMAP_ENTRY* pEntries, REFIID iid, void** ppvObject)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
HRESULT rc = E_NOINTERFACE;
|
||||||
|
TRACE("(%p, %p, %s, %p)\n",this, pEntries, debugstr_guid(iid), ppvObject);
|
||||||
|
|
||||||
|
if (IsEqualGUID(iid,&IID_IUnknown))
|
||||||
|
{
|
||||||
|
TRACE("Returning IUnknown\n");
|
||||||
|
*ppvObject = ((LPSTR)this+pEntries[0].dw);
|
||||||
|
IUnknown_AddRef((IUnknown*)*ppvObject);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (pEntries[i].pFunc != 0)
|
||||||
|
{
|
||||||
|
TRACE("Trying entry %i (%s %i %p)\n",i,debugstr_guid(pEntries[i].piid),
|
||||||
|
pEntries[i].dw, pEntries[i].pFunc);
|
||||||
|
|
||||||
|
if (pEntries[i].piid && IsEqualGUID(iid,pEntries[i].piid))
|
||||||
|
{
|
||||||
|
TRACE("MATCH\n");
|
||||||
|
if (pEntries[i].pFunc == (_ATL_CREATORARGFUNC*)1)
|
||||||
|
{
|
||||||
|
TRACE("Offset\n");
|
||||||
|
*ppvObject = ((LPSTR)this+pEntries[i].dw);
|
||||||
|
IUnknown_AddRef((IUnknown*)*ppvObject);
|
||||||
|
rc = S_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRACE("Function\n");
|
||||||
|
rc = pEntries[i].pFunc(this, iid, ppvObject,0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
TRACE("Done returning (0x%x)\n",rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlModuleRegisterServer [ATL.@]
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlModuleRegisterServer(_ATL_MODULEW* pM, BOOL bRegTypeLib, const CLSID* clsid)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
HRESULT hRes;
|
||||||
|
|
||||||
|
TRACE("%p %d %s\n", pM, bRegTypeLib, debugstr_guid(clsid));
|
||||||
|
|
||||||
|
if (pM == NULL)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
for (i = 0; pM->m_pObjMap[i].pclsid != NULL; i++) /* register CLSIDs */
|
||||||
|
{
|
||||||
|
if (!clsid || IsEqualCLSID(pM->m_pObjMap[i].pclsid, clsid))
|
||||||
|
{
|
||||||
|
const _ATL_OBJMAP_ENTRYW *obj = &pM->m_pObjMap[i];
|
||||||
|
|
||||||
|
TRACE("Registering clsid %s\n", debugstr_guid(obj->pclsid));
|
||||||
|
hRes = obj->pfnUpdateRegistry(TRUE); /* register */
|
||||||
|
if (FAILED(hRes))
|
||||||
|
return hRes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bRegTypeLib)
|
||||||
|
{
|
||||||
|
hRes = AtlModuleRegisterTypeLib(pM, NULL);
|
||||||
|
if (FAILED(hRes))
|
||||||
|
return hRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlAdvise [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, LPDWORD pdw)
|
||||||
|
{
|
||||||
|
FIXME("%p %p %p %p\n", pUnkCP, pUnk, iid, pdw);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlUnadvise [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID *iid, DWORD dw)
|
||||||
|
{
|
||||||
|
FIXME("%p %p %d\n", pUnkCP, iid, dw);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlFreeMarshalStream [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlFreeMarshalStream(IStream *stm)
|
||||||
|
{
|
||||||
|
FIXME("%p\n", stm);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlMarshalPtrInProc [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlMarshalPtrInProc(IUnknown *pUnk, const IID *iid, IStream **pstm)
|
||||||
|
{
|
||||||
|
FIXME("%p %p %p\n", pUnk, iid, pstm);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlUnmarshalPtr [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlUnmarshalPtr(IStream *stm, const IID *iid, IUnknown **ppUnk)
|
||||||
|
{
|
||||||
|
FIXME("%p %p %p\n", stm, iid, ppUnk);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlModuleGetClassObject [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlModuleGetClassObject(_ATL_MODULEW *pm, REFCLSID rclsid,
|
||||||
|
REFIID riid, LPVOID *ppv)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
HRESULT hres = CLASS_E_CLASSNOTAVAILABLE;
|
||||||
|
|
||||||
|
TRACE("%p %s %s %p\n", pm, debugstr_guid(rclsid), debugstr_guid(riid), ppv);
|
||||||
|
|
||||||
|
if (pm == NULL)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
for (i = 0; pm->m_pObjMap[i].pclsid != NULL; i++)
|
||||||
|
{
|
||||||
|
if (IsEqualCLSID(pm->m_pObjMap[i].pclsid, rclsid))
|
||||||
|
{
|
||||||
|
_ATL_OBJMAP_ENTRYW *obj = &pm->m_pObjMap[i];
|
||||||
|
|
||||||
|
TRACE("found object %i\n", i);
|
||||||
|
if (obj->pfnGetClassObject)
|
||||||
|
{
|
||||||
|
if (!obj->pCF)
|
||||||
|
hres = obj->pfnGetClassObject(obj->pfnCreateInstance,
|
||||||
|
&IID_IUnknown,
|
||||||
|
(void **)&obj->pCF);
|
||||||
|
if (obj->pCF)
|
||||||
|
hres = IUnknown_QueryInterface(obj->pCF, riid, ppv);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WARN("no class object found for %s\n", debugstr_guid(rclsid));
|
||||||
|
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlModuleGetClassObject [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlModuleRegisterTypeLib(_ATL_MODULEW *pm, LPCOLESTR lpszIndex)
|
||||||
|
{
|
||||||
|
HRESULT hRes;
|
||||||
|
BSTR path;
|
||||||
|
ITypeLib *typelib;
|
||||||
|
|
||||||
|
TRACE("%p %s\n", pm, debugstr_w(lpszIndex));
|
||||||
|
|
||||||
|
if (!pm)
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
|
hRes = AtlModuleLoadTypeLib(pm, lpszIndex, &path, &typelib);
|
||||||
|
|
||||||
|
if (SUCCEEDED(hRes))
|
||||||
|
{
|
||||||
|
hRes = RegisterTypeLib(typelib, path, NULL); /* FIXME: pass help directory */
|
||||||
|
ITypeLib_Release(typelib);
|
||||||
|
SysFreeString(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hRes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlModuleRevokeClassObjects [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlModuleRevokeClassObjects(_ATL_MODULEW *pm)
|
||||||
|
{
|
||||||
|
FIXME("%p\n", pm);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlModuleUnregisterServer [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlModuleUnregisterServer(_ATL_MODULEW *pm, const CLSID *clsid)
|
||||||
|
{
|
||||||
|
FIXME("%p %s\n", pm, debugstr_guid(clsid));
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlModuleRegisterWndClassInfoW [ATL.@]
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* pm [IO] Information about the module registering the window.
|
||||||
|
* wci [IO] Information about the window being registered.
|
||||||
|
* pProc [O] Window procedure of the registered class.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Atom representing the registered class.
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
* Can be called multiple times without error, unlike RegisterClassEx().
|
||||||
|
*
|
||||||
|
* If the class name is NULL, then a class with a name of "ATLxxxxxxxx" is
|
||||||
|
* registered, where the 'x's represent a unique value.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
ATOM WINAPI AtlModuleRegisterWndClassInfoW(_ATL_MODULEW *pm, _ATL_WNDCLASSINFOW *wci, WNDPROC *pProc)
|
||||||
|
{
|
||||||
|
ATOM atom;
|
||||||
|
|
||||||
|
FIXME("%p %p %p semi-stub\n", pm, wci, pProc);
|
||||||
|
|
||||||
|
atom = wci->m_atom;
|
||||||
|
if (!atom)
|
||||||
|
{
|
||||||
|
WNDCLASSEXW wc;
|
||||||
|
|
||||||
|
TRACE("wci->m_wc.lpszClassName = %s\n", debugstr_w(wci->m_wc.lpszClassName));
|
||||||
|
|
||||||
|
if (!wci->m_wc.lpszClassName)
|
||||||
|
{
|
||||||
|
static const WCHAR szFormat[] = {'A','T','L','%','0','8','x',0};
|
||||||
|
sprintfW(wci->m_szAutoName, szFormat, (UINT)(UINT_PTR)wci);
|
||||||
|
TRACE("auto-generated class name %s\n", debugstr_w(wci->m_szAutoName));
|
||||||
|
wci->m_wc.lpszClassName = wci->m_szAutoName;
|
||||||
|
}
|
||||||
|
|
||||||
|
atom = GetClassInfoExW(pm->m_hInst, wci->m_wc.lpszClassName, &wc);
|
||||||
|
if (!atom)
|
||||||
|
atom = RegisterClassExW(&wci->m_wc);
|
||||||
|
|
||||||
|
wci->pWndProc = wci->m_wc.lpfnWndProc;
|
||||||
|
wci->m_atom = atom;
|
||||||
|
}
|
||||||
|
*pProc = wci->pWndProc;
|
||||||
|
|
||||||
|
TRACE("returning 0x%04x\n", atom);
|
||||||
|
return atom;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WINAPI AtlHiMetricToPixel(const SIZEL* lpHiMetric, SIZEL* lpPix)
|
||||||
|
{
|
||||||
|
HDC dc = GetDC(NULL);
|
||||||
|
lpPix->cx = lpHiMetric->cx * GetDeviceCaps( dc, LOGPIXELSX ) / 100;
|
||||||
|
lpPix->cy = lpHiMetric->cy * GetDeviceCaps( dc, LOGPIXELSY ) / 100;
|
||||||
|
ReleaseDC( NULL, dc );
|
||||||
|
}
|
||||||
|
|
||||||
|
void WINAPI AtlPixelToHiMetric(const SIZEL* lpPix, SIZEL* lpHiMetric)
|
||||||
|
{
|
||||||
|
HDC dc = GetDC(NULL);
|
||||||
|
lpHiMetric->cx = 100 * lpPix->cx / GetDeviceCaps( dc, LOGPIXELSX );
|
||||||
|
lpHiMetric->cy = 100 * lpPix->cy / GetDeviceCaps( dc, LOGPIXELSY );
|
||||||
|
ReleaseDC( NULL, dc );
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlModuleAddCreateWndData [ATL.@]
|
||||||
|
*/
|
||||||
|
void WINAPI AtlModuleAddCreateWndData(_ATL_MODULEW *pM, _AtlCreateWndData *pData, void* pvObject)
|
||||||
|
{
|
||||||
|
TRACE("(%p, %p, %p)\n", pM, pData, pvObject);
|
||||||
|
|
||||||
|
pData->m_pThis = pvObject;
|
||||||
|
pData->m_dwThreadID = GetCurrentThreadId();
|
||||||
|
pData->m_pNext = pM->m_pCreateWndList;
|
||||||
|
pM->m_pCreateWndList = pData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlModuleExtractCreateWndData [ATL.@]
|
||||||
|
*
|
||||||
|
* NOTE: I failed to find any good description of this function.
|
||||||
|
* Tests show that this function extracts one of _AtlCreateWndData
|
||||||
|
* records from the current thread from a list
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void* WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM)
|
||||||
|
{
|
||||||
|
_AtlCreateWndData **ppData;
|
||||||
|
|
||||||
|
TRACE("(%p)\n", pM);
|
||||||
|
|
||||||
|
for(ppData = &pM->m_pCreateWndList; *ppData!=NULL; ppData = &(*ppData)->m_pNext)
|
||||||
|
{
|
||||||
|
if ((*ppData)->m_dwThreadID == GetCurrentThreadId())
|
||||||
|
{
|
||||||
|
_AtlCreateWndData *pData = *ppData;
|
||||||
|
*ppData = pData->m_pNext;
|
||||||
|
return pData->m_pThis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: should be in a header file */
|
||||||
|
typedef struct ATL_PROPMAP_ENTRY
|
||||||
|
{
|
||||||
|
LPCOLESTR szDesc;
|
||||||
|
DISPID dispid;
|
||||||
|
const CLSID* pclsidPropPage;
|
||||||
|
const IID* piidDispatch;
|
||||||
|
DWORD dwOffsetData;
|
||||||
|
DWORD dwSizeData;
|
||||||
|
VARTYPE vt;
|
||||||
|
} ATL_PROPMAP_ENTRY;
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlIPersistStreamInit_Load [ATL.@]
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlIPersistStreamInit_Load( LPSTREAM pStm, ATL_PROPMAP_ENTRY *pMap,
|
||||||
|
void *pThis, IUnknown *pUnk)
|
||||||
|
{
|
||||||
|
FIXME("(%p, %p, %p, %p)\n", pStm, pMap, pThis, pUnk);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI AtlIPersistStreamInit_Save(LPSTREAM pStm, BOOL fClearDirty,
|
||||||
|
ATL_PROPMAP_ENTRY *pMap, void *pThis,
|
||||||
|
IUnknown *pUnk)
|
||||||
|
{
|
||||||
|
FIXME("(%p, %d, %p, %p, %p)\n", pStm, fClearDirty, pMap, pThis, pUnk);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
166
reactos/dll/win32/atl/atlbase.h
Normal file
166
reactos/dll/win32/atl/atlbase.h
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
/*
|
||||||
|
* Implementation of the Active Template Library (atl.dll)
|
||||||
|
*
|
||||||
|
* Copyright 2004 Aric Stewart for CodeWeavers
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __WINE_ATLBASE_H__
|
||||||
|
#define __WINE_ATLBASE_H__
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include "atliface.h"
|
||||||
|
|
||||||
|
typedef HRESULT (WINAPI _ATL_CREATORFUNC)(void* pv, REFIID riid, LPVOID* ppv);
|
||||||
|
typedef HRESULT (WINAPI _ATL_CREATORARGFUNC)(void* pv, REFIID riid, LPVOID* ppv, DWORD dw);
|
||||||
|
typedef HRESULT (WINAPI _ATL_MODULEFUNC)(DWORD dw);
|
||||||
|
typedef LPCSTR (WINAPI _ATL_DESCRIPTIONFUNCA)();
|
||||||
|
typedef LPCWSTR (WINAPI _ATL_DESCRIPTIONFUNCW)();
|
||||||
|
typedef const struct _ATL_CATMAP_ENTRY* (_ATL_CATMAPFUNC)();
|
||||||
|
typedef void (WINAPI _ATL_TERMFUNC)(DWORD dw);
|
||||||
|
|
||||||
|
typedef struct _ATL_OBJMAP_ENTRYA_TAG
|
||||||
|
{
|
||||||
|
const CLSID* pclsid;
|
||||||
|
HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
|
||||||
|
_ATL_CREATORFUNC* pfnGetClassObject;
|
||||||
|
_ATL_CREATORFUNC* pfnCreateInstance;
|
||||||
|
IUnknown* pCF;
|
||||||
|
DWORD dwRegister;
|
||||||
|
_ATL_DESCRIPTIONFUNCA* pfnGetObjectDescription;
|
||||||
|
_ATL_CATMAPFUNC* pfnGetCategoryMap;
|
||||||
|
void (WINAPI *pfnObjectMain)(BOOL bStarting);
|
||||||
|
}_ATL_OBJMAP_ENTRYA;
|
||||||
|
|
||||||
|
typedef struct _ATL_OBJMAP_ENTRYW_TAG
|
||||||
|
{
|
||||||
|
const CLSID* pclsid;
|
||||||
|
HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
|
||||||
|
_ATL_CREATORFUNC* pfnGetClassObject;
|
||||||
|
_ATL_CREATORFUNC* pfnCreateInstance;
|
||||||
|
IUnknown* pCF;
|
||||||
|
DWORD dwRegister;
|
||||||
|
_ATL_DESCRIPTIONFUNCW* pfnGetObjectDescription;
|
||||||
|
_ATL_CATMAPFUNC* pfnGetCategoryMap;
|
||||||
|
void (WINAPI *pfnObjectMain)(BOOL bStarting);
|
||||||
|
} _ATL_OBJMAP_ENTRYW;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _ATL_TERMFUNC_ELEM_TAG
|
||||||
|
{
|
||||||
|
_ATL_TERMFUNC* pFunc;
|
||||||
|
DWORD_PTR dw;
|
||||||
|
struct _ATL_TERMFUNC_ELEM_TAG* pNext;
|
||||||
|
} _ATL_TERMFUNC_ELEM;
|
||||||
|
|
||||||
|
typedef struct _AtlCreateWndData_TAG
|
||||||
|
{
|
||||||
|
void* m_pThis;
|
||||||
|
DWORD m_dwThreadID;
|
||||||
|
struct _AtlCreateWndData_TAG* m_pNext;
|
||||||
|
} _AtlCreateWndData;
|
||||||
|
|
||||||
|
typedef struct _ATL_MODULEA_TAG
|
||||||
|
{
|
||||||
|
UINT cbSize;
|
||||||
|
HINSTANCE m_hInst;
|
||||||
|
HINSTANCE m_hInstResource;
|
||||||
|
HINSTANCE m_hInstTypeLib;
|
||||||
|
_ATL_OBJMAP_ENTRYA* m_pObjMap;
|
||||||
|
LONG m_nLockCnt;
|
||||||
|
HANDLE m_hHeap;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
CRITICAL_SECTION m_csTypeInfoHolder;
|
||||||
|
CRITICAL_SECTION m_csStaticDataInit;
|
||||||
|
} u;
|
||||||
|
CRITICAL_SECTION m_csWindowCreate;
|
||||||
|
CRITICAL_SECTION m_csObjMap;
|
||||||
|
|
||||||
|
DWORD dwAtlBuildVer;
|
||||||
|
_AtlCreateWndData* m_pCreateWndList;
|
||||||
|
BOOL m_bDestroyHeap;
|
||||||
|
GUID* pguidVer;
|
||||||
|
DWORD m_dwHeaps;
|
||||||
|
HANDLE* m_phHeaps;
|
||||||
|
int m_nHeap;
|
||||||
|
_ATL_TERMFUNC_ELEM* m_pTermFuncs;
|
||||||
|
} _ATL_MODULEA;
|
||||||
|
|
||||||
|
typedef struct _ATL_MODULEW_TAG
|
||||||
|
{
|
||||||
|
UINT cbSize;
|
||||||
|
HINSTANCE m_hInst;
|
||||||
|
HINSTANCE m_hInstResource;
|
||||||
|
HINSTANCE m_hInstTypeLib;
|
||||||
|
_ATL_OBJMAP_ENTRYW* m_pObjMap;
|
||||||
|
LONG m_nLockCnt;
|
||||||
|
HANDLE m_hHeap;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
CRITICAL_SECTION m_csTypeInfoHolder;
|
||||||
|
CRITICAL_SECTION m_csStaticDataInit;
|
||||||
|
} u;
|
||||||
|
CRITICAL_SECTION m_csWindowCreate;
|
||||||
|
CRITICAL_SECTION m_csObjMap;
|
||||||
|
|
||||||
|
DWORD dwAtlBuildVer;
|
||||||
|
_AtlCreateWndData* m_pCreateWndList;
|
||||||
|
BOOL m_bDestroyHeap;
|
||||||
|
GUID* pguidVer;
|
||||||
|
DWORD m_dwHeaps;
|
||||||
|
HANDLE* m_phHeaps;
|
||||||
|
int m_nHeap;
|
||||||
|
_ATL_TERMFUNC_ELEM* m_pTermFuncs;
|
||||||
|
} _ATL_MODULEW;
|
||||||
|
|
||||||
|
typedef struct _ATL_INTMAP_ENTRY_TAG
|
||||||
|
{
|
||||||
|
const IID* piid;
|
||||||
|
DWORD dw;
|
||||||
|
_ATL_CREATORARGFUNC* pFunc;
|
||||||
|
} _ATL_INTMAP_ENTRY;
|
||||||
|
|
||||||
|
struct _ATL_REGMAP_ENTRY
|
||||||
|
{
|
||||||
|
LPCOLESTR szKey;
|
||||||
|
LPCOLESTR szData;
|
||||||
|
};
|
||||||
|
|
||||||
|
HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID * iid, LPDWORD dpw);
|
||||||
|
HRESULT WINAPI AtlAxAttachControl(IUnknown*,HWND,IUnknown**);
|
||||||
|
HRESULT WINAPI AtlAxCreateControl(LPCOLESTR,HWND,IStream*,IUnknown**);
|
||||||
|
HRESULT WINAPI AtlAxCreateControlEx(LPCOLESTR,HWND,IStream*,IUnknown**,IUnknown**,REFIID,IUnknown*);
|
||||||
|
HRESULT WINAPI AtlFreeMarshalStream(IStream *pStream);
|
||||||
|
HRESULT WINAPI AtlInternalQueryInterface(void* pThis, const _ATL_INTMAP_ENTRY* pEntries, REFIID iid, void** ppvObject);
|
||||||
|
HRESULT WINAPI AtlMarshalPtrInProc(IUnknown *pUnk, const IID *iid, IStream **ppStream);
|
||||||
|
void WINAPI AtlModuleAddCreateWndData(_ATL_MODULEW *pM, _AtlCreateWndData *pData, void* pvObject);
|
||||||
|
HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULEW *pM, _ATL_TERMFUNC *pFunc, DWORD_PTR dw);
|
||||||
|
void* WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM);
|
||||||
|
HRESULT WINAPI AtlModuleInit(_ATL_MODULEW* pM, _ATL_OBJMAP_ENTRYW* p, HINSTANCE h);
|
||||||
|
HRESULT WINAPI AtlModuleLoadTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex, BSTR *pbstrPath, ITypeLib **ppTypeLib);
|
||||||
|
HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEW* pM, DWORD dwClsContext, DWORD dwFlags);
|
||||||
|
HRESULT WINAPI AtlModuleRegisterServer(_ATL_MODULEW* pM, BOOL bRegTypeLib, const CLSID* pCLSID);
|
||||||
|
HRESULT WINAPI AtlModuleRegisterTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex);
|
||||||
|
HRESULT WINAPI AtlModuleUnregisterServer(_ATL_MODULEW* pM, const CLSID* pCLSID);
|
||||||
|
HRESULT WINAPI AtlModuleUpdateRegistryFromResourceD(_ATL_MODULEW *pM, LPCOLESTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries, IRegistrar *pReg );
|
||||||
|
HRESULT WINAPI AtlModuleUnregisterServerEx(_ATL_MODULEW* pM, BOOL bUnRegTypeLib, const CLSID* pCLSID);
|
||||||
|
HRESULT WINAPI AtlModuleTerm(_ATL_MODULEW* pM);
|
||||||
|
HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID * iid, DWORD dw);
|
||||||
|
HRESULT WINAPI AtlUnmarshalPtr(IStream *pStream, const IID *iid, IUnknown **ppUnk);
|
||||||
|
|
||||||
|
#endif /* __WINE_ATLBASE_H__ */
|
79
reactos/dll/win32/atl/atliface.idl
Normal file
79
reactos/dll/win32/atl/atliface.idl
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/*
|
||||||
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
import "ocidl.idl";
|
||||||
|
|
||||||
|
cpp_quote("#ifdef ATL_INITGUID")
|
||||||
|
cpp_quote("#include \"initguid.h\"")
|
||||||
|
cpp_quote("#endif")
|
||||||
|
|
||||||
|
[
|
||||||
|
object,
|
||||||
|
oleautomation,
|
||||||
|
uuid(44EC053B-400F-11D0-9DCD-00A0C90391D3)
|
||||||
|
]
|
||||||
|
interface IRegistrar : IUnknown
|
||||||
|
{
|
||||||
|
HRESULT AddReplacement(
|
||||||
|
[in] LPCOLESTR Key,
|
||||||
|
[in] LPCOLESTR item);
|
||||||
|
|
||||||
|
HRESULT ClearReplacements();
|
||||||
|
|
||||||
|
HRESULT ResourceRegisterSz(
|
||||||
|
[in] LPCOLESTR resFileName,
|
||||||
|
[in] LPCOLESTR szID,
|
||||||
|
[in] LPCOLESTR szType);
|
||||||
|
|
||||||
|
HRESULT ResourceUnregisterSz(
|
||||||
|
[in] LPCOLESTR resFileName,
|
||||||
|
[in] LPCOLESTR szID,
|
||||||
|
[in] LPCOLESTR szType);
|
||||||
|
|
||||||
|
HRESULT FileRegister(
|
||||||
|
[in] LPCOLESTR fileName);
|
||||||
|
|
||||||
|
HRESULT FileUnregister(
|
||||||
|
[in] LPCOLESTR fileName);
|
||||||
|
|
||||||
|
HRESULT StringRegister(
|
||||||
|
[in] LPCOLESTR data);
|
||||||
|
|
||||||
|
HRESULT StringUnregister(
|
||||||
|
[in] LPCOLESTR data);
|
||||||
|
|
||||||
|
HRESULT ResourceRegister(
|
||||||
|
[in] LPCOLESTR resFileName,
|
||||||
|
[in] UINT nID,
|
||||||
|
[in] LPCOLESTR szType);
|
||||||
|
|
||||||
|
HRESULT ResourceUnregister(
|
||||||
|
[in] LPCOLESTR resFileName,
|
||||||
|
[in] UINT nID,
|
||||||
|
[in] LPCOLESTR szType);
|
||||||
|
}
|
||||||
|
|
||||||
|
cpp_quote("DEFINE_GUID(CLSID_ATLRegistrar,0x44ec053a,0x400f,0x11d0,0x9d,0xcd,0x00,0xa0,0xc9,0x03,0x91,0xd3);")
|
||||||
|
|
||||||
|
cpp_quote("HRESULT WINAPI AtlAxCreateControl(LPCOLESTR,HWND,IStream*,IUnknown**);")
|
||||||
|
cpp_quote("HRESULT WINAPI AtlAxCreateControlEx(LPCOLESTR,HWND,IStream*,IUnknown**,IUnknown**,REFIID,IUnknown*);")
|
||||||
|
cpp_quote("BOOL WINAPI AtlAxWinInit(void);")
|
||||||
|
|
||||||
|
cpp_quote("HWND WINAPI AtlAxCreateDialogW(HINSTANCE,LPCWSTR,HWND,DLGPROC,LPARAM);");
|
||||||
|
cpp_quote("HWND WINAPI AtlAxCreateDialogA(HINSTANCE,LPCSTR,HWND,DLGPROC,LPARAM);");
|
||||||
|
cpp_quote("#define AtlAxCreateDialog WINELIB_NAME_AW(AtlAxCreateDialog");
|
53
reactos/dll/win32/atl/atlwin.h
Normal file
53
reactos/dll/win32/atl/atlwin.h
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Active Template Library Window Functions
|
||||||
|
*
|
||||||
|
* Copyright 2006 Robert Shearman for CodeWeavers
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __WINE_ATLWIN_H__
|
||||||
|
#define __WINE_ATLWIN_H__
|
||||||
|
|
||||||
|
typedef struct _ATL_WNDCLASSINFOA_TAG
|
||||||
|
{
|
||||||
|
WNDCLASSEXA m_wc;
|
||||||
|
LPCSTR m_lpszOrigName;
|
||||||
|
WNDPROC pWndProc;
|
||||||
|
LPCSTR m_lpszCursorID;
|
||||||
|
BOOL m_bSystemCursor;
|
||||||
|
ATOM m_atom;
|
||||||
|
CHAR m_szAutoName[14];
|
||||||
|
} _ATL_WNDCLASSINFOA;
|
||||||
|
|
||||||
|
typedef struct _ATL_WNDCLASSINFOW_TAG
|
||||||
|
{
|
||||||
|
WNDCLASSEXW m_wc;
|
||||||
|
LPCWSTR m_lpszOrigName;
|
||||||
|
WNDPROC pWndProc;
|
||||||
|
LPCWSTR m_lpszCursorID;
|
||||||
|
BOOL m_bSystemCursor;
|
||||||
|
ATOM m_atom;
|
||||||
|
WCHAR m_szAutoName[14];
|
||||||
|
} _ATL_WNDCLASSINFOW;
|
||||||
|
|
||||||
|
ATOM WINAPI AtlModuleRegisterWndClassInfoA(_ATL_MODULEW *pm, _ATL_WNDCLASSINFOA *wci, WNDPROC *pProc);
|
||||||
|
ATOM WINAPI AtlModuleRegisterWndClassInfoW(_ATL_MODULEW *pm, _ATL_WNDCLASSINFOW *wci, WNDPROC *pProc);
|
||||||
|
|
||||||
|
HDC WINAPI AtlCreateTargetDC(HDC hdc, DVTARGETDEVICE *ptd);
|
||||||
|
void WINAPI AtlHiMetricToPixel(const SIZEL *lpSizeInHiMetric, LPSIZEL lpSizeInPix);
|
||||||
|
void WINAPI AtlPixelToHiMetric(const SIZEL *lpSizeInPix, LPSIZEL lpSizeInHiMetric);
|
||||||
|
|
||||||
|
#endif /* __WINE_ATLWIN_H__ */
|
848
reactos/dll/win32/atl/registrar.c
Normal file
848
reactos/dll/win32/atl/registrar.c
Normal file
|
@ -0,0 +1,848 @@
|
||||||
|
/*
|
||||||
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winuser.h"
|
||||||
|
#include "winreg.h"
|
||||||
|
#include "objbase.h"
|
||||||
|
#include "oaidl.h"
|
||||||
|
#include "string.h"
|
||||||
|
|
||||||
|
#define ATL_INITGUID
|
||||||
|
#include "atliface.h"
|
||||||
|
#include "atlbase.h"
|
||||||
|
|
||||||
|
#include "wine/debug.h"
|
||||||
|
#include "wine/unicode.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(atl);
|
||||||
|
|
||||||
|
static LONG dll_count;
|
||||||
|
|
||||||
|
/**************************************************************
|
||||||
|
* ATLRegistrar implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
static const struct {
|
||||||
|
WCHAR name[22];
|
||||||
|
HKEY key;
|
||||||
|
} root_keys[] = {
|
||||||
|
{{'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0},
|
||||||
|
HKEY_CLASSES_ROOT},
|
||||||
|
{{'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0},
|
||||||
|
HKEY_CURRENT_USER},
|
||||||
|
{{'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0},
|
||||||
|
HKEY_LOCAL_MACHINE},
|
||||||
|
{{'H','K','E','Y','_','U','S','E','R','S',0},
|
||||||
|
HKEY_USERS},
|
||||||
|
{{'H','K','E','Y','_','P','E','R','F','O','R','M','A','N','C','E','_','D','A','T','A',0},
|
||||||
|
HKEY_PERFORMANCE_DATA},
|
||||||
|
{{'H','K','E','Y','_','D','Y','N','_','D','A','T','A',0},
|
||||||
|
HKEY_DYN_DATA},
|
||||||
|
{{'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0},
|
||||||
|
HKEY_CURRENT_CONFIG},
|
||||||
|
{{'H','K','C','R',0}, HKEY_CLASSES_ROOT},
|
||||||
|
{{'H','K','C','U',0}, HKEY_CURRENT_USER},
|
||||||
|
{{'H','K','L','M',0}, HKEY_LOCAL_MACHINE},
|
||||||
|
{{'H','K','U',0}, HKEY_USERS},
|
||||||
|
{{'H','K','P','D',0}, HKEY_PERFORMANCE_DATA},
|
||||||
|
{{'H','K','D','D',0}, HKEY_DYN_DATA},
|
||||||
|
{{'H','K','C','C',0}, HKEY_CURRENT_CONFIG}
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct rep_list_str {
|
||||||
|
LPOLESTR key;
|
||||||
|
LPOLESTR item;
|
||||||
|
int key_len;
|
||||||
|
struct rep_list_str *next;
|
||||||
|
} rep_list;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const IRegistrarVtbl *lpVtbl;
|
||||||
|
LONG ref;
|
||||||
|
rep_list *rep;
|
||||||
|
} Registrar;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
LPOLESTR str;
|
||||||
|
DWORD alloc;
|
||||||
|
DWORD len;
|
||||||
|
} strbuf;
|
||||||
|
|
||||||
|
static void strbuf_init(strbuf *buf)
|
||||||
|
{
|
||||||
|
buf->str = HeapAlloc(GetProcessHeap(), 0, 128*sizeof(WCHAR));
|
||||||
|
buf->alloc = 128;
|
||||||
|
buf->len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void strbuf_write(LPCOLESTR str, strbuf *buf, int len)
|
||||||
|
{
|
||||||
|
if(len == -1)
|
||||||
|
len = lstrlenW(str);
|
||||||
|
if(buf->len+len+1 >= buf->alloc) {
|
||||||
|
buf->alloc = (buf->len+len)<<1;
|
||||||
|
buf->str = HeapReAlloc(GetProcessHeap(), 0, buf->str, buf->alloc*sizeof(WCHAR));
|
||||||
|
}
|
||||||
|
memcpy(buf->str+buf->len, str, len*sizeof(OLECHAR));
|
||||||
|
buf->len += len;
|
||||||
|
buf->str[buf->len] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT get_word(LPCOLESTR *str, strbuf *buf)
|
||||||
|
{
|
||||||
|
LPCOLESTR iter, iter2 = *str;
|
||||||
|
|
||||||
|
buf->len = 0;
|
||||||
|
buf->str[0] = '\0';
|
||||||
|
|
||||||
|
while(isspaceW(*iter2))
|
||||||
|
iter2++;
|
||||||
|
iter = iter2;
|
||||||
|
if(!*iter) {
|
||||||
|
*str = iter;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(*iter == '}' || *iter == '=') {
|
||||||
|
strbuf_write(iter++, buf, 1);
|
||||||
|
}else if(*iter == '\'') {
|
||||||
|
iter2 = ++iter;
|
||||||
|
iter = strchrW(iter, '\'');
|
||||||
|
if(!iter) {
|
||||||
|
WARN("Unexpected end of script\n");
|
||||||
|
*str = iter;
|
||||||
|
return DISP_E_EXCEPTION;
|
||||||
|
}
|
||||||
|
strbuf_write(iter2, buf, iter-iter2);
|
||||||
|
iter++;
|
||||||
|
}else {
|
||||||
|
while(*iter && !isspaceW(*iter))
|
||||||
|
iter++;
|
||||||
|
strbuf_write(iter2, buf, iter-iter2);
|
||||||
|
}
|
||||||
|
|
||||||
|
while(isspaceW(*iter))
|
||||||
|
iter++;
|
||||||
|
*str = iter;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT do_preprocess(const Registrar *This, LPCOLESTR data, strbuf *buf)
|
||||||
|
{
|
||||||
|
LPCOLESTR iter, iter2 = data;
|
||||||
|
rep_list *rep_iter;
|
||||||
|
static const WCHAR wstr[] = {'%',0};
|
||||||
|
|
||||||
|
iter = strchrW(data, '%');
|
||||||
|
while(iter) {
|
||||||
|
strbuf_write(iter2, buf, iter-iter2);
|
||||||
|
|
||||||
|
iter2 = ++iter;
|
||||||
|
if(!*iter2)
|
||||||
|
return DISP_E_EXCEPTION;
|
||||||
|
iter = strchrW(iter2, '%');
|
||||||
|
if(!iter)
|
||||||
|
return DISP_E_EXCEPTION;
|
||||||
|
|
||||||
|
if(iter == iter2) {
|
||||||
|
strbuf_write(wstr, buf, 1);
|
||||||
|
}else {
|
||||||
|
for(rep_iter = This->rep; rep_iter; rep_iter = rep_iter->next) {
|
||||||
|
if(rep_iter->key_len == iter-iter2
|
||||||
|
&& !memicmp(iter2, rep_iter->key, rep_iter->key_len))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(!rep_iter) {
|
||||||
|
WARN("Could not find replacement: %s\n", debugstr_wn(iter2, iter-iter2));
|
||||||
|
return DISP_E_EXCEPTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
strbuf_write(rep_iter->item, buf, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
iter2 = ++iter;
|
||||||
|
iter = strchrW(iter, '%');
|
||||||
|
}
|
||||||
|
|
||||||
|
strbuf_write(iter2, buf, -1);
|
||||||
|
TRACE("%s\n", debugstr_w(buf->str));
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT do_process_key(LPCOLESTR *pstr, HKEY parent_key, strbuf *buf, BOOL do_register)
|
||||||
|
{
|
||||||
|
LPCOLESTR iter = *pstr;
|
||||||
|
HRESULT hres;
|
||||||
|
LONG lres;
|
||||||
|
HKEY hkey = 0;
|
||||||
|
strbuf name;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
NORMAL,
|
||||||
|
NO_REMOVE,
|
||||||
|
IS_VAL,
|
||||||
|
FORCE_REMOVE,
|
||||||
|
DO_DELETE
|
||||||
|
} key_type = NORMAL;
|
||||||
|
|
||||||
|
static const WCHAR wstrNoRemove[] = {'N','o','R','e','m','o','v','e',0};
|
||||||
|
static const WCHAR wstrForceRemove[] = {'F','o','r','c','e','R','e','m','o','v','e',0};
|
||||||
|
static const WCHAR wstrDelete[] = {'D','e','l','e','t','e',0};
|
||||||
|
static const WCHAR wstrval[] = {'v','a','l',0};
|
||||||
|
|
||||||
|
iter = *pstr;
|
||||||
|
hres = get_word(&iter, buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
strbuf_init(&name);
|
||||||
|
|
||||||
|
while(buf->str[1] || buf->str[0] != '}') {
|
||||||
|
key_type = NORMAL;
|
||||||
|
if(!lstrcmpiW(buf->str, wstrNoRemove))
|
||||||
|
key_type = NO_REMOVE;
|
||||||
|
else if(!lstrcmpiW(buf->str, wstrForceRemove))
|
||||||
|
key_type = FORCE_REMOVE;
|
||||||
|
else if(!lstrcmpiW(buf->str, wstrval))
|
||||||
|
key_type = IS_VAL;
|
||||||
|
else if(!lstrcmpiW(buf->str, wstrDelete))
|
||||||
|
key_type = DO_DELETE;
|
||||||
|
|
||||||
|
if(key_type != NORMAL) {
|
||||||
|
hres = get_word(&iter, buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
TRACE("name = %s\n", debugstr_w(buf->str));
|
||||||
|
|
||||||
|
if(do_register) {
|
||||||
|
if(key_type == IS_VAL) {
|
||||||
|
hkey = parent_key;
|
||||||
|
strbuf_write(buf->str, &name, -1);
|
||||||
|
}else if(key_type == DO_DELETE) {
|
||||||
|
TRACE("Deleting %s\n", debugstr_w(buf->str));
|
||||||
|
lres = RegDeleteTreeW(parent_key, buf->str);
|
||||||
|
}else {
|
||||||
|
if(key_type == FORCE_REMOVE)
|
||||||
|
RegDeleteTreeW(parent_key, buf->str);
|
||||||
|
lres = RegCreateKeyW(parent_key, buf->str, &hkey);
|
||||||
|
if(lres != ERROR_SUCCESS) {
|
||||||
|
WARN("Could not create(open) key: %08x\n", lres);
|
||||||
|
hres = HRESULT_FROM_WIN32(lres);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(key_type != IS_VAL && key_type != DO_DELETE) {
|
||||||
|
strbuf_write(buf->str, &name, -1);
|
||||||
|
lres = RegOpenKeyW(parent_key, buf->str, &hkey);
|
||||||
|
if(lres != ERROR_SUCCESS)
|
||||||
|
WARN("Could not open key %s: %08x\n", debugstr_w(name.str), lres);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(key_type != DO_DELETE && *iter == '=') {
|
||||||
|
iter++;
|
||||||
|
hres = get_word(&iter, buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
if(buf->len != 1) {
|
||||||
|
WARN("Wrong registry type: %s\n", debugstr_w(buf->str));
|
||||||
|
hres = DISP_E_EXCEPTION;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(do_register) {
|
||||||
|
switch(buf->str[0]) {
|
||||||
|
case 's':
|
||||||
|
hres = get_word(&iter, buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_SZ, (PBYTE)buf->str,
|
||||||
|
(lstrlenW(buf->str)+1)*sizeof(WCHAR));
|
||||||
|
if(lres != ERROR_SUCCESS) {
|
||||||
|
WARN("Could set value of key: %08x\n", lres);
|
||||||
|
hres = HRESULT_FROM_WIN32(lres);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'd': {
|
||||||
|
WCHAR *end;
|
||||||
|
DWORD dw;
|
||||||
|
if(*iter == '0' && iter[1] == 'x') {
|
||||||
|
iter += 2;
|
||||||
|
dw = strtolW(iter, &end, 16);
|
||||||
|
}else {
|
||||||
|
dw = strtolW(iter, &end, 10);
|
||||||
|
}
|
||||||
|
iter = end;
|
||||||
|
lres = RegSetValueExW(hkey, name.len ? name.str : NULL, 0, REG_DWORD,
|
||||||
|
(PBYTE)&dw, sizeof(dw));
|
||||||
|
if(lres != ERROR_SUCCESS) {
|
||||||
|
WARN("Could set value of key: %08x\n", lres);
|
||||||
|
hres = HRESULT_FROM_WIN32(lres);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
WARN("Wrong resource type: %s\n", debugstr_w(buf->str));
|
||||||
|
hres = DISP_E_EXCEPTION;
|
||||||
|
};
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
}else {
|
||||||
|
if(*iter == '-')
|
||||||
|
iter++;
|
||||||
|
hres = get_word(&iter, buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else if(key_type == IS_VAL) {
|
||||||
|
WARN("value not set!\n");
|
||||||
|
hres = DISP_E_EXCEPTION;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(key_type != IS_VAL && key_type != DO_DELETE && *iter == '{' && isspaceW(iter[1])) {
|
||||||
|
hres = get_word(&iter, buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
hres = do_process_key(&iter, hkey, buf, do_register);
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("%x %x\n", do_register, key_type);
|
||||||
|
if(!do_register && (key_type == NORMAL || key_type == FORCE_REMOVE)) {
|
||||||
|
TRACE("Deleting %s\n", debugstr_w(name.str));
|
||||||
|
RegDeleteKeyW(parent_key, name.str);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hkey && key_type != IS_VAL)
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
hkey = 0;
|
||||||
|
name.len = 0;
|
||||||
|
|
||||||
|
hres = get_word(&iter, buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, name.str);
|
||||||
|
if(hkey && key_type != IS_VAL)
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
*pstr = iter;
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT do_process_root_key(LPCOLESTR data, BOOL do_register)
|
||||||
|
{
|
||||||
|
LPCOLESTR iter = data;
|
||||||
|
strbuf buf;
|
||||||
|
HRESULT hres = S_OK;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
strbuf_init(&buf);
|
||||||
|
hres = get_word(&iter, &buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
while(*iter) {
|
||||||
|
if(!buf.len) {
|
||||||
|
WARN("ward.len == 0, failed\n");
|
||||||
|
hres = DISP_E_EXCEPTION;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for(i=0; i<sizeof(root_keys)/sizeof(root_keys[0]); i++) {
|
||||||
|
if(!lstrcmpiW(buf.str, root_keys[i].name))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(i == sizeof(root_keys)/sizeof(root_keys[0])) {
|
||||||
|
WARN("Wrong root key name: %s\n", debugstr_w(buf.str));
|
||||||
|
hres = DISP_E_EXCEPTION;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
hres = get_word(&iter, &buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
if(buf.str[1] || buf.str[0] != '{') {
|
||||||
|
WARN("Failed, expected '{', got %s\n", debugstr_w(buf.str));
|
||||||
|
hres = DISP_E_EXCEPTION;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
hres = do_process_key(&iter, root_keys[i].key, &buf, do_register);
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
WARN("Processing key failed: %08x\n", hres);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
hres = get_word(&iter, &buf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf.str);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT string_register(Registrar *This, LPCOLESTR data, BOOL do_register)
|
||||||
|
{
|
||||||
|
strbuf buf;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
TRACE("(%p %s %x)\n", This, debugstr_w(data), do_register);
|
||||||
|
|
||||||
|
strbuf_init(&buf);
|
||||||
|
hres = do_preprocess(This, data, &buf);
|
||||||
|
if(FAILED(hres)) {
|
||||||
|
WARN("preprocessing failed!\n");
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf.str);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = do_process_root_key(buf.str, do_register);
|
||||||
|
if(FAILED(hres) && do_register)
|
||||||
|
do_process_root_key(buf.str, FALSE);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, buf.str);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT resource_register(Registrar *This, LPCOLESTR resFileName,
|
||||||
|
LPCOLESTR szID, LPCOLESTR szType, BOOL do_register)
|
||||||
|
{
|
||||||
|
HINSTANCE hins;
|
||||||
|
HRSRC src;
|
||||||
|
LPSTR regstra;
|
||||||
|
LPWSTR regstrw;
|
||||||
|
DWORD len, reslen;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hins = LoadLibraryExW(resFileName, NULL, LOAD_LIBRARY_AS_DATAFILE);
|
||||||
|
if(hins) {
|
||||||
|
src = FindResourceW(hins, szID, szType);
|
||||||
|
if(src) {
|
||||||
|
regstra = (LPSTR)LoadResource(hins, src);
|
||||||
|
reslen = SizeofResource(hins, src);
|
||||||
|
if(regstra) {
|
||||||
|
len = MultiByteToWideChar(CP_ACP, 0, regstra, reslen, NULL, 0)+1;
|
||||||
|
regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, regstra, reslen, regstrw, -1);
|
||||||
|
regstrw[len-1] = '\0';
|
||||||
|
|
||||||
|
hres = string_register(This, regstrw, do_register);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, regstrw);
|
||||||
|
}else {
|
||||||
|
WARN("could not load resource\n");
|
||||||
|
hres = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
}
|
||||||
|
HeapFree(GetProcessHeap(), 0, regstra);
|
||||||
|
}else {
|
||||||
|
WARN("Could not find source\n");
|
||||||
|
hres = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
}
|
||||||
|
FreeLibrary(hins);
|
||||||
|
}else {
|
||||||
|
WARN("Could not load resource file\n");
|
||||||
|
hres = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
}
|
||||||
|
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT file_register(Registrar *This, LPCOLESTR fileName, BOOL do_register)
|
||||||
|
{
|
||||||
|
HANDLE file;
|
||||||
|
DWORD filelen, len;
|
||||||
|
LPWSTR regstrw;
|
||||||
|
LPSTR regstra;
|
||||||
|
LRESULT lres;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
file = CreateFileW(fileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_READONLY, NULL);
|
||||||
|
if(file != INVALID_HANDLE_VALUE) {
|
||||||
|
filelen = GetFileSize(file, NULL);
|
||||||
|
regstra = HeapAlloc(GetProcessHeap(), 0, filelen);
|
||||||
|
lres = ReadFile(file, regstra, filelen, NULL, NULL);
|
||||||
|
if(lres == ERROR_SUCCESS) {
|
||||||
|
len = MultiByteToWideChar(CP_ACP, 0, regstra, filelen, NULL, 0)+1;
|
||||||
|
regstrw = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, regstra, filelen, regstrw, -1);
|
||||||
|
regstrw[len-1] = '\0';
|
||||||
|
|
||||||
|
hres = string_register(This, regstrw, do_register);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, regstrw);
|
||||||
|
}else {
|
||||||
|
WARN("Failed to read faile\n");
|
||||||
|
hres = HRESULT_FROM_WIN32(lres);
|
||||||
|
}
|
||||||
|
HeapFree(GetProcessHeap(), 0, regstra);
|
||||||
|
CloseHandle(file);
|
||||||
|
}else {
|
||||||
|
WARN("Could not open file\n");
|
||||||
|
hres = HRESULT_FROM_WIN32(GetLastError());
|
||||||
|
}
|
||||||
|
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_QueryInterface(IRegistrar *iface, REFIID riid, void **ppvObject)
|
||||||
|
{
|
||||||
|
TRACE("(%p)->(%s %p\n", iface, debugstr_guid(riid), ppvObject);
|
||||||
|
|
||||||
|
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IRegistrar, riid)) {
|
||||||
|
IRegistrar_AddRef(iface);
|
||||||
|
*ppvObject = iface;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI Registrar_AddRef(IRegistrar *iface)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
TRACE("(%p) ->%d\n", This, ref);
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI Registrar_Release(IRegistrar *iface)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
|
TRACE("(%p) ->%d\n", This, ref);
|
||||||
|
if(!ref) {
|
||||||
|
IRegistrar_ClearReplacements(iface);
|
||||||
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
|
InterlockedDecrement(&dll_count);
|
||||||
|
}
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_AddReplacement(IRegistrar *iface, LPCOLESTR Key, LPCOLESTR item)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
int len;
|
||||||
|
rep_list *new_rep;
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s %s)\n", This, debugstr_w(Key), debugstr_w(item));
|
||||||
|
|
||||||
|
new_rep = HeapAlloc(GetProcessHeap(), 0, sizeof(rep_list));
|
||||||
|
|
||||||
|
new_rep->key_len = lstrlenW(Key);
|
||||||
|
new_rep->key = HeapAlloc(GetProcessHeap(), 0, new_rep->key_len*sizeof(OLECHAR)+1);
|
||||||
|
memcpy(new_rep->key, Key, (new_rep->key_len+1)*sizeof(OLECHAR));
|
||||||
|
|
||||||
|
len = lstrlenW(item)+1;
|
||||||
|
new_rep->item = HeapAlloc(GetProcessHeap(), 0, len*sizeof(OLECHAR));
|
||||||
|
memcpy(new_rep->item, item, len*sizeof(OLECHAR));
|
||||||
|
|
||||||
|
new_rep->next = This->rep;
|
||||||
|
This->rep = new_rep;
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_ClearReplacements(IRegistrar *iface)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
rep_list *iter, *iter2;
|
||||||
|
|
||||||
|
TRACE("(%p)\n", This);
|
||||||
|
|
||||||
|
if(!This->rep)
|
||||||
|
return S_OK;
|
||||||
|
|
||||||
|
iter = This->rep;
|
||||||
|
while(iter) {
|
||||||
|
iter2 = iter->next;
|
||||||
|
HeapFree(GetProcessHeap(), 0, iter->key);
|
||||||
|
HeapFree(GetProcessHeap(), 0, iter->item);
|
||||||
|
HeapFree(GetProcessHeap(), 0, iter);
|
||||||
|
iter = iter2;
|
||||||
|
}
|
||||||
|
|
||||||
|
This->rep = NULL;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_ResourceRegisterSz(IRegistrar* iface, LPCOLESTR resFileName,
|
||||||
|
LPCOLESTR szID, LPCOLESTR szType)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType));
|
||||||
|
return resource_register(This, resFileName, szID, szType, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_ResourceUnregisterSz(IRegistrar* iface, LPCOLESTR resFileName,
|
||||||
|
LPCOLESTR szID, LPCOLESTR szType)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType));
|
||||||
|
return resource_register(This, resFileName, szID, szType, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_FileRegister(IRegistrar* iface, LPCOLESTR fileName)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
TRACE("(%p)->(%s)\n", This, debugstr_w(fileName));
|
||||||
|
return file_register(This, fileName, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_FileUnregister(IRegistrar* iface, LPCOLESTR fileName)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
FIXME("(%p)->(%s)\n", This, debugstr_w(fileName));
|
||||||
|
return file_register(This, fileName, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_StringRegister(IRegistrar* iface, LPCOLESTR data)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
TRACE("(%p)->(%s)\n", This, debugstr_w(data));
|
||||||
|
return string_register(This, data, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_StringUnregister(IRegistrar* iface, LPCOLESTR data)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
TRACE("(%p)->(%s)\n", This, debugstr_w(data));
|
||||||
|
return string_register(This, data, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_ResourceRegister(IRegistrar* iface, LPCOLESTR resFileName,
|
||||||
|
UINT nID, LPCOLESTR szType)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
TRACE("(%p)->(%s %d %s)\n", iface, debugstr_w(resFileName), nID, debugstr_w(szType));
|
||||||
|
return resource_register(This, resFileName, MAKEINTRESOURCEW(nID), szType, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI Registrar_ResourceUnregister(IRegistrar* iface, LPCOLESTR resFileName,
|
||||||
|
UINT nID, LPCOLESTR szType)
|
||||||
|
{
|
||||||
|
Registrar *This = (Registrar*)iface;
|
||||||
|
TRACE("(%p)->(%s %d %s)\n", This, debugstr_w(resFileName), nID, debugstr_w(szType));
|
||||||
|
return resource_register(This, resFileName, MAKEINTRESOURCEW(nID), szType, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IRegistrarVtbl RegistrarVtbl = {
|
||||||
|
Registrar_QueryInterface,
|
||||||
|
Registrar_AddRef,
|
||||||
|
Registrar_Release,
|
||||||
|
Registrar_AddReplacement,
|
||||||
|
Registrar_ClearReplacements,
|
||||||
|
Registrar_ResourceRegisterSz,
|
||||||
|
Registrar_ResourceUnregisterSz,
|
||||||
|
Registrar_FileRegister,
|
||||||
|
Registrar_FileUnregister,
|
||||||
|
Registrar_StringRegister,
|
||||||
|
Registrar_StringUnregister,
|
||||||
|
Registrar_ResourceRegister,
|
||||||
|
Registrar_ResourceUnregister,
|
||||||
|
};
|
||||||
|
|
||||||
|
static HRESULT Registrar_create(const IUnknown *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;
|
||||||
|
|
||||||
|
InterlockedIncrement(&dll_count);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**************************************************************
|
||||||
|
* ClassFactory implementation
|
||||||
|
*/
|
||||||
|
|
||||||
|
static HRESULT WINAPI RegistrarCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppvObject)
|
||||||
|
{
|
||||||
|
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
|
||||||
|
|
||||||
|
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IRegistrar, riid)) {
|
||||||
|
*ppvObject = iface;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI RegistrarCF_AddRef(IClassFactory *iface)
|
||||||
|
{
|
||||||
|
InterlockedIncrement(&dll_count);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI RegistrarCF_Release(IClassFactory *iface)
|
||||||
|
{
|
||||||
|
InterlockedDecrement(&dll_count);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI RegistrarCF_CreateInstance(IClassFactory *iface, LPUNKNOWN pUnkOuter,
|
||||||
|
REFIID riid, void **ppvObject)
|
||||||
|
{
|
||||||
|
TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppvObject);
|
||||||
|
return Registrar_create(pUnkOuter, riid, ppvObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI RegistrarCF_LockServer(IClassFactory *iface, BOOL lock)
|
||||||
|
{
|
||||||
|
TRACE("(%p)->(%x)\n", iface, lock);
|
||||||
|
|
||||||
|
if(lock)
|
||||||
|
InterlockedIncrement(&dll_count);
|
||||||
|
else
|
||||||
|
InterlockedDecrement(&dll_count);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IClassFactoryVtbl IRegistrarCFVtbl = {
|
||||||
|
RegistrarCF_QueryInterface,
|
||||||
|
RegistrarCF_AddRef,
|
||||||
|
RegistrarCF_Release,
|
||||||
|
RegistrarCF_CreateInstance,
|
||||||
|
RegistrarCF_LockServer
|
||||||
|
};
|
||||||
|
|
||||||
|
static IClassFactory RegistrarCF = { &IRegistrarCFVtbl };
|
||||||
|
|
||||||
|
/**************************************************************
|
||||||
|
* DllGetClassObject (ATL.2)
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, LPVOID *ppvObject)
|
||||||
|
{
|
||||||
|
TRACE("(%s %s %p)\n", debugstr_guid(clsid), debugstr_guid(riid), ppvObject);
|
||||||
|
|
||||||
|
if(IsEqualGUID(&CLSID_ATLRegistrar, clsid)) {
|
||||||
|
*ppvObject = &RegistrarCF;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
FIXME("Not supported class %s\n", debugstr_guid(clsid));
|
||||||
|
return CLASS_E_CLASSNOTAVAILABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern HINSTANCE hInst;
|
||||||
|
|
||||||
|
static HRESULT do_register_dll_server(IRegistrar *pRegistrar, LPCOLESTR wszDll,
|
||||||
|
LPCOLESTR wszId, BOOL do_register,
|
||||||
|
const struct _ATL_REGMAP_ENTRY* pMapEntries)
|
||||||
|
{
|
||||||
|
WCHAR buf[MAX_PATH];
|
||||||
|
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};
|
||||||
|
static const WCHAR wszCLSID_ATLRegistrar[] =
|
||||||
|
{'C','L','S','I','D','_','A','T','L','R','e','g','i','s','t','r','a','r',0};
|
||||||
|
|
||||||
|
if (!pRegistrar)
|
||||||
|
Registrar_create(NULL, &IID_IRegistrar, (void**)&pRegistrar);
|
||||||
|
|
||||||
|
IRegistrar_AddReplacement(pRegistrar, wszModule, wszDll);
|
||||||
|
|
||||||
|
for (pMapEntry = pMapEntries; pMapEntry && pMapEntry->szKey; pMapEntry++)
|
||||||
|
IRegistrar_AddReplacement(pRegistrar, pMapEntry->szKey, pMapEntry->szData);
|
||||||
|
|
||||||
|
StringFromGUID2(&CLSID_ATLRegistrar, buf, sizeof(buf)/sizeof(buf[0]));
|
||||||
|
IRegistrar_AddReplacement(pRegistrar, wszCLSID_ATLRegistrar, buf);
|
||||||
|
|
||||||
|
if(do_register)
|
||||||
|
hres = IRegistrar_ResourceRegisterSz(pRegistrar, wszDll, wszId, wszRegistry);
|
||||||
|
else
|
||||||
|
hres = IRegistrar_ResourceUnregisterSz(pRegistrar, wszDll, wszId, wszRegistry);
|
||||||
|
|
||||||
|
IRegistrar_Release(pRegistrar);
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT do_register_server(BOOL do_register)
|
||||||
|
{
|
||||||
|
static const WCHAR wszDll[] = {'a','t','l','.','d','l','l',0};
|
||||||
|
return do_register_dll_server(NULL, wszDll, MAKEINTRESOURCEW(101), do_register, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AtlModuleUpdateRegistryFromResourceD [ATL.@]
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI AtlModuleUpdateRegistryFromResourceD(_ATL_MODULEW* pM, LPCOLESTR lpszRes,
|
||||||
|
BOOL bRegister, struct _ATL_REGMAP_ENTRY* pMapEntries, IRegistrar* pReg)
|
||||||
|
{
|
||||||
|
HINSTANCE lhInst = pM->m_hInst;
|
||||||
|
/* everything inside this function below this point
|
||||||
|
* should go into atl71.AtlUpdateRegistryFromResourceD
|
||||||
|
*/
|
||||||
|
WCHAR module_name[MAX_PATH];
|
||||||
|
|
||||||
|
if(!GetModuleFileNameW(lhInst, module_name, MAX_PATH)) {
|
||||||
|
FIXME("hinst %p: did not get module name\n",
|
||||||
|
lhInst);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("%p (%s), %s, %d, %p, %p\n", hInst, debugstr_w(module_name),
|
||||||
|
debugstr_w(lpszRes), bRegister, pMapEntries, pReg);
|
||||||
|
|
||||||
|
return do_register_dll_server(pReg, module_name, lpszRes, bRegister, pMapEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DllRegisterServer (ATL.@)
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI DllRegisterServer(void)
|
||||||
|
{
|
||||||
|
TRACE("\n");
|
||||||
|
return do_register_server(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DllRegisterServer (ATL.@)
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI DllUnregisterServer(void)
|
||||||
|
{
|
||||||
|
TRACE("\n");
|
||||||
|
return do_register_server(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DllCanUnloadNow (ATL.@)
|
||||||
|
*/
|
||||||
|
HRESULT WINAPI DllCanUnloadNow(void)
|
||||||
|
{
|
||||||
|
TRACE("dll_count = %u\n", dll_count);
|
||||||
|
return dll_count ? S_FALSE : S_OK;
|
||||||
|
}
|
20
reactos/dll/win32/atl/rsrc.rc
Normal file
20
reactos/dll/win32/atl/rsrc.rc
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* @makedep: atl.rgs */
|
||||||
|
101 REGISTRY atl.rgs
|
|
@ -13,6 +13,9 @@
|
||||||
<directory name="advpack">
|
<directory name="advpack">
|
||||||
<xi:include href="advpack/advpack.rbuild" />
|
<xi:include href="advpack/advpack.rbuild" />
|
||||||
</directory>
|
</directory>
|
||||||
|
<directory name="atl">
|
||||||
|
<xi:include href="atl/atl.rbuild" />
|
||||||
|
</directory>
|
||||||
<directory name="authz">
|
<directory name="authz">
|
||||||
<xi:include href="authz/authz.rbuild" />
|
<xi:include href="authz/authz.rbuild" />
|
||||||
</directory>
|
</directory>
|
||||||
|
|
Loading…
Reference in a new issue