From 4bd374fa07414e4b187eeb566765a40347b53a0c Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Tue, 6 Jul 2004 21:01:18 +0000 Subject: [PATCH] First implementation of the Advanced Template Library, with just a few functions implemented. --- configure | 3 +- configure.ac | 1 + dlls/Makefile.in | 13 ++++ dlls/atl/.cvsignore | 3 + dlls/atl/Makefile.in | 14 +++++ dlls/atl/atl.spec | 52 +++++++++++++++ dlls/atl/atl_main.c | 146 +++++++++++++++++++++++++++++++++++++++++++ dlls/atl/atlbase.h | 135 +++++++++++++++++++++++++++++++++++++++ 8 files changed, 366 insertions(+), 1 deletion(-) create mode 100644 dlls/atl/.cvsignore create mode 100644 dlls/atl/Makefile.in create mode 100644 dlls/atl/atl.spec create mode 100644 dlls/atl/atl_main.c create mode 100644 dlls/atl/atlbase.h diff --git a/configure b/configure index 91337acc95e..a1f4d548270 100755 --- a/configure +++ b/configure @@ -20183,7 +20183,7 @@ MAKE_LIB_RULES=libs/Makelib.rules MAKE_PROG_RULES=programs/Makeprog.rules - ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile" + ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile" cat >confcache <<\_ACEOF @@ -20724,6 +20724,7 @@ do "dlls/advapi32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/advapi32/Makefile" ;; "dlls/advapi32/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/advapi32/tests/Makefile" ;; "dlls/amstream/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/amstream/Makefile" ;; + "dlls/atl/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/atl/Makefile" ;; "dlls/avicap32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/avicap32/Makefile" ;; "dlls/avifil32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/avifil32/Makefile" ;; "dlls/cabinet/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/cabinet/Makefile" ;; diff --git a/configure.ac b/configure.ac index e63b8429814..5f3c8f685f5 100644 --- a/configure.ac +++ b/configure.ac @@ -1508,6 +1508,7 @@ dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile +dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile diff --git a/dlls/Makefile.in b/dlls/Makefile.in index ae9ec53b8af..eebb7185be6 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -18,6 +18,7 @@ EXTRADIRS = @GLU32FILES@ @GLUT32FILES@ @OPENGLFILES@ @XFILES@ BASEDIRS = \ advapi32 \ amstream \ + atl \ avicap32 \ avifil32 \ cabinet \ @@ -237,6 +238,7 @@ SYMLINKS_SO = \ @WIN16_FILES@ \ advapi32.dll.so \ amstream.dll.so \ + atl.dll.so \ avicap32.dll.so \ avifil32.dll.so \ cabinet.dll.so \ @@ -400,6 +402,9 @@ advapi32.dll.so: advapi32/advapi32.dll.so amstream.dll.so: amstream/amstream.dll.so $(RM) $@ && $(LN_S) amstream/amstream.dll.so $@ +atl.dll.so: atl/atl.dll.so + $(RM) $@ && $(LN_S) atl/atl.dll.so $@ + avicap32.dll.so: avicap32/avicap32.dll.so $(RM) $@ && $(LN_S) avicap32/avicap32.dll.so $@ @@ -945,6 +950,7 @@ libuuid.a: uuid/libuuid.a IMPORT_LIBS = \ libadvapi32 \ libamstream \ + libatl \ libavicap32 \ libavifil32 \ libcabinet \ @@ -1084,6 +1090,11 @@ libamstream.def: amstream/amstream.spec.def libamstream.a: amstream/amstream.spec.def $(DLLTOOL) -k -l $@ -d amstream/amstream.spec.def +libatl.def: atl/atl.spec.def + $(RM) $@ && $(LN_S) atl/atl.spec.def $@ +libatl.a: atl/atl.spec.def + $(DLLTOOL) -k -l $@ -d atl/atl.spec.def + libavicap32.def: avicap32/avicap32.spec.def $(RM) $@ && $(LN_S) avicap32/avicap32.spec.def $@ libavicap32.a: avicap32/avicap32.spec.def @@ -1681,6 +1692,7 @@ libx11drv.a: x11drv/x11drv.spec.def advapi32/advapi32.spec.def: $(WINEBUILD) amstream/amstream.spec.def: $(WINEBUILD) +atl/atl.spec.def: $(WINEBUILD) avicap32/avicap32.spec.def: $(WINEBUILD) avifil32/avifil32.spec.def: $(WINEBUILD) cabinet/cabinet.spec.def: $(WINEBUILD) @@ -1808,6 +1820,7 @@ $(INSTALLSUBDIRS:%=%/__install__): $(ALL_IMPORT_LIBS) advapi32/advapi32.dll.so: advapi32 amstream/amstream.dll.so: amstream +atl/atl.dll.so: atl avicap32/avicap32.dll.so: avicap32 avifil32/avifil32.dll.so: avifil32 cabinet/cabinet.dll.so: cabinet diff --git a/dlls/atl/.cvsignore b/dlls/atl/.cvsignore new file mode 100644 index 00000000000..ca371e3ee47 --- /dev/null +++ b/dlls/atl/.cvsignore @@ -0,0 +1,3 @@ +Makefile +atl.dll.dbg.c +atl.spec.def diff --git a/dlls/atl/Makefile.in b/dlls/atl/Makefile.in new file mode 100644 index 00000000000..8952be9d0aa --- /dev/null +++ b/dlls/atl/Makefile.in @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = atl.dll +IMPORTS = ole32 kernel32 +EXTRALIBS = -luuid + +C_SRCS = \ + atl_main.c + +@MAKE_DLL_RULES@ + +### Dependencies: diff --git a/dlls/atl/atl.spec b/dlls/atl/atl.spec new file mode 100644 index 00000000000..def5c6edca8 --- /dev/null +++ b/dlls/atl/atl.spec @@ -0,0 +1,52 @@ +1 stub DllCanUnloadNow +2 stub DllGetClassObject +3 stub DllRegisterServer +4 stub DllUnregisterServer +10 stub AtlAdvise +11 stub AtlUnadvise +12 stub AtlFreeMarshalStream +13 stub AtlMarshalPtrInProc +14 stub AtlUnmarshalPtr +15 stub AtlModuleGetClassObject +16 stdcall AtlModuleInit(ptr long long) +17 stdcall AtlModuleRegisterClassObjects(ptr long long) +18 stub AtlModuleRegisterServer +19 stub AtlModuleRegisterTypeLib +20 stub AtlModuleRevokeClassObjects +21 stub AtlModuleTerm +22 stub AtlModuleUnregisterServer +23 stub AtlModuleUpdateRegistryFromResourceD +24 stub AtlWaitWithMessageLoop +25 stub AtlSetErrorInfo +26 stub AtlCreateTargetDC +27 stub AtlHiMetricToPixel +28 stub AtlPixelToHiMetric +29 stub AtlDevModeW2A +30 stub AtlComPtrAssign +31 stub AtlComQIPtrAssign +32 stdcall AtlInternalQueryInterface(ptr ptr ptr ptr) +34 stub AtlGetVersion +35 stub AtlAxDialogBoxW +36 stub AtlAxDialogBoxA +37 stub AtlAxCreateDialogW +38 stub AtlAxCreateDialogA +39 stub AtlAxCreateControl +40 stub AtlAxCreateControlEx +41 stub AtlAxAttachControl +42 stub AtlAxWinInit +43 stub AtlModuleAddCreateWndData +44 stub AtlModuleExtractCreateWndData +45 stub AtlModuleRegisterWndClassInfoW +46 stub AtlModuleRegisterWndClassInfoA +47 stub AtlAxGetControl +48 stub AtlAxGetHost +49 stub AtlRegisterClassCategoriesHelper +50 stub AtlIPersistStreamInit_Load +51 stub AtlIPersistStreamInit_Save +52 stub AtlIPersistPropertyBag_Load +53 stub AtlIPersistPropertyBag_Save +54 stub AtlGetObjectSourceInterface +55 stub AtlModuleUnRegisterTypeLib +56 stub AtlModuleLoadTypeLib +57 stub AtlModuleUnregisterServerEx +58 stub AtlModuleAddTermFunc diff --git a/dlls/atl/atl_main.c b/dlls/atl/atl_main.c new file mode 100644 index 00000000000..deb31c1bfa2 --- /dev/null +++ b/dlls/atl/atl_main.c @@ -0,0 +1,146 @@ +/* + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winuser.h" +#include "wine/debug.h" +#include "objbase.h" +#include "objidl.h" +#include "ole2.h" +#include "atlbase.h" + +WINE_DEFAULT_DEBUG_CHANNEL(atl); + +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); + return TRUE; +} + +HRESULT WINAPI AtlModuleInit(_ATL_MODULEA* pM, _ATL_OBJMAP_ENTRYA* p, HINSTANCE h) +{ + INT i; + + FIXME("SEMI-STUB (%p %p %p)\n",pM,p,h); + + memset(pM,0,sizeof(_ATL_MODULEA)); + pM->cbSize = sizeof(_ATL_MODULEA); + pM->m_hInst = h; + pM->m_hInstResource = h; + pM->m_hInstTypeLib = h; + pM->m_pObjMap = p; + pM->m_hHeap = GetProcessHeap(); + + /* call mains */ + i = 0; + while (pM->m_pObjMap[i].pclsid != NULL) + { + TRACE("Initializing object %i\n",i); + p[i].pfnObjectMain(TRUE); + i++; + } + + return S_OK; +} + +HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEA *pM, DWORD dwClsContext, + DWORD dwFlags) +{ + HRESULT hRes = S_OK; + int i=0; + + TRACE("(%p %li %li)\n",pM, dwClsContext, dwFlags); + + if (pM == NULL) + return E_INVALIDARG; + + while(pM->m_pObjMap[i].pclsid != NULL) + { + IUnknown* pUnknown; + _ATL_OBJMAP_ENTRYA *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 AtlInternalQueryInterface(LPVOID this, const _ATL_INTMAP_ENTRY* pEntries, REFIID iid, LPVOID* ppvObject) +{ + int i = 0; + HRESULT rc = E_NOINTERFACE; + TRACE("(%p, %p, %p, %p)\n",this, pEntries, iid, ppvObject); + + if (IsEqualGUID(iid,&IID_IUnknown)) + { + TRACE("Returning IUnknown\n"); + *ppvObject = this; + IUnknown_AddRef((IUnknown*)this); + return S_OK; + } + + while (pEntries[i].pFunc != 0) + { + TRACE("Trying entry %i (%p %li %p)\n",i,pEntries[i].piid, + pEntries[i].dw, pEntries[i].pFunc); + + if (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*)this); + rc = S_OK; + } + else + { + TRACE("Function\n"); + rc = pEntries[i].pFunc(this, iid, ppvObject,0); + } + break; + } + i++; + } + TRACE("Done returning (0x%lx)\n",rc); + return rc; +} diff --git a/dlls/atl/atlbase.h b/dlls/atl/atlbase.h new file mode 100644 index 00000000000..7d3fc22fb5d --- /dev/null +++ b/dlls/atl/atlbase.h @@ -0,0 +1,135 @@ +/* + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +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 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; + +HRESULT WINAPI AtlModuleInit(_ATL_MODULEA* pM, _ATL_OBJMAP_ENTRYA* p, HINSTANCE h); +HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEA* pM, DWORD dwClsContext, DWORD dwFlags); +HRESULT WINAPI AtlModuleTerm(_ATL_MODULEA* pM); +HRESULT WINAPI AtlInternalQueryInterface(LPVOID pThis, + const _ATL_INTMAP_ENTRY* pEntries, REFIID iid, LPVOID* ppvObject);