https://bugs.winehq.org/show_bug.cgi?id=41114
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Summary|CPU-Z randomly fails to |CPU-Z randomly fails to |load its driver |load its driver |(cpuz139_x32.sys) |(cpuz139_x32.sys)('StartSer | |vice' must wait for driver | |service entry point | |execution before return) Status|NEW |RESOLVED CC| |focht@gmx.net
--- Comment #6 from Anastasius Focht focht@gmx.net --- Hello folks,
dupe of bug 38836
In short: Wine's service manager doesn't wait until the kernel driver entry point is fully executed hence the driver symbolic device link '\\.\cpuz140' which is created in entry point might not exist yet when the client process tries to open it immediately after the StartService() call returns.
App log:
--- snip--- [bInitDriver] path = C:\users\focht\Temp\ [bInitDriver] GetCurrentDirectory = Z:\home\focht\Downloads [bInitDriver] GetModuleFileName = Z:\home\focht\Downloads\cpuz_x32.exe [vGetOSVersion] m_iOSVersion = 2 (5.1) [vGetOSVersion] m_bIsAMD64 = 0 [bInitDriver] m_hDriverMutex = 90 [bDeleteFile 13:18:16] DeleteFile returned = 0 (error = 3) [bDeleteFile 13:18:16] RemoveDirectory C:\users\focht\Temp\cpuz140\ returned = 0 (error = 2) [bInitDriver] m_szFilename = cpuz140_x32.sys [WinNT_hCreateServiceHandle] returned 2 (0x2) [WinNT_bInstallDriver 13:18:16] szMachineName = n550 [dwExtract_SYS] Extract C:\users\focht\Temp\cpuz140\cpuz140_x32.sys [WinNT_bCreateService] szDestName = C:\users\focht\Temp\cpuz140\cpuz140_x32.sys [WinNT_hCreateServiceHandle] returned 2 (0x2) [bInitDriver] bInitDriver returned 2 [vCloseDriver 13:18:16] WaitForSingleObject error = 0 [WinNT_dwStopService] ControlService[SERVICE_CONTROL_INTERROGATE] status = 0x4 [WinNT_dwStopService] ControlService[SERVICE_CONTROL_STOP] status = 0x3 [WinNT_dwStopService] ControlService[SERVICE_CONTROL_STOP] failed, pending, result = 0 [bDeleteFile 13:18:16] DeleteFile returned = 1 (error = 0) [bDeleteFile 13:18:16] RemoveDirectory C:\users\focht\Temp\cpuz140\ returned = 1 (error = 0) [vCloseDriver] CloseHandle(mutex) = 1 --- snip ---
Relevant part of "good case" trace log:
--- snip --- ... 0009:Call advapi32.CreateServiceA(0015cca0,007f2a28 "cpuz140",007f2a28 "cpuz140",000f01ff,00000001,00000003,00000001,0033e6c8 "C:\users\focht\Temp\\cpuz140\cpuz140_x32.sys",00000000,00000000,00000000,00000000,00000000) ret=00436740 ... 0015:trace:service:svcctl_CreateServiceW (L"cpuz140", L"cpuz140", 0xf01ff, L"C:\users\focht\Temp\\cpuz140\cpuz140_x32.sys") 0015:trace:service:create_serviceW (L"cpuz140", L"cpuz140", 0xf01ff, L"C:\users\focht\Temp\\cpuz140\cpuz140_x32.sys") ... 0009:trace:service:SERV_OpenServiceW returning 0x15c810 0009:Ret advapi32.OpenServiceA() retval=0015c810 ret=00436867 0009:Call advapi32.StartServiceA(0015c810,00000000,00000000) ret=004368a1 ... 0014:trace:process:create_process_impl starting L"C:\windows\system32\winedevice.exe" as Win32 binary (0x10000000-0x10003000, arch 014c, fakedll) ... 002f:Call KERNEL32.__wine_kernel_init() ret=7bc69f34 ... 0014:trace:process:create_process_impl started process pid 002e tid 002f 0014:Ret KERNEL32.CreateProcessW() retval=00000001 ret=7ed6c56b ... 0014:trace:service:process_send_start_message 0x11c390 L"Winedevice3" 0x64e408 0 ... 002f:trace:service:service_run_main_thread Starting 1 services running as process 46 ... 0014:trace:service:service_start returning 0 ... 0034:Call KERNEL32.LoadLibraryW(0011cb28 L"C:\users\focht\Temp\\cpuz140\cpuz140_x32.sys") ret=7effaaa4 ... 0009:Ret advapi32.StartServiceA() retval=00000001 ret=004368a1 ... 0034:trace:loaddll:load_native_dll Loaded L"C:\users\focht\Temp\cpuz140\cpuz140_x32.sys" at 0x740000: native ... 0034:Ret KERNEL32.LoadLibraryW() retval=00740000 ret=7effaaa4 ... 0034:Call driver init 0x74703e (obj=0x11c950,str=L"\Registry\Machine\System\CurrentControlSet\Services\cpuz140") ... ntoskrnl.exe.IoCreateDevice(0011c950,00000004,0063e734,00009c40,00000000,00000001,0063e740) ret=00743e95 ... 0034:trace:ntoskrnl:IoCreateDevice (0x11c950, 4, L"\Device\cpuz140", 40000, 0, 1, 0x63e740) ... 0034:trace:ntoskrnl:IoCreateSymbolicLink L"\DosDevices\Global\CPUZ140" -> L"\Device\cpuz140" ... 0034:Ret driver init 0x74703e (obj=0x11c950,str=L"\Registry\Machine\System\CurrentControlSet\Services\cpuz140") retval=00000000 ... 0034:trace:service:SetServiceStatus 0x11b7d8 30 4 5 0 0 0 0 ... 0009:Call KERNEL32.CreateFileA(0033e6f8 "\\.\cpuz140",80000000,00000001,00000000,00000003,00000000,00000000) ret=00436a72 ... 0009:Ret KERNEL32.CreateFileA() retval=00000088 ret=00436a72 ... --- snip ---
Last parts of "bad case" trace log:
--- snip --- ... 0035:Call KERNEL32.LoadLibraryW(0011cb20 L"C:\users\focht\Temp\\cpuz140\cpuz140_x32.sys") ret=7effaaa4 ... 0009:Ret advapi32.StartServiceA() retval=00000001 ret=004368a1 ... 0035:trace:loaddll:load_native_dll Loaded L"C:\users\focht\Temp\cpuz140\cpuz140_x32.sys" at 0x740000: native ... 0009:Call KERNEL32.CreateFileA(0033e6f8 "\\.\cpuz140",80000000,00000001,00000000,00000003,00000000,00000000) ret=00436a72 ... 0009:Ret KERNEL32.CreateFileA() retval=ffffffff ret=00436a72 ... 0009:Call KERNEL32.GetLastError() ret=00436a7e 0009:Ret KERNEL32.GetLastError() retval=00000002 ret=00436a7e ... 0035:Call driver init 0x74703e (obj=0x11c948,str=L"\Registry\Machine\System\CurrentControlSet\Services\cpuz140") ... 0035:trace:ntoskrnl:IoCreateSymbolicLink L"\DosDevices\Global\CPUZ140" -> L"\Device\cpuz140" ... --- snip ---
$ sha1sum cpu-z_1.77-en.zip 34de55aef583f43576dbb097ad8d486598ac0adb cpu-z_1.77-en.zip
$ du -sh cpu-z_1.77-en.zip 2.5M cpu-z_1.77-en.zip
$ wine --version wine-2.12
Regards
*** This bug has been marked as a duplicate of bug 38836 ***