Home > other >  Rtlcopymemory lead to blue screen
Rtlcopymemory lead to blue screen

Time:10-27

In minifilter communication function to handle the string is divided into two pieces are coming, but because the string itself is larger, the tail that cut to always will because paging issues when memory copy page_fault_in_nonpaged_area mistake, could you tell me how to modify a little bit better
 
NTSTATUS
MiniMessage (
__in PVOID ConnectionCookie,
__in_bcount_opt (InputBufferSize) PVOID InputBuffer,
__in ULONG InputBufferSize,
__out_bcount_part_opt (OutputBufferSize, * ReturnOutputBufferLength) PVOID OutputBuffer,
__in ULONG OutputBufferSize,
__out PULONG ReturnOutputBufferLength
)
{


PAGED_CODE ();

UNREFERENCED_PARAMETER (ConnectionCookie);
UNREFERENCED_PARAMETER (OutputBufferSize);
UNREFERENCED_PARAMETER (OutputBuffer);
If ((InputBuffer!=NULL) & amp; &
(InputBufferSize & gt;=sizeof (char)))
{
UNICODE_STRING receive;
UNICODE_STRING fuck;
KStr_Init (& amp; The head, MAX_PATH);
KStr_Init (& amp; Tail, MAX_PATH);
CHAR_TO_UNICODE_STRING (InputBuffer (char *), & amp; The receive);
RtlCopyMemory (head. The Buffer, the receive Buffer, 2 * sizeof (WCHAR));
Head. Length=2 * sizeof (WCHAR);
RtlCopyMemory (tail. The Buffer, the receive Buffer + 2 * sizeof (WCHAR), receive the Length - 2 * sizeof (WCHAR));
Tail. Length=receive. Length - 2 * sizeof (WCHAR);
}
Return STATUS_SUCCESS;
}

CodePudding user response:

My wise, change good, his tail intercept the starting location wrong true wisdom
  • Related