Jump to content

Arrays


Caiol
 Share

Recommended Posts

Good morning,

I'm new at forum and not "speak" english very well, but i wanna help with a script that is supposed to be a game anticheating.

I've used _ProcessGetLoadedModules to take the modules from de game and compare with a variable that contain 90 arrays...

So, i've used a while to take the modules, after i've get a "while" to compare the arrays got by function with the arrays that i've described...

The error is: Array variable subscript badly formatted. > At the start of the script and no every time.

Part of Script:

Dim $szDrive, $szDir, $szFName, $szExt
Dim $dllnormal[92]
$i = 0
$i2 = 0

$dllnormal[0] = "msskn.exe"
$dllnormal[1] = "ntdll.dll"
$dllnormal[2] = "kernel32.dll"
$dllnormal[3] = "KERNELBASE.dll"
$dllnormal[4] = "USER32.dll"
$dllnormal[5] = "GDI32.dll"
$dllnormal[6] = "LPK.dll"
$dllnormal[7] = "USP10.dll"
$dllnormal[8] = "msvcrt.dll"
$dllnormal[9] = "IMM32.DLL"
$dllnormal[10] = "MSCTF.dll"
$dllnormal[11] = "ADVAPI32.dll"
$dllnormal[12] = "sechost.dll"
$dllnormal[13] = "RPCRT4.dll"
$dllnormal[14] = "shell32.dll"
$dllnormal[15] = "SHLWAPI.dll"
$dllnormal[16] = "dsound.dll"
$dllnormal[17] = "ole32.dll"
$dllnormal[18] = "WINMM.dll"
$dllnormal[19] = "POWRPROF.dll"
$dllnormal[20] = "SETUPAPI.dll"
$dllnormal[21] = "CFGMGR32.dll"
$dllnormal[22] = "OLEAUT32.dll"
$dllnormal[23] = "DEVOBJ.dll"
$dllnormal[24] = "ddraw.dll"
$dllnormal[25] = "DCIMAN32.dll"
$dllnormal[26] = "dwmapi.dll"
$dllnormal[27] = "wininet.dll"
$dllnormal[28] = "Normaliz.dll"
$dllnormal[29] = "urlmon.dll"
$dllnormal[30] = "CRYPT32.dll"
$dllnormal[31] = "MSASN1.dll"
$dllnormal[32] = "iertutil.dll"
$dllnormal[33] = "wsock32.dll"
$dllnormal[34] = "WS2_32.dll"
$dllnormal[35] = "NSI.dll"
$dllnormal[36] = "CRYPTBASE.dll"
$dllnormal[37] = "CLBCatQ.DLL"
$dllnormal[38] = "MMDevApi.dll"
$dllnormal[39] = "PROPSYS.dll"
$dllnormal[40] = "AUDIOSES.DLL"
$dllnormal[41] = "uxtheme.dll"
$dllnormal[42] = "mswsock.dll"
$dllnormal[43] = "nvd3dum.dll"
$dllnormal[44] = "D3DIM.DLL"
$dllnormal[45] = "WINTRUST.dll"
$dllnormal[46] = "CRYPTSP.dll"
$dllnormal[47] = "rsaenh.dll"
$dllnormal[48] = "bcrypt.dll"
$dllnormal[49] = "bcryptprimitives.dll"
$dllnormal[50] = "ncrypt.dll"
$dllnormal[51] = "USERENV.dll"
$dllnormal[52] = "profapi.dll"
$dllnormal[53] = "GPAPI.dll"
$dllnormal[54] = "cryptnet.dll"
$dllnormal[55] = "WLDAP32.dll"
$dllnormal[56] = "SensApi.dll"
$dllnormal[57] = "Cabinet.dll"
$dllnormal[58] = "DEVRTL.dll"
$dllnormal[59] = "NLAapi.dll"
$dllnormal[60] = "DNSAPI.dll"
$dllnormal[61] = "winrnr.dll"
$dllnormal[62] = "napinsp.dll"
$dllnormal[63] = "pnrpnsp.dll"
$dllnormal[64] = "mdnsNSP.dll"
$dllnormal[65] = "Iphlpapi.DLL"
$dllnormal[66] = "WINNSI.DLL"
$dllnormal[67] = "fwpuclnt.dll"
$dllnormal[68] = "rasadhlp.dll"
$dllnormal[69] = "avrt.dll"
$dllnormal[70] = "apphelp.dll"
$dllnormal[71] = "AcLayers.dll"
$dllnormal[72] = "SspiCli.dll"
$dllnormal[73] = "winspool.drv"
$dllnormal[74] = "mpr.dll"
$dllnormal[75] = "mzvkbd3.dll"
$dllnormal[76] = "psapi.dll"
$dllnormal[77] = "kloehk.dll"
$dllnormal[78] = "wshtcpip.dll"
$dllnormal[79] = "comctl32.dll"
$dllnormal[80] = "rasapi32.dll"
$dllnormal[81] = "rasman.dll"
$dllnormal[82] = "rtutils.dll"
$dllnormal[83] = "wship6.dll"
$dllnormal[84] = "ntmarta.dll"
$dllnormal[85] = "version.dll"
$dllnormal[86] = "peerdist.dll"
$dllnormal[87] = "authz.dll"
$dllnormal[88] = "mscat32.dll"
$dllnormal[89] = "netprofm.dll"
$dllnormal[90] = "npmproxy.dll"
$dllnormal[91] = "rpcrtremote.dll"

While ProcessExists("msskn.exe")

$iPID = ProcessExists("msskn.exe")
$get = _ProcessGetLoadedModules($iPID)

