lib/windows/file.rb in windows-pr-0.9.4 vs lib/windows/file.rb in windows-pr-0.9.5
- old
+ new
@@ -168,10 +168,27 @@
MOVEFILE_DELAY_UNTIL_REBOOT = 0x00000004
MOVEFILE_WRITE_THROUGH = 0x00000008
MOVEFILE_CREATE_HARDLINK = 0x00000010
MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x00000020
SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1
+
+ # FILE_INFO_BY_HANDLE_CLASS enum
+
+ FileBasicInfo = 0
+ FileStandardInfo = 1
+ FileNameInfo = 2
+ FileRenameInfo = 3
+ FileDispositionInfo = 4
+ FileAllocationInfo = 5
+ FileEndOfFileInfo = 6
+ FileStreamInfo = 7
+ FileCompressionInfo = 8
+ FileAttributeTagInfo = 9
+ FileIdBothDirectoryInfo = 10
+ FileIdBothDirectoryRestartInfo = 11
+ FileIoPriorityHintInfo = 12
+ MaximumFileInfoByHandleClass = 13
API.new('CopyFile', 'PPI', 'B')
API.new('CopyFileEx', 'PPKPPL', 'B')
API.new('CreateFile', 'PLLPLLL', 'L')
API.new('CreateHardLink', 'PPP', 'B')
@@ -184,10 +201,11 @@
API.new('FindNextFile', 'LP', 'B')
API.new('FlushFileBuffers', 'L', 'B')
API.new('GetBinaryType', 'PP', 'B')
API.new('GetFileAttributes', 'P', 'L')
API.new('GetFileAttributesEx', 'PPP', 'I')
+ API.new('GetFileInformationByHandle', 'LP', 'B')
API.new('GetFileSize', 'LP', 'L')
API.new('GetFileSizeEx', 'LP', 'B')
API.new('GetFileType', 'L', 'L')
API.new('GetFullPathName', 'PLPP', 'L')
API.new('GetLongPathName', 'PPL', 'L')
@@ -198,17 +216,23 @@
API.new('MoveFileEx', 'PPL', 'B')
API.new('ReadFile', 'LPLPP', 'B')
API.new('ReadFileEx', 'LPLPK', 'B')
API.new('SetEndOfFile', 'L', 'B')
API.new('SetFileAttributes', 'PL', 'B')
- API.new('SetFilePointer', 'LLPL', 'L')
- API.new('SetFilePointerEx', 'LLPL', 'B')
API.new('UnlockFile', 'LLLLL', 'B')
API.new('UnlockFileEx', 'LLLLL', 'B')
API.new('WriteFile', 'LPLPP', 'B')
API.new('WriteFileEx', 'LPLPK', 'B')
+ # XP or later
+ begin
+ API.new('SetFileShortName', 'LP', 'B')
+ API.new('SetFileValidData', 'LL', 'B')
+ rescue
+ # Do nothing. Not supported by your platform.
+ end
+
# XP 64-bit and later
begin
API.new('Wow64DisableWow64FsRedirection', 'P', 'B')
API.new('Wow64EnableWow64FsRedirection', 'I', 'I')
API.new('Wow64RevertWow64FsRedirection', 'L', 'B')
@@ -218,11 +242,13 @@
# Windows Vista
begin
API.new('CreateSymbolicLink', 'PPL', 'B')
API.new('CreateSymbolicLinkTransacted', 'PPLL', 'B')
+ API.new('GetFileInformationByHandleEx', 'LLPL', 'B')
API.new('GetFinalPathNameByHandle', 'LPLL', 'L')
- rescue
+ API.new('SetFileInformationByHandle', 'LLPL', 'B')
+ rescue Windows::API::Error
# Do nothing - unsupported on your system
end
end
end