[USERENV]
authorEric Kohl <eric.kohl@reactos.org>
Sat, 7 Nov 2015 21:06:07 +0000 (21:06 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 7 Nov 2015 21:06:07 +0000 (21:06 +0000)
- GetAllUsersProfileDirectoryW: Fail if lpcchSize is NULL.
- GetDefaultUserProfileDirectoryW: Fail if lpcchSize is NULL.
- GetUserProfileDirectoryW: Fail if hToken is NULL.

svn path=/trunk/; revision=69841

reactos/dll/win32/userenv/profile.c

index b50b6d2..1e8aaf3 100644 (file)
@@ -464,6 +464,12 @@ GetAllUsersProfileDirectoryW(LPWSTR lpProfileDir,
     HKEY hKey;
     LONG Error;
 
+    if (!lpcchSize)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+
     Error = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
                           L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
                           0,
@@ -586,6 +592,12 @@ GetDefaultUserProfileDirectoryW(LPWSTR lpProfileDir,
     HKEY hKey;
     LONG Error;
 
+    if (!lpcchSize)
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+
     Error = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
                           L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
                           0,
@@ -839,9 +851,15 @@ GetUserProfileDirectoryW(HANDLE hToken,
     HKEY hKey;
     LONG Error;
 
+    if (!hToken)
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
+
     if (!lpcchSize)
     {
-        SetLastError( ERROR_INVALID_PARAMETER );
+        SetLastError(ERROR_INVALID_PARAMETER);
         return FALSE;
     }