Author: jgardou Date: Mon Nov 10 21:37:25 2014 New Revision: 65370
URL: http://svn.reactos.org/svn/reactos?rev=65370&view=rev Log: [TCPIP] - Add skeleton code to handle IOCTL_TCP_SET_INFORMATION_EX
Modified: branches/tcpip_revolution/drivers/network/tcpip/information.c branches/tcpip_revolution/drivers/network/tcpip/information.h branches/tcpip_revolution/drivers/network/tcpip/main.c
Modified: branches/tcpip_revolution/drivers/network/tcpip/information.c URL: http://svn.reactos.org/svn/reactos/branches/tcpip_revolution/drivers/network... ============================================================================== --- branches/tcpip_revolution/drivers/network/tcpip/information.c [iso-8859-1] (original) +++ branches/tcpip_revolution/drivers/network/tcpip/information.c [iso-8859-1] Mon Nov 10 21:37:25 2014 @@ -16,17 +16,23 @@ _Out_opt_ PVOID OutBuffer, _Inout_ ULONG* BufferSize);
+typedef NTSTATUS (*SET_INFO_HANDLER)( + _In_ TDIEntityID ID, + _In_ PVOID InBuffer, + _In_ ULONG BufferSize); + static struct { ULONG Entity, Class, Type, Id; - QUERY_INFO_HANDLER Handler; + QUERY_INFO_HANDLER QueryHandler; + SET_INFO_HANDLER SetHandler;
} InfoHandlers[] = { - { GENERIC_ENTITY, INFO_CLASS_GENERIC, INFO_TYPE_PROVIDER, ENTITY_LIST_ID, QueryEntityList }, - { IF_ENTITY, INFO_CLASS_PROTOCOL, INFO_TYPE_PROVIDER, IP_MIB_STATS_ID, QueryInterfaceEntry}, - { CL_NL_ENTITY, INFO_CLASS_PROTOCOL, INFO_TYPE_PROVIDER, IP_MIB_ADDRTABLE_ENTRY_ID, QueryInterfaceAddrTable}, + { GENERIC_ENTITY, INFO_CLASS_GENERIC, INFO_TYPE_PROVIDER, ENTITY_LIST_ID, QueryEntityList, NULL }, + { IF_ENTITY, INFO_CLASS_PROTOCOL, INFO_TYPE_PROVIDER, IP_MIB_STATS_ID, QueryInterfaceEntry, NULL }, + { CL_NL_ENTITY, INFO_CLASS_PROTOCOL, INFO_TYPE_PROVIDER, IP_MIB_ADDRTABLE_ENTRY_ID, QueryInterfaceAddrTable, NULL }, { (ULONG)-1, (ULONG)-1, (ULONG)-1, (ULONG)-1, NULL } };
@@ -95,14 +101,14 @@ }
/* Find the handler for this particular query */ - for (i = 0; InfoHandlers[i].Handler != NULL; i++) + for (i = 0; InfoHandlers[i].Entity != (ULONG)-1; i++) { if ((InfoHandlers[i].Entity == Query->ID.toi_entity.tei_entity) && (InfoHandlers[i].Class == Query->ID.toi_class) && (InfoHandlers[i].Type == Query->ID.toi_type) && (InfoHandlers[i].Id == Query->ID.toi_id)) { - Handler = InfoHandlers[i].Handler; + Handler = InfoHandlers[i].QueryHandler; break; } } @@ -177,3 +183,44 @@ IoCompleteRequest(Irp, IO_NETWORK_INCREMENT); return Status; } + +NTSTATUS +TcpIpSetInformation( + _Inout_ PIRP Irp +) +{ + TCP_REQUEST_SET_INFORMATION_EX* Query; + SET_INFO_HANDLER Handler = NULL; + NTSTATUS Status; + ULONG i; + + /* Get the input buffer */ + Query = Irp->AssociatedIrp.SystemBuffer; + + /* Find the handler for this particular query */ + for (i = 0; InfoHandlers[i].Entity != (ULONG)-1; i++) + { + if ((InfoHandlers[i].Entity == Query->ID.toi_entity.tei_entity) && + (InfoHandlers[i].Class == Query->ID.toi_class) && + (InfoHandlers[i].Type == Query->ID.toi_type) && + (InfoHandlers[i].Id == Query->ID.toi_id)) + { + Handler = InfoHandlers[i].SetHandler; + break; + } + } + + if (!Handler) + { + DPRINT1("TCPIP - Unknown query: entity 0x%x, class 0x%x, type 0x%x, Id 0x%x.\n", + Query->ID.toi_entity.tei_entity, Query->ID.toi_class, Query->ID.toi_type, Query->ID.toi_id); + return STATUS_NOT_IMPLEMENTED; + } + + Status = Handler(Query->ID.toi_entity, &Query->Buffer, Query->BufferSize); + + if (NT_SUCCESS(Status)) + Irp->IoStatus.Information = Query->BufferSize; + + return Status; +}
Modified: branches/tcpip_revolution/drivers/network/tcpip/information.h URL: http://svn.reactos.org/svn/reactos/branches/tcpip_revolution/drivers/network... ============================================================================== --- branches/tcpip_revolution/drivers/network/tcpip/information.h [iso-8859-1] (original) +++ branches/tcpip_revolution/drivers/network/tcpip/information.h [iso-8859-1] Mon Nov 10 21:37:25 2014 @@ -10,3 +10,8 @@ TcpIpQueryKernelInformation( _In_ PIRP Irp ); + +NTSTATUS +TcpIpSetInformation( + _Inout_ PIRP Irp +);
Modified: branches/tcpip_revolution/drivers/network/tcpip/main.c URL: http://svn.reactos.org/svn/reactos/branches/tcpip_revolution/drivers/network... ============================================================================== --- branches/tcpip_revolution/drivers/network/tcpip/main.c [iso-8859-1] (original) +++ branches/tcpip_revolution/drivers/network/tcpip/main.c [iso-8859-1] Mon Nov 10 21:37:25 2014 @@ -455,8 +455,7 @@ break;
case IOCTL_TCP_SET_INFORMATION_EX: - DPRINT1("TCPIP: Should handle IOCTL_TCP_SET_INFORMATION_EX.\n"); - Status = STATUS_NOT_IMPLEMENTED; + Status = TcpIpSetInformation(Irp); break;
case IOCTL_SET_IP_ADDRESS: