|
4#
楼主 |
发表于 2008-7-1 13:20:06
|
只看该作者
找到一个方法可惜是英文的,谁能给解释一下
http://forums.technet.microsoft. ... -b847-1b50f38fd83d/
This is from a support professional at MSFT
WinPE 2.0 will auto-detect PNP0501(COM) and PNP0401(LPT1) , you just need use addcom1.cpp to add a symbolic link for COM1.
Here I paste addcom1 source code here, you may use VC++ any version to compile a new addcom1.exe
===============Source code start==================
/*
Microsoft Windows XP Service Pack 2 (SP2), RTM
OEM Preinstallation Kit (OPK)
Readme Document
June 25, 2004
---------------
4. KNOWN ISSUES
---------------
* Adding Symbolic Names of Serial Ports to Windows PE
Windows PE does not create symbolic names such as COM1 and COM2
for serial ports. This means that applications cannot detect
and use the serial ports.
Workaround: To create the symbolic names, you can write an
application that calls the DefineDosDevice function and
uses the full device name of the port. Add this application to
Startnet.cmd so that it runs as part of the Windows PE boot
process. When the application is finished, applications
can detect the serial ports by their symbolic names.
The full device name of COM1 when using the ACPI
HAL is:
\\?\ACPI#PNP0501#1#{4D36E978-E325-11CE-BFC1-08002BE10318}
To identify the full device names for serial ports on other HALs,
use the QueryDosDevice function to search for the string "PNP0501".
To use serial ports in custom applications, either refer to the
ports by their full device names or use DefineDosDevice to create
the symbolic names as in this example:
#define COM_PORT_DEV_NAME(n) \
TEXT("\\\\?\\ACPI#PNP0501#") TEXT(#n) TEXT("#{4D36E978-E325
-11CE-BFC1-08002BE10318}")
#define COM_PORT_NAME(n) \
TEXT("COM") TEXT(#n)
DefineDosDevice( 0, COM_PORT_NAME(1), COM_PORT_DEV_NAME(1) );
*/
#include <windows.h>
#define COM_PORT_DEV_NAME(n) TEXT("\\\\?\\ACPI#PNP0501#") TEXT(#n) TEXT("#{4D36E978-E325-11CE-BFC1-08002BE10318}")
#define COM_PORT_NAME(n) TEXT("COM") TEXT(#n)
void main()
{
DefineDosDevice(0, COM_PORT_NAME(1), COM_PORT_DEV_NAME(1));
}
===============Source code END================== |
|