Пример #1
0
        private bool ApplyPatches(Process process)
        {
            if (process == null)
            {
                return(false);
            }

            TOKEN_PRIVILEGES privilege = PrivilegeHelper.SetPrivilege("SeDebugPrivilege");
            IntPtr           handle    = OpenProcessVirtualAccess(process.Id);
            bool             isOkay    = true;

            isOkay = isOkay && handle != IntPtr.Zero;
            isOkay = isOkay && CheckCrc(handle);
            isOkay = isOkay && ApplyCrcPatch(handle);
            isOkay = isOkay && ApplyCommPatch(handle);
            isOkay = isOkay && ApplyGamePatches(handle);

            Kernel32Imports.CloseHandle(handle);
            PrivilegeHelper.RestorePrivilege(privilege);

            return(isOkay);
        }