When you call VirtualAlloc() you can allocate a section of memory that spans multiple pages. When you VirtualQuery() a page in the middle of that section, AllocationBase will be the return value of VirtualAlloc, which is the beginning of that memory allocated by VirtualAlloc(). BaseAddress will be the base address of the individual page you queried.
Here is an example program that shows it in action:
int main()
{
intptr_t addr = (intptr_t)VirtualAlloc(0, 0x3000, MEM_COMMIT, PAGE_READWRITE);
MEMORY_BASIC_INFORMATION mbi{ 0 };
VirtualQuery((void*)(addr + 0x2000), &mbi, sizeof(mbi));
intptr_t middleAddr = addr + 0x2000;
std::cout << "VirtualAlloc returned = 0x" << std::hex << addr << "\n";
std::cout << "Middle Address Queried = 0x" << std::hex << middleAddr << "\n";
std::cout << "mbi.AllocationBase = 0x" << std::hex << mbi.AllocationBase << "\n";
std::cout << "mbi.BaseAddress = 0x" << std::hex << mbi.BaseAddress << "\n";
getchar();
return 0;
}
output:
VirtualAlloc returned = 0x5d0000
Middle Address Queried = 0x5d2000
mbi.AllocationBase = 0x005D0000
mbi.BaseAddress = 0x005D2000
Likewise, AllocationProtect regards the Allocation page, no the individual page you queried.