Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/24/2014 in all areas

  1. There was a thread in general support forum the other day about possibility of compiled executable to verify binary integrity of itself when run. I can't find the topic now to link it, but meh never mind. Logical solution is to calculate checksum of the exe and save it somewhere. Later when the executable is run the checksum is calculated again and compared to the saved value. If they match, all is ok, and if they don't the exe was altered and verification fails. The obvious problem is how and where to store the hash value. Alternate data stream seems the simplest solution. That way the hash is bound to the exe only and the risks of unwanted manipulations are relatively low. The problem could be if the exe is saved and run from non-NTFS file systems. Another problem is that any read/write action on exe file usually ends up with ADS being deleted. The other solution is registry writing, but that bounds exe and hash to the system. For another system (or even user) the checking wouldn't be valid. Third solution is using some sort of ini file. But that means ini has to go everywhere exe goes, otherwise again the check wouldn't make sense. And it would be too simple for someone to manipulate data, to the level the check wouldn't make sense. So, this is kind of fourth option. CheckSumVerify2.a3x script below is include file that will calculate the hash of the executable on the first run, save it directly inside that executable using special technique and recheck the hash on every new run. If the new hash wouldn't match the saved one, the script will show message box saying that and further execution will be aborted. CheckSumVerify2.a3x Just to say that I haven't done any complicated tests to see if it would work in outer space, or even on all supported systems. However my guess is it should work. Don't UPX the compiled executables, because I'm calculating checksum of the image on disk and not the one in memory. Here's small example of usage: #include "CheckSumVerify2.a3x" If @Compiled Then MsgBox(64 + 262144, "Aha!", "This is an example exe that does nothing except showing this message." & @CRLF & @CRLF & _ "But if you change the binary of me I will show error message and won't allow further execution." & @CRLF & _ $cmdlineraw) Else MsgBox(64 + 262144, "Hey", "This is an example script that does nothing except showing this message." & @CRLF & @CRLF & _ "But if you compile me I will check binary integrity of the compiled executable every time its run.") EndIf If something wouldn't work, or if you have any questions - simply post here. I'll do my best to answer.
    1 point
  2. LarsJ

    ListView color hover item

    Here are the ideas for a solution based on custom drawn items: #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> $hGUI = GUICreate("Hover Test", 323, 184, 208, 168) $cInput = GUICtrlCreateInput("", 8, 24, 305, 21) $cListView = GUICtrlCreateListView("ListView", 8, 45, 305, 129) $hListView = GUICtrlGetHandle($cListView) GUICtrlSendMsg(-1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_ONECLICKACTIVATE, $LVS_EX_TRACKSELECT) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState(@SW_SHOW) For $i = 0 To 10 GUICtrlCreateListViewItem("TEST_" & $i, $cListView) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local Static $iHot = -1, $iHotPrev = -1 Local $hWndFrom, $iCode, $tNMHDR, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $LVN_HOTTRACK ; Sent when the user moves the mouse over an item $tInfo = DllStructCreate($tagNMLISTVIEW, $ilParam) $iHot = DllStructGetData($tInfo, "Item") If $iHot <> $iHotPrev Then ;ConsoleWrite($iHot & @LF) If $iHot <> -1 Then _GUICtrlListView_RedrawItems( $hListView, $iHot, $iHot ) If $iHotPrev <> -1 Then _GUICtrlListView_RedrawItems( $hListView, $iHotPrev, $iHotPrev ) If $iHot <> $iHotPrev And $iHot <> -1 Then $iHotPrev = $iHot EndIf Case $NM_CUSTOMDRAW Local $tNMLVCUSTOMDRAW = DllStructCreate( $tagNMLVCUSTOMDRAW, $ilParam ) Local $dwDrawStage = DllStructGetData( $tNMLVCUSTOMDRAW, "dwDrawStage" ) Switch $dwDrawStage ; Holds a value that specifies the drawing stage Case $CDDS_PREPAINT ; Before the paint cycle begins Return $CDRF_NOTIFYITEMDRAW ; Notify the parent window of any ITEM-related drawing operations Case $CDDS_ITEMPREPAINT ; Before painting an item Return $CDRF_NOTIFYSUBITEMDRAW ; Notify the parent window of any SUBITEM-related drawing operations Case BitOR( $CDDS_ITEMPREPAINT, $CDDS_SUBITEM ) ; Before painting a subitem Local $dwItemSpec = DllStructGetData( $tNMLVCUSTOMDRAW, "dwItemSpec" ) ; Item index ;Local $iSubItem = DllStructGetData( $tNMLVCUSTOMDRAW, "iSubItem" ) ; Subitem index ;Local $uItemState = DllStructGetData( $tNMLVCUSTOMDRAW, "uItemState" ) ; Item state If $dwItemSpec = $iHot Then ; Hot row DllStructSetData( $tNMLVCUSTOMDRAW, "ClrText", 0x000000 ) DllStructSetData( $tNMLVCUSTOMDRAW, "ClrTextBk", 0x00FF00 ) Else ; Other rows DllStructSetData( $tNMLVCUSTOMDRAW, "ClrText", 0x000000 ) DllStructSetData( $tNMLVCUSTOMDRAW, "ClrTextBk", 0xFFFFFF ) EndIf Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY It's not a complete solution.
    1 point
  3. Danp2

    FF.au3 (V0.6.0.1b-10)

    Yes... See >this post from earlier in this same thread.
    1 point
  4. As mentioned above there is a bug in this section. Try this: If $ENABLE Then _SendMessage($hWnd, 0x00F7, 0, $aButtons[1][0]) $CtrlhWnd_Array[$i][1] = $aButtons[1][0] $CtrlhWnd_Array[$i][2] = $aButtons[1][1] $CtrlhWnd_Array[$i][3] = $aButtons[1][1] $aStates[$i] = 1 Else _SendMessage($hWnd, 0x00F7, 0, $aButtons[0][0]) $CtrlhWnd_Array[$i][1] = $aButtons[0][0] $CtrlhWnd_Array[$i][2] = $aButtons[0][1] $CtrlhWnd_Array[$i][3] = $aButtons[0][1] $aStates[$i] = 0 EndIf Br, UEZ
    1 point
×
×
  • Create New...