* autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro.
(LoadFuncEx2): Adapted from LoadFuncEx. Provides control of return value for nonexistent function. (NtQueryObject): Declare. (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not available. * debug.h (being_debugged): Just rely on IsDebuggerPresent return value. * dtable.cc (handle_to_fn): New function. (dtable::init_std_file_from_handle): Attempt to derive std handle's name via handle_to_fn. (dtable::build_fhandler_from_name): Fill in what we can in path_conv structure when given a handle and path doesn't exist. * fhandler.cc (fhandler_base::open): Don't set the file pointer here. Use pc->exists () to determine if file exists rather than calling GetFileAttributes again. * fhandler.h (fhandler_base::exec_state_isknown): New method. (fhandler_base::fstat_helper): Add extra arguments to declaration. (fhandler_base::fstat_by_handle): Declare new method. (fhandler_base::fstat_by_name): Declare new method. * fhandler_disk_file (num_entries): Make __stdcall. (fhandler_base::fstat_by_handle): Define new method. (fhandler_base::fstat_by_name): Define new method. (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate. (fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat structure. Move handle or name specific stuff to new methods above. (fhandler_disk_file::open): Use real_path->exists rather than calling GetFileAttributes again. * ntdll.h (FILE_NAME_INFORMATION): Define new structure. (OBJECT_INFORMATION_CLASS): Partially define new enum. (OBJECT_NAME_INFORMATION): Define new structure. (NtQueryInformationFile): New declaration. (NtQueryObject): New declaration. * path.cc (path_conv::fillin): Define new method. * path.h (path_conv::fillin): Declare new method. (path_conv::drive_thpe): Rename from 'get_drive_type'. (path_conv::volser): Declare new method. (path_conv::volname): Declare new method. (path_conv::root_dir): Declare new method. * syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
This commit is contained in:
@ -309,7 +309,7 @@ fhandler_base::get_default_fmode (int flags)
|
||||
|
||||
/* Open system call handler function. */
|
||||
int
|
||||
fhandler_base::open (path_conv *, int flags, mode_t mode)
|
||||
fhandler_base::open (path_conv *pc, int flags, mode_t mode)
|
||||
{
|
||||
int res = 0;
|
||||
HANDLE x;
|
||||
@ -318,7 +318,7 @@ fhandler_base::open (path_conv *, int flags, mode_t mode)
|
||||
int creation_distribution;
|
||||
SECURITY_ATTRIBUTES sa = sec_none;
|
||||
|
||||
syscall_printf ("(%s, %p)", get_win32_name (), flags);
|
||||
syscall_printf ("(%s, %p) query_open %d", get_win32_name (), flags, get_query_open ());
|
||||
|
||||
if (get_win32_name () == NULL)
|
||||
{
|
||||
@ -375,7 +375,7 @@ fhandler_base::open (path_conv *, int flags, mode_t mode)
|
||||
{
|
||||
char *c = strrchr (get_win32_name (), '\\');
|
||||
if ((c && c[1] == '.') || *get_win32_name () == '.')
|
||||
file_attributes |= FILE_ATTRIBUTE_HIDDEN;
|
||||
file_attributes |= FILE_ATTRIBUTE_HIDDEN;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -385,7 +385,7 @@ fhandler_base::open (path_conv *, int flags, mode_t mode)
|
||||
if (get_query_open () &&
|
||||
isremote () &&
|
||||
creation_distribution == OPEN_EXISTING &&
|
||||
GetFileAttributes (get_win32_name ()) == INVALID_FILE_ATTRIBUTES)
|
||||
!pc->exists ())
|
||||
{
|
||||
set_errno (ENOENT);
|
||||
goto done;
|
||||
@ -447,16 +447,6 @@ fhandler_base::open (path_conv *, int flags, mode_t mode)
|
||||
set_w_binary (bin);
|
||||
syscall_printf ("filemode set to %s", bin ? "binary" : "text");
|
||||
|
||||
if (get_device () != FH_TAPE
|
||||
&& get_device () != FH_FLOPPY
|
||||
&& get_device () != FH_SERIAL)
|
||||
{
|
||||
if (flags & O_APPEND)
|
||||
SetFilePointer (get_handle(), 0, 0, FILE_END);
|
||||
else
|
||||
SetFilePointer (get_handle(), 0, 0, FILE_BEGIN);
|
||||
}
|
||||
|
||||
res = 1;
|
||||
set_open_status ();
|
||||
done:
|
||||
|
Reference in New Issue
Block a user