Why does this line of code ...

mov eax, dword ptr fs:[30h]


... generate this error ...

error A2108: use of register assumed to ERROR


... when, in fact, using FS is allowed by windows ?



aweX <-

P.S.: Windows.inc of MASMv8 is still missing HFILE_ERROR EQU -1
Posted on 2003-02-09 05:27:36 by aweX
assume fs: nothing
Posted on 2003-02-09 07:10:38 by LaptoniC
Thanks very much.

What's the standard assume for fs anyways? fs:code ?
Posted on 2003-02-09 07:19:37 by aweX
assume fs:error - as the message suggests.
Posted on 2003-02-14 13:27:05 by stormix
FYI: The FS is used by Windows differently in user and kernel mode. In kernel mode it points to the KPCR (kernel processor control region) that contains the global info about the current state of all processors in the compluter. In user mode it points to the TEB (Thread Environment Block) that contains info about the currently running thread. Both structures are almost undocumented and differs on 9x and NTs.

I restored these structures for Win 2K, so if you are interested I can send you their description.

Regards,
Yury
Posted on 2003-02-21 22:21:11 by Yury Lukach

I restored these structures for Win 2K, so if you are interested I can send you their description.
Why not post it here? It's surely of general interest.
Posted on 2003-02-22 03:03:44 by Maverick
Here is a very raw version of my "Through The Window Glass" project that will describe Windows NT kernel. Currently I've restored internal structures of the Win 2k kernel. Almost all of them were extracted from the Microsoft official symbol files and so are authentical. The rare exceptions are marked in my headers as "Non-MS".

This archive also contains the kernel function prototypes but this work have started
only some days ago...

Regards,
Yury
Posted on 2003-02-22 23:31:13 by Yury Lukach
Nice work, Yuri.

I found out that there's an explanation of the Thread Information Block (fs:)
by Matt Pietrek: http://www.microsoft.com/msj/archive/s2ce.htm
Includes header file and example source. This guy rules ...

"Let's say that you've written the world's coolest exception handler.
When something bad happens, your handler diagnoses the problem,
logs relevant details, solves world hunger, and cancels the mind-numbing
weekly staff meeting.
"
- Matt Pietrek in "New Vectored Exception Handling in Windows XP"

aweX <-
Posted on 2003-02-24 00:00:45 by aweX