source: trunk/src/win32k/ldr/myldrClose.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.2 KB
RevLine 
[5086]1/* $Id: myldrClose.cpp,v 1.7 2001-02-10 11:11:46 bird Exp $
[847]2 *
[2501]3 * myldrClose - ldrClose
[847]4 *
5 * Copyright (c) 1998-1999 knut st. osmundsen
6 *
[1678]7 * Project Odin Software License can be found in LICENSE.TXT
8 *
[847]9 */
10
11/*******************************************************************************
12* Defined Constants And Macros *
13*******************************************************************************/
14#define INCL_DOSERRORS
15#define INCL_NOPMAPI
[5086]16#define INCL_OS2KRNL_LDR
[847]17
18/*******************************************************************************
19* Header Files *
20*******************************************************************************/
21#include <os2.h>
22
[1273]23#include <memory.h>
24#include <stdlib.h>
25
[4164]26#include "devSegDf.h" /* Win32k segment definitions. */
[1273]27#include "log.h"
[4164]28#include "avl.h"
[1273]29#include <peexe.h>
30#include <exe386.h>
[847]31#include "OS2Krnl.h"
32#include "ldr.h"
[4164]33#include "ModuleBase.h"
34#include "Pe2Lx.h"
[847]35
36
37/**
38 * Close a file.
39 * @returns NO_ERROR on success?
40 * error code on error?
41 * @param hFile Handle to file which is to be closed.
42 */
43ULONG LDRCALL myldrClose(SFN hFile)
44{
45 /* closes handle */
[4164]46 kprintf(("myldrClose: hFile = %.4x\n", hFile));
[1273]47 if (GetState(hFile) == HSTATE_OUR)
[847]48 {
[2501]49 APIRET rc;
50
[1678]51 #ifdef DEBUG
52 PMODULE pMod = getModuleBySFN(hFile);
53 if (pMod != NULL)
54 pMod->Data.pModule->dumpVirtualLxFile();
55 else
[4164]56 kprintf(("myldrClose: getModuleBySFN failed!!!"));
[1678]57 #endif
58
[1467]59 rc = removeModule(hFile);
[1273]60 if (rc != NO_ERROR)
[4164]61 kprintf(("myldrClose: removeModule retured rc=%d\n", rc));
[1273]62
[2501]63 #pragma info(notrd)
[1273]64 SetState(hFile, HSTATE_UNUSED);
[2501]65 #pragma info(restore)
[847]66 }
[4164]67 /*
68 * Invalidate the odin32path if kernel32 is closed.
69 * (Might possible not be needed as Pe2Lx does invalides
70 * the odin32path on object destruction.)
71 */
72 else if (Pe2Lx::getKernel32SFN() == hFile)
73 Pe2Lx::invalidateOdin32Path();
[847]74
[4164]75 /*
76 * Finally call the real close function.
77 */
[2501]78 return ldrClose(hFile);
[847]79}
Note: See TracBrowser for help on using the repository browser.