> IoDeviceObjectType and IoDriverObjectType may not be declared in ntddk.h,
they are exported by ntoskrnl.
So what??? As long as they are not be declared in ntddk.h and not documented anywhere, we are
not supposed to touch them anyway. There is no mentining of these types anywhere in WDK/MSDN, and there is no suggestion to avoid using driver and device objects in Ob… calls either, so that MSFT must have provided a legitimate way to reference objects of these types. Therefore, by using IoFileObjectType instead technically you are not going around MSFT rules, but by using
IoDeviceObjectType and IoDriverObjectType you do…
passing the wrong object type is asking for trouble, if it doesn’t come now then at
some point in the future.
This would apply only if they were declared in ntddk.h and properly documented. However, once they are not, ironically, by using IoDeviceObjectType and IoDriverObjectType in your calls you are going for a bigger trouble, compared to simply replacing them with IoFileObjectType instead. Just imagine if they disappear in the future OS releases…
The above applies only to documented functions. In our case it does not really matter - once there is no mentioning of this function anywhere on MSDN, there is some certain risk of using it anyway, because MSFT folks are free to do what they want with it, including modifications of its argument list. Therefore, once you have decide to use it, be ready to be asked to provide a fix for “unpleasant surprises” at any moment…
It is an optional parameter which means you can pass NULL instead,
Actually, I tried it, but, for this or that reason, bluescreened…
Anton Bassov