News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Calling external config file

Started by m-tek, October 07, 2007, 12:30:13 PM

Previous topic - Next topic

m-tek

Ok first post so go easy...  :U

Ive built a trainer that autoinjects some pokes and then auto closes ... but I want to point it to a config file which allows me to change pokes as and when...Ill explain


; #########################################################################
;
;  This Is My Trainer Template Created For The Game Trainer Studio
;
;  This Is Based On A MASM Example.
;
; #########################################################################

   .386
   .model flat, stdcall  ; 32 bit memory model
   option casemap :none  ; case sensitive

   include trainer.inc   ; local includes for this file



; #########################################################################

.data
        InstCap db 'Error',0
        InstMsg db 'You cant have more than one instance of this trainer running at the same time',0ah
        db 'This trainer will now terminate',0
       



; ### Constants Below
GameStatus equ 3000

; ### Constants Above

; ### Bytes Below



Timer00000 db 0EBh
           db 020h
Timer00001 db 0EBh
Timer00002 db 074h
           db 023h
Timer00003 db 0EBh
Timer00004 db 090h
           db 090h
           db 090h
           db 090h
           db 090h
           db 090h
Timer00005 db 090h
           db 090h
           db 090h
           db 090h
           db 090h
           db 090h
           db 090h
Timer00006 db 090h
           db 090h
Timer00007 db 090h
           db 090h
Timer00008 db 090h
           db 090h
           db 090h
           db 090h
           db 090h
           db 090h
           db 090h
Timer00009 db 0E9h
           db 05Eh
           db 004h
           db 000h
           db 000h
           db 090h
Timer00010 db 0E9h
           db 004h
           db 001h
           db 000h
           db 000h
           db 090h
Timer00011 db 000h
Timer00012 db 063h
Timer00013 db 090h
           db 090h
           db 090h
           db 090h
           db 090h
           db 090h
Timer00014 db 0EBh
           db 029h
Timer00015 db 089h
           db 09Eh
           db 060h
           db 007h
           db 000h
           db 000h
Timer00016 db 089h
           db 09Eh
           db 060h
           db 007h
           db 000h
           db 000h
Timer00017 db 048h
Timer00018 db 048h
Timer00019 db 048h
SetTextTimer20 db 'PLEASE START CSS',0
SetTextTimer21 db 'INJECTING....',0
SetTextTimer22 db 'PLEASE START CS:S',0
; ### Bytes Above

; ### Button Messages Below



; ### Button Messages Above

   WindCap db 'Counter-Strike Source',0
   szDisplayName db '*',0
.code

start:
   invoke GetModuleHandle, NULL
   mov hInstance, eax

   invoke GetCommandLine
   mov CommandLine, eax

   invoke WinMain,hInstance,NULL,CommandLine,SW_SHOWDEFAULT
   invoke ExitProcess,eax

; #########################################################################

WinMain proc hInst     :DWORD,
             hPrevInst :DWORD,
             CmdLine   :DWORD,
             CmdShow   :DWORD

   ;====================
   ; Put LOCALs on stack
   ;====================

   LOCAL wc   :WNDCLASSEX
   LOCAL msg  :MSG
   LOCAL Wwd  :DWORD
   LOCAL Wht  :DWORD
   LOCAL Wtx  :DWORD
   LOCAL Wty  :DWORD

   ;==================================================
   ; Fill WNDCLASSEX structure with required variables
   ;==================================================

   invoke LoadIcon,hInst,500    ; icon ID
   mov hIcon, eax

   szText szClassName,"Trainer_Class"

   mov wc.cbSize,         sizeof WNDCLASSEX
   mov wc.style,          CS_HREDRAW or CS_VREDRAW \
                or CS_BYTEALIGNWINDOW
   mov wc.lpfnWndProc,    offset WndProc
   mov wc.cbClsExtra,     NULL
   mov wc.cbWndExtra,     NULL
   m2m wc.hInstance,      hInst
   mov wc.hbrBackground,  COLOR_BTNFACE+1
   mov wc.lpszMenuName,   NULL
   mov wc.lpszClassName,  offset szClassName
   m2m wc.hIcon,          hIcon
   invoke LoadCursor,NULL,IDC_ARROW
   mov wc.hCursor,        eax
   m2m wc.hIconSm,        hIcon

   invoke RegisterClassEx, ADDR wc

   ;================================
   ; Centre window at following size
   ;================================

   mov Wwd, 183 ; Dialog Width
   mov Wht, 190 ; Dialog Height

   invoke GetSystemMetrics,SM_CXSCREEN
   invoke TopXY,Wwd,eax
   mov Wtx, eax

   invoke GetSystemMetrics,SM_CYSCREEN
   invoke TopXY,Wht,eax
   mov Wty, eax

   invoke CreateWindowEx,WS_EX_LEFT,
               ADDR szClassName,
               ADDR szDisplayName,
               WS_MINIMIZEBOX or WS_OVERLAPPED or WS_SYSMENU,
               Wtx,Wty,Wwd,Wht,
               NULL,NULL,
               hInst,NULL
   mov   hWnd,eax

   invoke ShowWindow,hWnd,SW_SHOWNORMAL
   invoke UpdateWindow,hWnd

   ;===================================
   ; Loop until PostQuitMessage is sent
   ;===================================

   StartLoop:
       invoke GetMessage,ADDR msg,NULL,0,0
       cmp eax, 0
       je ExitLoop
       invoke TranslateMessage, ADDR msg
       invoke DispatchMessage,  ADDR msg
       jmp StartLoop
   ExitLoop:

   return msg.wParam

