Jump to content

simon387

Active Members
  • Posts

    22
  • Joined

  • Last visited

Profile Information

  • Location
    Milan

simon387's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I can not make it work
  2. AOB = array out of bound thx again for the infos!
  3. thanks for the answer omg it lists all the system's handles (until an AOB), I need only the one of a specific PID... I'm sure the solution is there, but I just learned how to use dllcall()... gotta study a lot!
  4. here's a full attempt, I'm using the notepad process #Include <WinAPI.au3> Global Const $PROCESS_ALL_ACCESS = 0x000F0000 + 0x00100000 Global Const $DUPLICATE_CLOSE_SOURCE = 0x00000001 Global Const $MUTEX_ALL_ACCESS = 0x1F0001 $lPID = Run("notepad") ConsoleWrite("PID: " & @TAB & @TAB & @TAB & $lPID & @CR) $MutexName = "MSCTF.Asm.MutexDefault1" ConsoleWrite("MUTEX exists: "& @TAB & @TAB & _MutexExists($MutexName) & @CR) If _MutexExists($MUTEXname) == 1 Then $lhandle = _MutexOpen($MutexName) ConsoleWrite("MUTEX handle: " & @TAB & @TAB & $lhandle & @CR) $hprocess = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, False, $lPID , False) ConsoleWrite("Process handle: " & @TAB & $hprocess & @CR) $ret = DllCall("ntdll.dll", "long", "NtDuplicateObject", "long", $hprocess, "long", $lhandle, _ "long", 0, "long", 0, "long", 0, "long", 0, "long", $DUPLICATE_CLOSE_SOURCE) ConsoleWrite("@error on DllCall #1: "& @TAB & @error & @CR) ;ConsoleWrite("Return on DllCall #1: "& @TAB & $ret & @CR) $ret = DllCall("ntdll.dll", "long", "NtClose", "long", $lhandle) ConsoleWrite("@error on DllCall #2: "& @TAB & @error & @CR) ;ConsoleWrite("Return on DllCall #2: "& @TAB & $ret & @CR) ConsoleWrite("MUTEX exists: "& @TAB & @TAB & _MutexExists($MUTEXname) & @CR) If _MutexExists($MUTEXname) == 1 Then ConsoleWrite("You have failed!" & @CR) Else ConsoleWrite("You have won!" & @CR) EndIf Else ConsoleWrite("Mutex name not found, script terminated" & @CR) EndIf Sleep(500) ProcessClose($lPID) Func _MutexOpen($MutexName) Local $hMutex = DllCall("kernel32.dll", "hwnd", "OpenMutex", "int", $MUTEX_ALL_ACCESS, "int", 0, "str", $MutexName) If IsArray($hMutex) And $hMutex[0] Then Return $hMutex[0] Return 0 EndFunc Func _MutexExists($MutexName) Local $hMutex = DllCall("Kernel32.dll", "hwnd", "OpenMutex", "int", 0x1F0001, "int", 1, "str", $MutexName) Local $aGLE = DllCall("Kernel32.dll", "int", "GetLastError") If IsArray($hMutex) And $hMutex[0] Then DllCall("Kernel32.dll", "int", "CloseHandle", "hwnd", $hMutex[0]) If IsArray($aGLE) And $aGLE[0] = 127 Then Return 1 Return 0 EndFunc #cs Success: @error = 0. Failure: set @error @error: 1 unable to use the DLL file, 2 unknown "return type", 3 "function" not found in the DLL file, 4 bad number of parameters. #ce I fail :|
  5. I do not even know if this code is correct plus I don't know where to get the parameters and what they are, that code is from this link got the handle of a process by running it (in the below exambple), but I need at least to get the handles associated to that PID as long (i got the name as string) #include <WinAPI.au3> Dim $sProcess = @WindowsDir&"\system32\notepad.exe" Dim $hProcess Dim $tPI = DllStructCreate($tagPROCESS_INFORMATION), $pPI = DllStructGetPtr($tPI) Dim $tSI = DllStructCreate($tagSTARTUPINFO), $pSI = DllStructGetPtr($tSI) DllStructSetData($tSI, 'Size', DllStructGetSize($tSI)) Dim $iSuccess = _WinAPI_CreateProcess('', $sProcess, 0, 0, False, 0, 0, 0, $pSI, $pPI) _WinAPI_CloseHandle(DllStructGetData($tPI, 'hThread')) $hProcess = DllStructGetData($tPI, 'hProcess') _WinAPI_WaitForInputIdle($hProcess) MsgBox(0, "", $hProcess)
  6. in this case is an OS object http://en.wikipedia.org/wiki/Mutual_exclusion
  7. so no one knows how to close an handle of a process mutant
  8. with a menu this doesnt work :\ edit: yes, was my bad, it works with a menu 2! just had to built it on the 1th win
  9. #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $button_1,$button_2, $button_3, $button_4 Local $Halt, $msg Opt("GUICoordMode", 1) GUICreate("T", 140, 260) $button_1 = GUICtrlCreateButton("Earth", 20, 20, 100, 40) $button_2 = GUICtrlCreateButton("Water", 20, 80, 100, 40) $button_3 = GUICtrlCreateButton("Fire", 20, 140, 100, 40) $button_4 = GUICtrlCreateButton("Air", 20, 200, 100, 40) WinSetOnTop("T", "", 1) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $GUI_EVENT_MINIMIZE Case $msg = $GUI_EVENT_MAXIMIZE Case $msg = $button_1 WinActivate ("Earth") Case $msg = $button_2 WinActivate ("Water") Case $msg = $button_3 WinActivate ("Fire") Case $msg = $button_4 WinActivate ("Air") Case $Halt = $msg EndSelect WEnd EndFunc
  10. its not forbidden by EULA/COC (macroing afk is), its just blocked cause its official unsupported
  11. I need some help over here
  12. maybe I need to translate this in autoit Private Sub CloseHandleEx(ByVal lPID As Long, ByVal lHandle As Long) Dim hProcess As Long hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, lPID) Call NtDuplicateObject(hProcess, lHandle, 0, ByVal 0, 0, 0, DUPLICATE_CLOSE_SOURCE) Call NtClose(hProcess) End Sub
  13. no, the names are right, DAoCi1 & DAoCi2, just cant kill that mutex (but process explorer can!)
  14. just use another variable HotKeySet("s", "go") ; start/pause the script with the key 's' Global $flag = False, $flag2 = False Global $coo[4] = [160, 35, 50, 20] ; array with x1, y1, x2, y2 coo Global $loc ; starting loc Global $ms = 250 ; mill.sec. between clicks, adjust it like you want While 1 If $flag == True Then If $flag2 == False Then $loc = MouseGetPos() $flag2 = True EndIf MouseClick("left", $loc[0], $loc[1], 1, 0) Sleep($ms) MouseClick("left", $loc[0] + $coo[0], $loc[1] + $coo[1], 1, 0) Sleep($ms) MouseClick("left", $loc[0] + $coo[0], $loc[1] + $coo[1], 1, 0) Sleep($ms) MouseClick("left", $loc[0] + $coo[0] + $coo[2], $loc[1] + $coo[1] + $coo[3], 1, 0) MouseMove($loc[0], $loc[1], 0) Else $flag2 = False EndIf WEnd Func go() $flag = Not $flag EndFunc edit: the mouse will come back to originary loc
×
×
  • Create New...