Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

658 lines
19 KiB

  1. /*
  2. * KERNEL.H - C header file for all C kernel files
  3. *
  4. */
  5. /*
  6. * The following is defined as the null string as the kernel is compiled
  7. * with the -PLM switch
  8. */
  9. #ifndef PASCAL
  10. #define PASCAL
  11. #endif
  12. #define BUILDDLL 1
  13. #define PMODE 1
  14. /*
  15. * Define the following non-zero and the debugging support in the kernel
  16. * is enabled
  17. */
  18. #ifndef WINDEBUG
  19. #define KDEBUG 0
  20. #else
  21. #define KDEBUG 1
  22. #endif
  23. #ifdef ROMWIN
  24. #define ROM 1
  25. #else
  26. #define ROM 0
  27. #endif
  28. /* Register definition. */
  29. #define REG
  30. #define LONG long
  31. #define NULL 0
  32. /* Define common constants. */
  33. #define TRUE 1
  34. #define FALSE 0
  35. /* Far and Near dummy pointer attributes. */
  36. #define FAR far
  37. #define NEAR near
  38. typedef char far *FARP;
  39. typedef char *NEARP;
  40. typedef char far *LPSTR;
  41. typedef char *PSTR;
  42. typedef int ( far PASCAL * FARPROC )();
  43. typedef int ( near PASCAL * NEARPROC )();
  44. /* Standard types. */
  45. typedef unsigned long DWORD;
  46. typedef unsigned short int WORD;
  47. typedef WORD *pWORD;
  48. typedef unsigned char BYTE;
  49. typedef int BOOL;
  50. #define VOID void
  51. typedef WORD HANDLE;
  52. typedef struct {
  53. WORD Offset;
  54. WORD Segment;
  55. } FARADDR;
  56. typedef FARADDR *pFARADDR;
  57. /*
  58. * Internel near kernel procedures
  59. */
  60. FARPROC StartProcAddress( HANDLE, int );
  61. HANDLE StartTask( HANDLE, HANDLE, HANDLE, FARPROC );
  62. HANDLE StartLibrary( HANDLE, FARP, FARPROC );
  63. HANDLE FindExeInfo( FARP, WORD );
  64. FARP GetStringPtr( HANDLE, int, WORD );
  65. HANDLE AddModule( HANDLE );
  66. HANDLE DelModule( HANDLE );
  67. void IncExeUsage( HANDLE );
  68. void DecExeUsage( HANDLE );
  69. void PreloadResources( HANDLE, int );
  70. HANDLE GetExePtr( HANDLE );
  71. DWORD GetStackPtr( HANDLE );
  72. WORD GetInstance( HANDLE );
  73. HANDLE LoadExeHeader( int, int, FARP );
  74. HANDLE TrimExeHeader( HANDLE );
  75. int AllocAllSegs( HANDLE );
  76. HANDLE LoadSegment( HANDLE, WORD, int, int );
  77. WORD MyLock( HANDLE );
  78. HANDLE MyFree( HANDLE );
  79. HANDLE MyResAlloc( HANDLE, WORD, WORD, WORD );
  80. /*
  81. * Undocumented, exported kernel procedures
  82. */
  83. #if KDEBUG
  84. #ifdef WOW
  85. LPSTR far GetDebugString( int );
  86. #else
  87. LPSTR GetDebugString( int );
  88. #endif
  89. BOOL far PASCAL GlobalInit( WORD, WORD, WORD, WORD );
  90. WORD far * PASCAL GlobalInfoPtr( void );
  91. #define GlobalFreeze( dummy ) ( *(GlobalInfoPtr()+1) += 1 )
  92. #define GlobalMelt( dummy ) ( *(GlobalInfoPtr()+1) -= 1 )
  93. #endif
  94. void PASCAL PatchStack( WORD far *, WORD, WORD );
  95. WORD far * PASCAL SearchStack( WORD far *, WORD );
  96. int far PASCAL SetPriority( HANDLE, int );
  97. HANDLE far PASCAL LockCurrentTask( BOOL );
  98. HANDLE far PASCAL GetTaskQueue( HANDLE );
  99. HANDLE far PASCAL SetTaskQueue( HANDLE, HANDLE );
  100. WORD far PASCAL GetCurrentPDB( void );
  101. WORD far PASCAL BuildPDB( WORD, WORD, FARP, WORD );
  102. void far PASCAL EnableDOS( void );
  103. void far PASCAL DisableDOS( void );
  104. BOOL far PASCAL IsScreenGrab( void );
  105. HANDLE far PASCAL CreateTask( DWORD, FARP, HANDLE);
  106. HANDLE far PASCAL GetDSModule( WORD );
  107. HANDLE far PASCAL GetDSInstance( WORD );
  108. void far PASCAL CallProcInstance( void );
  109. FARPROC far PASCAL SetTaskSignalProc( HANDLE, FARPROC );
  110. FARPROC far PASCAL SetTaskSwitchProc( HANDLE, FARPROC );
  111. FARPROC far PASCAL SetTaskInterchange( HANDLE, FARPROC );
  112. void far PASCAL ExitKernel( int );
  113. /*
  114. * Exported procedures for KERNEL module
  115. */
  116. /*
  117. * Interface to FatalExit procedure
  118. */
  119. void far PASCAL FatalExit( int );
  120. void far PASCAL ValidateCodeSegments();
  121. /* Interface to Catch and Throw procedures */
  122. typedef int CATCHBUF[ 9 ];
  123. typedef int FAR *LPCATCHBUF;
  124. int FAR PASCAL Catch( LPCATCHBUF );
  125. void FAR PASCAL Throw( LPCATCHBUF, int );
  126. /*
  127. * Interface to local memory manager
  128. */
  129. #define LMEM_FIXED 0x0000
  130. #define LMEM_MOVEABLE 0x0002
  131. #define LMEM_NOCOMPACT 0x0010
  132. #define LMEM_NODISCARD 0x0020
  133. #define LMEM_ZEROINIT 0x0040
  134. #define LMEM_MODIFY 0x0080
  135. #define LMEM_DISCARDABLE 0x0F00
  136. #define LNOTIFY_OUTOFMEM 0
  137. #define LNOTIFY_MOVE 1
  138. #define LNOTIFY_DISCARD 2
  139. BOOL far PASCAL LocalInit( WORD, char *, char * );
  140. HANDLE far PASCAL LocalAlloc( WORD, WORD );
  141. HANDLE far PASCAL LocalReAlloc( HANDLE, WORD, WORD );
  142. HANDLE far PASCAL LocalFree( HANDLE );
  143. char * far PASCAL LocalLock( HANDLE );
  144. BOOL far PASCAL LocalUnlock( HANDLE );
  145. WORD far PASCAL LocalSize( HANDLE );
  146. HANDLE far PASCAL LocalHandle( WORD );
  147. WORD far PASCAL LocalCompact( WORD );
  148. FARPROC far PASCAL LocalNotify( FARPROC );
  149. int far PASCAL LocalNotifyDefault( int, HANDLE, WORD );
  150. #define LocalDiscard( h ) LocalReAlloc( h, 0, LMEM_MOVEABLE )
  151. extern WORD * PASCAL pLocalHeap;
  152. #define dummy 0
  153. #define LocalFreeze( dummy ) ( *(pLocalHeap+1) += 1 )
  154. #define LocalMelt( dummy ) ( *(pLocalHeap+1) -= 1 )
  155. #define LocalHandleDelta( delta ) ( (delta) ? (*(pLocalHeap+9) = (delta)) : *(pLocalHeap+9))
  156. #define calloc( n,size ) LocalAlloc( LMEM_ZEROINIT, n*(size) )
  157. #define malloc( size ) LocalAlloc( 0, size )
  158. #define free( p ) LocalFree( p )
  159. #define realloc( p, size ) LocalReAlloc( p, size, LMEM_ZEROINIT )
  160. /*
  161. * Interface to global memory manager
  162. */
  163. #define GMEM_FIXED 0x0000
  164. #define GMEM_ALLOCHIGH 0x0001 /* Kernel use only */
  165. #define GMEM_MOVEABLE 0x0002
  166. #define GMEM_DISCCODE 0x0004
  167. #define GMEM_NOCOMPACT 0x0010
  168. #define GMEM_NODISCARD 0x0020
  169. #define GMEM_ZEROINIT 0x0040
  170. #define GMEM_MODIFY 0x0080
  171. #define GMEM_DISCARDABLE 0x0100
  172. #define GMEM_SHARE 0x1000
  173. #define GMEM_SHAREALL 0x2000
  174. #define GNOTIFY_OUTOFMEM 0
  175. #define GNOTIFY_MOVE 1
  176. #define GNOTIFY_DISCARD 2
  177. #define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))
  178. #define LOWORD(l) ((WORD)(DWORD)(l))
  179. HANDLE far PASCAL GlobalAlloc( WORD, DWORD );
  180. HANDLE far PASCAL GlobalReAlloc( HANDLE, DWORD, WORD );
  181. HANDLE far PASCAL GlobalFree( HANDLE );
  182. HANDLE far PASCAL GlobalFreeAll( WORD );
  183. char far * far PASCAL GlobalLock( HANDLE );
  184. BOOL far PASCAL GlobalUnlock( HANDLE );
  185. DWORD far PASCAL GlobalSize( HANDLE );
  186. DWORD far PASCAL GlobalHandle( WORD );
  187. DWORD far PASCAL GlobalHandleNoRIP( WORD );
  188. HANDLE far PASCAL LockSegment( WORD );
  189. HANDLE far PASCAL UnlockSegment( WORD );
  190. DWORD far PASCAL GlobalCompact( DWORD );
  191. #define LockData( dummy ) LockSegment( 0xFFFF )
  192. #define UnlockData( dummy ) UnlockSegment( 0xFFFF )
  193. #define GlobalDiscard( h ) GlobalReAlloc( h, 0L, GMEM_MOVEABLE )
  194. /*
  195. * Interface to the task scheduler
  196. */
  197. BOOL far PASCAL Yield( void );
  198. BOOL far PASCAL WaitEvent( HANDLE );
  199. BOOL far PASCAL PostEvent( HANDLE );
  200. HANDLE far PASCAL GetCurrentTask( void );
  201. BOOL far PASCAL KillTask( HANDLE );
  202. /*
  203. * Interface to the dynamic loader/linker
  204. */
  205. HANDLE far PASCAL LoadModule( LPSTR, LPSTR );
  206. void far PASCAL FreeModule( HANDLE );
  207. HANDLE far PASCAL GetModuleHandle( LPSTR );
  208. FARPROC far PASCAL GetProcAddress( HANDLE, LPSTR );
  209. FARPROC far PASCAL MakeProcInstance( FARPROC, HANDLE );
  210. void far PASCAL FreeProcInstance( FARPROC );
  211. int far PASCAL GetInstanceData( HANDLE, PSTR, int );
  212. int far PASCAL GetModuleUsage( HANDLE );
  213. int far PASCAL GetModuleFileName( HANDLE, LPSTR, int );
  214. /*
  215. * Interface to the resource manager
  216. */
  217. HANDLE far PASCAL FindResource( HANDLE, LPSTR, LPSTR );
  218. HANDLE far PASCAL LoadResource( HANDLE, HANDLE );
  219. BOOL far PASCAL FreeResource( HANDLE );
  220. char far * far PASCAL LockResource( HANDLE );
  221. FARPROC far PASCAL SetResourceHandler( HANDLE, LPSTR, FARPROC );
  222. HANDLE far PASCAL AllocResource( HANDLE, HANDLE, DWORD );
  223. WORD far PASCAL SizeofResource( HANDLE, HANDLE );
  224. int far PASCAL AccessResource( HANDLE, HANDLE );
  225. #define MAKEINTRESOURCE(i) (LPSTR)((unsigned long)((WORD)i))
  226. /* Predefined resource types */
  227. #define RT_CURSOR MAKEINTRESOURCE( 1 )
  228. #define RT_BITMAP MAKEINTRESOURCE( 2 )
  229. #define RT_ICON MAKEINTRESOURCE( 3 )
  230. #define RT_MENU MAKEINTRESOURCE( 4 )
  231. #define RT_DIALOG MAKEINTRESOURCE( 5 )
  232. #define RT_STRING MAKEINTRESOURCE( 6 )
  233. #define RT_FONTDIR MAKEINTRESOURCE( 7 )
  234. #define RT_FONT MAKEINTRESOURCE( 8 )
  235. /*
  236. * Interface to the user profile
  237. int far PASCAL GetProfileInt( LPSTR, LPSTR, int );
  238. int far PASCAL GetProfileString( LPSTR, LPSTR, LPSTR, LPSTR, int );
  239. void far PASCAL WriteProfileString( LPSTR, LPSTR, LPSTR );
  240. */
  241. /*
  242. * Interface to the atom manager
  243. */
  244. typedef WORD ATOM;
  245. BOOL far PASCAL InitAtomTable( int );
  246. ATOM far PASCAL FindAtom( LPSTR );
  247. ATOM far PASCAL AddAtom( LPSTR );
  248. ATOM far PASCAL DeleteAtom( ATOM );
  249. WORD far PASCAL GetAtomName( ATOM, LPSTR, int );
  250. HANDLE far PASCAL GetAtomHandle( ATOM );
  251. #define MAKEINTATOM(i) (LPSTR)((unsigned long)((WORD)i))
  252. #define ATOMSTRUC struct atomstruct
  253. typedef ATOMSTRUC *PATOM;
  254. typedef ATOMSTRUC {
  255. PATOM chain;
  256. WORD usage; /* Atoms are usage counted. */
  257. BYTE len; /* length of ASCIZ name string */
  258. BYTE name; /* beginning of ASCIZ name string */
  259. } ATOMENTRY;
  260. typedef struct {
  261. int numEntries;
  262. PATOM pAtom[ 1 ];
  263. } ATOMTABLE;
  264. extern ATOMTABLE * PASCAL pAtomTable;
  265. /*
  266. * Interface to the string functions
  267. */
  268. int far PASCAL lstrcmp( LPSTR, LPSTR );
  269. LPSTR far PASCAL lstrcpy( LPSTR, LPSTR );
  270. LPSTR far PASCAL lstrcat( LPSTR, LPSTR );
  271. int far PASCAL lstrlen( LPSTR );
  272. LPSTR far PASCAL lstrbscan( LPSTR, LPSTR );
  273. LPSTR far PASCAL lstrbskip( LPSTR, LPSTR );
  274. /*
  275. * Interface to the file I/O functions
  276. */
  277. int far PASCAL OpenPathname( LPSTR, int );
  278. int far PASCAL DeletePathname( LPSTR );
  279. int far PASCAL _lopen( LPSTR, int );
  280. void far PASCAL _lclose( int );
  281. int far PASCAL _lcreat( LPSTR, int );
  282. LONG far PASCAL _llseek( int, long, int );
  283. WORD far PASCAL _lread( int, LPSTR, int );
  284. WORD far PASCAL _lwrite( int, LPSTR, int );
  285. BOOL FAR PASCAL AnsiToOem( LPSTR, LPSTR );
  286. BOOL FAR PASCAL OemToAnsi( LPSTR, LPSTR );
  287. BYTE FAR PASCAL AnsiUpper( LPSTR );
  288. BYTE FAR PASCAL AnsiLower( LPSTR );
  289. LPSTR FAR PASCAL AnsiNext( LPSTR );
  290. LPSTR FAR PASCAL AnsiPrev( LPSTR, LPSTR );
  291. typedef struct {
  292. BYTE cBytes; /* length of structure */
  293. BYTE fFixedDisk; /* non-zero if file located on non- */
  294. /* removeable media */
  295. WORD nErrCode; /* DOS error code if OpenFile fails */
  296. BYTE reserved[ 4 ];
  297. BYTE szPathName[ 128 ];
  298. } OFSTRUCT;
  299. typedef OFSTRUCT *POFSTRUCT;
  300. typedef OFSTRUCT NEAR *NPOFSTRUCT;
  301. typedef OFSTRUCT FAR *LPOFSTRUCT;
  302. int FAR PASCAL GetTempFileName( BYTE, LPSTR, WORD, LPSTR );
  303. int FAR PASCAL OpenFile( LPSTR, LPOFSTRUCT, WORD );
  304. int NEAR PASCAL MyOpenFile( LPSTR, LPOFSTRUCT, WORD );
  305. /* Flags for GetTempFileName */
  306. #define TF_FORCEDRIVE (BYTE)0x80 /* Forces use of current dir of passed */
  307. /* drive */
  308. /* Flags for OpenFile */
  309. #define OF_REOPEN 0x8000
  310. #define OF_EXIST 0x4000
  311. #define OF_PROMPT 0x2000
  312. #define OF_CREATE 0x1000
  313. #define OF_CANCEL 0x0800
  314. #define OF_VERIFY 0x0400
  315. #define OF_DELETE 0x0200
  316. /* Can use these with _lopen too */
  317. #define OF_SHARE_COMPAT 0x00
  318. #define OF_SHARE_EXCLUSIVE 0x10
  319. #define OF_SHARE_DENY_WRITE 0x20
  320. #define OF_SHARE_DENY_READ 0x30
  321. #define OF_SHARE_DENY_NONE 0x40
  322. #define OF_NO_INHERIT 0x80
  323. #define READ 0 /* Flags for _lopen */
  324. #define WRITE 1
  325. #define READ_WRITE 2
  326. #if KDEBUG
  327. int PASCAL KernelError( int, LPSTR, LPSTR );
  328. void far PASCAL FarKernelError( int, LPSTR, LPSTR );
  329. #else
  330. #define FarKernelError( a, b, c ) FatalExit( a )
  331. #endif
  332. /* See KERNEL.INC for parallel definitions */
  333. #define ERR_LMEM 0x0100 /* Local memory manager errors */
  334. #define ERR_GMEM 0x0200 /* Global memory manager errors */
  335. #define ERR_TASK 0x0300 /* Task scheduler errors */
  336. #define ERR_LD 0x0400 /* Dynamic loader/linker errors */
  337. #define ERR_LDBOOT 0x0401 /* Error booting */
  338. #define ERR_LDLOAD 0x0401 /* Unable to load a file */
  339. #define ERR_RESMAN 0x0500 /* Resource manager errors */
  340. #define ERR_MISSRES 0x0501 /* Missing resource table */
  341. #define ERR_BADRESTYPE 0x0502 /* Bad resource type */
  342. #define ERR_BADRESNAME 0x0503 /* Bad resource name */
  343. #define ERR_BADRESFILE 0x0504 /* Bad resource file */
  344. #define ERR_BADDEFAULT 0x0506 /* Bad parameter to profile routine */
  345. #define ERR_ATOM 0x0600 /* Atom manager errors */
  346. #define ERR_IO 0x0700 /* I/O package errors */
  347. #define ERR_PARAMETER 0x0800 /* Parameter checking RIP */
  348. #define HE_DISCARDED 0x40
  349. #define HE_SHAREALL 0x20
  350. #define HE_SHARE 0x10
  351. #define HE_DISCARDABLE 0x0F
  352. #define HE_FREEHANDLE 0xFFFF
  353. #define LHE_DISCARDED 0x40
  354. #define LHE_SHAREALL 0x20
  355. #define LHE_SHARE 0x10
  356. #define LHE_DISCARDABLE 0x0F
  357. #define LHE_FREEHANDLE 0xFFFF
  358. #define HANDLEENTRY struct handleentry
  359. #define HANDLETABLE struct handletable
  360. #define LOCALHANDLEENTRY struct localhandleentry
  361. #define LOCALHANDLETABLE struct localhandletable
  362. #define FREEHANDLEENTRY struct freehandleentry
  363. #define LOCALFREEHANDLEENTRY struct localfreehandleentry
  364. HANDLEENTRY {
  365. WORD he_address;
  366. BYTE he_flags;
  367. BYTE he_seg_no;
  368. };
  369. typedef HANDLEENTRY *PHANDLEENTRY;
  370. HANDLETABLE {
  371. WORD ht_count;
  372. HANDLEENTRY ht_entry[ 1 ];
  373. };
  374. typedef HANDLETABLE *PHANDLETABLE;
  375. LOCALHANDLEENTRY {
  376. WORD lhe_address;
  377. BYTE lhe_flags;
  378. BYTE lhe_count;
  379. };
  380. typedef LOCALHANDLEENTRY *PLOCALHANDLEENTRY;
  381. LOCALHANDLETABLE {
  382. WORD ht_count;
  383. LOCALHANDLEENTRY ht_entry[ 1 ];
  384. };
  385. typedef LOCALHANDLETABLE *PLOCALHANDLETABLE;
  386. FREEHANDLEENTRY {
  387. WORD he_link;
  388. WORD he_free;
  389. };
  390. typedef FREEHANDLEENTRY *PFREEHANDLEENTRY;
  391. LOCALFREEHANDLEENTRY {
  392. WORD lhe_link;
  393. WORD lhe_free;
  394. };
  395. typedef LOCALFREEHANDLEENTRY *PLOCALFREEHANDLEENTRY;
  396. #define LOCALARENA struct localarena
  397. LOCALARENA {
  398. LOCALARENA *la_prev;
  399. LOCALARENA *la_next;
  400. LOCALHANDLEENTRY *la_handle;
  401. };
  402. typedef LOCALARENA *PLOCALARENA;
  403. #define LOCALARENAFREE struct localarenafree
  404. LOCALARENAFREE {
  405. LOCALARENAFREE *la_prev; /* previous block */
  406. LOCALARENAFREE *la_next; /* next block */
  407. int la_size; /* size of block (includes header) */
  408. LOCALARENAFREE *ls_free_prev; /* previous free entry */
  409. LOCALARENAFREE *la_free_next; /* next free entry */
  410. };
  411. typedef LOCALARENAFREE *PLOCALARENAFREE;
  412. #define LOCALSTATS struct localstats
  413. LOCALSTATS {
  414. WORD ls_ljoin;
  415. WORD ls_falloc;
  416. WORD ls_fexamine;
  417. WORD ls_fcompact;
  418. WORD ls_ffound;
  419. WORD ls_ffoundne;
  420. WORD ls_malloc;
  421. WORD ls_mexamine;
  422. WORD ls_mcompact;
  423. WORD ls_mfound;
  424. WORD ls_mfoundne;
  425. WORD ls_fail;
  426. WORD ls_lcompact;
  427. WORD ls_cloop;
  428. WORD ls_cexamine;
  429. WORD ls_cfree;
  430. WORD ls_cmove;
  431. };
  432. typedef struct {
  433. WORD hi_check;
  434. WORD hi_freeze;
  435. WORD hi_count;
  436. PLOCALARENA hi_first;
  437. PLOCALARENA hi_last;
  438. BYTE hi_ncompact;
  439. BYTE hi_dislevel;
  440. WORD hi_distotal;
  441. LOCALHANDLETABLE *hi_htable;
  442. LOCALHANDLEENTRY *hi_hfree;
  443. WORD hi_hdelta;
  444. NEARPROC hi_hexpand;
  445. LOCALSTATS *hi_pstats;
  446. FARPROC li_notify;
  447. WORD li_lock;
  448. WORD li_extra;
  449. WORD li_minsize;
  450. } LOCALINFO;
  451. typedef LOCALINFO *PLOCALINFO;
  452. #define LA_BUSY 1
  453. #define LA_MOVEABLE 2
  454. #define LA_ALIGN (LA_MOVEABLE+LA_BUSY)
  455. #define LA_MASK (~ LA_ALIGN)
  456. typedef HANDLEENTRY far *LPHANDLEENTRY;
  457. typedef HANDLETABLE far *LPHANDLETABLE;
  458. typedef FREEHANDLEENTRY far *LPFREEHANDLEENTRY;
  459. typedef LOCALHANDLEENTRY far *LPLOCALHANDLEENTRY;
  460. typedef LOCALHANDLETABLE far *LPLOCALHANDLETABLE;
  461. typedef LOCALFREEHANDLEENTRY far *LPLOCALFREEHANDLEENTRY;
  462. #define GLOBALARENA struct globalarena
  463. GLOBALARENA {
  464. BYTE ga_count;
  465. WORD ga_owner;
  466. WORD ga_size;
  467. BYTE ga_flags;
  468. WORD ga_prev;
  469. WORD ga_next;
  470. HANDLEENTRY *ga_handle;
  471. HANDLEENTRY *ga_lruprev;
  472. HANDLEENTRY *ga_lrunext;
  473. };
  474. #define ga_sig ga_count
  475. typedef GLOBALARENA far *LPGLOBALARENA;
  476. typedef struct {
  477. WORD hi_check;
  478. WORD hi_freeze;
  479. WORD hi_count;
  480. WORD hi_first;
  481. WORD hi_last;
  482. BYTE hi_ncompact;
  483. BYTE hi_dislevel;
  484. WORD hi_distotal;
  485. HANDLETABLE *hi_htable;
  486. HANDLEENTRY *hi_hfree;
  487. WORD hi_hdelta;
  488. NEARPROC hi_hexpand;
  489. WORD *hi_pstats;
  490. WORD gi_lrulock;
  491. HANDLEENTRY *gi_lruchain;
  492. WORD gi_lrucount;
  493. WORD gi_reserve;
  494. WORD gi_disfence;
  495. WORD gi_alt_first;
  496. WORD gi_alt_last;
  497. WORD gi_alt_count;
  498. HANDLEENTRY *gi_alt_lruchain;
  499. WORD gi_alt_lrucount;
  500. WORD gi_alt_reserve;
  501. WORD gi_alt_disfence;
  502. } GLOBALINFO;
  503. typedef GLOBALINFO far *LPGLOBALINFO;
  504. #define GA_SIGNATURE 0x4D
  505. #define GA_ENDSIG 0x5A
  506. #define GA_FIXED 1
  507. #define GA_ALIGN GA_FIXED
  508. #define GA_MASK (~ GA_ALIGN)
  509. #define lpGlobalArena( w ) (LPGLOBALARENA)((DWORD)(w) << 16)
  510. #define lpHandleEntry( w ) (LPHANDLEENTRY)(pMaster | (WORD)(w))
  511. #define lpHandleTable( w ) (LPHANDLETABLE)(pMaster | (WORD)(w))
  512. /*
  513. * Structure passed between user profile routines
  514. */
  515. typedef struct {
  516. LPSTR lpProFile; /* Pointer to INI filename */
  517. LPSTR lpBuffer; /* Pointer to buffer containing file */
  518. int hBuffer; /* Handle of buffer */
  519. unsigned BufferLen; /* Length of buffer */
  520. int FileHandle; /* File handle - -1 if not open */
  521. int ProFlags; /* Open, writing etc */
  522. WORD wClusterSize; /* Cluster size on this drive */
  523. OFSTRUCT ProBuf; /* OpenFile info */
  524. } PROINFO;
  525. /* WinFlags[0] */
  526. #define WF_PMODE 0x01 /* Windows is running in Protected Mode */
  527. #define WF_CPU286 0x02 /* Windows is running on an 80286 cpu */
  528. #define WF_CPU386 0x04 /* " " " " " 80386 cpu */
  529. #define WF_CPU486 0x08 /* Windows is running on an 80486 cpu */
  530. #define WF_STANDARD 0x10 /* Running Windows/286 */
  531. #define WF_ENHANCED 0x20 /* Running Windows/386 */
  532. #define WF_CPU086 0x40 /* Windows is running on an 8086 cpu */
  533. #define WF_CPU186 0x80 /* Windows is running on an 80186 cpu */
  534. /* WinFlags[1] */
  535. #define WF1_LARGEFRAME 0x01 /* Running in EMS small frame */
  536. #define WF1_SMALLFRAME 0x02 /* Running in EMS large frame */
  537. #define WF1_80x87 0x04 /* There is a co-processor present */
  538. #ifndef WINDEBUG
  539. #include "ikernel.h"
  540. #endif