Get owner module from memory address
virtual-memory, winapi
Solution
Yes, a module handle value in Windows is simply the base address of the VM allocation for the module.
So you can cast the MEMORY_BASIC_INFORMATION.AllocationBase you get back to (HMODULE) and pass that to GetModuleFileName(). Of course, do keep in mind that this only works for allocations that were made for code loaded from executable files. You normally encounter lots of VM allocations with VirtualQuery() that are data or stacks. They don't have an owner and are not associated with a module. You can filter pretty effectively from the protection flags, executable code from a module is not writable.
Problem
I iterate trough my process memory using VirtualQuery, I would like to know witch module the certain memory range is owned by whom. Either the executable either some other dll, and get it's name. Is there a way I can find out ?