Help me!About SetupDiGetClassInstallParams...

ntdevHi,All:
I’ve a problem with SetupDiXXX API function on Windows 98(SE).When I call SetupDiGetClassInstallParams(…) it return error code:0x57(Invalid parameters…) Please see the source code blow:

void TestDrvInstall()
{
HDEVINFO hDevInfo;
GUID guid;
BOOL bSuccess;
char szClassName[MAX_PATH];
DWORD dwRequireSize = 0;
SP_DEVINFO_DATA sp_devinfo;
SP_CLASSINSTALL_HEADER sp_ClassInstall;

sp_ClassInstall.cbSize = sizeof(sp_ClassInstall);

bSuccess = SetupDiGetINFClass(
“C:\WINDOWS\Desktop\crasher\Driver\crasher.inf”,
&guid,
szClassName,
sizeof(szClassName),
&dwRequireSize
);
if(!bSuccess)
{
AfxMessageBox(“Get Inf class failed!”);
return ;
}

hDevInfo = SetupDiGetClassDevs(&guid,NULL,NULL,DIGCF_PRESENT);

if( INVALID_HANDLE_VALUE == hDevInfo )
{
AfxMessageBox(“SetupDiGetClassDevs failed!”);
return ;
}

sp_devinfo.cbSize = sizeof(sp_devinfo);
sp_devinfo.ClassGuid = guid;

> //******>> This call return error: Parameter invalid…why?

bSuccess = SetupDiGetClassInstallParams(
hDevInfo,
&sp_devinfo,
&sp_ClassInstall,
sizeof(sp_ClassInstall),
&dwRequireSize
);
if(!bSuccess)
{
AfxMessageBox(“Get install parameters failed!”);
return;
}

bSuccess = SetupDiCreateDeviceInfo(
hDevInfo,
“Crasher\0000”,
&guid,
“Crasher new SCSI Adapter”,
NULL,
DICD_INHERIT_CLASSDRVS,
&sp_devinfo
);
if(!bSuccess)
{
AfxMessageBox(“Create Device info failed!”);
return ;
}
}

Thank you in advance!

Regards!

Crasher
guodongzi@163.net


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi,
This is because the “sp_devinfo” is uninitialised
and this is be filled only in the
SetupDiCreateDeviceInfo() function. Try passing NULL
since this is optional

Cheers,
Jay

— Crasher wrote:
> ntdevHi,All:
> I’ve a problem with SetupDiXXX API function on
> Windows 98(SE).When I call
> SetupDiGetClassInstallParams(…) it return error
> code:0x57(Invalid parameters…) Please see the
> source code blow:
>
> void TestDrvInstall()
> {
> HDEVINFO hDevInfo;
> GUID guid;
> BOOL bSuccess;
> char szClassName[MAX_PATH];
> DWORD dwRequireSize = 0;
> SP_DEVINFO_DATA sp_devinfo;
> SP_CLASSINSTALL_HEADER sp_ClassInstall;
>
> sp_ClassInstall.cbSize = sizeof(sp_ClassInstall);
>
> bSuccess = SetupDiGetINFClass(
>
>
“C:\WINDOWS\Desktop\crasher\Driver\crasher.inf”,
> &guid,
> szClassName,
> sizeof(szClassName),
> &dwRequireSize
> );
> if(!bSuccess)
> {
> AfxMessageBox(“Get Inf class failed!”);
> return ;
> }
>
> hDevInfo =
> SetupDiGetClassDevs(&guid,NULL,NULL,DIGCF_PRESENT);
>
> if( INVALID_HANDLE_VALUE == hDevInfo )
> {
> AfxMessageBox(“SetupDiGetClassDevs failed!”);
> return ;
> }
>
> sp_devinfo.cbSize = sizeof(sp_devinfo);
> sp_devinfo.ClassGuid = guid;
>
>
> >> // ****** >> This call return error: Parameter
> invalid…why?
>
> bSuccess = SetupDiGetClassInstallParams(
> hDevInfo,
> &sp_devinfo,
> &sp_ClassInstall,
> sizeof(sp_ClassInstall),
> &dwRequireSize
> );
> if(!bSuccess)
> {
> AfxMessageBox(“Get install parameters failed!”);
> return;
> }
>
>
> bSuccess = SetupDiCreateDeviceInfo(
> hDevInfo,
> “Crasher\0000”,
> &guid,
> “Crasher new SCSI Adapter”,
> NULL,
> DICD_INHERIT_CLASSDRVS,
> &sp_devinfo
> );
> if(!bSuccess)
> {
> AfxMessageBox(“Create Device info failed!”);
> return ;
> }
> }
>
> Thank you in advance!
>
> Regards!
>
> Crasher
> guodongzi@163.net
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Your problem is that you are using the wrong setup library. For windows
9x systems you have to use the 16-bit library call setupx.lib. The
function you need is “DiCreateDeviceInfo” (see 98 ddk documentation for more
information). Also, your code has to be 16-bit code, i.e. you have to
user VC++ version 1.52, or cl.exe, or from the XP DDK disk in win_me
directory.

