- Add string resources for SAM object names and comments.
- Use the string resources in the setup code.

svn path=/trunk/; revision=58792
This commit is contained in:
Eric Kohl 2013-04-20 18:54:27 +00:00
parent 91a5c6ea10
commit 25006dfe30
5 changed files with 177 additions and 16 deletions

View file

@ -0,0 +1,24 @@
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
STRINGTABLE
BEGIN
IDS_DOMAIN_BUILTIN_NAME "Builtin"
IDS_ALIAS_ADMINISTRATORS_NAME "Administratoren"
IDS_ALIAS_ADMINISTRATORS_COMMENT "Administratoren haben unbeschränkten Zugriff auf den Computer oder die Domäne."
IDS_ALIAS_GUESTS_NAME "Gäste"
IDS_ALIAS_GUESTS_COMMENT "Gäste besitzen standadmäßig die selben Rechte wie die Mitglieder der Benutzer-Gruppe."
IDS_ALIAS_POWER_USERS_NAME "Hauptbenutzer"
IDS_ALIAS_POWER_USERS_COMMENT "Hauptbenutzer besitzen die meisten Rechte mit einigen Einschränkungen."
IDS_ALIAS_USERS_NAME "Benutzer"
IDS_ALIAS_USERS_COMMENT "Benutzer können keine Änderungen am System vornehmen."
IDS_USER_ADMINISTRATOR_NAME "Administrator"
IDS_USER_ADMINISTRATOR_COMMENT "Vordefiniertes Konto für die Verwaltung des Comuters oder der Domäne."
IDS_USER_GUEST_NAME "Gast"
IDS_USER_GUEST_COMMENT "Vordefiniertes Konto für Gastzugriff auf den Computer oder die Domäne."
END

View file

@ -0,0 +1,24 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE
BEGIN
IDS_DOMAIN_BUILTIN_NAME "Builtin"
IDS_ALIAS_ADMINISTRATORS_NAME "Administrators"
IDS_ALIAS_ADMINISTRATORS_COMMENT "Administrators have unrestricted access to the computer or domain."
IDS_ALIAS_GUESTS_NAME "Guests"
IDS_ALIAS_GUESTS_COMMENT "Guests have the same rights a members of the Users group by default."
IDS_ALIAS_POWER_USERS_NAME "Power Users"
IDS_ALIAS_POWER_USERS_COMMENT "Power Users have most administrative rights with some restrictions."
IDS_ALIAS_USERS_NAME "Users"
IDS_ALIAS_USERS_COMMENT "Users are prevented from making system-wide changes."
IDS_USER_ADMINISTRATOR_NAME "Administrator"
IDS_USER_ADMINISTRATOR_COMMENT "Built-in account used to administate the computer or domain."
IDS_USER_GUEST_NAME "Guest"
IDS_USER_GUEST_COMMENT "Built-in account for guest access to the computer or domain."
END

View file

