Hi Guys,
I am unable to access my virtual com port driver using createfile function. It gives error as “the system cannot find the file specified”
What could be wrong?
I have tried all the paths, but it keeps giving the same error.
This is the definition in my driver
#define OBJECT_DIRECTORY L"\DosDevices\Global\"
The port number i am accessing is COM24.
The code i am using to access is ,
HANDLE hFile;
DWORD dwReturn;
char szTemp[256] = { 0 };
wchar_t buf[256];
hFile = CreateFile(“COM24”, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 256, NULL);
printf(“%s”,buf);
After this the function the buf contains ,
“The system cannot find the file specified”
I have tried,
\\.\COM24
\\.\DosDevices\Global\COM24
\DosDevices\Global\COM24
\Devices\COM24
\\.\Devices\COM24
All possible combinations that came into my mind
The WinObj tool shows that port as COM24 with a shortcut ICON. When i select it the status bar shows \GLOBAL??\COM24
The properties of COM24 shows
Name:COM24
Type:SymbolicLink
References:2
Handles: 0
Link: \Device\0000004b
I have tried the path as,
\\.\Device\0000004b
\Device\0000004b
Device\0000004b
also.
Please help …