Hi, all
I found something to make a Virtual Serial Port in NewsGroups of Google,
Here are the steps:
- Write a bus driver (which would act as a function driver for a USB
device or some other device that enumlates com ports) and enumerate PDOs
(raw capable) for each virtual port.
- Name the PDO as \Device\XYZ. (XYZ is your company name)
- Use a Port Class NULL INF to install the enumerated device.
- In the StartDevice, create a symbolic link using the PortName value
created in the devnode registry by the classinstaller.
- Handle all the necessary serial port IRPs in your bus driver to provide
the required functionality.
The following is what I have done:
1)I Create a bus driver FDO based on the Toaster Bus in NTDDK
2)I modified the
status = IoCreateDevice(FdoData->Self->DriverObject,
sizeof (PDO_DEVICE_DATA),
NULL,
FILE_DEVICE_BUS_EXTENDER,
FILE_AUTOGENERATED_DEVICE_NAME |FILE_DEVICE_SECURE_OPEN,
FALSE,
&pdo);
into
status = IoCreateDevice(FdoData->Self->DriverObject,
sizeof (PDO_DEVICE_DATA),
&deviceName,
FILE_DEVICE_SERIAL_PORT,
FILE_DEVICE_SECURE_OPEN,
TRUE,
&pdo);
and I added codes to create a symbolic link & make sure the child device
is above the bus driver.
…
pdoData = (PPDO_DEVICE_DATA) pdo->DeviceExtension;
pdoData->IsFDO = FALSE;
pdoData->Self = pdo;
pdoData->ParentFdo = FdoData->Self;
pdoData->Self->Flags &= ~DO_DEVICE_INITIALIZING;
…
IoOpenDeviceRegistryKey
IoCreateSymbolicLink
…
All of these in the Bus_PlugInDevice function
I can use “enum -p 1” to create a port driver(displayed a COM port in the
Device Manager), but in HyperTerminal I can’t find any COM port of my own.
I know something was wrong, but I still can not find them, and I still
have no idea to make the Serial(the sample of NTDDK, it has a lot of
hardware configuration) into Virtual device, all of the hardware
configuration should be made by software.
Needs someone’s help
Regards
Daniel
I posted a reply to this in microsoft.public.development.device.drivers.
Essentially you need to go back and re-read that Google post, it answers
all of your questions already. In fact Eliyas could not have done a
better job had he held our hand through the process.
–
Bill McKenzie
Compuware Corporation
Watch your IRPs/IRBs/URBs/SRBs/NDIS pkts with our free WDMSniffer tool:
http://frontline.compuware.com/nashua/patches/utility.htm
Hi, all
I found something to make a Virtual Serial Port in NewsGroups of Google,
Here are the steps:
- Write a bus driver (which would act as a function driver for a USB
device or some other device that enumlates com ports) and enumerate PDOs
(raw capable) for each virtual port.
- Name the PDO as \Device\XYZ. (XYZ is your company name)
- Use a Port Class NULL INF to install the enumerated device.
- In the StartDevice, create a symbolic link using the PortName value
created in the devnode registry by the classinstaller.
- Handle all the necessary serial port IRPs in your bus driver to provide
the required functionality.
The following is what I have done:
1)I Create a bus driver FDO based on the Toaster Bus in NTDDK
2)I modified the
status = IoCreateDevice(FdoData->Self->DriverObject,
sizeof (PDO_DEVICE_DATA),
NULL,
FILE_DEVICE_BUS_EXTENDER,
FILE_AUTOGENERATED_DEVICE_NAME |FILE_DEVICE_SECURE_OPEN,
FALSE,
&pdo);
into
status = IoCreateDevice(FdoData->Self->DriverObject,
sizeof (PDO_DEVICE_DATA),
&deviceName,
FILE_DEVICE_SERIAL_PORT,
FILE_DEVICE_SECURE_OPEN,
TRUE,
&pdo);
and I added codes to create a symbolic link & make sure the child device
is above the bus driver.
…
pdoData = (PPDO_DEVICE_DATA) pdo->DeviceExtension;
pdoData->IsFDO = FALSE;
pdoData->Self = pdo;
pdoData->ParentFdo = FdoData->Self;
pdoData->Self->Flags &= ~DO_DEVICE_INITIALIZING;
…
IoOpenDeviceRegistryKey
IoCreateSymbolicLink
…
All of these in the Bus_PlugInDevice function
I can use “enum -p 1” to create a port driver(displayed a COM port in the
Device Manager), but in HyperTerminal I can’t find any COM port of my own.
I know something was wrong, but I still can not find them, and I still
have no idea to make the Serial(the sample of NTDDK, it has a lot of
hardware configuration) into Virtual device, all of the hardware
configuration should be made by software.
Needs someone’s help
Regards
Daniel