lib/windows/msvcrt/file.rb in windows-pr-0.7.1 vs lib/windows/msvcrt/file.rb in windows-pr-0.7.2

- old
+ new

@@ -15,24 +15,40 @@ S_IFREG = 0100000 # regular S_IREAD = 0000400 # read permission, owner S_IWRITE = 0000200 # write permission, owner S_IEXEC = 0000100 # execute/search permission, owner + Chmod = API.new('_chmod', 'PI', 'I', 'msvcrt') + Chsize = API.new('_chsize', 'IL', 'I', 'msvcrt') Mktemp = API.new('_mktemp', 'P', 'P', 'msvcrt') Stat = API.new('_stat', 'PP', 'I', 'msvcrt') Stat64 = API.new('_stat64', 'PP', 'I', 'msvcrt') + Wchmod = API.new('_wchmod', 'PI', 'I', 'msvcrt') Wmktemp = API.new('_wmktemp', 'P', 'P', 'msvcrt') Wstat = API.new('_wstat', 'PP', 'I', 'msvcrt') Wstat64 = API.new('_wstat64', 'PP', 'I', 'msvcrt') # VC++ 8.0 or later begin + Chsize_s = API.new('_chsize_s', 'IL', 'I', 'msvcrt') Mktemp_s = API.new('_mktemp_s', 'PL', 'L', 'msvcrt') Wmktemp_s = API.new('_wmktemp_s', 'PL', 'L', 'msvcrt') rescue RuntimeError # Ignore - you must check for it via 'defined?' end + + def chmod(file, mode) + Chmod.call(file, mode) + end + + def chsize(fd, size) + Chsize.call(fd, size) + end + + def chsize_s(fd, size) + Chsize_s.call(fd, size) + end def mktemp(template) Mktemp.call(template) end @@ -44,9 +60,13 @@ Stat.call(path, buffer) end def stat64(path, buffer) Stat64.call(path, buffer) + end + + def wchmod(file, mode) + Wchmod.call(file, mode) end def wmktemp(template) Wmktemp.call(template) end