WinMain endp

; #########################################################################

WndProc proc hWin   :DWORD,
             uMsg   :DWORD,
             wParam :DWORD,
             lParam :DWORD

    LOCAL var    :DWORD
    LOCAL caW    :DWORD
    LOCAL caH    :DWORD
    LOCAL color  :DWORD
    LOCAL hDC    :DWORD
    LOCAL Rct    :RECT
    LOCAL Ps     :PAINTSTRUCT
    LOCAL buffer1[128]:BYTE
    LOCAL buffer2[128]:BYTE
    LOCAL lfnt   :LOGFONT
    LOCAL psd    :PAGESETUPDLG
    LOCAL pd     :PRINTDLG

   .if uMsg == WM_COMMAND
        MOV EAX, wParam
       .if wParam == 499

       .endif
   .elseif uMsg == WM_CREATE


       ; ### Check If Trainer Is Already Running ###
              Invoke CreateMutex, NULL, 1, Offset szDisplayName
              Invoke GetLastError

              cmp eax, ERROR_ALREADY_EXISTS
              JE @Trainer_Already_Running
              JMP @Trainer_Not_Running

              @Trainer_Already_Running:
              Invoke MessageBox, 0, Offset InstMsg, Offset InstCap, MB_ICONEXCLAMATION
              Invoke ExitProcess, 0

              @Trainer_Not_Running:
       ; ### Check If Trainer Is Already Running ###

           Invoke Protection
        MOV HotKeyMiniToggle, TRUE
        szText font1,'MS Sans Serif'
        invoke CreateFont,8,5,0,0,500,0,0,0, \
                          DEFAULT_CHARSET,0,0,0,\
                          DEFAULT_PITCH,ADDR font1
        mov hFont, eax

       Invoke SetTimer, hWin, 1, 100, 0 ; HotKey Timer
       Invoke SetTimer, hWin, 2, 300, 0 ; EditBox Timer 1
       Invoke SetTimer, hWin, 3, 300, 0 ; EditBox Timer 2

       Invoke SetTimer, hWin, 100, 20000, 0 ; Set Timer Control ;   ### Timer Below ###

       Invoke SetTimer, hWin, 101, 100, 0 ; Set Timer Control ;   ### Timer Below ###



invoke LoadBitmap,hInstance,2500
mov bitmap2, eax
invoke BitMap,hWin,-4,-5,184,170,0
mov bitmap, eax
invoke SendMessage,bitmap,STM_SETIMAGE,0,bitmap2
       szText ETxt1," "
       invoke EditBox,ADDR ETxt1,hWin,28,120,120,19,3000

   .elseif uMsg == WM_TIMER
           Invoke Protection
       .If wParam == 1 ;   ### Timer Below ###




       .Endif ;        ### Timer Above ###

       .If wParam == 2 ;   ### Timer Below ###

       .Endif ;        ### Timer Above ###

       .If wParam == 3 ;   ### Timer Below ###




       .Endif ;        ### Timer Above ###


       .If wParam == 100 ;   ### Timer Below ###

