1 ! Copyright (C) 2010 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors destructors io.timeouts kernel windows.errors
4 windows.kernel32 windows.types ;
7 TUPLE: win32-handle < disposable handle ;
9 : set-inherit ( handle ? -- )
10 [ handle>> HANDLE_FLAG_INHERIT ] dip
11 >BOOLEAN SetHandleInformation win32-error=0/f ;
13 : new-win32-handle ( handle class -- win32-handle )
14 new-disposable swap >>handle
17 : <win32-handle> ( handle -- win32-handle )
18 win32-handle new-win32-handle ;
20 M: win32-handle dispose* ( handle -- )
21 handle>> CloseHandle win32-error=0/f ;
23 TUPLE: win32-file < win32-handle ptr ;
25 : <win32-file> ( handle -- win32-file )
26 win32-file new-win32-handle ;
29 [ cancel-operation ] [ call-next-method ] bi ;