Jump to content

Does anyone see anything wrong with this code?


Recommended Posts

Ya, I made this about a 7 months ago and haven't touched auto it since. I know this compiled then, and I'm 80% sure I never changed anything. Can anyone see any mistakes?

#include <GuiConstants.au3>
#include <InjectDLL.au3>
$Main = GUICreate("DLL Injector", 300, 100,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$InpWin = IniRead("DLLInjector.ini","Main","WindowName","Window Name")
$InpDll = IniRead("DLLInjector.ini","Main","DLL","DLL To Inject")

$Browse = GuiCtrlCreateButton("Browse", 230, 15, 60, 20)
$WinList = GuiCtrlCreateButton("WinList", 230, 50, 60, 20)
$Checkbox = GuiCtrlCreateCheckbox("Save Settings?", 10, 70, 90, 30)
;$Save = GuiCtrlCreateButton("Save Settings", 10, 70, 90, 30)
$InputDLL = GuiCtrlCreateInput($InpDLL, 10, 15, 150, 20)
$InputWindow = GuiCtrlCreateInput($InpWin, 10, 50, 150, 20)
$Quit = GuiCtrlCreateButton("Quit", 170, 15, 60, 20)
$Inject = GuiCtrlCreateButton("Inject", 170, 50, 60, 20)

GUICtrlCreateLabel("O_o Injector O_o", 140, 80, 100, 17);
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma");




ActGUI()




Func ActGUI()
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        Quit()
    Case $Quit
        Quit()
    Case $Browse
        $dllloc = FileOpenDialog("DLL to Inject",@DesktopDir,"DLL files (*.dll)",1)
        GUICtrlSetData($InputDLL,$dllloc)
    Case $Inject
        InjectDLL()
    Case $WinList
        ListWindows()
        
        ; Case $Checkbox
        ;_CheckCheckBox()
        
        EndSwitch
WEnd
Quit()
EndFunc

Func InjectDLL()
    
$Result = GUICtrlRead($InputWindow)
$Result2 = GUICtrlRead($InputDLL)

If fileExists(GUICtrlRead($InputDLL)) = 0   AND WinExists(GUICtrlRead($InputWindow)) = 0  Then
    MsgBox(0,"Bad DLL path and window name","The .DLL " & $Result2 & " does not exists as well as the window name " & $Result & " Does not exists. Please make sure both exists before injecting.")
    ActGui()
ElseIf fileExists(GUICtrlRead($InputDLL)) = 0 Then
    MsgBox(0,"Bad DLL path", "The .DLL " & "" &  $result2 & "" & " does not exists. Please check your .DLL  path")
    ActGUI()
    Elseif  WinExists(GUICtrlRead($InputWindow)) = 0   then
    MsgBox(0,"Bad Window name" , "The window " & $result & " does not exists. Please make sure the window exists before injecting.")
    ActGui()
    endif

    
    $success = _InjectDll(WinGetHandle(GUICtrlRead($InputWindow)), GUICtrlRead($InputDLL)); WinGetHandle($switches)
    $Errorr = @error
If $Errorr < 0 Then
  ;    MsgBox(16, $success, $Errorr)
    TrayTip ( "DLLInjecteor", "Failed!", 10 , 1 )

Else
      ;MsgBox(64, $success, "DLL Injected sucssfully")
    TrayTip ( "DLLInjecteor", "DLL Injected sucssfully!", 10 , 1 ) 


EndIf
    

EndFunc

Func Quit()
    $checkk = GUICtrlRead($Checkbox)
    ;1 is checked, 4 is unchecked
    If $checkk = 1 Then
        ;write to ini
        $ini_dll = GUICtrlRead($InputDLL)
        $ini_win = GUICtrlRead($InputWindow)
        IniWrite("DLLInjector.ini","Main","DLL",$ini_dll)
        IniWrite("DLLInjector.ini","Main","WindowName",$ini_win)
        ;MsgBox(0,"O_o" $chk)
    ;ElseIf $checkk = 4 Then
    ;       IniWrite("DLLInjector.ini","Main","DLL","DLL to inject")
    ;       IniWrite("DLLInjector.ini","Main","WindowName","Window Name")
        
    EndIf
;   MsgBox(0,"test",$chk)
    Exit
EndFunc





Func ListWindows()
$main2 = GUICreate ("Window List", 200, 300,700,200)
$Windows = GUICtrlCreateListView ("Currently visible windows", 1, 20, 200, 250)
$Window = GUICtrlCreateButton ("Select window", 120, 272, -1, -1)
$Refresh = GUICtrlCreateButton ("Refresh windows", 10, 272, -1, -1)

$var = WinList()

For $i = 1 to $var[0][0]
  ; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
      GUICtrlCreateListViewItem ($var[$i][0], $Windows)
 
  EndIf
Next

GUISetState (@SW_SHOW, $main2)
;;;

While 1
    $get= GUIGetMsg ()
    Select
Case $get= $GUI_EVENT_CLOSE
GUIDelete($main2)
 ExitLoop
 ;;;
Case $get= $Window
          $GetWindow=  (GUICtrlRead(GUICtrlRead ($Windows)))
          ; below commented out incase i want to add a warning before selecting the window
             ;   $warning= MsgBox (4 + 48, "WARNING", "Are you sure you want to use this window?") 
            ;    If $warning= 6 then
            
                    GUICtrlSetData($InputWindow , $GetWindow )
                     GUIDelete($main2)
                     ExitLoop
        
                ;  Else
               ;     ContinueLoop
                ;EndIf
                ;;;
                Case $get= $Refresh
            GUIDelete($main2)
    
    ListWindows()
    
    Exitloop
    
EndSelect

        WEnd
        EndFunc

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then 
    Return 1
  Else
    Return 0
  EndIf

EndFunc

; below commented incase i want to exit in a regular way
#cs Func Quit()
    Exit
    Endfunc 
    #ce
; 

#cs

Func InjectDLL()
    ; Incase I want to add a check for the default inputs and warn the user
  If ( GUICtrlRead($InputWindow) == "Window Name" ) Or ( GUICtrlRead($InputDLL) == "DLL To Inject" ) Then
        MsgBox(0,"Error","Can not use this path or window name")
        ActGUI()
    EndIf

    ;GUISetState(@SW_HIDE) 
    
#ce

Func _CheckCheckBox()
    

        $ini_dll = GUICtrlRead($InputDLL)
        $ini_win = GUICtrlRead($InputWindow)
        $check = GUICtrlRead($Checkbox)
        if $check = 1 Then
            IniWrite("DLLInjector.ini","Main","DLL", $ini_dll)
            IniWrite("DLLInjector.ini","Main","WindowName",$ini_win)
        Else
            IniWrite("DLLInjector.ini","Main","DLL", "DLL To Inject")
            IniWrite("DLLInjector.ini","Main","Window Name", "Window name")
            endif
        ;MsgBox(0,"credits/site" , "Credits: lolp1, DarkShadow, Outshynd.    www.edgeofnowhere.cc")
    ;Case Else
    
EndFunc

#cs
       Case $Save
           $lol1 = GUICtrlRead($InputWindow)
    $lol2 = GUICtrlRead($InputDLL)
    IniWrite("DLLinjector.ini", "Main", "WindowName", $lol1)
    IniWrite("DLLinjector.ini", "Main", "WindowName", $lol2)
        ;;;
        
        #ceoÝ÷ ØãyËC,¶®¶­sb6æ6ÇVFRÖöæ6P ¤gVæ2ôæ¦V7DFÆÂb33c¶væBÂb33c¶FÆÇF ¶Ö¶R7W&RFRW6W"76VBfÆB&ÖWFW'0 bb33c¶væBfÇC³ÒFVà 6WDW'&÷"Ó &WGW&âfÇ6P VÇ6Tb7G&ætÆVâb33c¶FÆÇFfÇC³ÒB÷"7G&æu&vBb33c¶FÆÇFÂBfÇC²fwC²gV÷C²æFÆÂgV÷C²FVà 6WDW'&÷"Ó" &WGW&âfÇ6P VæD`  Æö6Âb33c·BÂb33c·æFÆRÂb33c·Æ%&VÖ÷FRÂb33c¶ÖöDæFÆRÂb33c´ÆöDÆ'&'Âb33c¶F&V@  ¶÷VâFÆÂFBvRb33¶ÆÂ&RW6æp Æö6Âb33c¶¶W&æVÃ3"ÒFÆÄ÷VâgV÷C¶¶W&æVÃ3"æFÆÂgV÷C²  ¶vWBFRBg&öÒFRvæF÷r&÷fFV@ b33c·BÒFÆÄ6ÆÂgV÷C·W6W#3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷C´vWEvæF÷uF&VE&ö6W74BgV÷C²ÂgV÷C¶væBgV÷C²Âb33c¶væBÂgV÷C¶çE÷G"gV÷C²Â b4'&b33c·BFVà b33c·BÒb33c·E³%Ð VÇ6P 6WDW'&÷"Ó2 &WGW&âfÇ6P VæD`  ¶÷VâFR&ö6W72f÷"w&Fæp b33c·æFÆRÒFÆÄ6ÆÂb33c¶¶W&æVÃ3"ÂgV÷C¶çBgV÷C²ÂgV÷C´÷Vå&ö6W72gV÷C²ÂgV÷C¶çBgV÷C²ÂcddbÂgV÷C¶çBgV÷C²ÂÂgV÷C¶çBgV÷C²Âb33c·B b4'&b33c·æFÆRæBb33c·æFÆU³ÒfwC²FVà b33c·æFÆRÒb33c·æFÆU³Ð VÇ6P 6WDW'&÷"ÓB &WGW&âfÇ6P VæD`  b33c·Æ%&VÖ÷FRÒFÆÄ6ÆÂb33c¶¶W&æVÃ3"ÂgV÷C¶çBgV÷C²ÂgV÷Cµf'GVÄÆÆö4WgV÷C²ÂgV÷C¶çBgV÷C²Âb33c·æFÆRÂgV÷C·6÷'BgV÷C²ÂÂgV÷C¶çBgV÷C²ÂÂgV÷C¶çBgV÷C²ÂÂgV÷C¶çBgV÷C²ÂB b4'&b33c·Æ%&VÖ÷FRFVà bb33c·Æ%&VÖ÷FU³ÒfwC²FVà ¶FV'Vp 6öç6öÆUw&FRgV÷C³gV÷C²fײWb33c·Æ%&VÖ÷FU³ÒÂfײ5" b33c·Æ%&VÖ÷FRÒb33c·Æ%&VÖ÷FU³Ð VÇ6P 6WDW'&÷"ÓR &WGW&âfÇ6P VæD` VÇ6P 6WDW'&÷"Ób &WGW&âfÇ6P VæD`  f÷"b33c¶ÒFò7G&ætÆVâb33c¶FÆÇF b33c·&WBÒFÆÄ6ÆÂgV÷C¶¶W&æVÃ3"æFÆÂgV÷C²ÂgV÷C¶çBgV÷C²ÂgV÷Cµw&FU&ö6W74ÖVÖ÷'gV÷C²ÂgV÷C¶çBgV÷C²Âb33c·æFÆRÂgV÷C¶çBgV÷C²Âb33c·Æ%&VÖ÷FR²b33c¶ÂgV÷C¶çE÷G"gV÷C²Â627G&ætÖBb33c¶FÆÇFÂb33c¶²ÂÂgV÷C¶çBgV÷C²ÂÂgV÷C¶çBgV÷C²Â b4'&b33c·&WBFVà bb33c·&WE³ÒÒFVà 6WDW'&÷"Ór &WGW&âfÇ6P VæD` VÇ6P 6WDW'&÷"Ó &WGW&âfÇ6P VæD` æW@  b33c¶ÖöDæFÆRÒFÆÄ6ÆÂb33c¶¶W&æVÃ3"ÂgV÷C¶ÆöærgV÷C²ÂgV÷C´vWDÖöGVÆTæFÆRgV÷C²ÂgV÷C·7G"gV÷C²ÂgV÷C¶¶W&æVÃ3"æFÆÂgV÷C² b4'&b33c¶ÖöDæFÆRFVà bb33c¶ÖöDæFÆU³ÒfwC²FVà b33c¶ÖöDæFÆRÒb33c¶ÖöDæFÆU³Ð VÇ6P 6WDW'&÷"Ó &WGW&âfÇ6P VæD` VÇ6P 6WDW'&÷"Ó &WGW&âfÇ6P VæD`  b33c´ÆöDÆ'&'ÒFÆÄ6ÆÂb33c¶¶W&æVÃ3"ÂgV÷C¶ÆöærgV÷C²ÂgV÷C´vWE&ö4FG&W72gV÷C²ÂgV÷C¶ÆöærgV÷C²Âb33c¶ÖöDæFÆRÂgV÷C·7G"gV÷C²ÂgV÷C´ÆöDÆ'&'gV÷C² b4'&b33c´ÆöDÆ'&'FVà bb33c´ÆöDÆ'&'³ÒfwC²FVà b33c´ÆöDÆ'&'Òb33c´ÆöDÆ'&'³Ð VÇ6P 6WDW'&÷"Ó &WGW&âfÇ6P VæD` VÇ6P 6WDW'&÷"Ó" &WGW&âfÇ6P VæD`  b33c¶F&VBÒFÆÄ6ÆÂb33c¶¶W&æVÃ3"ÂgV÷C¶çBgV÷C²ÂgV÷C´7&VFU&VÖ÷FUF&VBgV÷C²ÂgV÷C¶çBgV÷C²Âb33c·æFÆRÂgV÷C¶çBgV÷C²ÂÂgV÷C¶çBgV÷C²ÂÂgV÷C¶ÆöærgV÷C²Âb33c´ÆöDÆ'&'ÂgV÷C¶ÆöærgV÷C²Âb33c·Æ%&VÖ÷FRÂgV÷C¶çBgV÷C²ÂÂgV÷C¶çBgV÷C²Â b4'&b33c¶F&VBFVà 6öç6öÆUw&FRb33c¶F&VE³Òfײ5" bb33c¶F&VE³ÒfwC²FVà b33c¶F&VBÒb33c¶F&VE³Ð VÇ6P 6WDW'&÷"Ó2 &WGW&âfÇ6P VæD` VÇ6P 6WDW'&÷"ÓB &WGW&âfÇ6P  VæD`  FÆÄ6ÆÂb33c¶¶W&æVÃ3"ÂgV÷C¶çBgV÷C²ÂgV÷Cµf'GVÄg&VTWgV÷C²ÂgV÷C¶çBgV÷C²Âb33c·æFÆRÂgV÷C¶çBgV÷C²Âb33c·Æ%&VÖ÷FRÂgV÷C¶çBgV÷C²ÂÂgV÷C¶çBgV÷C²Â FÆÄ6ÆÂb33c¶¶W&æVÃ3"ÂgV÷C¶çBgV÷C²ÂgV÷C´6Æ÷6TæFÆRgV÷C²ÂgV÷C¶çBgV÷C²Âb33c¶F&VB FÆÄ6ÆÂb33c¶¶W&æVÃ3"ÂgV÷C¶çBgV÷C²ÂgV÷C´6Æ÷6TæFÆRgV÷C²ÂgV÷C¶çBgV÷C²Âb33c·æFÆR  FÆÄ6Æ÷6Rb33c¶¶W&æVÃ3"  &WGW&âG'VP¤VæDgVæ
Link to comment
Share on other sites

No one can figure it out

Figuring out what is that you want is the hardest part.

You failed to say what exactly is wrong with that code and what you expect us to do? Debug it and fix it for you? Fix it that it would compile without errors or fix it that it would actually work? You are not showing any effort. If you run this thing through Scite, error messages are as descriptive as it gets.

"be smart, drink your wine"

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...