wpcap: Partially implement pcap_parsesrcstr

André Hentschel nerv at dawncrow.de
Mon Aug 31 13:52:13 CDT 2015


https://bugs.winehq.org/show_bug.cgi?id=39174
This is enough to run the application

---
 dlls/wpcap/wpcap.c    | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 dlls/wpcap/wpcap.spec |  2 +-
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/dlls/wpcap/wpcap.c b/dlls/wpcap/wpcap.c
index da545a8..ae9e482 100644
--- a/dlls/wpcap/wpcap.c
+++ b/dlls/wpcap/wpcap.c
@@ -27,6 +27,19 @@
 WINE_DEFAULT_DEBUG_CHANNEL(wpcap);
 WINE_DECLARE_DEBUG_CHANNEL(winediag);
 
+#ifndef PCAP_SRC_FILE_STRING
+#define PCAP_SRC_FILE_STRING    "file://"
+#endif
+#ifndef PCAP_SRC_FILE
+#define PCAP_SRC_FILE           2
+#endif
+#ifndef PCAP_SRC_IF_STRING
+#define PCAP_SRC_IF_STRING      "rpcap://"
+#endif
+#ifndef PCAP_SRC_IFLOCAL
+#define PCAP_SRC_IFLOCAL        3
+#endif
+
 void CDECL wine_pcap_breakloop(pcap_t *p)
 {
     TRACE("(%p)\n", p);
@@ -239,6 +252,44 @@ pcap_t* CDECL wine_pcap_open_live(const char *source, int snaplen, int promisc,
     return pcap_open_live(source, snaplen, promisc, to_ms, errbuf);
 }
 
+int CDECL wine_pcap_parsesrcstr(const char *source, int *type, char *host, char *port, char *name, char *errbuf)
+{
+    int t = PCAP_SRC_IFLOCAL;
+    const char *p = source;
+
+    FIXME("(%s %p %p %p %p %p): partial stub\n", debugstr_a(source), type, host, port, name, errbuf);
+
+    if (host)
+        *host = '\0';
+    if (port)
+        *port = '\0';
+    if (name)
+        *name = '\0';
+
+    if (!strncmp(p, PCAP_SRC_IF_STRING, strlen(PCAP_SRC_IF_STRING)))
+        p += strlen(PCAP_SRC_IF_STRING);
+    else if (!strncmp(p, PCAP_SRC_FILE_STRING, strlen(PCAP_SRC_FILE_STRING)))
+    {
+        p += strlen(PCAP_SRC_FILE_STRING);
+        t = PCAP_SRC_FILE;
+    }
+
+    if (type)
+        *type = t;
+
+    if (!*p)
+    {
+        if (errbuf)
+            sprintf(errbuf, "The name has not been specified in the source string.");
+        return -1;
+    }
+
+    if (name)
+        strcpy(name, p);
+
+    return 0;
+}
+
 int CDECL wine_pcap_sendpacket(pcap_t *p, const unsigned char *buf, int size)
 {
     TRACE("(%p %p %i)\n", p, buf, size);
diff --git a/dlls/wpcap/wpcap.spec b/dlls/wpcap/wpcap.spec
index c7d2cd1..0e1e208 100644
--- a/dlls/wpcap/wpcap.spec
+++ b/dlls/wpcap/wpcap.spec
@@ -51,7 +51,7 @@
 @ stub pcap_open_dead
 @ cdecl pcap_open_live(str long long long ptr) wine_pcap_open_live
 @ stub pcap_open_offline
-@ stub pcap_parsesrcstr
+@ cdecl pcap_parsesrcstr(str ptr ptr ptr ptr ptr) wine_pcap_parsesrcstr
 @ stub pcap_perror
 @ stub pcap_read
 @ stub pcap_remoteact_accept
-- 
1.9.1




More information about the wine-patches mailing list