Leaderboard
Popular Content
Showing content with the highest reputation on 07/26/2023 in all areas
-
CryptoNG UDF - Cryptography API: Next Generation
Stormgrade reacted to TheXman for a file
Version v2.2.0
1,416 downloads
Encryption / Decryption / Hashing / Signing Purpose Cryptography API: Next Generation (CNG) is Microsoft's long-term replacement for their CryptoAPI. Microsoft's CNG is designed to be extensible at many levels and cryptography agnostic in behavior. Although the Crypt.au3 UDF lib that is installed with AutoIt3 still works well, the advapi32.dll functions that it uses have been deprecated. In addition the Crypt.au3 UDF lib, as it is currently written, has a very limited ability to decrypt AES data that was not encrypted using Crypt.au3 functions. That is because Crypt.au3 functions do not allow you to specify an actual key or initialization vector (IV). It only lets you specify data to be used to derive a key and uses a static IV. This UDF was created to offer a replacement for the deprecated functions used by Crypt.au3. According to Microsoft, deprecated functions may be removed in future release. It was also created to allow more flexibility and functionality in encryption/decryption/hashing/signing and to expand the ability for users to implement cryptography in their scripts. Description This UDF implements some of Microsoft's Cryptography API: Next Generation (CNG) Win32 API functions. It implements functions to encrypt/decrypt text and files, generate hashes, derive keys using Password-Based Key Derivation Function 2 (PBKDF2), create and verify signatures, and has several cryptography-related helper functions. The UDF can implement any encryption/decryption algorithms and hashing algorithms that are supported by the installed cryptography providers on the PC in which it is running. Most, if not all, of the "magic number" values that you would commonly use to specify that desired algorithms, key bit lengths, and other magic number type values, are already defined as constants or enums in the UDF file. To flatten the learning curve, there is an example file that shows examples of all of the major functionality. This example file is not created to be an exhaustive set of how to implement each feature and parameter. It is designed to give you a template or guide to help you hit the ground running in terms of using the functions. I have tried to fully document the headers of all of the functions as well as the code within the functions themselves. As of v1.4.0, there is also a Help file that includes all of the functions, with examples. Current UDF Functions Algorithm-Specific Symmetric Encryption/Decryption Functions _CryptoNG_AES_CBC_EncryptData _CryptoNG_AES_CBC_DecryptData _CryptoNG_AES_CBC_EncryptFile _CryptoNG_AES_CBC_DecryptFile _CryptoNG_AES_ECB_EncryptData _CryptoNG_AES_ECB_DecryptData _CryptoNG_AES_GCM_EncryptData _CryptoNG_AES_GCM_DecryptData _CryptoNG_3DES_CBC_EncryptData _CryptoNG_3DES_CBC_DecryptData _CryptoNG_3DES_CBC_EncryptFile _CryptoNG_3DES_CBC_DecryptFile Generic Symmetric Encryption/Decryption Functions _CryptoNG_EncryptData _CryptoNG_DecryptData _CryptoNG_EncryptFile _CryptoNG_DecryptFile Hashing Functions _CryptoNG_HashData _CryptoNG_HashFile _CryptoNG_PBKDF2 Asymmetric (Public/Private Key) Cryptography Functions _CryptoNG_ECDSA_CreateKeyPair _CryptoNG_ECDSA_SignHash _CryptoNG_ECDSA_VerifySignature _CryptoNG_RSA_CreateKeyPair _CryptoNG_RSA_EncryptData _CryptoNG_RSA_DecryptData _CryptoNG_RSA_SignHash _CryptoNG_RSA_VerifySignature Misc / Helper Functions _CryptoNG_CryptBinaryToString _CryptoNG_CryptStringToBinary _CryptoNG_GenerateRandom _CryptoNG_EnumAlgorithms _CryptoNG_EnumRegisteredProviders _CryptoNG_EnumKeyStorageProviders _CryptoNG_LastErrorMessage _CryptoNG_Version Related Links Cryptography API: Next Generation - Main Page Cryptography API: Next Generation - Reference Cryptography API: Next Generation - Primitives Cryptography API: Next Generation - Cryptographic Algorithm Providers1 point -
Create an svg file https://www.w3schools.com/graphics/svg_line.asp1 point
-
Tester needed ^^
argumentum reacted to UEZ for a topic
You may have a look to the tool on German website which I updated. 🙂1 point -
1 point
-
Tester needed ^^
argumentum reacted to UEZ for a topic
Can you please test if GUI will be resize properly according the amount of icons read to listview? Of course limit is @DesktopWidth / 2. #include <File.au3> #include <FileConstants.au3> #include <FontConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <ListViewConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIShellEx.au3> #include <WindowsConstants.au3> Global $aTaskbar = WinGetPos("[CLASS:Shell_TrayWnd;INSTANCE:1]", "") Global $i, $aShortcutDetails, $hIcon, $aFileList = ReadDesktopIcons() If @error Then Dim $aFileList[1] $aFileList[0] = 0 MsgBox($MB_ICONWARNING, "Warning", "No desktop icons!", 15) EndIf Global $iLen = 0, $l For $i = 1 To $aFileList[0] $l = StringLen(StringRegExpReplace($aFileList[$i], ".*\\(.*)\..+", "$1")) $iLen = $l > $iLen ? $l : $iLen Next Global $iW = 0, $iH = 0 Global Const $hGUI = GUICreate("Toolbar Desktop by UEZ", $iW, $iH, $aTaskbar[1] ? -1 : -10000, $aTaskbar[1] ? -10000 : -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX), $WS_EX_TOPMOST) GUISetFont(8, $FW_NORMAL, $GUI_FONTNORMAL, "Arial", $hGUI, $CLEARTYPE_QUALITY) Global $hLV = _GUICtrlListView_Create($hGUI, "", 0, 0, 0, 0, BitOR($LVS_SINGLESEL, $LVS_NOCOLUMNHEADER, $LVS_LIST)), $iLV = _WinAPI_GetDlgCtrlID($hLV) GUICtrlSendMsg($hLV, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_ONECLICKACTIVATE, $LVS_EX_TRACKSELECT) _GUICtrlListView_SetExtendedListViewStyle($hLV, $LVS_EX_DOUBLEBUFFER) _GUICtrlListView_InsertColumn($hLV, 0, "Desktop App") Global Const $hImageList = _GUIImageList_Create(16, 16) ConsoleWrite("Added " & $aFileList[0] & " items to the list" & @CRLF) ;~ $aFileList[0] = 6 For $i = 1 To $aFileList[0] $hIcon = _WinAPI_ShellExtractAssociatedIcon($aFileList[$i], True) If $hIcon Then _GUIImageList_Add($hImageList, _WinAPI_Create32BitHBITMAP($hIcon)) Else _GUIImageList_Add($hImageList, _GUICtrlListView_CreateSolidBitMap($hLV, 0xFFFFFF, 16, 16)) EndIf Next Global $aIconAssignment[UBound($aFileList) - 1][2] _GUICtrlListView_SetImageList($hLV, $hImageList, 1) For $i = 1 To $aFileList[0] If StringInStr(FileGetAttrib($aFileList[$i]), "D") Then If StringRegExp($aFileList[$i], ".+\.\{(.*)\}") Then _GUICtrlListView_AddItem($hLV, StringRegExpReplace($aFileList[$i], ".*\\(.*)\..+", "$1"), $i - 1, $i - 1) Else _GUICtrlListView_AddItem($hLV, StringRegExpReplace($aFileList[$i], ".+\\(.+)", "$1"), $i - 1, $i - 1) EndIf Else _GUICtrlListView_AddItem($hLV, StringRegExpReplace($aFileList[$i], ".*\\(.*)\..+", "$1"), $i - 1, $i - 1) EndIf $aIconAssignment[$i - 1][0] = $i - 1 $aIconAssignment[$i - 1][1] = $aFileList[$i] Next ;~ ConsoleWrite("Screen Dimensions: " & @DesktopWidth & " x " & @DesktopHeight & @CRLF) ;~ Global $aDimLV = _GUICtrlListView_ApproximateViewRect($hLV) ;~ ConsoleWrite("Listview Dimensions: " & $aDimLV[0] & " x " & $aDimLV[1] & @CRLF) ;~ Global $aPos = WinGetPos($hGUI), $aWinPos ;~ $iW = $aDimLV[0] / $aDimLV[1] * 2.05 ; ;~ $iW = Max(150, Min(@DesktopWidth / 2, $iW)) ;~ $iH = $iW * 9 / 16 ;~ WinMove($hGUI, "", (@DesktopWidth - $iW) / 2, (@DesktopHeight - $iH) / 2, $iW, $iH) ;~ ConsoleWrite("Calculated GUI size: " & $iW & " x " & $iH & @CRLF) ;~ ConsoleWrite("OS: " & @OSVersion & @CRLF) GUIRegisterMsg($WM_SIZE, "WM_SIZE") If $iW < @DesktopWidth / 2 And BitAND(_WinAPI_GetWindowLong($hLV, $GWL_STYLE), $WS_HSCROLL) Then While BitAND(_WinAPI_GetWindowLong($hLV, $GWL_STYLE), $WS_HSCROLL) $iW += 1.77778 ;ratio 16:9 $iH += 1 WinMove($hGUI, "", (@DesktopWidth - $iW) / 2, (@DesktopHeight - $iH) / 2, $iW, $iH) If $iW > @DesktopWidth / 2 Then ExitLoop WEnd EndIf GUISetState(@SW_SHOW, $hGUI) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete($hGUI) Exit Func ReadDesktopIcons() Local $aFileList1 = _FileListToArray(@DesktopDir, "*", $FLTA_FILESFOLDERS, True) Local $aFileList2 = _FileListToArray(@DesktopCommonDir, "*", $FLTA_FILESFOLDERS, True) If BitOR(IsArray($aFileList1), IsArray($aFileList2)) = 0 Then Return SetError(1, 0, 0) Local $i, $j, $aFileList[$aFileList1[0] + $aFileList2[0] + 1], $c = 1 For $i = 1 To $aFileList1[0] If StringRight($aFileList1[$i], 4) <> ".ini" Then $aFileList[$c] = $aFileList1[$i] $c += 1 EndIf Next For $j = 1 To $aFileList2[0] If StringRight($aFileList2[$j], 4) <> ".ini" Then $aFileList[$c] = $aFileList2[$j] $c += 1 EndIf Next $aFileList[0] = $c - 1 ReDim $aFileList[$c] Return $aFileList EndFunc ;==>ReadDesktopIcons Func Max($a, $b) Return $a > $b ? $a : $b EndFunc ;==>Max Func Min($a, $b) Return $a < $b ? $a : $b EndFunc ;==>Min Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ControlMove($hGUI, "", $iLV, 0, 0, _WinAPI_LoWord($lParam), _WinAPI_HiWord($lParam)) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Thanks.1 point -
Tester needed ^^
argumentum reacted to UEZ for a topic
You have all so much icons on your desktop that always $iW = @DesktopWidth / 2 is applied. @AllenAA I can see that the calculated GUI size is not @DesktopWidth / 2. Does the GUI have scrollbar (all icons fit in the GUI)? The problem is that for a few icons the GUI is not set properly. If you set the list to a much smaller amount then ConsoleWrite("Added " & $aFileList[0] & " items to the list" & @CRLF) $aFileList[0] = 6 the GUI will be created too tiny. The goal is to adjust the GUI size so that the icons all fit in the GUI, of course only if the maximum GUI size is not exceeded. @all: thank you for testing!1 point -
Tester needed ^^
argumentum reacted to ioa747 for a topic
@argumentum the first GUICtrlCreateListView return the the identifier (controlID) of the new control. the second _GUICtrlListView_Create return the the the handle to the ListView control. if that helps #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGUI, $aXY, $idListview, $hLV $hGUI = GUICreate("ListView Approximate View Rect", 400, 300, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_SIZEBOX), $WS_EX_TOPMOST) ; CASE A ;~ $idListview = GUICtrlCreateListView("", 5, 5, 390, 260, BitOR($LVS_SINGLESEL, $LVS_NOCOLUMNHEADER, $LVS_LIST), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) ; CASE B $idListview = _GUICtrlListView_Create($hGUI, "", 5, 5, 390, 260, BitOR($LVS_SINGLESEL, $LVS_NOCOLUMNHEADER, $LVS_LIST), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE)) ConsoleWrite("$idListview=" & $idListview & @CRLF) GUICtrlSendMsg($idListview, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_ONECLICKACTIVATE, $LVS_EX_TRACKSELECT) _GUICtrlListView_SetExtendedListViewStyle($idListview, $LVS_EX_DOUBLEBUFFER) GUISetState(@SW_SHOW) _GUICtrlListView_InsertColumn($idListview, 0, "Column 1", 100) For $iI = 0 To 9 _GUICtrlListView_AddItem($idListview, "Row (your boat down the street #) " & $iI) Next _GUICtrlListView_SetColumnWidth($idListview, 0, $LVSCW_AUTOSIZE_USEHEADER) MsgBox($MB_SYSTEMMODAL, "Information", "Approximate View Rect") ; Resize view $aXY = _GUICtrlListView_ApproximateViewRect($idListview) ;~ _WinAPI_SetWindowPos(GUICtrlGetHandle($idListview), 0, 2, 2, $aXY[0], $aXY[1], $SWP_NOZORDER) ;This work in CASE A _WinAPI_SetWindowPos($idListview, 0, 2, 2, $aXY[0], $aXY[1], $SWP_NOZORDER) ;This work in CASE B ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example conclusion: if you use _GUICtrlListView_Create then _WinAPI_SetWindowPos($idListview, 0, 2, 2, $aXY[0], $aXY[1], $SWP_NOZORDER) else if you use GUICtrlCreateListView then _WinAPI_SetWindowPos(GUICtrlGetHandle($idListview), 0, 2, 2, $aXY[0], $aXY[1], $SWP_NOZORDER)1 point -
AutoIt Snippets
TheDcoder reacted to argumentum for a topic
..on my side, I'll be putting something like this: to simply add water a prefix _HiDpi_GUICtrlCreateSomething() and make it instantly coffee HiDpi ready ...unless @TheDcoder jumps the gun and gets it done. It'll take me time to get this functional. But the easier the addendum ( so to call it ), the more testers we'll have to know if it ( @UEZ's code ) works everywhere1 point