On 2022-01-27 14:13, Daniel Kucera wrote:
Now just the implementation... :)
Okay, so I have moved a bit further.
I can receive those ioctls in my driver which is great.
002b:trace:hantek:hantek_ioctl ioctl 222059 insize 10 outsize 10 002b:trace:hantek:hantek_ioctl indata "\x00\x02\x00\xf7\xea\xf8\x00\x00\x00\x00"
Now I am trying to write the usb part, so I tried to use libusb but there are two problems:
1. When I include libusb.h in my source file: #include <libusb-1.0/libusb.h>
I am getting following when running ./configure --enable-win64 : dlls/hantek.sys/main.c:31: error: system header libusb-1.0/libusb.h cannot be used with msvcrt
so I have done this to allow the configure to proceed but it is dirty: if (!strcmp( pFile->name, "stdarg.h" )) return NULL; fprintf( stderr, "%s:%d: error: system header %s cannot be used with msvcrt\n", pFile->included_by->file->name, pFile->included_line, pFile->name ); - exit(1); + //exit(1);
What is the proper way to fix this?
2. configure is generating broken Makefile: hantek.sys.so hantek.sys.fake: hantek.sys.spec main.o ../../dlls/ntoskrnl.exe/libntoskrnl.def \ ../../dlls/msvcrt/libmsvcrt.a ../../dlls/winecrt0/libwinecrt0.a \ ../../dlls/kernel32/libkernel32.def ../../dlls/ntdll/libntdll.def ../../tools/winebuild/winebuild \ ../../tools/winegcc/winegcc ../../tools/winegcc/winegcc -o $@ --wine-objdir ../.. -m64 -fPIC -fasynchronous-unwind-tables \ -shared hantek.sys.spec -mno-cygwin -Wl,--subsystem,native main.o -lntoskrnl -lusb-1 $(LDFLAGS)
note the -lusb-1
while in Makefile.in I have specified: IMPORTS = ntoskrnl usb-1.0
I also tried 'usb-1.0' and usb-1.0 but none of them works.
How to fix this one? I am now manually editing the generated Makefile to -lusb-1.0
Despite these problems, the libusb seems to work correctly in the driver and I can query it's version:
$ WINEDEBUG=trace+hantek wine Scope.exe 002a:trace:hantek:DriverEntry Using libusb v1.0.24.11584
002a:trace:hantek:DriverEntry (000000000011FCB0, L"\Registry\Machine\System\CurrentControlSet\Services\Hantek") hantek 002a:trace:hantek:DriverEntry create device hantek (L"\Device\d6CDE-0") dos device (L"\DosDevices\d6CDE-0") wine: Read access denied for device L"\??\Z:\", FS volume label and serial are not available. wine: Read access denied for device L"\??\Z:\", FS volume label and serial are not available. wine: Read access denied for device L"\??\Z:\", FS volume label and serial are not available. wine: Read access denied for device L"\??\Z:\", FS volume label and serial are not available. 002b:trace:hantek:hantek_ioctl ioctl 222059 insize 10 outsize 10 002b:trace:hantek:hantek_ioctl indata "\x00\x02\x00\xf7\xea\xf8\x00\x00\x00\x00"
Thank you in advance. Daniel.