factor/basis/io/backend/windows/windows.factor

34 lines
1.0 KiB
Factor
Raw Normal View History

! Copyright (C) 2004, 2010 Mackenzie Straight, Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types classes.struct destructors
io.backend io.timeouts kernel literals windows.errors
windows.handles windows.kernel32 vocabs.loader ;
IN: io.backend.windows
2007-09-20 18:09:08 -04:00
HOOK: CreateFile-flags io-backend ( DWORD -- DWORD )
2007-09-20 18:09:08 -04:00
HOOK: FileArgs-overlapped io-backend ( port -- overlapped/f )
HOOK: add-completion io-backend ( port -- port )
2007-09-20 18:09:08 -04:00
TUPLE: win32-file < win32-handle ptr ;
: <win32-file> ( handle -- win32-file )
win32-file new-win32-handle ;
M: win32-file dispose
[ cancel-operation ] [ call-next-method ] bi ;
: opened-file ( handle -- win32-file )
check-invalid-handle <win32-file> |dispose add-completion ;
CONSTANT: share-mode
flags{
2008-02-02 14:29:09 -05:00
FILE_SHARE_READ
FILE_SHARE_WRITE
FILE_SHARE_DELETE
}
2008-01-25 00:49:03 -05:00
: default-security-attributes ( -- obj )
SECURITY_ATTRIBUTES <struct>
2009-09-04 10:27:46 -04:00
SECURITY_ATTRIBUTES heap-size >>nLength ;
"io.files.windows" require