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

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

Moved ldrCalls.h into the OS2Krnl.h tree as OS2KLDR.h.
Also moved the Ldr definitions from OS2Krnl.h and into OS2KLDR.h.

File size: 2.7 KB
RevLine 
[5086]1/* $Id: myldrWasLoadModuled.cpp,v 1.2 2001-02-10 11:11:47 bird Exp $
[4827]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
[5086]19#define INCL_OS2KRNL_LDR
[4827]20
21/*******************************************************************************
22* Header Files *
23*******************************************************************************/
24#include <os2.h>
25
26#include <memory.h>
27#include <stdlib.h>
28#include <string.h>
29
30#include "devSegDf.h" /* Win32k segment definitions. */
31#include "log.h"
32#include "avl.h"
33#include <peexe.h>
34#include <exe386.h>
35#include "OS2Krnl.h"
36#include "dev32.h"
37#include "ldr.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.