source: trunk/src/win32k/include/ldr.h@ 847

Last change on this file since 847 was 847, checked in by bird, 26 years ago

Initial checkin of Win32k. (not tested & pe2lx not up-to-date!)

File size: 3.1 KB
Line 
1/* $Id: ldr.h,v 1.1 1999-09-06 02:19:58 bird Exp $
2 *
3 * ldr - loader header file.
4 *
5 * Copyright (c) 1999 knut St. osmundsen
6 *
7 */
8
9
10#ifndef _ldr_h_
11#define _ldr_h_
12 #ifndef LDR_INCL_INITONLY
13 /* state variable */
14 extern BOOL fQAppType;
15
16 /***************************************************************/
17 /* handle state - Array of handle states. Four state per byte! */
18 /***************************************************************/
19 #define MAX_FILE_HANDLES 0x10000
20
21 extern unsigned char ahStates[MAX_FILE_HANDLES/4];
22
23 #define HSTATE_UNUSED 0x00 /* nowhere */
24 #define HSTATE_CHECK 0x01 /* look in uncertain files */
25 #define HSTATE_NOT_PE 0x02 /* nowhere */
26 #define HSTATE_PE 0x03 /* look in PE handles */
27 #define HSTATE_MASK 0xFC
28 #define HSTATE_UMASK 0x03
29
30 #define GetState(a) (HSTATE_UMASK & (ahStates[a/4] >> (a%4)*2))
31 #define SetState(a,b) (ahStates[a/4] = (ahStates[a/4] & (HSTATE_MASK << (a%4)*2 | HSTATE_MASK >> 8-(a%4)*2) | b << (a%4)*2))
32
33
34
35 /*********************/
36 /* uncertain file(s) */
37 /*********************/
38 #define MAX_UNCERTAIN_FILES 0x10 /* probably never more that one uncertain file at the time */
39
40 typedef struct _uncertain
41 {
42 SFN hFile;
43 ULONG offsetNEHdr;
44 PSZ pszName;
45 unsigned int fMZ:1;
46 unsigned int fPE:1;
47 } UNCERTAIN, *PUNCERTAIN;
48
49 extern UNCERTAIN ahUncertain[MAX_UNCERTAIN_FILES];
50
51 ULONG getFreeUncertainEntry(void);
52 ULONG freeUncertainEntry(SFN hFile);
53 ULONG findUncertainEntry(SFN hFile);
54
55
56 /**************/
57 /* PE handles */
58 /**************/
59 typedef struct _PENode
60 {
61 /* linking stuff */
62 struct _PENode *left;
63 struct _PENode *right;
64
65 /* key */
66 SFN hFile; /* system file number or file handle if you prefer that */
67
68 /* misc */
69 PMTE pMTE; /* pointer to MTE if we got one - may be NULL */
70
71 /* LXFile object */
72 LXFile lxfile;
73 } PENODE, *PPENODE;
74
75 #define SIZEOF_NODE (sizeof(NODE))
76
77 ULONG insertNode(PPENODE pNode);
78 ULONG deleteNode(SFN key);
79 PPENODE getNodePtr(SFN key);
80 PPENODE findNodePtr(const char *pszFilename);
81 ULONG depthPE(void);
82 PPENODE allocateNode(void);
83
84 /* if sequential insertion - this will give a lower tree. */
85 /* testing shows that 3 gives best results for 27 to 134 nodes */
86 #define ROTATION 3
87 #define AdjustKey(a) ((USHORT)(a << 16-ROTATION) | (USHORT)(a >> ROTATION) )
88 #define UnAdjustKey(a) ((USHORT)(a >> 16-ROTATION) | (USHORT)(a << ROTATION) )
89
90 #endif
91 /*************/
92 /* functions */
93 /*************/
94 #ifdef __cplusplus
95 extern "C" {
96 #endif
97
98 ULONG ldrInit(void);
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #pragma pack()
105
106#endif
Note: See TracBrowser for help on using the repository browser.