Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 139 of file query.c.
Referenced by ChangeListViewText(), DeleteDialogProc(), and InitGeneralPage().
{ SC_HANDLE hSCManager = NULL; SC_HANDLE hSc = NULL; SERVICE_DESCRIPTION *pServiceDescription = NULL; LPTSTR lpDescription = NULL; DWORD BytesNeeded = 0; DWORD dwSize; hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE); if (hSCManager == NULL) { GetError(); return NULL; } hSc = OpenService(hSCManager, lpServiceName, SERVICE_QUERY_CONFIG); if (hSc) { if (!QueryServiceConfig2(hSc, SERVICE_CONFIG_DESCRIPTION, NULL, 0, &BytesNeeded)) { if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { pServiceDescription = (SERVICE_DESCRIPTION *) HeapAlloc(ProcessHeap, 0, BytesNeeded); if (pServiceDescription == NULL) goto cleanup; if (QueryServiceConfig2(hSc, SERVICE_CONFIG_DESCRIPTION, (LPBYTE)pServiceDescription, BytesNeeded, &BytesNeeded)) { if (pServiceDescription->lpDescription) { dwSize = _tcslen(pServiceDescription->lpDescription) + 1; lpDescription = HeapAlloc(ProcessHeap, 0, dwSize * sizeof(TCHAR)); if (lpDescription) { _tcscpy_s(lpDescription, dwSize, pServiceDescription->lpDescription); } } } } } } cleanup: if (pServiceDescription) HeapFree(ProcessHeap, 0, pServiceDescription); if (hSCManager != NULL) CloseServiceHandle(hSCManager); if (hSc != NULL) CloseServiceHandle(hSc); return lpDescription; }