Author: ekohl
Date: Sat Apr 20 18:54:27 2013
New Revision: 58792
URL:
http://svn.reactos.org/svn/reactos?rev=58792&view=rev
Log:
[SAMSRV]
- Add string resources for SAM object names and comments.
- Use the string resources in the setup code.
Added:
trunk/reactos/dll/win32/samsrv/lang/ (with props)
trunk/reactos/dll/win32/samsrv/lang/de-DE.rc (with props)
trunk/reactos/dll/win32/samsrv/lang/en-US.rc (with props)
Modified:
trunk/reactos/dll/win32/samsrv/samsrv.h
trunk/reactos/dll/win32/samsrv/samsrv.rc
trunk/reactos/dll/win32/samsrv/setup.c
Propchange: trunk/reactos/dll/win32/samsrv/lang/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Apr 20 18:54:27 2013
@@ -1,0 +1,7 @@
+GNUmakefile
+*.vcproj
+*.user
+*.cbp
+*.ncb
+*.suo
+*.sln
Added: trunk/reactos/dll/win32/samsrv/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/lang/de-D…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/lang/de-DE.rc (added)
+++ trunk/reactos/dll/win32/samsrv/lang/de-DE.rc [iso-8859-1] Sat Apr 20 18:54:27 2013
@@ -1,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
Propchange: trunk/reactos/dll/win32/samsrv/lang/de-DE.rc
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/samsrv/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/lang/en-U…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/lang/en-US.rc (added)
+++ trunk/reactos/dll/win32/samsrv/lang/en-US.rc [iso-8859-1] Sat Apr 20 18:54:27 2013
@@ -1,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
Propchange: trunk/reactos/dll/win32/samsrv/lang/en-US.rc
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/dll/win32/samsrv/samsrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samsrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/samsrv.h [iso-8859-1] Sat Apr 20 18:54:27 2013
@@ -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>
@@ -29,6 +30,8 @@
#include <sam_s.h>
#include <wine/debug.h>
+
+#include "resources.h"
typedef enum _SAM_DB_OBJECT_TYPE
{
Modified: trunk/reactos/dll/win32/samsrv/samsrv.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samsrv.rc…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/samsrv.rc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/samsrv.rc [iso-8859-1] Sat Apr 20 18:54:27 2013
@@ -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
+
Modified: trunk/reactos/dll/win32/samsrv/setup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/setup.c?r…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/setup.c [iso-8859-1] Sat Apr 20 18:54:27 2013
@@ -22,6 +22,53 @@
/* 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 @@
}
+#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,31 +380,31 @@
L"AdminComment",
0,
REG_SZ,
+ (LPVOID)lpComment,
+ (wcslen(lpComment) + 1) * sizeof(WCHAR));
+
+ RegSetValueEx(hAccountKey,
+ L"UserComment",
+ 0,
+ REG_SZ,
(LPVOID)lpEmptyString,
sizeof(WCHAR));
RegSetValueEx(hAccountKey,
- L"UserComment",
+ L"WorkStations",
0,
REG_SZ,
(LPVOID)lpEmptyString,
sizeof(WCHAR));
RegSetValueEx(hAccountKey,
- L"WorkStations",
+ L"Parameters",
0,
REG_SZ,
(LPVOID)lpEmptyString,
sizeof(WCHAR));
- RegSetValueEx(hAccountKey,
- L"Parameters",
- 0,
- REG_SZ,
- (LPVOID)lpEmptyString,
- sizeof(WCHAR));
-
- /* Set LogonHours attribute */
+ /* Set LogonHours attribute*/
*((PUSHORT)LogonHours) = 168;
memset(&(LogonHours[2]), 0xff, 21);
@@ -630,9 +690,14 @@
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",
@@ -687,31 +752,45 @@
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);
+ SampLoadString(hInstance, IDS_ALIAS_GUESTS_NAME, szName, 80);
+ SampLoadString(hInstance, IDS_ALIAS_GUESTS_COMMENT, szComment, 256);
+
SampCreateAliasAccount(hDomainKey,
- L"Guests",
- L"Guests 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,
- L"Power Users",
- L"Power Users Group",
+ szName,
+ szComment,
DOMAIN_ALIAS_RID_POWER_USERS);
@@ -737,13 +816,21 @@
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);