[PATCH 1/2] wpcap: Translate device identifier in pcap_create.
Roman Pišl
rpisl at seznam.cz
Sat Jul 2 06:18:25 CDT 2022
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53104
Signed-off-by: Roman Pišl <rpisl at seznam.cz>
---
dlls/wpcap/wpcap.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/dlls/wpcap/wpcap.c b/dlls/wpcap/wpcap.c
index b140deeb3d2..a295819f7fe 100644
--- a/dlls/wpcap/wpcap.c
+++ b/dlls/wpcap/wpcap.c
@@ -68,15 +68,6 @@ int CDECL pcap_compile( struct pcap *pcap, void *program, const char *buf, int o
return PCAP_CALL( compile, ¶ms );
}
-struct pcap * CDECL pcap_create( const char *src, char *errbuf )
-{
- struct pcap *ret;
- struct create_params params = { src, errbuf, &ret };
- TRACE( "%s, %p\n", src, errbuf );
- PCAP_CALL( create, ¶ms );
- return ret;
-}
-
int CDECL pcap_datalink( struct pcap *pcap )
{
TRACE( "%p\n", pcap );
@@ -579,6 +570,26 @@ static char *map_win32_device_name( const char *dev )
return ret;
}
+struct pcap * CDECL pcap_create( const char *source, char *errbuf )
+{
+ char *unix_dev;
+ struct pcap *ret;
+ TRACE( "%s, %p\n", source, errbuf );
+
+ if (!(unix_dev = map_win32_device_name( source )))
+ {
+ if (errbuf) sprintf( errbuf, "Unable to open the adapter." );
+ return NULL;
+ }
+ else
+ {
+ struct create_params params = { unix_dev, errbuf, &ret };
+ PCAP_CALL( create, ¶ms );
+ }
+ free( unix_dev );
+ return ret;
+}
+
static struct pcap *open_live( const char *source, int snaplen, int promisc, int timeout, char *errbuf )
{
char *unix_dev;
--
2.30.2
More information about the wine-devel
mailing list