1 | /* $Id: OS2KTK.h,v 1.1 2000-07-16 22:21:18 bird Exp $
|
---|
2 | *
|
---|
3 | * OS2KTK - OS/2 Kernel Task.
|
---|
4 | *
|
---|
5 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.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 |
|
---|
20 |
|
---|
21 |
|
---|
22 | #define TKFuChar(pch, pchUsr) \
|
---|
23 | TKFuBuff((PVOID)pch, (PVOID)pchUsr, sizeof(char), TK_FUSU_FATAL);
|
---|
24 | #define TKSuChar(pchUsr, pch) \
|
---|
25 | TKSuBuff((PVOID)pchUsr, (PVOID)pch, sizeof(char), TK_FUSU_FATAL);
|
---|
26 |
|
---|
27 | #define TKFuCharNF(pch, pchUsr) \
|
---|
28 | TKFuBuff((PVOID)pch, (PVOID)pchUsr, sizeof(char), TK_FUSU_NONFATAL);
|
---|
29 | #define TKSuCharNF(pchUsr, pch) \
|
---|
30 | TKSuBuff((PVOID)pchUsr, (PVOID)pch, sizeof(char), TK_FUSU_NONFATAL);
|
---|
31 |
|
---|
32 |
|
---|
33 | #define TKFuUShort(pus, pusUsr) \
|
---|
34 | TKFuBuff((PVOID)pus, (PVOID)pusUsr, sizeof(USHORT), TK_FUSU_FATAL);
|
---|
35 | #define TKSuUShort(pusUsr, pus) \
|
---|
36 | TKSuBuff((PVOID)pusUsr, (PVOID)pus, sizeof(USHORT), TK_FUSU_FATAL);
|
---|
37 |
|
---|
38 | #define TKFuUShortNF(pus, pusUsr) \
|
---|
39 | TKFuBuff((PVOID)pus, (PVOID)pusUsr, sizeof(USHORT), TK_FUSU_NONFATAL);
|
---|
40 | #define TKSuUShortNF(pusUsr, pus) \
|
---|
41 | TKSuBuff((PVOID)pusUsr, (PVOID)pus, sizeof(USHORT), TK_FUSU_NONFATAL);
|
---|
42 |
|
---|
43 |
|
---|
44 | #define TKFuULong(pul, pulUsr) \
|
---|
45 | TKFuBuff((PVOID)pul, (PVOID)pulUsr, sizeof(ULONG), TK_FUSU_FATAL);
|
---|
46 | #define TKSuULong(pulUsr, pul) \
|
---|
47 | TKSuBuff((PVOID)pulUsr, (PVOID)pul, sizeof(ULONG), TK_FUSU_FATAL);
|
---|
48 |
|
---|
49 | #define TKFuULongNF(pul, pulUsr) \
|
---|
50 | TKFuBuff((PVOID)pul, (PVOID)pulUsr, sizeof(ULONG), TK_FUSU_NONFATAL);
|
---|
51 | #define TKSuULongNF(pulUsr, pul) \
|
---|
52 | TKSuBuff((PVOID)pulUsr, (PVOID)pul, sizeof(ULONG), TK_FUSU_NONFATAL);
|
---|
53 |
|
---|
54 |
|
---|
55 | #define TKFuStrLen(pcch, pvUsr, cchMax) \
|
---|
56 | TKFuBufLen(pcch, pvUsr, cchMax, TK_FUSU_FATAL, FALSE)
|
---|
57 | #define TKFuStrLenNZ(pcch, pvUsr, cchMax) \
|
---|
58 | TKFuBufLenNZ(pcch, pvUsr, cchMax, TK_FUSU_NONFATAL, FALSE)
|
---|
59 |
|
---|
60 | #define TKFuStrLenZ(pcch, pvUsr, cchMax) \
|
---|
61 | TKFuBufLenZ(pcch, pvUsr, cchMax, TK_FUSU_FATAL, TRUE)
|
---|
62 | #define TKFuStrLenZNZ(pcch, pvUsr, cchMax) \
|
---|
63 | TKFuBufLenZNZ(pcch, pvUsr, cchMax, TK_FUSU_NONFATAL, TRUE)
|
---|
64 |
|
---|
65 |
|
---|
66 |
|
---|
67 |
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Copy user memory into system memory.
|
---|
71 | * @returns OS/2 return code. (NO_ERROR is success)
|
---|
72 | * @param pv Pointer to target (system) data area.
|
---|
73 | * @param pvUsr Pointer to source (user) data area.
|
---|
74 | * @param cb Count of bytes to copy.
|
---|
75 | * @param fl Flags.
|
---|
76 | */
|
---|
77 | extern ULONG KRNLCALL TKFuBuff(PVOID pv, PVOID pvUsr, ULONG cb, ULONG fl);
|
---|
78 |
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Copy system memory to user memory.
|
---|
82 | * @returns OS/2 return code. (NO_ERROR is success)
|
---|
83 | * @param pvUsr Pointer to target (user) data area.
|
---|
84 | * @param pv Pointer to source (system) data area.
|
---|
85 | * @param cb Count of bytes to copy.
|
---|
86 | * @param fl Flags.
|
---|
87 | */
|
---|
88 | extern ULONG KRNLCALL TKSuBuff(PVOID pvUsr, PVOID pv, ULONG cb, ULONG fl);
|
---|
89 |
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * String length.
|
---|
93 | * @returns OS/2 return code. (NO_ERROR is success)
|
---|
94 | * @param pcch Pointer to length variable.
|
---|
95 | * @param pvUsr Pointer to user data to preform string length on.
|
---|
96 | * @param cchMax Max string length.
|
---|
97 | * @param fl Flags.
|
---|
98 | * @param fDblNULL TRUE: Double '\0' (ie. '\0\0') terminated. Usefull for scanning environments.
|
---|
99 | * FALSE: Single string. (ie. one '\0').
|
---|
100 | */
|
---|
101 | extern ULONG KRNLCALL TKFuBufLen(PLONG pcch, PVOID pvUsr, ULONG cchMax, ULONG fl, BOOL fDblNULL);
|
---|
102 |
|
---|
103 |
|
---|
104 | #endif
|
---|