CreateFile allocates 2(!!) handles and CloseHandle closes only one handle when trying to get the low-level access to cd-rom device. OS Windows XP SP3, 5 of 7 tested computers works the same.
When trying to access hdd drive letter CreateFiles works OK and allocate only one handle.
Here is the sample code:
HANDLE m_driveHandle = CreateFileW("\\\\.\\E", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);CloseHandle(m_driveHandle);
What is the possible reason or it's just a microsoft bug?
Upd. The drive name was'nt cut&pasted.. The right string is L"\\.\E:". Bug still persists.
Upd2. Problem solved! See the answer below from me (omega).
Suggestion:
Put log begin at call CreateFileW, this confirm how many times it is executed;