Jump to content

yuser

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by yuser

  1. I provided how you can do it in asm, even clearing the pages created. You simply need to split the file to be compared into parts to accommodate depending on memory available you have. Otherwise on x64 you can't compare files over 2 gb each. I see that you haven't thoroughly read the link I posted. Simply compile your DLL to handle unsigned pointers properly and it will work above 2gb on x86. I'm trying to contribute, and my contribution doesn't necessarily have to be code that fits all sizes as I have no intention of spoon feeding anyone who doesn't want to learn anything. If you think this doesn't refer to you, please ignore this post.
  2. I recommend reading this link from microsoft, it's informative and I hope it will help you. https://learn.microsoft.com/en-us/windows/win32/memory/memory-limits-for-windows-releases #include <Memory.au3> While 1 $dwPage = _MemVirtualAlloc(Null,0x8000 * 0x1000,$MEM_COMMIT,0x40) ConsoleWrite(Hex($dwPage,8) & @CRLF) If $dwPage = 0 Then Exit WEnd Try running this, and you'll see that you can use more than 2 gb since LAA is enabled. You can use GlobalMemoryStatusEx to get available bytes. As for the crash, you ran out of memory for $pOut (you can get this by debugging it or checking a crash dump). If you plan to compare files that are completely different than each other (which ruins the entire purpose for this code) then you're supposed to create enough uint_ptr for every single byte. To handle too many mismatches, the code can be rewritten so it puts even less pressure on autoit (Adding two bytes after uint_ptr as a container for byte comparison etc). Keep in mind that if you handle the output of files with very little similarity in arrays, you might reach max array size on the way. I hope I'm being clear enough Cheers x)
  3. Hi, thanks for the release. I believe one wouldn't need an external dll to compare bytes. The trick to comparing it faster is not letting autoit do it x). Simply loading whatever file you want in memory (not as string) and comparing bytes one by one using asm will be faster: #include <WinAPI.au3> #include <Memory.au3> #include <Array.au3> $iTimer = TimerInit() $pBuff1 = ReadFile("big file.dat") $pBuff2 = ReadFile("similarly big file.dat") $aCmp = CompareFiles($pBuff1,$pBuff2,0) $aBindex = CompareByteIndex($pBuff1,$pBuff2,$aCmp) $iTimer = TimerDiff($iTimer) _MemVirtualFree(DllStructGetPtr($pBuff1),0,$MEM_RELEASE) _MemVirtualFree(DllStructGetPtr($pBuff2),0,$MEM_RELEASE) _ArrayDisplay($aBindex,$iTimer & "ms") Exit Func CompareByteIndex($pBuffer1,$pBuffer2,$aCmp) Local $aReturn[$aCmp[0]+1][3] For $i = 1 To $aCmp[0] $iOffset = $aCmp[$i] $aReturn[$i][0] = Hex($iOffset,8) $aReturn[$i][1] = Hex(DllStructGetData($pBuffer1,1,$iOffset),2) $aReturn[$i][2] = Hex(DllStructGetData($pBuffer2,1,$iOffset),2) Next Return $aReturn EndFunc Func ReadFile($sPath) $hFile = _WinAPI_CreateFile($sPath,2,2) $iLen = _WinAPI_GetFileSizeEx($hFile) Local $pAlloc = _MemVirtualAlloc(Null,$iLen,$MEM_COMMIT,$PAGE_READWRITE) ; Creating my own pages to avoid conflict with autoit when i want to free them $pBuffer = DllStructCreate("Byte[" & $iLen & "]",$pAlloc) $iRead = 0 _WinAPI_ReadFile($hFile,$pBuffer,$iLen,$iRead) _WinAPI_CloseHandle($hFile) Return $pBuffer EndFunc Func CompareFiles($pBuffer1,$pBuffer2,$iStart,$iEnd=-1) $iSizeBuffer1 = DllStructGetSize($pBuffer1) $iSizeBuffer2 = DllStructGetSize($pBuffer2) $iSizeMin = ($iSizeBuffer1 < $iSizeBuffer2) ? $iSizeBuffer1 : $iSizeBuffer2 If $iEnd > $iSizeMin OR $iEnd = -1 Then $iEnd = $iSizeMin ; Cases for mismatching sizes $pAlloc = _MemVirtualAlloc(Null, 128, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE) $pOut = DllStructCreate("uint_ptr[" & 0x4000 & "]") ; Modify if you wish to have more If @AutoItX64 Then $pFunc = DllStructCreate("Byte[128]",$pAlloc) DllStructSetData($pFunc, 1, "0x55488BEC4883EC10C745F001000000C745F400000000498BF848897DF8488BC14801F84C8BD24901FA488B7DF84C39CF0F8332000000418A1238100F841C0000004C8B5D30488B7DF048C1E7034901FB488B7DF848FFC749893BFF45F048FFC049FFC2FF45F8EBC14C8B5DF0488B7D304C891F488BE55DC3") Else $pFunc = DllStructCreate("Byte[90]",$pAlloc) DllStructSetData($pFunc, 1, "0x558BEC83EC0CC745F8010000008B7D10897DFC8B450801F88B4D0C01F98B7DFC3B7D140F83230000008A1138100F84120000008B7DFC478B75F8C1E602037518893EFF45F84041FF45FCEBD18B75F88B7D1889378BE55DC21400") EndIf DllCallAddress("int",DllStructGetPtr($pFunc),"UINT_PTR",DllStructGetPtr($pBuffer1),"UINT_PTR",DllStructGetPtr($pBuffer2),"int",$iStart,"int",$iEnd,"UINT_PTR",DllStructGetPtr($pOut)) $iLen = DllStructGetData($pOut,1,1) Dim $aReturn[$iLen] $aReturn[0] = $iLen-1 For $i = 1 To $aReturn[0] $aReturn[$i] = DllStructGetData($pOut,1,$i+1) Next Return $aReturn EndFunc x64 code is slightly different as i don't usually deal with it I've tried comparing files of 1.5gb and as long as there's enough memory to load the file this should work. Autoit has large address aware on by default so even on x86 you should be able to handle quite a bit. Feel free to improve it, I have no real use for it so I can't come up with any x) Cheers
  4. AutoIT is single threaded, suspending the main thread and resuming from another thread will do. This way you can hide system trays. #include <WinAPI.au3> #include <WinAPIvkeysConstants.au3> MsgBox(0,"","") SetPause($VK_SHIFT) MsgBox(0,"","") Func SetPause($iHotkey) $iThreadID = _WinAPI_GetCurrentThreadId() $hThread = OpenThread($iThreadID) $hKernel32 = _WinAPI_GetModuleHandle("kernel32.dll") $hUser32 = _WinAPI_GetModuleHandle("user32.dll") $dwSuspendThread = _WinAPI_GetProcAddress($hKernel32,"SuspendThread") $dwResumeThread = _WinAPI_GetProcAddress($hKernel32,"ResumeThread") $dwGetAsyncKeyState = _WinAPI_GetProcAddress($hUser32,"GetAsyncKeyState") $dwSleep = _WinAPI_GetProcAddress($hKernel32,"Sleep") $struct_Addresses = DllStructCreate("handle Thread; int Hotkey; dword SuspendThread; dword ResumeThread; dword GetAsyncKeyState; dword Sleep") DllStructSetData($struct_Addresses,1,$hThread) DllStructSetData($struct_Addresses,2,$iHotkey) DllStructSetData($struct_Addresses,3,$dwSuspendThread) DllStructSetData($struct_Addresses,4,$dwResumeThread) DllStructSetData($struct_Addresses,5,$dwGetAsyncKeyState) DllStructSetData($struct_Addresses,6,$dwSleep) $struct_Function = DllStructCreate("Byte[28]") DllStructSetData($struct_Function,1, _ "0xFF33" _ ; push [ebx] // hThread & "FF5308" _ ; call dword ptr [ebx+08] // SuspendThread & "6A05" _ ; loop1:push 05 & "FF5314" _ ; call dword ptr [ebx+14] // Sleep & "FF7304" _ ; push [ebx+04] // vKey & "FF5310" _ ; call dword ptr [ebx+10] // GetAsyncKeyState & "663D0000" _ ; cmp ax,0000 & "74EF" _ ; je loop1 & "FF33" _ ; push [ebx] // hThread & "FF530C" _ ; call dword ptr [ebx+0C] // ResumeThread & "C3") ; ret $dwAddresses = DllStructGetPtr($struct_Addresses) $dwFunction = DllStructGetPtr($struct_Function) CreateThread($dwFunction,$dwAddresses) EndFunc Func OpenThread($iTID) $ret = DllCall("kernel32.dll", "hwnd", "OpenThread", "int", 0x0002, "int", 0, "int", $iTID) Return $ret[0] EndFunc Func CreateThread($lpStartAddress,$lpParameter) $ret = DllCall("Kernel32.dll","hwnd","CreateThread","ptr",0,"int",0,"ptr",$lpStartAddress,"int",$lpParameter,"int",0,"ptr*",0) Return $ret[0] EndFunc I wrote this code that creates a thread and suspends the main thread and resumes when hotkey is pressed. I pass the structure for necessary info from ebx using createthread. You might ask what's the point of suspending main thread from asm, there really isn't any but you can modify the code a bit to make a suspend/resume hotkey that works in a loop.
  5. My idea of a source being "secure" isn't just plain asm compiled. I fail to comprehend both the security merits, and the purpose of this. If your autoit code is going to be converted to another language, wouldn't it be easier to learn that language instead? Then you can VMP easily, end of story. Unless your only intent is to prevent kids who only know how to drag drop to get your 1337 source, this will not provide you the slightest help.
  6. I've tried using UIASpy to get handles to UI objects from action center. However, all it returned were for the actual window created and not controls or notifications. Also, the only available methods were the following: (taken from UIASpy) So I don't think UserNotificationListener is available, for this control that is. Another thing is that action center was not detected by UIASpy when it was minimzed. So action center should be clicked on and the window should be there for these methods to be used (although they don't seem to work for UserNotificationListener). Does anyone have any pointers on this issue?
  7. Executing excel with a parameter and running excel THEN opening a file is slightly different. When a workbook is opened directly with a parameter, it's like two windows were handled. The second window does not inhert the minimized flag that was assigned to the initial one. It's just the weird way that excel handles windows. To run a workbook "minimized", you can use this trick to run excel hidden, open a file, minimize the window, then set show flag. #include <Excel.au3> $sFilePath = "C:\test\test.xlsx" $sFileName = StringRight($sFilePath,StringLen($sFilePath)-StringInStr($sFilePath,"\",0,-1)) $oExcel = _Excel_Open(0) $oWorkbook = _Excel_BookOpen($oExcel,$sFilePath) Do Sleep(5) Until WinExists($sFileName & " - Excel") WinSetState($sFileName & " - Excel","",@SW_MINIMIZE) $oExcel.Visible = True
  8. Hi, I'm trying to receive a list of notifications found in native action/notification center of windows 10. I'm aware that system service apps can't do that. I've stumbled upon UI Automation by LarsJ to use UserNotificationListener (https://docs.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/notification-listener). I could not change the code to use UserNotificationListener method and I'm completely lost. Is there any other way to do this? If not, how could I use UIAutomation with UserNotificationListener? I would really appreciate any help on this issue. Thank you.
  9. Great! As always you'r amazing! Thanks a lot
  10. Hi there everyone, the thing is i've been trying to find a proper script for drawing on the screen. But what i mean is like paint on the screen without having a gui. What i saw so far was UEZ's code. #Include <ScreenCapture.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) _GDIPlus_Startup() Global Const $HBITMAP = _ScreenCapture_Capture("", 0, 0, @DesktopWidth, @DesktopHeight, 0) Global Const $hGUI = GUICreate("Mark screen by UEZ", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hGUI) Global Const $hGraphic_Bg = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($HBITMAP) _GDIPlus_GraphicsDrawImage($hGraphic_Bg, $hBmp, 0, 0) _WinAPI_DeleteObject($HBITMAP) Global Const $pen_size = 8 Global Const $hPen = _GDIPlus_PenCreate(0xff000000, $pen_size) GUISetOnEvent(-3, "_Exit") OnAutoItExitRegister("_Exit") GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "Draw", $hGUI) Global Const $om = MouseGetCursor() While Sleep(100000) WEnd Func Draw() Local $aMC, $mxo, $myo $aMC = GUIGetCursorInfo($hGUI) Sleep(50) Do GUISetCursor(0, 1, $hGUI) $mxo = $aMC[0] $myo = $aMC[1] $aMC = GUIGetCursorInfo($hGUI) If $mxo <> $aMC[0] Or $myo <> $aMC[1] Then _GDIPlus_GraphicsDrawLine($hGraphic_Bg, $aMC[0], $aMC[1], $mxo, $myo, $hPen) $mxo = $aMC[0] $myo = $aMC[1] EndIf Until Not $aMC[2] EndFunc Func _Exit() GUISetCursor($om, 1, $hGUI) GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "") _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic_Bg) _GDIPlus_Shutdown() GUIDelete($hGUI) Exit EndFuncThis works pretty okay except the smoothness of the pen which looks awful when you use :/ I either need to smoothen the pen on this script or ask for another. I appreciate your help in advance :^)
  11. Hi everyone, ehm I need to figure out how to upload images on a drag&drop image service (on the background) I don't know much about IE.au3 :< Thank you all in advance !
  12. Problem solved - Thank you guys
  13. Hi, i'd like to ask if someone help me with this. I want to get the position after stringinstr. Like : The file has "Help" in first line and in the second line there's "AutoIt" It'll search "AutoIt" in the file then will take out the position of it as Line 2. Thank you a lot in advance.
  14. Hello, i'd like to ask how i can prevent the disappearance of cursor on touch screens-it's like if you don't touch it for 2-3 secs it disappears until you touch again. I want to prevent tthat, if it's possible.(I'm going to use it for a script that lets the user note on screen like a pen) Thank you P.S : if it's possible, it would only work when script is the active window
  15. No, i'm searching something which will work on moveable picture. I will use it with this kind of code. Checkboxes need to stuck to the picture sth like that #include-once #include <GUIConstantsEx.au3> #Include <Misc.au3> #include <WinAPI.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <Middle.au3> Opt("GUIOnEventMode",1) Opt("MouseCoordMode", 2) $sPictureLocation=@ScriptDir&'\Logo.png' Global $hMain=GUICreate("Smooth Move",@DesktopWidth-6,(@DesktopWidth-6)/2,0,0,BitOR($WS_MINIMIZEBOX,$WS_POPUP,$WS_GROUP)) WinSetTrans("Smooth Move","","230") GUISetBkColor(0xFFFFFF,$hMain) GUISetOnEvent($GUI_EVENT_CLOSE,"_Exit") GUISetState(@SW_SHOW,$hMain) ; create pic control last _GDIPlus_Startup() $hImage1 = _GDIPlus_ImageLoadFromFile($sPictureLocation) $hPic=GUICtrlCreatePic('',100,25,_GDIPlus_ImageGetWidth($hImage1),_GDIPlus_ImageGetHeight($hImage1)) GUICtrlSetOnEvent(-1,"_PicClick") $hBMP1=_GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage1) _WinAPI_DeleteObject(GUICtrlSendMsg($hPic, 0x0172, 0, $hBMP1)) _GDIPlus_ImageDispose($hImage1) _GDIPlus_Shutdown() While 1 Sleep(10) WEnd Func _PicClick() _SmoothMove(@GUI_CtrlId) $bChange=False $arPos=ControlGetPos($hMain,'',@GUI_CtrlId) If $arPos[0]<0 Then $arPos[0]=0 $bChange=True EndIf If $arPos[1]<0 Then $arPos[1]=0 $bChange=True EndIf If $arPos[0]+$arPos[2]>@DesktopWidth-6 Then $arPos[0]=@DesktopWidth-6-$arPos[2] $bChange=True EndIf If $arPos[1]+$arPos[3]>(@DesktopWidth-6)/2 Then $arPos[1]=(@DesktopWidth-6)/2-$arPos[3] $bChange=True EndIf If $bChange Then GUICtrlSetPos(@GUI_CtrlId,$arPos[0],$arPos[1]) EndFunc Func _ControlMove($nCID) $arPos=MouseGetPos() $arPieceInfo=ControlGetPos($hMain,"",$nCID) $nXOffset=$arPos[0]-$arPieceInfo[0] $nYOffset=$arPos[1]-$arPieceInfo[1] While _IsPressed("01") $arPos=MouseGetPos() ControlMove($hMain,'',$nCID,$arPos[0]-$nXOffset,$arPos[1]-$nYOffset) Sleep(10) WEnd EndFunc Func _SetPositionmove($nCID) $arPos=MouseGetPos() $arPieceInfo=ControlGetPos($hMain,"",$nCID) $nXOffset=$arPos[0]-$arPieceInfo[0] $nYOffset=$arPos[1]-$arPieceInfo[1] While _IsPressed("01") $arPos=MouseGetPos() GUICtrlSetPos($nCID,$arPos[0]-$nXOffset,$arPos[1]-$nYOffset) Sleep(10) WEnd EndFunc Func _SmoothMove($nCID) $arPos=MouseGetPos() Opt("MouseCoordMode",1) $Temp=MouseGetPos() Opt("MouseCoordMode",2) Local $nGlobalYOffset=$Temp[1]-$arPos[1] Local $nGlobalXOffset=$Temp[0]-$arPos[0] $arPieceInfo=ControlGetPos($hMain,"",$nCID) $nXOffset=$arPos[0]-$arPieceInfo[0] $nYOffset=$arPos[1]-$arPieceInfo[1] Local $hTempWin=GUICreate('temp',$arPieceInfo[2],$arPieceInfo[3],$arPieceInfo[0]+$nGlobalXOffset,$arPieceInfo[1]+$nGlobalYOffset, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD,$WS_EX_TOPMOST),$hMain) _GDIPlus_Startup() $hImage1 = _GDIPlus_ImageLoadFromFile($sPictureLocation) _SetBitmap($hTempWin,$hImage1,255) _GDIPlus_ImageDispose($hImage1) GUISetState(@SW_SHOWNA,$hTempWin) GUICtrlSetState($nCID,$GUI_HIDE) While _IsPressed("01") $arPos=MouseGetPos() WinMove($hTempWin,'',$arPos[0]-$nXOffset+$nGlobalXOffset,$arPos[1]-$nYOffset+$nGlobalYOffset) WEnd $arPos=WinGetPos($hTempWin) GUICtrlSetPos($nCID,$arPos[0]-$nGlobalXOffset,$arPos[1]-$nGlobalYOffset) GUICtrlSetState($nCID,$GUI_SHOW) GUIDelete($hTempWin) GUISwitch($hMain) EndFunc Func _SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend Local $AC_SRC_ALPHA=1 $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc Func _Exit() GUIDelete($hMain) Exit EndFunc
  16. Hey, can anyone help me with adding checkboxes on a movable picture? No gui on that, only picture moves in the full screen freely. I want to add checkboxes on that which will move with the picture. Thank you
×
×
  • Create New...