source: trunk/src/win32k/misc/OS2KTCB.c@ 5120

Last change on this file since 5120 was 4787, checked in by bird, 25 years ago

Changed email address... (may some dll fixes changes too.)

File size: 3.4 KB
Line 
1/* $Id: OS2KTCB.c,v 1.3 2000-12-11 06:53:54 bird Exp $
2 *
3 * TCB - Thread Control Block access methods.
4 *
5 * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10
11
12/*******************************************************************************
13* Header Files *
14*******************************************************************************/
15#include <os2.h>
16#include <OS2KTCB.h>
17#include "devSegDf.h" /* Win32k segment definitions. */
18#include "options.h"
19
20
21/*******************************************************************************
22* External Data *
23*******************************************************************************/
24/*
25 * Requires the following import(s):
26 * pTCBCur
27 */
28
29
30/*******************************************************************************
31* Global Variables *
32*******************************************************************************/
33int offTCBFailErr = 0;
34
35
36
37/*******************************************************************************
38* Internal Functions *
39*******************************************************************************/
40static BOOL initTCB(void);
41
42
43/**
44 * Init the TCB offset(s).
45 * @returns Success indicator. (TRUE = success; FALSE = failure)
46 */
47static BOOL initTCB(void)
48{
49 /*
50 * !!IMPORTANT!!
51 * Please note that when we don't define top limits here. New fixpack may have
52 * other values. But since they very seldom do, we'll gamble on no change!
53 * (Applies to Warp 3 and WS4eB)
54 * !!IMPORTANT!!
55 *
56 * These values are derived from the kernel[d].SDFs and SG24-4640-00.
57 */
58
59 /* WS4eB GA and above. */
60 if (options.ulBuild >= 14039)
61 {
62 offTCBFailErr = isSMPKernel() ? 0x1fa : 0x1ea;
63 }
64 else /* Warp 4 GA - fp12 */
65 if (options.ulBuild >= 9023 && options.ulBuild <= 9036)
66 {
67 offTCBFailErr = 0x18e;
68 }
69 else /* Warp 3 fp32 - fp62. */
70 if (options.ulBuild >= 8255 && options.ulBuild <= 8285)
71 {
72 offTCBFailErr = isSMPKernel() ? 0x1ba : 0x14e;
73 }
74 else
75 return FALSE;
76 return TRUE;
77}
78
79
80
81/**
82 * Get the content of the TCB data member TCBFailErr.
83 * Intended used to save and restore the value in ldrOpenPath.
84 * @returns Value of TCBFaileErr. (0xffff on error)
85 * @param pTCB Pointer to TCB.
86 * @remark Only known kernels are supported!
87 */
88USHORT tcbGetTCBFailErr(PTCB pTCB)
89{
90 if (offTCBFailErr == 0 || !initTCB())
91 return 0xffff;
92
93 return *(PUSHORT)(void*)((char*)(void*)pTCB + offTCBFailErr);
94}
95
96
97
98/**
99 * Set the content of the TCB data member TCBFailErr.
100 * Intended used to save and restore the value in ldrOpenPath.
101 * @returns New Value of TCBFaileErr. (0xffff on error)
102 * @param pTCB Pointer to TCB.
103 * @param TCBFAileErr New value. (or rather the old one in the save-restore case..)
104 * @remark Only known kernels are supported!
105 */
106USHORT tcbSetTCBFailErr(PTCB pTCB, USHORT TCBFailErr)
107{
108 if (offTCBFailErr == 0 || !initTCB())
109 return 0xffff;
110
111 return *(PUSHORT)(void*)((char*)(void*)pTCB + offTCBFailErr) = TCBFailErr;
112}
113
114
Note: See TracBrowser for help on using the repository browser.