[USERENV] Move some functions around to make it look nicer. No code changes.
authorEric Kohl <eric.kohl@reactos.org>
Sat, 8 Dec 2018 15:41:17 +0000 (16:41 +0100)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 8 Dec 2018 15:41:17 +0000 (16:41 +0100)
dll/win32/userenv/profile.c

index 077619e..40d4b32 100644 (file)
@@ -106,6 +106,45 @@ AcquireRemoveRestorePrivilege(IN BOOL bAcquire)
 }
 
 
 }
 
 
+static
+BOOL
+CheckForLoadedProfile(HANDLE hToken)
+{
+    UNICODE_STRING SidString;
+    HKEY hKey;
+
+    DPRINT("CheckForLoadedProfile() called\n");
+
+    /* Get the user SID string */
+    if (!GetUserSidStringFromToken(hToken, &SidString))
+    {
+        DPRINT1("GetUserSidStringFromToken() failed\n");
+        return FALSE;
+    }
+
+    if (RegOpenKeyExW(HKEY_USERS,
+                      SidString.Buffer,
+                      0,
+                      MAXIMUM_ALLOWED,
+                      &hKey))
+    {
+        DPRINT("Profile not loaded\n");
+        RtlFreeUnicodeString(&SidString);
+        return FALSE;
+    }
+
+    RegCloseKey(hKey);
+
+    RtlFreeUnicodeString(&SidString);
+
+    DPRINT("Profile already loaded\n");
+
+    return TRUE;
+}
+
+
+/* PUBLIC FUNCTIONS ********************************************************/
+
 BOOL
 WINAPI
 CopySystemProfile(
 BOOL
 WINAPI
 CopySystemProfile(
@@ -672,6 +711,62 @@ done:
 }
 
 
 }
 
 
+BOOL
+WINAPI
+DeleteProfileA(
+    _In_ LPCSTR lpSidString,
+    _In_opt_ LPCSTR lpProfilePath,
+    _In_opt_ LPCSTR lpComputerName)
+{
+    BOOL bResult;
+    UNICODE_STRING SidString, ProfilePath, ComputerName;
+
+    DPRINT("DeleteProfileA() called\n");
+
+    /* Conversion to UNICODE */
+    if (lpSidString)
+        RtlCreateUnicodeStringFromAsciiz(&SidString,
+                                         (LPSTR)lpSidString);
+
+    if (lpProfilePath)
+        RtlCreateUnicodeStringFromAsciiz(&ProfilePath,
+                                         (LPSTR)lpProfilePath);
+
+    if (lpComputerName)
+        RtlCreateUnicodeStringFromAsciiz(&ComputerName,
+                                         (LPSTR)lpComputerName);
+
+    /* Call the UNICODE function */
+    bResult = DeleteProfileW(SidString.Buffer,
+                             ProfilePath.Buffer,
+                             ComputerName.Buffer);
+
+    /* Memory cleanup */
+    if (lpSidString)
+        RtlFreeUnicodeString(&SidString);
+
+    if (lpProfilePath)
+        RtlFreeUnicodeString(&ProfilePath);
+
+    if (lpComputerName)
+        RtlFreeUnicodeString(&ComputerName);
+
+    return bResult;
+}
+
+
+BOOL
+WINAPI
+DeleteProfileW(
+    _In_ LPCWSTR lpSidString,
+    _In_opt_ LPCWSTR lpProfilePath,
+    _In_opt_ LPCWSTR lpComputerName)
+{
+    DPRINT1("DeleteProfileW() not implemented!\n");
+    return FALSE;
+}
+
+
 BOOL
 WINAPI
 GetAllUsersProfileDirectoryA(
 BOOL
 WINAPI
 GetAllUsersProfileDirectoryA(
@@ -1051,6 +1146,16 @@ GetProfilesDirectoryW(
 }
 
 
 }
 
 
+BOOL
+WINAPI
+GetProfileType(
+    _Out_ PDWORD pdwFlags)
+{
+    DPRINT1("GetProfileType() not implemented!\n");
+    return FALSE;
+}
+
+
 BOOL
 WINAPI
 GetUserProfileDirectoryA(
 BOOL
 WINAPI
 GetUserProfileDirectoryA(
@@ -1195,43 +1300,6 @@ GetUserProfileDirectoryW(
 }
 
 
 }
 
 
-static
-BOOL
-CheckForLoadedProfile(HANDLE hToken)
-{
-    UNICODE_STRING SidString;
-    HKEY hKey;
-
-    DPRINT("CheckForLoadedProfile() called\n");
-
-    /* Get the user SID string */
-    if (!GetUserSidStringFromToken(hToken, &SidString))
-    {
-        DPRINT1("GetUserSidStringFromToken() failed\n");
-        return FALSE;
-    }
-
-    if (RegOpenKeyExW(HKEY_USERS,
-                      SidString.Buffer,
-                      0,
-                      MAXIMUM_ALLOWED,
-                      &hKey))
-    {
-        DPRINT("Profile not loaded\n");
-        RtlFreeUnicodeString(&SidString);
-        return FALSE;
-    }
-
-    RegCloseKey(hKey);
-
-    RtlFreeUnicodeString(&SidString);
-
-    DPRINT("Profile already loaded\n");
-
-    return TRUE;
-}
-
-
 BOOL
 WINAPI
 LoadUserProfileA(
 BOOL
 WINAPI
 LoadUserProfileA(
@@ -1566,69 +1634,4 @@ UnloadUserProfile(
     return TRUE;
 }
 
     return TRUE;
 }
 
-
-BOOL
-WINAPI
-DeleteProfileW(
-    _In_ LPCWSTR lpSidString,
-    _In_opt_ LPCWSTR lpProfilePath,
-    _In_opt_ LPCWSTR lpComputerName)
-{
-    DPRINT1("DeleteProfileW() not implemented!\n");
-    return FALSE;
-}
-
-
-BOOL
-WINAPI
-DeleteProfileA(
-    _In_ LPCSTR lpSidString,
-    _In_opt_ LPCSTR lpProfilePath,
-    _In_opt_ LPCSTR lpComputerName)
-{
-    BOOL bResult;
-    UNICODE_STRING SidString, ProfilePath, ComputerName;
-
-    DPRINT("DeleteProfileA() called\n");
-
-    /* Conversion to UNICODE */
-    if (lpSidString)
-        RtlCreateUnicodeStringFromAsciiz(&SidString,
-                                         (LPSTR)lpSidString);
-
-    if (lpProfilePath)
-        RtlCreateUnicodeStringFromAsciiz(&ProfilePath,
-                                         (LPSTR)lpProfilePath);
-
-    if (lpComputerName)
-        RtlCreateUnicodeStringFromAsciiz(&ComputerName,
-                                         (LPSTR)lpComputerName);
-
-    /* Call the UNICODE function */
-    bResult = DeleteProfileW(SidString.Buffer,
-                             ProfilePath.Buffer,
-                             ComputerName.Buffer);
-
-    /* Memory cleanup */
-    if (lpSidString)
-        RtlFreeUnicodeString(&SidString);
-
-    if (lpProfilePath)
-        RtlFreeUnicodeString(&ProfilePath);
-
-    if (lpComputerName)
-        RtlFreeUnicodeString(&ComputerName);
-
-    return bResult;
-}
-
-
-BOOL
-WINAPI
-GetProfileType(_Out_ PDWORD pdwFlags)
-{
-    DPRINT1("GetProfileType() not implemented!\n");
-    return FALSE;
-}
-
 /* EOF */
 /* EOF */