Juan Lang : inetmib1: Add initialization function for getting the MIB2 number of interfaces.

Alexandre Julliard julliard at winehq.org
Wed Jun 25 04:47:30 CDT 2008


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Tue May 20 20:52:00 2008 -0700

inetmib1: Add initialization function for getting the MIB2 number of interfaces.

---

 dlls/inetmib1/Makefile.in |    1 +
 dlls/inetmib1/main.c      |   17 +++++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/inetmib1/Makefile.in b/dlls/inetmib1/Makefile.in
index cb27cc2..3998f00 100644
--- a/dlls/inetmib1/Makefile.in
+++ b/dlls/inetmib1/Makefile.in
@@ -4,6 +4,7 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = inetmib1.dll
 IMPORTS   = snmpapi kernel32
+DELAYIMPORTS = iphlpapi
 
 C_SRCS = \
 	main.c
diff --git a/dlls/inetmib1/main.c b/dlls/inetmib1/main.c
index 454ae0c..2ee0ba9 100644
--- a/dlls/inetmib1/main.c
+++ b/dlls/inetmib1/main.c
@@ -23,6 +23,7 @@
 #include "windef.h"
 #include "winbase.h"
 #include "snmp.h"
+#include "iphlpapi.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(inetmib1);
@@ -56,7 +57,23 @@ struct mibImplementation
     void              (*init)(void);
 };
 
+static UINT mib2IfNumber[] = { 1,3,6,1,2,1,2,1 };
+static PMIB_IFTABLE ifTable;
+
+static void mib2IfNumberInit(void)
+{
+    DWORD size = 0, ret = GetIfTable(NULL, &size, FALSE);
+
+    if (ret == ERROR_INSUFFICIENT_BUFFER)
+    {
+        ifTable = HeapAlloc(GetProcessHeap(), 0, size);
+        if (ifTable)
+            GetIfTable(ifTable, &size, FALSE);
+    }
+}
+
 static struct mibImplementation supportedIDs[] = {
+    { DEFINE_OID(mib2IfNumber), mib2IfNumberInit },
 };
 
 BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference,




More information about the wine-cvs mailing list