It was suggested by Thomas Faber, during some fixes of path.c
De : ros-dev-bounces(a)reactos.org [mailto:ros-dev-bounces@reactos.org] De la
part de Alex Ionescu
Envoyé : lundi 3 juin 2013 04:33
À : ReactOS Development List
Cc : Linda Wang
Objet : Re: [ros-dev] [ros-diffs] [hbelusca] 59165: [RTL] Use
RtlPrefixUnicodeString.
You should realize there's sometimes a reason why code doesn't use an
existing helper function. Among some very good bug fixes and patches, you
really seem to love changing code just for the sake of changing code.
Best regards,
Alex Ionescu
On Sun, Jun 2, 2013 at 3:51 PM, <hbelusca(a)svn.reactos.org> wrote:
Author: hbelusca
Date: Sun Jun 2 22:51:24 2013
New Revision: 59165
URL:
http://svn.reactos.org/svn/reactos?rev=59165
<http://svn.reactos.org/svn/reactos?rev=59165&view=rev> &view=rev
Log:
[RTL]
Use RtlPrefixUnicodeString.
Modified:
trunk/reactos/lib/rtl/path.c
Modified: trunk/reactos/lib/rtl/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=59165
<http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=59165&r
1=59164&r2=59165&view=diff> &r1=59164&r2=59165&view=diff
============================================================================
==
--- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Sun Jun 2 22:51:24
2013
@@ -479,13 +479,19 @@
/* Capture input string */
CapturedDosName = *DosName;
- /* Check for \\?\ form */
- if ((CapturedDosName.Length <= RtlpWin32NtRootSlash.Length) ||
- (CapturedDosName.Buffer[0] != RtlpWin32NtRootSlash.Buffer[0]) ||
- (CapturedDosName.Buffer[1] != RtlpWin32NtRootSlash.Buffer[1]) ||
- (CapturedDosName.Buffer[2] != RtlpWin32NtRootSlash.Buffer[2]) ||
- (CapturedDosName.Buffer[3] != RtlpWin32NtRootSlash.Buffer[3]))
- {
+ /* Check for the presence of the NT prefix "\\?\" form */
+ if (RtlPrefixUnicodeString(&RtlpWin32NtRootSlash, &CapturedDosName,
FALSE))
+ {
+ /* NT prefix is contained in the path */
+
+ /* Use the optimized path after acquiring the lock */
+ QuickPath = TRUE;
+ NewBuffer = NULL;
+ }
+ else
+ {
+ /* NT prefix is not contained in the path */
+
/* Quick path won't be used */
QuickPath = FALSE;
@@ -497,12 +503,6 @@
NewBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, MaxLength);
DPRINT("MaxLength: %lx\n", MaxLength);
if (!NewBuffer) return STATUS_NO_MEMORY;
- }
- else
- {
- /* Use the optimized path after acquiring the lock */
- QuickPath = TRUE;
- NewBuffer = NULL;
}
/* Lock the PEB and check if the quick path can be used */