* fhandler.h (class fhandler_dev_raw): Delete current_position and

eof_detected status flag.  Delete is_eom and is_eof methods.
	Move drive_size, bytes_per_sector, eom_detected status flag, as well
	as the methods read_file, write_file, raw_read and raw_write to ...
	(class fhandler_dev_floppy): ... here. Remove is_eom and is_eof
	methods.  Add dup method.
	* fhandler_floppy.cc (IS_EOM): New macro.
	(fhandler_dev_floppy::is_eom): Remove.
	(fhandler_dev_floppy::is_eof): Remove.
	(fhandler_dev_floppy::fhandler_dev_floppy): Initialize status flags.
	(fhandler_dev_floppy::get_drive_info): Only call EX functions on
	systems supporting them and stop suffering strange delays.
	(fhandler_dev_floppy::read_file): Move here, drop setting
	current_position.
	(fhandler_dev_floppy::write_file): Move here, drop setting
	current_position.
	(fhandler_dev_floppy::open): Rearrange comment.
	(fhandler_dev_floppy::dup): New method.
	(fhandler_dev_floppy::get_current_position): New inline method.  Use
	instead of former current_position were appropriate.
	(fhandler_dev_floppy::raw_read): Move here.  Drop EOF handling.
	(fhandler_dev_floppy::raw_write): Move here.  Drop EOF handling.
	(fhandler_dev_floppy::lseek): Remove useless conditions.  Convert
	sector_aligned_offset to LARGE_INTEGER to improve SetFilePointer call.
	(fhandler_dev_floppy::ioctl): Move blocksize check in RDSETBLK case
	to here.
	* fhandler_raw.cc (fhandler_dev_raw::is_eom): Remove.
	(fhandler_dev_raw::is_eof): Remove.
	(fhandler_dev_raw::write_file): Remove.
	(fhandler_dev_raw::read_file): Remove.
	(fhandler_dev_raw::raw_read): Remove.
	(fhandler_dev_raw::raw_write): Remove.
	(fhandler_dev_raw::dup): Drop copying removed members.
	(fhandler_dev_raw::ioctl): Drop blocksize testing.
	* wincap.h: Implement has_disk_ex_ioctls throughout.
	* wincap.cc: Ditto.
	(wincap_vista): Preliminary wincaps for Windows Vista/Longhorn.
	(wincapc::init): Add Vista/Longhorn handling.
This commit is contained in:
Corinna Vinschen
2005-09-28 19:02:53 +00:00
parent 280fdd0b67
commit 1204c515fe
26 changed files with 500 additions and 172 deletions

View File

@@ -75,6 +75,7 @@ details. */
#include "shared_info.h"
#include "registry.h"
#include "cygtls.h"
#include "ntdll.h"
#include <assert.h>
static int normalize_win32_path (const char *, char *, char *&);
@@ -488,25 +489,29 @@ path_conv::set_normalized_path (const char *path_copy, bool strip_tail)
PUNICODE_STRING
path_conv::get_nt_native_path (UNICODE_STRING &upath)
{
if (path[0] != '\\') /* X:\... or NUL, etc. */
if (path[0] == '\\' && path[1] != '\\')
{
str2uni_cat (upath, "\\??\\");
str2uni_cat (upath, path);
/* This handles all paths already given in NT speak. On writing this
comment, these are the raw device paths. */
if (RtlCreateUnicodeStringFromAsciiz (&upath, path))
return &upath;
}
else if (path[1] != '\\') /* \Device\... */
str2uni_cat (upath, path);
else if (path[2] != '.'
|| path[3] != '\\') /* \\server\share\... */
else
{
str2uni_cat (upath, "\\??\\UNC\\");
str2uni_cat (upath, path + 2);
wchar_t wc_path[CYG_MAX_PATH];
sys_mbstowcs (wc_path, path, CYG_MAX_PATH);
if (RtlDosPathNameToNtPathName_U (wc_path, &upath, NULL, NULL))
{
#ifdef DEBUGGING
char nt_path[CYG_MAX_PATH + 7];
sys_wcstombs (nt_path, upath.Buffer, CYG_MAX_PATH + 7);
debug_printf ("DOS: <%s> NT: <%s>", path, nt_path);
#endif
return &upath;
}
}
else /* \\.\device */
{
str2uni_cat (upath, "\\??\\");
str2uni_cat (upath, path + 4);
}
return &upath;
set_errno (ENOMEM);
return NULL;
}
/* Convert an arbitrary path SRC to a pure Win32 path, suitable for