Arbitrary DOS device name

Zebediah Figura zfigura at codeweavers.com
Mon Feb 14 18:56:18 CST 2022


On 2/14/22 03:49, Daniel Kucera wrote:
> On 2022-02-14 01:14, Daniel Kucera wrote:
>> On 2022-02-14 00:20, Daniel Kucera wrote:
>>> On 2022-02-01 22:39, Zebediah Figura wrote:
>>>> On 2/1/22 13:25, danman at danman.eu wrote:
>>>>> I checked with strace:
>>>>>
>>>>> openat(AT_FDCWD,
>>>>> "/usr/lib/wine/../x86_64-linux-gnu/wine/dpinst64.exe.so", O_RDONLY)
>>>>> = -1
>>>>> ENOENT (No such file or directory)
>>>>> write(2, "0009:err:module:__wine_process_i"...,
>>>>> 850009:err:module:__wine_process_init
>>>>> L"C:\\windows\\system32\\dpinst64.exe" not found
>>>>> ) = 85
>>>>>
>>>>> copied the lib:
>>>>> sudo cp programs/dpinst64/dpinst64.exe.so
>>>>> /usr/lib/x86_64-linux-gnu/wine/
>>>>>
>>>>> now I am getting:
>>>>>
>>>>> $ wine64 ~/.wine/drive_c/windows/system32/dpinst64.exe
>>>>> 002b:err:module:__wine_process_init
>>>>> L"C:\\windows\\system32\\dpinst64.exe" not supported on this system
>>>>>
>>>>> The same with setup.exe:
>>>>>
>>>>> $ WINEDLLOVERRIDES=dpinst64.exe=b,n WINEDEBUG=dpinst+trace wine64
>>>>> Setup.EXE
>>>>> 0032:fixme:shell:SHChangeNotify ignoring unsupported flags: 2001
>>>>> 0040:err:module:__wine_process_init L"C:\\Program Files
>>>>> (x86)\\Hantek6000\\Bin\\dpinst64.exe" not supported on this system
>>>>> 0042:err:module:__wine_process_init L"C:\\Program Files
>>>>> (x86)\\Hantek6000\\Bin\\dpinst64.exe" not supported on this system
>>>>>
>>>>
>>>> If you're building with MinGW, you want to copy it as "dpinst64.exe",
>>>> not "dpinst64.exe.so".
>>>>
>>>> Probably easier is just to run the wine binary from the build tree
>>>> instead, e.g. "path/to/build/tree/wine64 Setup.EXE". That doesn't
>>>> require installing anything at all.
>>>
>>> It took me a while to understand what's wrong there - the setup.exe is
>>> 32bit binary and I didn't run with wine64 so I have to recompile 32bit
>>> wine.
>>> Now, when I am installing the software, I get following error:
>>>
>>> 0118:fixme:imm:ImeSetActiveContext (0x257560, 0): stub
>>> 0118:fixme:imm:ImmReleaseContext (00020060, 00257560): stub
>>> 0108:fixme:imm:ImeSetActiveContext (0x245220, 1): stub
>>> 0108:fixme:imm:ImmReleaseContext (00020090, 00245220): stub
>>> 0138:err:module:import_dll Library USBD.SYS (which is needed by
>>> L"C:\\Program Files\\Hantek6000\\Driver\\Win10\\Hantek6000BX86.sys")
>>> not found
>>> 0150:err:module:import_dll Library USBD.SYS (which is needed by
>>> L"C:\\Program Files\\Hantek6000\\Driver\\Others\\Hantek6000BX86.sys")
>>> not found
>>> 0108:fixme:shell:SHChangeNotify ignoring unsupported flags: 2001
>>>
>>> Is there something to do to "activate" usbd.sys support? Is it
>>> implemented at all?
>>>
>>> Thank you for everything.
>>>
>>> Daniel.
>>
>> I've found out it is searching for usbd.sys in following paths:
>> 0120:trace:module:load_dll looking for L"USBD.SYS" in
>> L"C:\\users\\danman\\Temp;C:\\windows\\system32;C:\\windows\\system;C:\\windows;.;C:\\windows\\system32;C:\\windows;C:\\windows\\system32\\wbem;C:\\windows\\system32\\WindowsPowershell\\v1.0"
>> 0120:err:module:import_dll Library USBD.SYS (which is needed by
>> L"C:\\Program Files\\Hantek6000\\Driver\\Others\\HANT~1W0.SYS") not
>> found
>>
>> but it was in system32/drivers so I copied it to system32. Now I am
>> getting ntdll error:
>>
>> $ WINEDEBUG=trace+dpinst wine Setup.EXE
>> 0044:fixme:imm:ImeSetActiveContext (0x257540, 0): stub
>> 0044:fixme:imm:ImmReleaseContext (00010020, 00257540): stub
>> 0024:fixme:imm:ImeSetActiveContext (0x245240, 1): stub
>> 0024:fixme:imm:ImmReleaseContext (0001005A, 00245240): stub
>> 0024:fixme:shell:SHChangeNotify ignoring unsupported flags: 2001
>> 0158:err:ntdll:NtQueryInformationToken Unhandled token information
>> class 26
>> 0150:fixme:imm:ImeSetActiveContext (0x245380, 1): stub
>> 0150:fixme:imm:ImmReleaseContext (000D00C6, 00245380): stub
> 
> I have patched my ntdll to respond to class 26 like this:
> 
> diff --git a/dlls/ntdll/unix/security.c b/dlls/ntdll/unix/security.c
> index 8e3afd07..5fcd2fba 100644
> --- a/dlls/ntdll/unix/security.c
> +++ b/dlls/ntdll/unix/security.c
> @@ -503,6 +503,10 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE
> token, TOKEN_INFORMATION_CLASS c
>            SERVER_END_REQ;
>            break;
> 
> +    case TokenUIAccess:
> +        status = STATUS_SUCCESS;
> +       break;
> +
>        default:
>            ERR( "Unhandled token information class %u\n", class );
>            return STATUS_NOT_IMPLEMENTED;
> 
> Now I see something new - there is a driver install wizard showing
> failed installation of the driver so there is probably something wrong
> with the installation, see this video:
> https://www.youtube.com/watch?v=Ko9gg6wVsX8
> 
> I can also see there is dpinst process while the wizard is on:
> danman    498279 10.8  0.7 1938044 30568 ?       Ss   09:29   0:01
> C:\Program Files (x86)\Hantek6000\Bin\dpinst64.exe /F /EL /PATH
> C:\Program Files (x86)\Hantek6000\Driver\Win10

That's native dpinst, which is exactly what my builtin implementation is 
supposed to replace.

That said, if you're getting FIXMEs from usbd.sys, that should mean that 
the driver has already been installed and even enumerated, so I suppose 
you must have used builtin dpinst at some point. So now all that remains 
is to run the program and see if it manages to find its custom character 
device.



More information about the wine-devel mailing list