@@ -96,6 +96,7 @@ DWORD MMAP_NATIVE::ManualMap(const wchar_t * szDllFile, HANDLE hTargetProc, LAUN
9696 }
9797
9898 LOG (" Data written\n " );
99+ LOG (" NtSetInformationFile: %p\n " , data.f .NtSetInformationFile );
99100
100101 DWORD remote_ret = 0 ;
101102 DWORD dwRet = StartRoutine (hTargetProc, ReCa<f_Routine>(pShell), pArg, Method, (Flags & INJ_THREAD_CREATE_CLOAKED) != 0 , remote_ret, Timeout, error_data);
@@ -198,7 +199,7 @@ __forceinline bool InitAnsiString(MANUAL_MAPPING_FUNCTION_TABLE * f, ANSI_STRING
198199
199200 String->Length = Length;
200201 String->MaxLength = Length + 1 * sizeof (char );
201- f->RtlMoveMemory (String->szBuffer , szString, Length);
202+ f->memmove (String->szBuffer , szString, Length);
202203
203204 return true ;
204205}
@@ -241,8 +242,8 @@ DWORD ManualMapping_Shell(MANUAL_MAPPING_DATA * pData)
241242 }
242243
243244 // nt path prefix "\??\"
244- f->RtlMoveMemory (DllNtPath.szBuffer + 0 , pData->NtPathPrefix , sizeof (wchar_t [4 ]));
245- f->RtlMoveMemory (DllNtPath.szBuffer + 4 , pData->szPathBuffer , DllNtPath.Length );
245+ f->memmove (DllNtPath.szBuffer + 0 , pData->NtPathPrefix , sizeof (wchar_t [4 ]));
246+ f->memmove (DllNtPath.szBuffer + 4 , pData->szPathBuffer , DllNtPath.Length );
246247 DllNtPath.Length += sizeof (wchar_t [4 ]);
247248
248249 UNICODE_STRING DllName = pData->DllName ;
@@ -294,7 +295,7 @@ DWORD ManualMapping_Shell(MANUAL_MAPPING_DATA * pData)
294295 LARGE_INTEGER ImageSize{ pNtHeaders->OptionalHeader .SizeOfImage };
295296
296297 DeleteObject (f, Headers);
297-
298+
298299 auto * fsi = NewObject<FILE_STANDARD_INFO>(f);
299300 ntRet = f->NtQueryInformationFile (hDllFile, &io_status, fsi, sizeof (FILE_STANDARD_INFO), FILE_INFORMATION_CLASS::FileStandardInformation);
300301 if (NT_FAIL (ntRet))
@@ -335,7 +336,7 @@ DWORD ManualMapping_Shell(MANUAL_MAPPING_DATA * pData)
335336 f->NtFreeVirtualMemory (hProc, ReCa<void **>(&pRawData), &RawSize, MEM_RELEASE);
336337 f->NtClose (hDllFile);
337338
338- return INJ_MM_ERR_NT_READ_FILE ;
339+ return INJ_MM_ERR_SET_FILE_POSITION ;
339340 }
340341
341342 ntRet = f->NtReadFile (hDllFile, nullptr , nullptr , nullptr , &io_status, pRawData, fsi->AllocationSize .LowPart , nullptr , nullptr );
@@ -373,14 +374,14 @@ DWORD ManualMapping_Shell(MANUAL_MAPPING_DATA * pData)
373374 }
374375
375376 // copy header and sections
376- f->RtlMoveMemory (pBase, pRawData, pOptionalHeader->SizeOfHeaders );
377+ f->memmove (pBase, pRawData, pOptionalHeader->SizeOfHeaders );
377378
378379 auto * pCurrentSectionHeader = IMAGE_FIRST_SECTION (pNtHeaders);
379380 for (UINT i = 0 ; i != pFileHeader->NumberOfSections ; ++i, ++pCurrentSectionHeader)
380381 {
381382 if (pCurrentSectionHeader->SizeOfRawData )
382383 {
383- f->RtlMoveMemory (pBase + pCurrentSectionHeader->VirtualAddress , pRawData + pCurrentSectionHeader->PointerToRawData , pCurrentSectionHeader->SizeOfRawData );
384+ f->memmove (pBase + pCurrentSectionHeader->VirtualAddress , pRawData + pCurrentSectionHeader->PointerToRawData , pCurrentSectionHeader->SizeOfRawData );
384385 }
385386 }
386387
@@ -1003,7 +1004,7 @@ DWORD ManualMapping_Shell(MANUAL_MAPPING_DATA * pData)
10031004
10041005 auto * ntdll_ldr = ReCa<LDR_DATA_TABLE_ENTRY*>(pPEB->Ldr ->InLoadOrderModuleListHead .Flink ->Flink );
10051006
1006- f->RtlMoveMemory (pBase, ntdll_ldr->DllBase , pOptionalHeader->SizeOfHeaders );
1007+ f->memmove (pBase, ntdll_ldr->DllBase , pOptionalHeader->SizeOfHeaders );
10071008 }
10081009
10091010 if (Flags & INJ_MM_SET_PAGE_PROTECTIONS)
@@ -1046,7 +1047,7 @@ MANUAL_MAPPING_FUNCTION_TABLE::MANUAL_MAPPING_FUNCTION_TABLE()
10461047 NT_FUNC_CONSTRUCTOR_INIT (NtProtectVirtualMemory);
10471048 NT_FUNC_CONSTRUCTOR_INIT (NtFreeVirtualMemory);
10481049
1049- NT_FUNC_CONSTRUCTOR_INIT (RtlMoveMemory );
1050+ NT_FUNC_CONSTRUCTOR_INIT (memmove );
10501051 NT_FUNC_CONSTRUCTOR_INIT (RtlZeroMemory);
10511052 NT_FUNC_CONSTRUCTOR_INIT (RtlAllocateHeap);
10521053 NT_FUNC_CONSTRUCTOR_INIT (RtlFreeHeap);
0 commit comments