| 1 | /* $Id: myldrRead.cpp,v 1.3 1999-10-14 02:36:08 bird Exp $
|
|---|
| 2 | *
|
|---|
| 3 | * myldrRead - _ldrRead.
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright (c) 1998-1999 knut st. osmundsen
|
|---|
| 6 | *
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | /*******************************************************************************
|
|---|
| 10 | * Defined Constants And Macros *
|
|---|
| 11 | *******************************************************************************/
|
|---|
| 12 | #define INCL_DOSERRORS
|
|---|
| 13 | #define INCL_NOPMAPI
|
|---|
| 14 |
|
|---|
| 15 | /*******************************************************************************
|
|---|
| 16 | * Header Files *
|
|---|
| 17 | *******************************************************************************/
|
|---|
| 18 | #include <os2.h>
|
|---|
| 19 |
|
|---|
| 20 | #include <memory.h>
|
|---|
| 21 | #include <stdlib.h>
|
|---|
| 22 |
|
|---|
| 23 | #include "log.h"
|
|---|
| 24 | #include "dev32.h"
|
|---|
| 25 | #include <peexe.h>
|
|---|
| 26 | #include <exe386.h>
|
|---|
| 27 | #include "OS2Krnl.h"
|
|---|
| 28 | #include "pe2lx.h"
|
|---|
| 29 | #include "ldrCalls.h"
|
|---|
| 30 | #include "ldr.h"
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | ULONG LDRCALL myldrRead(
|
|---|
| 34 | SFN hFile,
|
|---|
| 35 | ULONG ulOffset,
|
|---|
| 36 | PVOID pBuffer,
|
|---|
| 37 | ULONG ulFlags ,
|
|---|
| 38 | ULONG ulBytesToRead,
|
|---|
| 39 | PMTE pMTE
|
|---|
| 40 | )
|
|---|
| 41 | {
|
|---|
| 42 | ULONG rc;
|
|---|
| 43 |
|
|---|
| 44 | /* Check if this is an overrided handle */
|
|---|
| 45 | if (GetState(hFile) == HSTATE_OUR)
|
|---|
| 46 | {
|
|---|
| 47 | PPENODE pNode;
|
|---|
| 48 |
|
|---|
| 49 | pNode = getNodePtr(hFile);
|
|---|
| 50 | if (pNode != NULL)
|
|---|
| 51 | {
|
|---|
| 52 | /* I would love to have a pointer to the MTE */
|
|---|
| 53 | if (pNode->pMTE == NULL && pMTE != NULL)
|
|---|
| 54 | pNode->pMTE == pMTE;
|
|---|
| 55 |
|
|---|
| 56 | /* debug */
|
|---|
| 57 | if (ulFlags != 0)
|
|---|
| 58 | kprintf(("_ldrRead: Warning ulFlags = 0x%x (!= 0)\n", ulFlags));
|
|---|
| 59 |
|
|---|
| 60 | rc = pNode->pPe2Lx->read(ulOffset, pBuffer, ulBytesToRead, ulFlags, pMTE);
|
|---|
| 61 | return rc;
|
|---|
| 62 | }
|
|---|
| 63 | else
|
|---|
| 64 | kprintf(("_ldrRead: DON'T PANIC! - but I can't get Node ptr! - This is really an IPE!\n"));
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | rc = _ldrRead(hFile, ulOffset, pBuffer, ulFlags, ulBytesToRead, pMTE);
|
|---|
| 68 |
|
|---|
| 69 | // kprintf(("_ldrRead: hF=%+04x off=%+08x pB=%+08x fl=%+08x cb=%+04x pMTE=%+08x rc=%d\n",hFile,ulOffset,pBuffer,ulFlags,ulBytesToRead,pMTE,rc));
|
|---|
| 70 |
|
|---|
| 71 | return rc;
|
|---|
| 72 | }
|
|---|