CreateFile() is successful when you use "COM1" through "COM9" for the name of the file; however, the message
INVALID_HANDLE_VALUE
If the name of the port is \\.\COM10, the correct way to specify the serial port in a call to CreateFile() is as follows:
CreateFile(
"\\\\.\\COM10", // address of name of the communications device
fdwAccess, // access (read-write) mode
0, // share mode
NULL, // address of security descriptor
OPEN_EXISTING, // how to create
0, // file attributes
NULL // handle of file with attributes to copy
);
http://support.microsoft.com/kb/115831