| 1 | /* $Id: OS2KPTDA.c,v 1.4 2000-12-11 06:53:54 bird Exp $ | 
|---|
| 2 | * | 
|---|
| 3 | * PTDA access functions. | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no) | 
|---|
| 6 | * | 
|---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 8 | * | 
|---|
| 9 | */ | 
|---|
| 10 |  | 
|---|
| 11 | /******************************************************************************* | 
|---|
| 12 | *   Defined Constants And Macros                                               * | 
|---|
| 13 | *******************************************************************************/ | 
|---|
| 14 | #define INCL_OS2KRNL_SEM | 
|---|
| 15 | #define INCL_OS2KRNL_PTDA | 
|---|
| 16 |  | 
|---|
| 17 | /******************************************************************************* | 
|---|
| 18 | *   Header Files                                                               * | 
|---|
| 19 | *******************************************************************************/ | 
|---|
| 20 | #include <os2.h> | 
|---|
| 21 | #include <OS2Krnl.h> | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 | /******************************************************************************* | 
|---|
| 25 | *   External Data                                                              * | 
|---|
| 26 | *******************************************************************************/ | 
|---|
| 27 | /* | 
|---|
| 28 | * Requires the following imports: | 
|---|
| 29 | *      pPTDACur | 
|---|
| 30 | *      ptda_start | 
|---|
| 31 | *      ptda_environ | 
|---|
| 32 | */ | 
|---|
| 33 | extern ULONG    pptda_start; | 
|---|
| 34 | extern ULONG    pptda_environ; | 
|---|
| 35 | extern ULONG    pptda_ptdasem; | 
|---|
| 36 | extern ULONG    pptda_handle; | 
|---|
| 37 | extern ULONG    pptda_module; | 
|---|
| 38 |  | 
|---|
| 39 |  | 
|---|
| 40 | /** | 
|---|
| 41 | * Gets the ptda_environ PTDA member. This member holds the memory object handle | 
|---|
| 42 | * for the environment block of the processes. | 
|---|
| 43 | * @returns     Content of the pPTDA->ptda_environ member. | 
|---|
| 44 | * @param       pPTDA   PTDA Pointer. (NULL is not allowed!) | 
|---|
| 45 | */ | 
|---|
| 46 | USHORT  ptdaGet_ptda_environ(PPTDA pPTDA) | 
|---|
| 47 | { | 
|---|
| 48 | return *(PUSHORT)(void*)(((char*)(void*)pPTDA) + (pptda_environ - pptda_start)); | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 | /** | 
|---|
| 53 | * Gets the ptda_handle PTDA member. This member holds the PTDA handle for the | 
|---|
| 54 | * given PTDA. | 
|---|
| 55 | * @returns     Content of the pPTDA->ptda_handle member. | 
|---|
| 56 | * @param       pPTDA   PTDA Pointer. (NULL is not allowed!) | 
|---|
| 57 | */ | 
|---|
| 58 | HPTDA  ptdaGet_ptda_handle(PPTDA pPTDA) | 
|---|
| 59 | { | 
|---|
| 60 | return *(PHPTDA)(void*)(((char*)(void*)pPTDA) + (pptda_handle - pptda_start)); | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 |  | 
|---|
| 64 | /** | 
|---|
| 65 | * Gets the ptda_module PTDA member. This member holds the MTE handle of the process's | 
|---|
| 66 | * executable image. | 
|---|
| 67 | * @returns     Content of the pPTDA->ptda_module member. | 
|---|
| 68 | * @param       pPTDA   PTDA Pointer. (NULL is not allowed!) | 
|---|
| 69 | */ | 
|---|
| 70 | USHORT  ptdaGet_ptda_module(PPTDA pPTDA) | 
|---|
| 71 | { | 
|---|
| 72 | return *(PUSHORT)(void*)(((char*)(void*)pPTDA) + (pptda_module - pptda_start)); | 
|---|
| 73 | } | 
|---|
| 74 |  | 
|---|
| 75 |  | 
|---|
| 76 | /** | 
|---|
| 77 | * Gets the ptda_ptdasem PTDA member. This member holds the intra-process semaphore which | 
|---|
| 78 | * for example is used to serialize _LDRQAppType. | 
|---|
| 79 | * @returns     Content of the pPTDA->ptda_ptdasem member. | 
|---|
| 80 | * @param       pPTDA   PTDA Pointer. (NULL is not allowed!) | 
|---|
| 81 | */ | 
|---|
| 82 | HKSEMMTX    ptda_ptda_ptdasem(PPTDA pPTDA) | 
|---|
| 83 | { | 
|---|
| 84 | return (HKSEMMTX)(void*)(((char*)(void*)pPTDA) + (pptda_ptdasem - pptda_start)); | 
|---|
| 85 | } | 
|---|
| 86 |  | 
|---|
| 87 |  | 
|---|
| 88 |  | 
|---|