wsnmp32: Add stub implementations for a couple of functions.

Hans Leidekker hans at codeweavers.com
Tue Sep 17 04:03:32 CDT 2013


---
 configure.ac                   |  3 ++-
 dlls/wsnmp32/tests/Makefile.in |  7 ++++++
 dlls/wsnmp32/tests/wsnmp.c     | 51 +++++++++++++++++++++++++++++++++++++++
 dlls/wsnmp32/wsnmp32.c         | 32 ++++++++++++++++++++++++
 dlls/wsnmp32/wsnmp32.spec      |  8 +++---
 include/Makefile.in            |  1 +
 include/winsnmp.h              | 55 ++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 152 insertions(+), 5 deletions(-)
 create mode 100644 dlls/wsnmp32/tests/Makefile.in
 create mode 100644 dlls/wsnmp32/tests/wsnmp.c
 create mode 100644 include/winsnmp.h

diff --git a/configure.ac b/configure.ac
index 96af299..f42fc15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3167,7 +3167,8 @@ WINE_CONFIG_DLL(ws2_32,,[implib])
 WINE_CONFIG_TEST(dlls/ws2_32/tests)
 WINE_CONFIG_DLL(wshom.ocx)
 WINE_CONFIG_TEST(dlls/wshom.ocx/tests)
-WINE_CONFIG_DLL(wsnmp32)
+WINE_CONFIG_DLL(wsnmp32,,[implib])
+WINE_CONFIG_TEST(dlls/wsnmp32/tests)
 WINE_CONFIG_DLL(wsock32,,[implib])
 WINE_CONFIG_DLL(wtsapi32,,[implib])
 WINE_CONFIG_DLL(wuapi)
diff --git a/dlls/wsnmp32/tests/Makefile.in b/dlls/wsnmp32/tests/Makefile.in
new file mode 100644
index 0000000..9d733c7
--- /dev/null
+++ b/dlls/wsnmp32/tests/Makefile.in
@@ -0,0 +1,7 @@
+TESTDLL   = wsnmp32.dll
+IMPORTS   = wsnmp32
+
+C_SRCS = \
+	wsnmp.c
+
+ at MAKE_TEST_RULES@
diff --git a/dlls/wsnmp32/tests/wsnmp.c b/dlls/wsnmp32/tests/wsnmp.c
new file mode 100644
index 0000000..6c1cf60
--- /dev/null
+++ b/dlls/wsnmp32/tests/wsnmp.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2013 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 <stdlib.h>
+#include <windef.h>
+#include <winbase.h>
+#include <winsnmp.h>
+
+#include "wine/test.h"
+
+static void test_SnmpStartup(void)
+{
+    SNMPAPI_STATUS status;
+    smiUINT32 major, minor, level, translate_mode, retransmit_mode;
+
+    status = SnmpStartup( NULL, NULL, NULL, NULL, NULL );
+    ok( status == SNMPAPI_SUCCESS, "got %u\n", status );
+
+    status = SnmpCleanup();
+    ok( status == SNMPAPI_SUCCESS, "got %u\n", status );
+
+    major = minor = level = translate_mode = retransmit_mode = 0xdeadbeef;
+    status = SnmpStartup( &major, &minor, &level, &translate_mode, &retransmit_mode );
+    ok( status == SNMPAPI_SUCCESS, "got %u\n", status );
+    trace( "major %u minor %u level %u translate_mode %u retransmit_mode %u\n",
+           major, minor, level, translate_mode, retransmit_mode );
+
+    status = SnmpCleanup();
+    ok( status == SNMPAPI_SUCCESS, "got %u\n", status );
+}
+
+START_TEST (wsnmp)
+{
+    test_SnmpStartup();
+}
diff --git a/dlls/wsnmp32/wsnmp32.c b/dlls/wsnmp32/wsnmp32.c
index 838c9bb..721842f 100644
--- a/dlls/wsnmp32/wsnmp32.c
+++ b/dlls/wsnmp32/wsnmp32.c
@@ -19,6 +19,7 @@
 #include <stdarg.h>
 #include "windef.h"
 #include "winbase.h"
+#include "winsnmp.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wsnmp32);
@@ -37,3 +38,34 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
     }
     return TRUE;
 }
