Предмет:
Тип роботи:
Курсова робота
К-сть сторінок:
44
Мова:
Українська
0L,
(PBYTE)szName,
63,
0))
{
char *p = szName;
ShowDevPropertyInfo(hListView, "Ідентифікатор обладнання", 0L);
while (*p)
{
ShowDevPropertyInfo(hListView, 0L, p);
p = strchr(p, 0);
*p++;
};
};
if (SetupDiGetDeviceRegistryProperty(hDevInfo,
&spDevInfoData,
SPDRP_LOCATION_INFORMATION,
0L,
(PBYTE)szName,
63,
0))
{
ShowDevPropertyInfo(hListView, "Локальна інформація", szName);
};
if (SetupDiGetDeviceRegistryProperty(hDevInfo,
&spDevInfoData,
SPDRP_LOWERFILTERS,
0L,
(PBYTE)szName,
63,
0))
{
ShowDevPropertyInfo(hListView, "Lower Filter", szName);
};
if (SetupDiGetDeviceRegistryProperty(hDevInfo,
&spDevInfoData,
SPDRP_UPPERFILTERS,
0L,
(PBYTE)szName,
63,
0))
{
ShowDevPropertyInfo(hListView, "Upper Filter", szName);
};
if (SetupDiGetDeviceRegistryProperty(hDevInfo,
&spDevInfoData,
SPDRP_PHYSICAL_DEVICE_OBJECT_NAME,
0L,
(PBYTE)szName,
63,
0))
{
ShowDevPropertyInfo(hListView, "Фізичне імя обєкту пристрою", szName);
};
if (SetupDiGetDeviceRegistryProperty(hDevInfo,
&spDevInfoData,
SPDRP_SERVICE,
0L,
(PBYTE)szName,
63,
0))
{
char *p = szName;
ShowDevPropertyInfo(hListView, "Ім'я служби", 0L);
if (*p)
GetDriverName(GetDlgItem(_hDlg, nIDList1), szName);
while (*p)
{
ShowDevPropertyInfo(hListView, 0L, p);
p = strchr(p, 0);
*p++;
while (strchr(p, '\\'))
{
p = strchr(p, 0);
*p++;
};
};
};
};
void GetDriverName(HWND hListView, const char *szServiceName)
{
HKEY hKey = 0L;
char szSubKey[128] = {"SYSTEM\\CurrentControlSet\\Services\\\0"};
char szPath[MAX_PATH] = {0};
DWORD cbData;
DWORD dwType;
DWORD dwStart;
strcat(szSubKey, szServiceName);
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
szSubKey,
0,
KEY_ALL_ACCESS,
&hKey) != ERROR_SUCCESS)
{
ListViewInsertItemText(hListView, 9, 1, "N/A");
ListViewInsertItemText(hListView, 12, 1, "N/A");
ListViewInsertItemText(hListView, 13, 1, "N/A");
return;
};
cbData = MAX_PATH-1;
dwType = REG_EXPAND_SZ;
if (RegQueryValueEx(hKey, "ImagePath", 0L,
&dwType,(unsigned char*)szPath,
&cbData) != ERROR_SUCCESS)
ListViewInsertItemText(hListView, 9, 1, "N/A");
else
{
char szRoot[MAX_PATH] = {0};
GetWindowsDirectory(szRoot, MAX_PATH-1);
strcat(szRoot, "\\");
strcat(szRoot, szPath);
ListViewInsertItemText(hListView, 9, 1, szRoot);
};
RtlZeroMemory(szPath, MAX_PATH);
cbData = MAX_PATH-1;
dwType = REG_SZ;
if (RegQueryValueEx(hKey, "Group", 0L,
&dwType,
(unsigned char*)szPath,
&cbData) != ERROR_SUCCESS)
ListViewInsertItemText(hListView, 12, 1, "N/A");
else
ListViewInsertItemText(hListView, 12, 1, szPath);
dwStart = 0;
cbData = sizeof(DWORD);
dwType = REG_DWORD;
if (RegQueryValueEx(hKey, "Start", 0L,
&dwType,
(unsigned char*)&dwStart,
&cbData) != ERROR_SUCCESS)
ListViewInsertItemText(hListView, 13, 1, "N/A");
else
{
switch(dwStart)
{
case SERVICE_BOOT_START:
strcpy(szPath, "BOOT START");
break;
case SERVICE_SYSTEM_START:
strcpy(szPath, "SYSTEM START");
break;
case SERVICE_AUTO_START:
strcpy(szPath, "AUTO START");
break;
case SERVICE_DEMAND_START:
strcpy(szPath, "DEMAND START");
break;
case SERVICE_DISABLED:
strcpy(szPath, "DISABLED");
break;
};
ListViewInsertItemText(hListView, 13, 1, szPath);
};
RegCloseKey(hKey);
};