Hans Leidekker : wsnmp32: Add stub implementations for a couple of functions.

Alexandre Julliard julliard at winehq.org
Tue Sep 17 15:25:53 CDT 2013


Module: wine
Branch: master
Commit: d36e7c080c5631eca2e176f23d4cc0e3f3664993
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d36e7c080c5631eca2e176f23d4cc0e3f3664993

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Sep 17 11:03:32 2013 +0200

wsnmp32: Add stub implementations for a couple of functions.

---

 configure                      |    3 +-
 configure.ac                   |    3 +-
 dlls/wsnmp32/Makefile.in       |    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 ++++++++++++++++++++++++++++++++++++++++
 9 files changed, 156 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 8ee4819..28e275d 100755
--- a/configure
+++ b/configure
@@ -16493,7 +16493,8 @@ wine_fn_config_dll ws2_32 enable_ws2_32 implib
 wine_fn_config_test dlls/ws2_32/tests ws2_32_test
 wine_fn_config_dll wshom.ocx enable_wshom_ocx
 wine_fn_config_test dlls/wshom.ocx/tests wshom.ocx_test
-wine_fn_config_dll wsnmp32 enable_wsnmp32
+wine_fn_config_dll wsnmp32 enable_wsnmp32 implib
+wine_fn_config_test dlls/wsnmp32/tests wsnmp32_test
 wine_fn_config_dll wsock32 enable_wsock32 implib
 wine_fn_config_dll wtsapi32 enable_wtsapi32 implib
 wine_fn_config_dll wuapi enable_wuapi
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/Makefile.in b/dlls/wsnmp32/Makefile.in
index 0fe0da2..32e63b8 100644
--- a/dlls/wsnmp32/Makefile.in
+++ b/dlls/wsnmp32/Makefile.in
@@ -1,4 +1,5 @@
-MODULE = wsnmp32.dll
+MODULE    = wsnmp32.dll
+IMPORTLIB = wsnmp32
 
 C_SRCS = wsnmp32.c
 
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 */




More information about the wine-cvs mailing list