dynamically install/uninstall filter driver for USB device

Hello All,

Currently, I am writing a application to dynamically install/uninstall my
lower filter driver to USB device. The methods I am using to install and
load filter driver is as follows:
(1) Add the LowerFilters registry value to the devnode registry;
(2) Stop and restart device with the following statements:

SP_PROPCHANGE_PARAMS params;
SP_DEVINSTALL_PARAMS installParams;
memset(&params, 0, sizeof(SP_PROPCHANGE_PARAMS));
params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
params.StateChange = DICS_PROPCHANGE;
params.Scope = DICS_FLAG_CONFIGSPECIFIC;
params.HwProfile = 0; // current profile

// prepare for the call to SetupDiCallClassInstaller
if (!SetupDiSetClassInstallParams( DeviceInfoSet,
DeviceInfoData,
(PSP_CLASSINSTALL_HEADER) &params,
sizeof(SP_PROPCHANGE_PARAMS)
))
{
dwError = GetLastError();
return (FALSE); // Couldn’t set the install parameters!
}

// stop and restart the device
if (!SetupDiCallClassInstaller( DIF_PROPERTYCHANGE,
DeviceInfoSet,
DeviceInfoData
))

{
dwError = GetLastError();
return (FALSE); // Call to class installer (DICS_PROPCHANGE)
failed!
}

My current problem is that the above method works fine in Win2k, but in
Win98/Me, after successfully return from calling to
SetupDiCallClassInstaller(), it will need to wait a long time (over 20
seconds) before the device takes effective. BTW, if at this point I call a
MessageBox to pop up a message box, then the device will take effective
immediately. I cannot imagine what is the reason. Could anyone help me
explain what is the reason and what is wrong in my method.

I have also tried to call SetupDiCallClassInstaller two times first with
parameter DICS_STOP and second with DICS_RESTART. It works fine in Win2k,
but failed in Win98/Me.

I have tested the USBVerify (provided in NTDDK), it can work in both Win2k
and Win98/Me and the time to install filter driver in Win98/Me is much
shorter than that what I did in my application.

Could anyone give me in detail how USBVerify works to install filter driver
in Win98/Me? I don’t know if it is possible to provide me some source codes
to illustrate the detailed procedures.

I will appreciate your BIG help!

Best Regards,
snzhai


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

The installer code for Win 98/Me uses 16-bit code. You have to use
setupx.lib functions. You have to read up on the proper function calls in
the Win 98 DDK documentation. You have to use the 16-bit compiler VC++
version 1.52. There is 16-bit version of cl.exe in the XP ddk.

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

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@hotmail.com
Sent: Thursday, August 16, 2001 6:33 AM
To: NT Developers Interest List
Subject: [ntdev] dynamically install/uninstall filter driver for USB
device

Hello All,

Currently, I am writing a application to dynamically install/uninstall my
lower filter driver to USB device. The methods I am using to install and
load filter driver is as follows:
(1) Add the LowerFilters registry value to the devnode registry;
(2) Stop and restart device with the following statements:

SP_PROPCHANGE_PARAMS params;
SP_DEVINSTALL_PARAMS installParams;
memset(&params, 0, sizeof(SP_PROPCHANGE_PARAMS));
params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
params.StateChange = DICS_PROPCHANGE;
params.Scope = DICS_FLAG_CONFIGSPECIFIC;
params.HwProfile = 0; // current profile

// prepare for the call to SetupDiCallClassInstaller
if (!SetupDiSetClassInstallParams( DeviceInfoSet,
DeviceInfoData,
(PSP_CLASSINSTALL_HEADER) &params,
sizeof(SP_PROPCHANGE_PARAMS)
))
{
dwError = GetLastError();
return (FALSE); // Couldn’t set the install parameters!
}

// stop and restart the device
if (!SetupDiCallClassInstaller( DIF_PROPERTYCHANGE,
DeviceInfoSet,
DeviceInfoData
))

{
dwError = GetLastError();
return (FALSE); // Call to class installer (DICS_PROPCHANGE)
failed!
}

My current problem is that the above method works fine in Win2k, but in
Win98/Me, after successfully return from calling to
SetupDiCallClassInstaller(), it will need to wait a long time (over 20
seconds) before the device takes effective. BTW, if at this point I call a
MessageBox to pop up a message box, then the device will take effective
immediately. I cannot imagine what is the reason. Could anyone help me
explain what is the reason and what is wrong in my method.

