Method: Cosmos::Win32.create_file

Defined in:
lib/cosmos/win32/win32.rb

.create_file(filename, desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file = NULL) ⇒ Object

Create a file



27
28
29
30
31
32
33
34
# File 'lib/cosmos/win32/win32.rb', line 27

def self.create_file(filename, desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file = NULL)
  api = Win32API.new('Kernel32', 'CreateFile', [LP, DWORD, DWORD, LP, DWORD, DWORD, HANDLE], HANDLE)

  handle = api.call(filename, desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file)
  raise "Error during CreateFile: #{get_last_error_message()}" if handle == INVALID_HANDLE_VALUE

  handle
end