Virtual COM Help

I am taking following steps in Virtual COM driver, is it right. (In Win
2k)

  1. In DriverEntry, all dispatch routines initialized
  2. In AddDevice, IoCreateDevice() used, IoAttach…()etc.
  3. In Pnp StartDevice, IoCreateSymbolicLink…()

Is it ok…?

How to get he list of COM ports in use in the system. (Not the count of COM
ports). I want to use a free COM port name to create symbolic link.

Any body can give a sample INF file for VCOM driver.

Thanks
SanWin


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hello,

I am taking following steps in Virtual COM driver, is it right. (In Win
2k)

  1. In DriverEntry, all dispatch routines initialized
  2. In AddDevice, IoCreateDevice() used, IoAttach…()etc.
  3. In Pnp StartDevice, IoCreateSymbolicLink…()

Is it ok…?

YES

How to get he list of COM ports in use in the system. (Not the count of COM
ports). I want to use a free COM port name to create symbolic link.

see msports.h from ddk include directory. Very simple. But the normal
class installer will do the right for you when you have a good inf
file.

Any body can give a sample INF file for VCOM driver.

see msports.inf

The name for the com port for your driver can you obtain
with this code. (Adapted from ddk)

WCHAR wszPortName[80];

NTSTATUS
CSerialDevice::getComPortName(void)
{
HANDLE keyHandle;
NTSTATUS status;

status = IoOpenDeviceRegistryKey(
PDO(),
PLUGPLAY_REGKEY_DEVICE,
STANDARD_RIGHTS_READ,
&keyHandle
);

if ( status == STATUS_SUCCESS)
{
//
// Fetch PortName which contains the suggested REG_SZ symbolic name.
//

UNICODE_STRING keyName;
PKEY_VALUE_FULL_INFORMATION fullInfo;
ULONG length;

RtlInitUnicodeString (&keyName, L"PortName");

length = sizeof(KEY_VALUE_FULL_INFORMATION) + sizeof(L"PortName") + sizeof(wszPortName);
fullInfo = (PKEY_VALUE_FULL_INFORMATION) ExAllocatePool(PagedPool, length);

if (! fullInfo )
{
status = STATUS_INSUFFICIENT_RESOURCES;
}
else
{
status = ZwQueryValueKey(
keyHandle,
&keyName,
KeyValueFullInformation,
fullInfo,
length,
&length
);

if ( NT_SUCCESS(status) )
{
RtlZeroMemory( wszPortName, sizeof(wszPortName));
RtlCopyMemory (
wszPortName,
((PUCHAR) fullInfo) + fullInfo->DataOffset,
fullInfo->DataLength
);
}

ExFreePool(fullInfo);
}

ZwClose(keyHandle);
}

return status;
}

elli


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

san,
It is fine. To get the list of the comport
already installed on the machine, go to the serial map
in the registry and then you will come to know what
all
port are available in the system
HKLM\HARDWARE\DEVICEMAP\SERIALCOMM. Make sure your
driver will put a signature here.

SAMPLE INF

----- BEGIN -----

[Version]
Signature=$CHICAGO$
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MFGNAME%

[Manufacturer]
%MFGNAME%=DeviceList

[DestinationDirs]
DefaultDestDir=10,System32\Drivers

[SourceDisksFiles]
URSERIAL.sys=1

[DeviceList]
%DESCRIPTION%=DriverInstall,VirtualComPort

; Windows 2000 Sections
[DriverInstall.NT]
CopyFiles=DriverCopyFiles

[DriverCopyFiles]
URSERIAL.sys,2

[DriverInstall.NT.Services]
AddService=URSERIAL,2,DriverService

[DriverService]
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%10%\system32\drivers\URSERIAL.sys

[DriverInstall.nt.hw]
AddReg=DriverHwAddReg

[DriverHwAddReg]

; Windows 98 Sections
[DriverInstall]
AddReg=DriverAddReg
CopyFiles=DriverCopyFiles

[DriverAddReg]
HKR,DevLoader,*ntkern
HKR,NTMPDriver,URSERIAL.sys

[DriverInstall.hw]
AddReg=DriverHwAddReg

; String Definitions
[Strings]
MFGNAME=“MY COMPANY.”
INSTDISK=“Installation Disk”
DESCRIPTION=“Virtual Serial Port”

---------- END ---------------

Cheers,
Jay

xxxxx@hotpop.com wrote:

I am taking following steps in Virtual COM driver,
is it right. (In Win
2k)

  1. In DriverEntry, all dispatch routines initialized
  2. In AddDevice, IoCreateDevice() used,
    IoAttach…()etc.
  3. In Pnp StartDevice, IoCreateSymbolicLink…()

Is it ok…?

How to get he list of COM ports in use in the
system. (Not the count of COM
ports). I want to use a free COM port name to create
symbolic link.

Any body can give a sample INF file for VCOM driver.

Thanks
SanWin


You are currently subscribed to ntdev as:
xxxxx@yahoo.com
To unsubscribe send a blank email to
leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com