不好意思問這個愚蠢的問題,但我試圖獲得在遠程進程中運行的lib的地址(指針)。intptr的指針地址
該地址保存在類型intptr但是當我打印的價值,我得到一個巨大的int。
我如何將它轉換爲0x00000等?
示例代碼:
public uint GetModuleBase(string _moduleName)
{
MODULEENTRY32 me32 = new MODULEENTRY32();
IntPtr hSnapshot = IntPtr.Zero;
me32.dwSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(me32);
hSnapshot = CreateToolhelp32Snapshot(0x00000008, this.processId);
// can we start looking?
if (!Module32First(hSnapshot, ref me32))
{
CloseHandle(hSnapshot);
return 0;
}
// enumerate all modules till we find the one we are looking for
// or until every one of them is checked
while (String.Compare(me32.szModule, _moduleName) != 0 && Module32Next(hSnapshot, ref me32))
{
modules.Add(me32.szModule, me32.modBaseAddr);
}
// close the handle
CloseHandle(hSnapshot);
// check if module handle was found and return it
if (String.Compare(me32.szModule, _moduleName) == 0)
{
return (uint)me32.modBaseAddr;
}
return 0;
}
過程黑客表明LIB是在地址(0x6f300000)加載,但我得到一個int值(1865416704)當我嘗試打印IntPtr的值。
http://msdn.microsoft.com/en-us/library/dwhawy9k%28v=vs.110%29.aspx - 嘗試'x8' – 2014-10-11 13:18:52