sti: register sti.dll (try 2)

Damjan Jovanovic damjan.jov at gmail.com
Sat Jul 18 05:10:03 CDT 2009


Changelog:
* register sti.dll

Try 2 adds regsvr.c, a better sti.h, and fixes DllUnregisterServer.

Damjan Jovanovic
-------------- next part --------------
diff --git a/dlls/sti/Makefile.in b/dlls/sti/Makefile.in
index dd977ac..fc7e5c9 100644
--- a/dlls/sti/Makefile.in
+++ b/dlls/sti/Makefile.in
@@ -4,9 +4,9 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = sti.dll
 IMPORTLIB = sti
-IMPORTS   = kernel32
+IMPORTS   = kernel32 advapi32 ole32
 
-C_SRCS = sti_main.c
+C_SRCS = sti_main.c regsvr.c
 
 @MAKE_DLL_RULES@
 
diff --git a/dlls/sti/regsvr.c b/dlls/sti/regsvr.c
new file mode 100644
index 0000000..24c6177
--- /dev/null
+++ b/dlls/sti/regsvr.c
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2009 Damjan Jovanovic
+ *
+ * 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 "config.h"
+
+#include <stdarg.h>
+#include <string.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
+#include "winerror.h"
+#include "ole2.h"
+
+#include "initguid.h"
+#include "sti.h"
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(sti);
+
+static const WCHAR clsidBkW[] = {'C','L','S','I','D','\\',0};
+
+/******************************************************************************
+ *           DllRegisterServer (STI.@)
+ */
+HRESULT WINAPI DllRegisterServer(void)
+{
+    WCHAR className[6 + 39];
+    HKEY classKey = NULL;
+    HKEY serverKey = NULL;
+    const char *str;
+    DWORD ret;
+
+    TRACE("()\n");
+
+    snprintfW(className, sizeof(className), clsidBkW);
+    StringFromGUID2(&CLSID_Sti, &className[6], 39);
+    ret = RegCreateKeyW(HKEY_CLASSES_ROOT, className, &classKey);
+    if (ret != ERROR_SUCCESS)
+        goto done;
+
+    str = "StillImage";
+    ret = RegSetValueA(classKey, "", REG_SZ, str, strlen(str) + 1);
+    if (ret != ERROR_SUCCESS)
+        goto done;
+
+    ret = RegCreateKeyA(classKey, "InProcServer32", &serverKey);
+    if (ret != ERROR_SUCCESS)
+        goto done;
+
+    str = "sti.dll";
+    ret = RegSetValueA(serverKey, "", REG_SZ, str, strlen(str) + 1);
+    if (ret != ERROR_SUCCESS)
+        goto done;
+
+    str = "Both";
+    ret = RegSetValueExA(serverKey, "ThreadingModel", 0, REG_SZ,
+        (const BYTE*)str, strlen(str) + 1);
+    if (ret != ERROR_SUCCESS)
+        goto done;
+
+    ret = ERROR_SUCCESS;
+
+done:
+    RegCloseKey(classKey);
+    RegCloseKey(serverKey);
+    return HRESULT_FROM_WIN32(ret);
+}
+
+/******************************************************************************
+ *           DllUnregisterServer (STI.@)
+ */
+HRESULT WINAPI DllUnregisterServer(void)
+{
+    WCHAR className[6 + 39];
+    DWORD ret;
+
+    TRACE("()\n");
+
+    snprintfW(className, sizeof(className), clsidBkW);
+    StringFromGUID2(&CLSID_Sti, &className[6], 39);
+    ret = RegDeleteTreeW(HKEY_CLASSES_ROOT, className);
+    return HRESULT_FROM_WIN32(ret);
+}
+
diff --git a/dlls/sti/sti.spec b/dlls/sti/sti.spec
index f8b17fd..186f382 100644
--- a/dlls/sti/sti.spec
+++ b/dlls/sti/sti.spec
@@ -1,7 +1,7 @@
 @ stub DllCanUnloadNow
 @ stub DllGetClassObject
-@ stub DllRegisterServer
-@ stub DllUnregisterServer
+@ stdcall -private DllRegisterServer()
+@ stdcall -private DllUnregisterServer()
 @ stdcall StiCreateInstance(ptr long ptr ptr)
 @ stdcall StiCreateInstanceA(ptr long ptr ptr)
 @ stdcall StiCreateInstanceW(ptr long ptr ptr)
diff --git a/include/sti.h b/include/sti.h
new file mode 100644
index 0000000..1fd46a4
--- /dev/null
+++ b/include/sti.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2009 Damjan Jovanovic
+ *
+ * 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_STI_H
+#define __WINE_STI_H
+
+#include <guiddef.h>
+
+DEFINE_GUID(CLSID_Sti, 0xB323F8E0L, 0x2E68, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);
+
+#endif /* __WINE_STI_H */
diff --git a/tools/wine.inf.in b/tools/wine.inf.in
index cd9e609..047d284 100644
--- a/tools/wine.inf.in
+++ b/tools/wine.inf.in
@@ -2426,6 +2426,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
 11,,quartz.dll,1
 11,,rsaenh.dll,1
 11,,shdocvw.dll,1
+11,,sti.dll,1
 11,,urlmon.dll,1
 11,,windowscodecs.dll,1
 11,,wintrust.dll,1


More information about the wine-patches mailing list