Пример #1
0
        private static int WriteMemory(IntPtr addressBase, byte[] writeBytes, int writeLength)
        {
            int reallyWriteLength = 0;

            if (!ProcessAPIHelper.WriteProcessMemory(processInfo.hProcess, addressBase, writeBytes, writeLength, out reallyWriteLength))
            {
                throw new Exception();
            }
            return(reallyWriteLength);
        }
Пример #2
0
        public static IntPtr Open(int processId)
        {
            IntPtr hProcess = IntPtr.Zero;

            hProcess = ProcessAPIHelper.OpenProcess(ProcessAccessFlags.All, false, processId);
            if (hProcess == IntPtr.Zero)
            {
                throw new Exception("OpenProcess失败");
            }
            processInfo.hProcess    = hProcess;
            processInfo.dwProcessId = processId;
            return(hProcess);
        }