9107
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2004 by eXept Software AG
|
10340
|
3 |
All Rights Reserved
|
9107
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libbasic' }"
|
|
13 |
|
|
14 |
OSHandle subclass:#Win32Handle
|
|
15 |
instanceVariableNames:''
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'OS-Windows'
|
|
19 |
!
|
|
20 |
|
9110
|
21 |
!Win32Handle primitiveDefinitions!
|
|
22 |
%{
|
|
23 |
|
|
24 |
#include "stxOSDefs.h"
|
|
25 |
|
|
26 |
/*
|
|
27 |
* ensure that ST/X runs on NT, 95 and 98
|
|
28 |
* (however, this disables some Win2K and XP features (sigh)
|
|
29 |
*/
|
|
30 |
#ifndef WINVER
|
|
31 |
# define WINVER 0x0400
|
|
32 |
#endif
|
|
33 |
|
|
34 |
#if WINVER < 0x0400
|
|
35 |
# define NO_GETADAPTERSINFO
|
|
36 |
#endif
|
|
37 |
|
|
38 |
#define WANT_OLE
|
|
39 |
#define OLE_DEBUG
|
|
40 |
#define COBJMACROS
|
|
41 |
#define CINTERFACE
|
|
42 |
|
|
43 |
#define USE_H_ERRNO
|
|
44 |
|
|
45 |
# if defined(i386) || defined(__i386__)
|
|
46 |
# ifndef _X86_
|
|
47 |
# define _X86_
|
|
48 |
# endif
|
|
49 |
# endif
|
|
50 |
|
|
51 |
/*
|
|
52 |
* notice: although many systems' include files
|
|
53 |
* already block against multiple inclusion, some
|
|
54 |
* do not. Therefore, this is done here again.
|
|
55 |
* (it does not hurt)
|
|
56 |
*/
|
|
57 |
|
|
58 |
# undef INT
|
14644
|
59 |
# undef UINT
|
9110
|
60 |
# undef Array
|
|
61 |
# undef Number
|
|
62 |
# undef Method
|
|
63 |
# undef Point
|
|
64 |
# undef Rectangle
|
|
65 |
# undef Block
|
|
66 |
# undef String
|
|
67 |
# undef Message
|
|
68 |
# undef Object
|
|
69 |
# undef Context
|
|
70 |
# undef Time
|
|
71 |
# undef Date
|
|
72 |
# undef Set
|
|
73 |
# undef Signal
|
|
74 |
# undef Delay
|
|
75 |
# undef Message
|
|
76 |
# undef Process
|
10340
|
77 |
# undef Processor
|
9110
|
78 |
|
|
79 |
# include <stdarg.h> /* */
|
|
80 |
|
|
81 |
# ifndef WINDOWS_H_INCLUDED
|
|
82 |
# define WINDOWS_H_INCLUDED
|
|
83 |
# include <windows.h>
|
|
84 |
# endif
|
|
85 |
|
|
86 |
# ifdef WANT_OLE
|
|
87 |
|
|
88 |
#if 0
|
|
89 |
# ifndef COMDEF_H_INCLUDED
|
|
90 |
# define COMDEF_H_INCLUDED
|
|
91 |
# include <comdef.h>
|
|
92 |
# endif
|
|
93 |
#endif
|
|
94 |
|
|
95 |
# ifndef OLEAUTO_H_INCLUDED
|
|
96 |
# define OLEAUTO_H_INCLUDED
|
|
97 |
# include <oleauto.h>
|
|
98 |
# endif
|
|
99 |
|
|
100 |
# endif
|
|
101 |
|
|
102 |
# ifdef __DEF_Array
|
|
103 |
# define Array __DEF_Array
|
|
104 |
# endif
|
|
105 |
# ifdef __DEF_Number
|
|
106 |
# define Number __DEF_Number
|
|
107 |
# endif
|
|
108 |
# ifdef __DEF_Method
|
|
109 |
# define Method __DEF_Method
|
|
110 |
# endif
|
|
111 |
# ifdef __DEF_Point
|
|
112 |
# define Point __DEF_Point
|
|
113 |
# endif
|
|
114 |
# ifdef __DEF_Rectangle
|
|
115 |
# define Rectangle __DEF_Rectangle
|
|
116 |
# endif
|
|
117 |
# ifdef __DEF_Block
|
|
118 |
# define Block __DEF_Block
|
|
119 |
# endif
|
|
120 |
# ifdef __DEF_String
|
|
121 |
# define String __DEF_String
|
|
122 |
# endif
|
|
123 |
# ifdef __DEF_Message
|
|
124 |
# define Message __DEF_Message
|
|
125 |
# endif
|
|
126 |
# ifdef __DEF_Object
|
|
127 |
# define Object __DEF_Object
|
|
128 |
# endif
|
|
129 |
# ifdef __DEF_Context
|
|
130 |
# define Context __DEF_Context
|
|
131 |
# endif
|
|
132 |
# ifdef __DEF_Date
|
|
133 |
# define Date __DEF_Date
|
|
134 |
# endif
|
|
135 |
# ifdef __DEF_Time
|
|
136 |
# define Time __DEF_Time
|
|
137 |
# endif
|
|
138 |
# ifdef __DEF_Set
|
|
139 |
# define Set __DEF_Set
|
|
140 |
# endif
|
|
141 |
# ifdef __DEF_Signal
|
|
142 |
# define Signal __DEF_Signal
|
|
143 |
# endif
|
|
144 |
# ifdef __DEF_Delay
|
|
145 |
# define Delay __DEF_Delay
|
|
146 |
# endif
|
|
147 |
# ifdef __DEF_Message
|
|
148 |
# define Message __DEF_Message
|
|
149 |
# endif
|
|
150 |
# ifdef __DEF_Process
|
|
151 |
# define Process __DEF_Process
|
|
152 |
# endif
|
10340
|
153 |
# ifdef __DEF_Processor
|
|
154 |
# define Processor __DEF_Processor
|
|
155 |
# endif
|
9110
|
156 |
|
14644
|
157 |
# define INT STX_INT
|
|
158 |
# define UINT STX_UINT
|
9110
|
159 |
|
|
160 |
typedef int (*intf)(int);
|
|
161 |
|
|
162 |
#define _HANDLEVal(o) (HANDLE)(__externalAddressVal(o))
|
|
163 |
|
|
164 |
%}
|
|
165 |
! !
|
|
166 |
|
9172
|
167 |
!Win32Handle class methodsFor:'documentation'!
|
|
168 |
|
|
169 |
copyright
|
|
170 |
"
|
|
171 |
COPYRIGHT (c) 2004 by eXept Software AG
|
10340
|
172 |
All Rights Reserved
|
9172
|
173 |
|
|
174 |
This software is furnished under a license and may be used
|
|
175 |
only in accordance with the terms of that license and with the
|
|
176 |
inclusion of the above copyright notice. This software may not
|
|
177 |
be provided or otherwise made available to, or used by, any
|
|
178 |
other person. No title to or ownership of the software is
|
|
179 |
hereby transferred.
|
|
180 |
"
|
|
181 |
!
|
|
182 |
|
|
183 |
documentation
|
|
184 |
"
|
|
185 |
I represent a non-I/O HANDLE.
|
|
186 |
"
|
|
187 |
! !
|
9110
|
188 |
|
9107
|
189 |
!Win32Handle methodsFor:'release'!
|
|
190 |
|
9172
|
191 |
close
|
|
192 |
"close the handle"
|
|
193 |
|
|
194 |
self closeHandle
|
|
195 |
!
|
|
196 |
|
9107
|
197 |
closeHandle
|
|
198 |
"close the handle"
|
|
199 |
|
|
200 |
%{
|
9110
|
201 |
HANDLE h = _HANDLEVal(self);
|
9107
|
202 |
|
|
203 |
if (h) {
|
10340
|
204 |
__externalAddressVal(self) = (HANDLE)0;
|
|
205 |
CloseHandle(h);
|
9107
|
206 |
}
|
|
207 |
%}.
|
|
208 |
!
|
|
209 |
|
|
210 |
finalize
|
|
211 |
"a filedescriptor was garbage collected - close the underlying handle"
|
|
212 |
|
|
213 |
self closeHandle
|
|
214 |
! !
|
|
215 |
|
|
216 |
!Win32Handle class methodsFor:'documentation'!
|
|
217 |
|
|
218 |
version
|
14644
|
219 |
^ '$Header: /cvs/stx/stx/libbasic/Win32Handle.st,v 1.9 2013-01-10 11:43:30 cg Exp $'
|
9107
|
220 |
! !
|