Leaderboard
Popular Content
Showing content with the highest reputation on 10/15/2020 in all areas
-
Hello Recently, there was a need to develop an SMS gateway. The machine is supposed to send notifications to employees, the number of sms sent is not much 10-50 a month, so it makes no sense to buy a subscription to the www-sms API. The machine is based on a USB-GSM modem: LC SIM800C V3 (aliexp.. price 3-8$) I used UDF: ComUDF.au3 Thank you mLipok for your work! Below is the program code with an example WARNING! The program is written very extensively (not optimized) - it was created with a novice programmer as part of exercises. But it makes it very understandable (lots of comments) There are ONLY functions here: - modem initialization - sending SMS - deleting received sms (no possibility of reading) Maybe someone will be useful for further experiments with AT commands to communicate with the modem. The biggest challenge for me was the dependence of AT commands in different modem operation modes (instruction AT command for chip SIM800 ONLY 380 pages !) LCSIM800CV3.au3 #include "ComUDF.au3" #include <Array.au3> #include <Timers.au3> Global Const $SMS_NOPL = 0 ; send sms not POLISH characters set the SMS mode "GSM" look AT command AT+CSCS Global Const $SMS_PL = 1 ; send sms with POLISH characters set the SMS mode "HEX" look AT command AT+CSCS ; Write setting from PC with modem USB Global $LCSIM800CV3_sComPort = 'COM3' ; a com port with USB modem, e.g. COM1 Global $LCSIM800CV3_sPortSettings = ' baud=9600 data=8' ; speed settings (for default values see _COM_OpenPort) Global $LCSIM800CV3_hComPort Local $LCSIM800CV3_aPortsList = _COM_ListPorts() ; an array with COM ports ;_ArrayDisplay($LCSIM800CV3_aPortsList) ; displays the ports found in OS _Example() ; example function ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Example ; Description ...: Declaring an array with data to send an SMS (various phone number formats) ; Sending SMS in "HEX" mode ; Sending SMS in "GSM" mode ; Syntax ........: _Example() ; Parameters ....: None ; Return values .: None ; Author ........: ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _Example() ;MODIFY number phone vvvvvvv and vvvvvvvv Local $aTest[2][2] = [['123456789','Test pl liter: ęóąśłżźćń'],['+48123456789','Test PL liter: ĘÓĄŚŁŻŹĆŃ']] ConsoleWrite('==START send sms mode "HEX" with diacritical character==' & @CRLF) $Return = _SendSMSFromArray($aTest, $SMS_PL) $Error = @error $Extended = @extended If $Error Then ConsoleWrite('$Error: ' & $Error & @CRLF) ConsoleWrite('$Extended: ' & $Extended & @CRLF) ConsoleWrite('$Return: ' & $Return & @CRLF) Else _ArrayDisplay($Return, '$SMS_PL') EndIf ConsoleWrite('==END send sms mode "HEX" with diacritical character==' & @CRLF) ConsoleWrite('==START send sms mode "GSM" only basic alphabet==' & @CRLF) $Return = _SendSMSFromArray($aTest, $SMS_NOPL) $Error = @error $Extended = @extended If $Error Then ConsoleWrite('$Error: ' & $Error & @CRLF) ConsoleWrite('$Extended: ' & $Extended & @CRLF) ConsoleWrite('$Return: ' & $Return & @CRLF) Else _ArrayDisplay($Return, '$SMS_NOPL') EndIf ConsoleWrite('==END send sms mode "GSM" only basic alphabet==' & @CRLF) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendSMSFromArray ; Description ...: Complete SMS sending function (opening the COM port; modem initialization; ; sending a text message; closing the COM port) ; Syntax ........: _SendSMSFromArray($aTableSMS, $PL) ; Parameters ....: $aTableSMS - an 2D array [NumberPhone_1][TextSMS_1] ; [NumberPhone_n][TextSMS_n] ; $PL - $SMS_NOPL (0) NO PL char send normal text "GSM" ; - $SMS_PL (1) PL char send mode "HEX" ; Return values .: success - input array and add col with status ; [NumberPhone_1][TextSMS_1][status_send _1] ; [NumberPhone_n][TextSMS_n][status_send _n] ; fail - set @error and description error ; Author ........: ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendSMSFromArray($aTableSMS, $PL) Local $Return, $Error, $Extended, $i $Return = _InitModem($PL) $Error = @error $Extended = @extended If $Error Then _COM_ClosePort($LCSIM800CV3_hComPort) Return SetError(1, 1, '[_SendSMSFromArray] ' & $Return) EndIf _DelAllSMS() _ArrayColInsert($aTableSMS, 2) ; add col to status sending sms For $i=0 to UBound($aTableSMS, $UBOUND_ROWS)-1 $Return = _SendSMS($aTableSMS[$i][0], $aTableSMS[$i][1], $PL) $Error = @error $Extended = @extended If $Error Then $aTableSMS[$i][2] = $Return Else $aTableSMS[$i][2] = 'OK' EndIf Next _COM_ClosePort($LCSIM800CV3_hComPort) Return $aTableSMS EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _InitModem ; Description ...: Open port COM, verify modem reposnse, send command setting SMS mode ; Syntax ........: _InitModem($PL) ; Parameters ....: $PL - 0 no PL character - SMS mode "GSM" ; 1 PL character - SMS mode "HEX" ; Return values .: success - 1 ; failure - set @error and return description error ; Author ........: ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _InitModem($PL) Local $Return, $Error, $Extended $Return = _COM_OpenPort($LCSIM800CV3_sComPort & $LCSIM800CV3_sPortSettings) $Error = @error If $Error Then Return SetError(1, 1, '[_Init] error open port: ' & $LCSIM800CV3_sComPort & $LCSIM800CV3_sPortSettings) EndIf $LCSIM800CV3_hComPort = $Return $Return = __SendToModem('AT') ; ping modem If StringInStr($Return, 'OK') = 0 Then Return SetError(1, 2, '[_Init] communication error with modem - AT command returned: ' & $Return) EndIf $Return = __SendToModem('ATE0') ; disable "echo" 0= send "AT" received: "OK"; 1= send "AT" received: "AT @CR OK" If StringInStr($Return, 'OK') = 0 Then Return SetError(1, 2, '[_Init] communication error with modem - ATE0 command returned: ' & $Return) EndIf $Return = __SendToModem('AT+CMGF=1') ; format wiadomości SMS (0 - PDU, 1 - Text) If StringInStr($Return, 'OK') = 0 Then Return SetError(1, 2, '[_Init] communication error with modem - AT+CMGF=1 command returned: ' & $Return) EndIf If $PL=$SMS_NOPL Then $Return = __SendToModem('AT+CSCS="GSM"') ; set mode "GSM" all character is normal text If StringInStr($Return, 'OK') = 0 Then Return SetError(1, 2, '[_Init] communication error with modem - AT+CSCS=""GSM"" command returned: ' & $Return) EndIf $Return = __SendToModem('AT+CSMP=17,167,0,0') ; additional settings to "GSM" If StringInStr($Return, 'OK') = 0 Then Return SetError(1, 2, '[_Init] communication error with modem - AT+CSMP=17,167,0,0 command returned: ' & $Return) EndIf ElseIf $PL=$SMS_PL Then $Return = __SendToModem('AT+CSCS="HEX"') ; set mode "HEX" all character is hex 4digit If StringInStr($Return, 'OK') = 0 Then Return SetError(1, 2, '[_Init] communication error with modem - AT+CSCS=""HEX"" command returned: ' & $Return) EndIf $Return = __SendToModem('AT+CSMP=17,167,0,8') ; additional settings to "HEX" If StringInStr($Return, 'OK') = 0 Then Return SetError(1, 2, '[_Init] communication error with modem - AT+CSMP=17,167,0,8 command returned: ' & $Return) EndIf Else Return SetError(1, 2, '[_Init] incorrect parameter $PL:' & $PL) EndIf Return 1 EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DelAllSMS ; Description ...: Deletes all received sms ; Syntax ........: _DelAllSMS() ; Parameters ....: None ; Return values .: success - 1 ; failure - set @error and return description error ; Author ........: ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DelAllSMS() $Return = __SendToModem('AT+CMGDA="DEL ALL"') ; send command AT delete all sms and receives text "OK" If StringInStr($Return, 'OK') = 0 Then Return SetError(1, 1, '[_DelAllSMS] SMS erase error - AT+CMGDA="DEL ALL" command returned: ' & $Return) EndIf Return 1 EndFunc ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendSMS ; Description ...: Send sms. Restriction of sending to the country POLAND (+48) ; Syntax ........: _SendSMS($sPhoneNumber, $sSMS, $PL) ; Parameters ....: $sPhoneNumber - a string value. ; $sSMS - a string value. ; $PL - 0=no PL character - SMS mode "GSM"; 1=PL character - SMS mode "HEX" ; Return values .: success - 1 ; failure - set @error and return description error ; Author ........: ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _SendSMS($sPhoneNumber, $sSMS, $PL) Local $Return, $Error, $Extended ;verifying and modifying of the telephone number $sPhoneNumber = StringRegExpReplace($sPhoneNumber, "\D", '') If Not StringLen($sPhoneNumber) = 9 Or Not StringLen($sPhoneNumber) = 11 Then ;Number MUST 9 or 11 digit Return SetError(1, 9, '[_SendSMS] wrong phone number: ' & $sPhoneNumber) EndIf ;START ONLY country +48 ;NOTE this section allows you to send text messages only to the area code PL ;CHANGE 48 with your country code or delete this part If StringLen($sPhoneNumber) = 9 Then $sPhoneNumber = '+48' & $sPhoneNumber ; ElseIf StringLen($sPhoneNumber) = 11 Then If StringLeft($sPhoneNumber, 2) <> '48' Then Return SetError(1, 9, '[_SendSMS] wrong phone area code: ' & $sPhoneNumber) Else $sPhoneNumber = '+' & $sPhoneNumber EndIf EndIf ;END ONLY country +48 ;verifying and modifying of the text sms If StringLen($sSMS) > 250 Then Return SetError(1, 10, '[_SendSMS] the content of the SMS exceeds 250 characters: ' & StringLen($sSMS)) EndIf ;sending SMS ;step 1 -send phone number & <CR> $Return = __SendToModem('AT+CMGS="' & $sPhoneNumber & '"') ; send command AT & number and receives char ">" If StringInStr($Return, '>') = 0 Then Return SetError(1, 1, '[_SendSMS] modem communication error - command AT+CMGS="' & $sPhoneNumber & '": ' & $Return) EndIf ;step 2 - send text sms & <ESC> / Ctrl+Z If $PL=$SMS_PL Then ; convert to HEX with PL char $sSMS = Hex(StringToBinary($sSMS, $SB_UTF16BE)) ElseIf $PL=$SMS_NOPL Then ; $SMS_NOPL $sSMS = __ReplacePLChar($sSMS) ; if "GSM" then normal text and replace ą=>a etc. Else Return SetError(1, 1, '[_SendSMS] incorrect parameter $PL:' & $PL) EndIf $Return = __SendToModem($sSMS, Chr(26)) ;send text and Ctrl-Z If StringInStr($Return, 'ERROR') > 0 Then Return SetError(1, 2, '[_SendSMS] modem communication error - command AT+CSCS="GSM" returned: ' & $Return) ElseIf StringInStr($Return, '+CMGS:') > 0 And StringInStr($Return, 'OK') > 0 Then Return 1 Else Return SetError(1, 3, '[_SendSMS] communication error with modem - unknown answer: ' & $Return) EndIf EndFunc Func __SendToModem($sText, $sEnter=Chr(13)) Local $Return, $Error, $hTimerStart If $sEnter <> Chr(13) And $sEnter <> Chr(26) Then Return SetError(1, 10, '[__SendToModem] argument value not allowed $sEnter: ' & $sEnter) EndIf $Return = _COM_SendString($LCSIM800CV3_hComPort, $sText & $sEnter) $Error = @error If $Error Then Return SetError(1, 1, '[__SendToModem][_COM_SendString] it returned an error: ' & $Error) EndIf Sleep(500) ; wait 500ms to allow the receive buffer to fill up $hTimerStart = _Timer_Init() Do Do Sleep(100) $Return = _COM_GetInputcount($LCSIM800CV3_hComPort) $Error = @error If $Error Then Return SetError(1, 1, '[__SendToModem][_COM_GetInputcount] it returned an error: ' & $Error) EndIf $iCount = $Return If _Timer_Diff($hTimerStart) > 61*1000 Then ;WARNING! Must be> 60 sec - instruction from modem: "Max response time send sms: 60s" Return SetError(1, 1, '[__SendToModem][_COM_GetInputcount] no answer from modem for 60 seconds') EndIf Until $iCount > 0 $Return = _COM_ReadString($LCSIM800CV3_hComPort, $iCount) $Error = @error If $Error Then Return SetError(1, 1, '[__SendToModem][_COM_ReadString] it returned an error: ' & $Error) EndIf Until StringInStr($Return, '+CMTI: "')=0 ; we omit modem responses informing about receiving an SMS Return $Return EndFunc ; #INTERNAL_USE_ONLY# =========================================================================================================== ; Name ..........: __ReplacePLChar ; Description ...: Replace polish characters to NO polish ; Syntax ........: __ReplacePLChar($sText) ; Parameters ....: $sText - a string value. ; Return values .: String no polish character ; Author ........: ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __ReplacePLChar($sText) $sText = StringReplace($sText, 'Ą', 'A', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'ą', 'a', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'Ć', 'C', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'ć', 'c', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'Ę', 'E', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'ę', 'e', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'Ł', 'L', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'ł', 'l', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'Ń', 'N', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'ń', 'n', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'Ó', 'O', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'ó', 'o', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'Ś', 'S', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'ś', 's', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'Ź', 'Z', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'ź', 'z', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'Ż', 'Z', 0, $STR_CASESENSE) $sText = StringReplace($sText, 'ż', 'z', 0, $STR_CASESENSE) Return $sText EndFunc1 point
-
Correct... The exe has the same "file" included in the PE header. Jos1 point
-
First of all : This is not a negative evaluation of the project made by @Exit ! According to my knowledge, a standalone .a3x file is no different from the variant included in the .exe (experts like @Jos may correct me). Therefore an .a3x file is not more vulnerable at all. The aspect "alternate data streams" has just been answered by @Exit while I was writing this post .1 point
-
Hello @Borje, I think that the solution with entering an A3X file is better than entering an EXE file, because the "Autoit3.exe" file is accepted as trustworthy by most virus scanners. Hello @t0nZ,, unfortunately the way via a zip file is inevitable, as ADS files cannot be sent via FTP or email. and that's why I recommended Borje to use the A3X variant.1 point
-
I Cannot reach a text area and a button on the same page
MarcoMonte reacted to Danp2 for a topic
You need to use _IEGetObjById instead of _IEFormElementGetObjByName because AFAICS there isn't a true form involved. Try -- $oText = _IEGetObjById($Posizione, "writeAddress") _IEFormElementSetValue ($oText,"via Ravenna 12" ) Not clear to me which button you are wanting to click, but the same technique should work. For example -- $oButton = _IEGetObjById($Posizione, "buttCerca") _IEAction($oButton, "click")1 point -
1 point
-
BONUS UPDATE! A minor bonus update for you guys, I have implemented parsing of keywords while working on the statement parser: -- I have also created a chatroom on [matrix], so if anyone is interested they can easily join using the web client: https://app.element.io/#/room/#EasyCodeIt:matrix.org The chatroom is fully public and all chat is visible to everyone (including unregistered guests!), so you can have a peek 👀 before joining. I am the only participant at the moment but I will respond to everyone who wants to chat... because I love to talk, perhaps too much1 point
-
WinHTTP This site requires Javascript to work
TheXman reacted to JockoDundee for a topic
Precise presumptive prescience1 point -
Yes, You can custom or owner draw the images directly with GDI/GDI+ functions without relying on an imagelist. A Virtual listview immediately supports the custom draw technique. To set the height of the rows in the listview to match the height of the images, you can probably add an imagelist with a single image of the correct height. To use the owner draw method, you can combine the virtual ($LVS_OWNERDATA) and owner draw ($LVS_OWNERDRAWFIXED) styles. By replying to WM_MEASUREITEM messages it's easy to set the height of the listview rows. Search forums for the topics and it should be possible to find code examples.1 point
-
I have made an change to au3check to strip any trailing backslashes from the registry entries so one can't make that mistake. It's available in the Beta dir: https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/Au3Check.exe in case you want to test it. Jos1 point
-
You are right, I should have mentioned this variant too. @FrancoDM : Some time ago I created a small comparison program (only for myself), but it should help you as well . #include <Crypt.au3> #include <WinAPI.au3> Opt("MustDeclareVars", 1) Global $sFile = @SystemDir & '\mspaint.exe' ; <== example Global $hTimer, $iTimer, $sData ConsoleWrite('----------------------------------------------------------- ' & @CRLF) ; CRC32 von trancexx : $hTimer = TimerInit() $sData = _CRC32ForFile($sFile) $iTimer = TimerDiff($hTimer) ConsoleWrite(' CRC32 - trancexx : ' & $sData & @CRLF) ConsoleWrite(' >>> Time = ' & $iTimer & " ms" & @CRLF) ConsoleWrite('----------------------------------------------------------- ' & @CRLF) ; MD5 von trancexx : $hTimer = TimerInit() $sData = _MD5ForFile($sFile) $iTimer = TimerDiff($hTimer) ConsoleWrite(' MD5 - trancexx : ' & Hex($sData) & @CRLF) ConsoleWrite(' >>> Time = ' & $iTimer & " ms" & @CRLF) ConsoleWrite('----------------------------------------------------------- ' & @CRLF) ; MD5 mit Standard AutoIt Crypt.au3 : _Crypt_Startup() $hTimer = TimerInit() $sData = _Crypt_HashFile($sFile, $CALG_MD5) $iTimer = TimerDiff($hTimer) ConsoleWrite(' MD5 - _Crypt.au3 : ' & Hex($sData) & @CRLF) ConsoleWrite(' >>> Time = ' & $iTimer & " ms" & @CRLF) ConsoleWrite('----------------------------------------------------------- ' & @CRLF) _Crypt_Shutdown() ;------------------------------------------------------------------------ ; #FUNCTION# ;=============================================================================== ; Name...........: _CRC32ForFile ; Description ...: Calculates CRC32 value for the specific file. ; Syntax.........: _CRC32ForFile ($sFile) ; Parameters ....: $sFile - Full path to the file to process. ; Return values .: Success - Returns CRC32 value in form of hex string ; - Sets @error to 0 ; Failure - Returns empty string and sets @error: ; |1 - CreateFile function or call to it failed. ; |2 - CreateFileMapping function or call to it failed. ; |3 - MapViewOfFile function or call to it failed. ; |4 - RtlComputeCrc32 function or call to it failed. ; Author ........: trancexx ;========================================================================================== Func _CRC32ForFile($sFile) Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _ "wstr", $sFile, _ "dword", 0x80000000, _ ; GENERIC_READ "dword", 3, _ ; FILE_SHARE_READ|FILE_SHARE_WRITE "ptr", 0, _ "dword", 3, _ ; OPEN_EXISTING "dword", 0, _ ; SECURITY_ANONYMOUS "ptr", 0) If @error Or $a_hCall[0] = -1 Then Return SetError(1, 0, "") EndIf Local $hFile = $a_hCall[0] $a_hCall = DllCall("kernel32.dll", "ptr", "CreateFileMappingW", _ "hwnd", $hFile, _ "dword", 0, _ ; default security descriptor "dword", 2, _ ; PAGE_READONLY "dword", 0, _ "dword", 0, _ "ptr", 0) If @error Or Not $a_hCall[0] Then DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile) Return SetError(2, 0, "") EndIf DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFile) Local $hFileMappingObject = $a_hCall[0] $a_hCall = DllCall("kernel32.dll", "ptr", "MapViewOfFile", _ "hwnd", $hFileMappingObject, _ "dword", 4, _ ; FILE_MAP_READ "dword", 0, _ "dword", 0, _ "dword", 0) If @error Or Not $a_hCall[0] Then DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject) Return SetError(3, 0, "") EndIf Local $pFile = $a_hCall[0] Local $iBufferSize = FileGetSize($sFile) Local $a_iCall = DllCall("ntdll.dll", "dword", "RtlComputeCrc32", _ "dword", 0, _ "ptr", $pFile, _ "int", $iBufferSize) If @error Or Not $a_iCall[0] Then DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile) DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject) Return SetError(4, 0, "") EndIf DllCall("kernel32.dll", "int", "UnmapViewOfFile", "ptr", $pFile) DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $hFileMappingObject) Local $iCRC32 = $a_iCall[0] Return SetError(0, 0, Hex($iCRC32)) EndFunc ;==>_CRC32ForFile ; #FUNCTION# ;=============================================================================== ; Name...........: _MD5ForFile ; Description ...: Calculates MD5 value for the specific file. ; Syntax.........: _MD5ForFile ($sFile) ; Parameters ....: $sFile - Full path to the file to process. ; Return values .: Success - Returns MD5 value in form of binary data ; - Sets @error to 0 ; Failure - Returns empty string and sets @error: ; |1 - CreateFile function or call to it failed. ; |2 - MD5Init function or call to it failed. ; |4 - ReadFile function or call to it failed. ; |5 - MD5Update function or call to it failed. ; |6 - MD5Final function or call to it failed. ; Author ........: trancexx ;========================================================================================== Func _MD5ForFile($sFile) Local $a_hCall = DllCall("kernel32.dll", "hwnd", "CreateFileW", _ "wstr", $sFile, _ "dword", 0x80000000, _ ; GENERIC_READ "dword", 1, _ ; FILE_SHARE_READ "ptr", 0, _ "dword", 3, _ ; OPEN_EXISTING "dword", 0, _ ; SECURITY_ANONYMOUS "ptr", 0) If @error Or $a_hCall[0] = -1 Then Return SetError(1, 0, "") EndIf Local $hFile = $a_hCall[0] Local $tMD5_CTX = DllStructCreate("dword i[2];" & _ "dword buf[4];" & _ "ubyte in[64];" & _ "ubyte digest[16]") DllCall("advapi32.dll", "none", "MD5Init", "ptr", DllStructGetPtr($tMD5_CTX)) If @error Then _WinAPI_CloseHandle($hFile) Return SetError(2, 0, "") EndIf Local $tBuffer = DllStructCreate("byte[524288]") Local $pBuffer = DllStructGetPtr($tBuffer), $iSize Local $iReadErr = True While _WinAPI_ReadFile($hFile, $pBuffer, 524288, $iSize) And $iSize $iReadErr = False DllCall("advapi32.dll", "none", "MD5Update", _ "ptr", DllStructGetPtr($tMD5_CTX), _ "ptr", $pBuffer, _ "dword", $iSize) If @error Then _WinAPI_CloseHandle($hFile) Return SetError(5, 0, "") EndIf WEnd If $iReadErr Then _WinAPI_CloseHandle($hFile) Return SetError(4, 0, "") EndIf DllCall("advapi32.dll", "none", "MD5Final", "ptr", DllStructGetPtr($tMD5_CTX)) If @error Then _WinAPI_CloseHandle($hFile) Return SetError(6, 0, "") EndIf _WinAPI_CloseHandle($hFile) Local $sMD5 = DllStructGetData($tMD5_CTX, "digest") Return SetError(0, 0, $sMD5) EndFunc ;==>_MD5ForFile _Crypt_HashFile is probably the easiest to implement.1 point