1 ! Copyright (C) 2004, 2010 Mackenzie Straight, Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien.c-types classes.struct destructors
4 io.backend io.timeouts kernel literals windows.errors
5 windows.handles windows.kernel32 vocabs.loader ;
8 HOOK: CreateFile-flags io-backend ( DWORD -- DWORD )
9 HOOK: FileArgs-overlapped io-backend ( port -- overlapped/f )
10 HOOK: add-completion io-backend ( port -- port )
12 TUPLE: win32-file < win32-handle ptr ;
14 : <win32-file> ( handle -- win32-file )
15 win32-file new-win32-handle ;
18 [ cancel-operation ] [ call-next-method ] bi ;
20 : opened-file ( handle -- win32-file )
21 check-invalid-handle <win32-file> |dispose add-completion ;
30 : default-security-attributes ( -- obj )
31 SECURITY_ATTRIBUTES <struct>
32 SECURITY_ATTRIBUTES heap-size >>nLength ;
34 "io.files.windows" require