Author: ekohl Date: Mon May 21 13:38:32 2012 New Revision: 56648
URL: http://svn.reactos.org/svn/reactos?rev=56648&view=rev Log: [SAMLIB/SAMSRV/SYSSETUP] - Use Wine debug messages in samlib.dll. - Move SAM initialization code from samlib.dll to samsrv.dll. - Lsass.exe initializes SAM instead of syssetup.dll.
Added: trunk/reactos/dll/win32/samsrv/setup.c (with props) Modified: trunk/reactos/dll/win32/samlib/CMakeLists.txt trunk/reactos/dll/win32/samlib/dllmain.c trunk/reactos/dll/win32/samlib/precomp.h trunk/reactos/dll/win32/samlib/samlib.c trunk/reactos/dll/win32/samlib/samlib.spec trunk/reactos/dll/win32/samsrv/CMakeLists.txt trunk/reactos/dll/win32/samsrv/samsrv.c trunk/reactos/dll/win32/samsrv/samsrv.h trunk/reactos/dll/win32/syssetup/install.c trunk/reactos/include/reactos/libs/samlib/samlib.h
Modified: trunk/reactos/dll/win32/samlib/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/CMakeLists... ============================================================================== --- trunk/reactos/dll/win32/samlib/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/CMakeLists.txt [iso-8859-1] Mon May 21 13:38:32 2012 @@ -21,6 +21,7 @@
add_library(samlib SHARED ${SOURCE}) set_module_type(samlib win32dll UNICODE) +target_link_libraries(samlib wine ${PSEH_LIB}) add_importlibs(samlib rpcrt4 advapi32 msvcrt kernel32 ntdll) add_pch(samlib precomp.h) add_cd_file(TARGET samlib DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/samlib/dllmain.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/dllmain.c?... ============================================================================== --- trunk/reactos/dll/win32/samlib/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/dllmain.c [iso-8859-1] Mon May 21 13:38:32 2012 @@ -29,7 +29,7 @@
#include "precomp.h"
-//#define LOG_DEBUG_MESSAGES +WINE_DEFAULT_DEBUG_CHANNEL(samlib);
/* GLOBALS *******************************************************************/
@@ -45,50 +45,4 @@ return TRUE; }
- -void -DebugPrint (char* fmt,...) -{ -#ifdef LOG_DEBUG_MESSAGES - char FileName[MAX_PATH]; - HANDLE hLogFile; - DWORD dwBytesWritten; -#endif - char buffer[512]; - va_list ap; - - va_start (ap, fmt); - vsprintf (buffer, fmt, ap); - va_end (ap); - - OutputDebugStringA (buffer); - -#ifdef LOG_DEBUG_MESSAGES - strcpy (FileName, "C:\reactos\samlib.log"); - hLogFile = CreateFileA (FileName, - GENERIC_WRITE, - 0, - NULL, - OPEN_ALWAYS, - FILE_ATTRIBUTE_NORMAL, - NULL); - if (hLogFile == INVALID_HANDLE_VALUE) - return; - - if (SetFilePointer(hLogFile, 0, NULL, FILE_END) == 0xFFFFFFFF) - { - CloseHandle (hLogFile); - return; - } - - WriteFile (hLogFile, - buffer, - strlen(buffer), - &dwBytesWritten, - NULL); - - CloseHandle (hLogFile); -#endif -} - /* EOF */
Modified: trunk/reactos/dll/win32/samlib/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/precomp.h?... ============================================================================== --- trunk/reactos/dll/win32/samlib/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/precomp.h [iso-8859-1] Mon May 21 13:38:32 2012 @@ -10,4 +10,4 @@
#include "sam_c.h"
-#include "debug.h" +#include <wine/debug.h>
Modified: trunk/reactos/dll/win32/samlib/samlib.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/samlib.c?r... ============================================================================== --- trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/samlib.c [iso-8859-1] Mon May 21 13:38:32 2012 @@ -27,276 +27,14 @@
/* INCLUDES *****************************************************************/
-#define NDEBUG #include "precomp.h"
+WINE_DEFAULT_DEBUG_CHANNEL(samlib);
/* GLOBALS *******************************************************************/
/* FUNCTIONS *****************************************************************/ - - -static BOOL -CreateBuiltinAliases (HKEY hAliasesKey) -{ - return TRUE; -} - - -static BOOL -CreateBuiltinGroups (HKEY hGroupsKey) -{ - return TRUE; -} - - -static BOOL -CreateBuiltinUsers (HKEY hUsersKey) -{ - return TRUE; -} - - -BOOL WINAPI -SamInitializeSAM (VOID) -{ - DWORD dwDisposition; - HKEY hSamKey; - HKEY hDomainsKey; - HKEY hAccountKey; - HKEY hBuiltinKey; - HKEY hAliasesKey; - HKEY hGroupsKey; - HKEY hUsersKey; - - DPRINT("SamInitializeSAM() called\n"); - - if (RegCreateKeyExW (HKEY_LOCAL_MACHINE, - L"SAM\SAM", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hSamKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create 'Sam' key! (Error %lu)\n", GetLastError()); - return FALSE; - } - - if (RegCreateKeyExW (hSamKey, - L"Domains", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hDomainsKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create 'Domains' key! (Error %lu)\n", GetLastError()); - RegCloseKey (hSamKey); - return FALSE; - } - - RegCloseKey (hSamKey); - - /* Create the 'Domains\Account' key */ - if (RegCreateKeyExW (hDomainsKey, - L"Account", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hAccountKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create 'Domains\Account' key! (Error %lu)\n", GetLastError()); - RegCloseKey (hDomainsKey); - return FALSE; - } - - - /* Create the 'Account\Aliases' key */ - if (RegCreateKeyExW (hAccountKey, - L"Aliases", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hAliasesKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create 'Account\Aliases' key! (Error %lu)\n", GetLastError()); - RegCloseKey (hAccountKey); - RegCloseKey (hDomainsKey); - return FALSE; - } - - RegCloseKey (hAliasesKey); - - - /* Create the 'Account\Groups' key */ - if (RegCreateKeyExW (hAccountKey, - L"Groups", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hGroupsKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create 'Account\Groups' key! (Error %lu)\n", GetLastError()); - RegCloseKey (hAccountKey); - RegCloseKey (hDomainsKey); - return FALSE; - } - - RegCloseKey (hGroupsKey); - - - /* Create the 'Account\Users' key */ - if (RegCreateKeyExW (hAccountKey, - L"Users", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hUsersKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create 'Account\Users' key! (Error %lu)\n", GetLastError()); - RegCloseKey (hAccountKey); - RegCloseKey (hDomainsKey); - return FALSE; - } - - RegCloseKey (hUsersKey); - - RegCloseKey (hAccountKey); - - - /* Create the 'Domains\Builtin' */ - if (RegCreateKeyExW (hDomainsKey, - L"Builtin", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hBuiltinKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create Builtin key! (Error %lu)\n", GetLastError()); - RegCloseKey (hDomainsKey); - return FALSE; - } - - - /* Create the 'Builtin\Aliases' key */ - if (RegCreateKeyExW (hBuiltinKey, - L"Aliases", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hAliasesKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create 'Builtin\Aliases' key! (Error %lu)\n", GetLastError()); - RegCloseKey (hBuiltinKey); - RegCloseKey (hDomainsKey); - return FALSE; - } - - /* Create builtin aliases */ - if (!CreateBuiltinAliases (hAliasesKey)) - { - DPRINT1 ("Failed to create builtin aliases!\n"); - RegCloseKey (hAliasesKey); - RegCloseKey (hBuiltinKey); - RegCloseKey (hDomainsKey); - return FALSE; - } - - RegCloseKey (hAliasesKey); - - - /* Create the 'Builtin\Groups' key */ - if (RegCreateKeyExW (hBuiltinKey, - L"Groups", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hGroupsKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create 'Builtin\Groups' key! (Error %lu)\n", GetLastError()); - RegCloseKey (hBuiltinKey); - RegCloseKey (hDomainsKey); - return FALSE; - } - - /* Create builtin groups */ - if (!CreateBuiltinGroups (hGroupsKey)) - { - DPRINT1 ("Failed to create builtin groups!\n"); - RegCloseKey (hGroupsKey); - RegCloseKey (hBuiltinKey); - RegCloseKey (hDomainsKey); - return FALSE; - } - - RegCloseKey (hGroupsKey); - - - /* Create the 'Builtin\Users' key */ - if (RegCreateKeyExW (hBuiltinKey, - L"Users", - 0, - NULL, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - NULL, - &hUsersKey, - &dwDisposition)) - { - DPRINT1 ("Failed to create 'Builtin\Users' key! (Error %lu)\n", GetLastError()); - RegCloseKey (hBuiltinKey); - RegCloseKey (hDomainsKey); - return FALSE; - } - - /* Create builtin users */ - if (!CreateBuiltinUsers (hUsersKey)) - { - DPRINT1 ("Failed to create builtin users!\n"); - RegCloseKey (hUsersKey); - RegCloseKey (hBuiltinKey); - RegCloseKey (hDomainsKey); - return FALSE; - } - - RegCloseKey (hUsersKey); - - RegCloseKey (hBuiltinKey); - - RegCloseKey (hDomainsKey); - - DPRINT ("SamInitializeSAM() done\n"); - - return TRUE; -} -
/* * ERROR_USER_EXISTS @@ -310,7 +48,7 @@ HKEY hUsersKey; HKEY hUserKey;
- DPRINT ("SamCreateUser() called\n"); + TRACE("SamCreateUser() called\n");
/* FIXME: Check whether the SID is a real user sid */
@@ -321,7 +59,7 @@ KEY_ALL_ACCESS, &hUsersKey)) { - DPRINT1 ("Failed to open Account key! (Error %lu)\n", GetLastError()); + ERR("Failed to open Account key! (Error %lu)\n", GetLastError()); return FALSE; }
@@ -336,7 +74,7 @@ &hUserKey, &dwDisposition)) { - DPRINT1 ("Failed to create/open the user key! (Error %lu)\n", GetLastError()); + ERR("Failed to create/open the user key! (Error %lu)\n", GetLastError()); RegCloseKey (hUsersKey); return FALSE; } @@ -345,7 +83,7 @@
if (dwDisposition == REG_OPENED_EXISTING_KEY) { - DPRINT1 ("User already exists!\n"); + ERR("User already exists!\n"); RegCloseKey (hUserKey); SetLastError (ERROR_USER_EXISTS); return FALSE; @@ -360,7 +98,7 @@ (LPBYTE)UserName, (wcslen (UserName) + 1) * sizeof (WCHAR))) { - DPRINT1 ("Failed to set the user name value! (Error %lu)\n", GetLastError()); + ERR("Failed to set the user name value! (Error %lu)\n", GetLastError()); RegCloseKey (hUserKey); return FALSE; } @@ -373,7 +111,7 @@ (LPBYTE)UserPassword, (wcslen (UserPassword) + 1) * sizeof (WCHAR))) { - DPRINT1 ("Failed to set the user name value! (Error %lu)\n", GetLastError()); + ERR("Failed to set the user name value! (Error %lu)\n", GetLastError()); RegCloseKey (hUserKey); return FALSE; } @@ -386,14 +124,14 @@ (LPBYTE)UserSid, RtlLengthSid (UserSid))) { - DPRINT1 ("Failed to set the user SID value! (Error %lu)\n", GetLastError()); + ERR("Failed to set the user SID value! (Error %lu)\n", GetLastError()); RegCloseKey (hUserKey); return FALSE; }
RegCloseKey (hUserKey);
- DPRINT ("SamCreateUser() done\n"); + TRACE("SamCreateUser() done\n");
return TRUE; } @@ -412,7 +150,7 @@ HKEY hUsersKey; HKEY hUserKey;
- DPRINT ("SamCheckUserPassword() called\n"); + TRACE("SamCheckUserPassword() called\n");
/* Open the Users key */ if (RegOpenKeyExW (HKEY_LOCAL_MACHINE, @@ -421,7 +159,7 @@ KEY_READ, &hUsersKey)) { - DPRINT1 ("Failed to open Users key! (Error %lu)\n", GetLastError()); + ERR("Failed to open Users key! (Error %lu)\n", GetLastError()); return FALSE; }
@@ -434,12 +172,12 @@ { if (GetLastError () == ERROR_FILE_NOT_FOUND) { - DPRINT1 ("Invalid user name!\n"); + ERR("Invalid user name!\n"); SetLastError (ERROR_NO_SUCH_USER); } else { - DPRINT1 ("Failed to open user key! (Error %lu)\n", GetLastError()); + ERR("Failed to open user key! (Error %lu)\n", GetLastError()); }
RegCloseKey (hUsersKey); @@ -457,7 +195,7 @@ (LPBYTE)szPassword, &dwLength)) { - DPRINT1 ("Failed to read the password! (Error %lu)\n", GetLastError()); + ERR("Failed to read the password! (Error %lu)\n", GetLastError()); RegCloseKey (hUserKey); return FALSE; } @@ -468,12 +206,12 @@ if ((wcslen (szPassword) != wcslen (UserPassword)) || (wcscmp (szPassword, UserPassword) != 0)) { - DPRINT1 ("Wrong password!\n"); + ERR("Wrong password!\n"); SetLastError (ERROR_WRONG_PASSWORD); return FALSE; }
- DPRINT ("SamCheckUserPassword() done\n"); + TRACE("SamCheckUserPassword() done\n");
return TRUE; } @@ -488,7 +226,7 @@ HKEY hUsersKey; HKEY hUserKey;
- DPRINT ("SamGetUserSid() called\n"); + TRACE("SamGetUserSid() called\n");
if (Sid != NULL) *Sid = NULL; @@ -500,7 +238,7 @@ KEY_READ, &hUsersKey)) { - DPRINT1 ("Failed to open Users key! (Error %lu)\n", GetLastError()); + ERR("Failed to open Users key! (Error %lu)\n", GetLastError()); return FALSE; }
@@ -513,12 +251,12 @@ { if (GetLastError () == ERROR_FILE_NOT_FOUND) { - DPRINT1 ("Invalid user name!\n"); + ERR("Invalid user name!\n"); SetLastError (ERROR_NO_SUCH_USER); } else { - DPRINT1 ("Failed to open user key! (Error %lu)\n", GetLastError()); + ERR("Failed to open user key! (Error %lu)\n", GetLastError()); }
RegCloseKey (hUsersKey); @@ -536,19 +274,19 @@ NULL, &dwLength)) { - DPRINT1 ("Failed to read the SID size! (Error %lu)\n", GetLastError()); + ERR("Failed to read the SID size! (Error %lu)\n", GetLastError()); RegCloseKey (hUserKey); return FALSE; }
/* Allocate sid buffer */ - DPRINT ("Required SID buffer size: %lu\n", dwLength); + TRACE("Required SID buffer size: %lu\n", dwLength); lpSid = (PSID)RtlAllocateHeap (RtlGetProcessHeap (), 0, dwLength); if (lpSid == NULL) { - DPRINT1 ("Failed to allocate SID buffer!\n"); + ERR("Failed to allocate SID buffer!\n"); RegCloseKey (hUserKey); return FALSE; } @@ -561,7 +299,7 @@ (LPBYTE)lpSid, &dwLength)) { - DPRINT1 ("Failed to read the SID! (Error %lu)\n", GetLastError()); + ERR("Failed to read the SID! (Error %lu)\n", GetLastError()); RtlFreeHeap (RtlGetProcessHeap (), 0, lpSid); @@ -573,7 +311,7 @@
*Sid = lpSid;
- DPRINT ("SamGetUserSid() done\n"); + TRACE("SamGetUserSid() done\n");
return TRUE; } @@ -597,7 +335,7 @@ LPWSTR pszStringBinding; RPC_STATUS status;
-// TRACE("PSAMPR_SERVER_NAME_bind() called\n"); + TRACE("PSAMPR_SERVER_NAME_bind() called\n");
status = RpcStringBindingComposeW(NULL, L"ncacn_np", @@ -607,7 +345,7 @@ &pszStringBinding); if (status) { -// TRACE("RpcStringBindingCompose returned 0x%x\n", status); + TRACE("RpcStringBindingCompose returned 0x%x\n", status); return NULL; }
@@ -616,7 +354,7 @@ &hBinding); if (status) { -// TRACE("RpcBindingFromStringBinding returned 0x%x\n", status); + TRACE("RpcBindingFromStringBinding returned 0x%x\n", status); }
status = RpcStringFreeW(&pszStringBinding); @@ -635,12 +373,12 @@ { RPC_STATUS status;
-// TRACE("PSAMPR_SERVER_NAME_unbind() called\n"); + TRACE("PSAMPR_SERVER_NAME_unbind() called\n");
status = RpcBindingFree(&hBinding); if (status) { -// TRACE("RpcBindingFree returned 0x%x\n", status); + TRACE("RpcBindingFree returned 0x%x\n", status); } }
Modified: trunk/reactos/dll/win32/samlib/samlib.spec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samlib/samlib.spe... ============================================================================== --- trunk/reactos/dll/win32/samlib/samlib.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samlib/samlib.spec [iso-8859-1] Mon May 21 13:38:32 2012 @@ -64,7 +64,6 @@ @ stub SamiSetDSRMPassword @ stub SamiSetDSRMPasswordOWF
-@ stdcall SamInitializeSAM() @ stdcall SamCreateUser(wstr wstr ptr) @ stdcall SamCheckUserPassword(wstr wstr) @ stdcall SamGetUserSid(wstr ptr)
Modified: trunk/reactos/dll/win32/samsrv/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/CMakeLists... ============================================================================== --- trunk/reactos/dll/win32/samsrv/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/CMakeLists.txt [iso-8859-1] Mon May 21 13:38:32 2012 @@ -10,6 +10,7 @@ list(APPEND SOURCE samrpc.c samsrv.c + setup.c samsrv.rc ${CMAKE_CURRENT_BINARY_DIR}/samsrv_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/samsrv.def @@ -19,6 +20,6 @@ set_module_type(samsrv win32dll ENTRYPOINT 0 UNICODE)
target_link_libraries(samsrv wine ${PSEH_LIB}) -add_importlibs(samsrv rpcrt4 kernel32 ntdll) +add_importlibs(samsrv rpcrt4 advapi32 kernel32 ntdll) add_dependencies(samsrv psdk) add_cd_file(TARGET samsrv DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/dll/win32/samsrv/samsrv.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samsrv.c?r... ============================================================================== --- trunk/reactos/dll/win32/samsrv/samsrv.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/samsrv.c [iso-8859-1] Mon May 21 13:38:32 2012 @@ -29,9 +29,15 @@ NTAPI SamIInitialize(VOID) { + NTSTATUS Status = STATUS_SUCCESS; + TRACE("SamIInitialize() called\n");
- return STATUS_SUCCESS; + if (SampIsSetupRunning()) + Status = SampInitializeRegistry(); + + + return Status; }
@@ -41,6 +47,8 @@ { TRACE("SampInitializeRegistry() called\n");
+ SampInitializeSAM(); + return STATUS_SUCCESS; }
Modified: trunk/reactos/dll/win32/samsrv/samsrv.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samsrv.h?r... ============================================================================== --- trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] Mon May 21 13:38:32 2012 @@ -16,4 +16,9 @@
#include "sam_s.h"
-#include <wine/debug.h> +#include <wine/debug.h> + + +/* setup.c */ +BOOL SampIsSetupRunning(VOID); +BOOL SampInitializeSAM(VOID);
Added: trunk/reactos/dll/win32/samsrv/setup.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/setup.c?re... ============================================================================== --- trunk/reactos/dll/win32/samsrv/setup.c (added) +++ trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] Mon May 21 13:38:32 2012 @@ -1,0 +1,316 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: Security Account Manager (SAM) Server + * FILE: reactos/dll/win32/samsrv/setup.c + * PURPOSE: Registry setup routines + * + * PROGRAMMERS: Eric Kohl + */ + +/* INCLUDES ****************************************************************/ + +#include "samsrv.h" + +WINE_DEFAULT_DEBUG_CHANNEL(samsrv); + + +/* FUNCTIONS ***************************************************************/ + +BOOL +SampIsSetupRunning(VOID) +{ + DWORD dwError; + HKEY hKey; + DWORD dwType; + DWORD dwSize; + DWORD dwSetupType; + + TRACE("SampIsSetupRunning()\n"); + + /* Open key */ + dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SYSTEM\Setup", + 0, + KEY_QUERY_VALUE, + &hKey); + if (dwError != ERROR_SUCCESS) + return FALSE; + + /* Read key */ + dwSize = sizeof(DWORD); + dwError = RegQueryValueExW(hKey, + L"SetupType", + NULL, + &dwType, + (LPBYTE)&dwSetupType, + &dwSize); + + /* Close key, and check if returned values are correct */ + RegCloseKey(hKey); + if (dwError != ERROR_SUCCESS || dwType != REG_DWORD || dwSize != sizeof(DWORD)) + return FALSE; + + TRACE("SampIsSetupRunning() returns %s\n", (dwSetupType != 0) ? "TRUE" : "FALSE"); + return (dwSetupType != 0); +} + + +static BOOL +CreateBuiltinAliases(HKEY hAliasesKey) +{ + return TRUE; +} + + +static BOOL +CreateBuiltinGroups(HKEY hGroupsKey) +{ + return TRUE; +} + + +static BOOL +CreateBuiltinUsers(HKEY hUsersKey) +{ + return TRUE; +} + + +BOOL +SampInitializeSAM(VOID) +{ + DWORD dwDisposition; + HKEY hSamKey; + HKEY hDomainsKey; + HKEY hAccountKey; + HKEY hBuiltinKey; + HKEY hAliasesKey; + HKEY hGroupsKey; + HKEY hUsersKey; + + TRACE("SampInitializeSAM() called\n"); + + if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, + L"SAM\SAM", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hSamKey, + &dwDisposition)) + { + ERR("Failed to create 'Sam' key! (Error %lu)\n", GetLastError()); + return FALSE; + } + + if (RegCreateKeyExW(hSamKey, + L"Domains", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hDomainsKey, + &dwDisposition)) + { + ERR("Failed to create 'Domains' key! (Error %lu)\n", GetLastError()); + RegCloseKey(hSamKey); + return FALSE; + } + + RegCloseKey (hSamKey); + + /* Create the 'Domains\Account' key */ + if (RegCreateKeyExW(hDomainsKey, + L"Account", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hAccountKey, + &dwDisposition)) + { + ERR("Failed to create 'Domains\Account' key! (Error %lu)\n", GetLastError()); + RegCloseKey(hDomainsKey); + return FALSE; + } + + + /* Create the 'Account\Aliases' key */ + if (RegCreateKeyExW(hAccountKey, + L"Aliases", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hAliasesKey, + &dwDisposition)) + { + ERR("Failed to create 'Account\Aliases' key! (Error %lu)\n", GetLastError()); + RegCloseKey(hAccountKey); + RegCloseKey(hDomainsKey); + return FALSE; + } + + RegCloseKey (hAliasesKey); + + + /* Create the 'Account\Groups' key */ + if (RegCreateKeyExW(hAccountKey, + L"Groups", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hGroupsKey, + &dwDisposition)) + { + ERR("Failed to create 'Account\Groups' key! (Error %lu)\n", GetLastError()); + RegCloseKey(hAccountKey); + RegCloseKey(hDomainsKey); + return FALSE; + } + + RegCloseKey(hGroupsKey); + + + /* Create the 'Account\Users' key */ + if (RegCreateKeyExW(hAccountKey, + L"Users", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hUsersKey, + &dwDisposition)) + { + ERR("Failed to create 'Account\Users' key! (Error %lu)\n", GetLastError()); + RegCloseKey(hAccountKey); + RegCloseKey(hDomainsKey); + return FALSE; + } + + RegCloseKey(hUsersKey); + + RegCloseKey(hAccountKey); + + + /* Create the 'Domains\Builtin' */ + if (RegCreateKeyExW(hDomainsKey, + L"Builtin", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hBuiltinKey, + &dwDisposition)) + { + ERR("Failed to create Builtin key! (Error %lu)\n", GetLastError()); + RegCloseKey(hDomainsKey); + return FALSE; + } + + + /* Create the 'Builtin\Aliases' key */ + if (RegCreateKeyExW(hBuiltinKey, + L"Aliases", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hAliasesKey, + &dwDisposition)) + { + ERR("Failed to create 'Builtin\Aliases' key! (Error %lu)\n", GetLastError()); + RegCloseKey(hBuiltinKey); + RegCloseKey(hDomainsKey); + return FALSE; + } + + /* Create builtin aliases */ + if (!CreateBuiltinAliases(hAliasesKey)) + { + ERR("Failed to create builtin aliases!\n"); + RegCloseKey(hAliasesKey); + RegCloseKey(hBuiltinKey); + RegCloseKey(hDomainsKey); + return FALSE; + } + + RegCloseKey(hAliasesKey); + + + /* Create the 'Builtin\Groups' key */ + if (RegCreateKeyExW(hBuiltinKey, + L"Groups", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hGroupsKey, + &dwDisposition)) + { + ERR("Failed to create 'Builtin\Groups' key! (Error %lu)\n", GetLastError()); + RegCloseKey(hBuiltinKey); + RegCloseKey(hDomainsKey); + return FALSE; + } + + /* Create builtin groups */ + if (!CreateBuiltinGroups(hGroupsKey)) + { + ERR("Failed to create builtin groups!\n"); + RegCloseKey(hGroupsKey); + RegCloseKey(hBuiltinKey); + RegCloseKey(hDomainsKey); + return FALSE; + } + + RegCloseKey(hGroupsKey); + + + /* Create the 'Builtin\Users' key */ + if (RegCreateKeyExW(hBuiltinKey, + L"Users", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hUsersKey, + &dwDisposition)) + { + ERR("Failed to create 'Builtin\Users' key! (Error %lu)\n", GetLastError()); + RegCloseKey(hBuiltinKey); + RegCloseKey(hDomainsKey); + return FALSE; + } + + /* Create builtin users */ + if (!CreateBuiltinUsers(hUsersKey)) + { + ERR("Failed to create builtin users!\n"); + RegCloseKey(hUsersKey); + RegCloseKey(hBuiltinKey); + RegCloseKey(hDomainsKey); + return FALSE; + } + + RegCloseKey(hUsersKey); + + RegCloseKey(hBuiltinKey); + + RegCloseKey(hDomainsKey); + + TRACE("SampInitializeSAM() done\n"); + + return TRUE; +}
Propchange: trunk/reactos/dll/win32/samsrv/setup.c ------------------------------------------------------------------------------ svn:eol-style = native
Propchange: trunk/reactos/dll/win32/samsrv/setup.c ------------------------------------------------------------------------------ svn:keywords = author date id revision
Modified: trunk/reactos/dll/win32/syssetup/install.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/syssetup/install.... ============================================================================== --- trunk/reactos/dll/win32/syssetup/install.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/syssetup/install.c [iso-8859-1] Mon May 21 13:38:32 2012 @@ -893,13 +893,6 @@ return 0; }
- /* Initialize the Security Account Manager (SAM) */ - if (!SamInitializeSAM()) - { - FatalError("SamInitializeSAM() failed!"); - return 0; - } - /* Create the semi-random Domain-SID */ if (!CreateRandomSid(&DomainSid)) {
Modified: trunk/reactos/include/reactos/libs/samlib/samlib.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/samlib... ============================================================================== --- trunk/reactos/include/reactos/libs/samlib/samlib.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/libs/samlib/samlib.h [iso-8859-1] Mon May 21 13:38:32 2012 @@ -27,9 +27,6 @@
BOOL WINAPI -SamInitializeSAM (VOID); - -BOOL WINAPI SamCreateUser (PWSTR UserName, PWSTR UserPassword, PSID UserSid);