From 98c56bb55b03852fee2ca4bc8e5d88381cb4611b Mon Sep 17 00:00:00 2001 From: Rual Ilmarranen Date: Wed, 16 Feb 2022 12:49:31 +0200 Subject: [PATCH] updates and better AV handling --- package-lock.json | 6 +++--- package.json | 2 +- src/app/game_state.ts | 10 +++++++++ src/app/locatewindow.ts | 19 +++++++++++++++++- src/app/log-parser/log_parser.ts | 4 ++++ src/lib/messages.ts | 1 + src/our-active-win/getFrontWindow.exe | Bin 9728 -> 9728 bytes src/our-active-win/getFrontWindow.pdb | Bin 0 -> 24064 bytes src/our-active-win/index.d.ts | 1 + .../overlay/functions/messages_ipcmain.ts | 6 ++++++ src/windows/overlay/overlay.css | 3 ++- src/windows/overlay/overlay.html | 4 ++++ src/windows/overlay/overlay.ts | 1 + 13 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 src/our-active-win/getFrontWindow.pdb diff --git a/package-lock.json b/package-lock.json index 9aeb992..5e56ad4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18043,9 +18043,9 @@ } }, "nth-check": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz", - "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz", + "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==", "dev": true, "requires": { "boolbase": "^1.0.0" diff --git a/package.json b/package.json index 68bdebd..11f9bff 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mtgaprotracker", "productName": "mtgaprotracker", - "version": "2.2.14", + "version": "2.2.15", "description": "MTG Arena Pro Tracker", "main": "./.webpack/main", "scripts": { diff --git a/src/app/game_state.ts b/src/app/game_state.ts index 3671820..9da0eed 100644 --- a/src/app/game_state.ts +++ b/src/app/game_state.ts @@ -22,6 +22,7 @@ const TWO_SECONDS = 2000; class GameState { private readonly startTimeMillis: number; private running: boolean; + private AVBlocked: boolean; private overlayInterval: NodeJS.Timeout | undefined; private psListInterval: NodeJS.Timeout | undefined; private processId: number | undefined; @@ -36,6 +37,7 @@ class GameState { constructor() { this.startTimeMillis = Date.now(); this.running = false; + this.AVBlocked = false; this.checkProcessId(); } @@ -52,6 +54,14 @@ class GameState { return this.startTimeMillis; } + public setAVBlocked() { + this.AVBlocked = true; + } + + public getAVBlocked() { + return this.AVBlocked; + } + public setRunning(running: boolean): void { //console.log('setRunning', running, this.running, this.badErrorHappening); if (!this.running && running) { diff --git a/src/app/locatewindow.ts b/src/app/locatewindow.ts index 9a9bcdc..530ccfc 100644 --- a/src/app/locatewindow.ts +++ b/src/app/locatewindow.ts @@ -2,7 +2,7 @@ import {ChildProcessWithoutNullStreams} from 'child_process'; import {screen} from 'electron'; import {gameState} from 'root/app/game_state'; -import {sendMessageToOverlayWindow} from 'root/app/messages'; +import {sendMessageToHomeWindow, sendMessageToOverlayWindow} from 'root/app/messages'; import {AccountV8} from 'root/app/settings-store/v9'; import {isMac} from 'root/lib/utils'; import ourActiveWin from 'root/our-active-win'; @@ -72,7 +72,24 @@ export class WindowLocator { raw.split('\n').map((line: string) => { if (line.indexOf('{') !== -1 && line.indexOf('}') !== -1) { const process = JSON.parse(line) as ourActiveWin.Result; + if (process.cantDoInjection) { + sendMessageToOverlayWindow('cant-inject', undefined); + sendMessageToHomeWindow('show-status', { + message: 'SharpMonoInjector.dll is blocked by AV!', + color: '#cc2d2d', + }); + gameState.setAVBlocked(); + } this.handleProcessRead(process); + } else { + if (line == 'ERROR') { + gameState.setAVBlocked(); + sendMessageToOverlayWindow('cant-inject', undefined); + sendMessageToHomeWindow('show-status', { + message: 'SharpMonoInjector.dll is blocked by AV!', + color: '#cc2d2d', + }); + } } }); } catch (error) { diff --git a/src/app/log-parser/log_parser.ts b/src/app/log-parser/log_parser.ts index 65ccaa8..d0a6391 100644 --- a/src/app/log-parser/log_parser.ts +++ b/src/app/log-parser/log_parser.ts @@ -111,6 +111,10 @@ export class LogParser { throw new Error('No log file found'); } + if (gameState.getAVBlocked()) { + throw new Error('SharpMonoInjector.dll is blocked by AV!'); + } + // Fetching fileId //const [fileId] = await getFileId(path, {bytesRead: 0}, parsingMetadata); const fileId = LogFromMTGAFolder.fileId; diff --git a/src/lib/messages.ts b/src/lib/messages.ts index 8320cbf..72d74d3 100644 --- a/src/lib/messages.ts +++ b/src/lib/messages.ts @@ -152,6 +152,7 @@ export interface Messages { 'screen-recording-authorized': boolean; 'enable-screen-recording': undefined; 'need-to-restart-mtga': boolean; + 'cant-inject': undefined; } export enum NetworkStatusMessage { diff --git a/src/our-active-win/getFrontWindow.exe b/src/our-active-win/getFrontWindow.exe index ace94c647beadfb7ac8efedd8329291bed42ebe9..85cd256b3966658ce1d1f91ddad37f1dcbc15bf9 100644 GIT binary patch delta 2582 zcmaJ@4{TM{8UN0G_nv$1Yy0}{E4}^S_t>NK6$(=Rj1uPt2xuchur`JTwH*>E$e%rM z2I2i_90n98^}qGNl*G zWJNIB^PTa={z7I72^R|PY)StukFdACTO|`}teR_{P+84oX+lIo8PpP zci%Obc*SrG5^5KZWnczxobc3*6CSZ~!b9k*D$iWj_jrishf{3M9ieH9<{}e3FX5ev z_fx!>1HxEg8pG#|MRZ2@sATK2+}{?Y-7dqKuzuBEZ3RcNZ%s5*>L=CwhVL89i>e{M z9h*BC%mj^9W3_b3t923-3kaP}=ZWsa z+Ka(RcW=-3Z@zaMXZBfaIQfwQi<46i*dcttc*NpOZvCl??}2wo>7u+ zlKoDUK9=vvDE$N&qu1O~>~_xTFTg2lT;H@fV4Y&TXfy6HnpSTH0McN%=(X1QGH zyUH7{KO_S-yH{}czu*8#SAoc$iZqxSQS~7)Y>b*Gu(SG4xdZ2*IeIuDGS|0IDnKVO&ViqrxJK-a#(} z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7rDHfM~T;W z(e35Z>&b9-x&XER9yJsH>{2wORX@Uu@qw{WAUWMWrj#+dGpTRz@FalrA#0OB!qV zkePe59r~9&uCO-h?8y??BP?s+#ZL$C4I9#luI*MTmt9m@SyfeC6>lqx)z;LNRYzl0 zWpx#ain6-4_E@wc+8&M7)tqUTHlEe6qOw80h_Z(xuX{F`)kC`Tpgg57>Lag-blt%Y z4N8)KblagBJS$H=${l^=>0ONfJ&wnwa`L-ytU4?xPkxXEhvhi+$*0lVQZoXp%6}#< zZ~W+Q5VYSYcxl3shC>{D`lsHwO$>xhP=8Sejbnb;FY_70Tyz-7(2pR!Jdtxn7g>ep)>qkm?L56> zzfxUu_9~RoYWpBl%vp6El^!AeS)!XE@on`{De>#E$*auOdZ-AJ8D>M8sam&6A)PN} zI{E#Jp)rumCR4~P+)MDa>K^5o@~?74jiKT+Uo=Vf433Y?s|s4oFhHC`hFUqynKnn7KT&Spp+VJ1@Z-fIxFZL zFc-p&8umF$R}Q0bN^E7 zSKmB%_vZuuAAfUt4EX={(f7mU|C2vSZc+LFG&l9$Li>ySe>%I%|EK*#Zc@2O3jeH literal 0 HcmV?d00001 diff --git a/src/our-active-win/index.d.ts b/src/our-active-win/index.d.ts index 13fbbad..2d0fa0b 100644 --- a/src/our-active-win/index.d.ts +++ b/src/our-active-win/index.d.ts @@ -29,6 +29,7 @@ declare namespace ourActiveWin { */ owner: BaseOwner; admin: boolean; + cantDoInjection: boolean; } interface MacOSOwner extends BaseOwner { diff --git a/src/windows/overlay/functions/messages_ipcmain.ts b/src/windows/overlay/functions/messages_ipcmain.ts index 1e754f3..6641884 100644 --- a/src/windows/overlay/functions/messages_ipcmain.ts +++ b/src/windows/overlay/functions/messages_ipcmain.ts @@ -368,6 +368,12 @@ export function SetMessages(setInteractiveHandler: (overlaySettings: OverlaySett } } }); + onMessageFromIpcMain('cant-inject', (state) => { + if (overlayElements.AVWarning.classList.contains('hidden')) { + overlayElements.AVWarning.classList.remove('hidden'); + } + }); + onMessageFromIpcMain('restart-mtga', () => { sendMessageToIpcMain('restart-mtga-now', undefined); }); diff --git a/src/windows/overlay/overlay.css b/src/windows/overlay/overlay.css index d38e7f5..fae109c 100644 --- a/src/windows/overlay/overlay.css +++ b/src/windows/overlay/overlay.css @@ -39,7 +39,8 @@ a[href^="ftp://"] padding-bottom: 5px; } -#RestartWarning { +#RestartWarning, +#AVWarning { position: absolute; bottom: 51px; left: 50%; diff --git a/src/windows/overlay/overlay.html b/src/windows/overlay/overlay.html index 04e5eec..3fd2b2b 100644 --- a/src/windows/overlay/overlay.html +++ b/src/windows/overlay/overlay.html @@ -39,6 +39,10 @@ MTGA is running with higher than Tracker system permissions.
Most likely it was an update or you've launched MTGA as Admin
Please restart the game (Alt+R) to keep using the Tracker. + diff --git a/src/windows/overlay/overlay.ts b/src/windows/overlay/overlay.ts index 19a89c7..1433ad4 100644 --- a/src/windows/overlay/overlay.ts +++ b/src/windows/overlay/overlay.ts @@ -38,6 +38,7 @@ export const overlayElements = { oppTimer: document.getElementById('oppTimer') as HTMLElement, OverlayMenu: document.getElementById('OverlayMenu') as HTMLElement, RestartWarning: document.getElementById('RestartWarning') as HTMLElement, + AVWarning: document.getElementById('AVWarning') as HTMLElement, }; const Interactive = document.getElementsByClassName('Interactive');