Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on WinPE #163

Open
wants to merge 2 commits into
base: msys2-3.4.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions winsup/cygwin/local_includes/mount.h
Expand Up @@ -47,6 +47,7 @@ enum fs_info_type
ncfsd,
afs,
prlfs,
ramdisk,
/* Always last. */
max_fs_type
};
Expand Down Expand Up @@ -117,6 +118,7 @@ class fs_info
IMPLEMENT_FS_FLAG (ncfsd)
IMPLEMENT_FS_FLAG (afs)
IMPLEMENT_FS_FLAG (prlfs)
IMPLEMENT_FS_FLAG (ramdisk)
fs_info_type what_fs () const { return status.fs_type; }
bool got_fs () const { return status.fs_type != none; }

Expand Down
1 change: 1 addition & 0 deletions winsup/cygwin/local_includes/path.h
Expand Up @@ -387,6 +387,7 @@ class path_conv
bool fs_is_ncfsd () const {return fs.is_ncfsd ();}
bool fs_is_afs () const {return fs.is_afs ();}
bool fs_is_prlfs () const {return fs.is_prlfs ();}
bool fs_is_ramdisk () const {return fs.is_ramdisk ();}
fs_info_type fs_type () const {return fs.what_fs ();}
ULONG fs_serial_number () const {return fs.serial_number ();}
inline const char *set_path (const char *p)
Expand Down
5 changes: 2 additions & 3 deletions winsup/cygwin/mm/mmap.cc
Expand Up @@ -956,11 +956,10 @@ mmap (void *addr, size_t len, int prot, int flags, int fd, off_t off)
HANDLE h;
IO_STATUS_BLOCK io;

InitializeObjectAttributes (&attr, &ro_u_empty, fh->pc.objcaseinsensitive (),
fh->get_handle (), NULL);
status = NtOpenFile (&h,
fh->get_access () | GENERIC_EXECUTE | SYNCHRONIZE,
&attr, &io, FILE_SHARE_VALID_FLAGS,
fh->pc.init_reopen_attr (attr, h), &io,
FILE_SHARE_VALID_FLAGS,
FILE_SYNCHRONOUS_IO_NONALERT
| FILE_OPEN_FOR_BACKUP_INTENT);
if (NT_SUCCESS (status))
Expand Down
12 changes: 12 additions & 0 deletions winsup/cygwin/mount.cc
Expand Up @@ -291,6 +291,17 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
if (!NT_SUCCESS (status))
ffdi.DeviceType = ffdi.Characteristics = 0;

if (upath->Buffer[5] == L':' && upath->Buffer[6] == L'\\')
{
WCHAR dos[3] = {upath->Buffer[4], upath->Buffer[5], L'\0'};
WCHAR dev[MAX_PATH];
if (QueryDosDeviceW (dos, dev, MAX_PATH))
{
is_ramdisk (wcsncmp (dev, L"\\Device\\Ramdisk", 15));
has_buggy_reopen (is_ramdisk ());
}
}

if ((ffdi.Characteristics & FILE_REMOTE_DEVICE)
|| (!ffdi.DeviceType
&& RtlEqualUnicodePathPrefix (attr.ObjectName, &ro_u_uncp, TRUE)))
Expand Down Expand Up @@ -1710,6 +1721,7 @@ fs_names_t fs_names[] = {
{ "ncfsd", false },
{ "afs", false },
{ "prlfs", false },
{ "ramdisk", false },
{ NULL, false }
};

Expand Down