#include "precomp.h"
Go to the source code of this file.
|
static 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) |
|
UINT | ResizePacket (PNDIS_PACKET Packet, UINT Size) |
|
void | GetDataPtr (PNDIS_PACKET Packet, UINT Offset, PCHAR *DataOut, PUINT Size) |
|
NDIS_STATUS | AllocatePacketWithBuffer (PNDIS_PACKET *NdisPacket, PCHAR Data, UINT Len) |
|
VOID | FreeNdisPacket (PNDIS_PACKET Packet) |
|
◆ AllocatePacketWithBuffer()
Definition at line 326 of file buffer.c.
327 {
332
335
337
342 }
343
349 }
350
353
355}
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)
#define ExAllocatePoolWithTag(hernya, size, tag)
NDIS_HANDLE GlobalBufferPool
NDIS_HANDLE GlobalPacketPool
#define FreeNdisPacket(x)
#define ExFreePoolWithTag(_P, _T)
_In_ NDIS_HANDLE _In_ PNDIS_PACKET Packet
#define NDIS_STATUS_SUCCESS
#define NdisChainBufferAtFront(Packet, Buffer)
#define NDIS_STATUS_RESOURCES
#define RtlCopyMemory(Destination, Source, Length)
◆ CopyBufferChainToBuffer()
Definition at line 113 of file buffer.c.
131{
134
136
137
138 if (
SkipToOffset(SrcBuffer, SrcOffset, &SrcData, &SrcSize) == -1)
139 return 0;
140
141
143 for (;;) {
145
147
151
154 break;
155
157 if (SrcSize == 0) {
158
159
161 if (!SrcBuffer)
162 break;
163
165 }
166 }
167
169}
FORCEINLINE ULONG SkipToOffset(IN PNDIS_BUFFER Buffer, IN UINT Offset, IN OUT PUCHAR *Data, IN OUT PUINT Size)
#define TI_DbgPrint(_t_, _x_)
#define NdisGetNextBuffer(CurrentBuffer, NextBuffer)
_In_ UINT _In_ UINT _In_ PNDIS_PACKET _In_ UINT _Out_ PUINT BytesCopied
_In_ UINT _In_ UINT BytesToCopy
#define NdisQueryBuffer(_Buffer, _VirtualAddress, _Length)
_In_ ULONG _In_ ULONG _In_ ULONG Length
◆ CopyBufferToBufferChain()
Definition at line 56 of file buffer.c.
74{
77
79
80
81 if (
SkipToOffset(DstBuffer, DstOffset, &DstData, &DstSize) == -1)
82 return 0;
83
84
86 for (;;) {
88
92
95 break;
96
98 if (DstSize == 0) {
99
100
102 if (!DstBuffer)
103 break;
104
106 }
107 }
108
110}
◆ CopyPacketToBuffer()
Definition at line 172 of file buffer.c.
190{
195
197
199 &FirstBuffer,
201 &FirstLength,
203
205}
UINT CopyBufferChainToBuffer(PUCHAR DstData, PNDIS_BUFFER SrcBuffer, UINT SrcOffset, UINT Length)
VOID EXPORT NdisGetFirstBufferFromPacket(IN PNDIS_PACKET _Packet, OUT PNDIS_BUFFER *_FirstBuffer, OUT PVOID *_FirstBufferVA, OUT PUINT _FirstBufferLength, OUT PUINT _TotalBufferLength)
◆ CopyPacketToBufferChain()
Definition at line 208 of file buffer.c.
228{
230 PCHAR DstData, SrcData;
231 UINT DstSize, SrcSize;
233
234 TI_DbgPrint(
DEBUG_PBUFFER, (
"DstBuffer (0x%X) DstOffset (0x%X) SrcPacket (0x%X) SrcOffset (0x%X) Length (%d)\n", DstBuffer, DstOffset, SrcPacket, SrcOffset,
Length));
235
236
238 if (
SkipToOffset(DstBuffer, DstOffset, &DstData, &DstSize) == -1)
239 return 0;
240
241
243 if (
SkipToOffset(SrcBuffer, SrcOffset, &SrcData, &SrcSize) == -1)
244 return 0;
245
246
247 for (Total = 0;;) {
248
251 else
255
257
261 break;
262
264 if (DstSize == 0) {
265
266
268 if (!DstBuffer)
269 break;
270
272 }
273
275 if (SrcSize == 0) {
276
277
279 if (!SrcBuffer)
280 break;
281
283 }
284 }
285
286 return Total;
287}
◆ FreeNdisPacket()
Definition at line 358 of file buffer.c.
365{
367
369
370
375
382 }
383
384
386}
VOID EXPORT NdisFreePacket(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)
◆ GetDataPtr()
Definition at line 315 of file buffer.c.
318 {
320
324}
_In_ ULONG _In_ ULONG Offset
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
◆ ResizePacket()
Definition at line 290 of file buffer.c.
301{
304
306
307 OldSize = NdisBuffer->ByteCount;
308
310 NdisBuffer->ByteCount =
Size;
311
312 return OldSize;
313}
◆ SkipToOffset()
Definition at line 14 of file buffer.c.
33{
34 for (;;) {
35
37 return -1;
38
40
44 break;
45 }
46
48
50 }
51
53}