At this time my driver returns “STATUS_NO_MEMORY” if a memory region was not allocated. I unfortunately don’t know any way to force this to happen but would still like to handle it appropriately. If this value is returned should I expect an error using GetLastError after opening the driver? If so, what error? I see no STATUS_NO_MEMORY in the system error codes.
I just discovered that maybe “STATUS_INSUFFICIENT_RESOURCES” would be more appropriate but I still don’t know how or if this shows up after a CreateFile( ) call. Not sure if this results in an invalid handle or an error message in GetLastError. If so which one?
I just discovered that maybe “STATUS_INSUFFICIENT_RESOURCES” would be more
appropriate but I still don’t know how or if this shows up after a
CreateFile( ) call. Not sure if this results in an invalid handle or an
error message in GetLastError. If so which one?
I just don’t know if it indeed returns INVALID_HANDLE_VALUE if the driver function returns STATUS_INSUFFICIENT_RESOURCES. When I return STATUS_NO_MEMORY I do get a valid handle. unfortunately I have no idea my resources were not allocated. When I attempt a driver access it crashes. I am now unable to recreate this scenario though so I can’t just try it by changing the return value to STATUS_INSUFFICIENT_RESOURCES and hope that it results in an invalid handle. I have no idea when the error may arise again and would prefer to handle it correctly no rather than hope to reproduce it continually.
STATUS_INSUFFICIENT_RESOURCES is an error return and if your driver
correctly returns it from your IRP_MJ_CREATE call then CreateFile will
return INVALID_HANDLE_VALUE anf GetLastError() will return the WIN32 version
of STATUS_INSUFFICIENT_RESOURCE.
Are you setting the error in the IO_STATUS field when you complete the IRP?
I just don’t know if it indeed returns INVALID_HANDLE_VALUE if the driver
function returns STATUS_INSUFFICIENT_RESOURCES. When I return
STATUS_NO_MEMORY I do get a valid handle. unfortunately I have no idea my
resources were not allocated. When I attempt a driver access it crashes. I
am now unable to recreate this scenario though so I can’t just try it by
changing the return value to STATUS_INSUFFICIENT_RESOURCES and hope that it
results in an invalid handle. I have no idea when the error may arise again
and would prefer to handle it correctly no rather than hope to reproduce it
continually.
At this time my driver returns “STATUS_NO_MEMORY” if a memory region was not allocated. I unfortunately don’t know any way to force this to happen but would still like to handle it appropriately. If this value is returned should I expect an error using GetLastError after opening the driver? If so, what error? I see no STATUS_NO_MEMORY in the system error codes.