Esempio n. 1
0
        public static IntPtr GetModuleHandleEx(IntPtr hProcess, string lpModuleName)
        {
            IntPtr hGMW    = GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetModuleHandleW");
            IntPtr hModule = IntPtr.Zero;

            if (!hGMW.IsNull())
            {
                IntPtr hParam = CreateRemotePointer(hProcess, System.Text.Encoding.Unicode.GetBytes(lpModuleName + "\0"), 0x04);
                if (!hParam.IsNull())
                {
                    hModule = Win32Ptr.Create(RunThread(hProcess, hGMW, (uint)hParam.ToInt32()));
                    VirtualFreeEx(hProcess, hParam, 0, 0x8000);
                }
            }
            return(hModule);
        }
Esempio n. 2
0
        public static IntPtr GetModuleHandleEx(IntPtr hProcess, string lpModuleName)
        {
            IntPtr procAddress = WinAPI.GetProcAddress(WinAPI.GetModuleHandleA("kernel32.dll"), "GetModuleHandleW");
            IntPtr result      = IntPtr.Zero;

            if (!procAddress.IsNull())
            {
                IntPtr intPtr = WinAPI.CreateRemotePointer(hProcess, Encoding.Unicode.GetBytes(lpModuleName + "\0"), 4);
                if (!intPtr.IsNull())
                {
                    result = Win32Ptr.Create((long)((ulong)WinAPI.RunThread(hProcess, procAddress, (uint)intPtr.ToInt32(), 1000)));
                    WinAPI.VirtualFreeEx(hProcess, intPtr, 0, 32768);
                }
            }
            return(result);
        }
Esempio n. 3
0
        public static IntPtr GetModuleHandleEx(IntPtr hProcess, string lpModuleName)
        {
            IntPtr procAddress = GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetModuleHandleW");
            IntPtr zero        = IntPtr.Zero;

            if (!procAddress.IsNull())
            {
                IntPtr ptr = CreateRemotePointer(hProcess, Encoding.Unicode.GetBytes(lpModuleName + "\0"), 4);
                if (!ptr.IsNull())
                {
                    zero = Win32Ptr.Create((long)RunThread(hProcess, procAddress, (uint)ptr.ToInt32(), 0x3e8));
                    VirtualFreeEx(hProcess, ptr, 0, 0x8000);
                }
            }
            return(zero);
        }