+
+SNMPAPI_STATUS WINAPI SnmpCleanup( void )
+{
+    FIXME( "\n" );
+    return SNMPAPI_SUCCESS;
+}
+
+SNMPAPI_STATUS WINAPI SnmpSetRetransmitMode( smiUINT32 retransmit_mode )
+{
+    FIXME( "%u\n", retransmit_mode );
+    return SNMPAPI_SUCCESS;
+}
+
+SNMPAPI_STATUS WINAPI SnmpSetTranslateMode( smiUINT32 translate_mode )
+{
+    FIXME( "%u\n", translate_mode );
+    return SNMPAPI_SUCCESS;
+}
+
+SNMPAPI_STATUS WINAPI SnmpStartup( smiLPUINT32 major, smiLPUINT32 minor, smiLPUINT32 level,
+                                   smiLPUINT32 translate_mode, smiLPUINT32 retransmit_mode )
+{
+    FIXME( "%p, %p, %p, %p, %p\n", major, minor, level, translate_mode, retransmit_mode );
+
+    if (major) *major = 2;
+    if (minor) *minor = 0;
+    if (level) *level = SNMPAPI_V2_SUPPORT;
+    if (translate_mode) *translate_mode = SNMPAPI_UNTRANSLATED_V1;
+    if (retransmit_mode) *retransmit_mode = SNMPAPI_ON;
+    return SNMPAPI_SUCCESS;
+}
diff --git a/dlls/wsnmp32/wsnmp32.spec b/dlls/wsnmp32/wsnmp32.spec
index fedf760..197092a 100644
--- a/dlls/wsnmp32/wsnmp32.spec
+++ b/dlls/wsnmp32/wsnmp32.spec
@@ -1,7 +1,7 @@
 100 stub SnmpGetTranslateMode
-101 stub SnmpSetTranslateMode
+101 stdcall SnmpSetTranslateMode(long)
 102 stub SnmpGetRetransmitMode
-103 stub SnmpSetRetransmitMode
+103 stdcall SnmpSetRetransmitMode(long)
 104 stub SnmpGetTimeout
 105 stub SnmpSetTimeout
 106 stub SnmpSetRetry
@@ -9,8 +9,8 @@
 108 stub _SnmpConveyAgentAddress at 4
 109 stub _SnmpSetAgentAddress at 4
 120 stub SnmpGetVendorInfo
-200 stub SnmpStartup
-201 stub SnmpCleanup
+200 stdcall SnmpStartup(ptr ptr ptr ptr ptr)
+201 stdcall SnmpCleanup()
 202 stub SnmpOpen
 203 stub SnmpClose
 204 stub SnmpSendMsg
diff --git a/include/Makefile.in b/include/Makefile.in
index d40284e..c109c06 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -589,6 +589,7 @@ SRCDIR_INCLUDES = \
 	winsafer.h \
 	winscard.h \
 	winsmcrd.h \
+	winsnmp.h \
 	winsock.h \
 	winsock2.h \
 	winspool.h \
diff --git a/include/winsnmp.h b/include/winsnmp.h
new file mode 100644
index 0000000..64765de
--- /dev/null
+++ b/include/winsnmp.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2013 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
+ */
+
+#ifndef __WINE_WINSNMP_H
+#define __WINE_WINSNMP_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef int          smiINT, *smiLPINT;
+typedef smiINT       smiINT32, *smiLPINT32;
+typedef unsigned int smiUINT32, *smiLPUINT32;
+typedef smiUINT32    SNMPAPI_STATUS;
+
+#define SNMPAPI_NO_SUPPORT  0
+#define SNMPAPI_V1_SUPPORT  1
+#define SNMPAPI_V2_SUPPORT  2
+#define SNMPAPI_M2M_SUPPORT 3
+
+#define SNMPAPI_TRANSLATED      0
+#define SNMPAPI_UNTRANSLATED_V1 1
+#define SNMPAPI_UNTRANSLATED_V2 2
+
+#define SNMPAPI_OFF 0
+#define SNMPAPI_ON  1
+
+#define SNMPAPI_FAILURE 0
+#define SNMPAPI_SUCCESS 1
+
+SNMPAPI_STATUS WINAPI SnmpCleanup(void);
+SNMPAPI_STATUS WINAPI SnmpSetRetransmitMode(smiUINT32);
+SNMPAPI_STATUS WINAPI SnmpSetTranslateMode(smiUINT32);
+SNMPAPI_STATUS WINAPI SnmpStartup(smiLPUINT32,smiLPUINT32,smiLPUINT32,smiLPUINT32,smiLPUINT32);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINE_WINSNMP_H */
-- 
1.8.1.5






More information about the wine-patches mailing list