windows.kernel32, io.files.windows: Add support for listing alternate data
streams, e.g. file paths like foo.txt:Zone.Identifier.db4
parent
48a0fa5428
commit
26e5c1aecf
|
@ -6,9 +6,9 @@ combinators.short-circuit continuations destructors environment io
|
||||||
io.backend io.binary io.buffers io.files io.files.private
|
io.backend io.binary io.buffers io.files io.files.private
|
||||||
io.files.types io.pathnames io.ports io.streams.c io.streams.null
|
io.files.types io.pathnames io.ports io.streams.c io.streams.null
|
||||||
io.timeouts kernel libc literals locals math math.bitwise namespaces
|
io.timeouts kernel libc literals locals math math.bitwise namespaces
|
||||||
sequences specialized-arrays system threads tr windows windows.errors
|
sequences specialized-arrays system threads tr vectors windows
|
||||||
windows.handles windows.kernel32 windows.shell32 windows.time
|
windows.errors windows.handles windows.kernel32 windows.shell32
|
||||||
windows.types windows.winsock ;
|
windows.time windows.types windows.winsock ;
|
||||||
SPECIALIZED-ARRAY: ushort
|
SPECIALIZED-ARRAY: ushort
|
||||||
IN: io.files.windows
|
IN: io.files.windows
|
||||||
|
|
||||||
|
@ -381,3 +381,34 @@ M: windows home
|
||||||
[ "USERPROFILE" os-env ]
|
[ "USERPROFILE" os-env ]
|
||||||
[ my-documents ]
|
[ my-documents ]
|
||||||
} 0|| ;
|
} 0|| ;
|
||||||
|
|
||||||
|
: STREAM_DATA>out ( WIN32_FIND_STREAM_DATA -- pair/f )
|
||||||
|
[ cStreamName>> alien>native-string ]
|
||||||
|
[ StreamSize>> ] bi 2array ;
|
||||||
|
|
||||||
|
: file-streams-rest ( streams handle -- streams )
|
||||||
|
WIN32_FIND_STREAM_DATA <struct>
|
||||||
|
[ FindNextStream ] 2keep
|
||||||
|
rot zero? [
|
||||||
|
GetLastError ERROR_HANDLE_EOF = [ win32-error ] unless
|
||||||
|
2drop
|
||||||
|
] [
|
||||||
|
pick push file-streams-rest
|
||||||
|
] if ;
|
||||||
|
|
||||||
|
: file-streams ( path -- streams )
|
||||||
|
FindStreamInfoStandard
|
||||||
|
WIN32_FIND_STREAM_DATA <struct>
|
||||||
|
0
|
||||||
|
[ FindFirstStream ] 2keep drop
|
||||||
|
over ALIEN: -1 = [
|
||||||
|
2drop throw-win32-error
|
||||||
|
] [
|
||||||
|
1vector swap file-streams-rest
|
||||||
|
] if ;
|
||||||
|
|
||||||
|
: alternate-file-streams ( path -- streams )
|
||||||
|
file-streams [ cStreamName>> alien>native-string "::$DATA" = not ] filter ;
|
||||||
|
|
||||||
|
: alternate-file-streams? ( path -- streams )
|
||||||
|
alternate-file-streams empty? not ;
|
||||||
|
|
|
@ -1161,6 +1161,28 @@ ALIAS: FindFirstChangeNotification FindFirstChangeNotificationW
|
||||||
! FUNCTION: FindFirstFileExW
|
! FUNCTION: FindFirstFileExW
|
||||||
FUNCTION: HANDLE FindFirstFileW ( LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData )
|
FUNCTION: HANDLE FindFirstFileW ( LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData )
|
||||||
ALIAS: FindFirstFile FindFirstFileW
|
ALIAS: FindFirstFile FindFirstFileW
|
||||||
|
|
||||||
|
ENUM: STREAM_INFO_LEVELS
|
||||||
|
FindStreamInfoStandard
|
||||||
|
FindStreamInfoMaxInfoLevel ;
|
||||||
|
|
||||||
|
STRUCT: WIN32_FIND_STREAM_DATA
|
||||||
|
{ StreamSize LARGE_INTEGER }
|
||||||
|
{ cStreamName WCHAR[292] } ;
|
||||||
|
|
||||||
|
TYPEDEF: WIN32_FIND_STREAM_DATA* PWIN32_FIND_STREAM_DATA
|
||||||
|
|
||||||
|
FUNCTION: HANDLE FindFirstStreamW (
|
||||||
|
LPCWSTR lpFileName,
|
||||||
|
STREAM_INFO_LEVELS InfoLevel,
|
||||||
|
LPVOID lpFindStreamData,
|
||||||
|
DWORD dwFlags
|
||||||
|
)
|
||||||
|
ALIAS: FindFirstStream FindFirstStreamW
|
||||||
|
|
||||||
|
FUNCTION: BOOL FindNextStreamW ( HANDLE hFindStream, LPVOID lpFindStreamData )
|
||||||
|
ALIAS: FindNextStream FindNextStreamW
|
||||||
|
|
||||||
! FUNCTION: FindFirstVolumeA
|
! FUNCTION: FindFirstVolumeA
|
||||||
! FUNCTION: FindFirstVolumeMountPointA
|
! FUNCTION: FindFirstVolumeMountPointA
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue