Questions about device naming

Hi

i’ve some question about device naming.
First of all i describe the situation. I’m developing a driver for a usb device and i’ve completed it without problems. In the EvtDriverDeviceAdd function, after the WdfDeviceCreate, i call the WdfDeviceCreateDeviceInterface routine with a device interface created by GUID generator tool. By this way i rename the device using that interface (in the .inf file, in the ClassGUID property, i use this GUID: {36FC9E60-C465-11CF-8056-444553540000}, is correct?).

But now come the real questions…

  1. When I plug the device i use Winobj to see the instance of the device, and i expect to see something like this:

USB#Vid_abcd&Pid_abcd#xxxxxxxxxxx#{CustomGuid} SymLink: \Device\USBPDO-4

But what i see is:

USB#Vid_abcd&Pid_abcd#xxxxxxxxxxx#{CustomGuid} SymLink: \Device\USBPDO-4
USB#Vid_abcd&Pid_abcd#xxxxxxxxxxx#{A5DCBF10-6530-11D2-901F-00C04FB951ED}
SymLink: \Device\USBPDO-4

What is the meaning of the second row?

2)In a user mode application i must handle more usb device at the same time, so there can be multiple devices connected to the system at the same time. How can i handle this situation using the same interface?
It’s a correct solution or should i use WdfDeviceCreateSymbolicLink?

> USB#Vid_abcd&Pid_abcd#xxxxxxxxxxx#{CustomGuid} SymLink: \Device\USBPDO-4

USB#Vid_abcd&Pid_abcd#xxxxxxxxxxx#{A5DCBF10-6530-11D2-901F-00C04FB951ED}
SymLink: \Device\USBPDO-4

What is the meaning of the second row?

Some standard device interface assigned to the same devnode by some other driver in the stack.

It’s a correct solution or should i use WdfDeviceCreateSymbolicLink?

Yes, correct. In the app, use SetupDiGetClassDevs to enumerate all devices with your interface on the machine.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Thanks, but when i plug in to the system two device the device manager gives me this error:

Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory. (Code 38)

Then i thought to rename the devices with different name with this code:

WCHAR DevNameWCHAR[15];
LONG CurrentIndex = InterlockedIncrement(&GeneralIndex);
UNICODE_STRING DevName;
snwprintf(DevNameWCHAR,array_size(DevNameWCHAR),L"DeviceNumber%d",GeneralIndex);
RtlInitUnicodeString(&DevName,DevNameWCHAR);

WdfDeviceCreateDeviceInterface(device, &GUID_MYDEVINTERFACE, &DevName);

But i get the same error.
What should i do?

xxxxx@libero.it wrote:

Thanks, but when i plug in to the system two device the device manager gives me this error:

Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory. (Code 38)

What kind of device is this? Are these USB devices? Do the devices
have serial numbers, and are the serial numbers different?

Then i thought to rename the devices with different name with this code:

WCHAR DevNameWCHAR[15];
LONG CurrentIndex = InterlockedIncrement(&GeneralIndex);
UNICODE_STRING DevName;
snwprintf(DevNameWCHAR,array_size(DevNameWCHAR),L"DeviceNumber%d",GeneralIndex);
RtlInitUnicodeString(&DevName,DevNameWCHAR);

How did you come up with that? Did you not see that device names are
supposed to be in the \Device\xxx namespace? Further, if you are using
device interfaces to find your device, you don’t need a device name at all.


WdfDeviceCreateDeviceInterface(device, &GUID_MYDEVINTERFACE, &DevName);

You don’t understand what that third parameter is for. Actually, almost
no one does. You should pass NULL.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

xxxxx@libero.it wrote:

Hi

i’ve some question about device naming.
First of all i describe the situation. I’m developing a driver for a usb device and i’ve completed it without problems. In the EvtDriverDeviceAdd function, after the WdfDeviceCreate, i call the WdfDeviceCreateDeviceInterface routine with a device interface created by GUID generator tool. By this way i rename the device using that interface (in the .inf file, in the ClassGUID property, i use this GUID: {36FC9E60-C465-11CF-8056-444553540000}, is correct?).

No. That’s Class=USB, which is meant for USB hubs and host
controllers. Your device should be placed in an install class that more
accurately describes your device. If your device doesn’t fall into any
of the standard classes (media, HID, image, etc), then just create your
own name and GUID. The ONLY purpose for the Class= and ClassGUID=
strings is to place the device in the Device Manager user interface.

But now come the real questions…

  1. When I plug the device i use Winobj to see the instance of the device, and i expect to see something like this:

