Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/04/2021 in all areas

  1. Since this thread is getting long, I thought I'd copy all the relevant information to the 1st post. Three different types of DPI Aware'ness are made available from Microsoft. 1. System Aware (introduced with Windows Vista) 2. Per Monitor Aware (Introduced with Windows 8.1) 3. Per Monitor Aware V2 (Introduced with Windows 10 1703) Method #1 - Programmatically - Only available for Windows 8.1 and 10 ; For values available to Windows 10 users - https://docs.microsoft.com/en-gb/windows/win32/hidpi/dpi-awareness-context If @OSVersion = 'WIN_10' Then DllCall("User32.dll", "bool", "SetProcessDpiAwarenessContext" , "HWND", "DPI_AWARENESS_CONTEXT" -2) If @OSVersion = 'WIN_81' Then DllCall("User32.dll", "bool", "SetProcessDPIAware") ; *** Microsoft warns that these entries need to be executed before the GUI is created *** ;This is the only reason they recommend using the Manifest method over the programmatic method When using the above code, Windows 10 and 8.1 will recognize your compiled app as DPI System Aware. Method #2 - using Manifest entries - Available for all Windows starting with Vista, up to current and future releases of Windows. Using #AutoIt3Wrapper_Res_HiDpi=Y will set your compiled app as DPI System Aware (Win Vista, 7, 8.1, 10). For Windows 8.1, using the Manifest method is the only way to have Per Monitor Aware. Follow this link to learn how to create Per Monitor Aware and Per Monitor Aware V2 apps for Windows 10. Learn how here *** This is the Microsoft recommended method of creating a DPI Aware application *** *** If you choose either method above, you will still need to deal with the GUI itself and all of its Controls. *** Being DPI Aware only deals with text. The simplest method to achieve this is to adapt the code below into your script. Global $iScale = RegRead("HKCU\Control Panel\Desktop\WindowMetrics", "AppliedDPI") / 96 GUICreate("DPI test", 200 * $iScale, 100 * $iScale) GUICtrlCreateButton("Ima Button", 35 * $iScale, 115 * $iScale, 55 * $iScale, 21 * $iScale) ; For reference, I have a single App with 579 occurances of $iScale ; Also know; I've had to make some small x,y adjustments to keep the GUI looking good but nothing drastic. ; Be sure to test your compiled app at 125% and at 200%. This is how I found small descrepancies requiring x,y adjustments. more importantly, this registry value can be had, programmatically and in my opinion, more efficiently With 4k monitors becoming a norm, this should set you well on your way to creating a DPI Aware applications that looks good on any system.
    1 point
  2. susserj

    Plink Wrapper

    Hi I have written "plink_wrapper.au3" UDF to assist utilizing the command line terminal emulation program know as "plink". For more information about plink and putty see "http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html". The plink_wrapper.au3 UDF contains a few basic functions: _Start_plink($_plink_loc,$_plinkserver); is used to start your terminal session _Plink_close(); is used to close the session _Init_plink_log($_plink_logfile); used to create a log file of the information sent to the screen _Expect($match_text); wait's for text to appear on screen before continuing _Expector($match_text1, $say1, $match_text2, $say2, $match_text3, $say3); performs one of three tasks based on information on screen _Expectlog($match_text); logs text for an individual Expect command; used when main logging is turned off _Say($output); Sends text to screen input _SayPlus($output); Sends text to screen input and a carrage return _Plink_close_logfile($_plink_logfile_handle); closes the log file _Collect_stdout($time); collect _stdout stream for designated period of time _ExpectTimed($match_text,$time); waits for specified time to check for string value in terminal output stream General Comments - This code has been in use for a few months and is not very sophisticated. - When entering your userid and password strings add an extra space at the end. - Finding a valid string to wait for can be tricky. I suggest using putty to record your sessions to find such strings. - New Function _Collect_stdout($time) added 7/10/2011 - New Function _ExpectTimed($match_text, $time) added 7/12/2011 #include-Once ; ==================================================================================================================================== ; Title....................: plink_wrapper ; AutoIt Version...........: 3.3.6.1 ; Language.................: English ; Description..............: UDF Functions to Control "plink.exe" allowing intelligent response to text displayed in terminal sessions ; Author...................: Joel Susser (susserj) ; Last Modified............: 07/12/2011 ; Status:..................: In Production ; Testing Workstation......; WinXP sp3, win7 32bit (It likely works with other versions of Windows but I cannot confirm this right now ) ; Tested Version of Autoit.; Autoit 3.3.6.1 ; What is plink? ;plink is a command line terminal emulation program similar to putty that allows rudimentary scripting. ;Requirements ; Autoit 3.3.6.X ; putty.exe, plink.exe. You can acquire these programs at "http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html". ; Hints ; If you are using the ssh protocol I suggest you connect to your server first ; with putty before you use plink for the first time so that you will not ; be disrupted by the authentication certificate requests. ; When entering your userid and password variables I suggest that you add an ; additional space at the end of these strings. I'm not sure why but if you don't it will likely ; cut off the last letters of your userid and password. ; Figuring out what screen information to wait for before continuing the data input stream ; can sometimes be difficult. I suggest using the putty logging feature to record the text that appears on each screen. ; I beleive it is advisable to do so in small chunks. ; Also, choose strings to recognize that are unique and at the end of the putty screen capture logging sessions ; for each screen. Avoid terminal escape coding. ; ================================================================================================================================ #comments-start Changelog: 6-09-2011 changed example script to use equivalent path with spaces 7-09-2011 added function _Collect_stdout and modified example script 7-12-2011 added function _ExpectTimed and modified example script #comments-end ;#Current List of Functions======================================================================================================= ;_Start_plink($_plink_loc,$_plinkserver) ;_Plink_close() ;_Init_plink_log($_plink_logfile) ;_Expect($match_text) ;_Expector($match_text1, $say1, $match_text2, $say2, $match_text3, $say3) ;_Expectlog($match_text) ;_Say($output) ;_SayPlus($output) ;_Plink_close_logfile($_plink_logfile_handle) ;_Collect_stdout($time) ;_ExpectTimed($match_text, $_plink_timeout) ; =============================================================================================================================== ; #VARIABLES# ==================================================================================================================== global $_plinkhandle="" ; used to handle starting of plink global $_plinkserver="" ; name of server you wish to connect to global $_plink_loc ="" ; location of plink.exe executable on workstation global $_plink_display_messages=false ; display interim messages to screen (default false) global $_plink_display_message_time=1 ; time in seconds messages are displayed global $_plink_logging=false ; record plink log file (default false) global $_plink_logfile="" ; location of plink log file global $_plink_logfile_handle="" ; plink log file handle ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Plink_close ; Description ...: closes plink.exe process ; Author ........: Joel Susser (susserj) ; Syntax.........: $_Plink_close() ; Parameters ....: none required ; example .......: _Plink_close() ; ; Remarks .......: plink.exe should only be running once ; =============================================================================================================================== func _Plink_close() ;If there are any stray plink sessions kill them if ProcessExists("plink.exe") then ProcessClose("plink.exe") Else return false endif EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Start_plink ; Description ...: open a new plink.exe terminal session ; Author ........: Joel Susser (susserj) ; Syntax.........: $_plinkhandle=_Start_plink($_plink_loc, $_plinkserver) ; Parameters ....: $_plink_loc is the location of the plink.exe ececutable on you workstation ; Parameters ....: $_plinkserver is the location of the server you wish to access ; Example........: $_plinkhandle = _Start_plink("c:/putty/plink.exe", "testserver.com") ; Return values .: $plinkhandle, pid of cmd processor ; Remarks........; Currently configured to use ssh protocol ; Remarks .......: Needs to be made more robust ; =============================================================================================================================== ;start the plink session func _Start_plink($_plink_loc,$_plinkserver) _Plink_close(); close any stray plink sessions before starting if $_plink_loc = "" then MsgBox(0, "Error", "Unable to open plink.exe",10) return false Exit endif if $_plinkserver = "" then MsgBox(0, "Error", "Unable to open server",10) Exit return false endif $_plinkhandle = Run(@comspec & " /c" & $_plink_loc & " -ssh " & $_plinkserver,"",@SW_HIDE,7) return $_plinkhandle endFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Init_plink_log ; Description ...: open a new file handle for saving a log file recording your plink terminal session ; Syntax.........: _Init_plink_log($_plink_logfile) ; Parameters ....: $_plink_logfile is the location of the log file ; Example........: _Init_plink_log("c:/putty/plink.log") ; Author ........: Joel Susser (susserj) ; Remarks .......: If the file exists it will be ovewritten (2) ; Remarks........: Initializing the log file does not mean logging gets turned on. ; remarks........; Logging gets turned on with the flag $_plink_logging=true. The default is false ; Remarks........; Sometimes the log files get too long and you just want to log a small section of code see $_Expectlog() ; Remarks........; ; =============================================================================================================================== ;Initialize plink session log file func _Init_plink_log($_plink_logfile) $_plink_logfile_handle = FileOpen($_plink_logfile, 2) ; Check if file opened for writing OK If $_plink_logfile_handle = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf return true endfunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Expect ; Description ...: Pause until expected text is displayed on output stream of terminal ; Syntax.........: _Expect("text string") ; Parameters ....: one parameter containing a text string. ; Example........: _Expect("Password:") ; Author ........: Joel Susser (susserj) ; Remarks .......: If the flag $_plink_logging is set to true then it will record all the data sent to the output screen ; Remarks........: while it is waiting for the required text to appear. If it runs to long and doesn't find the text this ; remarks........; file can get very big so be careful. ; Remarks........; If the flag $plink_display_message is set to true then it will popup a messages showing you that the text is found. ; Remarks........; I usaully leave the $_plink_display_messages flag on but reduce the time display to 1 second. However, during ; Remards........; development I usually bump it up to 5 seconds. ; =============================================================================================================================== func _Expect($match_text) local $text local $found While 1 $text = StdoutRead($_plinkhandle) if $_plink_logging Then filewriteline($_plink_logfile_handle,"**********************NEW SECTION************************") filewrite($_plink_logfile_handle,$match_text) filewrite($_plink_logfile_handle,$text) filewriteline($_plink_logfile_handle,"**********************END SECTION************************") endif $found = StringRegExp($text,$match_text) If $found = 1 Then If $_plink_display_messages Then MsgBox(4096, $match_text, $text, $_plink_display_message_time) ExitLoop endif sleep(100) Wend EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Expector ; Description ...: Depending on the text that is found in the input stream, perform one of three different tasks ; Syntax.........: _Expector($match_text1, $say1, $match_text2, $say2, $match_text3, $say3) ; Parameters ....: If string in $match_text1 is found then sent the text in $say1 input string ; Parameters ....: If string in $match_text2 is found then sent the text in $say2 input string ; Parameters ....: If string in $match_text3 is found then give the user a popup message and exit script ; Author ........: Joel Susser (susserj) ; Remarks .......: ; Example........: _Expector("Press <Space Bar> to continue", " ", "Do you wish to continue", "y" "Error no data found", "Script shutting down") ; Remarks .......: ; Remarks........: I'm not fully satified with this function. It requires exactly 6 parameters. It should be more fexable to handle ; remarks........; a variable number of parameters. ; Remarks........; Also, it should perhaps have some error handling to check that the parameters it receives are correct. ; Remarks........; Right now when I only need only two choices, not three choices I put dummy data in my second pair of data variables ; Remards........; ; =============================================================================================================================== func _Expector($match_text1, $say1, $match_text2, $say2, $match_text3, $say3) local $text While 1 $text = StdoutRead($_plinkhandle) if $_plink_logging then filewrite($_plink_logfile_handle,"**********************NEW SECTION************************") filewrite($_plink_logfile_handle,"Expector") filewrite($_plink_logfile_handle,$text) filewrite($_plink_logfile_handle,"**********************END SECTION************************") endif If $_plink_display_messages Then MsgBox(4096, $match_text1 & $match_text2, $text, $_plink_display_message_time) sleep(5000) If StringRegExp($text,$match_text3) then MsgBox(4096, "System Error", $say3, 6) ProcessClose("plink.exe") FileClose($_plink_logfile) exit; close program endif If StringRegExp($text,$match_text2) then _Say($say2) ExitLoop Endif If StringRegExp($text,$match_text1) then _Say($say1) ExitLoop Endif sleep(100) Wend EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Expectlog ; Description ...: Similar to _Expect but if forces a logging of the data for a particular search patern in the input stream ; Description ...: Pause until text is displayed on output stream of terminal ; Syntax.........: _Expectlog("text string") ; Parameters ....: one parameter containing a text string. ; Example........: _Epector("Password:") ; Author ........: Joel Susser (susserj) ; Remarks .......: ; Remarks........: As I indicated previously, the log files can get very big. ; remarks........; This function allows targeted logging related to a specific area of your script. ; Remarks........; It is primarily used for debugging. After your script is functional, you will likely convert your _Expectlog ; Remarks........; function calls to _Expect. ; Remards........; ; =============================================================================================================================== func _Expectlog($match_text) local $text local $found While 1 $text = StdoutRead($_plinkhandle) filewrite($_plink_logfile_handle,"**********************" & $match_text & "************************" ) filewrite($_plink_logfile_handle,$match_text) filewrite($_plink_logfile_handle,$text) $found = StringRegExp($text,$match_text) If $found = 1 Then MsgBox(4096, $match_text, $text, 10) ExitLoop endif sleep(100) Wend EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Say ; Description ...: Send the following text string to the input stream of the terminal session ; Syntax.........: _Say("text") ; Parameters ....: Function takes on parameter which contains the text to sent to the input stream. ; Example........: _Say("y") ; Author ........: Joel Susser (susserj) ; Remarks .......: Don't try and say to much at once. Wait for the screen to appear with the prompt for information ; Remards........; This say does not perform a carrage return. If you need a carrage return use _SayPlus ; =============================================================================================================================== ; Say Function func _Say($output) StdinWrite($_plinkhandle, $output) endfunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _SayPlus ; Description ...: Send the following text string to the input stream of the terminal session ; Syntax.........: _SayPlus("text") ; Parameters ....: Function takes on parameter which contains the text to sent to the input stream. ; Example........: _SayPlus("y") ; Author ........: Joel Susser (susserj) ; Remarks .......: Don't try and say to much at once. Wait for the screen to appear with the prompt for information ; Remards........; This type of say performs a carrage return. If you don't need a carrage return use _Say() ; =============================================================================================================================== func _SayPlus($output) StdinWrite($_plinkhandle, $output & @CR) endfunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Plink_close_logfile ; Description ...: close the plink logging file ; Syntax.........: _Plink_close_logfile($_plink_logfile_handle_) ; Parameters ....: $_Plink_close_logfile_handle ; Example........: N/A ; Author ........: Joel Susser (susserj) ; Remarks .......: ; Remards........; ; =============================================================================================================================== ;Close log file func _Plink_close_logfile($_plink_logfile_handle) FileClose($_plink_logfile_handle) endfunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Collect_stdout ; Description ...: Collects text sent to output stream of terminal for specified period of time ; Syntax.........: $variable = _Collect_stdout($time) ; Parameters ....: Function takes one parameter which specifies time(milliseconds) to collect the input buffer. ; Returns........: Returns the contents of stdout collected during specified time interval ; Example........: $output_buffer = $_Collect_stdout(500); 500 is half a second ; Author ........: Joel Susser (susserj) ; ; Remarks........; This function was inspired by comments made by (Phil; justhatched) and jp10558 ; Remarks .......: There are certain situations which can benefit from the ability to collectively parse the stdout stream. ; Remarks........: The potential problem with this approach is that it can sometimes be difficult to predict how long it takes for certain ; remarks........; screens to output their text due to variables such as server load and internet speed etc. ; Remarks........; That being said, with proper testing the time interval can potentially be evaluated for such situations and ; Remarks........; upon potential failure to succeed, the procedure can be repeated. ; Remarks........; See New Sample Script ; ; =============================================================================================================================== Func _Collect_stdout($_plink_timeout) local $text local $sBuffertext local $iBegin = TimerInit() While 1 $text = StdoutRead($_plinkhandle) $sBuffertext = $sBuffertext & $text if $_plink_logging Then filewriteline($_plink_logfile_handle, $text) endif If TimerDiff($iBegin) > $_plink_timeout then ExitLoop endif sleep(100) Wend return $sBuffertext EndFunc ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _ExpectTimed ; Description ...: Searches for a string in the stdout stream which was collected for a specified period of time ; Syntax.........: $variable = _Epect_timed("string", $time) ; Parameters ....: Function takes two parameters. First is string to find, second is period of in time(milliseconds) to collect the input buffer ; Returns........: Returns the contents of stdout collected during specified time interval ; Example........: $output_buffer = $_Expect__timed("Login:", 5000); 5 seconds ; Author ........: Joel Susser (susserj) ; ; Remarks........; This function was inspired by comments made by (Phil; justhatched) and jp10558 ; Remarks .......: There are certain situations which can benefit from the ability to collectively parse the stdout stream. ; Remarks........: The potential problem with this approach is that it can sometimes be difficult to predict how long it takes for certain ; remarks........; screens to output their text due to variables such as server load and internet speed etc. ; Remarks........; That being said, with proper testing the time interval can potentially be evaluated for such situations and ; Remarks........; upon potential failure to succeed, the procedure can be repeated. ; Remarks........; See New Sample Script ; =============================================================================================================================== Func _ExpectTimed($match_text, $_plink_timeout) local $found local $sBuf_text $sBuf_text = _Collect_stdout($_plink_timeout) $found = StringRegExp($sBuf_text, $match_text) If $found Then If $_plink_display_messages Then MsgBox(4096, $match_text, $sBuf_text, $_plink_display_message_time) return $sBuf_text endif EndFunc ; =============================================================================================================================== ; Sample Script Starts Here============================================================================================================= ; #cs #include plink_wrapper.au3 ;Initialize Variables------------------------------------------------------------------------------------------------------------ $username="admin " ; It seems necessary to put an extra space after the login name. The last character is being cut off. $password="admin1 "; It seems necessary to put an extra space after the password. The last characters is being cut off. $_plink_logging=true ; Turn Logging ON (default is off) $_plink_display_messages=true ; Turn Screen Messages ON (default is on) $_plink_display_message_time=5 ; Display message for 5 secs (default 1 sec) ;-------------------------------------------------------------------------------------------------------------------------------- ; Initizations------------------------------------------------------------------------------------------------------------------- $_plinkhandle=_Start_plink("c:\PROGRA~1\1putty\plink.exe","hostname.com"); Initialized plink connection to server _Init_plink_log("c:\PROGRA~1\putty\plink.log"); Initialize log file. Required even it not being used ;(Special Notes for Windows 7. If you are puttying plink, putty, and plink.log in a subdirectory of "c:\Program Files\" make sure ; you give your user account sufficient rights. Otherwises it may fail to run properly. ; To find the short file name, navigate to directory with cmd console, then type "command". This will show you the short name) ; ------------------------------------------------------------------------------------------------------------------------------- ; Terminal Emulation Session Interaction _Expect("login as:") _SayPlus($username) _Expect("Password:") _SayPlus($password) _Expect("hostname >") _SayPlus("ls") _Expect("hostname >") ;--------Sample Coding to illustrate using _Collect_stdout function----------------- _SayPlus("vncserver") $buf_collect = _Collect_stdout(5000); (5 sec) If StringInStr($buf_collect, "computer:0",1) then ;some function ElseIf StringInStr($buf_collect, "computer:1",1) then ; some function ElseIf StringInStr($buf_collect, "computer:2",1) then ; some function Elseif ... Else MsgBox(0,"Error", "Unable to find required string") Endif ;---------------------------------------------------------------------------------- ;--------Sample Coding to illustrate using _ExpectTimed function ----------------- ; Terminal Emulation Session Interaction $buf_collect = _ExpectTimed("login as:", 1000) if not $buf_collect then MsgBox(4096, "error", "unable to log into server", $_plink_display_message_time) exit Endif _SayPlus($username) _ExpectTimed("Password:", 1000) _SayPlus($password) _ExpectTimed("hostname >", 1000) _SayPlus("ls") _ExpectTimed("hostname >", 1000) ;---------------------------------------------------------------------------------- _SayPlus("exit") ;SHUTDOWN----------------------------------------------------------------------------------------------------------------------- _Plink_close(); shutdown plink session _Plink_close_logfile($_plink_logfile_handle);shutdown log file ; ------------------------------------------------------------------------------------------------------------------------------ #ce If you have any questions or comments please let me know. Thanks
    1 point
  3. For some reason the existing example is no longer running correctly for me. Have you tried to use the UDF?
    1 point
  4. It would be nice if you could share your newfound knowledge with others .
    1 point
  5. I definitely got that aspect of if. If you look at what i posted the controls are looped through and sent to the function ahead of time, It completely eliminates the need to use eval or whatever. In your above example you acknowledge the fact that $label and $combobox should be in there somewhere but those variables are never used. Just send the variable as a parameter and problem solved. I'm honestly not even sure why functions such as eval even exist bc in a situation like this its just giving you a crutch and a way to do things in a very unconventional way. I realize not everyone can be the master of everything right away but this is just the beginning of a bad habit. Arrays are what they are for this exact reason, to shuffle through a number of related variables in an organized manner. its the only real container type that exists in autoit so you should probably get acquainted. I'll also say based on what you've posted so far your code has no way to know when, if or which hotkeys have been set. My code at least takes care of that. I do have one question tho.... What is the purpose of the label changing?
    1 point
  6. Integrated my snippets inside @Danp2 example to create a more generalized script : #AutoIt3Wrapper_UseX64=y #include "x64_Ops.au3" #include <Constants.au3> Local Const $aType = ["VarInt", "Fixed64", "String", "Start Group", "End Group", "Fixed32"] $sData = "CgNQQ0cVH4UvQRiQvr/a4lsqA05ZUTAIOAFFKBlXQUj61YQeZWhmpj/YAQQ=" ;~ Results from https://protogen.marcgravell.com/decode ;~ Field #1: 0A String Length = 3, Hex = 03, UTF8 = "PCG" ;~ Field #2: 15 Fixed32 Value = 1093633311, Hex = 1F-85-2F-41 ;~ Field #3: 18 Varint Value = 3153232650000, Hex = 90-BE-BF-DA-E2-5B ;~ Field #5: 2A String Length = 3, Hex = 03, UTF8 = "NYQ" ;~ Field #6: 30 Varint Value = 8, Hex = 08 ;~ Field #7: 38 Varint Value = 1, Hex = 01 ;~ Field #8: 45 Fixed32 Value = 1096227112, Hex = 28-19-57-41 ;~ Field #9: 48 Varint Value = 62991098, Hex = FA-D5-84-1E ;~ Field #12: 65 Fixed32 Value = 1067869800, Hex = 68-66-A6-3F ;~ Field #27: D8-01 Varint Value = 4, Hex = 04 $bData = _Base64Decode($sData) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $bData = ' & $bData & @CRLF) ;### Debug Console Local $iPos = 1, $iLen = BinaryLen($bData), $iTag, $sResult, $iResult While $iPos <= $iLen $sResult = VarInt($bData, $iPos, $iTag) $iField = BitShift($iTag, 3) $iWire = BitAND($iTag, 7) ConsoleWrite("Field #" & $iField & ": " & $sResult & " " & $aType[$iWire]) Switch $iWire Case 0 ; VarInt $sResult = VarInt($bData, $iPos, $iResult) ConsoleWrite(" Value = " & $iResult & " Hex = " & $sResult & @CRLF) Case 1 ; Fixed64 $sResult = BinaryMid($bData, $iPos, 8) $iResult = Fixed($sResult) ConsoleWrite(" Value = " & $iResult & " Hex = " & Hex($sResult) & @CRLF) $iPos += 8 Case 2 ; Length-delimited $bLen = BinaryMid($bData, $iPos, 1) $sResult = BinaryToString(BinaryMid($bData, $iPos + 1, $bLen), $SB_UTF8) ConsoleWrite(" (" & Int($bLen) & ") = " & $sResult & @CRLF) $iPos += Number($bLen) + 1 Case 3 ; start group ConsoleWrite(@CRLF) Case 4 ; end group ConsoleWrite(@CRLF) Case 5 ; Fixed32 $sResult = BinaryMid($bData, $iPos, 4) $iResult = Fixed($sResult) ConsoleWrite(" Value = " & $iResult & " Hex = " & Hex($sResult) & @CRLF) $iPos += 4 EndSwitch WEnd Func _Base64Decode($input_string) Local $struct = DllStructCreate("int") $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ "str", $input_string, _ "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 Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _ "str", $input_string, _ "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 Return DllStructGetData($a, 1) EndFunc ;==>_Base64Decode Func VarInt(ByRef Const $bStream, ByRef $iPos, ByRef $iResult) Local $iVal, $iStart = $iPos, $iShift $iResult = 0 While True $iVal = BinaryMid($bStream, $iPos, 1) $iResult += _BitSHIFT64(BitAND($iVal, 0x7F), $iShift) $iShift -= 7 $iPos += 1 If Not BitAND($iVal, 0x80) Then ExitLoop WEnd Return Hex(BinaryMid($bStream, $iStart, $iPos - $iStart)) EndFunc ;==>VarInt Func Fixed($bVal) Local $iLen = BinaryLen($bVal) Local $tStruct = DllStructCreate(($bVal = 4 ? "int" : "int64") & " data") $tStruct.data = $bVal Return $tStruct.data EndFunc
    1 point
  7. I would immediately move to another security researcher. The wording he uses to describe the security issues is extremely unprofessional. I would expect a professional and detailed description of the security problems A score for each issue based on a recognized rating scale Links to the security recommandations he refers to ("Microsoft's security recommendations for the safe loading of DLLs and applications") detailed measures to address these security issues In my opinion this "security check and report" is Schrott. BTW: I work in IT-security, so I know what I'm talking about
    1 point
  8. Thanks! Just in case anyone arrives here from search engine. The solution was: DllCall("User32.dll", "bool", "SetProcessDPIAware")
    1 point
  9. maybe your answer is found here https://www.autoitscript.com/forum/topic/199786-making-your-compiled-application-dpi-aware/
    1 point
  10. @Jos Another update after much more testing. When you use #AutoIt3Wrapper_Res_HiDpi= (Y, N, P) Y = True (System Aware) N = Not Aware P = Per Monitor Aware and auto-selects the best one for the end user; such as PerMonitorV2 on later Windows 10 systems.
    1 point
  11. possible Manifest entries <!--System Aware The 1st step in evolution, To be System Aware (Introduced in Windows 7, works on 8 and 10)--> <asmv3:application> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <dpiAware>true</dpiAware> </asmv3:windowsSettings> </asmv3:application> <!--Per Monitor Aware (The 2nd step in evolution) Introduced with Windows 8.1 and works on 7 as System Aware, and on 8 and 10 as Per monitor Aware--> <asmv3:application> <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings"> <dpiAware>true/PM</dpiAware> </asmv3:windowsSettings> </asmv3:application> <!--Windows 10 only. Per Monotor Aware Version 2 (The 3rd step in evolution)--> <asmv3:application> <asmv3:windowsSettings xmlns="https://schemas.microsoft.com/SMI/2016/WindowsSettings"> <dpiAwareness>PerMonitorV2</dpiAwareness> </asmv3:windowsSettings> </asmv3:application> <!--Something I've only seen from EUZ. He seems pretty smart though, so I'm going to include it--> <asmv3:application> <asmv3:windowsSettings xmlns="https://schemas.microsoft.com/SMI/2017/WindowsSettings"> <gdiScaling>true</gdiScaling> </asmv3:windowsSettings> </asmv3:application>
    1 point
  12. Hi, There have been far too many occasions recently where the Mod team have been trying to determine whether a particular thread is legal and a member has posted offering help to the OP. If the Mods are concerned about a thread, please refrain from posting within it - and certainly do not offer anything at all useful - until the all-clear has been given. After this announcement has been posted, we will regard any future instances as unfriendly acts and the poster can expect to be sanctioned - you have been warned. M23
    1 point
×
×
  • Create New...