flat assembler
Message board for the users of flat assembler.

Index > Windows > Error with: LOCAL Remember:DWORD

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 26 Aug 2012, 03:11
hello, I am new to asm coding and FASM gives an error while compiling my file.
It is at this line:
LOCAL Remember:DWORD
Thanks in advance

_________________
If the problems too big, give up
Post 26 Aug 2012, 03:11
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 26 Aug 2012, 03:15
Show your code. We have no idea what you have done.
Post 26 Aug 2012, 03:15
View user's profile Send private message Visit poster's website Reply with quote
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 26 Aug 2012, 03:19
I have done nothing really, it is a hack for a game and I copied it.
this is the code:
LOCAL requestShootWeapon:DWORD
LOCAL getLocalPlayer:DWORD
LOCAL getPlayerWeapons:DWORD `
LOCAL sendEvent:DWORD
sendEvent:DWORD
invoke GetModuleHandleA,SADD("Entitiesmp.dll")
mov ebx,eax
invoke GetProcAddress,ebx,SADD("?RequestShootWeapon@CPlayerWeapons@@QAEXMHEPAVCEntity@@J@Z")
mov requestShootWeapon,eax
invoke GetProcAddress,ebx,SADD("?GetLocalPlayer@CPlayer@@QAEPAV1@XZ")
mov getLocalPlayer,eax
invoke GetProcAddress,ebx,SADD("?GetPlayerWeapons@CPlayer@@QAEPAVCPlayerWeapons@@XZ")
mov getPlayerWeapons,eax
call getLocalPlayer
mov ecx,eax
call getPlayerWeapons
mov ecx,eax
push 0
push 0
push 0
push 0
push 0
call requestShootWeapons
retn

hope u can help
Post 26 Aug 2012, 03:19
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 26 Aug 2012, 03:33
You haven't defined LOCAL in any way. What did you want LOCAL to do?

Usually LOCAL is used only within macros, so unless you defined it for something else outside of a macro then it won't be recognised.

BTW: You will also have a problem with the SADD lines.
Post 26 Aug 2012, 03:33
View user's profile Send private message Visit poster's website Reply with quote
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 26 Aug 2012, 03:46
i dont know, I thought LOCAL would make the SendEvent and such holding a DWORD which later would be called to set the variables. But I am no expert Sad
Post 26 Aug 2012, 03:46
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 26 Aug 2012, 04:07
You can use the 'proc' macro.

Read about it here.
Post 26 Aug 2012, 04:07
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 789
Location: Adelaide
sinsi 26 Aug 2012, 04:09
SADD is a masm32 macro, not fasm.
Post 26 Aug 2012, 04:09
View user's profile Send private message Reply with quote
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 26 Aug 2012, 04:30
revolution, I tried that already but didnt work
Post 26 Aug 2012, 04:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 26 Aug 2012, 05:39
Show us the code that "didn't work".
Post 26 Aug 2012, 05:39
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 26 Aug 2012, 15:39
also. Proper code tags please
Post 26 Aug 2012, 15:39
View user's profile Send private message Reply with quote
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 26 Aug 2012, 20:28
So I have changed the code but it now gives an error I didn't expect.
the error is at this line: invoke LoadLibraryA,'entitiesmp.dll'
Code:
format PE GUI DLL
include 'win32ax.inc'
section 'hax' code readable executable writeable
.code
requestShootWeapon dd 0
getLocalPlayer dd 0
getPlayerWeapons dd 0
sendEvent dd 0

invoke LoadLibraryA,'entitiesmp.dll'

mov [entities],eax
invoke GetProcAddress,[entities],4957
mov [requestShootWeapon],eax
invoke GetProcAddress,[entities],3190
mov [getLocalPlayer],eax
invoke GetProcAddress,[entities],3251
mov [getPlayerWeapons],eax
call getLocalPlayer
mov ecx,eax
call getPlayerWeapons
mov ecx,eax
push 0
push 0
push 0
push 0
push 0
call requestShootWeapons
retn
section 'lzdasd' fixups data readable           
Post 26 Aug 2012, 20:28
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 27 Aug 2012, 10:18
This assembles but I have no idea if it works with your setup:
Code:
format PE GUI DLL
include 'win32ax.inc'
section 'hax' code readable executable writeable

.code

proc Something
  locals
              requestShootWeapon      dd ?
                getLocalPlayer          dd ?
                getPlayerWeapons        dd ?
                sendEvent               dd ?
                entities                dd ?
        endl
        invoke  LoadLibrary,'entitiesmp.dll'
      mov     [entities],eax
      invoke  GetProcAddress,[entities],4957  ;Magic number for what?
     mov     [requestShootWeapon],eax
    invoke  GetProcAddress,[entities],3190  ;Magic number for what?
     mov     [getLocalPlayer],eax
        invoke  GetProcAddress,[entities],3251  ;Magic number for what?
     mov     [getPlayerWeapons],eax
      call    [getLocalPlayer]
    mov     ecx,eax
     call    [getPlayerWeapons]              ;does this procedure really take ECX as a parameter?
        mov     ecx,eax
     stdcall [requestShootWeapon],0,0,0,0,0  ;does this procedure really take ECX as a parameter?
        ret
endp

section 'lzdasd' fixups data readable

.end Something    
Edit: Since this is assembled as a DLL then you possibly might need to export something and also add an initialisation procedure.
Post 27 Aug 2012, 10:18
View user's profile Send private message Visit poster's website Reply with quote
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 27 Aug 2012, 13:19
That does indeed assemble, but doesn't work in the game.
The game uses the entitiesmp.dll file to(I think) store events. Which are called with the name like this
Code:
("?GetPlayerWeapons@CPlayer@@QAEPAVCPlayerWeapons@@XZ")     

or with the numbers I used in my code. I have attached the exported dll so you can see.
Can you help me with that?
I also have a working dll, but it changes a different event. Maybe that helps as well? Thanks a lot!


Description: Working file
Download
Filename: nak2sc.ASM
Filesize: 864 Bytes
Downloaded: 433 Time(s)

Description: Part 2
Download
Filename: entitiesmpPART2.dll.txt
Filesize: 570.3 KB
Downloaded: 761 Time(s)

Description: Part 1
Download
Filename: entitiesmpPART1.dll.txt
Filesize: 314.72 KB
Downloaded: 553 Time(s)


_________________
If the problems too big, give up
Post 27 Aug 2012, 13:19
View user's profile Send private message Reply with quote
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 28 Aug 2012, 20:16
Can nobody help me out???
Post 28 Aug 2012, 20:16
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 31 Aug 2012, 23:53
ikdekker,

How can anybody help when you provide so little information?

Is that DLL loaded? How?
Is its initialization function called?
Does that function return proper value?

If your DLL is loaded using LoadLibrary() and its DllMain() returns FALSE when fdwReason == DLL_PROCESS_ATTACH (that means DLL initialization failed), aforementioned LoadLibrary() fails and returns NULL.

Attached source looks strange at least.
MessageBoxA() requires 4 DWORDs as parameters, with only 3 provided it will use return address to somewhere in Kernel32.DLL as uType parameter value; chances are slim that MessageBoxA() will accept it.
Post 31 Aug 2012, 23:53
View user's profile Send private message Reply with quote
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 01 Sep 2012, 01:51
I dont know it uses a bypass/injector to inject dll into process,
it uses initialization somehow.
and it is supposed to return a proper value.
i think i need a tutorial on fasm first, anybody know one?
Post 01 Sep 2012, 01:51
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 01 Sep 2012, 05:32
ikdekker wrote:
...it uses a bypass/injector to inject dll into process,
it uses initialization somehow.
and it is supposed to return a proper value.
Can you be more specific about injector? As I've already said, if it uses LoadLibrary(), your code may fail: just before ret you're calling void __thiscall CPlayerWeapons::RequestShootWeapon() which returns garbage in eax (because it returns void). While only one of more than 4 billions possible values will cause failure, you may be doomed. So, add mov eax, 1 just before ret and try again. Or better, read MSDN.

There isn't something special in fasm that is related to your problem, I think.
Post 01 Sep 2012, 05:32
View user's profile Send private message Reply with quote
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 02 Sep 2012, 10:41
it uses loadlibrary,
but I have added a msg box to it but it doesnt give a pop-up
Code:
format PE GUI DLL
include 'win32ax.inc' 
section 'hax' code readable executable writeable 

.code 

proc Something 
        locals 
                requestShootWeapon      dd ? 
                getLocalPlayer          dd ? 
                getPlayerWeapons        dd ? 
                sendEvent               dd ? 
                entities                dd ?

start:
mov eax,0
nop
call @f
@@:
mov eax,[esp]
sub eax,6
mov byte [eax],$c3
pop eax
;initialization
push 0
call @f
db 'injected',0
@@:
push 0
call [MessageBoxA]
 invoke  LoadLibrary,'entitiesmp.dll'
        mov     [entities],eax 
        invoke  GetProcAddress,[entities],("?RequestShootWeapon@CPlayerWeapons@@QAEXMHEPAVCEntity@@J@Z")  ;Magic number for what?
        mov     [requestShootWeapon],eax 
        invoke  GetProcAddress,[entities],("?GetLocalPlayer@CPlayer@@QAEPAV1@XZ");Magic number for what?
        mov     [getLocalPlayer],eax 
        invoke  GetProcAddress,[entities],("?GetPlayerWeapons@CPlayer@@QAEPAVCPlayerWeapons@@XZ")
        mov     [getPlayerWeapons],eax 
        call    [getLocalPlayer] 
        mov     ecx,eax 
        call    [getPlayerWeapons]              ;does this procedure really take ECX as a parameter? 
        mov     ecx,eax 
        stdcall [requestShootWeapon],0,0,0,0,0  ;does this procedure really take ECX as a parameter? 
        mov eax, 1
        ret
  endp

xor eax,eax
retn

section 'lzdasd' fixups data readable         

and im still not sure wether I should use such an address:
("?RequestShootWeapon@CPlayerWeapons@@QAEXMHEPAVCEntity@@J@Z")
or like the 6159
Post 02 Sep 2012, 10:41
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20300
Location: In your JS exploiting you and your system
revolution 02 Sep 2012, 10:50
I wonder if your empty 'hax' section is causing a problem. Try removing the redundant "section 'hax' ..." line.

Also you are missing the .end macro. Are you sure that code is compiling successfully?

What happened to the endl? And where is endp? And why the extra retn? Are you really sure that code is compiling successfully?
Post 02 Sep 2012, 10:50
View user's profile Send private message Visit poster's website Reply with quote
ikdekker



Joined: 26 Aug 2012
Posts: 10
ikdekker 02 Sep 2012, 11:04
well,
when I used .end start it gave an error on compiling something like unused statement.
I removed endl because I thought that caused the error.
extra retn was in other code which I attached earlier.
And yes, it compiles
Post 02 Sep 2012, 11:04
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.