G
Guillaume Cormier
Guest
Hi,
We run the following code in order to retrieve the name of a specific Windows service. Under normal circumstance, the code works fine, but with Windows 2016, it does not work a reboot time. If I reboot the server, GetServiceDisplayNameW() returns "MyServiceName" into serviceDisplayName variable instead of the service "display name". To work around the problem, we have configure the service with "Delayed Start", but I am wondering if anyone has an idea of the problem.
Note: If we simply restart the service instead of rebooting the service, everything works fine.
Thanks!
SC_HANDLE hHandle;
wchar_t serviceDisplayName[256];
DWORD size = 0;
// Get from the installed service
hHandle = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hHandle)
{
if :GetServiceDisplayNameW(hHandle, "MyServiceName", serviceDisplayName, &size))
wprintf(L"Service Display Name. %s", serviceDisplayName);
}
else
{
wprintf(L"Last Error: %s", GetLastErrorAsString());
}
}
else
{
wprintf(L"Last Error: %s", GetLastErrorAsString());
}
Continue reading...
We run the following code in order to retrieve the name of a specific Windows service. Under normal circumstance, the code works fine, but with Windows 2016, it does not work a reboot time. If I reboot the server, GetServiceDisplayNameW() returns "MyServiceName" into serviceDisplayName variable instead of the service "display name". To work around the problem, we have configure the service with "Delayed Start", but I am wondering if anyone has an idea of the problem.
Note: If we simply restart the service instead of rebooting the service, everything works fine.
Thanks!
SC_HANDLE hHandle;
wchar_t serviceDisplayName[256];
DWORD size = 0;
// Get from the installed service
hHandle = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hHandle)
{
if :GetServiceDisplayNameW(hHandle, "MyServiceName", serviceDisplayName, &size))
wprintf(L"Service Display Name. %s", serviceDisplayName);
}
else
{
wprintf(L"Last Error: %s", GetLastErrorAsString());
}
}
else
{
wprintf(L"Last Error: %s", GetLastErrorAsString());
}
Continue reading...