News:

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

Help with a simple code

Started by GabonZ, July 14, 2011, 04:20:08 PM

Previous topic - Next topic

GabonZ

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

RuiLoureiro


MOV DWORD PTR DS:[462B0E], eax

462B0E must be 462B0Eh

baltoro

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

GabonZ

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

baltoro

Just a suggestion: I think GetPrivateProfileInt 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,...
Baltoro

dedndave

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

baltoro

WHAT !!!
I actually got the answer right ???
I can't believe it !!!

...Someone, has probably hacked my account. :eek
Baltoro

hutch--

 :bg

Does that mean the ghost of Baltoro has struck again ?
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

Injecting a DLL into the running process for an online game, modifying carefully chosen memory locations..
This sounds legit. ::)
No snowflake in an avalanche feels responsible.