mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
565 B
26 lines
565 B
#include "stdinc.h"
|
|
|
|
HRESULT SxApwHmoduleFromAddress(void* p, HMODULE* phModule)
|
|
{
|
|
HRESULT hr = S_OK;
|
|
MEMORY_BASIC_INFORMATION mbi;
|
|
SIZE_T size;
|
|
|
|
size = VirtualQuery(p, &mbi, sizeof(mbi));
|
|
if (size < sizeof(mbi))
|
|
{
|
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
|
goto Exit;
|
|
}
|
|
*phModule = (HMODULE)mbi.AllocationBase;
|
|
Exit:
|
|
return hr;
|
|
}
|
|
|
|
HRESULT SxApwHmoduleFromObject(IUnknown* punk, HMODULE* phModule)
|
|
/*
|
|
This assumes no marshaling!
|
|
*/
|
|
{
|
|
return SxApwHmoduleFromAddress(*reinterpret_cast<void**>(punk), phModule);
|
|
}
|