Module: wine Branch: master Commit: 0101e58d43d1eebec2c9dcbfa8071f2eb3db55ad URL: http://source.winehq.org/git/wine.git/?a=commit;h=0101e58d43d1eebec2c9dcbfa8...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Oct 16 20:50:20 2007 +0200
msimtf: Added Dll[Un]RegisterServer implementation.
---
.gitignore | 1 + dlls/msimtf/Makefile.in | 2 + dlls/msimtf/main.c | 63 ++++++++++++++++++++++++++++++++++++++++++++--- dlls/msimtf/msimtf.inf | 26 +++++++++++++++++++ dlls/msimtf/rsrc.rc | 20 +++++++++++++++ 5 files changed, 108 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore index 43ee7d8..95e66f5 100644 --- a/.gitignore +++ b/.gitignore @@ -266,6 +266,7 @@ dlls/msi/tests/*.ok dlls/msi/tests/msi_crosstest.exe dlls/msi/tests/testlist.c dlls/msimg32/libmsimg32.def +dlls/msimtf/rsrc.res dlls/msrle32/rsrc.res dlls/msvcrt/libmsvcrt.def dlls/msvcrt/rsrc.res diff --git a/dlls/msimtf/Makefile.in b/dlls/msimtf/Makefile.in index 2ec6168..2de6646 100644 --- a/dlls/msimtf/Makefile.in +++ b/dlls/msimtf/Makefile.in @@ -4,8 +4,10 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = msimtf.dll IMPORTS = kernel32 +EXTRALIBS = -luuid
C_SRCS = main.c +RC_SRCS = rsrc.rc
@MAKE_DLL_RULES@
diff --git a/dlls/msimtf/main.c b/dlls/msimtf/main.c index 5659647..238c781 100644 --- a/dlls/msimtf/main.c +++ b/dlls/msimtf/main.c @@ -19,14 +19,23 @@ #include "config.h"
#include <stdarg.h> +#include <stdio.h>
#include "windef.h" #include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "advpub.h" +#include "ole2.h" +#include "dimm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msimtf);
+static HINSTANCE msimtf_instance; + /****************************************************************** * DllMain (msimtf.@) */ @@ -37,6 +46,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: + msimtf_instance = hInstDLL; DisableThreadLibraryCalls(hInstDLL); break; case DLL_PROCESS_DETACH: @@ -63,13 +73,59 @@ HRESULT WINAPI DllCanUnloadNow(void) return S_FALSE; }
+#define INF_SET_CLSID(clsid) \ + do \ + { \ + static CHAR name[] = "CLSID_" #clsid; \ + \ + pse[i].pszName = name; \ + clsids[i++] = &CLSID_ ## clsid; \ + } while (0) + +static HRESULT register_server(BOOL doregister) +{ + HRESULT hres; + HMODULE hAdvpack; + typeof(RegInstallA) *pRegInstall; + STRTABLEA strtable; + STRENTRYA pse[1]; + static CLSID const *clsids[34]; + int i = 0; + + static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0}; + + INF_SET_CLSID(CActiveIMM); + + for(i = 0; i < sizeof(pse)/sizeof(pse[0]); i++) { + pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, 39); + sprintf(pse[i].pszValue, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", + clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0], + clsids[i]->Data4[1], clsids[i]->Data4[2], clsids[i]->Data4[3], clsids[i]->Data4[4], + clsids[i]->Data4[5], clsids[i]->Data4[6], clsids[i]->Data4[7]); + } + + strtable.cEntries = sizeof(pse)/sizeof(pse[0]); + strtable.pse = pse; + + hAdvpack = LoadLibraryW(wszAdvpack); + pRegInstall = (typeof(RegInstallA)*)GetProcAddress(hAdvpack, "RegInstall"); + + hres = pRegInstall(msimtf_instance, doregister ? "RegisterDll" : "UnregisterDll", &strtable); + + for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++) + HeapFree(GetProcessHeap(), 0, pse[i].pszValue); + + return hres; +} + +#undef INF_SET_CLSID + /*********************************************************************** * DllRegisterServer (msimtf.@) */ HRESULT WINAPI DllRegisterServer(void) { - FIXME("()\n"); - return S_OK; + return register_server(TRUE); }
/*********************************************************************** @@ -77,6 +133,5 @@ HRESULT WINAPI DllRegisterServer(void) */ HRESULT WINAPI DllUnregisterServer(void) { - FIXME("()\n"); - return S_OK; + return register_server(FALSE); } diff --git a/dlls/msimtf/msimtf.inf b/dlls/msimtf/msimtf.inf new file mode 100644 index 0000000..d7e6b73 --- /dev/null +++ b/dlls/msimtf/msimtf.inf @@ -0,0 +1,26 @@ +[version] +Signature="$CHICAGO$" + + +[RegisterDll] +AddReg=Classes.Reg + + +[UnregisterDll] +DelReg=Classes.Reg + + +[Classes.Reg] +HKCR,"CLSID%CLSID_CActiveIMM%",,,"CActiveIMMApp" +HKCR,"CLSID%CLSID_CActiveIMM%\InProcServer32",,,"msimtf.dll" +HKCR,"CLSID%CLSID_CActiveIMM%\InProcServer32","ThreadingModel",,"Apartment" +HKCR,"CLSID%CLSID_CActiveIMMAppEx_Trident",,,"CActiveIMMAppEx_Trident" +HKCR,"CLSID%CLSID_CActiveIMMAppEx_Trident\InProcServer32",,,"msimtf.dll" +HKCR,"CLSID%CLSID_CActiveIMMAppEx_Trident\InProcServer32","ThreadingModel",,"Apartment" +HKCR,"CLSID%CLSID_CActiveIMMAppEx",,,"CActiveIMMAppEx" +HKCR,"CLSID%CLSID_CActiveIMMAppEx\InProcServer32",,,"msimtf.dll" +HKCR,"CLSID%CLSID_CActiveIMMAppEx\InProcServer32","ThreadingModel",,"Apartment" + +[Strings] +CLSID_CActiveIMMAppEx_Trident={50D5107A-D278-4871-8989-F4CEAAF59CFC} +CLSID_CActiveIMMAppEx="{C1EE01F2-B3B6-4A6A-9DDD-E988C088EC82}" diff --git a/dlls/msimtf/rsrc.rc b/dlls/msimtf/rsrc.rc new file mode 100644 index 0000000..361feee --- /dev/null +++ b/dlls/msimtf/rsrc.rc @@ -0,0 +1,20 @@ +/* + * Copyright 2007 Jacek Caban 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 + */ + +/* @makedep: msimtf.inf */ +REGINST REGINST msimtf.inf