* syscalls.cc (try_to_bin): Use tmp_pathbuf buffer to allocate infobuf
rather than using the stack.
This commit is contained in:
parent
214a0e67fd
commit
0c4023011d
@ -1,3 +1,8 @@
|
|||||||
|
2009-04-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* syscalls.cc (try_to_bin): Use tmp_pathbuf buffer to allocate infobuf
|
||||||
|
rather than using the stack.
|
||||||
|
|
||||||
2009-04-09 Corinna Vinschen <corinna@vinschen.de>
|
2009-04-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* syscalls.cc (try_to_bin): Fix alignment of infobuf.
|
* syscalls.cc (try_to_bin): Fix alignment of infobuf.
|
||||||
|
@ -153,14 +153,13 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access)
|
|||||||
PFILE_NAME_INFORMATION pfni;
|
PFILE_NAME_INFORMATION pfni;
|
||||||
PFILE_INTERNAL_INFORMATION pfii;
|
PFILE_INTERNAL_INFORMATION pfii;
|
||||||
PFILE_RENAME_INFORMATION pfri;
|
PFILE_RENAME_INFORMATION pfri;
|
||||||
/* Enforce alignment for multi-purpose infobuf buffer */
|
|
||||||
BYTE infobuf[sizeof (FILE_NAME_INFORMATION) + 32767 * sizeof (WCHAR)]
|
|
||||||
__attribute__ ((aligned));
|
|
||||||
FILE_DISPOSITION_INFORMATION disp = { TRUE };
|
FILE_DISPOSITION_INFORMATION disp = { TRUE };
|
||||||
|
|
||||||
|
tmp_pathbuf tp;
|
||||||
|
PBYTE infobuf = (PBYTE) tp.w_get ();
|
||||||
|
|
||||||
pfni = (PFILE_NAME_INFORMATION) infobuf;
|
pfni = (PFILE_NAME_INFORMATION) infobuf;
|
||||||
status = NtQueryInformationFile (fh, &io, pfni, sizeof infobuf,
|
status = NtQueryInformationFile (fh, &io, pfni, 65536, FileNameInformation);
|
||||||
FileNameInformation);
|
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
debug_printf ("NtQueryInformationFile (FileNameInformation) failed, %08x",
|
debug_printf ("NtQueryInformationFile (FileNameInformation) failed, %08x",
|
||||||
@ -233,7 +232,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access)
|
|||||||
/* Create hopefully unique filename. */
|
/* Create hopefully unique filename. */
|
||||||
RtlAppendUnicodeToString (&recycler, L"\\cyg");
|
RtlAppendUnicodeToString (&recycler, L"\\cyg");
|
||||||
pfii = (PFILE_INTERNAL_INFORMATION) infobuf;
|
pfii = (PFILE_INTERNAL_INFORMATION) infobuf;
|
||||||
status = NtQueryInformationFile (fh, &io, pfii, sizeof infobuf,
|
status = NtQueryInformationFile (fh, &io, pfii, 65536,
|
||||||
FileInternalInformation);
|
FileInternalInformation);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
@ -248,8 +247,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access)
|
|||||||
pfri->RootDirectory = rootdir;
|
pfri->RootDirectory = rootdir;
|
||||||
pfri->FileNameLength = recycler.Length;
|
pfri->FileNameLength = recycler.Length;
|
||||||
memcpy (pfri->FileName, recycler.Buffer, recycler.Length);
|
memcpy (pfri->FileName, recycler.Buffer, recycler.Length);
|
||||||
status = NtSetInformationFile (fh, &io, pfri, sizeof infobuf,
|
status = NtSetInformationFile (fh, &io, pfri, 65536, FileRenameInformation);
|
||||||
FileRenameInformation);
|
|
||||||
if (status == STATUS_OBJECT_PATH_NOT_FOUND)
|
if (status == STATUS_OBJECT_PATH_NOT_FOUND)
|
||||||
{
|
{
|
||||||
/* Ok, so the recycler and/or the recycler/SID directory don't exist.
|
/* Ok, so the recycler and/or the recycler/SID directory don't exist.
|
||||||
@ -350,7 +348,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access)
|
|||||||
}
|
}
|
||||||
NtClose (recyclerdir);
|
NtClose (recyclerdir);
|
||||||
/* Shoot again. */
|
/* Shoot again. */
|
||||||
status = NtSetInformationFile (fh, &io, pfri, sizeof infobuf,
|
status = NtSetInformationFile (fh, &io, pfri, 65536,
|
||||||
FileRenameInformation);
|
FileRenameInformation);
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
@ -397,7 +395,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access)
|
|||||||
status);
|
status);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
status = NtSetInformationFile (tmp_fh, &io, pfri, sizeof infobuf,
|
status = NtSetInformationFile (tmp_fh, &io, pfri, 65536,
|
||||||
FileRenameInformation);
|
FileRenameInformation);
|
||||||
NtClose (tmp_fh);
|
NtClose (tmp_fh);
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user