Function 9 - information on execution thread.
Parameters:
- eax = 9 - function number
- ebx = pointer to 1-Kb buffer
- ecx = number of the slot of the thread
ecx = -1 - get information on the current thread
Returned value:
- eax = maximum number of the slot of a thread
- buffer pointed to by ebx contains the following information:
- +0: dword: usage of the processor (how many time units
per second leaves on execution of this thread)
- +4: word: position of the window of thread in the window stack
- +6: word: (has no relation to the specified thread)
number of the thread slot, which window has in the window stack
position ecx
- +8: word: reserved
- +10 = +0xA: 11 bytes: name of the process
(name of corresponding executable file in the format 8+3)
- +21 = +0x15: byte: reserved, this byte is not changed
- +22 = +0x16: dword: address of the process in memory
- +26 = +0x1A: dword: size of used memory - 1
- +30 = +0x1E: dword: identifier (PID/TID)
- +34 = +0x22: dword: coordinate of the thread window on axis x
- +38 = +0x26: dword: coordinate of the thread window on axis y
- +42 = +0x2A: dword: size of the thread window on axis x
- +46 = +0x2E: dword: size of the thread window on axis y
- +50 = +0x32: word: status of the thread slot:
- 0 = thread is running
- 1 = thread is suspended
- 2 = thread is suspended while waiting for event
- 3 = thread is terminating as a result of call to function -1
or under duress as a result of call to subfunction 2
of function 18 or termination of the system
- 4 = thread is terminating as a result of exception
- 5 = thread waits for event
- 9 = requested slot is free, all other information on the slot
is not meaningful
- +52 = +0x34: word: reserved, this word is not changed
- +54 = +0x36: dword: coordinate of the client area on axis x
- +58 = +0x3A: dword: coordinate of the client area on axis y
- +62 = +0x3E: dword: width of the client area
- +66 = +0x42: dword: height of the client area
- +70 = +0x46: byte: state of the window - bitfield
- bit 0 (mask 1): window is maximized
- bit 1 (mask 2): window is minimized to panel
- bit 2 (mask 4): window is rolled up
Remarks:
- Slots are numbered starting from 1.
- Returned value is not a total number of threads, because there
can be free slots.
- When process is starting, system automatically creates
execution thread.
- Function gives information on the thread. Each process has
at least one thread. One process can create many threads,
in this case each thread has its own slot and the fields
+10, +22, +26 in these slots coincide.
Applications have no common way to define whether two threads
belong to one process.
- The active window - window on top of the window stack -
receives the messages on a keyboard input. For such window
the position in the window stack coincides with returned value.
- Slot 1 corresponds to special system thread, for which:
- the window is in the bottom of the window stack, the fields
+4 and +6 contain value 1
- name of the process - "OS/IDLE" (supplemented by spaces)
- address of the process in memory is 0, size of used memory is
16 Mb (0x1000000)
- PID=1
- coordinates and sizes of the window and the client area are by
convention set to 0
- status of the slot is always 0 (running)
- the execution time adds of time leaving on operations itself
and idle time in waiting for interrupt (which can be got by call
to subfunction 4 of function 18).
- Beginning from slot 2, the normal applications are placed.
- The normal applications are placed in memory at the address
0x10000000 (kernel constand 'std_application_base_address').
There is no intersection, as each process has its own page table.
- At creation of the thread it is assigned the slot
in the system table and identifier (Process/Thread IDentifier =
PID/TID), which do not vary with time for given thread.
After completion of the thread its slot can be anew used
for another thread. The thread identifier can not be assigned
to other thread even after completion of this thread.
Identifiers, assigned to new threads, grow monotonously.
- If the thread has not yet defined the window by call to
function 0, the position and the sizes
of its window are considered to be zero.
- Coordinates of the client area are relative to the window.
- At the moment only the part of the buffer by a size
71 = 0x37 bytes is used. Nevertheless it is recommended to use
1-Kb buffer for the future compatibility, in the future
some fields can be added.