Joe McCloskey
Gamry Instruments, Inc.
xxxxx@gamry.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of jayadev m n
Sent: Monday, October 15, 2001 9:32 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Help me!About SetupDiGetClassInstallParams…

Hi,
This is because the “sp_devinfo” is uninitialised
and this is be filled only in the
SetupDiCreateDeviceInfo() function. Try passing NULL
since this is optional

Cheers,
Jay

— Crasher wrote:
> ntdevHi,All:
> I’ve a problem with SetupDiXXX API function on
> Windows 98(SE).When I call
> SetupDiGetClassInstallParams(…) it return error
> code:0x57(Invalid parameters…) Please see the
> source code blow:
>
> void TestDrvInstall()
>

> HDEVINFO hDevInfo;
> GUID guid;
> BOOL bSuccess;
> char szClassName[MAX_PATH];
> DWORD dwRequireSize = 0;
> SP_DEVINFO_DATA sp_devinfo;
> SP_CLASSINSTALL_HEADER sp_ClassInstall;
>
> sp_ClassInstall.cbSize = sizeof(sp_ClassInstall);
>
> bSuccess = SetupDiGetINFClass(
>
>
“C:\WINDOWS\Desktop\crasher\Driver\crasher.inf”,
> &guid,
> szClassName,
> sizeof(szClassName),
> &dwRequireSize
> );
> if(!bSuccess)
> {
> AfxMessageBox(“Get Inf class failed!”);
> return ;
> }
>
> hDevInfo =
> SetupDiGetClassDevs(&guid,NULL,NULL,DIGCF_PRESENT);
>
> if( INVALID_HANDLE_VALUE == hDevInfo )
> {
> AfxMessageBox(“SetupDiGetClassDevs failed!”);
> return ;
> }
>
> sp_devinfo.cbSize = sizeof(sp_devinfo);
> sp_devinfo.ClassGuid = guid;
>
>
> >> // ****** >> This call return error: Parameter
> invalid…why?
>
> bSuccess = SetupDiGetClassInstallParams(
> hDevInfo,
> &sp_devinfo,
> &sp_ClassInstall,
> sizeof(sp_ClassInstall),
> &dwRequireSize
> );
> if(!bSuccess)
> {
> AfxMessageBox(“Get install parameters failed!”);
> return;
> }
>
>
> bSuccess = SetupDiCreateDeviceInfo(
> hDevInfo,
> “Crasher\0000”,
> &guid,
> “Crasher new SCSI Adapter”,
> NULL,
> DICD_INHERIT_CLASSDRVS,
> &sp_devinfo
> );
> if(!bSuccess)
> {
> AfxMessageBox(“Create Device info failed!”);
> return ;
> }
> }
>
> Thank you in advance!
>
> Regards!
>
> Crasher
> guodongzi@163.net
>
>
> —
> You are currently subscribed to ntdev as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com


You are currently subscribed to ntdev as: xxxxx@gamry.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com