Hi All
I have this problem that i am using EnumDeviceDrivers() function to
get the addresses of device drivers in the system.
I got the total number of device drivers by dividing
cbNeeded/(sizeof(LPVOID) ).
Now, in a for loop for the number of device driver found by
EnumDeviceDrivers() API, i am calling GetDeviceDriverBaseName() API
repetitvely to get the name of device driver. This APi is failing sometimes
.
I am repeating this whole process for long loops like 1400 loops or so. in a
Test Program. But GetDeviceDriverBaseName() API fails sometimes during loop
700 and sometimes 1100 or so and my program exits with error as i have done
error handling in this case.
I suspect that After i called EnumDeviceDrivers() API to get the number of
device drivers and load addresss. And during the time i was executing
GetDeviceDriverBaseName() API in loop, one of the loaded device driver gets
unloaded. so when GetDeviceDriverBaseName() API is called using that load
address it fails and gives error as “Parameter is invalid”.
Now my questions,
- how good a chance of having any device driver getting unloaded during the
time GetDeviceDriverBaseName() API is called in for loop. - i was thinking of checking whether load address in the array filled by
EnumDeviceDrivers() is still valid or not? how it is possible. I thought of
comparing load address to INVALID_HANDLE_VALUE. will it do or not?
I am stuck up here and searching the resources.
I will be grateful to you if you could provide some help or clue.
Regards
Prashant