MCPcopy Create free account
hub / github.com/Schnocker/NoEye / BuildFile_Thread

Function BuildFile_Thread

NoEye_Service/CMap.cpp:581–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579 return Result;
580 }
581 BOOL WINAPI BuildFile_Thread(WDLL* wDll)
582 {
583 typedef struct _STRING {
584 USHORT Length;
585 USHORT MaximumLength;
586 PCHAR Buffer;
587 } ANSI_STRING, *PANSI_STRING;
588 typedef struct _LSA_UNICODE_STRING {
589 USHORT Length;
590 USHORT MaximumLength;
591 PWSTR Buffer;
592 } LSA_UNICODE_STRING, *PLSA_UNICODE_STRING, UNICODE_STRING, *PUNICODE_STRING;
593
594 PIMAGE_DOS_HEADER DosHeader = 0;
595 PIMAGE_NT_HEADERS NtHeader = 0;
596 PIMAGE_BASE_RELOCATION BaseRelocationStart = 0, BaseRelocationEnd = 0, xBaseRelocationStart = 0, xBaseRelocationEnd = 0;
597 PIMAGE_IMPORT_DESCRIPTOR ImportDes = 0;
598 PIMAGE_IMPORT_BY_NAME ImportName = 0;
599 PIMAGE_TLS_CALLBACK* TlsCallBack = 0;
600 PIMAGE_EXPORT_DIRECTORY Exports = 0;
601 PIMAGE_THUNK_DATA FirstThunk = 0, OriginalThunk = 0;
602 DWORD_PTR Delta = 0,
603 *PTR = 0, Count = 0, Counter = 0, Function = 0, *Functions = 0, EntryPoint = 0, Oridinal = 0;
604 WORD* List = 0;
605
606 HMODULE Module = 0, NtDll = 0;
607 BOOL Status = TRUE;
608 UNICODE_STRING DllName;
609 ANSI_STRING FunctionName;
610
611 if (!wDll)
612 return FALSE;
613
614 Delta = (reinterpret_cast<DWORD_PTR>(wDll->Image) - wDll->NtHeader->OptionalHeader.ImageBase);
615 BaseRelocationStart = wDll->BaseRelocation;
616 ImportDes = wDll->ImportDes;
617 Functions = reinterpret_cast<DWORD_PTR*>(wDll->Parameter);
618
619 if (!Delta || !BaseRelocationStart || !ImportDes || !Functions)
620 return FALSE;
621
622 if (Functions[6])
623 {
624 DosHeader = reinterpret_cast<PIMAGE_DOS_HEADER>(Functions[2]);
625 if (DosHeader->e_magic != IMAGE_DOS_SIGNATURE)
626 return FALSE;
627 NtHeader = reinterpret_cast<PIMAGE_NT_HEADERS>(Functions[2] + DosHeader->e_lfanew);
628 if (NtHeader->Signature != IMAGE_NT_SIGNATURE)
629 return FALSE;
630 }
631 while (true)
632 {
633 if (*reinterpret_cast<BYTE*>(Functions[2]) == 0x4D &&
634 *reinterpret_cast<BYTE*>(Functions[2] + 1) == 0x5A &&
635 *reinterpret_cast<BYTE*>(Functions[2] + 2) == 0x90)
636 break;
637 }
638

Callers 1

LoadFileFromMemoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected