| 1 | /* $Id: oslibutil.cpp,v 1.6 2000-11-21 11:36:08 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Window API utility functions for OS/2 | 
|---|
| 4 | * | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | * | 
|---|
| 11 | */ | 
|---|
| 12 | #include <os2win.h> | 
|---|
| 13 | #include <misc.h> | 
|---|
| 14 | #include <wprocess.h> | 
|---|
| 15 | #include "oslibutil.h" | 
|---|
| 16 |  | 
|---|
| 17 | #define DBG_LOCALLOG    DBG_oslibutil | 
|---|
| 18 | #include "dbglocal.h" | 
|---|
| 19 |  | 
|---|
| 20 | //****************************************************************************** | 
|---|
| 21 | //****************************************************************************** | 
|---|
| 22 | HAB GetThreadHAB() | 
|---|
| 23 | { | 
|---|
| 24 | TEB *teb; | 
|---|
| 25 |  | 
|---|
| 26 | teb = GetThreadTEB(); | 
|---|
| 27 | if(teb) | 
|---|
| 28 | { | 
|---|
| 29 | return (HAB)teb->o.odin.hab; | 
|---|
| 30 | } | 
|---|
| 31 |  | 
|---|
| 32 | dprintf(("GetThreadHAB: teb == NULL!!")); | 
|---|
| 33 | return 0; | 
|---|
| 34 | } | 
|---|
| 35 | //****************************************************************************** | 
|---|
| 36 | //****************************************************************************** | 
|---|
| 37 | void SetThreadHAB(HAB hab) | 
|---|
| 38 | { | 
|---|
| 39 | TEB *teb; | 
|---|
| 40 |  | 
|---|
| 41 | teb = GetThreadTEB(); | 
|---|
| 42 | if(teb) | 
|---|
| 43 | { | 
|---|
| 44 | teb->o.odin.hab = (ULONG)hab; | 
|---|
| 45 | } | 
|---|
| 46 | else  dprintf(("SetThreadHAB: teb == NULL!!")); | 
|---|
| 47 | } | 
|---|
| 48 | //****************************************************************************** | 
|---|
| 49 | //****************************************************************************** | 
|---|
| 50 | HMQ GetThreadMessageQueue() | 
|---|
| 51 | { | 
|---|
| 52 | TEB *teb; | 
|---|
| 53 |  | 
|---|
| 54 | teb = GetThreadTEB(); | 
|---|
| 55 | if(teb) | 
|---|
| 56 | { | 
|---|
| 57 | return (HMQ)teb->o.odin.hmq; | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 | dprintf(("GetThreadMessageQueue: teb == NULL!!")); | 
|---|
| 61 | return 0; | 
|---|
| 62 | } | 
|---|
| 63 | //****************************************************************************** | 
|---|
| 64 | //****************************************************************************** | 
|---|
| 65 | void SetThreadMessageQueue(HMQ hmq) | 
|---|
| 66 | { | 
|---|
| 67 | TEB *teb; | 
|---|
| 68 |  | 
|---|
| 69 | teb = GetThreadTEB(); | 
|---|
| 70 | if(teb) | 
|---|
| 71 | { | 
|---|
| 72 | teb->o.odin.hmq = (ULONG)hmq; | 
|---|
| 73 | } | 
|---|
| 74 | else  dprintf(("SetThreadMessageQueue: teb == NULL!!")); | 
|---|
| 75 | } | 
|---|
| 76 | //****************************************************************************** | 
|---|
| 77 | //****************************************************************************** | 
|---|
| 78 | DWORD GetThreadMessageExtraInfo() | 
|---|
| 79 | { | 
|---|
| 80 | TEB *teb; | 
|---|
| 81 |  | 
|---|
| 82 | teb = GetThreadTEB(); | 
|---|
| 83 | if(teb) | 
|---|
| 84 | { | 
|---|
| 85 | return teb->o.odin.lParam; | 
|---|
| 86 | } | 
|---|
| 87 |  | 
|---|
| 88 | dprintf(("GetThreadMessageExtraInfo: teb == NULL!!")); | 
|---|
| 89 | return 0; | 
|---|
| 90 | } | 
|---|
| 91 | //****************************************************************************** | 
|---|
| 92 | //****************************************************************************** | 
|---|
| 93 | DWORD SetThreadMessageExtraInfo(DWORD lParam) | 
|---|
| 94 | { | 
|---|
| 95 | TEB *teb; | 
|---|
| 96 |  | 
|---|
| 97 | teb = GetThreadTEB(); | 
|---|
| 98 | if(teb) | 
|---|
| 99 | { | 
|---|
| 100 | teb->o.odin.lParam = lParam; | 
|---|
| 101 | } | 
|---|
| 102 | else  dprintf(("SetThreadMessageExtraInfo: teb == NULL!!")); | 
|---|
| 103 | return 0; | 
|---|
| 104 | } | 
|---|