Sign in to follow this  
Followers 0
Belini

Gui with the option of choice.

1 post in this topic

Select the option by using a selector.

#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#cs ----------------------------------------------------------------------------
Author: Belini
Date: 07/05/12
AutoIt Version: 3.3.9.4
Script Function: Menu choice
#ce ----------------------------------------------------------------------------
Const $MASCARA = 0x8000
Global $baixo = 0x26
Global $cima = 0x28
Global $confir = 0x41
Global $Label_opt1, $Label_opt2, $pic_sel_1, $pic_sel_2, $gui, $opcao_escol = 1
Global $cont_tempo = 0, $move = 1, $loop = 1, $escol_feita = 1, $Label_press
escolha()
Func escolha()
gui()
While $loop
  If BitAND(_WinAPI_GetAsyncKeyState($baixo), $MASCARA) Then
   $opcao_escol += 1
   $move = 1
   Sleep(200)
  EndIf
  If BitAND(_WinAPI_GetAsyncKeyState($cima), $MASCARA) Then
   $opcao_escol -= 1
   $move = 1
   Sleep(200)
  EndIf
  If $opcao_escol > 2 Then $opcao_escol = 1
  If $opcao_escol <= 0 Then $opcao_escol = 2
  If $opcao_escol = 1 And $move = 1 Then
   GUICtrlSetImage($pic_sel_1, _Seletor(True))
   GUICtrlSetImage($pic_sel_2, "")
   $move = 0
  EndIf
  If $opcao_escol = 2 And $move = 1 Then
   GUICtrlSetImage($pic_sel_1, "")
   GUICtrlSetImage($pic_sel_2, _Seletor(True))
   $move = 0
  EndIf
  If BitAND(_WinAPI_GetAsyncKeyState($confir), $MASCARA) Then key_press()
  Sleep(5)
WEnd
Switch $opcao_escol
  Case 1
   MsgBox(4096, "completed.", "The first option was chosen.")
  Case 2
   MsgBox(4096, "completed.", "The second option was chosen.")
EndSwitch
EndFunc   ;==>escolha
Func key_press()
$cont_press = TimerInit()
AdlibRegister("mostra_mens", 1000)
While 1
  If Not BitAND(_WinAPI_GetAsyncKeyState($confir), $MASCARA) Or TimerDiff($cont_press) >= 3000 Then ExitLoop
  Sleep(1)
WEnd
If TimerDiff($cont_press) < 3000 Then $loop_1 = 1
If TimerDiff($cont_press) >= 3000 Then
  GUIDelete($gui)
  $loop = 0
