lib/windows/file.rb in windows-pr-0.1.0 vs lib/windows/file.rb in windows-pr-0.2.0
- old
+ new
@@ -161,34 +161,41 @@
FILE_FLAG_POSIX_SEMANTICS = 0x01000000
FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000
FILE_FLAG_OPEN_NO_RECALL = 0x00100000
FILE_FLAG_FIRST_PIPE_INSTANCE = 0x00080000
+ # File creation disposition
+ CREATE_NEW = 1
+ CREATE_ALWAYS = 2
+ OPEN_EXISTING = 3
+ OPEN_ALWAYS = 4
+ TRUNCATE_EXISTING = 5
+
# Errors
INVALID_FILE_ATTRIBUTES = -1
+ INVALID_HANDLE_VALUE = -1
INVALID_FILE_SIZE = 0xFFFFFFFF
CopyFile = Win32API.new('kernel32', 'CopyFile', 'PPI', 'I')
CopyFileEx = Win32API.new('kernel32', 'CopyFileEx', 'PPPPPL', 'I')
CreateFile = Win32API.new('kernel32', 'CreateFile', 'PLLPLLL', 'L')
CreateHardLink = Win32API.new('kernel32', 'CreateHardLink', 'PPP', 'I')
- DecryptFile = Win32API.new('kernel32', 'DecryptFile', 'PL', 'I')
+ DecryptFile = Win32API.new('advapi32', 'DecryptFile', 'PL', 'I')
DeleteFile = Win32API.new('kernel32', 'DeleteFile', 'P', 'I')
- EncryptFile = Win32API.new('kernel32', 'EncryptFile', 'P', 'I')
+ EncryptFile = Win32API.new('advapi32', 'EncryptFile', 'P', 'I')
- GetBinaryType = Win32API.new('kernel32', 'GetBinaryType', 'PL', 'I')
+ GetBinaryType = Win32API.new('kernel32', 'GetBinaryType', 'PP', 'I')
GetFileAttributes = Win32API.new('kernel32', 'GetFileAttributes', 'P', 'L')
- GetFileAttributesEx = Win32API.new('kernel32', 'GetFileAttributes', 'PPP', 'I')
+ GetFileAttributesEx = Win32API.new('kernel32', 'GetFileAttributesEx', 'PPP', 'I')
GetFileSize = Win32API.new('kernel32', 'GetFileSize', 'LP', 'L')
GetFileSizeEx = Win32API.new('kernel32', 'GetFileSizeEx', 'LP', 'L')
GetFileType = Win32API.new('kernel32', 'GetFileType', 'L', 'L')
LockFile = Win32API.new('kernel32', 'LockFile', 'LLLLL', 'I')
LockFileEx = Win32API.new('kernel32', 'LockFileEx', 'LLLLLL', 'I')
ReadFile = Win32API.new('kernel32', 'ReadFile', 'LPLPP', 'I')
ReadFileEx = Win32API.new('kernel32', 'ReadFileEx', 'LPLPP', 'I')
- ReOpenFile = Win32API.new('kernel32', 'ReOpenFile', 'LLLL', 'L')
SetFileAttributes = Win32API.new('kernel32', 'SetFileAttributes', 'PL', 'I')
UnlockFile = Win32API.new('kernel32', 'UnlockFile', 'LLLLL', 'I')
UnlockFileEx = Win32API.new('kernel32', 'UnlockFileEx', 'LLLLL', 'I')
@@ -259,13 +266,9 @@
ReadFile.call(file, buf, bytes, bytes_read, overlapped) > 0
end
def ReadFileEx(file, buf, bytes, overlapped, routine)
ReadFileEx.call(file, buf, bytes, overlapped, routine) > 0
- end
-
- def ReOpenFile(handle, access, mode, flags)
- ReOpenFile.call(handle, access, mode, flags)
end
def SetFileAttributes(file, attributes)
SetFileAttributes.call(file, attributes) > 0
end