Fix OpenService buffer for building with narrow char type
This commit is contained in:
parent
0d8bc9d7e2
commit
a76ae31126
|
@ -1258,15 +1258,8 @@ bool MainWindow::isServiceRunning(QString name)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_HANDLE hService;
|
auto array = name.toLocal8Bit();
|
||||||
int length = name.length();
|
SC_HANDLE hService = OpenService(hSCManager, array.data(), SERVICE_QUERY_STATUS);
|
||||||
wchar_t* array = new wchar_t[length + 1];
|
|
||||||
name.toWCharArray(array);
|
|
||||||
array[length] = '\0';
|
|
||||||
|
|
||||||
hService = OpenService(hSCManager, array, SERVICE_QUERY_STATUS);
|
|
||||||
|
|
||||||
delete[] array;
|
|
||||||
|
|
||||||
if (hService == NULL) {
|
if (hService == NULL) {
|
||||||
appendLogDebug("failed to open service: " + name);
|
appendLogDebug("failed to open service: " + name);
|
||||||
|
|
Loading…
Reference in New Issue