Leaderboard
Popular Content
Showing content with the highest reputation on 06/02/2023 in all areas
-
I recently bumped into winmm.dll and found that it was the resource file of Sound.au3 UDF for all of its audio functions. I was interested in learning its video funtions as well to find if it could replace WMPlayer.OCX in my zPlayer. I have been a bit dissatisfied with WMPlayer object because it required a resizing process for a simple toggle between play and pause. This made the video to flicker and it was annoying. That was the reason for going back to the earlier version of zPlayer, knowing that WMPlayer object embedded in IE may not be supported by Windows in the near future. Edit: Attached is a media player based on wimm.dll. Much of the time I spent to make this player was on video playback. I foresee that this player will ultimately be the future version of my zPlayer. I had a lot of fun working on this. And I have to say thank you to many of forum members for helping me out when I had difficulties. If an error is found, I would expect that you would kindly let me know. If you download the latest version, hopefully the error would have been corrected already. (File updated on August 15, 2023) ==> Please visit here for the latest update. WINMM.DLL Media Player.zip1 point
-
Help with best way to do this function
Andreik reacted to pixelsearch for a topic
@Andreik I tried some asm these last days 1) First of all, I downloaded the last stable version 2.16.01 of nasm (netwide assembler) which is free, from the original nasm website and simply placed nasm.exe in a new folder C:\nasm The goal was to be able to "quickly" compile an .asm program and grab its corresponding .obj file, to use automatically its inner binary code with AutoIt DllCallAddress function, as you did in your 1st post. Then we can modify the asm code directly from the AutoIt Edit control, compile and test again etc... all this without leaving the script, while using 2 buttons named "Compile" and "Test code" 2) To do that, I scripted a basic pattern (reusable when needed), a sort of "quick nasm compiler/tester with AutoIt" : #include <Array.au3> ; during tests #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) ;0=no (default), 1=require pre-declaration Opt("GUICloseOnESC", 0) ;1=ESC closes (default), 0=ESC won't close Global $g_Nasm_Path = "C:\nasm\", $g_Nasm_Exe = $g_Nasm_Path & "nasm.exe", $g_File_Err = $g_Nasm_Path & "nasmerr.err" Global $g_File_Asm = $g_Nasm_Path & "test.asm", $g_File_Obj = $g_Nasm_Path & "test.obj", $g_File_Lst = $g_Nasm_Path & "test.lst" Global $g_iGui_W = 900, $g_iGui_H = 600 Global $g_hGui = 0, $g_idEdit, $g_sAsmJustCompiled, $g_bJustCompiled, $g_sHexCode ; In case of global variables, add them here ; ... Main() ;============================================ Func Main() If Not FileExists($g_Nasm_Exe) Then Exit MsgBox($MB_TOPMOST, "File doesn't exist", $g_Nasm_Exe) $g_hGui = GUICreate("Nasm test (v1)", $g_iGui_W, $g_iGui_H, -1, -1, _ BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), _ $WS_EX_ACCEPTFILES) ; accept to maximize & resize the GUI, also accept drag & drop $g_idEdit = GUICtrlCreateEdit("", 1, 1, _ $g_iGui_W - 2, $g_iGui_H - 100, _ BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL)) ; no hozizontal scrollbar ; or if we want horizontal scrollbar : BitOR($GUI_SS_DEFAULT_EDIT)) GUICtrlSetFont(-1, 11, 400, 0, "Lucida Console") GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; drag & drop accepted in the edit control (it will accept .asm file content) GUICtrlSendMsg($g_idEdit, $EM_LIMITTEXT, -1, 0) ; added to allow unlimited text size in edit control _SetTabStops($g_idEdit, 14) ; 14 corresponds approx. to 4 characters width (as my Scite) in this Standard Edit control with this font Local $idCompile = GUICtrlCreateButton("Compile", 100, $g_iGui_H - 70 , 80, 30) Local $idTest = GUICtrlCreateButton("Test code", 250, $g_iGui_H - 70 , 80, 30) GUICtrlSetState($idTest, $GUI_DISABLE) GUISetState(@SW_SHOW, $g_hGui) ; Reload eventual .asm test file If FileExists($g_File_Asm) Then GUICtrlSetData($g_idEdit, FileRead($g_File_Asm)) EndIf While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE If MsgBox(BitOr($MB_YESNO, $MB_TOPMOST, $MB_ICONQUESTION, $MB_DEFBUTTON2), _ "Attention", "Quit the script ?", 0, $g_hGui) = $IDYES Then If FileExists($g_File_Asm) Then ; keep a backup, who knows... FileMove($g_File_Asm, $g_File_Asm & "_bak", 1) ; $FC_OVERWRITE (1) = overwrite existing files. EndIf _Write_Asm() ExitLoop ; While 1 EndIf Case $idCompile GUICtrlSetState($idCompile, $GUI_DISABLE) ; prevent accidental double click on the button GUICtrlSetState($idTest, $GUI_DISABLE) $g_bJustCompiled = False _Compile() If $g_bJustCompiled Then GUICtrlSetState($idTest, $GUI_ENABLE) GUICtrlSetState($idCompile, $GUI_ENABLE) Case $idTest GUICtrlSetState($idTest, $GUI_DISABLE) ; prevent accidental double click on the button GUICtrlSetState($idCompile, $GUI_DISABLE) If $g_sAsmJustCompiled <> StringStripWS(GUICtrlRead($g_idEdit), 1 + 2) Then ; 1=strip leading white space, 2=strip trailing white space MsgBox($MB_TOPMOST, "Watch out", "Asm code has changed, please compile", 0, $g_hGui) Else _Test() EndIf GUICtrlSetState($idCompile, $GUI_ENABLE) GUICtrlSetState($idTest, $GUI_ENABLE) Case $GUI_EVENT_DROPPED If @GUI_DragId = -1 Then ; -1 means dragged from a file (only alternative is to drag from... Listview item : help file) ; If StringRight(@GUI_DragFile, 4) <> ".asm" Or StringRight(@GUI_DragFile, 4) <> ".txt" Then If StringRight(@GUI_DragFile, 4) <> ".asm" Then ; GuiCtrlSendMsg($g_idEdit, $EM_SETREADONLY, 1, 0) ; read-only (too late, name of bad file extension already pasted in edit control) MsgBox($MB_TOPMOST, "Drag & Drop", _ @GUI_DragFile & " does not have an .asm extension", 0, $g_hGui) ; GuiCtrlSendMsg($g_idEdit, $EM_SETREADONLY, 0, 0) ; not read-only Else GUICtrlSetData(@GUI_DropId, FileRead(@GUI_DragFile)) EndIf EndIf EndSwitch WEnd ; in case of global structures in the script, release them here (not mandatory but why not) ; ... GUIDelete($g_hGui) EndFunc ;==>Main() ;============================================ Func _Compile() _Write_Asm() If @error Then Return ; Local $sCommand = " /c C:\nasm\nasm.exe -Z C:\nasm\nasmerr.err -l C:\nasm\test.lst -f win32 C:\nasm\test.asm" Local $sCommand = " /c " & $g_Nasm_Exe & " -Z " & $g_File_Err & " -l " & $g_File_Lst & " -f win32 " & $g_File_Asm Local $iRet = RunWait(@ComSpec & $sCommand, $g_Nasm_Path, @SW_HIDE) ; Help file RunWait : runs an external program and pauses script execution until the program finishes. ; Return Value : ; Success: the exit code of the program that was run. ; Failure: sets the @error flag to non-zero. Select Case @error MsgBox($MB_TOPMOST, "RunWait", "AutoIt error, please check AutoIt code", 0, $g_hGui) Return Case $iRet MsgBox($MB_TOPMOST, "Nasm compile : ERROR", FileRead($g_File_Err), 0, $g_hGui) Return Case Else ; get binary code from nasm list file Local $sFile_Lst = FileRead($g_File_Lst) Local $aArray = StringRegExp($sFile_Lst, '(?m)^.{16}([[:xdigit:]]{2,})', 3) ; according to $g_File_Lst format If @error Then MsgBox($MB_TOPMOST, '$aArray - StringRegExp', _ 'error = ' & @error & (@error = 1 ? ' (no matches)' : ' (bad pattern)'), 0, $g_hGui) Return EndIf ; get binary code from nasm obj file (preparing a double check) Local $hFile_Obj = FileOpen($g_File_Obj, 0 + 16) ; $FO_READ = 0 , $FO_BINARY = 16 If $hFile_Obj = -1 Then MsgBox($MB_TOPMOST, "FileOpen error", $g_File_Obj & " could not be opened", 0, $g_hGui) Return EndIf Local $aArray2 = StringRegExp(FileRead($hFile_Obj), '000020005060(.+)2E66696C6500', 3) ; according to $g_File_Obj format If @error Then MsgBox(0, '$aArray2 - StringRegExp', _ 'error = ' & @error & (@error = 1 ? ' (no matches)' : ' (bad pattern)'), 0, $g_hGui) FileClose($hFile_Obj) Return EndIf FileClose($hFile_Obj) ; double check binary code extracted from nasm list file with binary code found in nasm obj file $g_sHexCode = "" For $i = 0 To Ubound($aArray) - 1 $g_sHexCode &= $aArray[$i] Next If $g_sHexCode <> $aArray2[0] Then MsgBox($MB_TOPMOST, "Double check error", "Binary code is different between these 2 files :" & @crlf & _ $g_File_Lst & @crlf & _ $g_File_Obj, 0, $g_hGui) $g_sHexCode = "" Return Else MsgBox($MB_TOPMOST, "Nasm compile : done", $sFile_Lst, 0, $g_hGui) ; _ArrayDisplay($aArray) EndIf EndSelect $g_sAsmJustCompiled = StringStripWS(GUICtrlRead($g_idEdit), 1 + 2) ; 1=strip leading white space, 2=strip trailing white space $g_bJustCompiled = True EndFunc ;==>_Compile ;============================================ Func _Write_Asm() Local $hFile_Asm = FileOpen($g_File_Asm, 2) ; 2 = Write mode (erase previous contents) If $hFile_Asm = -1 Then ClipPut(GUICtrlRead($g_idEdit)) MsgBox($MB_TOPMOST, "FileOpen error", _ $g_File_Asm & " could not be opened" & @crlf & _ "(Asm code has been copied to the Clipboard)" , 0, $g_hGui) Return SetError(1, 0, 0) Else FileWrite($hFile_Asm, GUICtrlRead($g_idEdit)) FileClose($hFile_Asm) EndIf EndFunc ;==>_Write_Asm ;============================================ Func _SetTabStops($hWnd, $iTabStops) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) ; Next line _SendMessage based on _GUICtrlEdit_SetTabStops / _GUICtrlRichEdit_SetTabStops, with "uint*" instead of "struct*" of course. _SendMessage($hWnd, $EM_SETTABSTOPS, 1, $iTabStops, 0, "wparam", "uint*") EndFunc ;==>_SetTabStops ;============================================ Func _Test() If $g_bJustCompiled Then ; only once after each successful compile. ; set/reset functions here. ; ... $g_bJustCompiled = False EndIf ; launch function tests then display results here. ; ... MsgBox($MB_TOPMOST, "Test", "Done", 0, $g_hGui) EndFunc ;==>_Test 3) Now we can add some code to the pattern, for example : ; 1) if you got Global variables, place them at the beginning of program, before Main() ; ===================================================================================== Global $g_tData = DllStructCreate('int Data[100000]'), $g_NbElem ... ; 2) replace the _Test() function of the pattern with your own _Test() function ; ============================================================================= Func _Test() If $g_bJustCompiled Then ; only once after each successful compile. ; set/reset functions here. FillStruct($g_tData) ; fill it with 0xFFFFFFFF everywhere LoadSomeTestNumbers2($g_tData) ; this will also reset $g_NbElem (+++) $g_bJustCompiled = False EndIf ; launch function tests then display results here. Local $Minimum = GetMinimum($g_tData) WriteNumber($g_tData, $Minimum) MsgBox($MB_TOPMOST, "Minimum", $Minimum, 0, $g_hGui) EndFunc ;==>_Test ... ; 3) place your own functions at the end of the script ; ==================================================== Func FillStruct(ByRef $tStruct) Local $Code = Binary('0x8B7424048B4C2408C706FFFFFFFF83C604E2F5C20800') ; Andreik's original Local $iSize = BinaryLen($Code) Local $tCode = DllStructCreate('byte Code[' & $iSize & ']') DllStructSetData($tCode, 'Code', $Code) Local $aCall = DllCallAddress('int', DllStructGetPtr($tCode), 'ptr', DllStructGetPtr($tStruct), 'int', DllStructGetSize($tStruct) / 4) EndFunc Func LoadSomeTestNumbers2(ByRef $tStruct) $g_NbElem = 10000 Local $aNumbers[$g_NbElem] For $Index = 10 To ($g_NbElem - 1) + 10 ; 10000 times (from 10 To 10009) WriteNumber($tStruct, $Index) Next EndFunc Func GetMinimum(ByRef $tStruct) Local $Code = Binary('0x' & $g_sHexCode) Local $iSize = BinaryLen($Code) Local $tCode = DllStructCreate('byte Code[' & $iSize & ']') DllStructSetData($tCode, 'Code', $Code) ;~ Local $aCall = DllCallAddress('int', DllStructGetPtr($tCode), 'ptr', DllStructGetPtr($tStruct), 'int', DllStructGetSize($tStruct) / 4) Local $aCall = DllCallAddress('int', DllStructGetPtr($tCode), 'ptr', DllStructGetPtr($tStruct), 'int', $g_NbElem) ; ok too here... $g_NbElem += 1 ; ...but then, don't forget to increment $g_NbElem ! Return $aCall[0] EndFunc Func WriteNumber(ByRef $tStruct, $Minimum) Local $Code = Binary('0x8B7424048B4C24088B54240CAD83F8FF7409E2F8B8FFFFFFFFEB088956FCB800000000C20C00') ; Andreik's original Local $iSize = BinaryLen($Code) Local $tCode = DllStructCreate('byte Code[' & $iSize & ']') DllStructSetData($tCode, 'Code', $Code) Local $aCall = DllCallAddress('int', DllStructGetPtr($tCode), 'ptr', DllStructGetPtr($tStruct), 'int', DllStructGetSize($tStruct) / 4, 'int', $Minimum) Return $aCall[0] EndFunc Here is a display of the minimalist GUI : Here are some basic .asm codes I tested, trying to get correct results when dealing with signed integers > 7FFFFFFF ;============================================ ; https://www.autoitscript.com/forum/topic/210242-help-with-best-way-to-do-this-function/?do=findComment&comment=1518466 ; original andreik asm code starting search from 0 (will return a minimum = 0 which is correct... ; as elements of structure go from 10 to 10009) mov esi, [esp + 4] mov ecx, [esp + 8] ; counter for LOOP/LOOPcc xor edx, edx ; blanks edx (same as mov edx, 0) next: lodsd cmp eax, edx je increase loop next jmp exit increase: mov esi, [esp + 4] mov ecx, [esp + 8] inc edx jmp next exit: mov eax, edx ret 8 ============================================ ; https://www.autoitscript.com/forum/topic/210242-help-with-best-way-to-do-this-function/?do=findComment&comment=1518527 ; andreik asm code + my change starting search from 10 (will return a minimum = 10010 which is correct... ; ...as elements of structure go from 10 to 10009) mov esi, [esp + 4] mov ecx, [esp + 8] ; xor edx, edx ; blanks edx (same as mov edx, 0) mov edx, 10 next: lodsd cmp eax, edx je increase loop next jmp exit increase: mov esi, [esp + 4] mov ecx, [esp + 8] inc edx jmp next exit: mov eax, edx ret 8 ============================================ ; https://stackoverflow.com/questions/42795616/unsigned-integers-in-assembly ; search lowest value found in test elements (10 to 10009 => 10) and return it in eax (e.g. AutoIt $aCall[0]) ; remember that integers starting from 080000000h (-2147483647) to 0FFFFFFFFh (-1) are signed integers, so... ; ...if we mov edx, 0FFFFFFFFh and want it to be an unsigned integer, then some jump instructions has to... ; ...be changed : no more jg, jl, etc... (signed interpretation) but ja, jb, etc... (unsigned interpretation) ; testing the lowest value of test elements (which are integers from 10 to 10009) depending on an... ; initial mov edx, ... (test also the whole structure elements which contain lots of 0FFFFFFFFh !) ; 000000000h = 0 ; 07FFFFFFFh = 2147483647 ; 080000000h = -2147483648 ; 080000001h = -2147483647 ; 0FFFFFFFEh = -2 ; 0FFFFFFFFh = -1 mov esi, [esp + 4] mov ecx, [esp + 8] ; counter for LOOP/LOOPcc ; mov edx, 000000000h ; then jl found_lower => 0 (good) and jb found_lower => 0 (good) ... ; ... when loop only in test elements (which seems the best way to loop) ; mov edx, 000000000h ; then jl found_lower => -1 (bad) and jb found_lower => 0 (good) ... ; ... when loop in test elements + all remaining elements of the structure (as 0FFFFFFFFh will be found !) ; mov edx, 07FFFFFFFh ; then jl found_lower => 10 (good) and jb found_lower => 10 (good) ... ; ... when loop only in test elements (which seems the best way to loop) ; mov edx, 07FFFFFFFh ; jl found_lower => -1 (bad) but jb found_lower => 10 (good) ... ; ... when loop in test elements + all remaining elements of the structure (as 0FFFFFFFFh will be found !) ; Below, same result if test on panel elements or on the whole structure elements (including panel elements) ; mov edx, 080000000h ; then jl found_lower => -2147483648 (bad) but jb found_lower => 10 (good) ; mov edx, 080000001h ; then jl found_lower => -2147483647 (bad) but jb found_lower => 10 (good) ; mov edx, 0FFFFFFFEh ; then jl found_lower => -2 (bad) but jb found_lower => 10 (good) mov edx, 0FFFFFFFFh ; then jl found_lower => -1 (bad) but jb found_lower => 10 (good) find_lowest: lodsd cmp eax, edx ; jl found_lower ; bad result for signed integers 080000000h to 0FFFFFFFFh jb found_lower ; good result for unsigned integers 080000000h to 0FFFFFFFFh continueloop: loop find_lowest jmp exit found_lower: mov edx, eax jmp continueloop exit: mov eax, edx ; returned to AutoIt $aCall[0] ret 8 ===================================== ; several clicks on Test button will display the minimum values > test elements (which go from 10 to 10009) mov esi, [esp + 4] ; 1st AutoIt parameter (first test element of AutoIt structure) mov ecx, [esp + 8] ; 2nd AutoIt parameter (counter for LOOP/LOOPcc) mov edx, 0FFFFFFFFh ; watch out as -1 if treated as signed integer (by jg, jl, etc...) find_lowest: lodsd ; the "no-operand" syntax (esi is the source operand, eax the destination operand) cmp eax, edx ; jl found_lower ; 0 bad (as -1 first time, then only 1 inc edx => 0) then 1, 2... (all bad) jb found_lower ; 10010 good (1st number > 10 when test elements go from 10 to 10009) then 10011, 10012... continueloop: loop find_lowest jmp search_empty found_lower: mov edx, eax jmp continueloop search_empty: mov esi, [esp + 4] mov ecx, [esp + 8] inc edx next: lodsd cmp eax, edx je search_empty loop next mov eax, edx ; eax content returned to AutoIt $aCall[0] ret 8 ; 8 to remove both parameters from stack It's easy to copy each one of the asm code and paste it directly in the Edit control of the Gui, click compile and test etc... Maybe this AutoIt pattern could be helpful for some users (like me) to discover and test some asm instructions. Thanks for reading1 point -
Spent more time today, playing around with GDIPlus, working out the code to do image resizing for when it is required etc. I also improved some of my code and turned some into functions, including for the GDIPlus code used by the ADD button. When you select an ebook entry in the ListView, it now also selects the source image in the List field if the image and entry exist. This would only be for those images that I need to add or fix. I've added some percentage stuff to the Settings window, which is used by the GDIplus code. GDIPlus code is working well, though I am only exporting a 'Test.parsed' (JPG) file right now, with the final code currently disabled while I am still testing and adding missing elements. I still have to cater for the Alternate Drive element, checking if it is required and where to send a second copy of the resulting image file, plus updating the blank entries in the ListView and in the associated files. Once that is all done, I can then test with my Kobo device. Then I will work on the code for fixing wrongly formatted images, where the actual cover is just a small portion of the image, usually placed on a bigger black image. This will be not much more than doing a simple file replacement, using the GDIplus code I have already created. Then I will move onto doing the placebo code and images ... more GDIplus stuff, involving identity text on the resulting images that will be copied to the empty sub-folders. So we are slowly getting there ... the end is almost in sight. I don't yet know whether I will need to (update) write anything to the KoboReader.sqlite file. It depends I guess on whether my Kobo device will auto add the new images to that database file or not. DOWNLOAD Kobo Cover Fixer.au3 (47 downloads) SEE THE FIRST POST in this topic for the latest version. 75.76 kB1 point
-
#include <WinAPISys.au3> Func _CRC32ofStr($sStr) Local $bData = StringToBinary($sStr) Local $iLength = BinaryLen($bData), $tData If $iLength = 0 Then Return SetError(1, 0, 0) $tData = DllStructCreate('byte data[' & $iLength & ']') $tData.data = $bData Return Hex(_WinAPI_ComputeCrc32(DllStructGetPtr($tData), $iLength), 8) EndFunc ;==>_CRC32ofStr hope this fixes it ( have not tried your code but I figure that may be it ) Edit: look at this topic/204067-file-checksum1 point
-
I thought you were totally new to crypto a year ago when you posted basically the same script? Since you didn't ask a question, I can only assume that you would like for me to "help you" by creating an AutoIt example that does the same as your JavaScript example. The example script below is an accurate port of your JavaScript to AutoIt, using CryptoNG. #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 -w 6 -d #include <Constants.au3> #include <CryptoNG\CryptoNG.au3> ;<== Change path as needed n3wbie_example() Func n3wbie_example() ;String Vars Local $sMessage = "Encrypted string", _ $sPassword = "Secret password", _ $sDecryptedMessage = "" ;Binary Vars Local $xIV = _CryptoNG_GenerateRandom($CNG_BCRYPT_RNG_ALGORITHM, 16), _ $xSalt = _CryptoNG_GenerateRandom($CNG_BCRYPT_RNG_ALGORITHM, 16), _ $xEncryptionKey = _CryptoNG_PBKDF2($sPassword, $xSalt, 1000, $CNG_KEY_BIT_LENGTH_AES_256, $CNG_BCRYPT_SHA256_ALGORITHM), _ $xDecryptionKey = Binary(""), _ $xEncryptedMessage = Binary(""), _ $xFullEncryptedString = Binary("") ;Get encrypted message $xEncryptedMessage = _CryptoNG_AES_CBC_EncryptData($sMessage, $xEncryptionKey, $xIV) If @error Then Exit MsgBox($MB_ICONERROR, "_CryptoNG_AES_CBC_EncryptData Error", _CryptoNG_LastErrorMessage()) ;Prepend IV and Salt to encrypted message to create the full binary "encrypted string" $xFullEncryptedString = $xIV & $xSalt & $xEncryptedMessage ;Parse IV, Salt & Encrypted Message from full binary encrypted string in order to decrypt the message $xIV = BinaryMid($xFullEncryptedString, 1, 16) $xSalt = BinaryMid($xFullEncryptedString, 17, 16) $xEncryptedMessage = BinaryMid($xFullEncryptedString, 33) ;Generate decryption key using parsed values $xDecryptionKey = _CryptoNG_PBKDF2($sPassword, $xSalt, 1000, $CNG_KEY_BIT_LENGTH_AES_256, $CNG_BCRYPT_SHA256_ALGORITHM) ;Decrypt message using values parsed from full encrypted string $sDecryptedMessage = _CryptoNG_AES_CBC_DecryptData($xEncryptedMessage, $xDecryptionKey, $xIV) If @error Then Exit MsgBox($MB_ICONERROR, "_CryptoNG_AES_CBC_DecryptData Error", _CryptoNG_LastErrorMessage()) ;Display values ConsoleWrite("Message: " & $sMessage & @CRLF) ConsoleWrite(@CRLF) ConsoleWrite("Password: " & $sPassword & @CRLF) ConsoleWrite("IV: " & $xIV & @CRLF) ConsoleWrite("PBKDF2 Salt: " & $xSalt & @CRLF) ConsoleWrite("Generated Encryption Key: " & $xEncryptionKey & @CRLF) ConsoleWrite(@CRLF) ConsoleWrite("Encrypted Message: " & $xEncryptedMessage & @CRLF) ConsoleWrite("Full Encrypted String: " & $xFullEncryptedString & @CRLF) ConsoleWrite(@CRLF) ConsoleWrite("Generated decryption key: " & $xDecryptionKey & @CRLF) ConsoleWrite(@CRLF) ConsoleWrite("Decrypted Message: " & $sDecryptedMessage & @CRLF) EndFunc Console output: (A new encryption key is generated each time you run the script, so most values will be different than below.) Message: Encrypted string Password: Secret password IV: 0x8750BA05ED7BAE8E388456511813D208 PBKDF2 Salt: 0x96FBE67B0BAB75CE7E80DA8FFFE2AEB2 Generated Encryption Key: 0xC5FA70FF15D3C4193BDEA881DB8F34453015BD517174E96A2A24EF70A96FA984 Encrypted Message: 0x2262B52072EB0F8C966EDF4F8939F8D0DF984E0A2313726D79A46C23649A74BA Full Encrypted String: 0x8750BA05ED7BAE8E388456511813D20896FBE67B0BAB75CE7E80DA8FFFE2AEB22262B52072EB0F8C966EDF4F8939F8D0DF984E0A2313726D79A46C23649A74BA Generated decryption key: 0xC5FA70FF15D3C4193BDEA881DB8F34453015BD517174E96A2A24EF70A96FA984 Decrypted Message: Encrypted string1 point
-
For sure the CPU / HDD usage will increase. My CPU usage is ~1-5% but memory consumption is ~15 mb now. ;Coded by UEZ build 2023-05-31 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> AutoItSetOption("GUIOnEventMode", 1) _GDIPlus_Startup() Global $i, $hImage, $hGDIBitmap, $hObjOld, $bExit = False Global Const $hGUI = GUICreate("Test", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetState() Global Const $hDC = _WinAPI_GetDC($hGUI), _ $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $i = 1 Do $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Test\" & $i & ".jpg") $i += 1 If $i > 169 Then $i = 1 $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) $hObjOld = _WinAPI_SelectObject($hGfxDC, $hGDIBitmap) _WinAPI_StretchBlt($hDC, 0, 0, @DesktopWidth, @DesktopHeight, $hGfxDC, 0, 0, 1280, 720, $SRCCOPY) ;resize _WinAPI_SelectObject($hGfxDC, $hObjOld) _WinAPI_DeleteObject($hGDIBitmap) If $bExit Then ExitLoop Until Not Sleep(10) _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hGfxDC) _GDIPlus_Shutdown() Func _Exit() $bExit = True EndFunc1 point
-
I would use GDI to display the images: ;Coded by UEZ build 2023-05-31 #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> AutoItSetOption("GUIOnEventMode", 1) _GDIPlus_Startup() Global $aGDIImages[170], $i, $hImage, $iW, $iH, $iW2, $iH2, $iW4, $iH4, $hObjOld, $bExit = False ConsoleWrite("Loading images to memory..." & @CRLF) For $i = 1 to 168 $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Test\" & $i & ".jpg") $aGDIImages[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) Next $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Test\169.jpg") $iW = _GDIPlus_ImageGetWidth($hImage) $iH = _GDIPlus_ImageGetHeight($hImage) $iW2 = $iW / 2 $iH2 = $iH / 2 $iW4 = $iW / 4 $iH4 = $iH / 4 $aGDIImages[169] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) $aGDIImages[0] = 169 ConsoleWrite("Done" & @CRLF) Global Const $hGUI = GUICreate("Test", $iW, $iH) GUISetState() Global Const $hDC = _WinAPI_GetDC($hGUI), _ $hGfxDC = _WinAPI_CreateCompatibleDC($hDC) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $i = 1 Do $hObjOld = _WinAPI_SelectObject($hGfxDC, $aGDIImages[$i]) _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hGfxDC, 0, 0, $SRCCOPY) ;_WinAPI_StretchBlt($hDC, $iW4, $iH4, $iW2, $iH2, $hGfxDC, 0, 0, $iW, $iH, $SRCCOPY) ;resize _WinAPI_SelectObject($hGfxDC, $hObjOld) $i += 1 If $i > $aGDIImages[0] Then $i = 1 If $bExit Then ExitLoop Until Not Sleep(10) For $i = 1 to $aGDIImages[0] _WinAPI_DeleteObject($aGDIImages[$i]) Next _WinAPI_ReleaseDC($hGUI, $hDC) _WinAPI_DeleteDC($hGfxDC) _GDIPlus_Shutdown() Func _Exit() $bExit = True EndFunc On my old Notebook the CPU usage is <1% and approx. 600 mb memory usage.1 point
-
I would do something like this : #include <GUIConstants.au3> #include <GDIPlus.au3> #include <File.au3> Opt("MustDeclareVars", True) HotKeySet("{ESC}", Terminate) Global $hGraphic, $aFile Example() Func Example() Local $hGUI = GUICreate("", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP), $hImage GUISetState(@SW_SHOW) $aFile = _FileListToArray(".\test", "*.jpg", $FLTA_FILES, True) ;_ArrayDisplay($aFile) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) While True For $i = 1 To $aFile[0] If IsString($aFile[$i]) Then $hImage = _GDIPlus_ImageLoadFromFile(".\test\" & $i & ".jpg") $aFile[$i] = _GDIPlus_ImageResize($hImage, @DesktopWidth, @DesktopHeight) _GDIPlus_ImageDispose($hImage) EndIf _GDIPlus_GraphicsDrawImage($hGraphic, $aFile[$i], 0, 0) Sleep(30) Next WEnd EndFunc ;==>Example Func Terminate() For $i = 1 To $aFile[0] _GDIPlus_ImageDispose($aFile[$i]) Next _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Exit EndFunc ;==>Terminate It will take a bit of space but in my test it is less than 860MB1 point