[Bug 36065] New: PunkBuster service tests fail (DeleteService should mark active services in SCM database as pending for deletion)

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Apr 23 10:16:44 CDT 2014


https://bugs.winehq.org/show_bug.cgi?id=36065

            Bug ID: 36065
           Summary: PunkBuster service tests fail (DeleteService should
                    mark active services in SCM database as pending for
                    deletion)
           Product: Wine
           Version: 1.7.17
          Hardware: x86
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: programs
          Assignee: wine-bugs at winehq.org
          Reporter: focht at gmx.net

Hello folks,

although not really a problem because of the state of PunkBuster (bug 9685) it
still highlights a Wine bug.

PunkBuster service components test tool:
http://www.evenbalance.com/index.php?page=pbsvcfaq.php

--- snip ---
...
Checking PnkBstrK driver status    NOT FOUND
Extracting new PnkBstrK to:
   "C:\users\focht\Application Data\PnkBstrK.sys"
                                   OK
Sending load packet to PnkBstrB    SENT
Checking PnkBstrK driver status    NOT FOUND
Manually stopping PnkBstrB         FAILED - no handle
--- snip ---

Relevant part of trace log:

--- snip ---
$ WINEDEBUG=+tid,+seh,+loaddll,+service,+relay wine ./pbsvc.exe >>log.txt 2>&1
...
0044:Call advapi32.CreateServiceA(00135c48,0041e168 "PnkBstrK",0041e168
"PnkBstrK",000f01ff,00000001,00000003,00000001,0041b000
"C:\\windows\\system32\\drivers\\PnkBstrK.sys",00000000,00000000,00000000,00000000,00000000)
ret=004078e5
0044:trace:service:CreateServiceA 0x135c48 "PnkBstrK" "PnkBstrK"
0044:trace:service:CreateServiceW 0x135c48 L"PnkBstrK" L"PnkBstrK" 
...
0016:trace:service:svcctl_CreateServiceW (L"PnkBstrK", L"PnkBstrK", 0xf01ff,
L"C:\\windows\\system32\\drivers\\PnkBstrK.sys") 
...
0016:Call advapi32.RegCreateKeyW(00000024,00119aa0 L"PnkBstrK",0084e4a8)
ret=7edeb767
0016:Ret  advapi32.RegCreateKeyW() retval=00000000 ret=7edeb767
0016:Call advapi32.RegSetValueExW(00000130,7edf93c4
L"DisplayName",00000000,00000001,0011a890,00000012) ret=7edeb689
0016:Ret  advapi32.RegSetValueExW() retval=00000000 ret=7edeb689
...
0016:trace:service:scmdatabase_add_service 0x11a950 
...
0044:Ret  advapi32.CreateServiceA() retval=001f6108 ret=004078e5
0044:Call advapi32.CloseServiceHandle(001f6108) ret=004078f8
0044:trace:service:CloseServiceHandle 0x1f6108 
...
0044:Ret  advapi32.OpenServiceA() retval=001f55c8 ret=00407901
0044:Call advapi32.StartServiceA(001f55c8,00000000,00000000) ret=0040793b
0044:trace:service:StartServiceA (0x1f55c8,0,(nil))
0044:trace:service:StartServiceW 0x1f55c8 0 (nil) 
...
0042:trace:service:svcctl_StartServiceW (0x118d38, 0, (nil)) 
...
0042:Call KERNEL32.CreateProcessW(00000000,001191a0
L"C:\\windows\\system32\\winedevice.exe
PnkBstrK",00000000,00000000,00000000,00000400,00540000,00000000,00c4e4c8,00c4e50c)
ret=7edece8f
...
000d:Call KERNEL32.__wine_kernel_init() ret=7bc5a402
...
0042:Ret  KERNEL32.CreateProcessW() retval=00000001 ret=7edece8f 
...
0042:trace:service:service_send_start_message L"PnkBstrK" (nil) 0 
...
000d:trace:service:service_run_main_thread Starting 1 services running as
process 71 
...
0025:trace:service:service_control_dispatcher got request 1 for service
L"PnkBstrK"
0025:trace:service:SERV_OpenServiceW 0x119790 L"PnkBstrK" 32768 
...
0025:trace:service:SERV_OpenServiceW returning 0x11ac48
0025:trace:service:service_handle_start L"PnkBstrK" argsize 10 
...
0034:Call advapi32.RegisterServiceCtrlHandlerExW(00115292
L"PnkBstrK",7edfc61f,00000000) ret=7edfc86c
0034:trace:service:RegisterServiceCtrlHandlerExW L"PnkBstrK" 0x7edfc61f (nil)
0034:Ret  advapi32.RegisterServiceCtrlHandlerExW() retval=0011a918 ret=7edfc86c
0034:Call advapi32.SetServiceStatus(0011a918,0053e97c) ret=7edfc8c9
0042:trace:service:service_wait_for_startup 0x11a950
0034:trace:service:SetServiceStatus 0x11a918 30 2 0 0 0 0 2710
...
0016:trace:service:svcctl_SetServiceStatus (0x11aed8, 0x11adc4) 
...
0044:Ret  advapi32.StartServiceA() retval=00000001 ret=0040793b 
...
0034:Call driver init 0x100033c0
(obj=0x7edff4c0,str=L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\PnkBstrK") 
...
0034:Call advapi32.SetServiceStatus(0011a918,0053e97c) ret=7edfc8f8
0034:trace:service:SetServiceStatus 0x11a918 30 4 5 0 0 0 2710 
...
0044:Call advapi32.DeleteService(00137f70) ret=00407549
0044:trace:service:DeleteService (0x137f70) 
...
0016:trace:service:scmdatabase_remove_service 0x11a950
0016:Call advapi32.RegDeleteTreeW(00000024,00119aa0 L"PnkBstrK") ret=7edebbce
0016:Ret  advapi32.RegDeleteTreeW() retval=00000000 ret=7edebbce 
...
0044:Ret  advapi32.DeleteService() retval=00000001 ret=00407549 
...
0043:Call advapi32.OpenServiceA(00137f20,0041e168 "PnkBstrK",000f01ff)
ret=00407510
0043:trace:service:OpenServiceA 0x137f20 "PnkBstrK" 983551
0043:trace:service:SERV_OpenServiceW 0x137f20 L"PnkBstrK" 983551 
...
0016:trace:service:svcctl_OpenServiceW (L"PnkBstrK", 0xf01ff) 
...
0043:trace:service:SERV_OpenServiceW returning (nil) 
...
0043:Ret  advapi32.OpenServiceA() retval=00000000 ret=00407510 
...
--- snip ---

The tool extracts, installs and starts the kernel service.
Meanwhile, the tool issues a request to mark the service for deletion - kind of
"auto-cleanup".
After that it starts polling of the service status to check if the service is
actually running (it is).

The problem: Wine doesn't implement the deferred deletion of active services
and removes the service entry while the service is alive (state 'running').
All subsequent service lookup/status requests fail because the entry is now
missing from database.

MSDN:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682562%28v=vs.85%29.aspx

--- quote ---
DeleteService function

Marks the specified service for deletion from the service control manager
database.

...
The DeleteService function marks a service for deletion from the service
control manager database. The database entry is not removed until all open
handles to the service have been closed by calls to the CloseServiceHandle
function, and the service is not running. A running service is stopped by a
call to the ControlService function with the SERVICE_CONTROL_STOP control code.
If the service cannot be stopped, the database entry is removed when the system
is restarted.
--- quote ---

While you're at it ... please add a TRACE to DeleteService():

http://source.winehq.org/git/wine.git/blob/929d9fb9f79b9ba0b7392215e51a152ec709d62c:/dlls/advapi32/service.c#l1086

I used the 'service' debug channel first and lost some time because I didn't
see the the service deletion part (it's only visible if one uses the heavy
relay gun).
This would be consistent with other TRACE messages for service API.

Regards

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list