EndIf
GUICtrlSetBkColor($Label_press, "")
GUICtrlSetData($Label_press, "")
AdlibUnRegister("mostra_mens")
$cont_tempo = 0
$cont_press = 0
EndFunc   ;==>key_press
Func gui()
Local $Label_cima, $Label_baixo
$gui_1 = GUICreate("opcional", 393, 157, -1, -1, BitOR($WS_POPUP, $WS_BORDER))
GUISetBkColor(0x000000, $gui_1)
$pic_sel_1 = GUICtrlCreatePic(_Seletor(True), 9, 53, 375, 23)
$pic_sel_2 = GUICtrlCreatePic("", 9, 84, 375, 23)
GUICtrlSetState($pic_sel_1, $GUI_DISABLE)
GUICtrlSetState($pic_sel_2, $GUI_DISABLE)
GUICtrlCreatePic(_barra_horiz(True), 0, 0, 393, 3)
GUICtrlCreatePic(_barra_vert(True), 0, 0, 3, 189)
GUICtrlCreatePic(_barra_vert(True), 390, 0, 3, 189)
GUICtrlCreatePic(_barra_horiz(True), 0, 155, 393, 3)
$define_arquivo = "áudio e vídeo"
$Limite_del_arq = "3"
$Label_cima = GUICtrlCreateLabel(" Use the arrow keys to select an option:", 13, 6, 367, 24, BitOR($SS_CENTER, $SS_CENTERIMAGE))
$Label_opt1 = GUICtrlCreateLabel("Doing  what  was  defined  in  the  function  number  1.", 13, 56, 367, 17, BitOR($SS_LEFT, $SS_CENTERIMAGE))
$Label_opt2 = GUICtrlCreateLabel("Doing  what  was  defined  in  the  function  number  2.", 13, 87, 367, 17, BitOR($SS_LEFT, $SS_CENTERIMAGE))
$Labe_baixo = GUICtrlCreateLabel('Press "A" for 3 seconds to run the option.', 13, 125, 367, 25, BitOR($SS_CENTER, $SS_CENTERIMAGE))
$Label_press = GUICtrlCreateLabel("", 13, 31, 367, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont($Label_cima, 12, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label_opt1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label_opt2, 10, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Labe_baixo, 10, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label_press, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor($Label_cima, 0xFFFFFF)
GUICtrlSetColor($Label_opt1, 0xFFFFFF)
GUICtrlSetColor($Label_opt2, 0xFFFFFF)
GUICtrlSetColor($Labe_baixo, 0xFFFFFF)
GUICtrlSetColor($Label_press, 0x00FF00)
GUISetState(@SW_SHOW)
EndFunc   ;==>gui
Func mostra_mens()
$cont_tempo += 1
GUICtrlSetData($Label_press, 'The "A" key was pressed for ' & $cont_tempo & " seconds.")
EndFunc   ;==>mostra_mens
; #FUNCTION# ====================================================================================================================
; Name ..........: _barra_horiz()
; Description ...: Compressed file embedded in your .au3 file
; Syntax ........: _barra_horiz( [ lToSave [, sPath [, lExecute ]]] )
; Parameters ....: lToSave           - [optional] If True, save the file, else, return binary data. Default is False.
;                 sPath            - [optional] The path of the file to be save. Default is @TempDir
;                 lExecute          - [optional] Flag to execute file saved. Default is False
; Return values .: Success           - Returns decompressed barra_horiz.bmp binary data or saved.
;        Failure             - Returns 0 and set @error to 1.
; Author(s) .....: João Carlos (Jscript FROM Brazil)
; Modified ......:
; Remarks .......: This function uses _LZNTDecompress() and _Base64Decode() by trancexx.
; Related .......:
; Link ..........:
; Example .......; _barra_horiz()
; ===============================================================================================================================
Func _barra_horiz($lToSave = False, $sPath = @TempDir, $lExecute = False)
Local $hFileHwnd, $bData, $sFileName = $sPath & "\barra_horiz.bmp"
; Original: D:\00 _Importantes\ZZ Proj. maq de música\barra_horiz.bmp
$bData = "xbGgQk04HgACADYAUIIoADCAAgAABAA4iAEAGAAoAAACAHxwEgsAAAEMAkAAED4Awcozn6YpgYYAIWhsG1RYGEv+Tv8F/4B/EH8QfxB/EH8Q/38QPwhffn+Cvwy/DL8Mvwz/vwy/DL8Mvwy/DL8Mvwy/DP+/DL8Mvwy/DL8Mvwy/DL8MD78Mvwy/DLgMFkVIFAA9QBM7PhM8PwAWREde7vdS7QD2SePsQ9HaPeC/xzq0vF8AfwRPBP8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfA"
$bData &= "R8BHwEfAR8BHwEfAQ8fAR8BHwEfAbw3rLMAMpuhLYuRKH0AgiRxdofy+YgE8vlQAIHy+Xfx+Phx8C8AHwEfAR8BHwE/HwEfAR8BHwEfARIBCLEI8PhxoSZp7/dXAO33SOHqP8TNADaor6b2+672APuv9/ur9vul+PX6oV8AfwSfCL8Mvwz/vwy/DL8Mvwy/DF8GHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8BBx8BHwEfAfqb9PqMAPP5efH4Yu73AErl7gAA"
If $lToSave Then
  $hFileHwnd = FileOpen($sFileName, 10)
  If @error Then Return SetError(1, 0, 0)
  FileWrite($hFileHwnd, __barra_horiz(__barra_horizB64($bData)))
  FileClose($hFileHwnd)
  If $lExecute Then
   RunWait($sFileName, "")
   FileDelete($sFileName)
   Return 1
  EndIf
  If FileExists($sFileName) Then Return $sFileName
Else
  Return __barra_horiz(__barra_horizB64($bData))
EndIf
Return SetError(1, 0, 0)
EndFunc   ;==>_barra_horiz
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: __barra_horizB64
; Description ...: Base64 decode input data.
; Syntax.........: __barra_horizB64($bBinary)
; Parameters ....: $sInput - String data to decode
; Return values .: Success - Returns decode binary data.
;                         - Sets @error to 0
;                 Failure - Returns empty string and sets @error:
;                 |1 - Error calculating the length of the buffer needed.
;                 |2 - Error decoding.
; Author ........: trancexx
; Modified ......: João Carlos (Jscript FROM Brazil)
; Related .......: _Base64Encode()
; ===============================================================================================================================
Func __barra_horizB64($sInput)
Local $struct = DllStructCreate("int")
Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
   "str", $sInput, _
   "int", 0, _
   "int", 1, _
   "ptr", 0, _
   "ptr", DllStructGetPtr($struct, 1), _
   "ptr", 0, _
   "ptr", 0)
If @error Or Not $a_Call[0] Then
  Return SetError(1, 0, "") ; error calculating the length of the buffer needed
EndIf
Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")
$a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
   "str", $sInput, _
   "int", 0, _
   "int", 1, _
   "ptr", DllStructGetPtr($a), _
   "ptr", DllStructGetPtr($struct, 1), _
   "ptr", 0, _
   "ptr", 0)
