Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/17/2021 in all areas

  1. Note that this UserNotificationListener (class) that you are referring to has nothing to do with UIA (User Interface Automation) code. It has something to do with UI (User Interface) code used to create and manage user interfaces. This means that the UserNotificationListener (class) can in no way be used in relation to UIA code. Regarding UIASpy and Windows 10 Action Center, have you asked UIASpy to generate information for the entire control structure in the window as described in this post? But even if you can get more UIA information about the Action Center, and I'm pretty sure you can, it's not necessarily entirely trivial to access the information in the individual notifications. A easier approach might be to take a closer look at the C# code associated with the example for the UserNotificationListener class. It's possible to execute C# code in an AutoIt script with the techniques demonstrated in this example. Whatever approach you take, I'll not be contributing any code right now. Nevertheless, it's an interesting topic and I've made a note on it so that I can take a closer look when the opportunity arises.
    1 point
  2. I don't see why that would be required unless they have a limit on the number of transactions they will process per user.
    1 point
  3. Suggest that you split this into two separate lines so that you can check the return value and @error following the call to InetRead and then BinaryToString.
    1 point
  4. Just general tip for optimalization: If your CSV files doesn't change during your loop then avoid reading+parsing them inside loop repeatedly. Instead read them (FileRead+StringSplit) into variable type of array before main loop and inside loop only go through these (two) arrays.
    1 point
  5. Nah, that’s just you being cute; this is me being cute
    1 point
  6. Well i'll be, I did a test and it does output a 0x81. That is true about optimized compiled code but I was thinking that the nature of a strings being somewhat slow as are string comparisons that it might be possible that an autoit loop simply evaluating a a bool statement could be faster but what was i thinking lol. Ok I think I got it figured out its kinda simple and but its fast and it does make sense even though the math is weird due to mixing what amounts to a 0 based array and a 1 based index on the binary string but it is fast. Its not going to display via array display but it seems to be the ticket. #include <WinAPISys.au3> $struct = DllStructCreate("struct;byte[256];endstruct",DllStructGetPtr(_WinAPI_GetKeyboardState())) $timer = TimerInit() $binary = Binary(DllStructGetData($struct,1)) ;once you are here you have what amounts to a binary array accessed via $state = BinaryMid($binary,$key_code+1,1(byte)) ConsoleWrite("timer = " & TimerDiff($timer) & "ms" & @CRLF) for $x = 1 to BinaryLen($binary) ;just for display purposes ConsoleWrite("key = 0x" & Hex($x-1,2) & " State " & Int(BinaryMid($binary,$x,1)) & @CRLF) Next
    1 point
  7. with dllstruct syntax you can have a similar syntax than an array index: $arr = DllStructCreate('byte b[256]') DllCall('user32.dll', 'bool', 'GetKeyboardState', 'struct*', $arr) $arr.b( 1 + $VK_CONTROL) ; <<<< VK_CONTROL byte otherwise you will need to get a string with the One-Liner array (and then convert back to number on demand) $arr = StringRegExp(StringRegExpReplace(DllStructGetData(_WinAPI_GetKeyboardState(),1),'[[:xdigit:]]{2}','0x$0'),'.{4}',3,3) _ArrayDisplay($arr) ; yeyeah one-liner \o/
    1 point
  8. Hello. Do it like this. (Start-Process App.exe -PassThru -Wait).ExitCode Saludos
    1 point
  9. rtlmovememory wasn't accessible from the user mode when i tested (looks weird as it is stated on msdn that it is on ntdll (for usermode)) to search into a raw buffer, well usually you do that on language 'oriented' to it, but in AutoIt i usually do some regexp for pattern matching anyway you can still run some batch of asm (done some tests few days ago), just hard code in asm the pattern finder and call it with a dllcall in autoit, gonna send some code later on, need to find where i put this stuff haha, i guess this will be the fastest way: calling from autoit is slow, but the no allocation and really fast asm instruction may finally compensate EDIT: @Nine here are some idea, ofc just change the asm to handle w/e, i wrote that in 5 mins so guess it's not optimal at all >> CDECL 0: 57 push edi 1: 53 push ebx 2: 8b 5c 24 0c mov ebx,DWORD PTR [esp+0xc] 6: 8b 4c 24 10 mov ecx,DWORD PTR [esp+0x10] a: 8b 54 24 14 mov edx,DWORD PTR [esp+0x14] e: 01 ca add edx,ecx 10: 31 c0 xor eax,eax 00000012 <MatchLoop>: 12: 8d 3c 81 lea edi,[ecx+eax*4] 15: 39 d7 cmp edi,edx 17: 7d 07 jge 20 <NotFound> 19: 3b 1f cmp ebx,DWORD PTR [edi] 1b: 74 06 je 23 <Return> 1d: 40 inc eax 1e: eb f2 jmp 12 <MatchLoop> 00000020 <NotFound>: 20: 83 c8 ff or eax,0xffffffff 00000023 <Return>: 23: 5b pop ebx 24: 5f pop edi 25: c3 ret NB: we don't need to align the <MatchLoop> as the whole loop is included in the 16b cache from 00000010 ; Here a little snippet i use to align and npad stuff inside chunks of asm ; #TOSEE: disgusting string convertion, StringReplace and string concatenation ... but w/e those binaries should be quite small ; maybe could use StringRegExReplace func _OptimizeCallable($bin) ; for x86 we ALIGN 16 $bin = Binary($bin) ; to ensure Binary local $len = BinaryLen($bin) local $struct = DllStructCreate('BYTE b[' & (15 + $len) & ']') local $base = DllStructGetPtr($struct) local $offset = Number(BitAND($base + 15, BitNOT(15)) - $base) $bin = StringTrimLeft(String($bin),2) ; replace nop x by conservative instructions ; Intel recommandation: some kernel code assume those are atomic $bin = StringReplace($bin, '9090909090909090', '0F1F840000000000') ; 8: nop d[eax+eax+0x0] (+32b) $bin = StringReplace($bin, '90909090909090' , '0F1F8000000000' ) ; 7: nop d[eax+0x0] (+32b) $bin = StringReplace($bin, '909090909090' , '660F1F440000' ) ; 6: nop w[eax+eax+0x0] (+08b) $bin = StringReplace($bin, '9090909090' , '0F1F440000' ) ; 5: nop d[eax+eax+0x0] (+08b) $bin = StringReplace($bin, '90909090' , '0F1F4000' ) ; 4: nop d[eax+0x0] (+08b) $bin = StringReplace($bin, '909090' , '0F1F00' ) ; 3: nop d[eax] $bin = StringReplace($bin, '9090' , '6690' ) ; 2: ops nop | xchg ax,ax ; add padding bytes before (nop) and after (int3) for $i = 1 to $offset $bin = '90' & $bin ; nop < to avoid an INT3 if we call between base and func addr next for $i = 1 to (15-$offset) $bin = $bin & 'CC' ; INT3 < must be a RET or JMP/JCC before so if it happens = malformed next $struct.b = Binary('0x' & $bin) local $ret = [$struct,$base+$offset] return $ret endfunc global $FindDowrdAsm = null global $FindDowrdAsm_ptr = null func InitAsm() local $res = _OptimizeCallable('0x57538B5C240C8B4C24108B54241401CA31C08D3C8139D77D073B1F740640EBF283C8FF5B5FC3') $FindDowrdAsm = $res[0] $FindDowrdAsm_ptr = $res[1] endfunc func FindDwordAsm($aStruct, $aValue) local $res = DllCallAddress('DWORD:cdecl', $FindDowrdAsm_ptr, 'DWORD', $aValue, 'DWORD', DllStructGetPtr($aStruct), 'DWORD', DllStructGetSize($aStruct)) return $res[0] endfunc func FindDword($aStruct, $aValue) local $size = Floor(DllStructGetSize($aStruct) / 4) for $i = 1 to $size if (DllStructGetData($aStruct, 1, $i) = $aValue) then return ($i - 1) endif next return (-1) endfunc $data = DllStructCreate('DWORD D[1024]') $pos = 950 $data.D(1 + $pos) = 0x10 InitAsm() $nb = 1000 global $arr = [ [0,0] , [0,0] ] for $i = 1 to $nb $time = TimerInit() FindDwordAsm($data, 0x10) $time = TimerDiff($time) $arr[0][0] += $time $arr[0][1] += $time * $time $time = TimerInit() FindDword($data, 0x10) $time = TimerDiff($time) $arr[1][0] += $time $arr[1][1] += $time * $time next $arr[0][0] /= $nb $arr[0][1] = Sqrt( $arr[0][1] / $nb - $arr[0][0] * $arr[0][0] ) $arr[1][0] /= $nb $arr[1][1] = Sqrt( $arr[1][1] / $nb - $arr[1][0] * $arr[1][0] ) ; mean stdev println(StringFormat('Asm : %.4f | %.4f', $arr[0][0], $arr[0][1])) println(StringFormat('Naive : %.4f | %.4f', $arr[1][0], $arr[1][1])) The output: Asm : 0.0175 | 0.0075 Naive : 1.6179 | 0.5095 Even with 1000 calls the avg may significantly vary, but the acceleration magnitude is always about a factor 100 on my computer. Ofc the code is not really safe, doesn't handle error, can fall in segfault, etc ; but it's just about a proof of concept
    1 point
  10. rover

    Live Slider Control

    search forum for WM_HSCROLL, many examples of this register WM_HSCROLL and/or WM_VSCROLL messages only occur on event no continuous slider reading in main loop can be used with OnEvent or loop mode #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SliderConstants.au3> Opt('MustDeclareVars', 1) ;Global Const $WM_HSCROLL = 0x0114 ;Global Const $WM_VSCROLL = 0x0115 Global $Slider, $hSlider, $Dummy, $iBuffer, $Label Example() Func Example() Local $hGUI, $msg $hGUI = GUICreate("Slider Demo", 280, 100) $Label = GUICtrlCreateLabel('0', 125, 50, 30, 20) $Slider = GUICtrlCreateSlider(40, 10, 200, 30, BitOR($TBS_AUTOTICKS, $TBS_TOOLTIPS)) $hSlider = GUICtrlGetHandle($Slider) GUICtrlSetCursor(-1, 0) $Dummy = GUICtrlCreateDummy() ;one or both at same time GUIRegisterMsg($WM_HSCROLL, "WM_HVSCROLL") ;horz slider ;GUIRegisterMsg($WM_VSCROLL, "WM_HVSCROLL");vert slider GUISetState() Do $msg = GUIGetMsg() Switch $msg Case $Dummy _Slider() EndSwitch Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>Example Func _Slider() Local $iValue, $sValue $iValue = GUICtrlRead($Dummy) If $iBuffer <> $iValue Then $iBuffer = $iValue GUICtrlSetData($Label, $iBuffer) ;ConsoleWrite('-Value = ' & $iBuffer & @CRLF) EndIf Return EndFunc ;==>_Slider Func WM_HVSCROLL($hwnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Switch $iMsg Case $WM_HSCROLL Switch $lParam Case $hSlider GUICtrlSendToDummy($Dummy, GUICtrlRead($Slider)) EndSwitch Case $WM_VSCROLL EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_HVSCROLL
    1 point
×
×
  • Create New...