On 11.02.2016 09:55, Jianqiu Zhang wrote:
From 359272d74611e2c4a6ab1e3eb452cb277043b6d2 Mon Sep 17 00:00:00 2001 From: Jianqiu Zhang zhangjianqiu_133@yeah.net Date: Tue, 5 Jan 2016 09:12:42 +0800 Subject: [PATCH 2/2] wpcap: Fix crash on pcap_loop
Signed-off-by: Jianqiu Zhang zhangjianqiu_133@yeah.net
dlls/wpcap/wpcap.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/wpcap/wpcap.c b/dlls/wpcap/wpcap.c index e03e18e..3b0f618 100644 --- a/dlls/wpcap/wpcap.c +++ b/dlls/wpcap/wpcap.c @@ -99,7 +99,6 @@ static void pcap_handler_callback(u_char *user_data, const struct pcap_pkthdr *h TRACE("(%p %p %p)\n", user_data, h, p); pcb = (PCAP_HANDLER_CALLBACK *)user_data; pcb->pfn_cb(pcb->user_data, h, p);
- HeapFree(GetProcessHeap(), 0, pcb); TRACE("Callback COMPLETED\n");
}
@@ -111,11 +110,14 @@ int CDECL wine_pcap_dispatch(pcap_t *p, int cnt,
if (callback) {
int res = 0;
You can remove the initialization here. In fact some analyzers will warn about double-initialization when you do that although its not really necessary.
PCAP_HANDLER_CALLBACK *pcb; pcb = HeapAlloc(GetProcessHeap(), 0, sizeof(PCAP_HANDLER_CALLBACK)); pcb->pfn_cb = callback; pcb->user_data = user;
return pcap_dispatch(p, cnt, pcap_handler_callback, (unsigned char*)pcb);
res = pcap_dispatch(p, cnt, pcap_handler_callback, (unsigned char *)pcb);
HeapFree(GetProcessHeap(), 0, pcb);
return res;
}
return pcap_dispatch(p, cnt, NULL, user);
@@ -204,11 +206,14 @@ int CDECL wine_pcap_loop(pcap_t *p, int cnt,
if (callback) {
int res = 0;
Same here.
PCAP_HANDLER_CALLBACK *pcb; pcb = HeapAlloc(GetProcessHeap(), 0, sizeof(PCAP_HANDLER_CALLBACK)); pcb->pfn_cb = callback; pcb->user_data = user;
return pcap_loop(p, cnt, pcap_handler_callback, (unsigned char*)pcb);
res = pcap_loop(p, cnt, pcap_handler_callback, (unsigned char *)pcb);
HeapFree(GetProcessHeap(), 0, pcb);
return res;
}
return pcap_loop(p, cnt, NULL, user);
Hi,
When now I comile wpcap.dll It pops out a lot of warning message , one of them looks like this
--snip-- In file included from wpcap.c:26:0: ../../include/ntstatus.h:331:0: warning: "STATUS_FLOAT_UNDERFLOW" redefined #define STATUS_FLOAT_UNDERFLOW ((NTSTATUS) 0xC0000093) ^ In file included from ../../include/windef.h:266:0, from ../../include/windows.h:37, from ../../include/winsock.h:110, from ../../include/winsock2.h:47, from wpcap.c:22: ../../include/winnt.h:607:0: note: this is the location of the previous definition #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093) --snip--
How can I get rid of the warning messages?
And What's more, I found if given path " - ", It will be converted to a file named "-" , not writing output to the stdout This behaved differently on windows and wine, On windows it will write the dumpfile to stdout. Maybe this is a bug of wine_nt_to_unix_filename?, I am not sure