If @error Or Not $a_Call[0] Then
  Return SetError(2, 0, ""); error decoding
EndIf
Return DllStructGetData($a, 1)
EndFunc   ;==>__barra_horizB64
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: __barra_horiz
; Original Name..: _LZNTDecompress
; Description ...: Decompresses input data.
; Syntax.........: __barra_horiz($bBinary)
; Parameters ....: $vInput - Binary data to decompress.
; Return values .: Success - Returns decompressed binary data.
;                         - Sets @error to 0
;                 Failure - Returns empty string and sets @error:
;                 |1 - Error decompressing.
; Author ........: trancexx
; Related .......: _LZNTCompress
; Link ..........; http://msdn.microsoft.com/en-us/library/bb981784.aspx
; ===============================================================================================================================
Func __barra_horiz($bBinary)
$bBinary = Binary($bBinary)
Local $tInput = DllStructCreate("byte[" & BinaryLen($bBinary) & "]")
DllStructSetData($tInput, 1, $bBinary)
Local $tBuffer = DllStructCreate("byte[" & 16 * DllStructGetSize($tInput) & "]") ; initially oversizing buffer
Local $a_Call = DllCall("ntdll.dll", "int", "RtlDecompressBuffer", _
   "ushort", 2, _
   "ptr", DllStructGetPtr($tBuffer), _
   "dword", DllStructGetSize($tBuffer), _
   "ptr", DllStructGetPtr($tInput), _
   "dword", DllStructGetSize($tInput), _
   "dword*", 0)
If @error Or $a_Call[0] Then
  Return SetError(1, 0, "") ; error decompressing
