Rev 359 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 359 | Rev 548 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #include "fileacc.h" |
46 | #include "fileacc.h" |
47 | #include "rtinit.h" |
47 | #include "rtinit.h" |
48 | #include "seterrno.h" |
48 | #include "seterrno.h" |
49 | #include "handleio.h" |
49 | #include "handleio.h" |
Line 50... | Line -... | ||
50 | - | ||
51 | #ifdef DLHEAP |
- | |
52 | - | ||
53 | void* _cdecl dlmalloc(size_t); |
- | |
54 | void _cdecl dlfree(void*); |
- | |
55 | void _cdecl mf_init(); |
- | |
56 | - | ||
57 | #define malloc dlmalloc |
- | |
58 | #define free dlfree |
- | |
59 | #define realloc dlrealloc |
- | |
60 | - | ||
61 | #define lib_malloc dlmalloc |
- | |
62 | #define lib_free dlfree |
- | |
63 | #define lib_realloc dlrealloc |
- | |
64 | - | ||
65 | #endif |
- | |
66 | - | ||
67 | 50 | ||
Line 68... | Line 51... | ||
68 | #undef __getOSHandle |
51 | #undef __getOSHandle |
69 | 52 | ||
70 | extern unsigned __NFiles; // the size of the iomode array |
53 | extern unsigned __NFiles; // the size of the iomode array |
Line 151... | Line 134... | ||
151 | HANDLE __getOSHandle( int hid ) |
134 | HANDLE __getOSHandle( int hid ) |
152 | { |
135 | { |
153 | return( __OSHandles[ hid ] ); |
136 | return( __OSHandles[ hid ] ); |
154 | } |
137 | } |
Line -... | Line 138... | ||
- | 138 | ||
155 | 139 | ||
156 | int __setOSHandle( unsigned hid, HANDLE hdl ) |
140 | int __setOSHandle( unsigned hid, HANDLE hdl ) |
157 | { |
141 | { |
158 | // call the Win32 API for a standard file handle |
142 | // call the Win32 API for a standard file handle |
159 | switch( hid ) { |
143 | switch( hid ) { |
Line 182... | Line 166... | ||
182 | static int __topFakeHandle = 0; |
166 | static int __topFakeHandle = 0; |
Line 183... | Line 167... | ||
183 | 167 | ||
184 | HANDLE __NTGetFakeHandle( void ) |
168 | HANDLE __NTGetFakeHandle( void ) |
185 | { |
169 | { |
186 | HANDLE os_handle; |
- | |
- | 170 | HANDLE os_handle; |
|
187 | 171 | static DWORD fakeHandle = 0x80000000L; |
|
Line 188... | Line -... | ||
188 | _AccessFList(); |
- | |
189 | - | ||
190 | // os_handle = CreateEvent( 0, 0, 0, 0 ); |
- | |
191 | os_handle = 0; |
- | |
192 | if( os_handle == NULL ) |
- | |
193 | { |
- | |
194 | // win32s does not support event handles |
172 | _AccessFList(); |
195 | static DWORD fakeHandle = 0x80000000L; |
173 | |
196 | fakeHandle++; |
- | |
197 | os_handle = (HANDLE)fakeHandle; |
- | |
198 | } |
- | |
199 | else |
- | |
200 | { |
- | |
201 | __FakeHandles = lib_realloc( __FakeHandles, (__topFakeHandle+1) * sizeof( HANDLE ) ); |
- | |
202 | __FakeHandles[ __topFakeHandle ] = os_handle; |
- | |
203 | __topFakeHandle++; |
174 | fakeHandle++; |
204 | } |
175 | os_handle = (HANDLE)fakeHandle; |
205 | _ReleaseFList(); |
176 | _ReleaseFList(); |
Line 206... | Line 177... | ||
206 | return( os_handle ); |
177 | return( os_handle ); |