Im trying to use NtMapViewOfSection to remap a section but everytime i use the function it gives me the error STATUS_MAPPED_ALIGNMENT 0xC0000220.
If i replace the viewBase with a nullptr and it works.
my cpp code
HANDLE hSection = NULL;
LARGE_INTEGER sectionMaxSize = {};
sectionMaxSize.QuadPart = 0x1000;
NTSTATUS status = NtCreateSection(&hSection, SECTION_ALL_ACCESS, NULL, §ionMaxSize, PAGE_EXECUTE_READWRITE, SEC_COMMIT, NULL);
PVOID viewBase = address; // It maps the view in a different area
LARGE_INTEGER SectionOffset = {};
SIZE_T ViewSize = 0;
status = NtMapViewOfSection(hSection, hProc, &viewBase, 0, 0x1000, &SectionOffset, &ViewSize, ViewUnmap, 0, PAGE_EXECUTE_READWRITE);
address is just a PVOID
i think it might be because im unmapping the view before but im not really sure