EndIf
Local $tOutput = DllStructCreate("byte[" & $a_Call[6] & "]", DllStructGetPtr($tBuffer))
Return SetError(0, 0, DllStructGetData($tOutput, 1))
EndFunc   ;==>__barra_horiz
; #FUNCTION# ====================================================================================================================
; Name ..........: _barra_vert()
; Description ...: Compressed file embedded in your .au3 file
; Syntax ........: _barra_vert( [ lToSave [, sPath [, lExecute ]]] )
; Parameters ....: lToSave           - [optional] If True, save the file, else, return binary data. Default is False.
;                 sPath            - [optional] The path of the file to be save. Default is @TempDir
;                 lExecute          - [optional] Flag to execute file saved. Default is False
; Return values .: Success           - Returns decompressed barra_vert.bmp binary data or saved.
;        Failure             - Returns 0 and set @error to 1.
; Author(s) .....: João Carlos (Jscript FROM Brazil)
; Modified ......:
; Remarks .......: This function uses _LZNTDecompress() and _Base64Decode() by trancexx.
; Related .......:
; Link ..........:
; Example .......; _barra_vert()
; ===============================================================================================================================
Func _barra_vert($lToSave = False, $sPath = @TempDir, $lExecute = False)
Local $hFileHwnd, $bData, $sFileName = $sPath & "\barra_vert.bmp"
; Original: D:\00 _Importantes\ZZ Proj. maq de música\barra_vert.bmp
$bData = "vbGgQk24FgACADYAUAooADAEABjgAQAAiAEAGABIAACCAHxwEgsAAAEMAkAAEGIAnJ9Da20vS0wAJz4/esPGW5EAlEBlZy1ISZEA5utzt7tTg4YANldYovj9i94A4mejp0NqbK0A+f2g+P18xMgAUH+Cs/r9p/mA/YbV2VeLjv8X//+A/5L/IP8g/yD/IH8Qf3b//3r/FP+D/4Z/GX8Zfxl/Gf9/GX8Zfxl/GX8Zfxl/GX8Z/38Zfxl/GX8Zfxl/GX8Zfxn/fxl/GX8Zfxm/DH8HPwI/Av8/Aj8CPwI/Aj8CPwI/Aj8C/z8CPwI/Aj8CPwI/Aj8CPwL/PwI/Aj8CPwI/Aj8CPwI/Av8/Aj8CPwI/Aj8CPwI/Aj8C/z8CPwI/Aj8CPwI/Aj8CPwL/PwI/Aj8CPwI/Aj8CPwI/Av8/Aj8CPwI/Aj8CPwI/Aj8C/z8CPwI/Aj8CPwI/Aj8CPwL/PwI/Aj8CPwI/Aj8CPwI/Av8/Aj8CPwI/A"
$bData &= "j8CPwI/Aj8C/z8CPwI/Aj8CPwI/Aj8CPwL/PwI/Aj8CPwI/Aj8CPwI/Av8/Aj8CPwI/Aj8CPwI/Aj8CPz8CPwI/Aj8CPwIzAlCwAIuOs/r9p/n9EIbV2Vdrtrf6/gCt+f2Q5uphmgCdwPv+ufr+oQD4/XO3u8j7/gTC+0EDh9fbzvwA/sr7/rj6/p1g+P3T/P7AAUADrAD5/QAA"
If $lToSave Then
  $hFileHwnd = FileOpen($sFileName, 10)
  If @error Then Return SetError(1, 0, 0)
  FileWrite($hFileHwnd, __barra_vert(__barra_vertB64($bData)))
  FileClose($hFileHwnd)
  If $lExecute Then
   RunWait($sFileName, "")
   FileDelete($sFileName)
   Return 1
  EndIf
  If FileExists($sFileName) Then Return $sFileName
Else
  Return __barra_vert(__barra_vertB64($bData))
EndIf
Return SetError(1, 0, 0)
EndFunc   ;==>_barra_vert
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: __barra_vertB64
; Description ...: Base64 decode input data.
; Syntax.........: __barra_vertB64($bBinary)
; Parameters ....: $sInput - String data to decode
; Return values .: Success - Returns decode binary data.
;                         - Sets @error to 0
;                 Failure - Returns empty string and sets @error:
;                 |1 - Error calculating the length of the buffer needed.
;                 |2 - Error decoding.
; Author ........: trancexx
; Modified ......: João Carlos (Jscript FROM Brazil)
; Related .......: _Base64Encode()
; ===============================================================================================================================
Func __barra_vertB64($sInput)
Local $struct = DllStructCreate("int")
Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
   "str", $sInput, _
   "int", 0, _
   "int", 1, _
   "ptr", 0, _
   "ptr", DllStructGetPtr($struct, 1), _
   "ptr", 0, _
   "ptr", 0)
If @error Or Not $a_Call[0] Then
  Return SetError(1, 0, "") ; error calculating the length of the buffer needed
