The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: GabonZ on July 14, 2011, 04:20:08 PM

Title: Help with a simple code
Post by: GabonZ on July 14, 2011, 04:20:08 PM
Hi everyone... i`m new to ASM and i have a problem, i get this error: : error A2048: nondigit in number
My code is:

.586
.model flat, stdcall
option casemap:none
Include \masm32\include\windows.inc
Include \masm32\include\kernel32.inc
Include \masm32\include\user32.inc
IncludeLib \masm32\lib\kernel32.lib
IncludeLib \masm32\lib\user32.lib
Includelib  \masm32\lib\gdi32.lib

.data
FilePath DB "./Config.ini", 0
Context DB "TEST", 0
PointsPerLevel2 DB "PointsPerLevel", 0
PointsPerLevelMG2 DB "PointsPerLevelMG", 0

.code
start:
MyDLL Proc hInst:HINSTANCE, reason:DWord, reserved1:DWord
mov eax, TRUE
ret
MyDLL EndP

ReadConfigs Proc
invoke GetPrivateProfileInt, addr Context, addr PointsPerLevel2, 0, Addr FilePath
MOV DWORD PTR DS:[462B0E], eax
ret
ReadConfigs Endp
end start


Thanks...
Title: Re: Help with a simple code
Post by: RuiLoureiro on July 14, 2011, 04:34:23 PM

MOV DWORD PTR DS:[462B0E], eax

462B0E must be 462B0Eh
Title: Re: Help with a simple code
Post by: baltoro on July 14, 2011, 04:50:20 PM
GABONZ,
I think the data type defaults to decimal unless you specify otherwise, as RuiLoureiro has indicated above.
What mystifies me is the origin of that number.
Title: Re: Help with a simple code
Post by: GabonZ on July 14, 2011, 04:53:03 PM
Hmm thanks guys, i get rid of the error by adding "H" but it takes no changes... (Sorry, my english sucks)
I was trying a tutorial out on how to edit your server (MuOnline) this is it:

.586
.Model flat, StdCall
Option CaseMap:none
Include \masm32\include\windows.inc
Include \masm32\include\kernel32.inc
Include \masm32\include\user32.inc
IncludeLib \masm32\lib\kernel32.lib
IncludeLib \masm32\lib\user32.lib
Includelib      \masm32\lib\gdi32.lib

.const
.data?
.data
FilePath DB "./OptionsArentGreat.wow", 0
Context DB "Context", 0
szPotionMixIndex DB "PotionMixIndex", 0
szPotionMixID DB "PotionMixID", 0
.code

DllEntry Proc hInst:HINSTANCE, reason:DWord, reserved1:DWord
mov eax, TRUE ;Return TRUE when loaded DLL by GameServer
ret
DllEntry EndP

ReadWoWFile Proc
Invoke GetPrivateProfileInt, addr Context, addr szPotionMixIndex, 0, Addr FilePath
imul eax, eax, 512 ;Trasnform Index
push eax ;Save the ItemIndex in invert piramidal stack
invoke GetPrivateProfileInt, addr Context, addr szPotionMixID,
0, Addr FilePath
mov edx, eax ;EDX = ItemID
pop eax ;Restore the saved ItemIndex value from stack
add edx, eax ;ItemIndex + ItemID = Final item ID
mov word ptr [004978E4], Ax ;Since our item ID are 2 bytes then we move a WORD and not a DWORD (4 bytes)
ret ;Lets quick of the procedure
ReadWoWFile Endp


But even this code gives me that error...
Title: Re: Help with a simple code
Post by: baltoro on July 14, 2011, 05:11:24 PM
Just a suggestion: I think GetPrivateProfileInt (http://msdn.microsoft.com/en-us/library/ms724345(v=vs.85).aspx) is deprecated, however, alot of programmers still use it.
Note  This function is provided only for compatibility with 16-bit Windows-based applications. Applications should store initialization information in the registry.   
I'm a little confused, here,...what, exactly are you trying to do ???
It appears that you are locating data from an initialization file, but, you don't check for success,...
If GetPrivateProfileInt fails it returns zero, the specified default value,...which you do twice,...
Title: Re: Help with a simple code
Post by: dedndave on July 14, 2011, 05:31:10 PM
yah - it is still used for INI files, because a lot of users don't like you using the registry
if the registry wasn't so abused, you could do things the right way - lol
but, so many programs bloat the registry (especially a lot of 0's)

the real issue here is the hard-coded address
and, from a DLL
that is just poor programming, i'd say

offhand, this smells of hooking/injecting
you may want to review the forum rules
Title: Re: Help with a simple code
Post by: baltoro on July 14, 2011, 05:36:48 PM
WHAT !!!
I actually got the answer right ???
I can't believe it !!!

...Someone, has probably hacked my account. :eek
Title: Re: Help with a simple code
Post by: hutch-- on July 15, 2011, 02:30:30 AM
 :bg

Does that mean the ghost of Baltoro has struck again ?
Title: Re: Help with a simple code
Post by: Tedd on July 15, 2011, 12:36:58 PM
Injecting a DLL into the running process for an online game, modifying carefully chosen memory locations..
This sounds legit. ::)