group registry gathering data together Modified: trunk/reactos/base/system/servman/propsheet.c Modified: trunk/reactos/base/system/servman/query.c Modified: trunk/reactos/base/system/servman/servman.h _____
Modified: trunk/reactos/base/system/servman/propsheet.c --- trunk/reactos/base/system/servman/propsheet.c 2006-02-03 19:18:17 UTC (rev 75) +++ trunk/reactos/base/system/servman/propsheet.c 2006-02-03 20:03:48 UTC (rev 76) @@ -70,13 +70,24 @@
* Fills the 'startup type' combo box with possible * values and sets it to value of the selected item */ -VOID SetStartupType(HKEY hKey) +VOID SetStartupType(LPTSTR lpServiceName) { HWND hList; + HKEY hKey; TCHAR buf[25]; DWORD dwValueSize = 0; DWORD StartUp = 0; + LPCTSTR Path = _T("System\CurrentControlSet\Services\%s"); + TCHAR KeyBuf[300];
+ /* open the registry key for the service */ + _sntprintf(KeyBuf, sizeof(KeyBuf) / sizeof(TCHAR), Path, lpServiceName); + RegOpenKeyEx(HKEY_LOCAL_MACHINE, + KeyBuf, + 0, + KEY_READ, + &hKey); + hList = GetDlgItem(hwndGenDlg, IDC_START_TYPE);
LoadString(hInstance, IDS_SERVICES_AUTO, buf, sizeof(buf) / sizeof(TCHAR)); @@ -114,23 +125,13 @@ */ VOID GetDlgInfo() { - HKEY hKey; ENUM_SERVICE_STATUS_PROCESS *Service = NULL; PROP_DLG_INFO DlgInfo; - LPCTSTR Path = _T("System\CurrentControlSet\Services\%s"); - TCHAR buf[300]; +
/* get pointer to selected service */ Service = GetSelectedService();
- /* open the registry key for the service */ - /* TODO: move all this into query (getdescription)*/ - _sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, Service->lpServiceName); - RegOpenKeyEx(HKEY_LOCAL_MACHINE, - buf, - 0, - KEY_READ, - &hKey);
/* set the service name */ DlgInfo.lpServiceName = Service->lpServiceName; @@ -145,7 +146,7 @@
/* set the description */ - if (GetDescription(hKey, &DlgInfo.lpDescription)) + if (GetDescription(Service->lpServiceName, &DlgInfo.lpDescription)) SendDlgItemMessage(hwndGenDlg, IDC_DESCRIPTION, WM_SETTEXT, 0, (LPARAM)DlgInfo.lpDescription);
@@ -156,10 +157,9 @@
/* set startup type */ - SetStartupType(hKey); + SetStartupType(Service->lpServiceName);
- /* set service status */ if (Service->ServiceStatusProcess.dwCurrentState == SERVICE_RUNNING) { @@ -174,13 +174,10 @@ SendDlgItemMessageW(hwndGenDlg, IDC_SERV_STATUS, WM_SETTEXT, 0, (LPARAM)DlgInfo.szServiceStatus); }
- - - - }
+ #ifdef _MSC_VER #pragma warning(disable : 4100) #endif _____
Modified: trunk/reactos/base/system/servman/query.c --- trunk/reactos/base/system/servman/query.c 2006-02-03 19:18:17 UTC (rev 75) +++ trunk/reactos/base/system/servman/query.c 2006-02-03 20:03:48 UTC (rev 76) @@ -61,17 +61,29 @@
}
/* Retrives the service description from the registry */ -BOOL GetDescription(HKEY hKey, LPTSTR *retDescription) +BOOL GetDescription(LPTSTR lpServiceName, LPTSTR *retDescription) { - + HKEY hKey; LPTSTR Description = NULL; DWORD dwValueSize = 0; - LONG ret = RegQueryValueEx(hKey, - _T("Description"), - NULL, - NULL, - NULL, - &dwValueSize); + LONG ret; + LPCTSTR Path = _T("System\CurrentControlSet\Services\%s"); + TCHAR buf[300]; + + /* open the registry key for the service */ + _sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, lpServiceName); + RegOpenKeyEx(HKEY_LOCAL_MACHINE, + buf, + 0, + KEY_READ, + &hKey); + + ret = RegQueryValueEx(hKey, + _T("Description"), + NULL, + NULL, + NULL, + &dwValueSize); if (ret != ERROR_SUCCESS && ret != ERROR_FILE_NOT_FOUND && ret != ERROR_INVALID_HANDLE) { RegCloseKey(hKey); @@ -254,10 +266,9 @@
- /* set the description */
- if (GetDescription(hKey, &Description)) + if (GetDescription(pServiceStatus[Index].lpServiceName, &Description)) { item.pszText = Description; item.iSubItem = 1; _____
Modified: trunk/reactos/base/system/servman/servman.h --- trunk/reactos/base/system/servman/servman.h 2006-02-03 19:18:17 UTC (rev 75) +++ trunk/reactos/base/system/servman/servman.h 2006-02-03 20:03:48 UTC (rev 76) @@ -32,7 +32,7 @@
VOID DisplayString(PTCHAR);
BOOL SetDescription(HKEY, LPTSTR *); -BOOL GetDescription(HKEY, LPTSTR *); +BOOL GetDescription(LPTSTR, LPTSTR *); BOOL GetExecutablePath(LPTSTR *);
LONG APIENTRY OpenPropSheet(HWND);