https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b9d4e2dae644e6380e8e5d...
commit b9d4e2dae644e6380e8e5d87a49f5430232665fb Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Sat Dec 8 16:41:17 2018 +0100 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Sat Dec 8 16:41:17 2018 +0100
[USERENV] Move some functions around to make it look nicer. No code changes. --- dll/win32/userenv/profile.c | 207 ++++++++++++++++++++++---------------------- 1 file changed, 105 insertions(+), 102 deletions(-)
diff --git a/dll/win32/userenv/profile.c b/dll/win32/userenv/profile.c index 077619e5aa..40d4b323af 100644 --- a/dll/win32/userenv/profile.c +++ b/dll/win32/userenv/profile.c @@ -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( @@ -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( @@ -1051,6 +1146,16 @@ GetProfilesDirectoryW( }
+BOOL +WINAPI +GetProfileType( + _Out_ PDWORD pdwFlags) +{ + DPRINT1("GetProfileType() not implemented!\n"); + return FALSE; +} + + 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( @@ -1566,69 +1634,4 @@ UnloadUserProfile( 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 */