http://bugs.winehq.org/show_bug.cgi?id=13958
Summary: Services: handle null display names properly when populating SCM db entries Product: Wine Version: 1.0-rc5 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P3 Component: programs AssignedTo: wine-bugs@winehq.org ReportedBy: focht@gmx.net
Hello,
there is a bug in services code when one or more services have no display name set (null). If CreateServiceW() is called, it checks for existing services using scmdatabase_find_service_by_displayname(). Unfortunately this internal helper doesn't handle the "null" service name properly while iterating, resulting in exception and messy side effects (although mapped to rpc exception it isn't propagated properly).
Following is service db dump with such cases:
--- snip --- 000d:trace:service:scmdatabase_load_services Loading service L"BITS" 000d:trace:service:load_service_config Image path = L"svchost.exe -k netsvcs" 000d:trace:service:load_service_config Group = (null) 000d:trace:service:load_service_config Service account name = L"LocalSystem" 000d:trace:service:load_service_config Display name = L"BITS" 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) 000d:trace:service:scmdatabase_load_services Loading service L"MountMgr" 000d:trace:service:load_service_config Image path = L"C:\windows\system32\drivers\mountmgr.sys" 000d:trace:service:load_service_config Group = (null) 000d:trace:service:load_service_config Service account name = L"LocalSystem" 000d:trace:service:load_service_config Display name = L"Mount Manager" 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) 000d:trace:service:scmdatabase_load_services Loading service L"MSIServer" 000d:trace:service:load_service_config Image path = L"C:\windows\system32\msiexec.exe /V" 000d:trace:service:load_service_config Group = (null) 000d:trace:service:load_service_config Service account name = L"LocalSystem" 000d:trace:service:load_service_config Display name = L"MSIServer" 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) 000d:trace:service:scmdatabase_load_services Loading service L"PnkBstrA" 000d:trace:service:load_service_config Image path = L"C:\windows\system32\PnkBstrA.exe" 000d:trace:service:load_service_config Group = (null) 000d:trace:service:load_service_config Service account name = L"LocalSystem" 000d:trace:service:load_service_config Display name = L"PnkBstrA" 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) 000d:trace:service:scmdatabase_load_services Loading service L"PnkBstrB" 000d:trace:service:load_service_config Image path = L"C:\windows\system32\PnkBstrB.exe" 000d:trace:service:load_service_config Group = (null) 000d:trace:service:load_service_config Service account name = L"LocalSystem" 000d:trace:service:load_service_config Display name = L"PnkBstrB" 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) 000d:trace:service:scmdatabase_load_services Loading service L"PnkBstrK" 000d:trace:service:load_service_config Image path = L"C:\windows\system32\drivers\PnkBstrK.sys" 000d:trace:service:load_service_config Group = (null) 000d:trace:service:load_service_config Service account name = L"LocalSystem" 000d:trace:service:load_service_config Display name = L"PnkBstrK" 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) 000d:trace:service:scmdatabase_load_services Loading service L"PROCMON13" 000d:trace:service:load_service_config Image path = L"\??\C:\windows\system32\Drivers\PROCMON13.SYS" 000d:trace:service:load_service_config Group = (null) 000d:trace:service:load_service_config Service account name = (null) 000d:trace:service:load_service_config Display name = (null) 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) 000d:trace:service:scmdatabase_load_services Loading service L"SecDrv" 000d:trace:service:load_service_config Image path = L"C:\windows\system32\drivers\\SECDRV.SYS" 000d:trace:service:load_service_config Group = (null) 000d:trace:service:load_service_config Service account name = L"LocalSystem" 000d:trace:service:load_service_config Display name = L"SecDrv" 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) 000d:trace:service:scmdatabase_load_services Loading service L"Spooler" 000d:trace:service:load_service_config Image path = L"C:\windows\system32\spoolsv.exe" 000d:trace:service:load_service_config Group = L"SpoolerGroup" 000d:trace:service:load_service_config Service account name = L"LocalSystem" 000d:trace:service:load_service_config Display name = L"Print Spooler" 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) 000d:trace:service:scmdatabase_load_services Loading service L"VxD" 000d:trace:service:load_service_config Image path = (null) 000d:trace:service:load_service_config Group = (null) 000d:trace:service:load_service_config Service account name = (null) 000d:trace:service:load_service_config Display name = (null) 000d:trace:service:load_service_config Service dependencies : (none) 000d:trace:service:load_service_config Group dependencies : (none) --- snip ---
Quick fix:
--- snip ---
diff --git a/programs/services/services.c b/programs/services/services.c index 806fbb6..d48c985 100644 --- a/programs/services/services.c +++ b/programs/services/services.c @@ -341,7 +341,7 @@ struct service_entry *scmdatabase_find_service_by_displayname(struct scmdatabase
LIST_FOR_EACH_ENTRY(service, &db->services, struct service_entry, entry) { - if (strcmpiW(name, service->config.lpDisplayName) == 0) + if (service->config.lpDisplayName && strcmpiW(name, service->config.lpDisplayName) == 0) return service; }
--- snip ---
Hopefully it's not too late for 1.0 ;-|
Regards
http://bugs.winehq.org/show_bug.cgi?id=13958
Dan Kegel dank@kegel.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dank@kegel.com
--- Comment #1 from Dan Kegel dank@kegel.com 2008-06-16 14:55:48 --- Dude, you do love to cut it close to the wire!
I suspect this is in fact too late for 1.0, but that's ok, releases are like busses, another one will be along soon.
http://bugs.winehq.org/show_bug.cgi?id=13958
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Keywords| |patch
--- Comment #2 from Austin English austinenglish@gmail.com 2008-06-16 15:04:49 --- Confirming and adding patch keyword.
http://bugs.winehq.org/show_bug.cgi?id=13958
--- Comment #3 from Anastasius Focht focht@gmx.net 2008-06-16 15:08:42 --- Hello,
well I didn't had much time for wine project until recently. So this one just popped out minutes ago when I did some testing for PunkBuster.
Regards
http://bugs.winehq.org/show_bug.cgi?id=13958
Mikolaj Zalewski mikolaj.zalewski@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |mikolaj.zalewski@gmail.com
--- Comment #4 from Mikolaj Zalewski mikolaj.zalewski@gmail.com 2008-07-07 08:25:17 --- The patch http://www.winehq.org/pipermail/wine-patches/2008-July/057257.html should fix it.
http://bugs.winehq.org/show_bug.cgi?id=13958
--- Comment #5 from Austin English austinenglish@gmail.com 2009-01-05 11:19:02 --- Probably still present. Mikolaj, could you resubmit that patch/
http://bugs.winehq.org/show_bug.cgi?id=13958
--- Comment #6 from Mikolaj Zalewski mikolaj.zalewski@gmail.com 2009-01-06 01:27:42 --- This patch generated a comment from Alexandre: http://www.winehq.org/pipermail/wine-devel/2008-July/067159.html . I didn't understand it - the callers can't fix it because the NULL is not passed by them but is from the database loaded from the registry. I have tried to fix it from the other side by making sure service->name is not NULL (http://www.winehq.org/pipermail/wine-patches/2008-July/058571.html), but this also wasn't accepted. I haven't yet tried to find out why.
http://bugs.winehq.org/show_bug.cgi?id=13958
--- Comment #7 from Austin English austinenglish@gmail.com 2009-07-08 15:07:10 --- Is this still an issue in current (1.1.25 or newer) wine?
http://bugs.winehq.org/show_bug.cgi?id=13958
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #8 from Anastasius Focht focht@gmx.net 2009-07-09 14:22:28 --- Hello,
--- quote --- Is this still an issue in current (1.1.25 or newer) wine? --- quote ---
Issue was fixed by commit 8fd619618f37a5e0b08e1063f6f0f5c3945b2664 Gee, finally .. on services end ;-)
Regards
http://bugs.winehq.org/show_bug.cgi?id=13958
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org 2009-07-17 12:18:14 --- Closing bugs fixed in 1.1.26.
http://bugs.winehq.org/show_bug.cgi?id=13958
Anastasius Focht focht@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |8fd619618f37a5e0b08e1063f6f | |0f5c3945b2664
--- Comment #10 from Anastasius Focht focht@gmx.net 2011-10-11 14:51:00 CDT --- Hello,
filling/correcting fields ...
Regards