If you are building the driver in the win7 kit, are you setting DRIVERTYPE to WDM? This gets reflected into the binary’s PE header IIRC. I think the io manager also looks at this to determine legacy or not.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, February 4, 2014 10:55 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Driver services
Yeah I already actually tried that. No change concerning the unload error but at least in the device tree tool it shows the actual IRPs it can handle. I was fiddeling around with a couple other drivers to see if there actually exists a driver that can be loaded/unloaded just by starting stopping it’s service and I found this secdrv.sys. The only difference between that driver and mine is that somehow the secdrv.sys has this LEGACY_DRIVER flag on the driver which I couldn’t find on the DRIVER_OBJECT at all. Any ideas on how does this tool actually get that flag?
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
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
Yes I link with /driver:wdm, according to dumpbin dll characteristics value is 2000 (i suppose thats in hexa) - WDM driver.
Just a suggestion : remove following code
DeviceObject->Flags &= (~DO_DEVICE_INITIALIZING); // this is only necessary within PNP drivers
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
pDriverObject->MajorFunction[i] = Unsupported; // value or routine ‘Unsupported’ ?
pDriverObject->MajorFunction[IRP_MJ_CLEANUP] = Cleanup; // what does your CleanUp routine ?
Christiaan
----- Original Message -----
From:
To: “Windows System Software Devs Interest List”
Sent: Tuesday, February 04, 2014 7:55 PM
Subject: RE:[ntdev] Driver services
> Yeah I already actually tried that. No change concerning the unload error but at least in the device tree tool it shows the actual
> IRPs it can handle. I was fiddeling around with a couple other drivers to see if there actually exists a driver that can be
> loaded/unloaded just by starting stopping it’s service and I found this secdrv.sys. The only difference between that driver and
> mine is that somehow the secdrv.sys has this LEGACY_DRIVER flag on the driver which I couldn’t find on the DRIVER_OBJECT at all.
> Any ideas on how does this tool actually get that flag?
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>DeviceObject->Flags &= (~DO_DEVICE_INITIALIZING); // this is only necessary
within PNP drivers
I will try it out, I actually added this line as I hoped it would help.
for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
pDriverObject->MajorFunction[i] = Unsupported; // value or routine
‘Unsupported’ ?
already commented that, but doesn’t help unfortunatelly
the function Unsupported returns STATUS_NOT_SUPPORTED. Is it supposed to be NULL in case the it’s not supported? couldn’t find information on this anywhere…
pDriverObject->MajorFunction[IRP_MJ_CLEANUP] = Cleanup; // what does your
CleanUp routine ?
CleanUp contains DbgPrint(“CleanUp\r\n”);
I already managed to successfully execute this function.
You should remove that flag by removing whatever sources file directive is adding it.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, February 4, 2014 11:16 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Driver services
Yes I link with /driver:wdm, according to dumpbin dll characteristics value is 2000 (i suppose thats in hexa) - WDM driver.
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
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 MUST clear DO_DEVICE_INITIALIZING if you create your Device Object in DriverEntry – This is cleared for you when you write a PnP driver and you create your Device Object in AddDevice/EvtDriverDeviceAdd.
But you DO have to clear it manually otherwise… so do not delete that line.
Peter
OSR
>DRIVER_OBJECT at all. Any ideas on how does this tool actually get that flag?
Lack of AddDevice?
–
Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com
> Yes I link with /driver:wdm
Yes, this is the second important thing after lack of AddDevice.
Try omitting it.
–
Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com
Actually it is the opposite. the io manager will clear the flag for you on any device object created in DriverEntry. You must clear the flag explicitly on any device object created after DriverEntry has returned
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@osr.com
Sent: Tuesday, February 4, 2014 11:38 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Driver services
You MUST clear DO_DEVICE_INITIALIZING if you create your Device Object in DriverEntry – This is cleared for you when you write a PnP driver and you create your Device Object in AddDevice/EvtDriverDeviceAdd.
But you DO have to clear it manually otherwise… so do not delete that line.
Peter
OSR
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
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
daaaaamn oh dear, I changed the /driver:WDM to just /driver in linker’s options and the driver unloaded as I stopped the service O_O wow. I would like to thank all of you, you are very kind, especially Mr. Doron Holan you are awesome sir!
If you are not too fed up with this question yet, do you have any thoughts on what makes the loader work differently with that WDM flag?
The flag doesn’t affect the loader, it affects the io manager post processing of DriverEntry. Think of the problem: there is no one definitive way for a driver to say “I am a pnp driver” across WDM and not WDM. Not WDM drivers set a AddDevice routine (as can wdm drivers), but that the setting of AddDevice is the only way. For WDM drivers, you don’t need the heuristic b/c all WDM drivers are pnp, at least as defined by Windows 2000 / win98 version of WDM. Since WDM drivers have the bit set in the binary, the io manager can use that as a clue.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, February 4, 2014 11:56 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Driver services
daaaaamn oh dear, I changed the /driver:WDM to just /driver in linker’s options and the driver unloaded as I stopped the service O_O wow. I would like to thank all of you, you are very kind, especially Mr. Doron Holan you are awesome sir!
If you are not too fed up with this question yet, do you have any thoughts on what makes the loader work differently with that WDM flag?
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
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
Gad, Doron, you’re right! Thanks for the correction.
Sorry, everyone… especially Mr. Ghijselinck: you were correct. That line should be omitted from the OP’s DriverEntry.
Ah, creating Device Objects in DriverEntry… those were the days.
Peter
OSR