Beispiel #1
0
 public static void InsertHook(string hookcode)
 {
     // 重复插入相同的code(可能)会导致产生很高位的Context
     foreach (Process p in gameInfo.ProcList)
     {
         TextHostLib.InsertHook((uint)p.Id, hookcode);
         log.Info($"Try insert code {hookcode} to PID {p.Id}");
     }
 }
Beispiel #2
0
 public static void InsertHook(string hookcode)
 {
     // 重复插入相同的code(可能)会导致产生很高位的Context
     foreach (var v in ThreadHandleDict)
     {
         if (hookcode == v.Value.Hookcode)
         {
             DataEvent?.Invoke(typeof(Textractor), new HookParam
             {
                 Name     = "控制台",
                 Hookcode = "HB0@0",
                 Text     = "ErogeHelper: 该特殊码已插入"
             });
             return;
         }
     }
     foreach (Process p in DataRepository.GameProcesses)
     {
         TextHostLib.InsertHook((uint)p.Id, hookcode);
         log.Info($"Try insert code {hookcode} to PID {p.Id}");
     }
 }
Beispiel #3
0
        public static void Init()
        {
            // Current texthook.dll version 4.15
            string textractorPath = Directory.GetCurrentDirectory() + @"\libs\texthost.dll";

            if (!File.Exists(textractorPath))
            {
                throw new FileNotFoundException(textractorPath);
            }

            _createThread = CreateThreadHandle;
            _output       = OutputHandle;
            _removeThread = RemoveThreadHandle;
            _callback     = OnConnectCallBackHandle;

            _ = TextHostLib.TextHostInit(_callback, _ => { }, _createThread, _removeThread, _output);

            foreach (Process p in DataRepository.GameProcesses)
            {
                _ = TextHostLib.InjectProcess((uint)p.Id);
                Log.Info($"attach to PID {p.Id}.");
            }
        }
Beispiel #4
0
        public static void Init()
        {
            log.Info("initilize start.");
            string textractorPath = Directory.GetCurrentDirectory() + @"\libs\texthost.dll";

            if (!File.Exists(textractorPath))
            {
                throw new FileNotFoundException(textractorPath);
            }

            createthread = CreateThreadHandle;
            output       = OutputHandle;
            removethread = RemoveThreadHandle;
            callback     = OnConnectCallBackHandle;

            TextHostLib.TextHostInit(callback, _ => { }, createthread, removethread, output);

            foreach (Process p in DataRepository.GameProcesses)
            {
                TextHostLib.InjectProcess((uint)p.Id);
                log.Info($"attach to PID {p.Id}.");
            }
        }