|
有关wince下的用CreateFile获取串口句柄
[复制链接]
1.通过查看WINCE的句柄,得到com1与com2的信息如下:
[[HKEY_LOCALMACHINE/drivers/BuildIn/Serial]
(Default): (value not set)
Dll: com165550.Dll
Tsp: Unimodem.dll
IoBase: 2926575616
Irq: 19
IoLen: 36
DeviceArrayIndex: 0
Prefix: COM
Order: 1
Index: 1
DeviceType: 0
FriendlyName: Serial IR on COM1:
DevConfig: 20 00 00 00 05 00 00 00 10 01 00 00 00 4B 00 00 00 00 08 00 00 0.
[HKEY_LOCALMACHINE/drivers/BuildIn/Serial_cmd]
(Default): (value not set)
Dll: Serial_cmd.Dll
Tsp: Unimodem.dll
IoBase: 2920284160
Irq: 19
IoLen: 36
DeviceArrayIndex: 0
Prefix: COM
Order: 2
Index: 2
DeviceType: 0
FriendlyName: RIL on COM2:
DevConfig: 20 00 00 00 05 00 00 00 10 01 00 00 00 4B 00 00 00 00 08 00 00 0.
2.试图用CreateFile函数获取COM1,COM2的句柄
HANDLE h1 =CreateFile(L"COM1:",GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,0); 获得h1是一个合法的句柄
HANDLE h2 =CreateFile(L"COM2:",GENERIC_READ|GENERIC_WRITE,0,0,OPEN_EXISTING,0,0); 获得h2是一个非法的句柄
请问大家知道这是什么原因吗???谢谢
|
|