🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #266

SetupDiGetClassDevs and DIGCF_PRESENT

#266
From: JohnG
Date: Thu, 15 May 2008 15:45
28 lines
1710 bytes
Hi,

In sample code below SetupDiGetClassDevs always returns 
INVALID_HANDLE_VALUE. GetLastError() returns 87, which I 
believe is incorrect parameter. If I replace DIGCF_PRESENT  
with DIGCF_PRESENT | DIGCF_ALLCLASSES, the code works however 
when I enumerate the hardware I get much more then just the 
hardware that is currently in the system. Any ideas why I cant 
use only the DIGCF_PRESENT flag? I am trying to query only the 
hardware that is in the system.


HDEVINFO hDevInfo;
SP_DEVINFO_DATA DeviceInfoData;

// Create a HDEVINFO with all present devices.
hDevInfo = SetupDiGetClassDevs(NULL,
	                       NULL, 
               		       NULL,
		               DIGCF_PRESENT );

if (hDevInfo == INVALID_HANDLE_VALUE)
{
       OutputDebugString("INVALID_HANDLE_VALUE");

       return 0;
}
Technical Details
Message-ID: <482c5a83$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f5fa50a86f1465be,start
X-Google-Attributes: gid10cc67,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "JohnG" <whatis@email.com>
Sender: "JohnG" <whatis@email.com>
Reply-To: "JohnG" <whatis@email.com>
Subject: SetupDiGetClassDevs and DIGCF_PRESENT
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 138.11.0.153     
X-Forwarded-For: unknown
NNTP-Posting-Host: 207.105.83.66
Message-ID: <482c5a83$1@newsgroups.borland.com>
Date: 15 May 2008 08:45:07 -0700
X-Trace: newsgroups.borland.com 1210866307 207.105.83.66 (15 May 2008 08:45:07 -0700)
Lines: 28
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
X-Original-Bytes: 1527