-
Notifications
You must be signed in to change notification settings - Fork 55
/
MyBot.run.Wmi.au3
135 lines (116 loc) · 4.55 KB
/
MyBot.run.Wmi.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
; #FUNCTION# ====================================================================================================================
; Name ..........: MBR Bot Wmi
; Description ...: This file contens the Sequence that runs all MBR Bot
; Author ........: cosote (03-2017)
; Modified ......:
; Remarks .......: This file is part of MyBot, previously known as ClashGameBot. Copyright 2015-2019
; MyBot is distributed under the terms of the GNU GPL
; Related .......:
; Link ..........: https://github.com/MyBotRun/MyBot/wiki
; Example .......: No
; ===============================================================================================================================
; AutoIt pragmas
#NoTrayIcon
#RequireAdmin
#AutoIt3Wrapper_UseX64=7n
#AutoIt3Wrapper_Run_Au3Stripper=y
#Au3Stripper_Parameters=/rsln /MI=3
;/SV=0
#AutoIt3Wrapper_Change2CUI=y
#pragma compile(Console, true)
#include "MyBot.run.version.au3"
#pragma compile(ProductName, My Bot Wmi)
#pragma compile(Out, MyBot.run.Wmi.exe) ; Required
; Enforce variable declarations
Opt("MustDeclareVars", 1)
#include <APIErrorsConstants.au3>
#include <Misc.au3>
#include <WinAPI.au3>
#include <WinAPISys.au3>
#include <WinAPIProc.au3>
#include <ProcessConstants.au3>
#include <ColorConstants.au3>
#include <Date.au3>
Global $g_sWmiTestApi = ""
Global $g_bRunState = True
Global $g_bDebugSetlog = False
Global $g_bDebugAndroid = False
Global $g_iGlobalActiveBotsAllowed = 0 ; Dummy
Global $g_hMutextOrSemaphoreGlobalActiveBots = 0 ; Dummy
Global $g_bBotLaunchOption_NoBotSlot = True
Global $g_hStatusBar = 0 ; Dummy
Global Const $COLOR_ORANGE = 0xFF7700 ; Used for donate GUI buttons
Global Const $COLOR_ERROR = $COLOR_RED ; Error messages
Global Const $COLOR_WARNING = $COLOR_MAROON ; Warning messages
Global Const $COLOR_INFO = $COLOR_BLUE ; Information or Status updates for user
Global Const $COLOR_SUCCESS = 0x006600 ; Dark Green, Action, method, or process completed successfully
Global Const $COLOR_SUCCESS1 = 0x009900 ; Med green, optional success message for users
Global Const $COLOR_DEBUG = $COLOR_PURPLE ; Purple, basic debug color
Global Const $COLOR_DEBUG1 = 0x7a00cc ; Dark Purple, Debug for successful status checks
Global Const $COLOR_DEBUG2 = 0xaa80ff ; lt Purple, secondary debug color
Global Const $COLOR_DEBUGS = $COLOR_MEDGRAY ; Med Grey, debug color for less important but needed supporting data points in multiple messages
Global Const $COLOR_ACTION = 0xFF8000 ; Med Orange, debug color for individual actions, clicks, etc
Global Const $COLOR_ACTION1 = 0xcc80ff ; Light Purple, debug color for pixel/window checks
Func _Sleep($ms, $iSleep = True, $CheckRunState = True)
Sleep($ms)
EndFunc ;==>_Sleep
Func SetLog($String, $Color = $COLOR_BLACK, $LogPrefix = "L ")
;ConsoleWrite($String & @CRLF) ; Always write any log to console
EndFunc ;==>SetLog
Func SetDebugLog($String, $Color = $COLOR_DEBUG, $LogPrefix = "D ")
;Return SetLog($String, $Color, $LogPrefix)
EndFunc ;==>SetDebugLog
#include "COCBot\functions\Config\DelayTimes.au3"
#include "COCBot\functions\Other\Time.au3"
#include "COCBot\functions\Other\LaunchConsole.au3"
Local $g_oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Local $query
If $CmdLine[0] = 1 Then
$query = $CmdLine[1]
Else
; list all processes
$query = "Select " & GetWmiSelectFields() & " from Win32_Process"
EndIf
Local $oProcessColl = GetWmiObject().ExecQuery($query, "WQL", 0x20 + 0x10)
OutputWmiData("<Processes>")
For $Process In $oProcessColl
OutputWmiData(" <Process>")
For $sField In $g_WmiFields
OutputWmiData(" <" & $sField & ">" & Execute("$Process." & $sField) & "</" & $sField & ">")
Next
OutputWmiData(" </Process>")
Next
OutputWmiData("</Processes>")
If $g_sWmiTestApi <> "" Then
; test parsing
Local $aProcesses = WmiOutputToArray($g_sWmiTestApi)
ConsoleWrite("Found " & UBound($aProcesses) & " processes" & @CRLF)
For $aProcess In $aProcesses
ConsoleWrite("Handle : " & $aProcess[0] & @CRLF)
ConsoleWrite("ExecutablePath : " & $aProcess[1] & @CRLF)
ConsoleWrite("CommandLine : " & $aProcess[2] & @CRLF)
Next
EndIf
If $CmdLine[0] <> 1 Then
ConsoleWrite(@CRLF & "Press enter to exit . . . ")
While Not ConsoleRead(True)
Sleep(10)
WEnd
EndIf
Exit 0
Func OutputWmiData($s)
If $g_sWmiTestApi <> "" Then
$g_sWmiTestApi &= $s & @CRLF
Return
EndIf
ConsoleWrite($s & @CRLF)
EndFunc ;==>OutputWmiData
; Dummy functions
Func _GUICtrlStatusBar_SetText($a, $b)
EndFunc
Func GetTranslated($a, $b, $c)
EndFunc
Func GetTranslatedFileIni($a, $b, $c)
EndFunc
Func _GUICtrlStatusBar_SetTextEx($hWnd, $sText = "", $iPart = 0, $iUFlag = 0)
EndFunc