USB#Vid_abcd&Pid_abcd#xxxxxxxxxxx#{CustomGuid} SymLink: \Device\USBPDO-4

But what i see is:

USB#Vid_abcd&Pid_abcd#xxxxxxxxxxx#{CustomGuid} SymLink: \Device\USBPDO-4
USB#Vid_abcd&Pid_abcd#xxxxxxxxxxx#{A5DCBF10-6530-11D2-901F-00C04FB951ED}
SymLink: \Device\USBPDO-4

What is the meaning of the second row?

Again, I grieve that this generation has lost the ability to use “grep”
or “findstr”.

C:\Dev>grep -i a5dcbf10 c:\DDK\7600\inc\api*.h
c:\DDK\7600\inc\api\usbiodef.h:/* A5DCBF10-6530-11D2-901F-00C04FB951ED */
c:\DDK\7600\inc\api\usbiodef.h:DEFINE_GUID(GUID_DEVINTERFACE_USB_DEVICE,
0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, \
C:\Dev>

This is your PDO, created by the hub driver. All such PDOs are assigned
to the GUID_DEVINTERFACE_USB_DEVICE device interface.

2)In a user mode application i must handle more usb device at the same time, so there can be multiple devices connected to the system at the same time. How can i handle this situation using the same interface?

This is EXACTLY the problem that device interfaces were designed to
handle. Any number of devices can expose the same device interface.
Your user-mode application enumerates through them and chooses one.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Code 38 means your driver failed to unload, not b/c of a naming conflict. Look at why your driver failed to unload.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@libero.it
Sent: Wednesday, August 03, 2011 8:01 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Questions about device naming

Thanks, but when i plug in to the system two device the device manager gives me this error:

Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory. (Code 38)

Then i thought to rename the devices with different name with this code:

WCHAR DevNameWCHAR[15];
LONG CurrentIndex = InterlockedIncrement(&GeneralIndex);
UNICODE_STRING DevName;
snwprintf(DevNameWCHAR,array_size(DevNameWCHAR),L"DeviceNumber%d",GeneralIndex);
RtlInitUnicodeString(&DevName,DevNameWCHAR);

WdfDeviceCreateDeviceInterface(device, &GUID_MYDEVINTERFACE, &DevName);

But i get the same error.
What should i do?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>You don’t understand what that third parameter is for. Actually, almost

no one does. You should pass NULL.

No. That’s Class=USB, which is meant for USB hubs and host
controllers. Your device should be placed in an install class that more
accurately describes your device. If your device doesn’t fall into any
of the standard classes (media, HID, image, etc), then just create your
own name and GUID. The ONLY purpose for the Class= and ClassGUID=
strings is to place the device in the Device Manager user interface.

Ok, now i pass NULL to the third parameter of WdfDeviceCreateDeviceInterface and i’ve also defined a new class for my devices. So now, when i plug in my usb device, i can see it in the new class (using Device Manager, obviously). But if i plug in another device i get the same error code 38.
Furthermore, the first device resides in the new class correctly, while the second resides in the Universal Serial Bus controllers class (in this appear the error 38).

xxxxx@libero.it wrote:

Ok, now i pass NULL to the third parameter of WdfDeviceCreateDeviceInterface and i’ve also defined a new class for my devices. So now, when i plug in my usb device, i can see it in the new class (using Device Manager, obviously). But if i plug in another device i get the same error code 38.
Furthermore, the first device resides in the new class correctly, while the second resides in the Universal Serial Bus controllers class (in this appear the error 38).

You never answered the question about serial numbers. Do your devices
have serial numbers? Are they different?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

You seem to also be confusing the device SETUP class GUID, with the device INTERFACE GUID. This is a common mistake. They are entirely separate things.

Several of my devices might belong to the device SETUP class GUID “OSR Machine Tools” – and thus appear under OSR Machine Tools in Device Manager. Each type of tool could have its own INTERFACE GUID, say GUID_INTERFACE_OSR_TOOL_LATHE for example.

Peter
OSR

Where, exactly, are you doing this “renaming”. You show a code snippet
entirely out of context and expect us to infer something about it. My
inference is that this is a piece of code from your AddDevice handler, right
before you create the symbolic link.

But the error from the kernel says that it was UNABLE to load the second
device because a previous instance of the driver is still in memory, and
this is not consistent with the way a device driver works; the whole purpose
of AddDevice is that the driver is *expected* to be in memory.

Now, if the driver is in memory, and this is the error, how is writing code
that assigns a symbolic name supposed to change anything? If the code is
executed once, a symbolic name is created, but the driver IS STILL IN MEMORY
(read the error message! It did NOT say “there is a conflict in symbolic
names” or something like that), and it refuses to load the driver a second
time, meaning the code you wrote will not be executed, so what is its
purpose? To make the driver manager feel good about your driver?

