Hello. I am trying to disable Out Of Bounds InLine by creating an IOCTL_TCP_SET_INFORMATION_EX IRP (which I assume is the same as an app calling setsockopt(a0, SOL_SOCKET, SO_OOBINLINE,…)).
My code builds and runs but IoCallDriver returns an invalid parameter status. Here is my code below. Does anyone see which parameter is invalid? I would appreciate any comments. I really need expedited data to come in via an receive expedited call back. If I have the app call setsockopt then expedited data indeed comes in on my expedited receive event callback, but calling that from the app is not acceptabel in the end product. Needs to be done from my driver.
PTCP_REQUEST_SET_INFORMATION_EX pSetInformation;
KEVENT TdiCompletionContext;
PIO_STACK_LOCATION StackLocation;
IO_STATUS_BLOCK IoStatusBlock = {0};
KeInitializeEvent(&TdiCompletionContext, NotificationEvent, FALSE);
pSetInformation = (PTCP_REQUEST_SET_INFORMATION_EX) ExAllocatePool(NonPagedPool, sizeof(TCP_REQUEST_SET_INFORMATION_EX) + size);
if (pSetInformation == NULL) {
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlZeroMemory ( pSetInformation, sizeof(TCP_REQUEST_SET_INFORMATION_EX) + size);
// set tdi obj struct
pSetInformation->ID.toi_entity.tei_entity = CO_TL_ENTITY;
pSetInformation->ID.toi_entity.tei_instance = 0;
pSetInformation->ID.toi_class = INFO_CLASS_PROTOCOL;
pSetInformation->ID.toi_type = INFO_TYPE_CONNECTION;
pSetInformation->ID.toi_id = TCP_SOCKET_OOBINLINE;
RtlMoveMemory(pSetInformation->Buffer, pBuf, size);
pSetInformation->BufferSize = size;
irp = IoBuildDeviceIoControlRequest(IOCTL_TCP_SET_INFORMATION_EX,
DeviceObject, // TDI device
(PVOID)pSetInformation,
sizeof(TCP_REQUEST_SET_INFORMATION_EX) + size,
NULL,
0,
FALSE,
&TdiCompletionContext,
&IoStatusBlock);
if (!irp) {
return STATUS_INSUFFICIENT_RESOURCES;
}
StackLocation = IoGetNextIrpStackLocation(irp);
StackLocation->DeviceObject = DeviceObject; // TDI device
StackLocation->FileObject = fileObject; // Connect file object
NtStatus = IoCallDriver(DeviceObject, irp);