diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2007-07-28 16:00:35 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2007-07-28 16:00:35 +0000 |
commit | 74c5e8c73ace5043a1a78b479d7b701be3f5966d (patch) | |
tree | 4f92cc9c959df3543a3a6637d6c2526721799831 /winsup/cygwin/ntdll.h | |
parent | 745c29fe7b54844aad20e62891624ea9a0063d9a (diff) | |
download | cygnal-74c5e8c73ace5043a1a78b479d7b701be3f5966d.tar.gz cygnal-74c5e8c73ace5043a1a78b479d7b701be3f5966d.tar.bz2 cygnal-74c5e8c73ace5043a1a78b479d7b701be3f5966d.zip |
* ntdll.h (RtlInitCountedUnicodeString): Swap order of string and length
parameters to be the same as for RtlInitEmptyUnicodeString.
(RtlEqualPathPrefix): New inline function.
(RtlEqualPathSuffix): New inline function.
* fhandler_disk_file.cc: Accommodate parameter order change of
RtlInitEmptyUnicodeString throughout.
(fhandler_disk_file::link): Do path checking in unicode. Call
CopyFileW instead of CopyFileA.
Diffstat (limited to 'winsup/cygwin/ntdll.h')
-rw-r--r-- | winsup/cygwin/ntdll.h | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index aca672533..c30aed15c 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -807,8 +807,8 @@ extern "C" dest->Buffer = (PWSTR) buf; } inline - VOID NTAPI RtlInitCountedUnicodeString (PUNICODE_STRING dest, USHORT len, - PCWSTR buf) + VOID NTAPI RtlInitCountedUnicodeString (PUNICODE_STRING dest, PCWSTR buf, + USHORT len) { dest->Length = dest->MaximumLength = len; dest->Buffer = (PWSTR) buf; @@ -822,9 +822,36 @@ extern "C" ; ++len; if (dir) - RtlInitCountedUnicodeString (dir, len * sizeof (WCHAR), path->Buffer); + RtlInitCountedUnicodeString (dir, path->Buffer, len * sizeof (WCHAR)); if (file) - RtlInitCountedUnicodeString (file, path->Length - len * sizeof (WCHAR), - &path->Buffer[len]); + RtlInitCountedUnicodeString (file, &path->Buffer[len], + path->Length - len * sizeof (WCHAR)); + } + inline + BOOLEAN NTAPI RtlEqualPathPrefix (PUNICODE_STRING path, PCWSTR prefix, + BOOLEAN caseinsensitive) + { + UNICODE_STRING p, pref; + + RtlInitUnicodeString (&pref, prefix); + RtlInitCountedUnicodeString (&p, path->Buffer, + pref.Length < path->Length + ? pref.Length : path->Length); + return RtlEqualUnicodeString (&p, &pref, caseinsensitive); + } + inline + BOOL NTAPI RtlEqualPathSuffix (PUNICODE_STRING path, PCWSTR suffix, + BOOLEAN caseinsensitive) + { + UNICODE_STRING p, suf; + + RtlInitUnicodeString (&suf, suffix); + if (suf.Length < path->Length) + RtlInitCountedUnicodeString (&p, (PWCHAR) ((PBYTE) path->Buffer + + path->Length - suf.Length), + suf.Length); + else + RtlInitCountedUnicodeString (&p, path->Buffer, path->Length); + return RtlEqualUnicodeString (&p, &suf, caseinsensitive); } } |