From e1fb5a56a593351b247c820e9c1d421a446dae16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Wed, 8 Aug 2007 13:44:03 +0000 Subject: [PATCH] Replace a call to undocumented function CreateUserProfile by its documented equivalent (LogonUser + LoadUserProfile) In all cases, this code should be removed once NtUnloadKey is implemented Add a message to remind when to remove this hack svn path=/trunk/; revision=28244 --- reactos/dll/win32/syssetup/install.c | 39 +++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/reactos/dll/win32/syssetup/install.c b/reactos/dll/win32/syssetup/install.c index 28231fb70cb..80f16e9acc8 100644 --- a/reactos/dll/win32/syssetup/install.c +++ b/reactos/dll/win32/syssetup/install.c @@ -722,18 +722,39 @@ InstallReactOS(HINSTANCE hInstance) } } - /* Create the Administrator profile */ - if (!CreateUserProfileW(AdminSid, L"Administrator")) - { - DebugPrint("CreateUserProfileW() failed!"); - RtlFreeSid(AdminSid); - RtlFreeSid(DomainSid); - return 0; - } - RtlFreeSid(AdminSid); RtlFreeSid(DomainSid); + /* ROS HACK, as long as NtUnloadKey is not implemented */ + { + NTSTATUS Status = NtUnloadKey(NULL); + if (Status == STATUS_NOT_IMPLEMENTED) + { + /* Create the Administrator profile */ + PROFILEINFOW ProfileInfo; + HANDLE hToken; + BOOL ret; +#define LOGON32_LOGON_NETWORK 3 + ret = LogonUserW(L"Administrator", L"", L"", LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, &hToken); + if (!ret) + { + DebugPrint("LogonUserW() failed!"); + return 0; + } + ZeroMemory(&ProfileInfo, sizeof(PROFILEINFOW)); + ProfileInfo.dwSize = sizeof(PROFILEINFOW); + ProfileInfo.lpUserName = L"Administrator"; + ProfileInfo.dwFlags = PI_NOUI; + LoadUserProfileW(hToken, &ProfileInfo); + CloseHandle(hToken); + } + else + { + DPRINT1("ROS HACK not needed anymore. Please remove it\n"); + } + } + /* END OF ROS HACK */ + CreateTempDir(L"TEMP"); CreateTempDir(L"TMP");