| 1 | /* $Id: OS2KTK.h,v 1.4 2000-12-11 06:53:50 bird Exp $ | 
|---|
| 2 | * | 
|---|
| 3 | * OS2KTK - OS/2 Kernel Task. | 
|---|
| 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 | #ifndef _OS2KTK_h_ | 
|---|
| 11 | #define _OS2KTK_h_ | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 | /******************************************************************************* | 
|---|
| 15 | *   Defined Constants And Macros                                               * | 
|---|
| 16 | *******************************************************************************/ | 
|---|
| 17 | #define TK_FUSU_FATAL       0x3         /* Traps the task on failure. */ | 
|---|
| 18 | #define TK_FUSU_NONFATAL    0x0         /* Returns error code to caller on failure. */ | 
|---|
| 19 | #define TK_FUSU_USER_SRC    0x10        /* Source buffer is in user memory. (TKSuFuBuff) */ | 
|---|
| 20 | #define TK_FUSU_USER_DST    0x20        /* Target buffer is in user memory. (TKSuFuBuff) */ | 
|---|
| 21 |  | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 | #define TKFuChar(pch, pchUsr) \ | 
|---|
| 25 | TKFuBuff((PVOID)pch, (PVOID)pchUsr, sizeof(char), TK_FUSU_FATAL) | 
|---|
| 26 | #define TKSuChar(pchUsr, pch) \ | 
|---|
| 27 | TKSuBuff((PVOID)pchUsr, (PVOID)pch, sizeof(char), TK_FUSU_FATAL) | 
|---|
| 28 |  | 
|---|
| 29 | #define TKFuCharNF(pch, pchUsr) \ | 
|---|
| 30 | TKFuBuff((PVOID)pch, (PVOID)pchUsr, sizeof(char), TK_FUSU_NONFATAL) | 
|---|
| 31 | #define TKSuCharNF(pchUsr, pch) \ | 
|---|
| 32 | TKSuBuff((PVOID)pchUsr, (PVOID)pch, sizeof(char), TK_FUSU_NONFATAL) | 
|---|
| 33 |  | 
|---|
| 34 |  | 
|---|
| 35 | #define TKFuUShort(pus, pusUsr) \ | 
|---|
| 36 | TKFuBuff((PVOID)pus, (PVOID)pusUsr, sizeof(USHORT), TK_FUSU_FATAL) | 
|---|
| 37 | #define TKSuUShort(pusUsr, pus) \ | 
|---|
| 38 | TKSuBuff((PVOID)pusUsr, (PVOID)pus, sizeof(USHORT), TK_FUSU_FATAL) | 
|---|
| 39 |  | 
|---|
| 40 | #define TKFuUShortNF(pus, pusUsr) \ | 
|---|
| 41 | TKFuBuff((PVOID)pus, (PVOID)pusUsr, sizeof(USHORT), TK_FUSU_NONFATAL) | 
|---|
| 42 | #define TKSuUShortNF(pusUsr, pus) \ | 
|---|
| 43 | TKSuBuff((PVOID)pusUsr, (PVOID)pus, sizeof(USHORT), TK_FUSU_NONFATAL) | 
|---|
| 44 |  | 
|---|
| 45 |  | 
|---|
| 46 | #define TKFuULong(pul, pulUsr) \ | 
|---|
| 47 | TKFuBuff((PVOID)pul, (PVOID)pulUsr, sizeof(ULONG), TK_FUSU_FATAL) | 
|---|
| 48 | #define TKSuULong(pulUsr, pul) \ | 
|---|
| 49 | TKSuBuff((PVOID)pulUsr, (PVOID)pul, sizeof(ULONG), TK_FUSU_FATAL) | 
|---|
| 50 |  | 
|---|
| 51 | #define TKFuULongNF(pul, pulUsr) \ | 
|---|
| 52 | TKFuBuff((PVOID)pul, (PVOID)pulUsr, sizeof(ULONG), TK_FUSU_NONFATAL) | 
|---|
| 53 | #define TKSuULongNF(pulUsr, pul) \ | 
|---|
| 54 | TKSuBuff((PVOID)pulUsr, (PVOID)pul, sizeof(ULONG), TK_FUSU_NONFATAL) | 
|---|
| 55 |  | 
|---|
| 56 |  | 
|---|
| 57 | #define TKFuStrLen(pcch, pvUsr, cchMax) \ | 
|---|
| 58 | TKFuBufLen(pcch, pvUsr, cchMax, TK_FUSU_FATAL, FALSE) | 
|---|
| 59 | #define TKFuStrLenNZ(pcch, pvUsr, cchMax) \ | 
|---|
| 60 | TKFuBufLenNZ(pcch, pvUsr, cchMax, TK_FUSU_NONFATAL, FALSE) | 
|---|
| 61 |  | 
|---|
| 62 | #define TKFuStrLenZ(pcch, pvUsr, cchMax) \ | 
|---|
| 63 | TKFuBufLenZ(pcch, pvUsr, cchMax, TK_FUSU_FATAL, TRUE) | 
|---|
| 64 | #define TKFuStrLenZNZ(pcch, pvUsr, cchMax) \ | 
|---|
| 65 | TKFuBufLenZNZ(pcch, pvUsr, cchMax, TK_FUSU_NONFATAL, TRUE) | 
|---|
| 66 |  | 
|---|
| 67 |  | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|
| 70 |  | 
|---|
| 71 | /** | 
|---|
| 72 | * Copy user memory into system memory. | 
|---|
| 73 | * @returns   OS/2 return code. (NO_ERROR is success) | 
|---|
| 74 | * @param     pv     Pointer to target (system) data area. | 
|---|
| 75 | * @param     pvUsr  Pointer to source (user) data area. | 
|---|
| 76 | * @param     cb     Count of bytes to copy. | 
|---|
| 77 | * @param     fl     Flags. | 
|---|
| 78 | */ | 
|---|
| 79 | extern ULONG KRNLCALL   TKFuBuff(PVOID pv, PVOID pvUsr, ULONG cb, ULONG fl); | 
|---|
| 80 |  | 
|---|
| 81 |  | 
|---|
| 82 | /** | 
|---|
| 83 | * Copy system memory to user memory. | 
|---|
| 84 | * @returns   OS/2 return code. (NO_ERROR is success) | 
|---|
| 85 | * @param     pvUsr  Pointer to target (user) data area. | 
|---|
| 86 | * @param     pv     Pointer to source (system) data area. | 
|---|
| 87 | * @param     cb     Count of bytes to copy. | 
|---|
| 88 | * @param     fl     Flags. | 
|---|
| 89 | */ | 
|---|
| 90 | extern ULONG KRNLCALL   TKSuBuff(PVOID pvUsr, PVOID pv, ULONG cb, ULONG fl); | 
|---|
| 91 |  | 
|---|
| 92 |  | 
|---|
| 93 | /** | 
|---|
| 94 | * String length. | 
|---|
| 95 | * @returns   OS/2 return code. (NO_ERROR is success) | 
|---|
| 96 | * @param     pcch      Pointer to length variable. | 
|---|
| 97 | * @param     pvUsr     Pointer to user data to preform string length on. | 
|---|
| 98 | * @param     cchMax    Max string length. | 
|---|
| 99 | * @param     fl        Flags. | 
|---|
| 100 | * @param     fDblNULL  TRUE:  Double '\0' (ie. '\0\0') terminated. Usefull for scanning environments. | 
|---|
| 101 | *                      FALSE: Single string. (ie. one '\0'). | 
|---|
| 102 | */ | 
|---|
| 103 | extern ULONG KRNLCALL   TKFuBufLen(PLONG pcch, PVOID pvUsr, ULONG cchMax, ULONG fl, BOOL fDblNULL); | 
|---|
| 104 |  | 
|---|
| 105 |  | 
|---|
| 106 | /** | 
|---|
| 107 | * Copy user memory to user memory. | 
|---|
| 108 | * @returns   OS/2 return code. (NO_ERROR is success) | 
|---|
| 109 | * @param     pvTarget  Pointer to target (user) data area. | 
|---|
| 110 | * @param     pvSource  Pointer to source (user) data area. | 
|---|
| 111 | * @param     cb        Count of bytes to copy. | 
|---|
| 112 | * @param     fl        Flags. | 
|---|
| 113 | */ | 
|---|
| 114 | extern ULONG KRNLCALL   TKSuFuBuff(PVOID pvTarget, PVOID pvSource, ULONG cb, ULONG fl); | 
|---|
| 115 |  | 
|---|
| 116 |  | 
|---|
| 117 | #ifdef INCL_OS2KRNL_PTDA | 
|---|
| 118 | /** | 
|---|
| 119 | * PID to PTDA pointer. | 
|---|
| 120 | * @returns     OS/2 return code. | 
|---|
| 121 | * @param       pid     Process Identifier. | 
|---|
| 122 | * @param       ppPTDA  Pointer to the PTDA-pointer variabel which is to receive | 
|---|
| 123 | *                      the PTDA pointer on successful return. | 
|---|
| 124 | */ | 
|---|
| 125 | extern ULONG KRNLCALL  TKPidToPTDA(PID pid, PPPTDA ppPTDA); | 
|---|
| 126 | #endif | 
|---|
| 127 |  | 
|---|
| 128 | #endif | 
|---|