105 lines
3.1 KiB
V
105 lines
3.1 KiB
V
module os
|
|
|
|
// Ref - winnt.h
|
|
const (
|
|
success = 0 // ERROR_SUCCESS
|
|
error_insufficient_buffer = 130
|
|
)
|
|
|
|
const (
|
|
file_share_read = 1
|
|
file_share_write = 2
|
|
file_share_delete = 4
|
|
)
|
|
|
|
const (
|
|
file_notify_change_file_name = 1
|
|
file_notify_change_dir_name = 2
|
|
file_notify_change_attributes = 4
|
|
file_notify_change_size = 8
|
|
file_notify_change_last_write = 16
|
|
file_notify_change_last_access = 32
|
|
file_notify_change_creation = 64
|
|
file_notify_change_security = 128
|
|
)
|
|
|
|
const (
|
|
file_action_added = 1
|
|
file_action_removed = 2
|
|
file_action_modified = 3
|
|
file_action_renamed_old_name = 4
|
|
file_action_renamed_new_name = 5
|
|
)
|
|
|
|
const (
|
|
file_attr_readonly = 0x1
|
|
file_attr_hidden = 0x2
|
|
file_attr_system = 0x4
|
|
file_attr_directory = 0x10
|
|
file_attr_archive = 0x20
|
|
file_attr_device = 0x40
|
|
file_attr_normal = 0x80
|
|
file_attr_temporary = 0x100
|
|
file_attr_sparse_file = 0x200
|
|
file_attr_reparse_point = 0x400
|
|
file_attr_compressed = 0x800
|
|
file_attr_offline = 0x1000
|
|
file_attr_not_content_indexed = 0x2000
|
|
file_attr_encrypted = 0x4000
|
|
file_attr_integrity_stream = 0x8000
|
|
file_attr_virtual = 0x10000
|
|
file_attr_no_scrub_data = 0x20000
|
|
// file_attr_recall_on_open = u32(0x...)
|
|
// file_attr_recall_on_data_access = u32(0x...)
|
|
)
|
|
|
|
const (
|
|
file_type_disk = 0x1
|
|
file_type_char = 0x2
|
|
file_type_pipe = 0x3
|
|
|
|
file_type_unknown = 0x0
|
|
)
|
|
|
|
const (
|
|
file_invalid_file_id = (-1)
|
|
)
|
|
|
|
const(
|
|
invalid_handle_value = voidptr(-1)
|
|
)
|
|
|
|
// https://docs.microsoft.com/en-us/windows/console/setconsolemode
|
|
const (
|
|
// Input Buffer
|
|
enable_echo_input = 0x0004
|
|
enable_extended_flags = 0x0080
|
|
enable_insert_mode = 0x0020
|
|
enable_line_input = 0x0002
|
|
enable_mouse_input = 0x0010
|
|
enable_processed_input = 0x0001
|
|
enable_quick_edit_mode = 0x0040
|
|
enable_window_input = 0x0008
|
|
enable_virtual_terminal_input = 0x0200
|
|
// Output Screen Buffer
|
|
enable_processed_output = 0x0001
|
|
enable_wrap_at_eol_output = 0x0002
|
|
enable_virtual_terminal_processing = 0x0004
|
|
disable_newline_auto_return = 0x0008
|
|
enable_lvb_grid_worldwide = 0x0010
|
|
)
|
|
|
|
// File modes
|
|
const (
|
|
o_rdonly = 0 // open the file read-only.
|
|
o_wronly = 1 // open the file write-only.
|
|
o_rdwr = 2 // open the file read-write.
|
|
o_append = 0x0008 // append data to the file when writing.
|
|
o_create = 0x0100 // create a new file if none exists.
|
|
o_trunc = 0x0200 // truncate regular writable file when opened.
|
|
o_excl = 0x0400 // used with o_create, file must not exist.
|
|
o_sync = 0 // open for synchronous I/O (ignored on Windows)
|
|
o_noctty = 0 // make file non-controlling tty (ignored on Windows)
|
|
o_nonblock = 0 // don't block on opening file (ignored on Windows)
|
|
)
|