Invoke FindWindow, NULL, Offset WindCap
.If EAX != 0
Invoke TrainerEngine, NULL, Offset WindCap, 02004BFB5h, Offset Timer00000, 2
Invoke TrainerEngine, NULL, Offset WindCap, 020074C00h, Offset Timer00001, 1
Invoke TrainerEngine, NULL, Offset WindCap, 020074BBDh, Offset Timer00002, 2
Invoke TrainerEngine, NULL, Offset WindCap, 02003F843h, Offset Timer00003, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0241BF510h, Offset Timer00004, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0241BF541h, Offset Timer00005, 7
Invoke TrainerEngine, NULL, Offset WindCap, 0241FF0A8h, Offset Timer00006, 2
Invoke TrainerEngine, NULL, Offset WindCap, 024207890h, Offset Timer00007, 2
Invoke TrainerEngine, NULL, Offset WindCap, 0241FE56Ah, Offset Timer00008, 7
Invoke TrainerEngine, NULL, Offset WindCap, 0241D0D6Dh, Offset Timer00009, 6
Invoke TrainerEngine, NULL, Offset WindCap, 02418D40Ah, Offset Timer00010, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0243E7A3Ch, Offset Timer00011, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0243E7A3Bh, Offset Timer00012, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0241E0693h, Offset Timer00013, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0241E077Ch, Offset Timer00014, 2
Invoke TrainerEngine, NULL, Offset WindCap, 0241E1709h, Offset Timer00015, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0241E16F0h, Offset Timer00016, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0240192B4h, Offset Timer00017, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0240192CAh, Offset Timer00018, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0240192BEh, Offset Timer00019, 1
Invoke ExitProcess, 0
.Else
Invoke SetDlgItemText, hWin, GameStatus, ADDR SetTextTimer20
.EndIf
       .Endif ;        ### Timer Above ###
       .If wParam == 101 ;   ### Timer Below ###

Invoke FindWindow, NULL, Offset WindCap
.If EAX != 0
Invoke SetDlgItemText, hWin, GameStatus, ADDR SetTextTimer21
.Else
Invoke SetDlgItemText, hWin, GameStatus, ADDR SetTextTimer22
.EndIf
       .Endif ;        ### Timer Above ###

   .elseif uMsg == WM_PAINT
       invoke BeginPaint,hWin,ADDR Ps
         mov hDC, eax
         invoke Paint_Proc,hWin,hDC
       invoke EndPaint,hWin,ADDR Ps
       return 0
   .elseif uMsg == WM_DESTROY
       invoke PostQuitMessage,NULL
       return 0
   .endif

    invoke DefWindowProc,hWin,uMsg,wParam,lParam

    ret

WndProc endp

; ########################################################################

TopXY proc wDim:DWORD, sDim:DWORD

   shr sDim, 1      ; divide screen dimension by 2
   shr wDim, 1      ; divide window dimension by 2
   mov eax, wDim    ; copy window dimension into eax
   sub sDim, eax    ; sub half win dimension from half screen dimension

   return sDim

TopXY endp

; #########################################################################

Paint_Proc proc hWin:DWORD, hDC:DWORD

   LOCAL btn_hi   :DWORD
   LOCAL btn_lo   :DWORD
   LOCAL Rct      :RECT

   invoke GetSysColor,COLOR_BTNHIGHLIGHT
   mov btn_hi, eax

   invoke GetSysColor,COLOR_BTNSHADOW
   mov btn_lo, eax

   return 0

Paint_Proc endp

; ########################################################################

end start



now the bit I need to be in an external file is


Invoke TrainerEngine, NULL, Offset WindCap, 02004BFB5h, Offset Timer00000, 2
Invoke TrainerEngine, NULL, Offset WindCap, 020074C00h, Offset Timer00001, 1
Invoke TrainerEngine, NULL, Offset WindCap, 020074BBDh, Offset Timer00002, 2
Invoke TrainerEngine, NULL, Offset WindCap, 02003F843h, Offset Timer00003, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0241BF510h, Offset Timer00004, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0241BF541h, Offset Timer00005, 7
Invoke TrainerEngine, NULL, Offset WindCap, 0241FF0A8h, Offset Timer00006, 2
Invoke TrainerEngine, NULL, Offset WindCap, 024207890h, Offset Timer00007, 2
Invoke TrainerEngine, NULL, Offset WindCap, 0241FE56Ah, Offset Timer00008, 7
Invoke TrainerEngine, NULL, Offset WindCap, 0241D0D6Dh, Offset Timer00009, 6
Invoke TrainerEngine, NULL, Offset WindCap, 02418D40Ah, Offset Timer00010, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0243E7A3Ch, Offset Timer00011, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0243E7A3Bh, Offset Timer00012, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0241E0693h, Offset Timer00013, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0241E077Ch, Offset Timer00014, 2
Invoke TrainerEngine, NULL, Offset WindCap, 0241E1709h, Offset Timer00015, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0241E16F0h, Offset Timer00016, 6
Invoke TrainerEngine, NULL, Offset WindCap, 0240192B4h, Offset Timer00017, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0240192CAh, Offset Timer00018, 1
Invoke TrainerEngine, NULL, Offset WindCap, 0240192BEh, Offset Timer00019, 1


Can anyone point me in the right direction please???

hutch--

> Can anyone point me in the right direction please???

Yes, read the rules.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php