From 6b40f64e180a7dc9556ed91f83e9fd2ae0da7123 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 11 Mar 2009 17:12:32 +0100 Subject: [PATCH] ole32: Make compobj.dll into a stand-alone 16-bit module. --- .gitignore | 1 - configure | 10 ++ configure.ac | 2 + dlls/Makefile.in | 4 - dlls/compobj.dll16/Makefile.in | 15 +++ .../ole16.c => compobj.dll16/compobj.c} | 106 ++++++++++++------ .../compobj.dll16.spec} | 12 +- dlls/ole32/Makefile.in | 6 - dlls/ole32/compobj.c | 6 - 9 files changed, 103 insertions(+), 59 deletions(-) create mode 100644 dlls/compobj.dll16/Makefile.in rename dlls/{ole32/ole16.c => compobj.dll16/compobj.c} (90%) rename dlls/{ole32/compobj.spec => compobj.dll16/compobj.dll16.spec} (96%) diff --git a/.gitignore b/.gitignore index 298ec905092..cb0184456d1 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,6 @@ dlls/advapi32/svcctl_c.c dlls/atl/atliface.h dlls/avifile.dll16 dlls/commdlg.dll16 -dlls/compobj.dll16 dlls/ctl3d.dll16 dlls/ctl3dv2.dll16 dlls/ddeml.dll16 diff --git a/configure b/configure index e453fee05bd..c18840db625 100755 --- a/configure +++ b/configure @@ -3902,6 +3902,7 @@ then WIN16_FILES="" WIN16_INSTALL="" enable_comm_drv16=${enable_comm_drv16:-no} + enable_compobj_dll16=${enable_compobj_dll16:-no} enable_dispdib_dll16=${enable_dispdib_dll16:-no} enable_display_drv16=${enable_display_drv16:-no} enable_ifsmgr_vxd=${enable_ifsmgr_vxd:-no} @@ -24768,6 +24769,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS dlls/comm.drv16/Makefile: dlls/comm.drv16/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/comm.drv16/Makefile" +ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/compobj.dll16/Makefile" +test "x$enable_compobj_dll16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + compobj.dll16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/compobj.dll16/Makefile: dlls/compobj.dll16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/compobj.dll16/Makefile" + ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/compstui/Makefile" test "x$enable_compstui" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ @@ -29021,6 +29030,7 @@ do "dlls/comdlg32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/comdlg32/Makefile" ;; "dlls/comdlg32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/comdlg32/tests/Makefile" ;; "dlls/comm.drv16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/comm.drv16/Makefile" ;; + "dlls/compobj.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/compobj.dll16/Makefile" ;; "dlls/compstui/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/compstui/Makefile" ;; "dlls/credui/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/credui/Makefile" ;; "dlls/credui/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/credui/tests/Makefile" ;; diff --git a/configure.ac b/configure.ac index 887497da0b4..f4e34a95859 100644 --- a/configure.ac +++ b/configure.ac @@ -139,6 +139,7 @@ then WIN16_FILES="" WIN16_INSTALL="" enable_comm_drv16=${enable_comm_drv16:-no} + enable_compobj_dll16=${enable_compobj_dll16:-no} enable_dispdib_dll16=${enable_dispdib_dll16:-no} enable_display_drv16=${enable_display_drv16:-no} enable_ifsmgr_vxd=${enable_ifsmgr_vxd:-no} @@ -1934,6 +1935,7 @@ WINE_CONFIG_MAKEFILE([dlls/comctl32/tests/Makefile],[dlls/Maketest.rules],[dlls] WINE_CONFIG_MAKEFILE([dlls/comdlg32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/comdlg32/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/comm.drv16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/compobj.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/compstui/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/credui/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/credui/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index f6557dbaa47..27783bea0a3 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -20,7 +20,6 @@ DOCSUBDIRS = $(DLLSUBDIRS) WIN16_FILES = \ avifile.dll16 \ commdlg.dll16 \ - compobj.dll16 \ ctl3d.dll16 \ ctl3dv2.dll16 \ ddeml.dll16 \ @@ -79,9 +78,6 @@ krnl386.exe16 system.drv16 toolhelp.dll16: msvideo.dll16: echo "msvfw32.dll" >$@ -compobj.dll16: - echo "ole32.dll" >$@ - ole2disp.dll16 typelib.dll16: echo "oleaut32.dll" >$@ diff --git a/dlls/compobj.dll16/Makefile.in b/dlls/compobj.dll16/Makefile.in new file mode 100644 index 00000000000..8fd49fb6fd9 --- /dev/null +++ b/dlls/compobj.dll16/Makefile.in @@ -0,0 +1,15 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = compobj.dll16 +IMPORTS = uuid ole32 advapi32 kernel32 +EXTRADLLFLAGS = -Wb,--subsystem,win16,--main-module,ole32.dll + +SPEC_SRCS = compobj.dll16.spec + +C_SRCS = compobj.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/ole32/ole16.c b/dlls/compobj.dll16/compobj.c similarity index 90% rename from dlls/ole32/ole16.c rename to dlls/compobj.dll16/compobj.c index 514a91251a8..8b67322de2a 100644 --- a/dlls/ole32/ole16.c +++ b/dlls/compobj.dll16/compobj.c @@ -42,7 +42,6 @@ #include "wtypes.h" #include "wine/unicode.h" #include "wine/winbase16.h" -#include "compobj_private.h" #include "wine/debug.h" @@ -158,7 +157,7 @@ SEGPTR CDECL IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb) SEGPTR ret; IMalloc16Impl *This = (IMalloc16Impl *)iface; TRACE("(%p)->Realloc(%08x,%d)\n",This,pv,cb); - if (!pv) + if (!pv) ret = IMalloc16_fnAlloc(iface, cb); else if (cb) { ret = MapLS( HeapReAlloc( GetProcessHeap(), 0, MapSL(pv), cb ) ); @@ -231,6 +230,14 @@ IMalloc16_Constructor(void) } +/****************************************************************************** + * CoBuildVersion [COMPOBJ.1] + */ +DWORD WINAPI CoBuildVersion16(void) +{ + return CoBuildVersion(); +} + /*********************************************************************** * CoGetMalloc [COMPOBJ.4] * @@ -284,6 +291,14 @@ void WINAPI CoUninitialize16(void) CoFreeAllLibraries(); } +/*********************************************************************** + * CoFreeUnusedLibraries [COMPOBJ.17] + */ +void WINAPI CoFreeUnusedLibraries16(void) +{ + return CoFreeUnusedLibraries(); +} + /*********************************************************************** * IsEqualGUID [COMPOBJ.18] * @@ -417,15 +432,17 @@ _xmalloc16(DWORD size, SEGPTR *ptr) { HRESULT WINAPI StringFromCLSID16( REFCLSID id, /* [in] the GUID to be converted */ - LPOLESTR16 *idstr /* [out] a pointer to a to-be-allocated segmented pointer pointing to the resulting string */ + LPOLESTR16 *idstr ) /* [out] a pointer to a to-be-allocated segmented pointer pointing to the resulting string */ +{ + WCHAR buffer[40]; + HRESULT ret; -) { - HRESULT ret; - - ret = _xmalloc16(40,(SEGPTR*)idstr); - if (ret != S_OK) + ret = _xmalloc16(40,(SEGPTR*)idstr); + if (ret != S_OK) + return ret; + StringFromGUID2( id, buffer, 40 ); + WideCharToMultiByte( CP_ACP, 0, buffer, -1, MapSL((SEGPTR)*idstr), 40, NULL, NULL ); return ret; - return WINE_StringFromCLSID(id,MapSL((SEGPTR)*idstr)); } /****************************************************************************** @@ -439,37 +456,21 @@ HRESULT WINAPI StringFromCLSID16( */ HRESULT WINAPI ProgIDFromCLSID16( REFCLSID clsid, /* [in] class id as found in registry */ - LPOLESTR16 *lplpszProgID/* [out] associated Program ID */ -) { - static const WCHAR wszProgID[] = {'P','r','o','g','I','D',0}; - HKEY hkey; - HRESULT ret; - LONG len; - char *buffer; - - ret = COM_OpenKeyForCLSID(clsid, wszProgID, KEY_READ, &hkey); - if (FAILED(ret)) - return ret; - - if (RegQueryValueA(hkey, NULL, NULL, &len)) - ret = REGDB_E_READREGDB; - - if (ret == S_OK) - { - buffer = HeapAlloc(GetProcessHeap(), 0, len); - if (RegQueryValueA(hkey, NULL, buffer, &len)) - ret = REGDB_E_READREGDB; + LPOLESTR16 *lplpszProgID )/* [out] associated Program ID */ +{ + LPOLESTR progid; + HRESULT ret; + ret = ProgIDFromCLSID( clsid, &progid ); if (ret == S_OK) { - ret = _xmalloc16(len, (SEGPTR*)lplpszProgID); - if (ret == S_OK) - strcpy(MapSL((SEGPTR)*lplpszProgID),buffer); + INT len = WideCharToMultiByte( CP_ACP, 0, progid, -1, NULL, 0, NULL, NULL ); + ret = _xmalloc16(len, (SEGPTR*)lplpszProgID); + if (ret == S_OK) + WideCharToMultiByte( CP_ACP, 0, progid, -1, MapSL((SEGPTR)*lplpszProgID), len, NULL, NULL ); + CoTaskMemFree( progid ); } - HeapFree(GetProcessHeap(), 0, buffer); - } - RegCloseKey(hkey); - return ret; + return ret; } /*********************************************************************** @@ -570,6 +571,14 @@ BOOL16 WINAPI CoDosDateTimeToFileTime16(WORD wDosDate, WORD wDosTime, FILETIME * return DosDateTimeToFileTime(wDosDate, wDosTime, ft); } +/****************************************************************************** + * CoGetCurrentProcess [COMPOBJ.34] + */ +DWORD WINAPI CoGetCurrentProcess16(void) +{ + return CoGetCurrentProcess(); +} + /****************************************************************************** * CoRegisterMessageFilter [COMPOBJ.27] */ @@ -668,6 +677,23 @@ HRESULT WINAPI CLSIDFromProgID16(LPCOLESTR16 progid, LPCLSID riid) return CLSIDFromString16(buf2,riid); } +/****************************************************************************** + * StringFromGUID2 [COMPOBJ.76] + */ +INT WINAPI StringFromGUID216(REFGUID id, LPOLESTR str, INT cmax) +{ + return StringFromGUID2( id, str, cmax ); +} + + +/*********************************************************************** + * CoFileTimeNow [COMPOBJ.82] + */ +HRESULT WINAPI CoFileTimeNow16( FILETIME *lpFileTime ) +{ + return CoFileTimeNow( lpFileTime ); +} + /*********************************************************************** * CoGetClassObject [COMPOBJ.7] * @@ -685,6 +711,14 @@ HRESULT WINAPI CoGetClassObject16( return E_NOTIMPL; } +/****************************************************************************** + * CoCreateGuid [COMPOBJ.73] + */ +HRESULT WINAPI CoCreateGuid16(GUID *pguid) +{ + return CoCreateGuid( pguid ); +} + /*********************************************************************** * CoCreateInstance [COMPOBJ.13] */ diff --git a/dlls/ole32/compobj.spec b/dlls/compobj.dll16/compobj.dll16.spec similarity index 96% rename from dlls/ole32/compobj.spec rename to dlls/compobj.dll16/compobj.dll16.spec index 3ac8568585a..d3022ae767d 100644 --- a/dlls/ole32/compobj.spec +++ b/dlls/compobj.dll16/compobj.dll16.spec @@ -1,4 +1,4 @@ -1 pascal CoBuildVersion() CoBuildVersion +1 pascal CoBuildVersion() CoBuildVersion16 2 pascal CoInitialize(long) CoInitialize16 3 pascal CoUninitialize() CoUninitialize16 4 pascal CoGetMalloc(long ptr) CoGetMalloc16 @@ -14,7 +14,7 @@ 14 stub STRINGFROMIID 15 pascal CoDisconnectObject(ptr long) CoDisconnectObject16 16 stub CORELEASEMARSHALDATA -17 pascal -ret16 CoFreeUnusedLibraries() CoFreeUnusedLibraries +17 pascal -ret16 CoFreeUnusedLibraries() CoFreeUnusedLibraries16 18 pascal -ret16 IsEqualGUID(ptr ptr) IsEqualGUID16 19 pascal StringFromCLSID(ptr ptr) StringFromCLSID16 20 pascal CLSIDFromString(str ptr) CLSIDFromString16 @@ -31,7 +31,7 @@ 31 pascal -ret16 CoDosDateTimeToFileTime(word word ptr) CoDosDateTimeToFileTime16 32 stub COMARSHALHRESULT 33 stub COUNMARSHALHRESULT -34 pascal CoGetCurrentProcess() CoGetCurrentProcess +34 pascal CoGetCurrentProcess() CoGetCurrentProcess16 35 stub SHRCREATE 36 stub COISOLE1CLASS 37 stub _GUID_NULL @@ -70,15 +70,15 @@ 70 stub _IID_ISTDMARSHALINFO 71 pascal CoCreateStandardMalloc(long ptr) CoCreateStandardMalloc16 72 stub _IID_IEXTERNALCONNECTION -73 pascal CoCreateGuid(ptr) CoCreateGuid +73 pascal CoCreateGuid(ptr) CoCreateGuid16 75 stub FNASSERT -76 pascal StringFromGUID2(ptr ptr word) StringFromGUID2 +76 pascal StringFromGUID2(ptr ptr word) StringFromGUID216 77 stub COGETCLASSEXT 78 stub OLE1CLASSFROMCLSID2 79 stub CLSIDFROMOLE1CLASS 80 stub COOPENCLASSKEY 81 stub GUIDFROMSTRING -82 pascal CoFileTimeNow(ptr) CoFileTimeNow +82 pascal CoFileTimeNow(ptr) CoFileTimeNow16 83 stub REMALLOCOID 84 stub REMFREEOID 85 stub REMCREATEREMOTEHANDLER diff --git a/dlls/ole32/Makefile.in b/dlls/ole32/Makefile.in index bd05b43e3ae..eb1ac5ea181 100644 --- a/dlls/ole32/Makefile.in +++ b/dlls/ole32/Makefile.in @@ -46,12 +46,6 @@ C_SRCS = \ stubmanager.c \ usrmarshal.c -C_SRCS16 = \ - ole16.c - -SPEC_SRCS16 = \ - compobj.spec - RC_SRCS = ole32res.rc IDL_C_SRCS = \ diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 711f341e278..0faaf7e994b 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -999,7 +999,6 @@ static void COMPOBJ_DllList_Free(void) /****************************************************************************** * CoBuildVersion [OLE32.@] - * CoBuildVersion [COMPOBJ.1] * * Gets the build version of the DLL. * @@ -1318,7 +1317,6 @@ HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved ) /****************************************************************************** * CoCreateGuid [OLE32.@] - * CoCreateGuid [COMPOBJ.73] * * Simply forwards to UuidCreate in RPCRT4. * @@ -1504,7 +1502,6 @@ HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr) /****************************************************************************** * StringFromGUID2 [OLE32.@] - * StringFromGUID2 [COMPOBJ.76] * * Modified version of StringFromCLSID that allows you to specify max * buffer size. @@ -2684,7 +2681,6 @@ void WINAPI CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved) /*********************************************************************** * CoFreeUnusedLibraries [OLE32.@] - * CoFreeUnusedLibraries [COMPOBJ.17] * * Frees any unused libraries. Unused are identified as those that return * S_OK from their DllCanUnloadNow function. @@ -2702,7 +2698,6 @@ void WINAPI CoFreeUnusedLibraries(void) /*********************************************************************** * CoFileTimeNow [OLE32.@] - * CoFileTimeNow [COMPOBJ.82] * * Retrieves the current time in FILETIME format. * @@ -2980,7 +2975,6 @@ done: /****************************************************************************** * CoGetCurrentProcess [OLE32.@] - * CoGetCurrentProcess [COMPOBJ.34] * * Gets the current process ID. *