Now, it is certainly possible the error code issued was with an erroneous or
misleading text message (Horrors! Windows would do that???)

So I did a google of

windows cannot load device driver code 38

and got a HUGE number of hits, such as

http://support.microsoft.com/kb/310123
http://www.techtalkz.com/windows-help/85420-usb-composite-device-code-38-a.h
tml

And overall I got the impression that if your driver has failed to complete
an IRP, and cannot be unloaded, then the new version will not be able to
load. So that’s the first place I’d suggest looking. It took perhaps five
minutes to discover this.
joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@libero.it
Sent: Wednesday, August 03, 2011 11:01 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Questions about device naming

Thanks, but when i plug in to the system two device the device manager gives
me this error:

Windows cannot load the device driver for this hardware because a previous
instance of the device driver is still in memory. (Code 38)

Then i thought to rename the devices with different name with this code:

WCHAR DevNameWCHAR[15];
LONG CurrentIndex = InterlockedIncrement(&GeneralIndex);
UNICODE_STRING DevName;
snwprintf(DevNameWCHAR,array_size(DevNameWCHAR),L"DeviceNumber%d",GeneralI
ndex);
RtlInitUnicodeString(&DevName,DevNameWCHAR);

WdfDeviceCreateDeviceInterface(device, &GUID_MYDEVINTERFACE, &DevName);

But i get the same error.
What should i do?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

My research (using that obscure, practically unknown, search tool, google)
had revealed this, and even suggested it might be due to an uncompleted IRP.

What amazed me was someone would even *think* that executing code to create
a different name would make a difference when the code cannot be executed!
joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, August 03, 2011 1:52 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Questions about device naming

Code 38 means your driver failed to unload, not b/c of a naming conflict.
Look at why your driver failed to unload.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@libero.it
Sent: Wednesday, August 03, 2011 8:01 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Questions about device naming

Thanks, but when i plug in to the system two device the device manager gives
me this error:

Windows cannot load the device driver for this hardware because a previous
instance of the device driver is still in memory. (Code 38)

Then i thought to rename the devices with different name with this code:

WCHAR DevNameWCHAR[15];
LONG CurrentIndex = InterlockedIncrement(&GeneralIndex);
UNICODE_STRING DevName;
snwprintf(DevNameWCHAR,array_size(DevNameWCHAR),L"DeviceNumber%d",GeneralI
ndex);
RtlInitUnicodeString(&DevName,DevNameWCHAR);

WdfDeviceCreateDeviceInterface(device, &GUID_MYDEVINTERFACE, &DevName);

But i get the same error.
What should i do?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

A pended irp will not cause a code 38 in my experience. That will usually hang device uninstall. In my experience it is a leaked Ob reference on a device or driver object that prevents unload and gives a code 38 on reload

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Joseph M. Newcomer
Sent: Thursday, August 04, 2011 2:06 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Questions about device naming

My research (using that obscure, practically unknown, search tool, google) had revealed this, and even suggested it might be due to an uncompleted IRP.

What amazed me was someone would even *think* that executing code to create a different name would make a difference when the code cannot be executed!
joe

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Wednesday, August 03, 2011 1:52 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] Questions about device naming

Code 38 means your driver failed to unload, not b/c of a naming conflict.
Look at why your driver failed to unload.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@libero.it
Sent: Wednesday, August 03, 2011 8:01 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Questions about device naming

Thanks, but when i plug in to the system two device the device manager gives me this error:

Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory. (Code 38)

Then i thought to rename the devices with different name with this code:

WCHAR DevNameWCHAR[15];
LONG CurrentIndex = InterlockedIncrement(&GeneralIndex);
UNICODE_STRING DevName;
snwprintf(DevNameWCHAR,array_size(DevNameWCHAR),L"DeviceNumber%d",GeneralI
ndex);
RtlInitUnicodeString(&DevName,DevNameWCHAR);

WdfDeviceCreateDeviceInterface(device, &GUID_MYDEVINTERFACE, &DevName);

But i get the same error.
What should i do?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>You never answered the question about serial numbers. Do your devices

have serial numbers? Are they different?

Do you mean usb iSerialNumber?
I checked, usb devices don’t implement it.

You seem to also be confusing the device SETUP class GUID, with the device
INTERFACE GUID. This is a common mistake. They are entirely separate things.