I have also tried to call SetupDiCallClassInstaller two times first with
parameter DICS_STOP and second with DICS_RESTART. It works fine in Win2k,
but failed in Win98/Me.

I have tested the USBVerify (provided in NTDDK), it can work in both Win2k
and Win98/Me and the time to install filter driver in Win98/Me is much
shorter than that what I did in my application.

Could anyone give me in detail how USBVerify works to install filter driver
in Win98/Me? I don’t know if it is possible to provide me some source codes
to illustrate the detailed procedures.

I will appreciate your BIG help!

Best Regards,
snzhai


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

Hi, Joe,

Thanks for your help. I do find some functions from setupx.h and 98DDK
today. I will try to use them to see if my problem can be solved.

But, I only have VC++ 6.0 so far. Before I continue my programming, could
you tell me if I can build my application with setupx.lib in VC++ 6.0? If
not, do you know if SetupDiXXX APIs, which are supported by NTDDK, can
still be compiled in VC++ version 1.52, because I need my application to
support Win2k and right now it works fine in Win2k.

Thank you in advance for your further help!

Regards,
snzhai

On 08/16/01, ““Joe McCloskey” ” wrote:
> The installer code for Win 98/Me uses 16-bit code. You have to use
> setupx.lib functions. You have to read up on the proper function calls in
> the Win 98 DDK documentation. You have to use the 16-bit compiler VC++
> version 1.52. There is 16-bit version of cl.exe in the XP ddk.
>
> Joe McCloskey
> Gamry Instruments, Inc.
> xxxxx@gamry.com
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@hotmail.com
> Sent: Thursday, August 16, 2001 6:33 AM
> To: NT Developers Interest List
> Subject: [ntdev] dynamically install/uninstall filter driver for USB
> device
>
>
>
> Hello All,
>
> Currently, I am writing a application to dynamically install/uninstall my
> lower filter driver to USB device. The methods I am using to install and
> load filter driver is as follows:
> (1) Add the LowerFilters registry value to the devnode registry;
> (2) Stop and restart device with the following statements:
>
> SP_PROPCHANGE_PARAMS params;
> SP_DEVINSTALL_PARAMS installParams;
> memset(&params, 0, sizeof(SP_PROPCHANGE_PARAMS));
> params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
> params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
> params.StateChange = DICS_PROPCHANGE;
> params.Scope = DICS_FLAG_CONFIGSPECIFIC;
> params.HwProfile = 0; // current profile
>
> // prepare for the call to SetupDiCallClassInstaller
> if (!SetupDiSetClassInstallParams( DeviceInfoSet,
> DeviceInfoData,
> (PSP_CLASSINSTALL_HEADER) &params,
> sizeof(SP_PROPCHANGE_PARAMS)
> ))
> {
> dwError = GetLastError();
> return (FALSE); // Couldn’t set the install parameters!
> }
>
> // stop and restart the device
> if (!SetupDiCallClassInstaller( DIF_PROPERTYCHANGE,
> DeviceInfoSet,
> DeviceInfoData
> ))
>
> {
> dwError = GetLastError();
> return (FALSE); // Call to class installer (DICS_PROPCHANGE)
> failed!
> }
>
> My current problem is that the above method works fine in Win2k, but in
> Win98/Me, after successfully return from calling to
> SetupDiCallClassInstaller(), it will need to wait a long time (over 20
> seconds) before the device takes effective. BTW, if at this point I call a
> MessageBox to pop up a message box, then the device will take effective
> immediately. I cannot imagine what is the reason. Could anyone help me
> explain what is the reason and what is wrong in my method.
>
> I have also tried to call SetupDiCallClassInstaller two times first with
> parameter DICS_STOP and second with DICS_RESTART. It works fine in Win2k,
> but failed in Win98/Me.
>
> I have tested the USBVerify (provided in NTDDK), it can work in both Win2k
> and Win98/Me and the time to install filter driver in Win98/Me is much
> shorter than that what I did in my application.
>
> Could anyone give me in detail how USBVerify works to install filter driver
> in Win98/Me? I don’t know if it is possible to provide me some source codes
> to illustrate the detailed procedures.
>
> I will appreciate your BIG help!
>
> Best Regards,
> snzhai
>
> —
> 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


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

I got this message before from another developer:

it can be found in Visual C version 1.52c on the Platform Archive CD #3
labeled 16-bit DDKs. The
compiler by itself (without the entire VC IDE) is shipped as part of the
new unified Windows XP DDK in the Bin\Win_Me folder as CL.EXE version
8.00x.

