diff --git a/reactos/dll/win32/lsasrv/CMakeLists.txt b/reactos/dll/win32/lsasrv/CMakeLists.txt index 9804adaaca3..639a0b1f687 100644 --- a/reactos/dll/win32/lsasrv/CMakeLists.txt +++ b/reactos/dll/win32/lsasrv/CMakeLists.txt @@ -18,6 +18,7 @@ list(APPEND SOURCE privileges.c registry.c security.c + utils.c lsasrv.rc ${CMAKE_CURRENT_BINARY_DIR}/lsasrv_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/lsasrv.def diff --git a/reactos/dll/win32/lsasrv/lang/en-US.rc b/reactos/dll/win32/lsasrv/lang/en-US.rc new file mode 100644 index 00000000000..02795d81f1c --- /dev/null +++ b/reactos/dll/win32/lsasrv/lang/en-US.rc @@ -0,0 +1,44 @@ +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +STRINGTABLE +BEGIN + IDS_NT_AUTHORITY "NT AUTHORITY" + IDS_NULL_RID "NULL SID" + IDS_WORLD_RID "Everyone" + IDS_LOCAL_RID "LOCAL" + IDS_CREATOR_OWNER_RID "CREATOR OWNER" + IDS_CREATOR_GROUP_RID "CREATOR GROUP" + IDS_CREATOR_OWNER_SERVER_RID "CREATOR OWNER SERVER" + IDS_CREATOR_GROUP_SERVER_RID "CREATOR GROUP SERVER" + IDS_DIALUP_RID "DIALUP" + IDS_NETWORK_RID "NETWORK" + IDS_BATCH_RID "BATCH" + IDS_INTERACTIVE_RID "INTERACTIVE" + IDS_SERVICE_RID "SERVICE" + IDS_ANONYMOUS_LOGON_RID "ANONYMOUS LOGON" + IDS_PROXY_RID "PROXY" + IDS_ENTERPRISE_CONTROLLERS_RID "ENTERPRISE DOMAIN CONTROLLERS" + IDS_PRINCIPAL_SELF_RID "SELF" + IDS_AUTHENTICATED_USER_RID "Authenticated Users" + IDS_RESTRICTED_CODE_RID "RESTRICTED" + IDS_TERMINAL_SERVER_RID "TERMINAL SERVER USER" + IDS_REMOTE_LOGON_RID "REMOTE INTERACTIVE LOGON" + IDS_THIS_ORGANIZATION_RID "This Organization" + IDS_LOCAL_SYSTEM_RID "SYSTEM" + IDS_LOCAL_SERVICE_RID "LOCAL SERVICE" + IDS_NETWORK_SERVICE_RID "NETWORK SERVICE" + IDS_BUILTIN_DOMAIN_RID "BUILTIN" + IDS_ALIAS_RID_ADMINS "Administrators" + IDS_ALIAS_RID_USERS "Users" + IDS_ALIAS_RID_GUESTS "Guests" + IDS_ALIAS_RID_POWER_USERS "Power Users" + IDS_ALIAS_RID_ACCOUNT_OPS "Account Operators" + IDS_ALIAS_RID_SYSTEM_OPS "Server Operators" + IDS_ALIAS_RID_PRINT_OPS "Print Operators" + IDS_ALIAS_RID_BACKUP_OPS "Backup Operators" + IDS_ALIAS_RID_REPLICATOR "Replicators" + IDS_ALIAS_RID_RAS_SERVERS "RAS and IAS Servers" + IDS_ALIAS_RID_PREW2KCOMPACCESS "Pre-Windows 2000 Compatible Access" + IDS_ALIAS_RID_REMOTE_DESKTOP_USERS "Remote Desktop Users" + IDS_ALIAS_RID_NETWORK_CONFIGURATION_OPS "Network Configuration Operators" +END diff --git a/reactos/dll/win32/lsasrv/lookup.c b/reactos/dll/win32/lsasrv/lookup.c index 3cc49738758..b43686815ad 100644 --- a/reactos/dll/win32/lsasrv/lookup.c +++ b/reactos/dll/win32/lsasrv/lookup.c @@ -235,11 +235,38 @@ LsapCreateSid(PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, *p = SubAuthorities[i]; } - RtlInitUnicodeString(&SidEntry->AccountName, - AccountName); +// RtlInitUnicodeString(&SidEntry->AccountName, +// AccountName); + SidEntry->AccountName.Length = wcslen(AccountName) * sizeof(WCHAR); + SidEntry->AccountName.MaximumLength = SidEntry->AccountName.Length + sizeof(WCHAR); + SidEntry->AccountName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, + SidEntry->AccountName.MaximumLength); + if (SidEntry->AccountName.Buffer == NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, SidEntry->Sid); + RtlFreeHeap(RtlGetProcessHeap(), 0, SidEntry); + return FALSE; + } - RtlInitUnicodeString(&SidEntry->DomainName, - DomainName); + wcscpy(SidEntry->AccountName.Buffer, + AccountName); + +// RtlInitUnicodeString(&SidEntry->DomainName, +// DomainName); + SidEntry->DomainName.Length = wcslen(DomainName) * sizeof(WCHAR); + SidEntry->DomainName.MaximumLength = SidEntry->DomainName.Length + sizeof(WCHAR); + SidEntry->DomainName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, + SidEntry->DomainName.MaximumLength); + if (SidEntry->DomainName.Buffer == NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, SidEntry->AccountName.Buffer); + RtlFreeHeap(RtlGetProcessHeap(), 0, SidEntry->Sid); + RtlFreeHeap(RtlGetProcessHeap(), 0, SidEntry); + return FALSE; + } + + wcscpy(SidEntry->DomainName.Buffer, + DomainName); SidEntry->Use = Use; @@ -253,223 +280,278 @@ LsapCreateSid(PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, NTSTATUS LsapInitSids(VOID) { + WCHAR szAccountName[80]; + WCHAR szDomainName[80]; ULONG SubAuthorities[8]; + HINSTANCE hInstance; InitializeListHead(&WellKnownSidListHead); + hInstance = GetModuleHandleW(L"lsasrv.dll"); + /* NT Authority */ + + LsapLoadString(hInstance, IDS_NT_AUTHORITY, szAccountName, 80); + LsapLoadString(hInstance, IDS_NT_AUTHORITY, szDomainName, 80); LsapCreateSid(&NtAuthority, 0, NULL, - L"NT AUTHORITY", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeDomain); /* Null Sid */ + LsapLoadString(hInstance, IDS_NULL_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_NULL_RID; LsapCreateSid(&NullSidAuthority, 1, SubAuthorities, - L"NULL SID", + szAccountName, L"", SidTypeWellKnownGroup); /* World Sid */ + LsapLoadString(hInstance, IDS_WORLD_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_WORLD_RID; LsapCreateSid(&WorldSidAuthority, 1, SubAuthorities, - L"Everyone", + szAccountName, L"", SidTypeWellKnownGroup); /* Local Sid */ + LsapLoadString(hInstance, IDS_LOCAL_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_LOCAL_RID; LsapCreateSid(&LocalSidAuthority, 1, SubAuthorities, - L"LOCAL", + szAccountName, L"", SidTypeWellKnownGroup); /* Creator Owner Sid */ + LsapLoadString(hInstance, IDS_CREATOR_OWNER_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_CREATOR_OWNER_RID; LsapCreateSid(&CreatorSidAuthority, 1, SubAuthorities, - L"CREATOR OWNER", + szAccountName, L"", SidTypeWellKnownGroup); /* Creator Group Sid */ + LsapLoadString(hInstance, IDS_CREATOR_GROUP_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_CREATOR_GROUP_RID; LsapCreateSid(&CreatorSidAuthority, 1, SubAuthorities, - L"CREATOR GROUP", + szAccountName, L"", SidTypeWellKnownGroup); /* Creator Owner Server Sid */ + LsapLoadString(hInstance, IDS_CREATOR_OWNER_SERVER_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_CREATOR_OWNER_SERVER_RID; LsapCreateSid(&CreatorSidAuthority, 1, SubAuthorities, - L"CREATOR OWNER SERVER", + szAccountName, L"", SidTypeWellKnownGroup); /* Creator Group Server Sid */ + LsapLoadString(hInstance, IDS_CREATOR_GROUP_SERVER_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_CREATOR_GROUP_SERVER_RID; LsapCreateSid(&CreatorSidAuthority, 1, SubAuthorities, - L"CREATOR GROUP SERVER", + szAccountName, L"", SidTypeWellKnownGroup); /* Dialup Sid */ + LsapLoadString(hInstance, IDS_DIALUP_RID, szAccountName, 80); + LsapLoadString(hInstance, IDS_NT_AUTHORITY, szDomainName, 80); + SubAuthorities[0] = SECURITY_DIALUP_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"DIALUP", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Network Sid */ + LsapLoadString(hInstance, IDS_DIALUP_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_NETWORK_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"NETWORK", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Batch Sid*/ + LsapLoadString(hInstance, IDS_BATCH_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_BATCH_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"BATCH", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Interactive Sid */ + LsapLoadString(hInstance, IDS_INTERACTIVE_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_INTERACTIVE_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"INTERACTIVE", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Service Sid */ + LsapLoadString(hInstance, IDS_SERVICE_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_SERVICE_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"SERVICE", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Anonymous Logon Sid */ + LsapLoadString(hInstance, IDS_ANONYMOUS_LOGON_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_ANONYMOUS_LOGON_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"ANONYMOUS LOGON", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Proxy Sid */ + LsapLoadString(hInstance, IDS_PROXY_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_PROXY_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"PROXY", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Enterprise Controllers Sid */ + LsapLoadString(hInstance, IDS_ENTERPRISE_CONTROLLERS_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_ENTERPRISE_CONTROLLERS_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"ENTERPRISE DOMAIN CONTROLLERS", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Principal Self Sid */ + LsapLoadString(hInstance, IDS_PRINCIPAL_SELF_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_PRINCIPAL_SELF_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"SELF", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Authenticated Users Sid */ + LsapLoadString(hInstance, IDS_AUTHENTICATED_USER_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_AUTHENTICATED_USER_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"Authenticated Users", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Restricted Code Sid */ + LsapLoadString(hInstance, IDS_RESTRICTED_CODE_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_RESTRICTED_CODE_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"RESTRICTED", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Terminal Server Sid */ + LsapLoadString(hInstance, IDS_TERMINAL_SERVER_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_TERMINAL_SERVER_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"TERMINAL SERVER USER", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Remote Logon Sid */ + LsapLoadString(hInstance, IDS_REMOTE_LOGON_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_REMOTE_LOGON_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"REMOTE INTERACTIVE LOGON", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* This Organization Sid */ + LsapLoadString(hInstance, IDS_THIS_ORGANIZATION_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_THIS_ORGANIZATION_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"This Organization", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Local System Sid */ + LsapLoadString(hInstance, IDS_LOCAL_SYSTEM_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_LOCAL_SYSTEM_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"SYSTEM", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); /* Local Service Sid */ + LsapLoadString(hInstance, IDS_LOCAL_SERVICE_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_LOCAL_SERVICE_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"LOCAL SERVICE", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); LsapCreateSid(&NtAuthority, @@ -480,12 +562,14 @@ LsapInitSids(VOID) SidTypeWellKnownGroup); /* Network Service Sid */ + LsapLoadString(hInstance, IDS_NETWORK_SERVICE_RID, szAccountName, 80); + SubAuthorities[0] = SECURITY_NETWORK_SERVICE_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"NETWORK SERVICE", - L"NT AUTHORITY", + szAccountName, + szDomainName, SidTypeWellKnownGroup); LsapCreateSid(&NtAuthority, @@ -496,144 +580,171 @@ LsapInitSids(VOID) SidTypeWellKnownGroup); /* Builtin Domain Sid */ + LsapLoadString(hInstance, IDS_BUILTIN_DOMAIN_RID, szAccountName, 80); + LsapLoadString(hInstance, IDS_BUILTIN_DOMAIN_RID, szDomainName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; LsapCreateSid(&NtAuthority, 1, SubAuthorities, - L"BUILTIN", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeDomain); /* Administrators Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_ADMINS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_ADMINS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Administrators", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* Users Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_USERS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_USERS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Users", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* Guests Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_GUESTS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_GUESTS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Guests", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* Power User Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_POWER_USERS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_POWER_USERS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Power User", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* Account Operators Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_ACCOUNT_OPS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_ACCOUNT_OPS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Account Operators", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* System Operators Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_SYSTEM_OPS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_SYSTEM_OPS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Server Operators", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* Print Operators Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_PRINT_OPS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_PRINT_OPS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Print Operators", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* Backup Operators Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_BACKUP_OPS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_BACKUP_OPS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Backup Operators", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* Replicators Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_REPLICATOR, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_REPLICATOR; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Replicators", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); -#if 0 /* RAS Servers Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_RAS_SERVERS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_RAS_SERVERS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Backup Operators", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); -#endif /* Pre-Windows 2000 Compatible Access Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_PREW2KCOMPACCESS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_PREW2KCOMPACCESS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Pre-Windows 2000 Compatible Access", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* Remote Desktop Users Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_REMOTE_DESKTOP_USERS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Remote Desktop Users", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* Network Configuration Operators Alias Sid */ + LsapLoadString(hInstance, IDS_ALIAS_RID_NETWORK_CONFIGURATION_OPS, szAccountName, 80); + SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID; SubAuthorities[1] = DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS; LsapCreateSid(&NtAuthority, 2, SubAuthorities, - L"Network Configuration Operators", - L"BUILTIN", + szAccountName, + szDomainName, SidTypeAlias); /* FIXME: Add more well known sids */ diff --git a/reactos/dll/win32/lsasrv/lsasrv.h b/reactos/dll/win32/lsasrv/lsasrv.h index 029b1fe64eb..eb94c7909d2 100644 --- a/reactos/dll/win32/lsasrv/lsasrv.h +++ b/reactos/dll/win32/lsasrv/lsasrv.h @@ -14,6 +14,7 @@ #include #include #include +#include #define NTOS_MODE_USER #include #include @@ -39,6 +40,7 @@ #include +#include "resources.h" typedef enum _LSA_DB_OBJECT_TYPE { @@ -381,4 +383,11 @@ NTSTATUS LsapCreateSecretSd(PSECURITY_DESCRIPTOR *SecretSd, PULONG SecretSdSize); +/* utils.c */ +INT +LsapLoadString(HINSTANCE hInstance, + UINT uId, + LPWSTR lpBuffer, + INT nBufferMax); + /* EOF */ diff --git a/reactos/dll/win32/lsasrv/lsasrv.rc b/reactos/dll/win32/lsasrv/lsasrv.rc index 9726ee2c33a..67ca2bc56d4 100644 --- a/reactos/dll/win32/lsasrv/lsasrv.rc +++ b/reactos/dll/win32/lsasrv/lsasrv.rc @@ -1,5 +1,24 @@ +#include +#include "resources.h" + #define REACTOS_VERSION_DLL #define REACTOS_STR_FILE_DESCRIPTION "LSA server DLL\0" #define REACTOS_STR_INTERNAL_NAME "lsasrv\0" #define REACTOS_STR_ORIGINAL_FILENAME "lsasrv.dll\0" +#define REACTOS_FILEVERSION 5,1,2600,0 +#define REACTOS_STR_FILE_VERSION "5.1.2600\0" #include + +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_EN_US + #include "lang/en-US.rc" +#endif diff --git a/reactos/dll/win32/lsasrv/resources.h b/reactos/dll/win32/lsasrv/resources.h new file mode 100644 index 00000000000..63071292f9a --- /dev/null +++ b/reactos/dll/win32/lsasrv/resources.h @@ -0,0 +1,52 @@ +/* + * PROJECT: Local Security Authority Server DLL + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/lsasrv/resource.h + * PURPOSE: Resource IDs + * COPYRIGHT: Copyright 2013 Eric Kohl + */ + +#pragma once + +#define IDS_NT_AUTHORITY 100 + +#define IDS_NULL_RID 110 +#define IDS_WORLD_RID 111 +#define IDS_LOCAL_RID 112 +#define IDS_CREATOR_OWNER_RID 113 +#define IDS_CREATOR_GROUP_RID 114 +#define IDS_CREATOR_OWNER_SERVER_RID 115 +#define IDS_CREATOR_GROUP_SERVER_RID 116 +#define IDS_DIALUP_RID 117 +#define IDS_NETWORK_RID 118 +#define IDS_BATCH_RID 119 +#define IDS_INTERACTIVE_RID 120 +#define IDS_SERVICE_RID 121 +#define IDS_ANONYMOUS_LOGON_RID 122 +#define IDS_PROXY_RID 123 +#define IDS_ENTERPRISE_CONTROLLERS_RID 124 +#define IDS_PRINCIPAL_SELF_RID 125 +#define IDS_AUTHENTICATED_USER_RID 126 +#define IDS_RESTRICTED_CODE_RID 127 +#define IDS_TERMINAL_SERVER_RID 128 +#define IDS_REMOTE_LOGON_RID 129 +#define IDS_THIS_ORGANIZATION_RID 130 +#define IDS_LOCAL_SYSTEM_RID 131 +#define IDS_LOCAL_SERVICE_RID 132 +#define IDS_NETWORK_SERVICE_RID 133 +#define IDS_BUILTIN_DOMAIN_RID 134 +#define IDS_ALIAS_RID_ADMINS 135 +#define IDS_ALIAS_RID_USERS 136 +#define IDS_ALIAS_RID_GUESTS 137 +#define IDS_ALIAS_RID_POWER_USERS 138 +#define IDS_ALIAS_RID_ACCOUNT_OPS 139 +#define IDS_ALIAS_RID_SYSTEM_OPS 140 +#define IDS_ALIAS_RID_PRINT_OPS 141 +#define IDS_ALIAS_RID_BACKUP_OPS 142 +#define IDS_ALIAS_RID_REPLICATOR 143 +#define IDS_ALIAS_RID_RAS_SERVERS 144 +#define IDS_ALIAS_RID_PREW2KCOMPACCESS 145 +#define IDS_ALIAS_RID_REMOTE_DESKTOP_USERS 146 +#define IDS_ALIAS_RID_NETWORK_CONFIGURATION_OPS 147 + +/* EOF */ diff --git a/reactos/dll/win32/lsasrv/utils.c b/reactos/dll/win32/lsasrv/utils.c new file mode 100644 index 00000000000..0b5651d6dc5 --- /dev/null +++ b/reactos/dll/win32/lsasrv/utils.c @@ -0,0 +1,68 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: Security Account Manager (SAM) Server + * FILE: reactos/dll/win32/lsasrv/utils.c + * PURPOSE: Utility functions + * + * PROGRAMMERS: Eric Kohl + */ + +/* INCLUDES ****************************************************************/ + +#include "lsasrv.h" + +WINE_DEFAULT_DEBUG_CHANNEL(lsasrv); + + +/* GLOBALS *****************************************************************/ + + +/* FUNCTIONS ***************************************************************/ + +INT +LsapLoadString(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; +} + +/* EOF */