EndIf
Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")
$a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
   "str", $sInput, _
   "int", 0, _
   "int", 1, _
   "ptr", DllStructGetPtr($a), _
   "ptr", DllStructGetPtr($struct, 1), _
   "ptr", 0, _
   "ptr", 0)
If @error Or Not $a_Call[0] Then
  Return SetError(2, 0, ""); error decoding
EndIf
Return DllStructGetData($a, 1)
EndFunc   ;==>__barra_vertB64
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: __barra_vert
; Original Name..: _LZNTDecompress
; Description ...: Decompresses input data.
; Syntax.........: __barra_vert($bBinary)
; Parameters ....: $vInput - Binary data to decompress.
; Return values .: Success - Returns decompressed binary data.
;                         - Sets @error to 0
;                 Failure - Returns empty string and sets @error:
;                 |1 - Error decompressing.
; Author ........: trancexx
; Related .......: _LZNTCompress
; Link ..........; http://msdn.microsoft.com/en-us/library/bb981784.aspx
; ===============================================================================================================================
Func __barra_vert($bBinary)
$bBinary = Binary($bBinary)
Local $tInput = DllStructCreate("byte[" & BinaryLen($bBinary) & "]")
DllStructSetData($tInput, 1, $bBinary)
Local $tBuffer = DllStructCreate("byte[" & 16 * DllStructGetSize($tInput) & "]") ; initially oversizing buffer
Local $a_Call = DllCall("ntdll.dll", "int", "RtlDecompressBuffer", _
   "ushort", 2, _
   "ptr", DllStructGetPtr($tBuffer), _
   "dword", DllStructGetSize($tBuffer), _
   "ptr", DllStructGetPtr($tInput), _
   "dword", DllStructGetSize($tInput), _
   "dword*", 0)
If @error Or $a_Call[0] Then
  Return SetError(1, 0, "") ; error decompressing
EndIf
Local $tOutput = DllStructCreate("byte[" & $a_Call[6] & "]", DllStructGetPtr($tBuffer))
Return SetError(0, 0, DllStructGetData($tOutput, 1))
EndFunc   ;==>__barra_vert
; #FUNCTION# ====================================================================================================================
; Name ..........: _Seletor()
; Description ...: Compressed file embedded in your .au3 file
; Syntax ........: _Seletor( [ lToSave [, sPath [, lExecute ]]] )
; Parameters ....: lToSave           - [optional] If True, save the file, else, return binary data. Default is False.
;                 sPath            - [optional] The path of the file to be save. Default is @TempDir
;                 lExecute          - [optional] Flag to execute file saved. Default is False
; Return values .: Success           - Returns decompressed Seletor.bmp binary data or saved.
;        Failure             - Returns 0 and set @error to 1.
; Author(s) .....: João Carlos (Jscript FROM Brazil)
; Modified ......:
; Remarks .......: This function uses _LZNTDecompress() and _Base64Decode() by trancexx.
; Related .......:
; Link ..........:
; Example .......; _Seletor()
; ===============================================================================================================================
Func _Seletor($lToSave = False, $sPath = @TempDir, $lExecute = False)
Local $hFileHwnd, $bData, $sFileName = $sPath & "\Seletor.bmp"
; Original: F:\_0 SCRIPTS\zzz ultimas\Testes deletar arquivos\Auxiliares\Seletor.bmp
$bData = "cLGgQk2QZQACADYAUIIoADB3AQAAFwA4iAEAGAAoAABaAHxwEgsAAAEMAkAAEAP44vwC/ws/gL+E1YggjPHgjAKpvKAAXwA/BD8E/z8EPwQ/BD8EPwQ/BD8EPwT/PwQ/BD8EPwQ/BD8EPwQ/BP8/BD8EPwQ/BD8EPwQ/BB8C/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHQETRn9GnwMfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8Bnx8B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D8E/z8EPwQ/BD8EPwQ/BD8EHwL/HwEfARoBE0Z/Rm8DHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BH"
$bData &= "wEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwETAX9GnwIfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8B/x8BHwEfAR8BHwEfAR8BHwH/HwEfAR8BHwEfAR8BHwEfAf8fAR8BHwEfAR8BHwEfAR8BAx8BGQE+sCIAHAECqbyAkAje8PYH3/h/Af9BP0F/EP9/EH8QfxB/EH8QfxA/CL9m/79avwy/DL8Mvwy/DL8MswwDIIwisQ=="
If $lToSave Then
  $hFileHwnd = FileOpen($sFileName, 10)
  If @error Then Return SetError(1, 0, 0)
  FileWrite($hFileHwnd, __Seletor(__SeletorB64($bData)))
  FileClose($hFileHwnd)
  If $lExecute Then
   RunWait($sFileName, "")
   FileDelete($sFileName)
   Return 1
  EndIf
  If FileExists($sFileName) Then Return $sFileName
