Author: tfaber
Date: Sun Nov 6 15:52:20 2011
New Revision: 54317
URL:
http://svn.reactos.org/svn/reactos?rev=54317&view=rev
Log:
[KERNEL32]
- Use the correct buffer length in GetDllDirectoryA
- Do not always return FALSE from BasepIsCurDirAllowedForPlainExeNames
- Some cosmetic fixes
Modified:
trunk/reactos/dll/win32/kernel32/client/path.c
Modified: trunk/reactos/dll/win32/kernel32/client/path.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] Sun Nov 6 15:52:20 2011
@@ -28,10 +28,10 @@
UNICODE_STRING EmptyString;
RtlInitEmptyUnicodeString(&EmptyString, NULL, 0);
- Status = RtlQueryEnvironmentVariable_U(0,
+ Status = RtlQueryEnvironmentVariable_U(NULL,
&NoDefaultCurrentDirectoryInExePath,
&EmptyString);
- return NT_SUCCESS(Status);
+ return !NT_SUCCESS(Status) && Status != STATUS_BUFFER_TOO_SMALL;
}
/*
@@ -45,7 +45,7 @@
if (lpPathName)
{
- if (wcschr(lpPathName, ';'))
+ if (wcschr(lpPathName, L';'))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
@@ -53,12 +53,12 @@
if (!RtlCreateUnicodeString(&DllDirectory, lpPathName))
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return 0;
+ return FALSE;
}
}
else
{
- RtlInitUnicodeString(&DllDirectory, 0);
+ RtlInitUnicodeString(&DllDirectory, NULL);
}
RtlEnterCriticalSection(&BaseDllDirectoryLock);
@@ -69,7 +69,7 @@
RtlLeaveCriticalSection(&BaseDllDirectoryLock);
RtlFreeUnicodeString(&OldDirectory);
- return 1;
+ return TRUE;
}
/*
@@ -102,12 +102,12 @@
if (!NT_SUCCESS(Status))
{
BaseSetLastNTError(Status);
- return 0;
+ return FALSE;
}
}
else
{
- RtlInitUnicodeString(&DllDirectory, 0);
+ RtlInitUnicodeString(&DllDirectory, NULL);
}
RtlEnterCriticalSection(&BaseDllDirectoryLock);
@@ -118,7 +118,7 @@
RtlLeaveCriticalSection(&BaseDllDirectoryLock);
RtlFreeUnicodeString(&OldDirectory);
- return 1;
+ return TRUE;
}
/*
@@ -132,11 +132,11 @@
ULONG Length;
RtlEnterCriticalSection(&BaseDllDirectoryLock);
-
+
if ((nBufferLength * sizeof(WCHAR)) > BaseDllDirectory.Length)
{
RtlCopyMemory(lpBuffer, BaseDllDirectory.Buffer, BaseDllDirectory.Length);
- Length = BaseDllDirectory.Length / sizeof(WCHAR);
+ Length = BaseDllDirectory.Length / sizeof(WCHAR);
lpBuffer[Length] = UNICODE_NULL;
}
else
@@ -144,7 +144,7 @@
Length = (BaseDllDirectory.Length + sizeof(UNICODE_NULL)) / sizeof(WCHAR);
if (lpBuffer) *lpBuffer = UNICODE_NULL;
}
-
+
RtlLeaveCriticalSection(&BaseDllDirectoryLock);
return Length;
}
@@ -161,7 +161,7 @@
ANSI_STRING AnsiDllDirectory;
ULONG Length;
- RtlInitEmptyAnsiString(&AnsiDllDirectory, lpBuffer, 0);
+ RtlInitEmptyAnsiString(&AnsiDllDirectory, lpBuffer, nBufferLength);
RtlEnterCriticalSection(&BaseDllDirectoryLock);
@@ -198,7 +198,7 @@
WINAPI
NeedCurrentDirectoryForExePathW(IN LPCWSTR ExeName)
{
- if (wcschr(ExeName, '\\')) return TRUE;
+ if (wcschr(ExeName, L'\\')) return TRUE;
return BasepIsCurDirAllowedForPlainExeNames();
}