$max = UBound($get)
$tam = $max-1

$TestPath = _PathSplit($get[$i], $szDrive, $szDir, $szFName, $szExt)
$leituradll = $TestPath[3] & $TestPath[4]

 $max2 = UBound($dllnormal)
    $tam2 = $max2-1
    
    if $tam2 >= $i2 Then
            $i2 = 0
    EndIf
    
    While $i2 <= $tam2 ;0 <= 92
        if $tam2 >= $i2 Then
            $i2 = 0
        EndIf
        If $leituradll <> $dllnormal[$i2] Then
            if $i2 >= $tam2 Then
                MsgBox(0,"DLL isn't exists",$leituradll)
                $i2 = 0
                ExitLoop
            EndIf
            $i2 = $i2+1
        Else
            $i2 = 0
            ExitLoop
        EndIf
    WEnd
    
if $i >= $tam Then
    $i = 0
Else
    $i = $i+1
EndIf

WEnd
Link to comment
Share on other sites

Watch what you say about games/cheating, etc. There are very strict rules about this on the forum. That being said, nothing that you have provided gives any indication of an error. What is the line number that the error occurs.

Why did you do this

$max2 = UBound($Dllnormal)
$tam2 = $max2 - 1
instead of this
$tam2 = UBound($Dllnormal) - 1
Is $Max2 used somewhere else in the script? Edited by Varian
Link to comment
Share on other sites

This script is not to hack programs or game cheating, is to protect them... Game Anti hack :)

$max2 = UBound($Dllnormal)
$tam2 = $max2 - 1

I don't know why i've used it, $max2 isn't used in the script.

So, i've been searching and find a possibility to use "For":

For $i2 = 0 to $tam2 Step 1
;Arrays compare
Next

About the error, is it occuring at the function:

Here:

Local $aReturn[$aCall[4]/$SIZEOFHWND]

Local $aReturn[^ ERROR

==> Array variable subscript badly formatted.:

#Include <WinAPI.au3>

; #FUNCTION#;===============================================================================
;
; Name...........: _ProcessGetLoadedModules
; Description ...: Returns an array containing the full path of the loaded modules
; Syntax.........: _ProcessGetLoadedModules($iPID)
; Parameters ....:
; Return values .: Success - An array with all the paths
;               : Failure - -1 and @error=1 if the specified process couldn't be opened.
; Author ........: Andreas Karlsson (monoceres) & ProgAndy
; Modified.......:
; Remarks .......:
; Related .......: 
; Link ..........;
; Example .......; No
;
;;==========================================================================================
Func _ProcessGetLoadedModules($iPID)
    Local Const $PROCESS_QUERY_INFORMATION=0x0400
    Local Const $PROCESS_VM_READ=0x0010
    Local $aCall, $hPsapi=DllOpen("Psapi.dll")
    Local $hProcess, $tModulesStruct
    $tModulesStruct=DllStructCreate("hwnd [200]")
    Local $SIZEOFHWND = DllStructGetSize($tModulesStruct)/200
    $hProcess=_WinAPI_OpenProcess(BitOR($PROCESS_QUERY_INFORMATION,$PROCESS_VM_READ),False,$iPID)
    If Not $hProcess Then Return SetError(1,0,-1)
    $aCall=DllCall($hPsapi,"int","EnumProcessModules","ptr",$hProcess,"ptr",DllStructGetPtr($tModulesStruct),"dword",DllStructGetSize($tModulesStruct),"dword*","")
    If $aCall[4]>DllStructGetSize($tModulesStruct) Then
        $tModulesStruct=DllStructCreate("hwnd ["&$aCall[4]/$SIZEOFHWND&"]")
        $aCall=DllCall($hPsapi,"int","EnumProcessModules","ptr",$hProcess,"ptr",DllStructGetPtr($tModulesStruct),"dword",$aCall[4],"dword*","")
    EndIf
    Local $aReturn[$aCall[4]/$SIZEOFHWND]
    For $i=0 To Ubound($aReturn)-1
        
$aCall=DllCall($hPsapi,"dword","GetModuleFileNameExW","ptr",$hProcess,"ptr",DllStructGetData($tModulesStruct,1,$i+1),"wstr","","dword",65536)
$aReturn[$i]=$aCall[3]
    
Next
    _WinAPI_CloseHandle($hProcess)
    DllClose($hPsapi)
    Return $aReturn
EndFunc
Link to comment
Share on other sites

Nvmwhat i wroted it whas dumb

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

The Expression "$aCall[4] / $SIZEOFHWND" is returning either 0 or a negative. You cannot define an array with 0 or less (negative). You need to have some fallback to ensure that $aCall[4] / $SIZEOFHWND is at least 1. If it is an float, the floor (integer portion) will be used to initialize the array.

For example:

$Dimensions = $aCall[4] / $SIZEOFHWND
If $Dimensions <= 0 Then $Dimensions = 1    ;just an example
Local $aReturn[$Dimensions] ;This way, you will not get an error
Link to comment
Share on other sites

The Expression "$aCall[4] / $SIZEOFHWND" is returning either 0 or a negative. You cannot define an array with 0 or less (negative). You need to have some fallback to ensure that $aCall[4] / $SIZEOFHWND is at least 1. If it is an float, the floor (integer portion) will be used to initialize the array.

For example:

$Dimensions = $aCall[4] / $SIZEOFHWND
If $Dimensions <= 0 Then $Dimensions = 1    ;just an example
Local $aReturn[$Dimensions] ;This way, you will not get an error

Thanks Varian, it works perfect!

Thanks everybody... :)

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...