Buffer issues

OK, this might be offtopic, but td I really dn’t know where to ask abt it,
but here!

I am testing an ndis driver. And for that I need an LSP to filter out the
data sent by applications to the driver.

I see a strangething (atlesat to me) in the LSP call.

I am using the sample LSP code that comes with the platform SDK.

In the overlapped receive case, teh function
IntermediateCompletionRoutine(…) is called (overlapped.c)

So In the case of receive (olp->Operation = LSP_OP_RECV) I am supposed to
get a valid set of WSABUFs

Now look at the structure dump below.

+0x030 RecvArgs : struct _RECVARGS, 4 elements, 0x10 bytes
+0x000 lpBuffers : 0x00b3efa0
+0x004 dwBufferCount : 1
+0x008 dwNumberOfBytesRecvd : 0
+0x00c dwFlags : 0

I am gettinga valid buffer, with a valid buffer count but the
dwNumberOfBytesRecvd is 0. Why is that so???

I have also seen the other case where dwNumberOfBytesRecvd =2,
dwBufferCount = 1, but lpBuffers is a NULL pointer.

Can someone please throw some light on the issue.

Dumped below is the whole structure for your reference.

amitr0

0:012> dt -v -b _WSAOVERLAPPEDPLUS 0x00d660e8
struct _WSAOVERLAPPEDPLUS, 24 elements, 0xe0 bytes
+0x000 ProviderOverlapped : struct _OVERLAPPED, 6 elements, 0x14 bytes
+0x000 Internal : 0
+0x004 InternalHigh : 2
+0x008 Offset : 0
+0x00c OffsetHigh : 0
+0x008 Pointer : (null)
+0x010 hEvent : (null)
+0x014 Provider : 0x00d66aa8
+0x018 SockInfo : 0x00d66078
+0x01c CallerSocket : 0x294
+0x020 ProviderSocket : 0x28c
+0x024 Iocp : (null)
+0x028 Error : 0
+0x02c CloseThread : 0
+0x030 AcceptExArgs : struct _ACCEPTEXARGS, 7 elements, 0x1c bytes
+0x000 sAcceptSocket : 0xb3efa0
+0x004 sProviderAcceptSocket : 1
+0x008 lpOutputBuffer : (null)
+0x00c dwReceiveDataLength : 0
+0x010 dwLocalAddressLength : 0
+0x014 dwRemoteAddressLength : 0
+0x018 dwBytesReceived : 0
+0x030 TransmitFileArgs : struct _TRANSMITFILEARGS, 5 elements, 0x14
bytes
+0x000 hFile : 0x00b3efa0
+0x004 nNumberOfBytesToWrite : 1
+0x008 nNumberOfBytesPerSend : 0
+0x00c lpTransmitBuffers : (null)
+0x010 dwFlags : 0
+0x030 ConnectExArgs : struct _CONNECTEXARGS, 6 elements, 0x94 bytes
+0x000 s : 0xb3efa0
+0x004 name : struct sockaddr_storage, 4 elements, 0x80
bytes
+0x000 ss_family : 1
+0x002 __ss_pad1 : (6 elements) “”
[00] 0 ‘’
[01] 0 ‘’
[02] 0 ‘’
[03] 0 ‘’
[04] 0 ‘’
[05] 0 ‘’
+0x008 __ss_align : 0
+0x010 __ss_pad2 : (112 elements) “”
[00] 0 ‘’
[01] 0 ‘’
[02] 0 ‘’
[03] 0 ‘’
[04] 0 ‘’
[05] 0 ‘’
[06] 0 ‘’
[07] 0 ‘’
[08] 0 ‘’
[09] 0 ‘’
[10] 0 ‘’
[11] 0 ‘’
[12] 0 ‘’
[13] 0 ‘’
[14] 0 ‘’
[15] 0 ‘’
[16] 0 ‘’
[17] 0 ‘’
[18] 0 ‘’
[19] 0 ‘’
[20] 0 ‘’
[21] 0 ‘’
[22] 0 ‘’
[23] 0 ‘’
[24] 0 ‘’
[25] 0 ‘’
[26] 0 ‘’
[27] 0 ‘’
[28] 0 ‘’
[29] 0 ‘’
[30] 0 ‘’
[31] 0 ‘’
[32] 0 ‘’
[33] 0 ‘’
[34] 0 ‘’
[35] 0 ‘’
[36] 0 ‘’
[37] 0 ‘’
[38] 0 ‘’
[39] 0 ‘’
[40] 0 ‘’
[41] 0 ‘’
[42] 0 ‘’
[43] 0 ‘’
[44] 0 ‘’
[45] 0 ‘’
[46] 0 ‘’
[47] 0 ‘’
[48] 0 ‘’
[49] 0 ‘’
[50] 0 ‘’
[51] 0 ‘’
[52] 0 ‘’
[53] 0 ‘’
[54] 0 ‘’
[55] 0 ‘’
[56] 0 ‘’
[57] 0 ‘’
[58] 0 ‘’
[59] 0 ‘’
[60] 0 ‘’
[61] 0 ‘’
[62] 0 ‘’
[63] 0 ‘’
[64] 0 ‘’
[65] 0 ‘’
[66] 0 ‘’
[67] 0 ‘’
[68] 0 ‘’
[69] 0 ‘’
[70] 0 ‘’
[71] 0 ‘’
[72] 0 ‘’
[73] 0 ‘’
[74] 0 ‘’
[75] 0 ‘’
[76] 0 ‘’
[77] 0 ‘’
[78] 0 ‘’
[79] 0 ‘’
[80] 0 ‘’
[81] 0 ‘’
[82] 0 ‘’
[83] 0 ‘’
[84] 0 ‘’
[85] 0 ‘’
[86] 0 ‘’
[87] 0 ‘’
[88] 0 ‘’
[89] 0 ‘’
[90] 0 ‘’
[91] 0 ‘’
[92] 0 ‘’
[93] 0 ‘’
[94] 0 ‘’
[95] 0 ‘’
[96] 0 ‘’
[97] 0 ‘’
[98] 0 ‘’
[99] 0 ‘’
[100] 0 ‘’
[101] 0 ‘’
[102] 0 ‘’
[103] 0 ‘’
[104] 0 ‘’
[105] 0 ‘’
[106] 0 ‘’
[107] 0 ‘’
[108] 0 ‘’
[109] 0 ‘’
[110] 0 ‘’
[111] 0 ‘’
+0x084 namelen : 0
+0x088 lpSendBuffer : (null)
+0x08c dwSendDataLength : 0
+0x090 dwBytesSent : 0
+0x030 TransmitPacketsArgs : struct _TRANSMITPACKETSARGS, 5 elements,
0x14 bytes
+0x000 s : 0xb3efa0
+0x004 lpPacketArray : 0x00000001
+0x008 nElementCount : 0
+0x00c nSendSize : 0
+0x010 dwFlags : 0
+0x030 DisconnectExArgs : struct _DISCONNECTEXARGS, 3 elements, 0xc bytes
+0x000 s : 0xb3efa0
+0x004 dwFlags : 1
+0x008 dwReserved : 0
+0x030 WSARecvMsgArgs : struct _WSARECVMSGARGS, 3 elements, 0xc bytes
+0x000 s : 0xb3efa0
+0x004 lpMsg : 0x00000001
+0x008 dwNumberOfBytesRecvd : 0
+0x030 RecvArgs : struct _RECVARGS, 4 elements, 0x10 bytes
+0x000 lpBuffers : 0x00b3efa0
+0x004 dwBufferCount : 1
+0x008 dwNumberOfBytesRecvd : 0
+0x00c dwFlags : 0
+0x030 RecvFromArgs : struct _RECVFROMARGS, 6 elements, 0x18 bytes
+0x000 lpBuffers : 0x00b3efa0
+0x004 dwBufferCount : 1
+0x008 dwNumberOfBytesRecvd : 0
+0x00c dwFlags : 0
+0x010 lpFrom : (null)
+0x014 lpFromLen : (null)
+0x030 SendArgs : struct _SENDARGS, 4 elements, 0x10 bytes
+0x000 lpBuffers : 0x00b3efa0
+0x004 dwBufferCount : 1
+0x008 dwNumberOfBytesSent : 0
+0x00c dwFlags : 0
+0x030 SendToArgs : struct _SENDTOARGS, 6 elements, 0x94 bytes
+0x000 lpBuffers : 0x00b3efa0
+0x004 dwBufferCount : 1
+0x008 dwNumberOfBytesSent : 0
+0x00c dwFlags : 0
+0x010 To : struct sockaddr_storage, 4 elements, 0x80
bytes
+0x000 ss_family : 0
+0x002 __ss_pad1 : (6 elements) “”
[00] 0 ‘’
[01] 0 ‘’
[02] 0 ‘’
[03] 0 ‘’
[04] 0 ‘’
[05] 0 ‘’
+0x008 __ss_align : 0
+0x010 __ss_pad2 : (112 elements) “”
[00] 0 ‘’
[01] 0 ‘’
[02] 0 ‘’
[03] 0 ‘’
[04] 0 ‘’
[05] 0 ‘’
[06] 0 ‘’
[07] 0 ‘’
[08] 0 ‘’
[09] 0 ‘’
[10] 0 ‘’
[11] 0 ‘’
[12] 0 ‘’
[13] 0 ‘’
[14] 0 ‘’
[15] 0 ‘’
[16] 0 ‘’
[17] 0 ‘’
[18] 0 ‘’
[19] 0 ‘’
[20] 0 ‘’
[21] 0 ‘’
[22] 0 ‘’
[23] 0 ‘’
[24] 0 ‘’
[25] 0 ‘’
[26] 0 ‘’
[27] 0 ‘’
[28] 0 ‘’
[29] 0 ‘’
[30] 0 ‘’
[31] 0 ‘’
[32] 0 ‘’
[33] 0 ‘’
[34] 0 ‘’
[35] 0 ‘’
[36] 0 ‘’
[37] 0 ‘’
[38] 0 ‘’
[39] 0 ‘’
[40] 0 ‘’
[41] 0 ‘’
[42] 0 ‘’
[43] 0 ‘’
[44] 0 ‘’
[45] 0 ‘’
[46] 0 ‘’
[47] 0 ‘’
[48] 0 ‘’
[49] 0 ‘’
[50] 0 ‘’
[51] 0 ‘’
[52] 0 ‘’
[53] 0 ‘’
[54] 0 ‘’
[55] 0 ‘’
[56] 0 ‘’
[57] 0 ‘’
[58] 0 ‘’
[59] 0 ‘’
[60] 0 ‘’
[61] 0 ‘’
[62] 0 ‘’
[63] 0 ‘’
[64] 0 ‘’
[65] 0 ‘’
[66] 0 ‘’
[67] 0 ‘’
[68] 0 ‘’
[69] 0 ‘’
[70] 0 ‘’
[71] 0 ‘’
[72] 0 ‘’
[73] 0 ‘’
[74] 0 ‘’
[75] 0 ‘’
[76] 0 ‘’
[77] 0 ‘’
[78] 0 ‘’
[79] 0 ‘’
[80] 0 ‘’
[81] 0 ‘’
[82] 0 ‘’
[83] 0 ‘’
[84] 0 ‘’
[85] 0 ‘’
[86] 0 ‘’
[87] 0 ‘’
[88] 0 ‘’
[89] 0 ‘’
[90] 0 ‘’
[91] 0 ‘’
[92] 0 ‘’
[93] 0 ‘’
[94] 0 ‘’
[95] 0 ‘’
[96] 0 ‘’
[97] 0 ‘’
[98] 0 ‘’
[99] 0 ‘’
[100] 0 ‘’
[101] 0 ‘’
[102] 0 ‘’
[103] 0 ‘’
[104] 0 ‘’
[105] 0 ‘’
[106] 0 ‘’
[107] 0 ‘’
[108] 0 ‘’
[109] 0 ‘’
[110] 0 ‘’
[111] 0 ‘’
+0x090 iToLen : 0
+0x030 IoctlArgs : struct _IOCTLARGS, 6 elements, 0x18 bytes
+0x000 dwIoControlCode : 0xb3efa0
+0x004 lpvInBuffer : 0x00000001
+0x008 cbInBuffer : 0
+0x00c lpvOutBuffer : (null)
+0x010 cbOutBuffer : 0
+0x014 cbBytesReturned : 0
+0x0c4 Operation : Enum LspOperation, 11 total enums
2 ( LSP_OP_RECV )
+0x0c8 CallerThreadId : struct _WSATHREADID, 2 elements, 0x8 bytes
+0x000 ThreadHandle : 0x00000214
+0x004 Reserved : 0x1c4
+0x0d0 lpCallerOverlapped : 0x006e685c
+0x0d4 lpCallerCompletionRoutine : 0x0025132f
+0x0d8 Link : struct _LIST_ENTRY, 2 elements, 0x8 bytes
[0x0 - 0x0]
+0x000 Flink : (null)
+0x004 Blink : (null)

  • amitr0