source: trunk/src/win32k/kKrnlLib/include/OS2KLDR.h

Last change on this file was 8170, checked in by bird, 24 years ago

Corrected some case problems. (linking is now case sensitive!)

File size: 27.4 KB
Line 
1/* $Id: OS2KLDR.h,v 1.5 2002-04-01 12:45:00 bird Exp $
2 *
3 * OS/2 kernel Loader Stuff.
4 *
5 * Copyright (c) 2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10
11#ifndef _OS2KLDR_H_
12#define _OS2KLDR_H_
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#pragma pack(1)
19
20
21/*******************************************************************************
22* Structures and Typedefs *
23*******************************************************************************/
24typedef struct OTE
25{
26 ULONG ote_size; /* Object virtual size */
27 ULONG ote_base; /* Object base virtual address */
28 ULONG ote_flags; /* Attribute flags */
29 ULONG ote_pagemap; /* Object page map index */
30 ULONG ote_mapsize; /* Num of entries in obj page map */
31 USHORT ote_sel; /* Object Selector */
32 USHORT ote_hob; /* Object Handle */
33} OTE, *POTE;
34
35
36/* ote_flags */
37#if !defined(OBJREAD)
38 #define OBJREAD 0x00000001L /* Readable Object */
39 #define OBJWRITE 0x00000002L /* Writeable Object */
40 #define OBJEXEC 0x00000004L /* Executable Object */
41 #define OBJRSRC 0x00000008L /* Resource Object */
42 #define OBJDISCARD 0x00000010L /* Object is Discardable */
43 #define OBJSHARED 0x00000020L /* Object is Shared */
44 #define OBJPRELOAD 0x00000040L /* Object has preload pages */
45 #define OBJINVALID 0x00000080L /* Object has invalid pages */
46#endif
47#define OBJZEROFIL 0x00000100L /* Object has zero-filled pages */
48#if !defined(OBJRESIDENT)
49 #define OBJRESIDENT 0x00000200L /* Object is resident */
50 #define OBJCONTIG 0x00000300L /* Object is resident and contiguous */
51 #define OBJDYNAMIC 0x00000400L /* Object is permanent and long locable */
52 #define OBJTYPEMASK 0x00000700L /* Object type mask */
53 #define OBJALIAS16 0x00001000L /* 16:16 alias required */
54 #define OBJBIGDEF 0x00002000L /* Big/Default bit setting */
55 #define OBJCONFORM 0x00004000L /* Object is conforming for code */
56 #define OBJIOPL 0x00008000L /* Object I/O privilege level */
57#endif
58#define OBJMADEPRIV 0x40000000L /* Object is made private for debug (now obsolete) */
59#define OBJALLOC 0x80000000L /* Object is allocated used by loader */
60
61
62
63
64
65
66/*************************/
67/* warp 3.0 AS SMTEs */
68/* Swap ModuleTableEntry */
69/*************************/
70typedef struct SMTE
71{
72 /* lxheader fields */
73 /*- magic,border,worder,level,cpu,os,ver,mflags */
74 ULONG smte_mpages; /* 00 Module # pages */
75 ULONG smte_startobj; /* 04 Object # for instruction */
76 ULONG smte_eip; /* 08 Extended instruction pointer */
77 ULONG smte_stackobj; /* 0c Object # for stack pointer */
78 ULONG smte_esp; /* 10 Extended stack pointer */
79 /*- pagesize*/
80 ULONG smte_pageshift; /* 14 Page alignment shift in .EXE */
81 ULONG smte_fixupsize; /* 18 Fixup section size */
82 /*- fixupsum,ldrsize,ldrsum*/
83 POTE smte_objtab; /* 1c Object table offset - POINTER */
84 ULONG smte_objcnt; /* 20 Number of objects in module */
85 ULONG smte_objmap; /* 24 Object page map offset - POINTER */
86 ULONG smte_itermap; /* 28 Object iterated data map offset */
87 ULONG smte_rsrctab; /* 2c Offset of Resource Table */
88 ULONG smte_rsrccnt; /* 30 Number of resource entries */
89 ULONG smte_restab; /* 34 Offset of resident name table - POINTER */
90 ULONG smte_enttab; /* 38 Offset of Entry Table - POINTER */
91 ULONG smte_fpagetab; /* 3c Offset of Fixup Page Table - POINTER */
92 ULONG smte_frectab; /* 40 Offset of Fixup Record Table - POINTER */
93 ULONG smte_impmod; /* 44 Offset of Import Module Name Table - POINTER */
94 /*- impmodcnt*/
95 ULONG smte_impproc; /* 48 Offset of Imp Procedure Name Tab - POINTER */
96 /*- pagesum*/
97 ULONG smte_datapage; /* 4c Offset of Enumerated Data Pages */
98 /*- preload*/
99 ULONG smte_nrestab; /* 50 Offset of Non-resident Names Table */
100 ULONG smte_cbnrestab; /* 54 Size of Non-resident Name Table */
101 /*- nressum*/
102 ULONG smte_autods; /* 58 Object # for automatic data object */
103 ULONG smte_debuginfo; /* 5c Offset of the debugging info */
104 ULONG smte_debuglen; /* 60 The len of the debug info in */
105 /*- instpreload,instdemand*/
106 ULONG smte_heapsize; /* 64 use for converted 16-bit modules */
107 /*- res3*/
108 /* extra */
109 PCHAR smte_path; /* 68 full pathname - POINTER */
110 USHORT smte_semcount; /* 6c Count of threads waiting on MTE semaphore. 0 => semaphore is free */
111 USHORT smte_semowner; /* 6e Slot number of the owner of MTE semahore */
112 ULONG smte_pfilecache; /* 70 Pointer to file cache for Dos32CacheModule */
113 ULONG smte_stacksize; /* 74 Thread 1 Stack size from the exe header */
114 USHORT smte_alignshift; /* 78 use for converted 16-bit modules */
115 USHORT smte_NEexpver; /* 7a expver from NE header */
116 USHORT smte_pathlen; /* 7c length of full pathname */
117 USHORT smte_NEexetype; /* 7e exetype from NE header */
118 USHORT smte_csegpack; /* 80 count of segs to pack */
119} SMTE, *PSMTE;
120
121
122
123
124
125
126
127
128/********************/
129/* warp 3.0 GA MTEs */
130/* ModuleTableEntry */
131/********************/
132typedef struct MTE
133{
134 USHORT mte_flags2;
135 USHORT mte_handle;
136 PSMTE mte_swapmte; /* handle for swapmte */
137 struct MTE * mte_link;
138 ULONG mte_flags1;
139 ULONG mte_impmodcnt; /* number of entries in Import Module Name Table*/
140 SFN mte_sfn; /*"filehandle"*/
141 USHORT mte_usecnt; /* (.EXE only) - use count */
142 CHAR mte_modname[8];
143} MTE,*PMTE,**PPMTE;
144
145
146/***********/
147/* flags 1 */
148/***********/
149 #define NOAUTODS 0x00000000 /* No Auto DS exists */
150 #define SOLO 0x00000001 /* Auto DS is shared */
151 #define INSTANCEDS 0x00000002 /* Auto DS is not shared */
152 #define INSTLIBINIT 0x00000004 /* Perinstance Libinit */
153 #define GINISETUP 0x00000008 /* Global Init has been setup */
154 #define NOINTERNFIXUPS 0x00000010 /* internal fixups in .EXE.DLL applied */
155 #define NOEXTERNFIXUPS 0x00000020 /* external fixups in .EXE.DLL applied */
156 #define CLASS_PROGRAM 0x00000040 /* Program class */
157 #define CLASS_GLOBAL 0x00000080 /* Global class */
158 #define CLASS_SPECIFIC 0x000000C0 /* Specific class, as against global */
159 #define CLASS_ALL 0x00000000 /* nonspecific class all modules */
160 #define CLASS_MASK 0x000000C0 /* */
161 #define MTEPROCESSED 0x00000100 /* MTE being loaded */
162 #define USED 0x00000200 /* MTE is referenced see ldrgc.c */
163 #define DOSLIB 0x00000400 /* set if DOSCALL1 */
164 #define DOSMOD 0x00000800 /* set if DOSCALLS */
165 #define MTE_MEDIAFIXED 0x00001000 /* File Media permits discarding */
166 #define LDRINVALID 0x00002000 /* module not loadable */
167 #define PROGRAMMOD 0x00000000 /* program module */
168 #define DEVDRVMOD 0x00004000 /* device driver module */
169 #define LIBRARYMOD 0x00008000 /* DLL module */
170 #define VDDMOD 0x00010000 /* VDD module */
171 #define MVDMMOD 0x00020000 /* Set if VDD Helper MTE (MVDM.DLL) */
172 #define INGRAPH 0x00040000 /* In Module Graph see ldrgc.c */
173 #define GINIDONE 0x00080000 /* Global Init has finished */
174 #define MTEADDRALLOCED 0x00100000 /* Allocate specific or not */
175 #define FSDMOD 0x00200000 /* FSD MTE */
176 #define FSHMOD 0x00400000 /* FS helper MTE */
177 #define MTELONGNAMES 0x00800000 /* Module supports longnames */
178 #define MTE_MEDIACONTIG 0x01000000 /* File Media contiguous memory req */
179 #define MTE_MEDIA16M 0x02000000 /* File Media requires mem below 16M */
180 #define MTESWAPONLOAD 0x04000000 /* make code pages swap on load */
181 #define MTEPORTHOLE 0x08000000 /* porthole module */
182 #define MTEMODPROT 0x10000000 /* Module has shared memory protected */
183 #define MTENEWMOD 0x20000000 /* Newly added module */
184 #define MTEDLLTERM 0x40000000 /* Gets instance termination */
185 #define MTESYMLOADED 0x80000000 /* Set if debugger symbols loaded */
186
187
188/***********/
189/* flags 2 */
190/***********/
191 #define MTEFORMATMASK 0x0003 /* Module format mask */
192 #define MTEFORMATR1 0x0000 /* Module format reserved */
193 #define MTEFORMATNE 0x0001 /* Module format NE */
194 #define MTEFORMATLX 0x0002 /* Module format LX */
195 #define MTEFORMATR2 0x0003 /* Module format reserved */
196 #define MTESYSTEMDLL 0x0004 /* DLL exists in system list */
197 #define MTELOADORATTACH 0x0008 /* Module under load or attach for init */
198 #define MTECIRCLEREF 0x0010 /* Module circular reference detection */
199 #define MTEFREEFIXUPS 0x0020 /* Free system mte's fixup flag d#98488 */
200 #define MTEPRELOADED 0x0040 /* MTE Preload completed */
201 #define MTEGETMTEDONE 0x0080 /* GetMTE already resolved */
202 #define MTEPACKSEGDONE 0x0100 /* Segment packed memory allocated */
203 #define MTE20LIELIST 0x0200 /* Name present in version20 lie list */
204 #define MTESYSPROCESSED 0x0400 /* System DLL already processed */
205 #define MTEDLLONEXTLST 0x1000 /* DLL has term routine on exit list #74177 */
206
207
208#pragma pack()
209
210
211#ifndef INCL_OS2KRNL_LDR_NOAPIS /* Flag to exclude prototypes. */
212#ifndef INCL_16 /* 16-bit test - function prototypes for 32-bit code only! */
213
214
215/*******************************************************************************
216* Defined Constants And Macros *
217*******************************************************************************/
218#define LDRCALL __stdcall
219
220/** Additional ldrFindModule flag. Or together with the class. */
221#define SEARCH_FULL_NAME 0x0001
222
223
224/*******************************************************************************
225* Global Variables *
226*******************************************************************************/
227#ifndef KKRNLLIB
228 #if defined(__IBMC__) || defined(__IBMCPP__)
229 #pragma map(LDRLibPath, "_LDRLibPath")
230 #pragma map(mte_h , "_mte_h")
231 #pragma map(program_h , "_program_h")
232 #pragma map(program_l , "_program_l")
233 #pragma map(global_h , "_global_h")
234 #pragma map(global_l , "_global_l")
235 #pragma map(specific_h, "_specific_h")
236 #pragma map(specific_l, "_specific_l")
237 #pragma map(LdrSem, "_LdrSem")
238 #pragma map(ldrpFileNameBuf, "_ldrpFileNameBuf")
239 #else
240 #pragma LDRLibPath _LDRLibPath
241 #pragma mte_h _mte_h
242 #pragma program_h _program_h
243 #pragma program_l _program_l
244 #pragma global_h _global_h
245 #pragma global_l _global_l
246 #pragma specific_h _specific_h
247 #pragma specific_l _specific_l
248 #pragma LdrSem _LdrSem
249 #pragma ldrpFileNameBuf _ldrpFileNameBuf
250 #endif
251#endif
252
253#ifdef KKRNLLIB
254extern PSZ* pLDRLibPath; /* Pointer to the libpath pointer. */
255extern PPMTE pmte_h;
256extern PPMTE pprogram_h;
257extern PPMTE pprogram_l;
258extern PPMTE pglobal_h;
259extern PPMTE pglobal_l;
260extern PPMTE pspecific_h;
261extern PPMTE pspecific_l;
262#else
263extern PSZ LDRLibPath; /* Pointer to the libpath. */
264extern PMTE mte_h;
265extern PMTE program_h;
266extern PMTE program_l;
267extern PMTE global_h;
268extern PMTE global_l;
269extern PMTE specific_h;
270extern PMTE specific_l;
271#endif
272
273/*
274 * Pointer to the loader semaphore.
275 */
276#ifdef _OS2KSEM_h_
277#ifdef KKRNLLIB
278extern PKSEMMTX pLdrSem;
279#else
280extern KSEMMTX LdrSem;
281#endif
282#endif
283
284/**
285 * Pointer to the loader filename buffer.
286 * Upon return from ldrOpen (and ldrOpenPath which calls ldrOpen) this is
287 * set to the fully qualified filename of the file last opened (successfully).
288 */
289#ifdef KKRNLLIB
290extern PSZ * pldrpFileNameBuf;
291#define ldrpFileNameBuf (*pldrpFileNameBuf)
292#else
293extern PSZ ldrpFileNameBuf;
294#endif
295
296
297/*******************************************************************************
298* Function Prototypes *
299*******************************************************************************/
300/**
301 * _ldrClose
302 */
303extern ULONG LDRCALL ldrClose( /* retd 0x04 */
304 SFN p1 /* ebp + 0x08 */
305 );
306
307extern ULONG LDRCALL OrgldrClose(SFN);
308
309
310/**
311 * _ldrOpen
312 */
313extern ULONG LDRCALL ldrOpen( /* retd 0x0c */
314 PSFN p1, /* ebp + 0x08 */
315 PCHAR p2, /* ebp + 0x0c */
316 PULONG p3 /* ebp + 0x10 */
317 );
318
319extern ULONG LDRCALL OrgldrOpen(PSFN phFile, PSZ pszFilename, PULONG pfl);
320
321
322/**
323 * _ldrRead
324 */
325extern ULONG LDRCALL ldrRead( /* retd 0x18 */
326 SFN hFile, /* ebp + 0x08 */
327 ULONG ulOffset, /* ebp + 0x0c */
328 PVOID pvBuffer, /* ebp + 0x10 */
329 ULONG fpBuffer, /* ebp + 0x14 */
330 ULONG cbToRead, /* ebp + 0x18 */
331 PMTE pMTE /* ebp + 0x1c */
332 );
333
334extern ULONG LDRCALL OrgmyldrRead(
335 SFN hFile,
336 ULONG ulOffset,
337 PVOID pvBuffer,
338 ULONG fpBuffer,
339 ULONG cbToRead,
340 PMTE pMTE
341 );
342
343
344/**
345 * _LDRQAppType
346 */
347extern ULONG LDRCALL LDRQAppType( /* retd 0x08 */
348 ULONG p1, /* ebp + 0x08 */
349 ULONG p2 /* ebp + 0x0c */
350 );
351
352extern ULONG LDRCALL OrgLDRQAppType(ULONG,ULONG);
353
354
355/**
356 * ldrEnum32bitRelRecs
357 * @param pMTE Pointer to MTE for this module.
358 * @param iObject Object index. 0-based!
359 * @param iPageTabl Page index. 0-based!
360 * @param pvPage Pointer to page buffer.
361 * @param ulPageAddress Note! Page is not present.
362 * @param pPTDA
363 *
364 */
365extern ULONG LDRCALL ldrEnum32bitRelRecs( /* retd 0x20 */
366 PMTE pMTE, /* ebp + 0x08 */
367 ULONG iObject, /* ebp + 0x0c */
368 ULONG iPageTable, /* ebp + 0x10 */
369 PVOID pvPage, /* ebp + 0x14 */
370 ULONG ulPageAddress, /* ebp + 0x18 */
371 PVOID pvPTDA /* ebp + 0x1c */
372 );
373
374extern ULONG LDRCALL OrgldrEnum32bitRelRecs(PMTE, ULONG, ULONG, PVOID, ULONG, PVOID);
375
376
377/**
378 * Loader local variables from KERNEL.SDF.
379 */
380typedef struct ldrlv_s /* #memb 12 size 39 (0x027) */
381{
382 PMTE lv_pmte; /* Pointer to mte. (ldrCreateMte/ldrXXX) */
383 ULONG lv_lbufaddr;
384 ULONG lv_sbufaddr;
385 ULONG lv_lrecbufaddr;
386 ULONG lv_srecbufaddr;
387 ULONG lv_new_exe_off;
388 USHORT lv_sfn; /* Handle to the module being loaded */
389 USHORT lv_hobmte;
390 ULONG lv_objnum;
391 ULONG lv_csmte; /* size of the swappable mte heap block. (ldrCreateMte) */
392 USHORT lv_class; /* Object class CLASS_* defines in OS2Krnl (mteflags1) it seems. */
393 /* CLASS_PROGRAM Program class. */
394 /* CLASS_GLOBAL Global class. */
395 /* CLASS_SPECIFIC Specific class, as against global. */
396 /* CLASS_ALL (0) Nonspecific class all modules. */
397 /* CLASS_MASK Class mask. */
398 UCHAR lv_type; /* Type of executable image expected loaded. */
399} ldrlv_t;
400
401
402/*
403 * Values of the lv_type byte. (Qualified guesses.)
404 */
405#define LVTYPE_EXE 0 /* Executable program. */
406#define LVTYPE_DLL 1 /* Dynamic Link Library. */
407#define LVTYPE_DD 2 /* Device Driver. */
408#define LVTYPE_IFS 3 /* Installable Filesystem. */
409#define LVTYPE_VDD 4 /* Virtual Device Driver (for VDMs). */
410
411
412
413/**
414 * ldrOpenPath
415 * pre 14053.
416 * @returns OS2 return code.
417 * pLdrLv->lv_sfn is set to filename handle.
418 * @param pachModname Pointer to modulename. Not zero terminated!
419 * @param cchModname Modulename length.
420 * @param pLdrLv Loader local variables? (Struct from KERNEL.SDF)
421 * @param pfl Pointer to flags which are passed on to ldrOpen.
422 * @sketch
423 * if !CLASS_GLOBAL or miniifs then
424 * ldrOpen(pachModName)
425 * else
426 * loop until no more libpath elements
427 * get next libpath element and add it to the modname.
428 * try open the modname
429 * if successfull then break the loop.
430 * endloop
431 * endif
432 * @remark Win32k Internal stuff???
433 */
434extern ULONG LDRCALL ldrOpenPath_old( /* retd 0x10 */
435 PCHAR pachFilename, /* ebp + 0x08 */
436 USHORT cchFilename, /* ebp + 0x0c */
437 ldrlv_t * plv, /* ebp + 0x10 */
438 PULONG pful /* ebp + 0x14 */
439 );
440
441
442/**
443 * ldrOpenPath - ldrOpenPath for build 14053 and above.
444 *
445 * @returns OS2 return code.
446 * plv->lv_sfn is set to filename handle.
447 * @param pachFilename Pointer to modulename. Not zero terminated!
448 * @param cchFilename Modulename length.
449 * @param plv Loader local variables? (Struct from KERNEL.SDF)
450 * @param pful Pointer to flags which are passed on to ldrOpen.
451 * @param lLibPath New parameter in build 14053.
452 * ldrGetMte calls with 1
453 * ldrOpenNewExe calls with 3
454 * This is compared to the initial libpath index.
455 * The libpath index is:
456 * BEGINLIBPATH 1
457 * LIBPATH 2
458 * ENDLIBPATH 3
459 * The initial libpath index is either 1 or 2.
460 *
461 * @sketch
462 * This is roughly what the original ldrOpenPath does:
463 * Save pTCBCur->TCBFailErr.
464 * if !CLASS_GLOBAL or miniifs then
465 * ldrOpen(pachFilename)
466 * else
467 * if beglibpath != NULL then path = 1 else path = 2
468 * if (lLibPath < path)
469 * return ERROR_FILE_NOT_FOUND; (2)
470 * Allocate buffer.
471 * loop until no more libpath elements
472 * get next libpath element and add it to the modname.
473 * try open the modname
474 * if successfull then break the loop.
475 * endloop
476 * Free buffer.
477 * endif
478 * Restore pTCBCur->TCBFailErr.
479 */
480extern ULONG LDRCALL ldrOpenPath( /* retd 0x14 */
481 PCHAR pachFilename, /* ebp + 0x08 */
482 USHORT cchFilename, /* ebp + 0x0c */
483 ldrlv_t * plv, /* ebp + 0x10 */
484 PULONG pful, /* ebp + 0x14 */
485 ULONG lLibPath /* ebp + 0x18 */
486 );
487
488extern ULONG LDRCALL OrgldrOpenPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *plv, PULONG pful, ULONG lLibPath);
489
490
491/**
492 * Finds a module if it's loaded.
493 * @returns NO_ERROR on success.
494 * OS/2 errorcode on error.
495 * @param pachFilename Pointer to module filename.
496 * @param cchFilename Length of modulefilename.
497 * @param usClass Module class. (CLASS_*)
498 * @param ppMTE Pointer to pMTE found.
499 * @sketch
500 */
501extern ULONG LDRCALL ldrFindModule( /* retd 0x10 */
502 PCHAR pachFilename, /* ebp + 0x08 */
503 USHORT cchFilename, /* ebp + 0x0c */
504 USHORT usClass, /* ebp + 0x10 */
505 PPMTE ppMTE /* ebp + 0x14 */
506 );
507
508extern ULONG LDRCALL OrgldrFindModule(PCHAR pachFilename, USHORT cchFilename, USHORT usClass, PPMTE ppMTE);
509
510
511/**
512 * Checks if a module was loaded using DosLoadModule.
513 * This is called from LDRGetProcAddr and LDRFreeModule.
514 * @returns NO_ERROR if the module was LoadModuled or executable.
515 * ERROR_INVALID_HANDLE if not LoadModuled.
516 * @param hmte MTE handle.
517 * @param pptda Pointer to the PTDA of the process calling. (current)
518 * @param pcUsage Pointer to usage variable. (output)
519 * The usage count is returned.
520 * @sketch
521 */
522#ifdef _OS2KPTDA_h_
523ULONG LDRCALL ldrWasLoadModuled( /* retd 0x0c */
524 HMTE hmte, /* ebp + 0x08 */
525 PPTDA pptda, /* ebp + 0x0c */
526 PULONG pcUsage); /* ebp + 0x10 */
527
528extern ULONG LDRCALL OrgldrWasLoadModuled(HMTE hmte, PPTDA pptda, PULONG pcUsage);
529#endif
530
531
532/**
533 * LDRGetProcAddr gets address and proctype for a entry point to a module.
534 * @returns NO_ERROR if the module was LoadModuled.
535 * ERROR_INVALID_HANDLE if not LoadModuled.
536 * @param hmte Handle of module.
537 * @param ulOrdinal Procedure ordinal.
538 * @param pszName Pointer to procedure name.
539 * NULL is allowed. Ignored if ulOrdinal is not zero.
540 * @param pulAddress Pointer to address variable. (output)
541 * @param fFlat TRUE if a flat 0:32 address is to be returned.
542 * FALSE if a far 16:16 address is to be returned.
543 * @param pulProcType Pointer to procedure type variable. (output)
544 * NULL is allowed. (DosQueryProcAddr uses NULL)
545 * In user space.
546 * @sketch
547 */
548ULONG LDRCALL LDRGetProcAddr( /* retd 0x14 */
549 HMTE hmte, /* ebp + 0x08 */
550 ULONG ulOrdinal, /* ebp + 0x0c */
551 PCSZ pszName, /* ebp + 0x10 */
552 PULONG pulAddress, /* ebp + 0x14 */
553 BOOL fFlat, /* ebp + 0x18 */
554 PULONG pulProcType); /* ebp + 0x1c */
555
556extern ULONG LDRCALL OrgLDRGetProcAddr(HMTE hmte, ULONG ulOrdinal, PCSZ pszName, PULONG pulAddress, BOOL fFlat, PULONG pulProcType);
557
558
559
560/**
561 * LDRClearSem - Clears the loader semaphore.
562 * (It does some garbage collection on release.)
563 * @returns NO_ERROR on success.
564 * OS/2 error on failure. (ERROR_INTERRUPT?)
565 */
566extern ULONG LDRCALL LDRClearSem(void);
567extern ULONG LDRCALL OrgLDRClearSem(void);
568
569
570/**
571 * LDRRequestSem - Requests the loader semaphore..
572 * @returns NO_ERROR if succesfully.
573 * OS2 errorcode on failure. (ERROR_INTERRUPT?)
574 */
575#ifdef KKRNLLIB
576#define LDRRequestSem() KSEMRequestMutex(pLdrSem, (ULONG)-1)
577#else
578#define LDRRequestSem() KSEMRequestMutex(&LdrSem, (ULONG)-1)
579#endif
580
581
582/**
583 * Validates an hMTE and gets the MTE pointer.
584 * @returns Pointer to MTE on success.
585 * NULL on error.
586 * @param hMTE MTE handle.
587 * @remark If you wan't to this faster:
588 * Use the hMTE as a HOB and get the HOB address (by using VMGetHandleInfo).
589 */
590extern PMTE LDRCALL ldrValidateMteHandle(HMTE hMTE);
591extern PMTE LDRCALL OrgldrValidateMteHandle(HMTE hMTE);
592
593
594/**
595 * Gets the pMTE from a hMTE. No checks.
596 * @returns Pointer to the pMTE for a given hMTE.
597 * @param hMTE Module handle.
598 * @sketch
599 */
600extern PMTE KRNLCALL ldrASMpMTEFromHandle(HMTE hMTE);
601extern PMTE KRNLCALL OrgldrASMpMTEFromHandle(HMTE hMTE);
602
603
604/**
605 * Translates a relative filename to a full qualified filename.
606 * @returns NO_ERROR on success.
607 * Errorcode on error.
608 * @param pszFilename Pointer to nullterminated filename.
609 */
610extern ULONG LDRCALL ldrTransPath(PSZ pszFilename);
611extern ULONG LDRCALL OrgldrTransPath(PSZ pszFilename);
612
613
614/**
615 * Sets the VM flags for an executable object.
616 * @returns void
617 * @param pMTE Pointer to the module table entry.
618 * @param flObj LX Object flags.
619 * @param pflFlags1 Pointer to the flFlags1 of VMAllocMem (out).
620 * @param pflFlags2 Pointer to the flFlags2 of VMAllocMem (out).
621 */
622extern VOID LDRCALL ldrSetVMflags( /* retd 0x10 */
623 PMTE pMTE, /* ebp + 0x08 */
624 ULONG flObj, /* ebp + 0x0c */
625 PULONG pflFlags1, /* ebp + 0x10 */
626 PULONG pflFlags2 /* ebp + 0x14 */
627 );
628
629extern VOID LDRCALL OrgldrSetVMflags(PMTE pMTE, ULONG flObj, PULONG pflFlags1, PULONG pflFlags2);
630
631
632/**
633 * Checks if the internal name (first name in the resident nametable) matches
634 * the filename.
635 * @returns NO_ERROR on success (the name matched).
636 * ERROR_INVALID_NAME if mismatch.
637 * @param pMTE Pointer to the MTE of the module to check.<br>
638 * Assumes! that the filename for this module is present in ldrpFileNameBuf.
639 */
640extern ULONG LDRCALL ldrCheckInternalName( /* retd 0x04 */
641 PMTE pMTE /* ebp + 0x08 */
642 );
643extern ULONG LDRCALL OrgldrCheckInternalName(PMTE pMTE);
644
645
646/**
647 * Parses a filename to find the name and extention.
648 * @returns Length of the filename without the extention.
649 * @param pachFilename Pointer to filename to parse - must have path!
650 * @param ppachName Pointer to pointer which should hold the name pointer upon successfull return.
651 * @param ppachExt Pointer to pointer which should hold the extention pointer upon successfull return.
652 */
653extern ULONG LDRCALL ldrGetFileName(PSZ pszFilename, PCHAR *ppchName, PCHAR *ppchExt);
654extern ULONG LDRCALL OrgldrGetFileName(PSZ pszFilename, PCHAR *ppchName, PCHAR *ppchExt);
655
656
657/**
658 * Parses a filename to find the name and extention.
659 * @returns Length of the filename without the extention.
660 * @param pachFilename Pointer to filename to parse - path not needed.
661 * @param ppachName Pointer to pointer which should hold the name pointer upon successfull return.
662 * @param ppachExt Pointer to pointer which should hold the extention pointer upon successfull return.
663 * @remark Win32k internal function???
664 */
665extern ULONG LDRCALL ldrGetFileName2(PSZ pszFilename, PCHAR *ppchName, PCHAR *ppchExt);
666
667
668/**
669 * Uppercase a string.
670 * @returns void
671 * @param pach String to uppercase.
672 * @param cch Length of string. (may include terminator)
673 */
674extern VOID LDRCALL ldrUCaseString(PCHAR pch, unsigned cch);
675extern VOID LDRCALL OrgldrUCaseString(PCHAR pch, unsigned cch);
676
677
678
679/**
680 * Resolves the ordinal number of an name export.
681 * @returns OS2 return code. (I.e. ON_ERROR on success)
682 * @param pMTE Pointer to the module table entry for the
683 * module.
684 * @param pszExportName Name to resolve. This is case sensitive.
685 * @param pusOrdinal Pointer to variable which on success will hold
686 * the ordinal value found for the name export.
687 */
688extern ULONG LDRCALL ldrGetOrdNum(PMTE pMTE, PSZ pszExportName, PUSHORT pusOrdinal);
689extern ULONG LDRCALL OrgldrGetOrdNum(PMTE pMTE, PSZ pszExportName, PUSHORT pusOrdinal);
690
691
692/**
693 * Frees a task.
694 * @param pPTDA Pointer to per task data area of the task to be freed.
695 */
696#ifdef _OS2KPTDA_h_
697extern void LDRCALL LDRFreeTask(PPTDA pPTDA);
698extern void LDRCALL OrgLDRFreeTask(PPTDA pPTDA);
699#endif
700
701
702
703#endif /* INCL_16 (16-bit test - function prototypes for 32-bit code only!) */
704#endif /* no loader api test */
705
706
707#ifdef __cplusplus
708} /* extern "C" */
709#endif
710
711#endif
Note: See TracBrowser for help on using the repository browser.