|
-
September 30th, 2003, 01:18 AM
#1
details of installed devices
hi
it will be very helpful to me if anyone tells me a way to find out the details of the installed devices in a system like display adapters, network adapters, keyboard, mouse, monitor etc., through code, which in general we see in the 'device manager'.
thanking u in adance
-
September 30th, 2003, 01:39 AM
#2
attached is a DDK sample project, run the enable.exe and you'll see how to enumerate the devices, or look at the code, it should point you in the right direction.
-
September 30th, 2003, 05:04 AM
#3
hi
i downloaded the file. the exe found in it is working fine. but i do not know how to execute the source code provided. i tried it by including them in a win32 application project. but it gives so many errors in CFGMGR32.h.
plz tell me what to do?
-
September 30th, 2003, 09:40 AM
#4
Originally posted by shobaradha
hi
i downloaded the file. the exe found in it is working fine. but i do not know how to execute the source code provided. i tried it by including them in a win32 application project. but it gives so many errors in CFGMGR32.h.
plz tell me what to do?
That is because it comes from the DDK (Driver Device Kit) which I'm sure you don't have installed. You have to take what is given and translate it into a VC++ IDE project, that was what I meant by getting you a start in the right direction.
But, look at the .c files, look how it uses SetupDiOpenClassRegKey(...) etc, those calls can be found in the platform SDK, via the setupapi.h, remove the CM_get_devnode_status, which is where the CFGMGR32.h (DDK header) comes into play, those calls are depreciated anyways.
-
October 2nd, 2003, 03:09 AM
#5
Try QueryDosDevice. The description of it implies it only works for DOS, but it works for most NT/2000/XP device drivers too. It might not work for what you need but it might.
-
December 11th, 2003, 07:04 AM
#6
help!!
Well i tried using ConstructDevice and GetRegisterProperty but i got an error in GetRegisterProperty on parameter 5 saying
SetupDiGetDeviceRegistryPropertyA' : cannot convert parameter 5 from 'void *' to 'unsigned char *'
Help....any alternate function would also be helpful
BOOL GetRegistryProperty(HDEVINFO DeviceInfoSet,
PSP_DEVINFO_DATA DeviceInfoData,
ULONG Property,
PVOID Buffer,
PULONG Length)
{
while (!SetupDiGetDeviceRegistryProperty(DeviceInfoSet,
DeviceInfoData,
Property,
NULL,
(PVOID)*(TCHAR **)Buffer,
*Length,
Length
))
{
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
//
// We need to change the buffer size.
//
if (*(LPTSTR *)Buffer)
LocalFree(*(LPTSTR *)Buffer);
*(LPTSTR *)Buffer = LocalAlloc(LPTR,*Length);
}
else
{
//
// Unknown Failure.
//
if (GetLastError() != ERROR_INVALID_DATA)
DisplayError(TEXT("GetDeviceRegistryProperty"));
return FALSE;
}
}
return (*(LPTSTR *)Buffer)[0];
}
#define UnknownDevice TEXT("<Unknown Device>")
BOOL ConstructDeviceName( HDEVINFO DeviceInfoSet,
PSP_DEVINFO_DATA DeviceInfoData,
PVOID Buffer,
PULONG Length)
{
if (!GetRegistryProperty(DeviceInfoSet,
DeviceInfoData,
SPDRP_FRIENDLYNAME ,
Buffer,
Length))
{
if (!GetRegistryProperty(DeviceInfoSet,
DeviceInfoData,
SPDRP_DEVICEDESC ,
Buffer,
Length))
{
if (!GetRegistryProperty(DeviceInfoSet,
DeviceInfoData,
SPDRP_CLASS ,
Buffer,
Length))
{
if (!GetRegistryProperty(DeviceInfoSet,
DeviceInfoData,
SPDRP_CLASSGUID ,
Buffer,
Length))
{
*Length = (_tcslen(UnknownDevice)+1)*sizeof(TCHAR);
*(LPTSTR *)Buffer = LocalAlloc(LPTR,*Length);
_tcscpy(*(LPTSTR *)Buffer,UnknownDevice);
}
}
}
}
return TRUE;
}
Ritwik Samsi
-
August 9th, 2008, 01:06 AM
#7
Re: details of installed devices
 Originally Posted by Mick
attached is a DDK sample project, run the enable.exe and you'll see how to enumerate the devices, or look at the code, it should point you in the right direction.
Hi all
How can i download and attached DDk sample project,run the enable.exe.
-
August 9th, 2008, 01:40 AM
#8
Re: details of installed devices
you can find a open source library, it will save your lots of time.
-
March 17th, 2009, 04:08 AM
#9
Re: details of installed devices
Hi guys,
sorry I am new here - maybe my question is stupid,
but i cannot find the DDK sample project.
Where can I download it?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|