Throughout avoid having to initialize constant UNICODE_STRINGs.

* globals.cc: Define constant UNICODE_STRINGs and store in .rdata
	section.
	* fhandler_disk_file.cc: Throughout, use readonly UNICODE_STRINGs
	rather then initializing local UNICODE_STRING variable where
	applicable.
	* fhandler_mem.cc (fhandler_dev_mem::open): Ditto.
	* flock.cc (inode_t::inode_t): Ditto.
	* mmap.cc: Ditto.
	* syscalls.cc: Ditto.
	* mount.cc (fs_info::update): Ditto.
	* path.cc: Ditto.

	* ntdll.h (RtlEqualUnicodePathPrefix): Redefine to take prefix as
	UNICODE_STRING.
	(RtlEqualUnicodePathSuffix): Redefine to take suffix as UNICODE_STRING.
	* fhandler_disk_file.cc: Accommodate throughout.
	* mount.cc (fs_info::update): Ditto.
	* path.cc (cwdstuff::set): Ditto.
	* syscalls.cc: Ditto.
This commit is contained in:
Corinna Vinschen
2009-07-14 17:37:42 +00:00
parent 472345a06c
commit 8deb411836
10 changed files with 98 additions and 75 deletions

View File

@@ -448,7 +448,7 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath)
{
if (path[1] == ':') /* X:\... */
{
RtlAppendUnicodeToString (&upath, L"\\??\\");
RtlAppendUnicodeStringToString (&upath, &ro_u_natp);
str2uni_cat (upath, path);
/* The drive letter must be upper case. */
upath.Buffer[4] = towupper (upath.Buffer[4]);
@@ -462,13 +462,13 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath)
else if ((path[2] != '.' && path[2] != '?')
|| path[3] != '\\') /* \\server\share\... */
{
RtlAppendUnicodeToString (&upath, L"\\??\\UNC\\");
RtlAppendUnicodeStringToString (&upath, &ro_u_uncp);
str2uni_cat (upath, path + 2);
transform_chars (&upath, 8);
}
else /* \\.\device or \\?\foo */
{
RtlAppendUnicodeToString (&upath, L"\\??\\");
RtlAppendUnicodeStringToString (&upath, &ro_u_natp);
str2uni_cat (upath, path + 4);
}
return &upath;
@@ -3079,7 +3079,7 @@ cwdstuff::set (PUNICODE_STRING nat_cwd, const char *posix_cwd, bool doit)
else
{
len = upath.Length / sizeof (WCHAR) - 4;
if (RtlEqualUnicodePathPrefix (&upath, L"\\??\\UNC\\", TRUE))
if (RtlEqualUnicodePathPrefix (&upath, &ro_u_uncp, TRUE))
len -= 2;
}
}