Module: wine Branch: master Commit: b97c9be3b822512b83cad6fd5a80c9574a6b1113 URL: https://gitlab.winehq.org/wine/wine/-/commit/b97c9be3b822512b83cad6fd5a80c95...
Author: Hans Leidekker hans@codeweavers.com Date: Mon Feb 6 22:00:48 2023 +0100
wpcap: Try to enable 32-bit mmap() support in libpcap.
This feature will be available in version 1.11.
---
dlls/wpcap/wpcap.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/dlls/wpcap/wpcap.c b/dlls/wpcap/wpcap.c index 39a65885723..8c304ce66a4 100644 --- a/dlls/wpcap/wpcap.c +++ b/dlls/wpcap/wpcap.c @@ -1425,6 +1425,7 @@ int CDECL pcap_wsockinit( void )
#define PCAP_CHAR_ENC_LOCAL 0 #define PCAP_CHAR_ENC_UTF_8 1 +#define PCAP_MMAP_32BIT 2
int CDECL pcap_init( unsigned int opt, char *errbuf ) { @@ -1450,9 +1451,16 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, void *reserved ) { char errbuf[PCAP_ERRBUF_SIZE]; struct init_params params = { PCAP_CHAR_ENC_UTF_8, errbuf }; + BOOL is_wow64;
if (PCAP_CALL( init, ¶ms ) == PCAP_ERROR) WARN( "failed to enable UTF-8 encoding %s\n", debugstr_a(errbuf) ); + if (IsWow64Process( GetCurrentProcess(), &is_wow64 ) && is_wow64) + { + params.opt = PCAP_MMAP_32BIT; + if (PCAP_CALL( init, ¶ms ) == PCAP_ERROR) + WARN( "failed to enable 32-bit mmap() %s\n", debugstr_a(errbuf) ); + } } break; }