A forum for reverse engineering, OS internals and malware analysis 

Ask your beginner questions here.
 #29211  by Carlbyte
 Sat Sep 10, 2016 6:49 pm
Anyone know how to send an IOCTL_TDI_TL_IO_CONTROL_ENDPOINT using NtDeviceIoControlFile? I searched and not found any documentation on this subject.

typedef struct _TDI_TL_IO_CONTROL_ENDPOINT {
TDI_TL_IO_CONTROL_TYPE Type;
ULONG Level;
union {
ULONG IoControlCode;
ULONG OptionName;
};
__field_bcount(InputBufferLength) PVOID InputBuffer;
ULONG InputBufferLength;
__field_bcount(OutputBufferLength) PVOID OutputBuffer;
ULONG OutputBufferLength;
} TDI_TL_IO_CONTROL_ENDPOINT, *PTDI_TL_IO_CONTROL_ENDPOINT;
 #29213  by Brock
 Sun Sep 11, 2016 10:17 pm
TDI_TL_IO_CONTROL_ENDPOINT "Type" struct member would likely have to be GetSockOptIoControlType defined in this enum from what I see at first glance:
Code: Select all
typedef enum {
    EndpointIoControlType,
    SetSockOptIoControlType,
    GetSockOptIoControlType,
    SocketIoControlType,
} TDI_TL_IO_CONTROL_TYPE, *PTDI_TL_IO_CONTROL_TYPE;
Level and Option Name (OptName) would probably coincide with Winsock's GetSockOpt() input params, named identically as Level and Optname:
Code: Select all
int getsockopt(
  _In_    SOCKET s,
  _In_    int    level,
  _In_    int    optname,
  _Out_   char   *optval,
  _Inout_ int    *optlen
);