[USERENV]
[reactos.git] / reactos / dll / win32 / userenv / profile.c
index aa2f5dd..2884e3a 100644 (file)
 /*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
- * FILE:            lib/userenv/profile.c
+ * FILE:            dll/win32/userenv/profile.c
  * PURPOSE:         User profile code
  * PROGRAMMERS:     Eric Kohl
  *                  HervĂ© Poussineau
  */
 
-#include <precomp.h>
+#include "precomp.h"
 
 #define NDEBUG
 #include <debug.h>
@@ -75,31 +75,6 @@ AppendSystemPostfix(LPWSTR lpName,
 }
 
 
-BOOL
-WINAPI
-CreateUserProfileA(PSID Sid,
-                   LPCSTR lpUserName)
-{
-    UNICODE_STRING UserName;
-    BOOL bResult;
-    NTSTATUS Status;
-
-    Status = RtlCreateUnicodeStringFromAsciiz(&UserName,
-                                              (LPSTR)lpUserName);
-    if (!NT_SUCCESS(Status))
-    {
-        SetLastError(RtlNtStatusToDosError(Status));
-        return FALSE;
-    }
-
-    bResult = CreateUserProfileW(Sid, UserName.Buffer);
-
-    RtlFreeUnicodeString(&UserName);
-
-    return bResult;
-}
-
-
 static
 BOOL
 AcquireRemoveRestorePrivilege(IN BOOL bAcquire)
@@ -147,6 +122,29 @@ AcquireRemoveRestorePrivilege(IN BOOL bAcquire)
 }
 
 
+BOOL
+WINAPI
+CreateUserProfileA(PSID Sid,
+                   LPCSTR lpUserName)
+{
+    UNICODE_STRING UserName;
+    BOOL bResult;
+
+    if (!RtlCreateUnicodeStringFromAsciiz(&UserName,
+                                          (LPSTR)lpUserName))
+    {
+        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+        return FALSE;
+    }
+
+    bResult = CreateUserProfileW(Sid, UserName.Buffer);
+
+    RtlFreeUnicodeString(&UserName);
+
+    return bResult;
+}
+
+
 BOOL
 WINAPI
 CreateUserProfileW(PSID Sid,
@@ -393,6 +391,34 @@ Done:
 }
 
 
+BOOL
+WINAPI
+CreateUserProfileExA(IN PSID pSid,
+                     IN LPCSTR lpUserName,
+                     IN LPCSTR lpUserHive OPTIONAL,
+                     OUT LPSTR lpProfileDir OPTIONAL,
+                     IN DWORD dwDirSize,
+                     IN BOOL bWin9xUpg)
+{
+    DPRINT1("CreateUserProfileExA() not implemented!\n");
+    return FALSE;
+}
+
+
+BOOL
+WINAPI
+CreateUserProfileExW(IN PSID pSid,
+                     IN LPCWSTR lpUserName,
+                     IN LPCWSTR lpUserHive OPTIONAL,
+                     OUT LPWSTR lpProfileDir OPTIONAL,
+                     IN DWORD dwDirSize,
+                     IN BOOL bWin9xUpg)
+{
+    DPRINT1("CreateUserProfileExW() not implemented!\n");
+    return FALSE;
+}
+
+
 BOOL
 WINAPI
 GetAllUsersProfileDirectoryA(LPSTR lpProfileDir,
@@ -1160,6 +1186,11 @@ LoadUserProfileW(IN HANDLE hToken,
                         SidString.Buffer,
                         szUserHivePath);
     AcquireRemoveRestorePrivilege(FALSE);
+
+    /* HACK: Do not fail if the profile has already been loaded! */
+    if (Error == ERROR_SHARING_VIOLATION)
+        Error = ERROR_SUCCESS;
+
     if (Error != ERROR_SUCCESS)
     {
         DPRINT1("RegLoadKeyW() failed (Error %ld)\n", Error);
@@ -1305,4 +1336,13 @@ DeleteProfileA(LPCSTR lpSidString,
     return bResult;
 }
 
+
+BOOL
+WINAPI
+GetProfileType(OUT PDWORD pdwFlags)
+{
+    DPRINT1("GetProfileType() not implemented!\n");
+    return FALSE;
+}
+
 /* EOF */