News:

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

What is the correct syntax for

Started by Sigmatador, January 30, 2005, 11:55:49 AM

Previous topic - Next topic

Sigmatador

mov eax, [fs:30h] or something like that ?

regards.

hutch--

Maybe if you told us what you are trying to do, someone could help you. Segment "fs" is normally not used in win32 for application coding so it would appear you have some other use for it.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Sigmatador

i know what i'm doing  :green
however this code will give you the module base address of KERNEL32.DLL on every 32bits Windows version (stored in eax)

mov     edx, fs:[30h]
mov     eax, [edx+0ch]
mov     esi, [eax+01ch]
mov     edx, [esi]
mov     eax, [edx+8]

this code compil without pb using msvc and inline asm syntax (__asm {...})
I would like to write a whole prog in asm using this (not just some inline asm in a C code), so i have to find the correct masm syntax to write this ^^

Sigmatador

and yes i know

mov eax, fs
add eax, 30h
mov eax, [eax]

would work, but why use 3 instructions when a single one do the same job  :8)

and btw, i'm new to masm, so  i still need to figure out the masm syntax specificity

Jibz

Quote from: Sigmatador on January 30, 2005, 12:34:18 PM
i know what i'm doing :green
however this code will give you the module base address of KERNEL32.DLL on every 32bits Windows version (stored in eax)

Tried it on Win9x/ME? or do you not considder them to be 32-bit since you know what you're doing?

Sigmatador

oki found!

by default masm prevent from using fs segment

a simple

assume fs:nothing
mov eax, [fs:30h]

do the trick ^^

cu all
regards