Discussion:
Virtual Serial Port Driver and CreateFile
(too old to reply)
anonymous
2004-12-03 00:13:03 UTC
Permalink
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.

HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call (CreateFile("COM106:"...)),
I get an error (123).

I use SoftICE and I had a breakpoint set in the handler for IRP_MJ_CREATE
but it never got hit.

Any ideas?

Thanks
/kmk
cristalink
2004-12-03 00:21:03 UTC
Permalink
Maybe, just "COM106"?
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.
HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call (CreateFile("COM106:"...)),
I get an error (123).
I use SoftICE and I had a breakpoint set in the handler for IRP_MJ_CREATE
but it never got hit.
Any ideas?
Thanks
/kmk
cristalink
2004-12-03 00:43:19 UTC
Permalink
I've checked my old code and found that I use the "\\\\.\\COM1" syntax
(C/C++).
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.
HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call (CreateFile("COM106:"...)),
I get an error (123).
I use SoftICE and I had a breakpoint set in the handler for IRP_MJ_CREATE
but it never got hit.
Any ideas?
Thanks
/kmk
anonymous
2004-12-03 03:27:03 UTC
Permalink
Thanks. I tried this already and worked. Why couldnt I just use
"COM106:"? This seems to work for COM1 etc. Any ideas?
Post by cristalink
I've checked my old code and found that I use the "\\\\.\\COM1" syntax
(C/C++).
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.
HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call (CreateFile("COM106:"...)),
I get an error (123).
I use SoftICE and I had a breakpoint set in the handler for IRP_MJ_CREATE
but it never got hit.
Any ideas?
Thanks
/kmk
cristalink
2004-12-03 04:37:53 UTC
Permalink
Sorry, I am not really interested in serial ports to be sure, but

\\.\com1 works fine on my pc
com1 works as well
com1: works, too
com106 file not found
com106: invalid file name

So I guess there must be a symbolic link(s) pointing to \Device\Com106 named
Com106, Com106:, or both. I am not sure who is responsible for creation of
this link. You may want to create it yourself. You may also want to wait for
someone to add a comment to this thread with their opinion.
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
Thanks. I tried this already and worked. Why couldnt I just use
"COM106:"? This seems to work for COM1 etc. Any ideas?
Post by cristalink
I've checked my old code and found that I use the "\\\\.\\COM1" syntax
(C/C++).
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.
HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call
(CreateFile("COM106:"...)),
Post by anonymous
Post by cristalink
Post by anonymous
I get an error (123).
I use SoftICE and I had a breakpoint set in the handler for IRP_MJ_CREATE
but it never got hit.
Any ideas?
Thanks
/kmk
anonymous
2004-12-03 06:03:02 UTC
Permalink
Please read my first post. The COM106 is created by my virtual
driver.

Anyway, I don't know why I am not able to use "COM106:" instead of
"\\\\.\\COM106".

I tried strace for NT and regmon to get a clue of whats going on.
Here is the output from strace.

95 2544 2576 NtCreateFile (0xc0100080, {24, 0, 0x40, 0, 1244852,
"\??\COM1"}, 0x0, 0, 0, 1, 96, 0, 0, ... 28, {status=0x0, info=0}, ) == 0x0
96 2544 2576 NtClose (28, ... ) == 0x0

97 2544 2576 NtCreateFile (0xc0100080, {24, 12, 0x40, 0, 1244852,
"COM107:"}, 0x0, 0, 0, 1, 96, 0, 0, ... ) == STATUS_OBJECT_NAME_INVALID
98 2544 2576 NtClose (-1, ... ) == STATUS_INVALID_HANDLE

For "COM1:", CreateFile endsup calling NtCreateFile with "\??\COM1". But
for "COM107:", it does not do any translation.

Why CreateFile is not able to translate COM107 to "\??\COM107"?

If anybody has any insights please respond.

