I have a structure
typedef struct sample_structure
{
... some data definiti0ns
PUCHAR Data[1000];
.. other data def ..
}
// retreiving packet data from callout, there are valid data, displayed i
checked in windbg
packet = (PUCHAR) currentMdl->MappedSystemVa + netBuffer->DataOffset;
Rtlzeromemory clears it to zores first ..Then im trying to copy with:
RtlCopyMemory(sample_structure->Data, packet, currentMdl->ByteCount );
But after copy it should be a string there in Data, but there is in WinDbg
not valid data .. packet is displayed as a PUCHAR* string.
When i try something like this, in mbr will be valid string, that should be
in Data array too but there goes something wrong ..:
PUCHAR mbr;
mbr = ExAllocatePool( NonPagedPoolCacheAligned, currentMdl->ByteCount );
RtlZeroMemory(mbr, currentMdl->ByteCount);
RtlCopyMemory(mbr, packet, currentMdl->ByteCount );
ExFreePool( mbr );
Im guessing there is very wrong with data aligment, but no idea how to solve
this ..
The correct is MmGetSystemAddressForMdlSafe
> RtlCopyMemory(sample_structure->Data, packet, currentMdl->ByteCount );
The correct is MmGetMdlByteCount, also note that it can be larger then sample_structure->Data.
> mbr = ExAllocatePool( NonPagedPoolCacheAligned, currentMdl->ByteCount );
"CacheAligned" is not necessary.
--
Maxim S. Shatskih
Windows DDK MVP
ma...@storagecraft.com
http://www.storagecraft.com
Is that really what your code says? That defines a region 4000 bytes long
-- it's an array of 1000 pointers. Did you mean this:
UCHAR Data[1000];
>Rtlzeromemory clears it to zores first ..Then im trying to copy with:
>RtlCopyMemory(sample_structure->Data, packet, currentMdl->ByteCount );
>
>But after copy it should be a string there in Data, but there is in WinDbg
>not valid data .. packet is displayed as a PUCHAR* string.
Well, yes, because you have defined the member as 1,000 pointers, not a
string of 1,000 characters.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.