From: Anatoly Greenblatt on
Hi,

I want to open a udp ipv6 connection in XP kernel. I am using the following
code but it fails in zwcreatefile with status 0xc0000207. Apparently the
tcpip!GetAddress routine return error if AddressType != TDI_ADDRESS_TYPE_IP.
Any ideas ? How should I open ipv6 transport address ? A sample code would
be highly appreciated.

Thanks,
Anatoly.


NTSTATUS CreateIPv6Address(PHANDLE pTdiHandle, PFILE_OBJECT *pFileObject)
{
NTSTATUS NtStatus = STATUS_INSUFFICIENT_RESOURCES;
UNICODE_STRING usTdiDriverNameString;
OBJECT_ATTRIBUTES oaTdiDriverNameAttributes;
IO_STATUS_BLOCK IoStatusBlock;
char DataBlob[sizeof(FILE_FULL_EA_INFORMATION) +
TDI_TRANSPORT_ADDRESS_LENGTH + 300] = {0};
PFILE_FULL_EA_INFORMATION pExtendedAttributesInformation =
(PFILE_FULL_EA_INFORMATION)&DataBlob;
UINT dwEASize = 0;
PTRANSPORT_ADDRESS pTransportAddress = NULL;
PTDI_ADDRESS_IP6 pTdiAddressIp6 = NULL;

RtlInitUnicodeString(&usTdiDriverNameString, L"\\Device\\Tcp");
InitializeObjectAttributes(&oaTdiDriverNameAttributes,
&usTdiDriverNameString,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL, NULL);

RtlCopyMemory(&pExtendedAttributesInformation->EaName,
TdiTransportAddress,
TDI_TRANSPORT_ADDRESS_LENGTH);

pExtendedAttributesInformation->EaNameLength =
TDI_TRANSPORT_ADDRESS_LENGTH;
pExtendedAttributesInformation->EaValueLength =
TDI_TRANSPORT_ADDRESS_LENGTH +
sizeof(TRANSPORT_ADDRESS) +
sizeof(TDI_ADDRESS_IP6);
pTransportAddress =
(PTRANSPORT_ADDRESS)(&pExtendedAttributesInformation->EaName +
TDI_TRANSPORT_ADDRESS_LENGTH + 1);

pTransportAddress->TAAddressCount = 1;

pTransportAddress->Address[0].AddressType = TDI_ADDRESS_TYPE_IP6;
pTransportAddress->Address[0].AddressLength = sizeof(TDI_ADDRESS_IP6);
pTdiAddressIp6 =
(TDI_ADDRESS_IP6 *)&pTransportAddress->Address[0].Address;

RtlZeroMemory(pTdiAddressIp6, sizeof(TDI_ADDRESS_IP6));

dwEASize = sizeof(DataBlob);

NtStatus = ZwCreateFile(pTdiHandle, FILE_READ_EA | FILE_WRITE_EA,
&oaTdiDriverNameAttributes,
&IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN_IF, 0,
pExtendedAttributesInformation, dwEASize);

if(NT_SUCCESS(NtStatus))
{
NtStatus = ObReferenceObjectByHandle(*pTdiHandle,
GENERIC_READ | GENERIC_WRITE,
NULL,
KernelMode,
(PVOID *)pFileObject, NULL);

if(!NT_SUCCESS(NtStatus))
{
ZwClose(*pTdiHandle);
}
}

return NtStatus;
}



From: TarasCo on
Have you installed "Advanced Networking Pack for Windows XP"? And You
probably should note \Device\Tcp6 instead of \Device\Tcp.

From: Anatoly Greenblatt on
Thanks Taras,

But if I want to make a UDP6 connection, should I open \device\tcp6 ? Do you
have any example that uses \device\udp?

Thanks again,
Anatoly.

"TarasCo" <tarasc0inbox(a)gmail.com> wrote in message
news:1185980520.157063.138810(a)g4g2000hsf.googlegroups.com...
> Have you installed "Advanced Networking Pack for Windows XP"? And You
> probably should note \Device\Tcp6 instead of \Device\Tcp.
>


From: Maxim S. Shatskih on
> I want to open a udp ipv6 connection in XP kernel.

UDP has no connections :-)

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim(a)storagecraft.com
http://www.storagecraft.com

From: Maxim S. Shatskih on
No. For UDP, he needs \Device\Udp and \Device\Udp6

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim(a)storagecraft.com
http://www.storagecraft.com

"TarasCo" <tarasc0inbox(a)gmail.com> wrote in message
news:1185980520.157063.138810(a)g4g2000hsf.googlegroups.com...
> Have you installed "Advanced Networking Pack for Windows XP"? And You
> probably should note \Device\Tcp6 instead of \Device\Tcp.
>