Thanks
/kmk
Post by cristalink
Sorry, I am not really interested in serial ports to be sure, but
\\.\com1 works fine on my pc
com1 works as well
com1: works, too
com106 file not found
com106: invalid file name
So I guess there must be a symbolic link(s) pointing to \Device\Com106 named
Com106, Com106:, or both. I am not sure who is responsible for creation of
this link. You may want to create it yourself. You may also want to wait for
someone to add a comment to this thread with their opinion.
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
Thanks. I tried this already and worked. Why couldnt I just use
"COM106:"? This seems to work for COM1 etc. Any ideas?
Post by cristalink
I've checked my old code and found that I use the "\\\\.\\COM1" syntax
(C/C++).
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.
HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call
(CreateFile("COM106:"...)),
Post by anonymous
Post by cristalink
Post by anonymous
I get an error (123).
I use SoftICE and I had a breakpoint set in the handler for
IRP_MJ_CREATE
Post by anonymous
Post by cristalink
Post by anonymous
but it never got hit.
Any ideas?
Thanks
/kmk
anonymous
2004-12-03 06:25:04 UTC
Permalink
Interesting...

CreateFile seems to translate COMx: to "\??\COMx" only if single digit
COMx: entry is used. For COMxx: or COMxxx:, it does not do the
translation....
Post by anonymous
Please read my first post. The COM106 is created by my virtual
driver.
Anyway, I don't know why I am not able to use "COM106:" instead of
"\\\\.\\COM106".
I tried strace for NT and regmon to get a clue of whats going on.
Here is the output from strace.
95 2544 2576 NtCreateFile (0xc0100080, {24, 0, 0x40, 0, 1244852,
"\??\COM1"}, 0x0, 0, 0, 1, 96, 0, 0, ... 28, {status=0x0, info=0}, ) == 0x0
96 2544 2576 NtClose (28, ... ) == 0x0
97 2544 2576 NtCreateFile (0xc0100080, {24, 12, 0x40, 0, 1244852,
"COM107:"}, 0x0, 0, 0, 1, 96, 0, 0, ... ) == STATUS_OBJECT_NAME_INVALID
98 2544 2576 NtClose (-1, ... ) == STATUS_INVALID_HANDLE
For "COM1:", CreateFile endsup calling NtCreateFile with "\??\COM1". But
for "COM107:", it does not do any translation.
Why CreateFile is not able to translate COM107 to "\??\COM107"?
If anybody has any insights please respond.
Thanks
/kmk
Post by cristalink
Sorry, I am not really interested in serial ports to be sure, but
\\.\com1 works fine on my pc
com1 works as well
com1: works, too
com106 file not found
com106: invalid file name
So I guess there must be a symbolic link(s) pointing to \Device\Com106 named
Com106, Com106:, or both. I am not sure who is responsible for creation of
this link. You may want to create it yourself. You may also want to wait for
someone to add a comment to this thread with their opinion.
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
Thanks. I tried this already and worked. Why couldnt I just use
"COM106:"? This seems to work for COM1 etc. Any ideas?
Post by cristalink
I've checked my old code and found that I use the "\\\\.\\COM1" syntax
(C/C++).
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.
HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call
(CreateFile("COM106:"...)),
Post by anonymous
Post by cristalink
Post by anonymous
I get an error (123).
I use SoftICE and I had a breakpoint set in the handler for
IRP_MJ_CREATE
Post by anonymous
Post by cristalink
Post by anonymous
but it never got hit.
Any ideas?
Thanks
/kmk
Doron Holan [MS]
2004-12-03 08:04:41 UTC
Permalink
this is documented behavior b/c these are "well known" DOS device names.
for any COM port greater then 9 you must use the \\.\COMX syntax, which is
the std way of accessing a driver name in user mode.

