Jump to content

Gunnar

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Gunnar

  1. Using AutoIt v3.3.16.1 EXE-Installer (default Installation options, just clicking next) modifies: Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment Value-Name: PSModulePath Value-Type: REG_EXPAND_SZ Value before Installation: %ProgramFiles%\WindowsPowerShell\Modules;%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules Value after Installation: %ProgramFiles(x86)%\WindowsPowerShell\Modules;%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\AutoIt3\AutoItX Problem: %ProgramFiles%\WindowsPowerShell\Modules changed to %ProgramFiles(x86)%\WindowsPowerShell\Modules Running Uninstall does the same! It correctly removes AutoItX Path from PSModulePath but again changes %ProgramFiles%\WindowsPowerShell\Modules to %ProgramFiles(x86)%\WindowsPowerShell\Modules
  2. Slightly modified, to demonstrate both Conversion Variants: Opt("MustDeclareVars", 1) #include <String.au3> Local $HEX = "08045cb64115eb65e2466e1b5c19065def72e35b5402249e1159f279f9dd02b9" Local $StringUTF8 = _HexToString($HEX) Local $StringAnsi = _HexToStringAnsi($HEX) ConsoleWrite("Demonstrating: AutoIt _HexToString and _StringToHex broken since Version 3.3.14.0 (uses UTF8 instead of ANSI)" & @CRLF) ConsoleWrite("String ANSI: " & $StringAnsi & @CRLF) ConsoleWrite("String UTF8: " & $StringUTF8 & @CRLF) ConsoleWrite("HEX original input: " & $HEX & @CRLF) ; ConsoleWrite("HEX converted from Ansi as Ansi: " & _StringToHexAnsi($StringAnsi) & @CRLF) ; ConsoleWrite("HEX converted from UTF8 as Ansi: " & _StringToHexAnsi($StringUTF8) & @CRLF) ; ConsoleWrite("HEX converted from UTF8 as UTF8: " & _StringToHex($StringUTF8) & @CRLF) ; ; Instead of using _StringtoHex and _HexToString from String.au3 using this self-made Functions: Func _StringToHexAnsi($sString) Return Hex(StringToBinary($sString, $SB_ANSI)) EndFunc Func _HexToStringAnsi($sHex) If Not (StringLeft($sHex, 2) == "0x") Then $sHex = "0x" & $sHex Return BinaryToString($sHex, $SB_ANSI) EndFunc Output:
  3. I'm using the _HexToString Function (included in String.au3 Library). The tool I coded with AutoIt in 2014 worked perfectly, but when I recompile with an actual AutoIt Version the Calculations have wrong results. I digged into and found the root cause, the _HexToString Function does a bad job starting with AutoIt 3.3.14.0 (Released 10th July, 2015) . The Changelog says: "Changed: _HexToString() to _StringToHex() now handles strings and binary as UTF-8 by default." OK, so you changed the internal handling. But in my opinion this should not lead to a wrong result. To demonstrate the problem, I wrot some lines of sample code. What I do is: Convert a Hex to a String, then convert the String to a Hex. I would expect, that the Input-HEX is the same as the output HEX. But you can see, that this is not the case, the output-Hex changes (starting with v3.3.14.0). Workaround: Using my own _HexToStringAnsi and _StringToHexAnsi Functions which to the conversion like it was done ins String.au3 in older Versions. Opt("MustDeclareVars", 1) #include <String.au3> Local $HEX = "08045cb64115eb65e2466e1b5c19065def72e35b5402249e1159f279f9dd02b9" Local $StringUTF8 = _HexToString($HEX) Local $StringAnsi = _HexToStringAnsi($HEX) ConsoleWrite("Demonstrating: AutoIt _HexToString and _StringToHex broken since Version 3.3.14.0 (uses UTF8 instead of ANSI)" & @CRLF) ConsoleWrite("String ANSI: " & $StringAnsi & @CRLF) ConsoleWrite("String UTF8: " & $StringUTF8 & @CRLF) ConsoleWrite("HEX original input: " & $HEX & @CRLF) ; ConsoleWrite("HEX converted from Ansi: " & _StringToHexAnsi($StringAnsi) & @CRLF) ; ConsoleWrite("HEX converted from UTF8: " & _StringToHexAnsi($StringUTF8) & @CRLF) ; ; Instead of using _StringtoHex and _HexToString from String.au3 using this self-made Functions: Func _StringToHexAnsi($sString) Return Hex(StringToBinary($sString, $SB_ANSI)) EndFunc Func _HexToStringAnsi($sHex) If Not (StringLeft($sHex, 2) == "0x") Then $sHex = "0x" & $sHex Return BinaryToString($sHex, $SB_ANSI) EndFunc Attached a Screenshot of the Output with most current AutoIt v3.3.14.5 (Released 16th March, 2018).
×
×
  • Create New...