Sometimes I see code like
mov eax, fs:dword ptr[150h] or simular, what is the fs for?

And how do you calculate right addresses? I mean eg:
jmp dword ptr (after the first line), how is that 250 calculated and of course how is the relation to FS ?
Posted on 2003-06-13 08:56:59 by SFP
In Win32 programming the FS (and GS) register is assumed to Error and used for structured exception handling. Addressing in Win32 is FLAT, that means that there are no segements to deal with at all, the actual address in eip is where the instruction pointer is (well sort of - it is after all protected mode).
Posted on 2003-06-13 12:00:47 by donkey
Windows sets FS to point to a segment which contains information about the thread when executing a Windows application. GS will point to the TDB of the program in Windows 95/98/Me. When executing system code, FS will point to a segment which only contains an exception frame address, and GS will be a flat segment. FS:[150h] must be an error, the segment is not that big.
Posted on 2003-06-13 14:24:49 by Sephiroth3
Where can i find information about how windows 9x uses FS: register?

Greets.

pd: yes, i've tryed Google.
Posted on 2003-06-17 00:34:44 by r00t
You can google for SEH or structured exception handling, I used to have some demos around but they're archived somewhere in a badly organized stack of cdroms. I'll see what I can find.
Posted on 2003-06-17 01:19:49 by donkey

GS will point to the TDB of the program in Windows 95/98/Me.
Actually, in Win95 original edition, on program launch, GS is set to 0, an invalid selector. There are some APIs that use GS as a temporary segment register.
Posted on 2003-06-17 14:47:14 by tenkey
Whoops... I guess I should have tested it more carefully. I was just interrupting Explorer at a random time and found it pointing to the TDB, and it was very late at night...
Posted on 2003-06-17 16:23:49 by Sephiroth3
Posted on 2003-06-17 19:01:24 by Four-F

Where can i find information about how windows 9x uses FS: register?


Hello, Coder!
Posted on 2003-06-18 11:40:28 by MazeGen