d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
Post by anonymous
Interesting...
CreateFile seems to translate COMx: to "\??\COMx" only if single digit
COMx: entry is used. For COMxx: or COMxxx:, it does not do the
translation....
Post by anonymous
Please read my first post. The COM106 is created by my virtual
driver.
Anyway, I don't know why I am not able to use "COM106:" instead of
"\\\\.\\COM106".
I tried strace for NT and regmon to get a clue of whats going on.
Here is the output from strace.
95 2544 2576 NtCreateFile (0xc0100080, {24, 0, 0x40, 0, 1244852,
"\??\COM1"}, 0x0, 0, 0, 1, 96, 0, 0, ... 28, {status=0x0, info=0}, ) == 0x0
96 2544 2576 NtClose (28, ... ) == 0x0
97 2544 2576 NtCreateFile (0xc0100080, {24, 12, 0x40, 0, 1244852,
"COM107:"}, 0x0, 0, 0, 1, 96, 0, 0, ... ) == STATUS_OBJECT_NAME_INVALID
98 2544 2576 NtClose (-1, ... ) == STATUS_INVALID_HANDLE
For "COM1:", CreateFile endsup calling NtCreateFile with "\??\COM1". But
for "COM107:", it does not do any translation.
Why CreateFile is not able to translate COM107 to "\??\COM107"?
If anybody has any insights please respond.
Thanks
/kmk
Post by cristalink
Sorry, I am not really interested in serial ports to be sure, but
\\.\com1 works fine on my pc
com1 works as well
com1: works, too
com106 file not found
com106: invalid file name
So I guess there must be a symbolic link(s) pointing to \Device\Com106 named
Com106, Com106:, or both. I am not sure who is responsible for creation of
this link. You may want to create it yourself. You may also want to wait for
someone to add a comment to this thread with their opinion.
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
Thanks. I tried this already and worked. Why couldnt I just use
"COM106:"? This seems to work for COM1 etc. Any ideas?
Post by cristalink
I've checked my old code and found that I use the "\\\\.\\COM1" syntax
(C/C++).
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.
HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call
(CreateFile("COM106:"...)),
Post by anonymous
Post by cristalink
Post by anonymous
I get an error (123).
I use SoftICE and I had a breakpoint set in the handler for
IRP_MJ_CREATE
Post by anonymous
Post by cristalink
Post by anonymous
but it never got hit.
Any ideas?
Thanks
/kmk
kmk
2004-12-04 04:26:12 UTC
Permalink
I didnt' know. Thanks for the clarification.

/kmk
Post by Doron Holan [MS]
this is documented behavior b/c these are "well known" DOS device names.
for any COM port greater then 9 you must use the \\.\COMX syntax, which is
the std way of accessing a driver name in user mode.
d
CheckAbdoul
2004-12-07 22:26:42 UTC
Permalink
See if the following KB article helps you

