#include "pinfo.h"
#include <assert.h>
#include <ctype.h>
+#include <winioctl.h>
#define _COMPILING_NEWLIB
#include <dirent.h>
return 0;
}
+ /* Set newly created and truncated files as sparse files. */
+ if ((real_path->fs_flags () & FILE_SUPPORTS_SPARSE_FILES)
+ && (get_access () & GENERIC_WRITE) == GENERIC_WRITE
+ && (get_flags () & (O_CREAT | O_TRUNC)))
+ {
+ DWORD dw;
+ HANDLE h = get_handle ();
+ BOOL r = DeviceIoControl (h , FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &dw,
+ NULL);
+ syscall_printf ("%d = DeviceIoControl(0x%x, FSCTL_SET_SPARSE, NULL, 0, "
+ "NULL, 0, &dw, NULL)", r, h);
+ }
+
set_symlink_p (real_path->issymlink ());
set_execable_p (real_path->exec_state ());
set_socket_p (real_path->issocket ());
has_64bit_file_access:false,
has_process_io_counters:false,
supports_reading_modem_output_lines:false,
- needs_memory_protection:false
+ needs_memory_protection:false,
+ supports_sparse_files:false
};
static NO_COPY wincaps wincap_95 = {
has_64bit_file_access:false,
has_process_io_counters:false,
supports_reading_modem_output_lines:false,
- needs_memory_protection:false
+ needs_memory_protection:false,
+ supports_sparse_files:false
};
static NO_COPY wincaps wincap_95osr2 = {
has_64bit_file_access:false,
has_process_io_counters:false,
supports_reading_modem_output_lines:false,
- needs_memory_protection:false
+ needs_memory_protection:false,
+ supports_sparse_files:false
};
static NO_COPY wincaps wincap_98 = {
has_64bit_file_access:false,
has_process_io_counters:false,
supports_reading_modem_output_lines:false,
- needs_memory_protection:false
+ needs_memory_protection:false,
+ supports_sparse_files:false
};
static NO_COPY wincaps wincap_98se = {
has_64bit_file_access:false,
has_process_io_counters:false,
supports_reading_modem_output_lines:false,
- needs_memory_protection:false
+ needs_memory_protection:false,
+ supports_sparse_files:false
};
static NO_COPY wincaps wincap_me = {
has_64bit_file_access:false,
has_process_io_counters:false,
supports_reading_modem_output_lines:false,
- needs_memory_protection:false
+ needs_memory_protection:false,
+ supports_sparse_files:false
};
static NO_COPY wincaps wincap_nt3 = {
has_64bit_file_access:true,
has_process_io_counters:false,
supports_reading_modem_output_lines:true,
- needs_memory_protection:true
+ needs_memory_protection:true,
+ supports_sparse_files:false
};
static NO_COPY wincaps wincap_nt4 = {
has_64bit_file_access:true,
has_process_io_counters:false,
supports_reading_modem_output_lines:true,
- needs_memory_protection:true
+ needs_memory_protection:true,
+ supports_sparse_files:false
};
static NO_COPY wincaps wincap_nt4sp4 = {
has_64bit_file_access:true,
has_process_io_counters:false,
supports_reading_modem_output_lines:true,
- needs_memory_protection:true
+ needs_memory_protection:true,
+ supports_sparse_files:false
};
static NO_COPY wincaps wincap_2000 = {
has_64bit_file_access:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
- needs_memory_protection:true
+ needs_memory_protection:true,
+ supports_sparse_files:true
};
static NO_COPY wincaps wincap_xp = {
has_64bit_file_access:true,
has_process_io_counters:true,
supports_reading_modem_output_lines:true,
- needs_memory_protection:true
+ needs_memory_protection:true,
+ supports_sparse_files:true
};
wincapc wincap;