https://bugs.winehq.org/show_bug.cgi?id=56871
Bug ID: 56871 Summary: The 32-bit wpcap program is working abnormally Product: Wine Version: 9.0 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: wpcap Assignee: wine-bugs@winehq.org Reporter: csumushu@126.com Distribution: ---
wine version: 9.0 os version: ubuntu 24.04
I used Visual Studio 2010 to compile the code in the attachment into a 32-bit release version of the Windows program. When running the program with Wine, the length of the data packets captured by the program is abnormal when the network card receives ping packets. The program output is as follows: Packet captured: Packet length: 2139105536 Number of bytes: 2139115008
Additionally, compiling the code into a 64-bit release version of the Windows program works normally. Another issue is that if I rename the file at ~/.wine/drive_c/windows/syswow64/wpcap.dll to wpcap_bak.dll, the 32-bit test program cannot start, indicating a failure to load the DLL file. If I rename the file at ~/.wine/drive_c/windows/system32/wpcap.dll to wpcap_bak.dll, the 64-bit test program cannot start either, also indicating a failure to load the DLL file. Are their placement positions reversed?
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #1 from mushu csumushu@126.com --- Created attachment 76671 --> https://bugs.winehq.org/attachment.cgi?id=76671 demo source
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #2 from Rafał Mużyło galtgendo@o2.pl --- Can't say anything about the actual issue, but the dirs are correct, on 64bits syswow64 is for 32bit libs.
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #3 from mushu csumushu@126.com --- (In reply to Rafał Mużyło from comment #2)
Can't say anything about the actual issue, but the dirs are correct, on 64bits syswow64 is for 32bit libs.
However, it is a bit strange that the disappearance of the wpcap.dll in the system32 directory would affect the operation of 64-bit programs.
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #4 from Hans Leidekker hans@meelstraat.net --- (In reply to mushu from comment #3)
(In reply to Rafał Mużyło from comment #2)
Can't say anything about the actual issue, but the dirs are correct, on 64bits syswow64 is for 32bit libs.
However, it is a bit strange that the disappearance of the wpcap.dll in the system32 directory would affect the operation of 64-bit programs.
It's confusing, but that's where 64-bit dlls are on 64-bit Windows.
Can you attach a WINEDEBUG=+wpcap log?
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #5 from mushu csumushu@126.com --- Created attachment 76672 --> https://bugs.winehq.org/attachment.cgi?id=76672 Generated 64-bit program
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #6 from mushu csumushu@126.com --- Created attachment 76673 --> https://bugs.winehq.org/attachment.cgi?id=76673 Generated 32-bit program
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #7 from mushu csumushu@126.com --- (In reply to Hans Leidekker from comment #4)
(In reply to mushu from comment #3)
(In reply to Rafał Mużyło from comment #2)
Can't say anything about the actual issue, but the dirs are correct, on 64bits syswow64 is for 32bit libs.
However, it is a bit strange that the disappearance of the wpcap.dll in the system32 directory would affect the operation of 64-bit programs.
It's confusing, but that's where 64-bit dlls are on 64-bit Windows.
Can you attach a WINEDEBUG=+wpcap log?
I have uploaded the compiled binary program to the attachment, and it can be directly run with Wine
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #8 from Hans Leidekker hans@meelstraat.net --- (In reply to mushu from comment #7)
(In reply to Hans Leidekker from comment #4)
(In reply to mushu from comment #3)
(In reply to Rafał Mużyło from comment #2)
Can't say anything about the actual issue, but the dirs are correct, on 64bits syswow64 is for 32bit libs.
However, it is a bit strange that the disappearance of the wpcap.dll in the system32 directory would affect the operation of 64-bit programs.
It's confusing, but that's where 64-bit dlls are on 64-bit Windows.
Can you attach a WINEDEBUG=+wpcap log?
I have uploaded the compiled binary program to the attachment, and it can be directly run with Wine
64-bit works here. Whether this works may depend on your system too. Please attach a WINEDEBUG=+wpcap log from the 32-bit version for which you filed this bug.
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #9 from mushu csumushu@126.com --- (In reply to Hans Leidekker from comment #8)
(In reply to mushu from comment #7)
(In reply to Hans Leidekker from comment #4)
(In reply to mushu from comment #3)
(In reply to Rafał Mużyło from comment #2)
Can't say anything about the actual issue, but the dirs are correct, on 64bits syswow64 is for 32bit libs.
However, it is a bit strange that the disappearance of the wpcap.dll in the system32 directory would affect the operation of 64-bit programs.
It's confusing, but that's where 64-bit dlls are on 64-bit Windows.
Can you attach a WINEDEBUG=+wpcap log?
I have uploaded the compiled binary program to the attachment, and it can be directly run with Wine
64-bit works here. Whether this works may depend on your system too. Please attach a WINEDEBUG=+wpcap log from the 32-bit version for which you filed this bug.
Indeed, the 64-bit program also works in my environment. I'm just curious why the wpcap.dll in the system32 directory would affect it. I have uploaded the 32-bit log file to the attachment
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #10 from mushu csumushu@126.com --- Created attachment 76674 --> https://bugs.winehq.org/attachment.cgi?id=76674 32bit demo wpcap log
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #11 from Hans Leidekker hans@meelstraat.net --- (In reply to mushu from comment #10)
Created attachment 76674 [details] 32bit demo wpcap log
0024:warn:wpcap:DllMain failed to enable 32-bit mmap() "Unknown options specified"
That's likely the problem. 32-bit apps need this relatively new feature from the Linux pcap library. Looks like it's available since 1.10.4.
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #12 from mushu csumushu@126.com --- (In reply to Hans Leidekker from comment #11)
(In reply to mushu from comment #10)
Created attachment 76674 [details] 32bit demo wpcap log
0024:warn:wpcap:DllMain failed to enable 32-bit mmap() "Unknown options specified"
That's likely the problem. 32-bit apps need this relatively new feature from the Linux pcap library. Looks like it's available since 1.10.4.
I have checked that the current version of pcap is already 1.10.4.
root@mushu:~# dpkg -l|grep pcap ii libpcap-dev:amd64 1.10.4-4 amd64 development library for libpcap (transitional package) ii libpcap-dev:i386 1.10.4-4 i386 development library for libpcap (transitional package) ii libpcap0.8:amd64 1.10.4-4 amd64 system interface for user-level packet capture ii libpcap0.8:i386 1.10.4-4 i386 system interface for user-level packet capture ii libpcap0.8-dev:amd64 1.10.4-4 amd64 development library and header files for libpcap0.8 ii libpcap0.8-dev:i386 1.10.4-4 i386 development library and header files for libpcap0.8
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #13 from mushu csumushu@126.com --- (In reply to Hans Leidekker from comment #11)
(In reply to mushu from comment #10)
Created attachment 76674 [details] 32bit demo wpcap log
0024:warn:wpcap:DllMain failed to enable 32-bit mmap() "Unknown options specified"
That's likely the problem. 32-bit apps need this relatively new feature from the Linux pcap library. Looks like it's available since 1.10.4.
I have also run the unit tests for wpcap, and it is indeed not supporting PCAP_MMAP_32BIT. Are there any other methods to resolve this issue?
root@mushu:~/wine/wine64/dlls/wpcap/tests/x86_64-windows# WINEDEBUG=+trace wine wpcap_test.exe 0084:fixme:wineusb:query_id Unhandled ID query type 0x5. 0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 0084:fixme:hid:handle_IRP_MN_QUERY_ID Unhandled type 00000005 wine: configuration in L"/root/.wine" has been updated. wpcap.c:368: lib version libpcap version 1.10.4 (with TPACKET_V3) wpcap.c:369: supports PCAP_MMAP_32BIT: no wpcap.c:188: pcap_get_tstamp_precision 0 wpcap.c:191: pcap_datalink 1 wpcap.c:126: user 0000000000000000 hdr 00007FFFFE923618 byte 0000555555DE1F70 wpcap.c:265: user 0000000000000000 hdr 00007FFFFE923858 bytes 0000555555DE1F70 0140:wpcap: 44 tests executed (0 marked as todo, 0 as flaky, 0 failures), 0 skipped.
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #14 from mushu csumushu@126.com --- (In reply to Hans Leidekker from comment #11)
(In reply to mushu from comment #10)
Created attachment 76674 [details] 32bit demo wpcap log
0024:warn:wpcap:DllMain failed to enable 32-bit mmap() "Unknown options specified"
That's likely the problem. 32-bit apps need this relatively new feature from the Linux pcap library. Looks like it's available since 1.10.4.
I took a look at the libpcap code, and the feature of PCAP_MMAP_32BIT has not been integrated into the libpcap 1.10.4 version (which is the latest version at present), but it is supported in the master branch.
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #15 from Hans Leidekker hans@meelstraat.net --- (In reply to mushu from comment #14)
(In reply to Hans Leidekker from comment #11)
(In reply to mushu from comment #10)
Created attachment 76674 [details] 32bit demo wpcap log
0024:warn:wpcap:DllMain failed to enable 32-bit mmap() "Unknown options specified"
That's likely the problem. 32-bit apps need this relatively new feature from the Linux pcap library. Looks like it's available since 1.10.4.
I took a look at the libpcap code, and the feature of PCAP_MMAP_32BIT has not been integrated into the libpcap 1.10.4 version (which is the latest version at present), but it is supported in the master branch.
Right, and you would also need a new-style wow64 Wine build to make use of this feature. The root cause of this bug is a difference in layout of the native packet header structure between 32-bit and 64-bit. I'll attach a patch that accounts for this difference. With that you wouldn't need new libpcap or a new wow64 build (though you will need a new Wine build anyway).
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #16 from Hans Leidekker hans@meelstraat.net --- Created attachment 76681 --> https://bugs.winehq.org/attachment.cgi?id=76681 patch
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #17 from mushu csumushu@126.com --- (In reply to Hans Leidekker from comment #16)
Created attachment 76681 [details] patch
It works. I would like to know which output components are affected by this patch, as I wish to repair other environments by copying files.
https://bugs.winehq.org/show_bug.cgi?id=56871
--- Comment #18 from Hans Leidekker hans@meelstraat.net --- (In reply to mushu from comment #17)
(In reply to Hans Leidekker from comment #16)
Created attachment 76681 [details] patch
It works. I would like to know which output components are affected by this patch, as I wish to repair other environments by copying files.
This affects wpcap.so.
https://bugs.winehq.org/show_bug.cgi?id=56871
Hans Leidekker hans@meelstraat.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |727472ab7d60e285a28fb67fd5e | |3e21907dd060a Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #19 from Hans Leidekker hans@meelstraat.net --- Fixed by 727472ab7d60e285a28fb67fd5e3e21907dd060a.
https://bugs.winehq.org/show_bug.cgi?id=56871
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #20 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 9.12.
https://bugs.winehq.org/show_bug.cgi?id=56871
Michael Stefaniuc mstefani@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |9.0.x