http://support.microsoft.com/?id=115831
--
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------
Post by anonymous
Interesting...
CreateFile seems to translate COMx: to "\??\COMx" only if single digit
COMx: entry is used. For COMxx: or COMxxx:, it does not do the
translation....
Post by anonymous
Please read my first post. The COM106 is created by my virtual
driver.
Anyway, I don't know why I am not able to use "COM106:" instead of
"\\\\.\\COM106".
I tried strace for NT and regmon to get a clue of whats going on.
Here is the output from strace.
95 2544 2576 NtCreateFile (0xc0100080, {24, 0, 0x40, 0, 1244852,
"\??\COM1"}, 0x0, 0, 0, 1, 96, 0, 0, ... 28, {status=0x0, info=0}, ) == 0x0
96 2544 2576 NtClose (28, ... ) == 0x0
97 2544 2576 NtCreateFile (0xc0100080, {24, 12, 0x40, 0, 1244852,
"COM107:"}, 0x0, 0, 0, 1, 96, 0, 0, ... ) == STATUS_OBJECT_NAME_INVALID
98 2544 2576 NtClose (-1, ... ) == STATUS_INVALID_HANDLE
For "COM1:", CreateFile endsup calling NtCreateFile with "\??\COM1". But
for "COM107:", it does not do any translation.
Why CreateFile is not able to translate COM107 to "\??\COM107"?
If anybody has any insights please respond.
Thanks
/kmk
Post by cristalink
Sorry, I am not really interested in serial ports to be sure, but
\\.\com1 works fine on my pc
com1 works as well
com1: works, too
com106 file not found
com106: invalid file name
So I guess there must be a symbolic link(s) pointing to \Device\Com106 named
Com106, Com106:, or both. I am not sure who is responsible for creation of
this link. You may want to create it yourself. You may also want to wait for
someone to add a comment to this thread with their opinion.
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
Thanks. I tried this already and worked. Why couldnt I just use
"COM106:"? This seems to work for COM1 etc. Any ideas?
Post by cristalink
I've checked my old code and found that I use the "\\\\.\\COM1" syntax
(C/C++).
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.
HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call
(CreateFile("COM106:"...)),
Post by anonymous
Post by cristalink
Post by anonymous
I get an error (123).
I use SoftICE and I had a breakpoint set in the handler for
IRP_MJ_CREATE
Post by anonymous
Post by cristalink
Post by anonymous
but it never got hit.
Any ideas?
Thanks
/kmk
cristalink
2004-12-03 07:05:50 UTC
Permalink
Open DDK Help and search for "DosDevices com". You'll find "COM Port
Interfaces" and "Registry Settings for a Legacy COM Port". All the info is
there.
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
Please read my first post. The COM106 is created by my virtual
driver.
Anyway, I don't know why I am not able to use "COM106:" instead of
"\\\\.\\COM106".
I tried strace for NT and regmon to get a clue of whats going on.
Here is the output from strace.
95 2544 2576 NtCreateFile (0xc0100080, {24, 0, 0x40, 0, 1244852,
"\??\COM1"}, 0x0, 0, 0, 1, 96, 0, 0, ... 28, {status=0x0, info=0}, ) == 0x0
96 2544 2576 NtClose (28, ... ) == 0x0
97 2544 2576 NtCreateFile (0xc0100080, {24, 12, 0x40, 0, 1244852,
"COM107:"}, 0x0, 0, 0, 1, 96, 0, 0, ... ) == STATUS_OBJECT_NAME_INVALID
98 2544 2576 NtClose (-1, ... ) == STATUS_INVALID_HANDLE
For "COM1:", CreateFile endsup calling NtCreateFile with "\??\COM1". But
for "COM107:", it does not do any translation.
Why CreateFile is not able to translate COM107 to "\??\COM107"?
If anybody has any insights please respond.
Thanks
/kmk
Post by cristalink
Sorry, I am not really interested in serial ports to be sure, but
\\.\com1 works fine on my pc
com1 works as well
com1: works, too
com106 file not found
com106: invalid file name
So I guess there must be a symbolic link(s) pointing to \Device\Com106 named
Com106, Com106:, or both. I am not sure who is responsible for creation of
this link. You may want to create it yourself. You may also want to wait for
someone to add a comment to this thread with their opinion.
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
Thanks. I tried this already and worked. Why couldnt I just use
"COM106:"? This seems to work for COM1 etc. Any ideas?
Post by cristalink
I've checked my old code and found that I use the "\\\\.\\COM1" syntax
(C/C++).
--
http://www.firestreamer.com - NTBACKUP to DVD and DV
Post by anonymous
My virtual serial port driver seems to work fine. I used lot of code
from serial driver example in the DDK for external naming etc.
HyperTerminal successfully opens the virtual port etc. However, when
I try to open the port using CreateFile call
(CreateFile("COM106:"...)),
Post by anonymous
Post by cristalink
Post by anonymous
I get an error (123).
I use SoftICE and I had a breakpoint set in the handler for
IRP_MJ_CREATE
Post by anonymous
Post by cristalink
Post by anonymous
but it never got hit.
Any ideas?
Thanks
/kmk
Loading...