Several of my devices might belong to the device SETUP class GUID “OSR Machine
Tools” – and thus appear under OSR Machine Tools in Device Manager. Each type
of tool could have its own INTERFACE GUID, say GUID_INTERFACE_OSR_TOOL_LATHE for
example.

I know, in fact in the inf file i’ve the Classinstall32 section with a specific GUID, while the devices have another GUID, used in WdfDeviceCreateDeviceInterface.

Where, exactly, are you doing this “renaming”. You show a code snippet
entirely out of context and expect us to infer something about it. My
inference is that this is a piece of code from your AddDevice handler, right
before you create the symbolic link. …

The symbolic link was a test, i don’t use it in the driver.

The strange thing is that everything go well with a single device plugged into the system. DriverEntry is ok,EvtDeviceAdd is ok,Read,Write,IoDeviceControl ok. Everything is ok.
The problem comes when i plug a second device.
The first continues to function properly while the second gives an error.
I search everywere in the web about code 38 and i found this:

CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD
The driver could not be loaded because a previous instance is still loaded.
Error Code 38
Display Message (Windows XP and later versions of Windows)
“Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory. (Code 38)”
Recommended Resolution (Windows XP and later versions of Windows)
A previous driver instance can still be loaded due to an incorrect reference count or a race between load and unload operations. Additionally, this message can appear if a driver is referenced by multiple INF AddService directives in one or more INF files.
Select Restart Computer, which will restart the computer.

Could it be a mistake in the inf file?
This is the section of my inf file where i define service and coinstaller:

;/***************************************/
[InstallDriver.Services]
AddService = Algotex2011, 0x00000002, AlgotexAddService

[AlgotexAddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\Algotex2011.sys

[InstallDriver.CoInstallers]
AddReg=CoInstaller_AddReg
CopyFiles=CoInstaller_CopyFiles

[CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000, “WdfCoInstaller01009.dll,WdfCoInstaller”

[CoInstaller_CopyFiles]
WdfCoInstaller01009.dll

[InstallDriver.Wdf]
KmdfService = Algotex2011, Algotex2011_wdfsect

[Algotex2011_wdfsect]
KmdfLibraryVersion = 1.9
;/***************************************/

Or could it be a coinstaller problem?

Are you setting an unload routine ?

d

debt from my phone

-----Original Message-----
From: xxxxx@libero.it
Sent: Friday, August 05, 2011 3:10 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Questions about device naming

You never answered the question about serial numbers. Do your devices
have serial numbers? Are they different?

Do you mean usb iSerialNumber?
I checked, usb devices don’t implement it.

You seem to also be confusing the device SETUP class GUID, with the device
INTERFACE GUID. This is a common mistake. They are entirely separate things.

Several of my devices might belong to the device SETUP class GUID “OSR Machine
Tools” – and thus appear under OSR Machine Tools in Device Manager. Each type
of tool could have its own INTERFACE GUID, say GUID_INTERFACE_OSR_TOOL_LATHE for
example.

I know, in fact in the inf file i’ve the Classinstall32 section with a specific GUID, while the devices have another GUID, used in WdfDeviceCreateDeviceInterface.

Where, exactly, are you doing this “renaming”. You show a code snippet
entirely out of context and expect us to infer something about it. My
inference is that this is a piece of code from your AddDevice handler, right
before you create the symbolic link. …

The symbolic link was a test, i don’t use it in the driver.

The strange thing is that everything go well with a single device plugged into the system. DriverEntry is ok,EvtDeviceAdd is ok,Read,Write,IoDeviceControl ok. Everything is ok.
The problem comes when i plug a second device.
The first continues to function properly while the second gives an error.
I search everywere in the web about code 38 and i found this:

CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD
The driver could not be loaded because a previous instance is still loaded.
Error Code 38
Display Message (Windows XP and later versions of Windows)
“Windows cannot load the device driver for this hardware because a previous instance of the device driver is still in memory. (Code 38)”
Recommended Resolution (Windows XP and later versions of Windows)
A previous driver instance can still be loaded due to an incorrect reference count or a race between load and unload operations. Additionally, this message can appear if a driver is referenced by multiple INF AddService directives in one or more INF files.
Select Restart Computer, which will restart the computer.

Could it be a mistake in the inf file?
This is the section of my inf file where i define service and coinstaller:

;/***************************************/
[InstallDriver.Services]
AddService = Algotex2011, 0x00000002, AlgotexAddService

[AlgotexAddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\Algotex2011.sys

[InstallDriver.CoInstallers]
AddReg=CoInstaller_AddReg
CopyFiles=CoInstaller_CopyFiles

[CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000, “WdfCoInstaller01009.dll,WdfCoInstaller”

[CoInstaller_CopyFiles]
WdfCoInstaller01009.dll

[InstallDriver.Wdf]
KmdfService = Algotex2011, Algotex2011_wdfsect

[Algotex2011_wdfsect]
KmdfLibraryVersion = 1.9
;/***************************************/

Or could it be a coinstaller problem?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

> Are you setting an unload routine ?

No, i defined a EvtCleanupCallback callback function on the driver object, but i don’t think that’s a problem.
Also because without it i still have the same error.

Are you using wpp? Are you unregistering in the driver cleanup callback?

d

debt from my phone

-----Original Message-----
From: xxxxx@libero.it
Sent: Friday, August 05, 2011 7:55 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Questions about device naming

Are you setting an unload routine ?

No, i defined a EvtCleanupCallback callback function on the driver object, but i don’t think that’s a problem.
Also because without it i still have the same error.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I don’t use WPP.

This is cleanup routine:

VOID
DriverContextCleanup( WDFDRIVER Driver )
{
PAGED_CODE ();
UNREFERENCED_PARAMETER(Driver);
KdPrint((" –>DriverContextCleanup<–\n"));
}

xxxxx@libero.it wrote:

The symbolic link was a test, i don’t use it in the driver.

The strange thing is that everything go well with a single device plugged into the system. DriverEntry is ok,EvtDeviceAdd is ok,Read,Write,IoDeviceControl ok. Everything is ok.
The problem comes when i plug a second device.
The first continues to function properly while the second gives an error.
I search everywere in the web about code 38 and i found this:

CM_PROB_DRIVER_FAILED_PRIOR_UNLOAD
The driver could not be loaded because a previous instance is still loaded.
Error Code 38

Could it be a mistake in the inf file?
This is the section of my inf file where i define service and coinstaller:

That’s not enough information. Why not show us the entire INF file?

It is unusual that the system would WANT to unload the prior driver.
That suggests the driver wasn’t installed correctly to begin with. How,
EXACTLY, did you install your driver package initially? Did you happen
to use “devcon install”? Did you just copy the files into place? Is it
possible there are older copies of your driver package in \Windows\Inf
or in the driver store?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Hi, sorry for the delay
This is the inf file:

;Inf file

[Version]
Signature=“$WINDOWS NT$”
Class=MyUsbClass
ClassGUID={20F21F9B-E885-47A4-9F45-14131F2EAA69}
Provider=%ProviderName%
CatalogFile=Driver2011.cat
DriverVer=07/27/2011,1.0.0.0

; ================= Class section =====================

[ClassInstall32]
Addreg=SampleClassReg

[SampleClassReg]
HKR,0,%ClassName%
HKR,Icon,-5

;======================================================

[SourceDisksNames]
1=%CURRENT_DIR%,

[SourceDisksFiles]
Algotex2011.sys = 1
WdfCoInstaller01009.dll=1

[DestinationDirs]
DefaultDestDir = 12 ;Cartella in cui viene salvato il driver.
CoInstaller_CopyFiles = 11

[Manufacturer]
%AdvTecMfg%=Mfc,NTx86,NTamd64

[Mfc.NTx86]
%DeviceDesc%=InstallDriver, USB\VID_135D&PID_F001

[Mfc.NTamd64]
%DeviceDesc%=InstallDriver, USB\VID_135D&PID_F001

[InstallDriver]
DriverVer=07/27/2011,1.0.0.0
CopyFiles=Algotex2011.Files.Ext

[Algotex2011.Files.Ext]
Algotex2011.sys

[InstallDriver.Services]
AddService = Algotex2011, 0x00000002, AlgotexAddService

[AlgotexAddService]
DisplayName = %SvcDesc%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %10%\system32\drivers\Algotex2011.sys

[InstallDriver.CoInstallers]
AddReg=CoInstaller_AddReg
CopyFiles=CoInstaller_CopyFiles

[CoInstaller_AddReg]
HKR,CoInstallers32,0x00010000, “WdfCoInstaller01009.dll,WdfCoInstaller”

[CoInstaller_CopyFiles]
WdfCoInstaller01009.dll

[InstallDriver.Wdf]
KmdfService = Algotex2011, Algotex2011_wdfsect

[Algotex2011_wdfsect]
KmdfLibraryVersion = 1.9

[Strings]
ClassName = “My Usb Device”
ProviderName=“Provider”
DeviceDesc=“USB Device”
Description=“Description”
SvcDesc=“USB Device”
AdvTecMfg = “Advance Techne”
CURRENT_DIR=“C:\Temp”