All Activity
- Past hour
-
tasoxfclo joined the community
- Today
-
ioa747 reacted to a post in a topic: Windows Debug Messages?
- Yesterday
-
Uploaded a new version of the SciTE4AutoIt3.exe v21.316.1639.1
KaFu replied to Jos's topic in AutoIt Technical Discussion
Hi Jos, a feature request for SciTE from my side. When I run code in SciTE, all entries under "Tools" except the last 5 are greyed out. Would it be possible to leave those enabled, which do not interfere with the current code execution? Especially for running "AU3Info" I don't know how many times I had to abort the current execution, start AU3Info and then run the code again š, because I forgot to start AU3Info early. Maybe it makes sense to leave some others enabled too, e.g. Open Explorer in Scriptdir, Codewizard and Koda? Best Regards -
KaFu reacted to a post in a topic: WebP v0.3.5 build 2025-06-30 beta
-
Quick test after download 5 min ago : new version (x86) works fine for showing progress in Console & aborting (Esc) during progress, in Example 9. Well done !
-
pixelsearch reacted to a post in a topic: WebP v0.3.5 build 2025-06-30 beta
-
Yes, I forgot to removed these lines for the other functions but I need to add the code also for the other function with callbacks. Currently only function "WebP_CreateWebPCreateAnimFromScreenCapture" in the dll is implemented (example 9) for callback but it should be easy to add also for the other functions. I think tomorrow I will add it to the other functions, too.
-
Great news as progress callback didn't show at all in the console (dll x86) even after I replaced at 3 different places in WebP.au3 "ptr", @AutoItX64 ? $pCallback : 0)[0] with "ptr", $pCallback)[0] If not mistaken, all Console output lines come from the script (WebP Example9.au3) except this line displayed in Console by the dll : Starting...done! I'm gonna check your download site for the updated version including progress. No need to hurry, just take all the time you need to have it work nicely. Thanks a lot for this great script
-
Thx for testing. Figured out how callback can be used with Example9 to show progress and abort capturing...
-
UEZ reacted to a post in a topic: WebP v0.3.5 build 2025-06-30 beta
-
Yes it is working. The 10s output file "Captured.webp" displays in the GUI, then loops until we close the GUI. It displays same in IrfanView.
-
I tried again using a Stdout script along with the small command line version of DebugView++. Ran my test script while VLC Player was running, no problems/hangs/crashes encountered. Ran my test script while PowerDVD was running and again no problems encountered. Here is my test script: #include <AutoItConstants.au3> HotKeySet("{Esc}", "Terminate") Local $CMD = 'DebugViewConsole-small.exe -a -c -f -i "deviceModeChangedCallbackEvent:" -i "json_event[{"isEnabled":true}]" -i "json_event[{"isEnabled":false}]"' Local $PID = Run('"' & @ComSpec & '" /k ' & $CMD, "", @SW_HIDE, $STDOUT_CHILD); Local $strData Local $strEvent = 'deviceModeChangedCallbackEvent:' ; Windows debug message/event to wait for. Local $strKeyDn = 'json_event[{"isEnabled":true}]' ; 'Fn' key down on Razer keyboard. Local $strKeyUp = 'json_event[{"isEnabled":false}]' ; 'Fn' key up on Razer keyboard. While ProcessExists($PID) $strData = StdoutRead($PID) If StringInStr($strData, $strEvent) Then If StringInStr($strData, $strKeyDn) Then MsgBox(0, "Event", "Fn key down") If StringInStr($strData, $strKeyUp) Then MsgBox(0, "Event", "Fn key up") EndIf sleep(10) WEnd Func Terminate() Run('"' & @ComSpec & '" /k ' & 'DebugViewConsole-small -x', "", @SW_HIDE) ; Kill all DebugView++ instances. Exit EndFunc As far as I can tell, after a couple of hours testing, everything is works without any problems. It is a pity that I had to use a third-party app though. Oh well.
-
@pixelsearch thanks for testing. Is Example9 working? Currently I'm trying to figure out how the callback is working but no real examples.
-
Hello @UEZ Just downloaded all your files (including the Frames subfolder containing 10 png files to create the animation). Somes files were updated 3 hours ago, lucky me to download the brand new release just now Example 8 worked fine and the created animation "TestAnim.webp" displayed without any issue. Well done
-
How to pin a script to the taskbar or start menu
argumentum replied to argumentum's topic in AutoIt Example Scripts
Added a new version. It now looks for the environment variable %AUTOIT3DIR% and if it exists, the link will have that instead of the hard path. That way you can test a beta or another version easily. To set the %AUTOIT3DIR%, you can run from a command prompt setx AUTOIT3DIR C:\PathTo\AutoIt3 and that'd set it for you. -
Which version of Autoit do you run? WinAPISys.au3, WinAPIProc.au3 and WinAPIHObj.au3 exist in folder C:\Program Files (x86)\AutoIt3\Include of version 3.3.16.1 I'm running
-
Can you provide us with some code? We would like to see the unimplemented functions in your code. Thank you.
-
I am developing a window managing tool and I use ChatGPT to support this. It has provided some functions for window moving and resizing. It suggested to use the following UDFs: WinAPIMon.au3 ā 13.081 Byte WinAPISys.au3 ā 77.594 Byte WinAPIProc.au3 ā 76.629 Byte WinAPIHObj.au3 ā 16.852 Byte These are not in the scope of my installation. Is this a problem of my new installation I performed the last days or are these UDFs which are only available by the forum. I did some searches but I was not able to succeed. Can you give some hints where or how to seek?
-
HelmutJ joined the community
-
Update! While the debug capture script definitely works, it causes problems with any other running software that use windows debug messages. Took a while to notice this problem. Hereās my example: I was running PowerDVD, just listening to a DVD box set while I was testing my debug capture script. I noticed that PowerDVD would hang/crash if the script was running. It was not obvious to begin with, PowerDVD can throw a tantrum if DVD needs a clean, so I didnāt see the connection to my script up straight away. PowerDVD uses debug messages under normal operation and the script was interfering. Also affects VLC player, any (all?) Stardock software, and I assume a lot more software packages that make use of windows debug messages. I have (re-)tested using the DebugCapture.dll: https://www.autoitscript.com/forum/topic/82889-capture-debug-information-udf/ and Argumentumās solution in this thread. Both result in the same lockup/crash problem. For what I am trying to achieve I need the script to be constantly running. If the script causes problems with software then using debug scripts are obviously not the solution, for me anyway. As said, the DebugCapture.dll and Argumentumās script works perfectly well on their own. Hopefully this post will save others some problems trying something similar to what I was hoping to do. Sysinternals Debugview and DebugView++ do not cause software to hang or crash. So it is possible. Both can be run using the command line. Originally, I tried Stdout scripts on both but was sketchy, though that was probably my scripting! I might have another look into this, or⦠I may have another cunning plan/solution. I can capture the USB data of my keyboard using Wireshark & USBPcap. If I can monitor the USB data somehow, then maybe I can find a good alternative to using windows debug messages.
-
How to pin a script to the taskbar or start menu
argumentum posted a topic in AutoIt Example Scripts
vs. If you would like to pin the script to the taskbar ( or the start menu ), it can be done with a link. This script is an example and demonstration. The way that I go about it, is to have the script and icon with the same name. The easiest way to test this is if the post had it all in a ZIP file so, there: Example AutoIt v3 Script_v2.zip Also, it's easier to find in task manager given that you can see your icon. - Last week
-
ByRH changed their profile photo
-
Embedding font in compiled binary and loading per-session
UEZ replied to WildByDesign's topic in AutoIt GUI Help and Support
Here you should find one way how to embed your font (Display Font from Memory): -
I am trying to embed a font file in my compiled binary with the following: #AutoIt3Wrapper_Res_File_Add=embed\Aptos-Mono.ttf, rt_rcdata, aptos_ttf And trying to load it temporarily (per-session) with various iterations of the following: _WinAPI_AddFontResourceEx(@ScriptFullPath & ", aptos_ttf", $FR_PRIVATE) But I can't seem to get that to work and I've tried a few different things with the _WinAPI_AddFontResourceEx line. I know that I could FileInstall and load it easy that way, but I would prefer to load it directly from the compiled binary resources if possible. Thank you for any help or ideas with this.
-
I've updated GImageX with the latest version of the ADK. (Dec 2024 version). Don't think the ADK version was the OP's issue. But updated it anyway.
-
Microsoft insists that the false positive is removed from the compiled binary and is no longer detected by Windows Defender. VirusTotal shows it. But apparently Windows Defender itself does not detect it and we're good to go. First post has been updated with version 1.0.3. This version is mostly a bug-fix release with a fix for Windows Terminal losing border color after being minimized. And a regression where border colors, if not set in custom rules, were not properly falling back to the global set value. That was a weird bug that took me forever to understand how/why it was happening but finally fixed it. I also made some changes that made the overall performance even better. Several functions were made to be more efficient. Less loops. I also made a special function Func _ColorBorderOnly($hWnd, $sClassName, $sName) to handle the border coloring in the Foreground Case only. Prior to that, the border stuff was going through the main coloring function and therefore a lot of extra stuff that was not necessary in the Foreground Case. So this also made things much more efficient.
-
I have a really nice update lined up to release that increases performance a bit more and fixed the last few remaining bugs. However, after Microsoft removed the previous false positive, it is back. They are calling it: Trojan:Win32/Wacatac.B!ml That seems to be their generic "everything is a virus" name. So curious, I decided to gut my entire script leaving only a While loop and the includes. My hope was to nail down exactly which function or include could be triggering the detection. Still detected. So I removed the includes one at a time and testing on VirusTotal each time. So I end up only with a While loop, no includes. Nothing else. Microsoft still detects the bare bones binary as: Trojan:Win32/Wacatac.B!ml I also tried all various compression levels and no luck still. If there is nothing in there but a While loop, what else can they detect? What part of AutoIt is in there as interpreter? (like, what binary?) I scanned all of the actual AutoIt binaries and none of them get detected by Microsoft.
-
Codejr joined the community
-
#include <Print.au3> ; I'd like that too Credentials acquired successfully Calling InitializeSecurityContext (first) hResult: 00090312 Send 196 octets (hex): 0x16FEFD000000000000000000B7010000AB00000000000000ABFEFD685ED6BBEADE75B6F57B4AE8946D5DB4C1F8D86F4B37... Send (text) : þýReceived 7 bytes (hex): 0x15030100020246... Received (text): Alerte TLS détected: Version=0x0103, Length=2, Level=Fatal, Description=70 (Protocol Version) Calling InitializeSecurityContext (subsequent) hResult: 80090308 Error InitializeSecurityContext: 80090308 TLS connection failed
-
In the context of a complex project with stringent TLS requirements and various technical constraints, I decided to dive into the core of security mechanisms. While many off-the-shelf solutions exist for handling security contexts, I wanted to explore the fundamentals directly. Here, Iām sharing a raw and isolated excerpt of an AutoIt script that initializes a TLS security context using the Schannel API. This code is functional but deliberately minimal, providing a solid foundation for optimization and enhanced robustness. #include-once #include <WinAPI.au3> #include <WinAPIError.au3> #include <AutoItConstants.au3> #include <Date.au3> ; Constantes Schannel Global Const $SEC_E_OK = 0x00000000 Global Const $SEC_I_CONTINUE_NEEDED = 0x00090312 Global Const $SEC_E_INCOMPLETE_MESSAGE = 0x80090318 Global Const $SEC_E_INVALID_TOKEN = 0x80090308 Global Const $SECPKG_CRED_OUTBOUND = 2 Global Const $UNISP_NAME = "Microsoft Unified Security Protocol Provider" Global Const $SCHANNEL_CRED_VERSION = 4 Global Const $SCH_CRED_NO_DEFAULT_CREDS = 0x00000010 Global Const $SCH_CRED_AUTO_CRED_VALIDATION = 0x00000020 ; Flags pour InitializeSecurityContext Global Const $ISC_REQ_SEQUENCE_DETECT = 0x00000008 Global Const $ISC_REQ_REPLAY_DETECT = 0x00000004 Global Const $ISC_REQ_CONFIDENTIALITY = 0x00000010 Global Const $ISC_REQ_ALLOCATE_MEMORY = 0x00000100 Global Const $ISC_REQ_STREAM = 0x00008000 ; Types buffers Global Const $SECBUFFER_TOKEN = 2 Global Const $SECBUFFER_EMPTY = 0 ; Attributes QueryContextAttributes Global Const $SECPKG_ATTR_REMOTE_CERT_CONTEXT = 0x53 Global Const $SECPKG_ATTR_CONNECTION_INFO = 0x5A ; Structures Global Const $tagCRED_HANDLE = "struct;ULONG_PTR dwLower;ULONG_PTR dwUpper;endstruct;" Global Const $tagSCHANNEL_CRED = "struct;" & _ "dword dwVersion;" & _ "dword dwCredFormat;" & _ "dword cCreds;" & _ "ptr paCred;" & _ "ptr hRootStore;" & _ "dword cMappers;" & _ "ptr aphMappers;" & _ "byte reserved[4];" & _ "dword dwSessionLifespan;" & _ "dword dwFlags;" & _ "dword cTlsParameters;" & _ "ptr pTlsParameters;" & _ "endstruct;" Global Const $tagSEC_BUFFER = "struct;dword cbBuffer;dword BufferType;ptr pvBuffer;endstruct;" Global Const $tagSEC_BUFFER_DESC = "struct;dword ulVersion;dword cBuffers;ptr pBuffers;endstruct;" Global Const $tagCERT_CONTEXT = "struct;" & _ "dword dwCertEncodingType;" & _ "ptr pbCertEncoded;" & _ "dword cbCertEncoded;" & _ "ptr pCertInfo;" & _ "ptr hCertStore;" & _ "endstruct;" Global Const $tagCERT_INFO = "struct;" & _ "dword dwVersion;" & _ "dword cbSerialNumber;ptr pbSerialNumber;" & _ "ptr pszObjId;dword cbData;ptr pbData;" & _ "dword cbIssuer;ptr pbIssuer;" & _ "dword NotBeforeLow;dword NotBeforeHigh;" & _ "dword NotAfterLow;dword NotAfterHigh;" & _ "dword cbSubject;ptr pbSubject;" & _ "ptr pSubjectPublicKeyInfo;" & _ "dword cbIssuerUniqueId;ptr pbIssuerUniqueId;" & _ "dword cbSubjectUniqueId;ptr pbSubjectUniqueId;" & _ "dword cExtension;" & _ "ptr rgExtension;" & _ "endstruct;" ; Variables globales Global $iSocket = -1 Global $tCredHandle, $tCtxtHandle Global $sHost = "www.google.com" Global $g_iDetectedTLSVersion = 0 Func InitializeTLS() TCPStartup() Sleep(100) ; Initial delay to stabilize the network Local $sIP = TCPNameToIP($sHost) If @error Then ConsoleWrite("Error: Failed to establish TCP connection to " & $sHost & @CRLF) Cleanup() Return False EndIf $iSocket = TCPConnect($sIP, 443) If $iSocket = -1 Then ConsoleWrite("Error: Failed to establish TCP connection to " & $sHost & @CRLF) Cleanup() Return False EndIf $tCredHandle = _AcquireCredentialsHandle() If @error Then Cleanup() Return False EndIf Local $bResult = EstablishSecurityContext() If Not $bResult Then Cleanup() EndIf Return $bResult EndFunc ;==>InitializeTLS Func _AcquireCredentialsHandle() Local $tCred = DllStructCreate($tagSCHANNEL_CRED) Local $tTimeStamp = DllStructCreate("dword;dword") Local $tHandle = DllStructCreate($tagCRED_HANDLE) DllStructSetData($tCred, "dwVersion", $SCHANNEL_CRED_VERSION) DllStructSetData($tCred, "dwCredFormat", 0) DllStructSetData($tCred, "cCreds", 0) DllStructSetData($tCred, "paCred", 0) DllStructSetData($tCred, "hRootStore", 0) DllStructSetData($tCred, "cMappers", 0) DllStructSetData($tCred, "aphMappers", 0) DllStructSetData($tCred, "dwSessionLifespan", 0) DllStructSetData($tCred, "dwFlags", BitOR($SCH_CRED_NO_DEFAULT_CREDS, $SCH_CRED_AUTO_CRED_VALIDATION)) DllStructSetData($tCred, "cTlsParameters", 0) DllStructSetData($tCred, "pTlsParameters", 0) DllStructSetData($tCred, "grbitEnabledProtocols", BitOR(0x00000800, 0x00002000)) ; TLS 1.2 et 1.3 Local $aRet = DllCall("secur32.dll", "long", "AcquireCredentialsHandleW", _ "wstr", "", _ "wstr", $UNISP_NAME, _ "dword", $SECPKG_CRED_OUTBOUND, _ "ptr", 0, _ "ptr", DllStructGetPtr($tCred), _ "ptr", 0, _ "ptr", 0, _ "ptr", DllStructGetPtr($tHandle), _ "ptr", DllStructGetPtr($tTimeStamp)) If @error Or $aRet[0] <> $SEC_E_OK Then ConsoleWrite("Error AcquireCredentialsHandle: " & Hex($aRet[0]) & @CRLF) Return SetError(1, 0, 0) EndIf ConsoleWrite("Credentials acquired successfully" & @CRLF) Return $tHandle EndFunc ;==>_AcquireCredentialsHandle Func EstablishSecurityContext() Local $tInBufferDesc = DllStructCreate($tagSEC_BUFFER_DESC) Local $tOutBufferDesc = DllStructCreate($tagSEC_BUFFER_DESC) Local $tInBuffer = DllStructCreate($tagSEC_BUFFER) Local $tOutBuffer = DllStructCreate($tagSEC_BUFFER) Local $tCtxtNew = DllStructCreate($tagCRED_HANDLE) Local $tAttributes = DllStructCreate("dword") Local $tTimeStamp = DllStructCreate("dword;dword") DllStructSetData($tInBufferDesc, "ulVersion", 0) DllStructSetData($tInBufferDesc, "cBuffers", 1) DllStructSetData($tInBufferDesc, "pBuffers", DllStructGetPtr($tInBuffer)) DllStructSetData($tInBuffer, "BufferType", $SECBUFFER_EMPTY) DllStructSetData($tInBuffer, "cbBuffer", 0) DllStructSetData($tInBuffer, "pvBuffer", 0) DllStructSetData($tOutBufferDesc, "ulVersion", 0) DllStructSetData($tOutBufferDesc, "cBuffers", 1) DllStructSetData($tOutBufferDesc, "pBuffers", DllStructGetPtr($tOutBuffer)) DllStructSetData($tOutBuffer, "BufferType", $SECBUFFER_TOKEN) DllStructSetData($tOutBuffer, "cbBuffer", 0) DllStructSetData($tOutBuffer, "pvBuffer", 0) Local $dwFlags = BitOR($ISC_REQ_SEQUENCE_DETECT, $ISC_REQ_REPLAY_DETECT, _ $ISC_REQ_CONFIDENTIALITY, $ISC_REQ_ALLOCATE_MEMORY, $ISC_REQ_STREAM) Local $scRet = $SEC_I_CONTINUE_NEEDED Local $bFirstCall = True While $scRet = $SEC_I_CONTINUE_NEEDED Or $scRet = $SEC_E_INCOMPLETE_MESSAGE ConsoleWrite("Calling InitializeSecurityContext (" & ($bFirstCall ? "first" : "subsequent") & ")" & @CRLF) Local $aRet = DllCall("secur32.dll", "long", "InitializeSecurityContextW", _ "ptr", DllStructGetPtr($tCredHandle), _ "ptr", ($bFirstCall ? 0 : DllStructGetPtr($tCtxtNew)), _ "wstr", $sHost, _ "dword", $dwFlags, _ "dword", 0, _ "dword", 0, _ "ptr", ($bFirstCall ? 0 : DllStructGetPtr($tInBufferDesc)), _ "dword", 0, _ "ptr", DllStructGetPtr($tCtxtNew), _ "ptr", DllStructGetPtr($tOutBufferDesc), _ "ptr", DllStructGetPtr($tAttributes), _ "ptr", DllStructGetPtr($tTimeStamp)) If @error Then ConsoleWrite("DLL Call ERROR: " & @CRLF) Return False EndIf $scRet = $aRet[0] ConsoleWrite("hResult: " & Hex($scRet) & @CRLF) If $scRet = $SEC_E_OK Then ConsoleWrite("TLS connection successfully established!" & @CRLF) $tCtxtHandle = $tCtxtNew Return True ElseIf $scRet = $SEC_I_CONTINUE_NEEDED Or $scRet = $SEC_E_INCOMPLETE_MESSAGE Then If Not SendOutBuffer($tOutBuffer) Then Return False EndIf If Not ReceiveInputBuffer($tInBufferDesc, $tInBuffer) Then Return False EndIf If $bFirstCall Then $bFirstCall = False Else ConsoleWrite("Error InitializeSecurityContext: " & Hex($scRet) & @CRLF) Return False EndIf WEnd Return False EndFunc ;==>EstablishSecurityContext Func SendOutBuffer(ByRef $tBuffer) Local $cbBuffer = DllStructGetData($tBuffer, "cbBuffer") If $cbBuffer <= 0 Then Return True Local $pvBuffer = DllStructGetData($tBuffer, "pvBuffer") Local $tData = DllStructCreate("byte[" & $cbBuffer & "]", $pvBuffer) Local $bData = DllStructGetData($tData, 1) ConsoleWrite("Send " & $cbBuffer & " octets (hex): " & StringLeft($bData, 100) & "..." & @CRLF) ConsoleWrite("Send (text) : " & StringLeft(BinaryToString($bData), 50) & "..." & @CRLF) TCPSend($iSocket, $bData) If @error Then ConsoleWrite("Errorr TCPSend: " & @error & @CRLF) Return False EndIf DllCall("secur32.dll", "long", "FreeContextBuffer", "ptr", $pvBuffer) DllStructSetData($tBuffer, "pvBuffer", 0) DllStructSetData($tBuffer, "cbBuffer", 0) Return True EndFunc ;==>SendOutBuffer Func ReceiveInputBuffer(ByRef $tBufferDesc, ByRef $tBuffer) Local $bData = "" Local $iTimeout = TimerInit() While BinaryLen($bData) < 5 And TimerDiff($iTimeout) < 5000 $bData = TCPRecv($iSocket, 8192, 1) If @error Then ConsoleWrite("Error TCPRecv: " & @error & @CRLF) Return False EndIf If BinaryLen($bData) > 0 Then ExitLoop Sleep(10) WEnd Local $iLen = BinaryLen($bData) If $iLen = 0 Then ConsoleWrite("Error: No data received after timeout" & @CRLF) Return False EndIf ConsoleWrite("Received " & $iLen & " bytes (hex): " & StringLeft($bData, 50) & "..." & @CRLF) ConsoleWrite("Received (text): " & StringLeft(BinaryToString($bData), 50) & "..." & @CRLF) If BinaryMid($bData, 1, 1) = 0x15 And $iLen >= 7 Then Local $iVersion = Number(BinaryMid($bData, 2, 2)) Local $iLengthHi = Number(BinaryMid($bData, 4, 1)) Local $iLengthLo = Number(BinaryMid($bData, 5, 1)) Local $iLength = $iLengthHi * 256 + $iLengthLo Local $iLevel = Number(BinaryMid($bData, 6, 1)) Local $iDesc = Number(BinaryMid($bData, 7, 1)) ConsoleWrite("Alerte TLS détected: " & _ "Version=0x" & Hex($iVersion, 4) & ", " & _ "Length=" & $iLength & ", " & _ "Level=" & ($iLevel = 2 ? "Fatal" : "Warning") & ", " & _ "Description=" & $iDesc & " (" & GetAlertDescription($iDesc) & ")" & @CRLF) EndIf Local $tData = DllStructCreate("byte[" & $iLen & "]") DllStructSetData($tData, 1, $bData) DllStructSetData($tBuffer, "BufferType", $SECBUFFER_TOKEN) DllStructSetData($tBuffer, "cbBuffer", $iLen) DllStructSetData($tBuffer, "pvBuffer", DllStructGetPtr($tData)) Return True EndFunc ;==>ReceiveInputBuffer Func GetAlertDescription($iDesc) Switch $iDesc Case 0 Return "Close Notify" Case 10 Return "Unexpected Message" Case 40 Return "Handshake Failure" Case 70 Return "Protocol Version" Case 112 Return "Unrecognized Name" Case Else Return "Unknown Alert" EndSwitch EndFunc ;==>GetAlertDescription Func DisplayCertInfo() Local $tCertContextPtr = DllStructCreate("ptr") Local $aRet = DllCall("secur32.dll", "long", "QueryContextAttributesW", _ "ptr", DllStructGetPtr($tCtxtHandle), _ "dword", $SECPKG_ATTR_REMOTE_CERT_CONTEXT, _ "ptr", DllStructGetPtr($tCertContextPtr)) If @error Or $aRet[0] <> $SEC_E_OK Then ConsoleWrite("Error QueryContextAttributesW (cert): " & Hex($aRet[0]) & @CRLF) Return EndIf Local $pCertContext = DllStructGetData($tCertContextPtr, 1) If $pCertContext = 0 Then ConsoleWrite("Error: No certificate retrieved" & @CRLF) Return EndIf Local $tCertContext = DllStructCreate($tagCERT_CONTEXT, $pCertContext) Local $pCertInfo = DllStructGetData($tCertContext, "pCertInfo") Local $tCertInfo = DllStructCreate($tagCERT_INFO, $pCertInfo) Local $tConnInfo = DllStructCreate("struct;dword dwProtocol;dword aiCipher;dword dwCipherStrength;dword aiHash;dword dwHashStrength;dword aiExch;dword dwExchStrength;endstruct;") $aRet = DllCall("secur32.dll", "long", "QueryContextAttributesW", _ "ptr", DllStructGetPtr($tCtxtHandle), _ "dword", $SECPKG_ATTR_CONNECTION_INFO, _ "ptr", DllStructGetPtr($tConnInfo)) If @error Or $aRet[0] <> $SEC_E_OK Then ConsoleWrite("Error QueryContextAttributesW (conn): " & Hex($aRet[0]) & @CRLF) EndIf ConsoleWrite("š SSL CERTIFICATE INFO" & @CRLF) ConsoleWrite("======================================" & @CRLF) ConsoleWrite("š·ļø Subject: " & GetCertNameString($pCertContext, False) & @CRLF) ConsoleWrite("šļø Issued by: " & GetCertNameString($pCertContext, True) & @CRLF) Local $tNotAfter = DllStructCreate($tagFILETIME) DllStructSetData($tNotAfter, "Lo", DllStructGetData($tCertInfo, "NotAfterLow")) DllStructSetData($tNotAfter, "Hi", DllStructGetData($tCertInfo, "NotAfterHigh")) Local $sExpiration = FileTimeToString($tNotAfter) ConsoleWrite("š Expiration: " & $sExpiration & @CRLF) Local $tNotBefore = DllStructCreate($tagFILETIME) DllStructSetData($tNotBefore, "Lo", DllStructGetData($tCertInfo, "NotBeforeLow")) DllStructSetData($tNotBefore, "Hi", DllStructGetData($tCertInfo, "NotBeforeHigh")) Local $sValidFrom = FileTimeToString($tNotBefore) ConsoleWrite("š Valid from: " & $sValidFrom & @CRLF) ConsoleWrite("ConnInfo: " & _ "Protocol=0x" & Hex(DllStructGetData($tConnInfo, "dwProtocol"), 4) & ", " & _ "Cipher=0x" & Hex(DllStructGetData($tConnInfo, "aiCipher"), 4) & ", " & _ "Strength=" & DllStructGetData($tConnInfo, "dwCipherStrength") & ", " & _ "Hash=0x" & Hex(DllStructGetData($tConnInfo, "aiHash"), 4) & ", " & _ "HashStrength=" & DllStructGetData($tConnInfo, "dwHashStrength") & ", " & _ "Exch=0x" & Hex(DllStructGetData($tConnInfo, "aiExch"), 4) & ", " & _ "ExchStrength=" & DllStructGetData($tConnInfo, "dwExchStrength") & @CRLF) Local $dwProtocol = DllStructGetData($tConnInfo, "dwProtocol") Local $sProtocol = GetProtocolName($dwProtocol) ConsoleWrite("š SSL Protocol: " & $sProtocol & " (raw value: 0x" & Hex($dwProtocol, 4) & ")" & @CRLF) ConsoleWrite("CERT_INFO Data: Version=" & DllStructGetData($tCertInfo, "dwVersion") & ", pszObjId=" & DllStructGetData($tCertInfo, "pszObjId") & @CRLF) ConsoleWrite("šļø Signature Algorithm: " & GetSignatureAlgorithm($pCertInfo) & @CRLF) Local $sCipher = GetCipherName(DllStructGetData($tConnInfo, "aiCipher")) ConsoleWrite("š Encryption Algorithm: " & $sCipher & @CRLF) Local $iCipherStrength = DllStructGetData($tConnInfo, "dwCipherStrength") ConsoleWrite("š ļø Key Size: " & $iCipherStrength & " bits" & @CRLF) DllCall("crypt32.dll", "bool", "CertFreeCertificateContext", "ptr", $pCertContext) EndFunc ;==>DisplayCertInfo Func GetCertNameString($pCertContext, $bIssuer = False) Local Const $CERT_NAME_SIMPLE_DISPLAY_TYPE = 4 Local Const $CERT_NAME_ISSUER_FLAG = 0x1 Local $dwFlags = ($bIssuer ? $CERT_NAME_ISSUER_FLAG : 0) Local $aRet = DllCall("crypt32.dll", "dword", "CertGetNameStringW", _ "ptr", $pCertContext, _ "dword", $CERT_NAME_SIMPLE_DISPLAY_TYPE, _ "dword", $dwFlags, _ "ptr", 0, _ "wstr", 0, _ "dword", 0) If @error Then Return "Error DLL: " & @error EndIf Local $iLength = $aRet[0] If $iLength <= 1 Then Return "" EndIf Local $tBuffer = DllStructCreate("wchar[" & $iLength & "]") $aRet = DllCall("crypt32.dll", "dword", "CertGetNameStringW", _ "ptr", $pCertContext, _ "dword", $CERT_NAME_SIMPLE_DISPLAY_TYPE, _ "dword", $dwFlags, _ "ptr", 0, _ "ptr", DllStructGetPtr($tBuffer), _ "dword", $iLength) If @error Or $aRet[0] <= 1 Then Return "" EndIf Return DllStructGetData($tBuffer, 1) EndFunc ;==>GetCertNameString Func GetProtocolName($dwProtocol) Switch $dwProtocol Case 0x0080 Return "SSL 2.0" Case 0x0300 Return "SSL 3.0" Case 0x0301 Return "TLS 1.0" Case 0x0302 Return "TLS 1.1" Case 0x0800 Return "TLS 1.2" Case 0x1000 Return "TLS 1.3" Case Else Return "Inconnu (0x" & Hex($dwProtocol, 4) & ")" EndSwitch EndFunc ;==>GetProtocolName Func GetSignatureAlgorithm($pCertInfo) Local $tCertInfo = DllStructCreate($tagCERT_INFO, $pCertInfo) Local $pszObjId = DllStructGetData($tCertInfo, "pszObjId") ConsoleWrite("OID brut : " & $pszObjId & @CRLF) Switch $pszObjId Case "1.2.840.113549.1.1.11" Return "SHA256withRSA" Case "1.2.840.113549.1.1.12" Return "SHA384withRSA" Case "1.2.840.10045.4.3.2" Return "ECDSAwithSHA256" Case "1.2.840.10045.4.3.3" Return "ECDSAwithSHA384" Case Else Return "Inconnu (OID: " & $pszObjId & ")" EndSwitch EndFunc ;==>GetSignatureAlgorithm Func GetCipherName($aiCipher) Switch $aiCipher Case 0x0000660E Return "AES-128" Case 0x0000660F Return "AES-256" Case 0x00000002 Return "RC4" Case 0x00000005 Return "3DES" Case Else Return "Inconnu (0x" & Hex($aiCipher, 4) & ")" EndSwitch EndFunc ;==>GetCipherName Func Cleanup() If IsDllStruct($tCtxtHandle) Then DllCall("secur32.dll", "long", "DeleteSecurityContext", "ptr", DllStructGetPtr($tCtxtHandle)) $tCtxtHandle = 0 EndIf If IsDllStruct($tCredHandle) Then DllCall("secur32.dll", "long", "FreeCredentialsHandle", "ptr", DllStructGetPtr($tCredHandle)) $tCredHandle = 0 EndIf If $iSocket <> -1 Then TCPCloseSocket($iSocket) $iSocket = -1 EndIf TCPShutdown() EndFunc ;==>Cleanup Func FileTimeToString($tFileTime) Local $tSystemTime = DllStructCreate("word wYear;word wMonth;word wDayOfWeek;word wDay;word wHour;word wMinute;word wSecond;word wMilliseconds") Local $aRet = DllCall("kernel32.dll", "none", "FileTimeToSystemTime", _ "ptr", DllStructGetPtr($tFileTime), _ "ptr", DllStructGetPtr($tSystemTime)) If @error Or $aRet[0] <> 0 Then ConsoleWrite("Erreur FileTimeToSystemTime: " & @error & @CRLF) Return "Erreur" EndIf Return StringFormat("%04d/%02d/%02d %02d:%02d:%02d UTC", _ DllStructGetData($tSystemTime, "wYear"), _ DllStructGetData($tSystemTime, "wMonth"), _ DllStructGetData($tSystemTime, "wDay"), _ DllStructGetData($tSystemTime, "wHour"), _ DllStructGetData($tSystemTime, "wMinute"), _ DllStructGetData($tSystemTime, "wSecond")) EndFunc ;==>FileTimeToString ; Execution If InitializeTLS() Then ConsoleWrite("TLS connection successful!" & @CRLF) Sleep(300) DisplayCertInfo() Else ConsoleWrite("TLS connection failed" & @CRLF) EndIf Cleanup()