@ -15,6 +15,7 @@
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winuser.h>
#define NTOS_MODE_USER
#include <ndk/cmfuncs.h>
#include <ndk/kefuncs.h>
@ -30,6 +31,8 @@
#include <wine/debug.h>
#include "resources.h"
typedef enum _SAM_DB_OBJECT_TYPE
{
SamDbIgnoreObject,

View file

@ -1,5 +1,28 @@
#include <windows.h>
#include "resources.h"
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "SAM server DLL\0"
#define REACTOS_STR_INTERNAL_NAME "samsrv\0"
#define REACTOS_STR_ORIGINAL_FILENAME "samsrv.dll\0"
#define REACTOS_FILEVERSION 5,1,2600,0
#define REACTOS_STR_FILE_VERSION "5.1.2600\0"
#include <reactos/version.rc>
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/*
* Everything specific to any language goes in one of the specific
* files. Note that you can and may override resources which also have
* a neutral version. This is to get localized bitmaps for example.
*/
/* UTF-8 */
#pragma code_page(65001)
#ifdef LANGUAGE_DE_DE
#include "lang/de-DE.rc"
#endif
#ifdef LANGUAGE_EN_US
#include "lang/en-US.rc"
#endif

View file

@ -23,6 +23,53 @@ SID_IDENTIFIER_AUTHORITY SecurityNtAuthority = {SECURITY_NT_AUTHORITY};
/* FUNCTIONS ***************************************************************/
static INT
SampLoadString(HINSTANCE hInstance,
UINT uId,
LPWSTR lpBuffer,
INT nBufferMax)
{
HGLOBAL hmem;
HRSRC hrsrc;
WCHAR *p;
int string_num;
int i;
/* Use loword (incremented by 1) as resourceid */
hrsrc = FindResourceW(hInstance,
MAKEINTRESOURCEW((LOWORD(uId) >> 4) + 1),
(LPWSTR)RT_STRING);
if (!hrsrc)
return 0;
hmem = LoadResource(hInstance, hrsrc);
if (!hmem)
return 0;
p = LockResource(hmem);
string_num = uId & 0x000f;
for (i = 0; i < string_num; i++)
p += *p + 1;
i = min(nBufferMax - 1, *p);
if (i > 0)
{
memcpy(lpBuffer, p + 1, i * sizeof(WCHAR));
lpBuffer[i] = 0;
}
else
{
if (nBufferMax > 1)
{
lpBuffer[0] = 0;
return 0;
}
}
return i;
}
BOOL
SampIsSetupRunning(VOID)
{
@ -222,9 +269,22 @@ SampCreateAliasAccount(HKEY hDomainKey,
}
#if 0
static BOOL
SampCreateGroupAccount(HKEY hDomainKey,
LPCWSTR lpAccountName,
ULONG ulRelativeId)
{
return FALSE;
}
#endif
static BOOL
SampCreateUserAccount(HKEY hDomainKey,
LPCWSTR lpAccountName,
LPCWSTR lpComment,
ULONG ulRelativeId,
ULONG UserAccountControl)
{
@ -320,8 +380,8 @@ SampCreateUserAccount(HKEY hDomainKey,
L"AdminComment",
0,
REG_SZ,
(LPVOID)lpEmptyString,
sizeof(WCHAR));
(LPVOID)lpComment,
(wcslen(lpComment) + 1) * sizeof(WCHAR));
RegSetValueEx(hAccountKey,
L"UserComment",
@ -344,7 +404,7 @@ SampCreateUserAccount(HKEY hDomainKey,
(LPVOID)lpEmptyString,
sizeof(WCHAR));
/* Set LogonHours attribute */
/* Set LogonHours attribute*/
*((PUSHORT)LogonHours) = 168;
memset(&(LogonHours[2]), 0xff, 21);
@ -630,10 +690,15 @@ SampInitializeSAM(VOID)
PSID pBuiltinSid = NULL;
BOOL bResult = TRUE;
PSID pSid;
HINSTANCE hInstance;
WCHAR szComment[256];
WCHAR szName[80];
NTSTATUS Status;
TRACE("SampInitializeSAM() called\n");
hInstance = GetModuleHandleW(L"samsrv.dll");
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE,
L"SAM\\SAM",
0,
@ -687,31 +752,45 @@ SampInitializeSAM(VOID)
goto done;
}
SampLoadString(hInstance, IDS_DOMAIN_BUILTIN_NAME, szName, 80);
/* Create the Builtin domain */
if (SampCreateDomain(hDomainsKey,
L"Builtin",
L"Builtin",
szName, //L"Builtin", // SampGetResourceString(hInstance, IDS_DOMAIN_BUILTIN_NAME),
pBuiltinSid,
&hDomainKey))
{
SampLoadString(hInstance, IDS_ALIAS_ADMINISTRATORS_NAME, szName, 80);
SampLoadString(hInstance, IDS_ALIAS_ADMINISTRATORS_COMMENT, szComment, 256);
SampCreateAliasAccount(hDomainKey,
L"Administrators",
L"Testabc1234567890",
szName,
szComment,
DOMAIN_ALIAS_RID_ADMINS);
SampLoadString(hInstance, IDS_ALIAS_USERS_NAME, szName, 80);
SampLoadString(hInstance, IDS_ALIAS_USERS_COMMENT, szComment, 256);
SampCreateAliasAccount(hDomainKey,
L"Users",
L"Users Group",
szName,
szComment,
DOMAIN_ALIAS_RID_USERS);
SampCreateAliasAccount(hDomainKey,
L"Guests",
L"Guests Group",
DOMAIN_ALIAS_RID_GUESTS);
SampLoadString(hInstance, IDS_ALIAS_GUESTS_NAME, szName, 80);
SampLoadString(hInstance, IDS_ALIAS_GUESTS_COMMENT, szComment, 256);
SampCreateAliasAccount(hDomainKey,
L"Power Users",
L"Power Users Group",
szName,
szComment,
DOMAIN_ALIAS_RID_GUESTS);
SampLoadString(hInstance, IDS_ALIAS_POWER_USERS_NAME, szName, 80);
SampLoadString(hInstance, IDS_ALIAS_POWER_USERS_COMMENT, szComment, 256);
SampCreateAliasAccount(hDomainKey,
szName,
szComment,
DOMAIN_ALIAS_RID_POWER_USERS);
@ -737,13 +816,21 @@ SampInitializeSAM(VOID)
AccountDomainInfo->DomainSid,
&hDomainKey))
{
SampLoadString(hInstance, IDS_USER_ADMINISTRATOR_NAME, szName, 80);
SampLoadString(hInstance, IDS_USER_ADMINISTRATOR_COMMENT, szComment, 256);
SampCreateUserAccount(hDomainKey,
L"Administrator",
szName,
szComment,
DOMAIN_USER_RID_ADMIN,
USER_DONT_EXPIRE_PASSWORD | USER_NORMAL_ACCOUNT);
SampLoadString(hInstance, IDS_USER_GUEST_NAME, szName, 80);
SampLoadString(hInstance, IDS_USER_GUEST_COMMENT, szComment, 256);
SampCreateUserAccount(hDomainKey,
L"Guest",
szName,
szComment,
DOMAIN_USER_RID_GUEST,
USER_ACCOUNT_DISABLED | USER_DONT_EXPIRE_PASSWORD | USER_NORMAL_ACCOUNT);