Home › Forums › Discussions › Support › Compiling with cygwin.
- This topic has 4 replies, 2 voices, and was last updated 8 months, 3 weeks ago by Vadim Smirnov.
-
AuthorPosts
-
February 27, 2024 at 11:44 am #13584
Hi,
Is it possible to generate executables based on ndisapi framework via CYGWIN ?
I tried to compile PerfTest, by replacing C++ api calls with C api ones; then simply generating “perftest.exe” with the following command in Cygwin command shell:
$ /usr/bin/c++ perftest.cpp stdafx.cpp -o PerfTest.exe ndisapi.dll -I../ndisapi/Include
I installed “Windows Packet Filter v3.4.8” on my Windows 10 Pro environment.
When I run the application;
1. NDISRD device is opened successfully ( via OpenFilterDriver call )
2. Adapter list is obtained successfully ( via GetTcpipBoundAdaptersInfo )
3. SetPacketEvent fails. When I debug, I see that;
3.1 CNdisApi::SetPacketEvent calls “CNdisApi::DeviceIoControl”.
3.2 “CNdisApi::DeviceIoControl” calls DeviceIOControl from “ioapiset.h” which always returns “87: INVALID_PARAMETER” error.
Is there any additional configuration task to be applied in order to not experience this error ?
Visual Studio uses “‘C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\um\ioapiset.h'”
while cygwin uses its own w32api header: “/usr/include/w32api/ioapiset.h”
I didn’t see any difference between DeviceIoControl definitions. GetTcpipBoundAdaptersInfo calls same function without any error.
Is there a document describing how to compile and run ndisapi or ndisapi based apps ( dnstrace etc. ) on Cygwin?
Thanks.
February 27, 2024 at 8:33 pm #13585Is there a document describing how to compile and run ndisapi or ndisapi based apps ( dnstrace etc. ) on Cygwin?
Unfortunately, no, and I haven’t attempted that myself. However, I believe it should be feasible to build NDISAPI with Cygwin or invoke the NDISAPI.DLL C interface from a Cygwin application. Thus, I’m somewhat puzzled by your error code. Kindly verify that you’ve compiled the code against the appropriate platform, ensuring, for instance, that you’re calling a 64-bit DLL from 64-bit code.
February 28, 2024 at 9:37 am #13587I thing ndisapi.dll is 64-bit, I’m using the “../ndisapi/bin/dll/x64/Debug/ndisapi.dll” compiled in VS 2022.
Cygwin64 is installed in my Win 10 Pro 64 bit setup.
I tried the 64 bit compilers in cygwin: “/usr/bin/x86_64-pc-cygwin-c++.exe” and “/usr/bin/x86_64-pc-cygwin-g++.exe”
When I compile the modified PerfTest ( with C Api ) in VS 2022, everything is fine, I don’t get any error.
February 28, 2024 at 10:57 am #13588I apologize for any earlier confusion. My advice is to start by building NDISAPI with Cygwin, which should streamline the process and address ABI compatibility issues. Although I haven’t personally built it using Cygwin, I consider it a viable option. The driver interface is well-documented, and the C++ code can be compiled using various Microsoft compilers, ranging from Visual C++ 6.0 to the latest Visual Studio 2022. Previously, I used C++ Builder for building it and it also worked just fine.
March 1, 2024 at 6:36 pm #13589I’ve recently added a Cygwin demonstration, providing Makefile for building the static version of the NDISAPI library as well as several basic examples. Hope it helps!
-
AuthorPosts
- You must be logged in to reply to this topic.