[Bug 11420] service control manager API problem: name of named objects might differ (client vs. service process)

wine-bugs at winehq.org wine-bugs at winehq.org
Thu Feb 28 04:06:21 CST 2008


http://bugs.winehq.org/show_bug.cgi?id=11420





--- Comment #2 from Anastasius Focht <focht at gmx.net>  2008-02-28 04:06:21 ---
Hello,

--- quote ---
I would bet that name shows up in
"HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/mdm" under the value
"DisplayName"...
--- quote ---

Possible. But that knowledge won't help you anyway.
Consider the following snippet:

--- snip example ---
int main(..)
{
..
    SERVICE_TABLE_ENTRY serviceTable[] =
    {
        { "my service", (LPSERVICE_MAIN_FUNCTION) ServiceMain},
        { NULL, NULL}
    };

    ..
    StartServiceCtrlDispatcher(serviceTable);
..
}

int install_service( ..)
{
    ..
    HANDLE scm = OpenSCManager(NULL, NULL, SC_MANAGER_CREATE_SERVICE);
    if (scm)
    {
       HANDLE svc = CreateService( scm, "MyService", "My Service Display Name",
...);
       ..
    }
..
}
--- snip example ---

Now you have: 

1. service name "MyService" -> HKLM\SYSTEM\CurrentControlSet\Services\MyService
2. service (friendly) display name "My Service Display Name", under registry
key (1) ->  "DisplayName"="My Service Display Name"
3. service name in service process (compile/runtime) "my service" ->
SERVICE_TABLE_ENTRY -> StartServiceCtrlDispatcher ->
dlls/advapi32/service.c:service_control_dispatcher

No duplicate (1) and (2) are allowed with SCM.
For duplicates in (3) I'm not sure.

Console start:

net start MyService
net start "My Service Display Name"

--- quote ---
Are there any trial/demo links for this?
--- quote ---

Don't know, I'm using retail versions of VS.NET products.
But you can write a simple test case with the example snippet given to verify
this.

Regards


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
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