Throughout, open console handles with sharing for reading and writing.
* dcrt0.cc (insert_file): Open file with full sharing allowed. * hookapi.cc (find_first_notloaded_dll): Ditto. * spawn.cc (av::fixup): Ditto.
This commit is contained in:
parent
d3ed549d51
commit
fc3e7da6b0
|
@ -1,3 +1,10 @@
|
|||
2011-07-04 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
Throughout, open console handles with sharing for reading and writing.
|
||||
* dcrt0.cc (insert_file): Open file with full sharing allowed.
|
||||
* hookapi.cc (find_first_notloaded_dll): Ditto.
|
||||
* spawn.cc (av::fixup): Ditto.
|
||||
|
||||
2011-07-04 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* dtable.cc (dtable::init_std_file_from_handle): Change test for console
|
||||
|
|
|
@ -33,8 +33,8 @@ __assert_func (const char *file, int line, const char *func,
|
|||
/* If we don't have a console in a Windows program, then bring up a
|
||||
message box for the assertion failure. */
|
||||
|
||||
h = CreateFile ("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, &sec_none_nih,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
h = CreateFile ("CONOUT$", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
&sec_none_nih, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
PWCHAR buf = (PWCHAR) alloca ((100 + strlen (failedexpr))
|
||||
|
|
|
@ -95,12 +95,12 @@ insert_file (char *name, char *&cmd)
|
|||
PWCHAR wname = tp.w_get ();
|
||||
sys_mbstowcs (wname, NT_MAX_PATH, name + 1);
|
||||
f = CreateFileW (wname,
|
||||
GENERIC_READ, /* open for reading */
|
||||
FILE_SHARE_READ, /* share for reading */
|
||||
&sec_none_nih, /* default security */
|
||||
OPEN_EXISTING, /* existing file only */
|
||||
FILE_ATTRIBUTE_NORMAL,/* normal file */
|
||||
NULL); /* no attr. template */
|
||||
GENERIC_READ, /* open for reading */
|
||||
FILE_SHARE_VALID_FLAGS, /* share for reading */
|
||||
&sec_none_nih, /* default security */
|
||||
OPEN_EXISTING, /* existing file only */
|
||||
FILE_ATTRIBUTE_NORMAL, /* normal file */
|
||||
NULL); /* no attr. template */
|
||||
|
||||
if (f == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
|
|
@ -324,9 +324,9 @@ frok::parent (volatile char * volatile stack_here)
|
|||
/* If we don't have a console, then don't create a console for the
|
||||
child either. */
|
||||
HANDLE console_handle = CreateFile ("CONOUT$", GENERIC_WRITE,
|
||||
FILE_SHARE_WRITE, &sec_none_nih,
|
||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
|
||||
NULL);
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
&sec_none_nih, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (console_handle != INVALID_HANDLE_VALUE)
|
||||
CloseHandle (console_handle);
|
||||
|
|
|
@ -174,7 +174,7 @@ find_first_notloaded_dll (path_conv& pc)
|
|||
|
||||
status = NtOpenFile (&h, SYNCHRONIZE | GENERIC_READ,
|
||||
pc.get_object_attr (attr, sec_none_nih),
|
||||
&io, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
&io, FILE_SHARE_VALID_FLAGS,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT
|
||||
| FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| FILE_NON_DIRECTORY_FILE);
|
||||
|
|
|
@ -1052,7 +1052,7 @@ av::fixup (const char *prog_arg, path_conv& real_path, const char *ext,
|
|||
|
||||
status = NtOpenFile (&h, SYNCHRONIZE | GENERIC_READ,
|
||||
real_path.get_object_attr (attr, sec_none_nih),
|
||||
&io, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
&io, FILE_SHARE_VALID_FLAGS,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT
|
||||
| FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| FILE_NON_DIRECTORY_FILE);
|
||||
|
|
|
@ -259,7 +259,7 @@ strace::vprntf (unsigned category, const char *func, const char *fmt, va_list ap
|
|||
if (GetFileType (GetStdHandle (STD_ERROR_HANDLE)) != FILE_TYPE_CHAR)
|
||||
{
|
||||
HANDLE h = CreateFile ("CONOUT$", GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_WRITE | FILE_SHARE_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
&sec_none, OPEN_EXISTING, 0, 0);
|
||||
if (h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue