source: trunk/src/win32k/ldr/myldrWasLoadModuled.cpp@ 4827

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

Will try to allow exefiles to export entry points.

File size: 2.7 KB
Line 
1/* $Id: myldrWasLoadModuled.cpp,v 1.1 2000-12-17 22:44:45 bird Exp $
2 *
3 * ldrWasLoadModuled - Tells OS/2 that the executable module was LoadModuled
4 * too. This way DosQueryProcAddr and DosQueryProcType will work for
5 * executables too.
6 *
7 * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
8 *
9 * Project Odin Software License can be found in LICENSE.TXT
10 *
11 */
12
13/*******************************************************************************
14* Defined Constants And Macros *
15*******************************************************************************/
16#define INCL_DOSERRORS
17#define INCL_NOPMAPI
18#define INCL_OS2KRNL_PTDA
19
20/*******************************************************************************
21* Header Files *
22*******************************************************************************/
23#include <os2.h>
24
25#include <memory.h>
26#include <stdlib.h>
27#include <string.h>
28
29#include "devSegDf.h" /* Win32k segment definitions. */
30#include "log.h"
31#include "avl.h"
32#include <peexe.h>
33#include <exe386.h>
34#include "OS2Krnl.h"
35#include "dev32.h"
36#include "ldr.h"
37#include "ldrCalls.h"
38#include "options.h"
39
40
41/**
42 * Checks if a module was loaded using DosLoadModule.
43 * This is called from LDRGetProcAddr and LDRFreeModule.
44 *
45 * We would like to get entry points from executables (EXEs) too.
46 * So, when called from LDRGetProcAddr we'll tell OS/2 a white lie and
47 * say that the executable module for the given process was LoadModuled.
48 *
49 * @returns NO_ERROR if the module was LoadModuled or executable.
50 * ERROR_INVALID_HANDLE if not LoadModuled.
51 * @param hmte MTE handle.
52 * @param pptda Pointer to the PTDA of the process calling. (current)
53 * @param pcUsage Pointer to usage variable. (output)
54 * The usage count is returned.
55 * @sketch Check if enabled.
56 * If called from LDRGetProcAddr
57 * AND hmte = hmteEXE
58 * Then return NO_ERROR.
59 * return thru ldrWasLoadModuled.
60 */
61ULONG LDRCALL myldrWasLoadModuled(HMTE hmte, PPTDA pptda, PULONG pcUsage)
62{
63 /*
64 * Check if the fix is enabled.
65 */
66 if (isExeFixesEnabled())
67 {
68 /*
69 * If pcUsage is NULL we're called from LDRGetProcAddr.
70 */
71 if ( pcUsage == NULL
72 && hmte == ptdaGet_ptda_module(pptda)
73 )
74 {
75 kprintf(("myldrWasLoadModuled: Executable hmte=%04x\n", hmte));
76 return NO_ERROR;
77 }
78 }
79
80 /*
81 * Let the real function do the work.
82 */
83 return ldrWasLoadModuled(hmte, pptda, pcUsage);
84}
85
Note: See TracBrowser for help on using the repository browser.