Xuy and Wang get the donut. Naveen you gotta study a little bit more.
Ya gotta be able to spell folks. I can’t count the number of times I’ve seen
the same question posted, but this time I see at least 1 answer that
concatenated the same misspelling. It is “DosDevices”, and NOT “DosDevice”.
Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@Broadstor.com
xxxxx@inland.net
-----Original Message-----
From: xuye [mailto:xxxxx@genius-soft.com]
Sent: Thursday, July 12, 2001 3:56 AM
To: NT Developers Interest List
Subject: [ntdev] Re: a viatual com port driver
try this:
UNICODE_STRING DevName;
RtlInitUnicodeString(&DevName, L"\Device\VirCom");
status = IoCreateDevice (DriverObject,
sizeof(VIRCOM_DEVICE_EXTENSION),
&DevName,
FILE_DEVICE_SERIAL_PORT,
FILE_DEVICE_SECURE_OPEN,
TRUE,
&fdo);
if( !NT_SUCCESS(status))
return status;
// Remember fdo in our device extension
PWDM1_DEVICE_EXTENSION dx = (PWDM1_DEVICE_EXTENSION)fdo->DeviceExtension;
dx->fdo = fdo;
DebugPrint(“FDO is %x”,fdo);
RtlInitUnicodeString(&dx->ifSymLinkName, L"\DosDevices\Com");
RtlZeroMemory(dx->ifSymLinkName.Buffer,dx->ifSymLinkName.MaximumLength);
RtlAppendUnicodeToString(&dx->ifSymLinkName, L"\DosDevices\Com");
status = IoCreateSymbolicLink (&dx->ifSymLinkName,
&DevName);
if (!NT_SUCCESS(status)) {
DebugPrint(“Error: IoCreateSymbolicLink Failed, ErrCode =
%x”,status);
IoDeleteDevice(fdo);
return status;
}
----- Original Message -----
From:
To: “NT Developers Interest List”
Sent: Thursday, July 12, 2001 4:57 PM
Subject: [ntdev] Re: a viatual com port driver
> Yea,I have done, my code is the bellow:
>
> UNICODE_STRING DevName;
>
> RtlZeroMemory(&DevName, sizeof(UNICODE_STRING));
>
> DevName.MaximumLength = 128 * sizeof(WCHAR);
> DevName.Buffer = (unsigned short*)ExAllocatePool(PagedPool,
> DevName.MaximumLength+sizeof(WCHAR));
>
>
> if (DevName.Buffer == NULL) {
> return STATUS_INSUFFICIENT_RESOURCES;
> }
>
> RtlZeroMemory(DevName.Buffer, DevName.MaximumLength + sizeof(WCHAR));
> RtlAppendUnicodeToString(&DevName, L"\Device\VirCom");
>
> status = IoCreateDevice (DriverObject,
> sizeof(VIRCOM_DEVICE_EXTENSION),
> &DevName,
> FILE_DEVICE_SERIAL_PORT,
> FILE_DEVICE_SECURE_OPEN,
> TRUE,
> &fdo);
> if( !NT_SUCCESS(status))
> return status;
>
> // Remember fdo in our device extension
> PWDM1_DEVICE_EXTENSION dx = (PWDM1_DEVICE_EXTENSION)fdo->DeviceExtension;
> dx->fdo = fdo;
> DebugPrint(“FDO is %x”,fdo);
>
>
> dx->ifSymLinkName.MaximumLength = DevName.Length + sizeof(WCHAR);
> dx->ifSymLinkName.Buffer = (unsigned short *)
> ExAllocatePool(PagedPool, DevName.MaximumLength + sizeof(WCHAR));
>
>
> if(!dx->ifSymLinkName.Buffer)
> {
> DebugPrint(“Error: Couldn’t allocate memory for
> dx->ifSymLinkName!”);
> status = STATUS_INSUFFICIENT_RESOURCES;
> return status;
> }
>
>
RtlZeroMemory(dx->ifSymLinkName.Buffer,dx->ifSymLinkName.MaximumLength);
> RtlAppendUnicodeToString(&dx->ifSymLinkName, L"\DosDevices\Com");
>
> status = IoCreateSymbolicLink (&dx->ifSymLinkName,
> &DevName);
>
> if (!NT_SUCCESS(status)) {
> DebugPrint(“Error: IoCreateSymbolicLink Failed, ErrCode =
> %x”,status);
> IoDeleteDevice(fdo);
> return status;
> }
>
> But it still not work, What wrong with me?
>
> Thanks in advance!
>
> Best regards
> misshome
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@genius-soft.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
b‹šç.®·§¶\¬¹??Þv?µ×¯j?ŠÛeyºèi?¢·(?.žË›±Êâm?Ö›•©äzf¢–?y«Þž×^¿~w?b²Û(²·(
—
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