[PATCH 2/2] amsi: Add stub implementations for a couple of functions.

Hans Leidekker hans at codeweavers.com
Thu Mar 7 07:14:13 CST 2019


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/amsi/Makefile.in |  3 ++
 dlls/amsi/amsi.spec   | 12 ++++----
 dlls/amsi/main.c      | 65 +++++++++++++++++++++++++++++++++++++++++++
 include/Makefile.in   |  1 +
 include/amsi.idl      | 36 ++++++++++++++++++++++++
 5 files changed, 111 insertions(+), 6 deletions(-)
 create mode 100644 dlls/amsi/main.c
 create mode 100644 include/amsi.idl

diff --git a/dlls/amsi/Makefile.in b/dlls/amsi/Makefile.in
index dfaec30d39..213d3e06ce 100644
--- a/dlls/amsi/Makefile.in
+++ b/dlls/amsi/Makefile.in
@@ -1 +1,4 @@
 MODULE    = amsi.dll
+
+C_SRCS = \
+	main.c
diff --git a/dlls/amsi/amsi.spec b/dlls/amsi/amsi.spec
index 6c2b4ae60b..27e6b3dbda 100644
--- a/dlls/amsi/amsi.spec
+++ b/dlls/amsi/amsi.spec
@@ -1,12 +1,12 @@
-@ stub AmsiCloseSession
-@ stub AmsiInitialize
-@ stub AmsiOpenSession
-@ stub AmsiScanBuffer
-@ stub AmsiScanString
+@ stdcall AmsiCloseSession(ptr ptr)
+@ stdcall AmsiInitialize(wstr ptr)
+@ stdcall AmsiOpenSession(ptr ptr)
+@ stdcall AmsiScanBuffer(ptr ptr long wstr ptr ptr)
+@ stdcall AmsiScanString(ptr wstr wstr ptr ptr)
 @ stub AmsiUacInitialize
 @ stub AmsiUacScan
 @ stub AmsiUacUninitialize
-@ stub AmsiUninitialize
+@ stdcall AmsiUninitialize(ptr)
 @ stub DllCanUnloadNow
 @ stub DllGetClassObject
 @ stub DllRegisterServer
diff --git a/dlls/amsi/main.c b/dlls/amsi/main.c
new file mode 100644
index 0000000000..f56e699c35
--- /dev/null
+++ b/dlls/amsi/main.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2019 Hans Leidekker 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 "windef.h"
+#include "winbase.h"
+#include "amsi.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(amsi);
+
+HRESULT WINAPI AmsiInitialize( const WCHAR *appname, HAMSICONTEXT *context )
+{
+    FIXME( "%s, %p\n", debugstr_w(appname), context );
+    *context = (HAMSICONTEXT)0xdeadbeef;
+    return S_OK;
+}
+
+HRESULT WINAPI AmsiOpenSession( HAMSICONTEXT context, HAMSISESSION *session )
+{
+    FIXME( "%p, %p\n", context, session );
+    *session = (HAMSISESSION)0xdeadbeef;
+    return S_OK;
+}
+
+void WINAPI AmsiCloseSession( HAMSICONTEXT context, HAMSISESSION session )
+{
+    FIXME( "%p, %p\n", context, session );
+}
+
+HRESULT WINAPI AmsiScanBuffer( HAMSICONTEXT context, void *buffer, ULONG length, const WCHAR *name,
+                               HAMSISESSION session, AMSI_RESULT *result )
+{
+    FIXME( "%p, %p, %u, %s, %p, %p\n", context, buffer, length, debugstr_w(name), session, result );
+    *result = AMSI_RESULT_NOT_DETECTED;
+    return S_OK;
+}
+
+HRESULT WINAPI AmsiScanString( HAMSICONTEXT context, const WCHAR *string, const WCHAR *name,
+                               HAMSISESSION session, AMSI_RESULT *result )
+{
+    FIXME( "%p, %s, %s, %p, %p\n", context, debugstr_w(string), debugstr_w(name), session, result );
+    *result = AMSI_RESULT_NOT_DETECTED;
+    return S_OK;
+}
+
+void WINAPI AmsiUninitialize( HAMSICONTEXT context )
+{
+    FIXME( "%p\n", context );
+}
diff --git a/include/Makefile.in b/include/Makefile.in
index c9f5be9791..2817c10d17 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -11,6 +11,7 @@ SOURCES = \
 	advpub.h \
 	af_irda.h \
 	amaudio.h \
+	amsi.idl \
 	amstream.idl \
 	amvideo.idl \
 	appcompatapi.h \
diff --git a/include/amsi.idl b/include/amsi.idl
new file mode 100644
index 0000000000..31303a3629
--- /dev/null
+++ b/include/amsi.idl
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2019 Hans Leidekker 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
+ */
+
+cpp_quote("DECLARE_HANDLE(HAMSICONTEXT);")
+cpp_quote("DECLARE_HANDLE(HAMSISESSION);")
+
+typedef [v1_enum] enum AMSI_RESULT
+{
+    AMSI_RESULT_CLEAN                  = 0x00,
+    AMSI_RESULT_NOT_DETECTED           = 0x01,
+    AMSI_RESULT_BLOCKED_BY_ADMIN_START = 0x4000,
+    AMSI_RESULT_BLOCKED_BY_ADMIN_END   = 0x4fff,
+    AMSI_RESULT_DETECTED               = 0x8000,
+} AMSI_RESULT;
+
+cpp_quote("void WINAPI AmsiCloseSession(HAMSICONTEXT,HAMSISESSION);")
+cpp_quote("HRESULT WINAPI AmsiInitialize(const WCHAR*,HAMSICONTEXT*);")
+cpp_quote("HRESULT WINAPI AmsiOpenSession(HAMSICONTEXT,HAMSISESSION*);")
+cpp_quote("HRESULT WINAPI AmsiScanBuffer(HAMSICONTEXT,void*,ULONG,const WCHAR*,HAMSISESSION,AMSI_RESULT*);")
+cpp_quote("HRESULT WINAPI AmsiScanString(HAMSICONTEXT,const WCHAR*,const WCHAR *,HAMSISESSION,AMSI_RESULT*);")
+cpp_quote("void WINAPI AmsiUninitialize(HAMSICONTEXT);")
-- 
2.20.1




More information about the wine-devel mailing list