Exemple #1
0
 public TabHandler(Mem.Mem sharedMemory,
                   Dictionary <string, string> offsets,
                   Dictionary <string, string> aobScannedValues,
                   dynamic sharedTabData)
 {
     _sharedMemory     = sharedMemory;
     _offsets          = offsets;
     _aobScannedValues = aobScannedValues;
     _sharedTabData    = sharedTabData;
 }
        public FunctionHandler(Mem.Mem sharedMemory,
                               Dictionary <string, string> offsets,
                               Dictionary <string, string> aobScannedValues,
                               dynamic sharedFunctionData)
        {
            _sharedMemory       = sharedMemory;
            _offsets            = offsets;
            _aobScannedValues   = aobScannedValues;
            _sharedFunctionData = sharedFunctionData;

            foreach (var item in _offsets)
            {
                Console.WriteLine(item.Key);
            }

            _dynamicDefinedValues = new Dictionary <string, dynamic>();
        }
Exemple #3
0
        public bool Inject2Game()
        {
            // Administrator Only
            using (var identity = WindowsIdentity.GetCurrent())
            {
                var principal = new WindowsPrincipal(identity);

                if (!principal.IsInRole(WindowsBuiltInRole.Administrator))
                {
                    return(false);
                }
            }

            // Search Process
            // Multiple Instances Not Allowed
            if (Process.GetProcessesByName(_processName).Length != 1)
            {
                return(false);
            }

            // If value is "all" or empty, do not check the game version.
            if (string.IsNullOrEmpty(_version) || string.IsNullOrWhiteSpace(_version) || _version != "all")
            {
                var process  = Process.GetProcessesByName(_processName).FirstOrDefault();
                var filePath = process.MainModule.FileName;

                var versionInfo = FileVersionInfo.GetVersionInfo(filePath);
                var version     = versionInfo.FileVersion;

                if (!string.IsNullOrEmpty(version) && version != _version)
                {
                    return(false);
                }
            }

            _memory = new Mem.Mem();
            return(_memory.OpenProcess(_processName));
        }