Leaderboard
Popular Content
Showing content with the highest reputation on 08/26/2013 in all areas
-
Search the forum for CoInternetSetFeatureEnabled or mybe even _SilentClick. Both should get you to the right direction.1 point
-
Guictrlcreate date with MM/DD/YYYY HH:MM:SS AM/PM
Alexxander reacted to water for a topic
Set $style according to this.1 point -
If I understand you right, you are really asking about nesting your IF statements. FireFox gave you one example of this, in the latter part of his code. We perhaps need to see more of your code to give exact help for that? Is that what you are asking, where you need multiple queries to match? You can also use AND or OR to string more than one IF query together in a continuous line, but I don't think that is what you are asking.1 point
-
bvr, And how useful do you think that function code will be given that the problem only appears after you have closed that GUI? You will need to post more code than that if you want help. Better still, reduce the code to create a small reproducer scrip to illustrate the problem - you often find the answer yourself at that point. But I would hazard a guess that you have a control in the main GUI ($Button1/2 perhaps?) whose ControlID is stored in a variable using the same name as one in the secondary - which you will have overwritten when creating the secondary and so which no longer refers to the same control once the secondary has been deleted. But that is just a guess - until we see more code we are just whistling in the dark. M231 point
-
What Command3r said!1 point
-
He is developer now, lol the post from 2010 !!1 point
-
you can do like mlipok told you. Here an Example for Switch method $msg = MsgBox(2, "", "Select anything") Switch $msg Case 3 MsgBox(0, "", "You pressed Abort") Case 4 MsgBox(0, "", "You pressed Retry") Case 5 MsgBox(0, "", "You pressed Ignore") EndSwitch and for IF method $msg = MsgBox(2, "", "Select anything") If $msg = 3 Then MsgBox(0,"", "You pressed Abort") ElseIf $msg = 4 Then MsgBox(0,"", "You pressed Retry") ElseIf $msg Then MsgBox(0,"", "You pressed Ignore") EndIf do what's better for u, i don't really know whats diffirence hope this what you're looking for If $msgcom = 1 then ; if pressed OK then sleep($time) ; wait the time you want shutdown(32) ; shutdown after waiting ElseIf $msgcom = 2 ; if pressed cancel then msgbox(0, "", "standby is canceled") ; appear the msgbox Endif ; closing the If statement EDIT: add IF method EDIT2: your script1 point
-
@fikri1979 I would like to apologize for the tone of my first reply, I was a in bad mood. I didn't mean to attack you of course; see ya on the forum Br, FireFox.1 point
-
FF - Problem with clicking <a> element with 'onclick' tag
linoskoczek reacted to Danp2 for a topic
Instead of using _FFClick, try the following: _FFCmd("FFau3.xpath.onclick()")1 point -
_IsUPX() - Checks if a supported file is UPX'd.
codewar509 reacted to guinness for a topic
Two very quick Functions I came up with in 5 minutes to check if a file has been upx'ed. This is accomplished by reading the file or using the parameter "-t" and upx.exe. Any problems, suggestions then post below. Thanks. Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _IsUPX ; Description ...: Checks if a supported file is UPX'd. ; Syntax ........: _IsUPX($sFilePath[, $sUPX = 'upx.exe']) ; Parameters ....: $sFilePath - File path of the file to check, this must be supported by UPX. ; Return values .: Success - 1 or 0 if the file is UPX'd ; Failure - None ; Author ........: guinness & MrCreatoR ; Example .......: No ; =============================================================================================================================== Func _IsUPX($sFilePath) Local Const $bStart_Address = 0x001F0, $iUPX_Header_Length = 30 Local $hFileOpen = FileOpen($sFilePath, 0) If $hFileOpen = -1 Then Return SetError(1, 0, -1) EndIf FileSetPos($hFileOpen, $bStart_Address, 0) Local $sData = FileRead($hFileOpen, $iUPX_Header_Length) FileClose($hFileOpen) Return Number(StringInStr($sData, 'UPX') > 0) EndFunc ;==>_IsUPXFunction with UPX required: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _IsUPX ; Description ...: Checks if a supported file is UPX'd. ; Syntax ........: _IsUPX($sFilePath[, $sUPX = 'upx.exe']) ; Parameters ....: $sFilePath - File path of the file to check, this must be supported by UPX. ; $sDirectory - [optional] Location of the UPX executable. Default is @ScriptDir. ; Return values .: Success - 1 or 0 if the file is UPX'd ; Failure - -1 and sets @error to non-zero. ; Author ........: guinness ; Remarks .......: Constants.au3 should be included. ; Example .......: No ; =============================================================================================================================== Func _IsUPX($sFilePath, $sDirectory = @ScriptDir) $sDirectory = StringRegExpReplace($sDirectory, '[/]+$', '') If FileExists($sDirectory & 'upx.exe') = 0 Then Return SetError(1, 0, -1) EndIf Local $iPID = Run('"' & $sDirectory & 'upx.exe' & '" -t "' & $sFilePath & '"', @ScriptDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD), $sOutput = '' While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop EndIf WEnd Local $aReturn = StringRegExp($sOutput, '(?is)testing ' & StringRegExpReplace($sFilePath, "^.*", "") & ' (.*?)' & @CRLF, 3) If @error Then Return 0 EndIf Return Number($aReturn[0] = '[OK]') EndFunc ;==>_IsUPX Updated: Thanks to Mobius for spurring me on & MrCreatoR for the Examples & improvement to the UPX Function that doesn't require UPX. Updated:1 point -
_IsUPX() - Checks if a supported file is UPX'd.
codewar509 reacted to Mobius for a topic
Hello guinness, A better structured example of upx detection. #Region Example $_ = FileOpenDialog("",@scriptdir,"Binary (*.exe;*.dll)") IF @error THEN EXIT $iRet = _IsUPX($_) If @error Then MsgBox(16,@scriptname,"_IsUPX Error "& @error) Elseif $iRet Then MsgBox(64,@scriptname,"Upx packing detected in:"& @lf & $_) Else MsgBox(48,@scriptname,"Upx packing not detected in:"& @lf & $_) Endif #Endregion ; #cs _IsUPX bloaty but accurate structured example function. Focuses on the first bytes of the .code entrypoint for upx instead of checking section names and evidence of the upx version signature which are too easily modified to be used effectively. The main section table loop at the tail of the function is the meat of the operation and could easily be modified to check the section names and to more accurately calculate the correct instance of the .code section if you wanted to. Returns: 0 = Upx not detected, 1 First bytes (upx) detected. Errors :: 1 = Failed to open target file. 2 = MZ bom not found (not executable) 3 = PE signature not found. (non Win32 pe's not supported) #ce ; Func _IsUPX($sFile) Local $hFile = FileOpen($sFile,16) If @error Then ;ConsoleWrite("Failed to open for reading:"& @LF & $sFile & @LF) Return SetError(1) Endif ; Local $Size = FileGetSize($sFile) Local $BinBuff = DllStructCreate("byte["& $Size &"]") DllStructSetData($BinBuff,1,FileRead($hFile)) FileClose($hFile) Local $BBPtr = DllStructGetPtr($BinBuff) ; Storing the pointer again here for later use since the original is recycled. Local $OBBPtr = $BBPtr ; Local Const $IDH_LEN = 64 ; DllStructGetSize($IMAGE_DOS_HEADER) Local Const $INH_LEN = 248 ; DllStructGetSize($IMAGE_NT_HEADERS) Local Const $IFH_LEN = 20 ; DllStructGetSize($IMAGE_FILE_HEADER) Local Const $IOH_LEN = 224 ; DllStructGetSize($IMAGE_OPT_HEADER) Local Const $ISH_LEN = 40 ; DllStructGetSize($IMAGE_SECTION_HEADER) ; Local $IMAGE_DOS_HEADER = DllStructCreate( _ "WORD e_magic;WORD e_cblp;WORD e_cp;WORD e_crlc;WORD e_cparhdr;WORD e_minalloc;WORD e_maxalloc;"& _ "WORD e_ss;WORD e_sp;WORD e_csum;WORD e_ip;WORD e_cs;WORD e_lfarlc;WORD e_ovno;"& _ "WORD e_res[4];WORD e_oemid;WORD e_oeminfo;WORD e_res2[10];WORD e_lfanew",$BBPtr) ; If Not DllStructGetData($IMAGE_DOS_HEADER,"e_magic") = 23177 Then ;ConsoleWrite("MZ executable bom not found!"& @LF) Return SetError(2) Endif ; Rotate the pointer to offset specified landing at image nt header. $BBPtr += DllStructGetData($IMAGE_DOS_HEADER,"e_lfanew") ; Local $IMAGE_NT_HEADERS = DllStructCreate( _ "DWORD signature;CHAR ifh["& $IFH_LEN &"];CHAR ioh["& $IOH_LEN &"]",$BBPtr) ; If Not DllStructGetData($IMAGE_NT_HEADERS,"signature") = 17744 Then ;ConsoleWrite("PE signature not found!"& @LF) Return SetError(3) Endif ; Local $IMAGE_FILE_HEADER = DllStructCreate( _ "WORD machine;WORD numberofsections;DWORD timedatestamp;DWORD pointertosymboltable;DWORD numberofsymbols;"& _ "WORD SizeOfOptionalHeader;WORD characteristics",DllStructGetPtr($IMAGE_NT_HEADERS,"ifh")) ; Local $IMAGE_OPT_HEADER = DllStructCreate( _ "WORD magic;BYTE majorlinkerversion;BYTE minorlinkerversion;DWORD sizeofcode;DWORD sizeofinitializeddata;"& _ "DWORD sizeofuninitializeddata;DWORD addressofentrypoint;DWORD baseofcode;DWORD baseofdata;DWORD imagebase;"& _ "DWORD sectionalignment;DWORD filealignment;WORD majoroperatingsystemversion;WORD minoroperatingsystemversion;"& _ "WORD majorimageversion;WORD minorimageversion;WORD majoresubsystemversion;WORD minorsubsystemversion;"& _ "DWORD win32versionvalue;DWORD sizeofimage;DWORD sizeofheaders;DWORD checksum;WORD subsystem;WORD dllcharacteristics;"& _ "DWORD sizeofstackreserve;DWORD sizeofstackcommit;DWORD sizeofheapcommit;DWORD loaderflags;DWORD numberofrvaandsizes;"& _ "DOUBLE datadirectory[16]",DllStructGetPtr($IMAGE_NT_HEADERS,"ioh")) ; Rotate pointer to first section in the table $BBPtr += $INH_LEN ; Loop through the section tables For $i = 1 To DllStructGetData($IMAGE_FILE_HEADER,"numberofsections") Local $IMAGE_SECTION_HEADER = DllStructCreate( _ "CHAR name[8];DWORD virtualsize;DWORD virtualaddress;DWORD sizeofrawdata;DWORD pointertorawdata;DWORD pointertorelocations;"& _ "DWORD pointertolinenumbers;WORD numberofrelocations;WORD numberoflinenumbers;DWORD characteristics",$BBPtr) ; The purpose of this chunk of code is simply to convert the relative virtual address into a file offset, ; So that we can check this offset for the upx first byte sequence '60BE' of the .code (UPX1) section. Local $RVA_TO_FILE_OFFSET = DllStructGetData($IMAGE_SECTION_HEADER,"pointertorawdata") + DllStructGetData($IMAGE_OPT_HEADER,"addressofentrypoint") - DllStructGetData($IMAGE_SECTION_HEADER,"virtualaddress") If $RVA_TO_FILE_OFFSET > 0 And $RVA_TO_FILE_OFFSET < $Size Then Local $FIRSTBYTES = DllStructCreate("WORD fb",$OBBPtr + $RVA_TO_FILE_OFFSET) If DllStructGetData($FIRSTBYTES,"fb") = 48736 Then ;ConsoleWrite("Upx first bytes detected in section: "& DllStructGetData($IMAGE_SECTION_HEADER,"name") & @LF) Return 1 Endif Endif ; Rotate the pointer plus the static section table element length $BBPtr += $ISH_LEN Next EndFunc Want a version without all those Au3 structures? go Vlad1 point