Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista Drivers > SetupDiGetClassDevs failed with error 13

Reply
Thread Tools Display Modes

SetupDiGetClassDevs failed with error 13

 
 
Gerryson
Guest
Posts: n/a

 
      06-18-2009
I use SetupDiGetClassDevs to retrieve how many usb devices are present , the
code is as follows:
//==================================================
DWORD dwFlag = DIGCF_ALLCLASSES | DIGCF_PRESENT;

HDEVINFO hDevInfo = SetupDiGetClassDevs(NULL, "USB", NULL, dwFlag);

if( hDevInfo == INVALID_HANDLE_VALUE )
{
WriteLog("Gerry:hDevInfo = INVALID_HANDLE_VALUE , Last Error:%d",
GetLastError());
return 0;
}
..
..
..
..
..

//=========================================
The code above runs ok when called from normal applications, but
when this code is called from winlogon.exe before any user log on,
SetupDiGetClassDevs failed with error code 13, I really don't know what's
the difference and why this happens, please any one tell me how to solve this.
 
Reply With Quote
 
 
 
 
Kerem Gümrükcü
Guest
Posts: n/a

 
      06-18-2009
Hi,

did you read the following line in the documentation:

"To return devices only for a specific device setup class,
do not set DIGCF_ALLCLASSES, and use ClassGuid to
supply the GUID of the device setup class."

"Do NOT set DIGCF_ALLCLASSES",...at first try it without
this Flag,...then we will see,...

I have something that possibly can aid you. Drop
me a few lines if you like. I wont write about it here
because it would look like house advertising, i dont
want that:




Regards

Kerem

--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."

"Gerryson" <> schrieb im Newsbeitrag
news:250D651A-8C97-4835-9BFF-...
> I use SetupDiGetClassDevs to retrieve how many usb devices are present ,
> the
> code is as follows:
> //==================================================
> DWORD dwFlag = DIGCF_ALLCLASSES | DIGCF_PRESENT;
>
> HDEVINFO hDevInfo = SetupDiGetClassDevs(NULL, "USB", NULL, dwFlag);
>
> if( hDevInfo == INVALID_HANDLE_VALUE )
> {
> WriteLog("Gerry:hDevInfo = INVALID_HANDLE_VALUE , Last Error:%d",
> GetLastError());
> return 0;
> }
> .
> .
> .
> .
> .
>
> //=========================================
> The code above runs ok when called from normal applications, but
> when this code is called from winlogon.exe before any user log on,
> SetupDiGetClassDevs failed with error code 13, I really don't know what's
> the difference and why this happens, please any one tell me how to solve
> this.


 
Reply With Quote
 
Mike [MSFT]
Guest
Posts: n/a

 
      06-24-2009

I don't think he's trying to get devices of a specific setup class. He's
not passing a class GUID. He's using the enumerator parameter to find
devices enumerated by USB.

I believe the reason you are getting the error is because you are calling
the API before the plug and plug service is available. You must wait until
the PnP service has been started before you can start querying devices.
Probably what you want to do is call the function in a loop until it
succeeds (with a timeout for safety).

-Mike

"Kerem Gümrükcü" <> wrote in message
news:#2VaiE$...
> Hi,
>
> did you read the following line in the documentation:
>
> "To return devices only for a specific device setup class,
> do not set DIGCF_ALLCLASSES, and use ClassGuid to
> supply the GUID of the device setup class."
>
> "Do NOT set DIGCF_ALLCLASSES",...at first try it without
> this Flag,...then we will see,...
>
> I have something that possibly can aid you. Drop
> me a few lines if you like. I wont write about it here
> because it would look like house advertising, i dont
> want that:
>
>
>
>
> Regards
>
> Kerem
>
> --
> --
> -----------------------
> Beste Grüsse / Best regards / Votre bien devoue
> Kerem Gümrükcü
> Latest Project: http://www.pro-it-education.de/software/deviceremover
> Latest Open-Source Projects: http://entwicklung.junetz.de
> -----------------------
> "This reply is provided as is, without warranty express or implied."
>
> "Gerryson" <> schrieb im Newsbeitrag
> news:250D651A-8C97-4835-9BFF-...
>> I use SetupDiGetClassDevs to retrieve how many usb devices are present ,
>> the
>> code is as follows:
>> //==================================================
>> DWORD dwFlag = DIGCF_ALLCLASSES | DIGCF_PRESENT;
>>
>> HDEVINFO hDevInfo = SetupDiGetClassDevs(NULL, "USB", NULL, dwFlag);
>>
>> if( hDevInfo == INVALID_HANDLE_VALUE )
>> {
>> WriteLog("Gerry:hDevInfo = INVALID_HANDLE_VALUE , Last Error:%d",
>> GetLastError());
>> return 0;
>> }
>> .
>> .
>> .
>> .
>> .
>>
>> //=========================================
>> The code above runs ok when called from normal applications, but
>> when this code is called from winlogon.exe before any user log on,
>> SetupDiGetClassDevs failed with error code 13, I really don't know
>> what's
>> the difference and why this happens, please any one tell me how to solve
>> this.

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invoking SetupDiGetClassDevs(...) sometimes fails with Kerem Gümrükcü Windows Vista Drivers 2 08-14-2008 10:54 AM
a problem about SetupDiGetClassDevs & SetupDiEnumDeviceInterfaces Walter Oney Windows Vista Drivers 3 10-06-2007 08:17 PM
SetupDiGetClassDevs csguy Windows Vista Drivers 5 01-16-2007 04:58 PM
Question about SetupDiGetClassDevs and SetupDiEnumDeviceInterfaces Andrea Windows Vista Drivers 8 07-26-2006 08:29 PM
SetupDiGetClassDevs ERROR_IO_PENDING Andy Dreistadt Windows Vista Drivers 1 06-04-2004 03:41 AM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59