You may at least already have the command line compiler. It was helpful to
have the IDE because the 16-bit setup code users actual data structures,
instead of handles. The use of data structures help in figuring out what
was happening with the system.

As for using VC 6.0, You can allways use a custom build by adding the file
to a project. Highlight and right mouse click the file. Select “Settings”.
On the general tab select “Allways use Custom step”. Change the settings to
custom step tab page. I used the VC++ 1.52 ide it was less of a hasle. . .
.

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

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@hotmail.com
Sent: Friday, August 17, 2001 5:18 AM
To: NT Developers Interest List
Subject: [ntdev] RE: dynamically install/uninstall filter driver for USB
device

Hi, Joe,

Thanks for your help. I do find some functions from setupx.h and 98DDK
today. I will try to use them to see if my problem can be solved.

But, I only have VC++ 6.0 so far. Before I continue my programming, could
you tell me if I can build my application with setupx.lib in VC++ 6.0? If
not, do you know if SetupDiXXX APIs, which are supported by NTDDK, can
still be compiled in VC++ version 1.52, because I need my application to
support Win2k and right now it works fine in Win2k.

Thank you in advance for your further help!

Regards,
snzhai

On 08/16/01, ““Joe McCloskey” ” wrote:
> The installer code for Win 98/Me uses 16-bit code. You have to use
> setupx.lib functions. You have to read up on the proper function calls
in
> the Win 98 DDK documentation. You have to use the 16-bit compiler VC++
> version 1.52. There is 16-bit version of cl.exe in the XP ddk.
>
> Joe McCloskey
> Gamry Instruments, Inc.
> xxxxx@gamry.com
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of xxxxx@hotmail.com
> Sent: Thursday, August 16, 2001 6:33 AM
> To: NT Developers Interest List
> Subject: [ntdev] dynamically install/uninstall filter driver for USB
> device
>
>
>
> Hello All,
>
> Currently, I am writing a application to dynamically install/uninstall my
> lower filter driver to USB device. The methods I am using to install and
> load filter driver is as follows:
> (1) Add the LowerFilters registry value to the devnode registry;
> (2) Stop and restart device with the following statements:
>
> SP_PROPCHANGE_PARAMS params;
> SP_DEVINSTALL_PARAMS installParams;
> memset(&params, 0, sizeof(SP_PROPCHANGE_PARAMS));
> params.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
> params.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
> params.StateChange = DICS_PROPCHANGE;
> params.Scope = DICS_FLAG_CONFIGSPECIFIC;
> params.HwProfile = 0; // current profile
>
> // prepare for the call to SetupDiCallClassInstaller
> if (!SetupDiSetClassInstallParams( DeviceInfoSet,
> DeviceInfoData,
> (PSP_CLASSINSTALL_HEADER) &params,
> sizeof(SP_PROPCHANGE_PARAMS)
> ))
> {
> dwError = GetLastError();
> return (FALSE); // Couldn’t set the install parameters!
> }
>
> // stop and restart the device
> if (!SetupDiCallClassInstaller( DIF_PROPERTYCHANGE,
> DeviceInfoSet,
> DeviceInfoData
> ))
>
> {
> dwError = GetLastError();
> return (FALSE); // Call to class installer (DICS_PROPCHANGE)
> failed!
> }
>
> My current problem is that the above method works fine in Win2k, but in
> Win98/Me, after successfully return from calling to
> SetupDiCallClassInstaller(), it will need to wait a long time (over 20
> seconds) before the device takes effective. BTW, if at this point I call a
> MessageBox to pop up a message box, then the device will take effective
> immediately. I cannot imagine what is the reason. Could anyone help me
> explain what is the reason and what is wrong in my method.
>
> I have also tried to call SetupDiCallClassInstaller two times first with
> parameter DICS_STOP and second with DICS_RESTART. It works fine in Win2k,
> but failed in Win98/Me.
>
> I have tested the USBVerify (provided in NTDDK), it can work in both Win2k
> and Win98/Me and the time to install filter driver in Win98/Me is much
> shorter than that what I did in my application.
>
> Could anyone give me in detail how USBVerify works to install filter
driver
> in Win98/Me? I don’t know if it is possible to provide me some source
codes
> to illustrate the detailed procedures.
>
> I will appreciate your BIG help!
>
> Best Regards,
> snzhai
>
> —
> 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: 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: 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