<div dir="ltr"><div>Hello all,</div><div><br></div><div>I have a Windows software which tries to access dos device name but it is failing:<br></div><div><br></div>0009:Call KERNEL32.CreateFileA(0060f588 "\\\\.\\d6CDE-0",40000000,00000002,00000000,00000003,00000000,00000000) ret=00b1117f<br>0009:Call ntdll.RtlInitAnsiString(0060f49c,0060f588 "\\\\.\\d6CDE-0") ret=7b036296<br>0009:Ret  ntdll.RtlInitAnsiString() retval=0060f49c ret=7b036296<br>0009:Call ntdll.RtlAnsiStringToUnicodeString(3fff8bf8,0060f49c,00000000) ret=7b0362fb<br>0009:Ret  ntdll.RtlAnsiStringToUnicodeString() retval=00000000 ret=7b0362fb<br>0009:Call ntdll._wcsicmp(3fff8c00 L"\\\\.\\d6CDE-0",7b09d0c0 L"CONIN$") ret=7b0355c9<br>0009:Ret  ntdll._wcsicmp() retval=fffffff9 ret=7b0355c9<br>0009:Call ntdll._wcsicmp(3fff8c00 L"\\\\.\\d6CDE-0",7b09d0ce L"CONOUT$") ret=7b035636<br>0009:Ret  ntdll._wcsicmp() retval=fffffff9 ret=7b035636<br>0009:Call ntdll.wcsncmp(3fff8c00 L"\\\\.\\d6CDE-0",7b09d644 L"\\\\.\\",00000004) ret=7b035670<br>0009:Ret  ntdll.wcsncmp() retval=00000000 ret=7b035670<br>0009:Call ntdll.iswalpha(00000064) ret=7b0356cd<br>0009:Ret  ntdll.iswalpha() retval=00000102 ret=7b0356cd<br>0009:Call ntdll._wcsnicmp(3fff8c08 L"d6CDE-0",7b09d638 L"PIPE\\",00000005) ret=7b0356f5<br>0009:Ret  ntdll._wcsnicmp() retval=fffffff4 ret=7b0356f5<br>0009:Call ntdll._wcsnicmp(3fff8c08 L"d6CDE-0",7b09d624 L"MAILSLOT\\",00000009) ret=7b03570e<br>0009:Ret  ntdll._wcsnicmp() retval=fffffff7 ret=7b03570e<br>0009:Call ntdll.RtlIsDosDeviceName_U(3fff8c08 L"d6CDE-0") ret=7b035724<br>0009:Ret  ntdll.RtlIsDosDeviceName_U() retval=00000000 ret=7b035724<br>0009:Call ntdll.RtlDosPathNameToNtPathName_U(3fff8c00 L"\\\\.\\d6CDE-0",0060f458,00000000,00000000) ret=7b035769<br>0009:Ret  ntdll.RtlDosPathNameToNtPathName_U() retval=00000001 ret=7b035769<br>0009:Call ntdll.NtCreateFile(0060f454,40100080,0060f474,0060f460,00000000,00000000,00000002,00000001,00000060,00000000,00000000) ret=7b03581e<br>0009:Ret  ntdll.NtCreateFile() retval=c0000034 ret=7b03581e<br>0009:Call ntdll.RtlNtStatusToDosError(c0000034) ret=7b035a11<br>0009:Ret  ntdll.RtlNtStatusToDosError() retval=00000002 ret=7b035a11<br>0009:Call ntdll.RtlFreeUnicodeString(0060f458) ret=7b03592b<br>0009:Ret  ntdll.RtlFreeUnicodeString() retval=0060f458 ret=7b03592b<br>0009:Ret  KERNEL32.CreateFileA() retval=ffffffff ret=00b1117f<br><div><br></div><div>The problem is, that wine doesn't recognize "\\\\.\\d6CDE-0" as valid DOS device name:</div><div><a href="https://github.com/wine-mirror/wine/blob/e909986e6ea5ecd49b2b847f321ad89b2ae4f6f1/dlls/ntdll/path.c#L70">https://github.com/wine-mirror/wine/blob/e909986e6ea5ecd49b2b847f321ad89b2ae4f6f1/dlls/ntdll/path.c#L70</a></div><div><br></div><div>Even when I created the device in HKEY_LOCAL_MACHINE\Software\Wine\Ports it doesn't allow to open it.</div><div><br></div><div>When I patched the corresponding DLL to use COM81 and created the device in Ports, it works okay (can open the device).</div><div><br></div><div>I want to write a patch to ntdll/path.c to recognize my string as DOS device but I want it to be generic enough to be acceptable.</div><div><br></div><div>What approach do you suggest? Can I add a generic match, something like: "\\\\.\\[^\\]+$" ?<br></div><div><br></div><div>To add some context here, the software is for controlling USB osclloscope from Hantek:</div><div><a href="http://hantek.com/uploadpic/hantek/files/20210731/Hantek-6000_Ver2.2.7_D20210721.rar">http://hantek.com/uploadpic/hantek/files/20210731/Hantek-6000_Ver2.2.7_D20210721.rar</a></div><div>It installs a driver which creates mentioned "DOS device" and communicates through it using ioctl.</div><div>I am reversing the driver and I'll create a Linux char device to handle those ioctl calls and talk to the USB device using libusb.</div><div><br></div><div>Thanks.<br></div><div><br></div><div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><br>S pozdravom / Best regards<br>Daniel Kucera.</div></div></div>