Author: hpoussin
Date: Wed Oct 24 11:49:40 2007
New Revision: 29846
URL:
http://svn.reactos.org/svn/reactos?rev=29846&view=rev
Log:
Better check of GetWindowsDirectory() return value
Modified:
trunk/reactos/dll/win32/msgina/msgina.c
Modified: trunk/reactos/dll/win32/msgina/msgina.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/msgina.c?…
==============================================================================
--- trunk/reactos/dll/win32/msgina/msgina.c (original)
+++ trunk/reactos/dll/win32/msgina/msgina.c Wed Oct 24 11:49:40 2007
@@ -207,6 +207,13 @@
UINT len;
BOOL ret;
+ len = GetWindowsDirectoryW(CurrentDirectory, MAX_PATH);
+ if (len == 0 || len > MAX_PATH)
+ {
+ WARN("GetWindowsDirectoryW() failed\n");
+ return FALSE;
+ }
+
ret = DuplicateTokenEx(pgContext->UserToken, MAXIMUM_ALLOWED, NULL,
SecurityImpersonation, TokenPrimary, &hAppToken);
if (!ret)
{
@@ -222,13 +229,6 @@
StartupInfo.wShowWindow = SW_SHOW;
StartupInfo.lpDesktop = pszDesktopName;
- len = GetWindowsDirectoryW(CurrentDirectory, MAX_PATH);
- if (len > MAX_PATH)
- {
- WARN("GetWindowsDirectoryW() failed\n");
- CloseHandle(hAppToken);
- return FALSE;
- }
ret = CreateProcessAsUserW(
hAppToken,
pszCmdLine,