Problem With Application Launcher for Device Driver
-
Hi, I have created a Device Independent Driver Code. It is working perfectly. All i need is a Application Launcher program. And that is where my problem starts. I am trying to create the file using the CreateFile Command. And it is always returning false. I have attached the code snippet below. Anyone who knows how to solve the problem please help me. HANDLE OpenDeviceDriver(LPCTSTR szDriverName) { HANDLE hDevice; TCHAR szFullName[200]; wsprintf(szFullName, "\\\\.\\%s", szDriverName); hDevice = CreateFile (szFullName, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if(hDevice == INVALID_HANDLE_VALUE) { hDevice = 0; printf("%x Error %ld\n",hDevice,GetLastError()); } return hDevice; } With Warm Regards Kenny
-
Hi, I have created a Device Independent Driver Code. It is working perfectly. All i need is a Application Launcher program. And that is where my problem starts. I am trying to create the file using the CreateFile Command. And it is always returning false. I have attached the code snippet below. Anyone who knows how to solve the problem please help me. HANDLE OpenDeviceDriver(LPCTSTR szDriverName) { HANDLE hDevice; TCHAR szFullName[200]; wsprintf(szFullName, "\\\\.\\%s", szDriverName); hDevice = CreateFile (szFullName, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); if(hDevice == INVALID_HANDLE_VALUE) { hDevice = 0; printf("%x Error %ld\n",hDevice,GetLastError()); } return hDevice; } With Warm Regards Kenny
-
What's the return value from GetLastError() ?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
The result of GetLastError() is 2
-
The result of GetLastError() is 2
Means The file is not there in the specified path.I want to know what u or passing to szDriverName. regards Vairavan -- modified at 0:52 Friday 1st September, 2006