Else
  Return __Seletor(__SeletorB64($bData))
EndIf
Return SetError(1, 0, 0)
EndFunc   ;==>_Seletor
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: __SeletorB64
; Description ...: Base64 decode input data.
; Syntax.........: __SeletorB64($bBinary)
; Parameters ....: $sInput - String data to decode
; Return values .: Success - Returns decode binary data.
;                         - Sets @error to 0
;                 Failure - Returns empty string and sets @error:
;                 |1 - Error calculating the length of the buffer needed.
;                 |2 - Error decoding.
; Author ........: trancexx
; Modified ......: João Carlos (Jscript FROM Brazil)
; Related .......: _Base64Encode()
; ===============================================================================================================================
Func __SeletorB64($sInput)
Local $struct = DllStructCreate("int")
Local $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
   "str", $sInput, _
   "int", 0, _
   "int", 1, _
   "ptr", 0, _
   "ptr", DllStructGetPtr($struct, 1), _
   "ptr", 0, _
   "ptr", 0)
If @error Or Not $a_Call[0] Then
  Return SetError(1, 0, "") ; error calculating the length of the buffer needed
EndIf
Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")
$a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
   "str", $sInput, _
   "int", 0, _
   "int", 1, _
   "ptr", DllStructGetPtr($a), _
   "ptr", DllStructGetPtr($struct, 1), _
   "ptr", 0, _
   "ptr", 0)
If @error Or Not $a_Call[0] Then
  Return SetError(2, 0, ""); error decoding
EndIf
Return DllStructGetData($a, 1)
EndFunc   ;==>__SeletorB64
; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: __Seletor
; Original Name..: _LZNTDecompress
; Description ...: Decompresses input data.
; Syntax.........: __Seletor($bBinary)
; Parameters ....: $vInput - Binary data to decompress.
; Return values .: Success - Returns decompressed binary data.
;                         - Sets @error to 0
;                 Failure - Returns empty string and sets @error:
;                 |1 - Error decompressing.
; Author ........: trancexx
; Related .......: _LZNTCompress
; Link ..........; http://msdn.microsoft.com/en-us/library/bb981784.aspx
; ===============================================================================================================================
Func __Seletor($bBinary)
$bBinary = Binary($bBinary)
Local $tInput = DllStructCreate("byte[" & BinaryLen($bBinary) & "]")
DllStructSetData($tInput, 1, $bBinary)
Local $tBuffer = DllStructCreate("byte[" & 16 * DllStructGetSize($tInput) & "]") ; initially oversizing buffer
Local $a_Call = DllCall("ntdll.dll", "int", "RtlDecompressBuffer", _
   "ushort", 2, _
   "ptr", DllStructGetPtr($tBuffer), _
   "dword", DllStructGetSize($tBuffer), _
   "ptr", DllStructGetPtr($tInput), _
   "dword", DllStructGetSize($tInput), _
   "dword*", 0)
If @error Or $a_Call[0] Then
  Return SetError(1, 0, "") ; error decompressing
EndIf
Local $tOutput = DllStructCreate("byte[" & $a_Call[6] & "]", DllStructGetPtr($tBuffer))
Return SetError(0, 0, DllStructGetData($tOutput, 1))
EndFunc   ;==>__Seletor

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0