|05 Mar 2010||#1|
| || |
createFile invalid handle
I could use some help figuring out why createFile will fail on some machines and not on others. Customer's are installing a USB drive on their machines and then running my security application. The security app runs fine for most of the customer except for about 3. It fails every time with an invalid handle error. I have checked the owner and permissions on the drive letter and at the c:\ level and they are all fine. The code I am running is below.
snprintf(devpath, sizeof(devpath)-1, "\\\\?\\");
hDevice = CreateFile(devpath, // drive to open
//0, // no access to the drive
NULL, // default security attributes
OPEN_EXISTING, // disposition
0, // file attributes
NULL); // do not copy file attributes
if (hDevice == INVALID_HANDLE_VALUE) // cannot open the drive
printf("Press return key to continue.");
Any thoughts as to how to fix this would be appreciated. I have actually added the GetLastError() call to the code to get the exact error code for the failure. I am now waiting on a customer call back to try the new code.
|My System Specs|
|Similar help and support threads for2: createFile invalid handle|
|BSOD-Invalid Kernel Handle-ntoskrnl.exe||BSOD Help and Support|
|Error: Wrapper-CreateFile failed with Error 5: Access is denied||Software|
|What is "Invalid Handle" and how can I fix it?||Installation & Setup|
|invalid kernel handle||BSOD Help and Support|
|"Handle invalid" error message.||BSOD Help and Support|
|ftp invalid handle error||Network & Sharing|
|Backup error: The handle is invalid||Backup and Restore|
|Our Sites ||Site Links ||About Us ||Find Us |
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
All times are GMT -5. The time now is 06:27 PM.