#include "precomp.h"
Go to the source code of this file.
|
VOID | XNdisGetFirstBufferFromPacket (PNDIS_PACKET Packet, PNDIS_BUFFER *FirstBuffer, PVOID *FirstBufferVA, PUINT FirstBufferLength, PUINT TotalBufferLength) |
|
VOID | XNdisQueryBuffer (PNDIS_BUFFER Buffer, PVOID *VirtualAddress, PUINT Length) |
|
__inline INT | SkipToOffset (PNDIS_BUFFER Buffer, UINT Offset, PCHAR *Data, PUINT Size) |
|
UINT | CopyBufferToBufferChain (PNDIS_BUFFER DstBuffer, UINT DstOffset, PCHAR SrcData, UINT Length) |
|
UINT | CopyBufferChainToBuffer (PCHAR DstData, PNDIS_BUFFER SrcBuffer, UINT SrcOffset, UINT Length) |
|
UINT | CopyPacketToBuffer (PCHAR DstData, PNDIS_PACKET SrcPacket, UINT SrcOffset, UINT Length) |
|
UINT | CopyPacketToBufferChain (PNDIS_BUFFER DstBuffer, UINT DstOffset, PNDIS_PACKET SrcPacket, UINT SrcOffset, UINT Length) |
|
PVOID | AdjustPacket (PNDIS_PACKET Packet, UINT Available, UINT Needed) |
|
UINT | ResizePacket (PNDIS_PACKET Packet, UINT Size) |
|
NDIS_STATUS | PrependPacket (PNDIS_PACKET Packet, PCHAR Data, UINT Length, BOOLEAN Copy) |
|
void | GetDataPtr (PNDIS_PACKET Packet, UINT Offset, PCHAR *DataOut, PUINT Size) |
|
NDIS_STATUS | AllocatePacketWithBufferX (PNDIS_PACKET *NdisPacket, PCHAR Data, UINT Len, PCHAR File, UINT Line) |
|
VOID | FreeNdisPacketX (PNDIS_PACKET Packet, PCHAR File, UINT Line) |
|
◆ AdjustPacket()
Definition at line 334 of file mockbuffer.c.
347{
350
352
353 Adjust = Available - Needed;
354
356
357
358
361 NdisBuffer->ByteOffset +=
Adjust;
362 NdisBuffer->ByteCount -=
Adjust;
363 }
364
365 return NdisBuffer->MappedSystemVa;
366}
#define TI_DbgPrint(_t_, _x_)
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
static __inline VOID NdisQueryPacket(IN PNDIS_PACKET Packet, OUT PUINT PhysicalBufferCount OPTIONAL, OUT PUINT BufferCount OPTIONAL, OUT PNDIS_BUFFER *FirstBuffer OPTIONAL, OUT PUINT TotalPacketLength OPTIONAL)
static LONGLONG Adjust(LONGLONG value, const LONGLONG *pModifier, DWORD dwFlags)
◆ AllocatePacketWithBufferX()
Definition at line 425 of file mockbuffer.c.
427 {
432
435
438
443 }
445
450 }
452
455
457}
VOID EXPORT NdisAllocateBuffer(OUT PNDIS_STATUS Status, OUT PNDIS_BUFFER *Buffer, IN NDIS_HANDLE PoolHandle, IN PVOID VirtualAddress, IN UINT Length)
VOID EXPORT NdisAllocatePacket(OUT PNDIS_STATUS Status, OUT PNDIS_PACKET *Packet, IN NDIS_HANDLE PoolHandle)
NDIS_HANDLE GlobalBufferPool
NDIS_HANDLE GlobalPacketPool
#define exAllocatePool(x, y)
#define TrackWithTag(w, x, y, z)
#define FreeNdisPacket(x)
#define NDIS_STATUS_SUCCESS
#define NDIS_STATUS_NOT_ACCEPTED
#define NdisChainBufferAtFront(Packet, Buffer)
#define RtlCopyMemory(Destination, Source, Length)
◆ CopyBufferChainToBuffer()
Definition at line 157 of file mockbuffer.c.
175{
178
180
181
182 if (
SkipToOffset(SrcBuffer, SrcOffset, &SrcData, &SrcSize) == -1)
183 return 0;
184
185
187 for (;;) {
189
191
195
198 break;
199
201 if (SrcSize == 0) {
202
203
205 if (!SrcBuffer)
206 break;
207
209 }
210 }
211
213}
VOID XNdisQueryBuffer(PNDIS_BUFFER Buffer, PVOID *VirtualAddress, PUINT Length)
__inline INT SkipToOffset(PNDIS_BUFFER Buffer, UINT Offset, PCHAR *Data, PUINT Size)
#define NdisGetNextBuffer(CurrentBuffer, NextBuffer)
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT _Out_ PUINT BytesCopied
_In_ UINT _In_ UINT BytesToCopy
_In_ ULONG _In_ ULONG _In_ ULONG Length
Referenced by CopyPacketToBuffer().
◆ CopyBufferToBufferChain()
Definition at line 100 of file mockbuffer.c.
118{
121
123
124
125 if (
SkipToOffset(DstBuffer, DstOffset, &DstData, &DstSize) == -1)
126 return 0;
127
128
130 for (;;) {
132
136
139 break;
140
142 if (DstSize == 0) {
143
144
146 if (!DstBuffer)
147 break;
148
150 }
151 }
152
154}
◆ CopyPacketToBuffer()
Definition at line 216 of file mockbuffer.c.
234{
239
241
243 &FirstBuffer,
245 &FirstLength,
247
249}
UINT CopyBufferChainToBuffer(PCHAR DstData, PNDIS_BUFFER SrcBuffer, UINT SrcOffset, UINT Length)
VOID XNdisGetFirstBufferFromPacket(PNDIS_PACKET Packet, PNDIS_BUFFER *FirstBuffer, PVOID *FirstBufferVA, PUINT FirstBufferLength, PUINT TotalBufferLength)
◆ CopyPacketToBufferChain()
Definition at line 252 of file mockbuffer.c.
272{
274 PCHAR DstData, SrcData;
275 UINT DstSize, SrcSize;
277
278 TI_DbgPrint(
DEBUG_PBUFFER, (
"DstBuffer (0x%X) DstOffset (0x%X) SrcPacket (0x%X) SrcOffset (0x%X) Length (%d)\n", DstBuffer, DstOffset, SrcPacket, SrcOffset,
Length));
279
280
282 if (
SkipToOffset(DstBuffer, DstOffset, &DstData, &DstSize) == -1)
283 return 0;
284
285
287 if (
SkipToOffset(SrcBuffer, SrcOffset, &SrcData, &SrcSize) == -1)
288 return 0;
289
290
291 for (Total = 0;;) {
292
295 else
299
301
305 break;
306
308 if (DstSize == 0) {
309
310
312 if (!DstBuffer)
313 break;
314
316 }
317
319 if (SrcSize == 0) {
320
321
323 if (!SrcBuffer)
324 break;
325
327 }
328 }
329
330 return Total;
331}
◆ FreeNdisPacketX()
Definition at line 460 of file mockbuffer.c.
469{
471
473
474
479
485 }
486
487
490}
VOID EXPORT NdisFreePacket(IN PNDIS_PACKET Packet)
#define UntrackFL(x, y, z)
◆ GetDataPtr()
◆ PrependPacket()
Definition at line 394 of file mockbuffer.c.
395 {
399
404 }
else NewBuf =
Data;
405
408
410
412}
VOID Copy(PVOID Src, PVOID Dst, ULONG NumBytes)
PVOID PoolAllocateBuffer(ULONG Size)
◆ ResizePacket()
Definition at line 369 of file mockbuffer.c.
380{
383
385
386 OldSize = NdisBuffer->ByteCount;
387
389 NdisBuffer->ByteCount =
Size;
390
391 return OldSize;
392}
◆ SkipToOffset()
◆ XNdisGetFirstBufferFromPacket()
Definition at line 13 of file mockbuffer.c.
18{
20
21 _Buffer = (
Packet)->Private.Head;
22 *(FirstBuffer) = _Buffer;
24 if (_Buffer !=
NULL) {
26 _Buffer = _Buffer->Next;
27 } else
28 *(FirstBufferLength) = 0;
29 *(TotalBufferLength) = *(FirstBufferLength);
30 while (_Buffer !=
NULL) {
32 _Buffer = _Buffer->Next;
33 }
34}
#define MmGetMdlByteCount(_Mdl)
#define MmGetMdlVirtualAddress(_Mdl)
Referenced by CopyPacketToBuffer(), and CopyPacketToBufferChain().
◆ XNdisQueryBuffer()