From 724ae101fe9d1e128a65981925a9f8762e0c3c86 Mon Sep 17 00:00:00 2001 From: tnishi Date: Fri, 18 Nov 2016 19:48:44 +0900 Subject: [PATCH] =?utf8?q?=E5=88=9D=E6=9C=9F=E5=8C=96=E5=87=A6=E7=90=86?= =?utf8?q?=E3=81=AE=E6=94=B9=E5=96=84=EF=BC=9Aamodi.exe=E3=81=AE=E8=B5=B7?= =?utf8?q?=E5=8B=95=E3=82=92=E6=AD=A3=E3=81=97=E3=81=8F=E6=A4=9C=E7=9F=A5?= =?utf8?q?=E3=81=A7=E3=81=8D=E3=81=9A=E3=80=81amodi=E3=81=8C=E4=BD=BF?= =?utf8?q?=E7=94=A8=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=8F=E3=81=AA=E3=82=8B?= =?utf8?q?=E5=A0=B4=E5=90=88=E3=81=AE=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- DCHookTest/DCHookMain.cpp | 24 ++++++++++++------------ DCHookTest/DCHookMain.dfm | 4 ++-- DCHookTest/DCHookMain.h | 4 ++-- DCHookTest/Util.cpp | 10 ++++++++-- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/DCHookTest/DCHookMain.cpp b/DCHookTest/DCHookMain.cpp index 3893171..03fac5a 100644 --- a/DCHookTest/DCHookMain.cpp +++ b/DCHookTest/DCHookMain.cpp @@ -184,9 +184,6 @@ void __fastcall TDCHookMainForm::FormCreate(TObject *Sender) } // Application->OnIdle = IdleHandler; - - if (fWow64) - tmReInit64->Enabled = true; } //--------------------------------------------------------------------------- void __fastcall TDCHookMainForm::FormCloseQuery(TObject *Sender, @@ -582,16 +579,17 @@ void __fastcall TDCHookMainForm::tmMODINotifyTimer(TObject *Sender) } } //--------------------------------------------------------------------------- -void __fastcall TDCHookMainForm::tmReInit64Timer(TObject *Sender) +void __fastcall TDCHookMainForm::tmReInitTimer(TObject *Sender) { - // ‰‰ñ‹N“®Žž‚Ì‚Ý‚±‚̏ˆ—‚ð‚µ‚È‚¢‚Æpopup‚µ‚È‚¢ - // ÄƒƒOƒCƒ“Žž‚Í•s—v - tmReInit64->Enabled = false; - Unhook(); - bool use64 = Ini->ReadInteger(PFS_CONFIG, PFS_USE64, false); - Ini->WriteInteger(PFS_CONFIG, PFS_USE64, !use64); - Hook(); - Ini->WriteInteger(PFS_CONFIG, PFS_USE64, use64); + // amodi.exe‚Ìlaunch‚É”ñí‚ÉŽžŠÔ‚ª‚©‚©‚éê‡‚ª‚ ‚é + // ex.ŒÃ‚¢PC‚Åstartup‚É“o˜^‚µ‚Ä‚¢‚éê‡ + // ¨input idle‚É‚È‚Á‚Ä‚àmain window‚̐¶¬‚ÉŽžŠÔ‚ª‚©‚©‚Á‚Ä‚¢‚é‚Ì‚©‚à‚µ‚ê‚È‚¢ + // AMODIAvail‚ªtrue‚É‚È‚é‚܂ŏ‰Šú‰»‚𑱂¯‚é + tmReInit->Enabled = false; + SetupAMODI(); + if (AMODIAvail){ + SetupConfig2(); + } } //--------------------------------------------------------------------------- // Mouse Events @@ -1340,6 +1338,8 @@ void TDCHookMainForm::SetupAMODI() HWND hwnd = FindAMODI(); if (hwnd) AMODIAvail = true; + else + tmReInit->Enabled = true; // retry later } } } diff --git a/DCHookTest/DCHookMain.dfm b/DCHookTest/DCHookMain.dfm index e42af8b..e12e26e 100644 --- a/DCHookTest/DCHookMain.dfm +++ b/DCHookTest/DCHookMain.dfm @@ -2738,9 +2738,9 @@ object DCHookMainForm: TDCHookMainForm Left = 232 Top = 273 end - object tmReInit64: TTimer + object tmReInit: TTimer Enabled = False - OnTimer = tmReInit64Timer + OnTimer = tmReInitTimer Left = 280 Top = 276 end diff --git a/DCHookTest/DCHookMain.h b/DCHookTest/DCHookMain.h index 4ee351d..3490b18 100644 --- a/DCHookTest/DCHookMain.h +++ b/DCHookTest/DCHookMain.h @@ -70,7 +70,7 @@ __published: // IDE TTimer *tmMODINotify; TMenuItem *miCheckLatest; TMenuItem *miOCRText; - TTimer *tmReInit64; + TTimer *tmReInit; void __fastcall miHookClick(TObject *Sender); void __fastcall miUnhookClick(TObject *Sender); void __fastcall miExitClick(TObject *Sender); @@ -106,7 +106,7 @@ __published: // IDE void __fastcall tmMODINotifyTimer(TObject *Sender); void __fastcall miCheckLatestClick(TObject *Sender); void __fastcall miOCRTextClick(TObject *Sender); - void __fastcall tmReInit64Timer(TObject *Sender); + void __fastcall tmReInitTimer(TObject *Sender); private: // ƒ†[ƒU[éŒ¾ //void __fastcall IdleHandler(TObject *sender, bool &done); diff --git a/DCHookTest/Util.cpp b/DCHookTest/Util.cpp index 15318ec..d2bb816 100644 --- a/DCHookTest/Util.cpp +++ b/DCHookTest/Util.cpp @@ -424,8 +424,14 @@ bool _WinExec( const char *cmd, int show, int waittime, const char *dir) return false; bool ret = true; if ( waittime ){ +// DWORD startTime = GetTickCount(); int r = WaitForInputIdle( pi.hProcess, waittime ); ret = r==0; + if (!ret){ + dbw("CreateProcess: %d, 0x%X", r, GetLastError()); + } else { +// dbw("CreateProcess: %d", GetTickCount() - startTime); + } } CloseHandle( pi.hProcess ); return ret; @@ -491,11 +497,11 @@ bool LaunchAMODI() #else SW_HIDE; #endif - if (!_WinExec( AMODI_EXE_PATH, show, 500)) + if (!_WinExec( AMODI_EXE_PATH, show, 300)) return false; HWND hwnd = NULL; - for (int i=0;i<30;i++){ + for (int i=0;i<10;i++){ hwnd = FindAMODI(); if (hwnd) break; -- 2.11.0