Based off patch by Jianqiu Zhang.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/wpcap/wpcap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ dlls/wpcap/wpcap.spec | 4 ++-- 2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/dlls/wpcap/wpcap.c b/dlls/wpcap/wpcap.c index fe46903..e7908cd 100644 --- a/dlls/wpcap/wpcap.c +++ b/dlls/wpcap/wpcap.c @@ -27,6 +27,7 @@ #include "winsock2.h" #include "windef.h" #include "winbase.h" +#include "wine/heap.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wpcap); @@ -45,6 +46,22 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); #define PCAP_SRC_IFLOCAL 3 #endif
+static inline WCHAR *heap_strdupAtoW(const char *str) +{ + LPWSTR ret = NULL; + + if(str) { + DWORD len; + + len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + ret = heap_alloc(len*sizeof(WCHAR)); + if(ret) + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + } + + return ret; +} + void CDECL wine_pcap_breakloop(pcap_t *p) { TRACE("(%p)\n", p); @@ -341,3 +358,30 @@ int CDECL wine_wsockinit(void) if (WSAStartup(MAKEWORD(1,1), &wsadata)) return -1; return 0; } + +pcap_dumper_t* CDECL wine_pcap_dump_open(pcap_t *p, const char *fname) +{ + pcap_dumper_t *dumper; + WCHAR *fnameW = heap_strdupAtoW(fname); + char *unix_path; + + TRACE("(%p %s)\n", p, debugstr_a(fname)); + + unix_path = wine_get_unix_file_name(fnameW); + heap_free(fnameW); + if(!unix_path) + return NULL; + + TRACE("unix_path %s\n", debugstr_a(unix_path)); + + dumper = pcap_dump_open(p, unix_path); + heap_free(unix_path); + + return dumper; +} + +void CDECL wine_pcap_dump(u_char *user, const struct pcap_pkthdr *h, const u_char *sp) +{ + TRACE("(%p %p %p)\n", user, h, sp); + return pcap_dump(user, h, sp); +} diff --git a/dlls/wpcap/wpcap.spec b/dlls/wpcap/wpcap.spec index 66303b4..ffb6ed1 100644 --- a/dlls/wpcap/wpcap.spec +++ b/dlls/wpcap/wpcap.spec @@ -16,12 +16,12 @@ @ cdecl pcap_datalink_val_to_description(long) wine_pcap_datalink_val_to_description @ cdecl pcap_datalink_val_to_name(long) wine_pcap_datalink_val_to_name @ cdecl pcap_dispatch(ptr long ptr ptr) wine_pcap_dispatch -@ stub pcap_dump +@ cdecl pcap_dump(ptr ptr str) wine_pcap_dump @ stub pcap_dump_close @ stub pcap_dump_file @ stub pcap_dump_flush @ stub pcap_dump_ftell -@ stub pcap_dump_open +@ cdecl pcap_dump_open(ptr str) wine_pcap_dump_open @ stub pcap_file @ stub pcap_fileno @ cdecl pcap_findalldevs(ptr ptr) wine_pcap_findalldevs
Am 09.04.2018 um 01:17 schrieb Alistair Leslie-Hughes:
Based off patch by Jianqiu Zhang.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com
dlls/wpcap/wpcap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ dlls/wpcap/wpcap.spec | 4 ++-- 2 files changed, 46 insertions(+), 2 deletions(-)
I was a bit worried about simply returning NULL, but I doubt there is a program checking the failure with geterr...
Signed-off-by: André Hentschel nerv@dawncrow.de
On 4/9/2018 10:34 PM, André Hentschel wrote:
Am 09.04.2018 um 01:17 schrieb Alistair Leslie-Hughes:
Based off patch by Jianqiu Zhang.
Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com
dlls/wpcap/wpcap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ dlls/wpcap/wpcap.spec | 4 ++-- 2 files changed, 46 insertions(+), 2 deletions(-)
I was a bit worried about simply returning NULL, but I doubt there is a program checking the failure with geterr...
Signed-off-by: André Hentschel nerv@dawncrow.de
It should probably use CP_UNIXCP.