Author: hbelusca
Date: Mon Nov 14 16:19:22 2016
New Revision: 73233
URL:
http://svn.reactos.org/svn/reactos?rev=73233&view=rev
Log:
[LSASRV]
- No need to hardcode the name of the dll in the GetModuleHandleW call;
- Use ARRAYSIZE instead of hardcoding string buffer sizes;
- When initializing the "Network Sid", use the correct localized string.
Modified:
trunk/reactos/dll/win32/lsasrv/lookup.c
Modified: trunk/reactos/dll/win32/lsasrv/lookup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lookup.c?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lookup.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lookup.c [iso-8859-1] Mon Nov 14 16:19:22 2016
@@ -186,12 +186,12 @@
InitializeListHead(&WellKnownSidListHead);
- hInstance = GetModuleHandleW(L"lsasrv.dll");
+ hInstance = GetModuleHandleW(NULL);
/* NT Authority */
- LsapLoadString(hInstance, IDS_NT_AUTHORITY, szAccountName, 80);
- LsapLoadString(hInstance, IDS_NT_AUTHORITY, szDomainName, 80);
+ LsapLoadString(hInstance, IDS_NT_AUTHORITY, szAccountName,
ARRAYSIZE(szAccountName));
+ LsapLoadString(hInstance, IDS_NT_AUTHORITY, szDomainName, ARRAYSIZE(szDomainName));
LsapCreateSid(&NtAuthority,
0,
NULL,
@@ -201,7 +201,7 @@
NULL);
/* Null Sid */
- LsapLoadString(hInstance, IDS_NULL_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_NULL_RID, szAccountName, ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_NULL_RID;
LsapCreateSid(&NullSidAuthority,
@@ -213,7 +213,7 @@
NULL);
/* World Sid */
- LsapLoadString(hInstance, IDS_WORLD_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_WORLD_RID, szAccountName, ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_WORLD_RID;
LsapCreateSid(&WorldSidAuthority,
@@ -225,7 +225,7 @@
&LsapWorldSid);
/* Local Sid */
- LsapLoadString(hInstance, IDS_LOCAL_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_LOCAL_RID, szAccountName, ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_LOCAL_RID;
LsapCreateSid(&LocalSidAuthority,
@@ -237,7 +237,7 @@
NULL);
/* Creator Owner Sid */
- LsapLoadString(hInstance, IDS_CREATOR_OWNER_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_CREATOR_OWNER_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_CREATOR_OWNER_RID;
LsapCreateSid(&CreatorSidAuthority,
@@ -249,7 +249,7 @@
NULL);
/* Creator Group Sid */
- LsapLoadString(hInstance, IDS_CREATOR_GROUP_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_CREATOR_GROUP_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_CREATOR_GROUP_RID;
LsapCreateSid(&CreatorSidAuthority,
@@ -261,7 +261,7 @@
NULL);
/* Creator Owner Server Sid */
- LsapLoadString(hInstance, IDS_CREATOR_OWNER_SERVER_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_CREATOR_OWNER_SERVER_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_CREATOR_OWNER_SERVER_RID;
LsapCreateSid(&CreatorSidAuthority,
@@ -273,7 +273,7 @@
NULL);
/* Creator Group Server Sid */
- LsapLoadString(hInstance, IDS_CREATOR_GROUP_SERVER_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_CREATOR_GROUP_SERVER_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_CREATOR_GROUP_SERVER_RID;
LsapCreateSid(&CreatorSidAuthority,
@@ -285,8 +285,8 @@
NULL);
/* Dialup Sid */
- LsapLoadString(hInstance, IDS_DIALUP_RID, szAccountName, 80);
- LsapLoadString(hInstance, IDS_NT_AUTHORITY, szDomainName, 80);
+ LsapLoadString(hInstance, IDS_DIALUP_RID, szAccountName, ARRAYSIZE(szAccountName));
+ LsapLoadString(hInstance, IDS_NT_AUTHORITY, szDomainName, ARRAYSIZE(szDomainName));
SubAuthorities[0] = SECURITY_DIALUP_RID;
LsapCreateSid(&NtAuthority,
@@ -298,7 +298,7 @@
NULL);
/* Network Sid */
- LsapLoadString(hInstance, IDS_DIALUP_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_NETWORK_RID, szAccountName, ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_NETWORK_RID;
LsapCreateSid(&NtAuthority,
@@ -310,7 +310,7 @@
&LsapNetworkSid);
/* Batch Sid*/
- LsapLoadString(hInstance, IDS_BATCH_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_BATCH_RID, szAccountName, ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BATCH_RID;
LsapCreateSid(&NtAuthority,
@@ -322,7 +322,7 @@
&LsapBatchSid);
/* Interactive Sid */
- LsapLoadString(hInstance, IDS_INTERACTIVE_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_INTERACTIVE_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_INTERACTIVE_RID;
LsapCreateSid(&NtAuthority,
@@ -334,7 +334,7 @@
&LsapInteractiveSid);
/* Service Sid */
- LsapLoadString(hInstance, IDS_SERVICE_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_SERVICE_RID, szAccountName, ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_SERVICE_RID;
LsapCreateSid(&NtAuthority,
@@ -346,7 +346,7 @@
&LsapServiceSid);
/* Anonymous Logon Sid */
- LsapLoadString(hInstance, IDS_ANONYMOUS_LOGON_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ANONYMOUS_LOGON_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_ANONYMOUS_LOGON_RID;
LsapCreateSid(&NtAuthority,
@@ -358,7 +358,7 @@
NULL);
/* Proxy Sid */
- LsapLoadString(hInstance, IDS_PROXY_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_PROXY_RID, szAccountName, ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_PROXY_RID;
LsapCreateSid(&NtAuthority,
@@ -370,7 +370,7 @@
NULL);
/* Enterprise Controllers Sid */
- LsapLoadString(hInstance, IDS_ENTERPRISE_CONTROLLERS_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ENTERPRISE_CONTROLLERS_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_ENTERPRISE_CONTROLLERS_RID;
LsapCreateSid(&NtAuthority,
@@ -382,7 +382,7 @@
NULL);
/* Principal Self Sid */
- LsapLoadString(hInstance, IDS_PRINCIPAL_SELF_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_PRINCIPAL_SELF_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_PRINCIPAL_SELF_RID;
LsapCreateSid(&NtAuthority,
@@ -394,7 +394,7 @@
NULL);
/* Authenticated Users Sid */
- LsapLoadString(hInstance, IDS_AUTHENTICATED_USER_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_AUTHENTICATED_USER_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_AUTHENTICATED_USER_RID;
LsapCreateSid(&NtAuthority,
@@ -406,7 +406,7 @@
NULL);
/* Restricted Code Sid */
- LsapLoadString(hInstance, IDS_RESTRICTED_CODE_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_RESTRICTED_CODE_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_RESTRICTED_CODE_RID;
LsapCreateSid(&NtAuthority,
@@ -418,7 +418,7 @@
NULL);
/* Terminal Server Sid */
- LsapLoadString(hInstance, IDS_TERMINAL_SERVER_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_TERMINAL_SERVER_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_TERMINAL_SERVER_RID;
LsapCreateSid(&NtAuthority,
@@ -430,7 +430,7 @@
NULL);
/* Remote Logon Sid */
- LsapLoadString(hInstance, IDS_REMOTE_LOGON_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_REMOTE_LOGON_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_REMOTE_LOGON_RID;
LsapCreateSid(&NtAuthority,
@@ -442,7 +442,7 @@
NULL);
/* This Organization Sid */
- LsapLoadString(hInstance, IDS_THIS_ORGANIZATION_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_THIS_ORGANIZATION_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_THIS_ORGANIZATION_RID;
LsapCreateSid(&NtAuthority,
@@ -454,7 +454,7 @@
NULL);
/* Local System Sid */
- LsapLoadString(hInstance, IDS_LOCAL_SYSTEM_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_LOCAL_SYSTEM_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_LOCAL_SYSTEM_RID;
LsapCreateSid(&NtAuthority,
@@ -466,7 +466,7 @@
&LsapLocalSystemSid);
/* Local Service Sid */
- LsapLoadString(hInstance, IDS_LOCAL_SERVICE_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_LOCAL_SERVICE_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_LOCAL_SERVICE_RID;
LsapCreateSid(&NtAuthority,
@@ -486,7 +486,7 @@
NULL);
/* Network Service Sid */
- LsapLoadString(hInstance, IDS_NETWORK_SERVICE_RID, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_NETWORK_SERVICE_RID, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_NETWORK_SERVICE_RID;
LsapCreateSid(&NtAuthority,
@@ -506,8 +506,8 @@
NULL);
/* Builtin Domain Sid */
- LsapLoadString(hInstance, IDS_BUILTIN_DOMAIN_RID, szAccountName, 80);
- LsapLoadString(hInstance, IDS_BUILTIN_DOMAIN_RID, szDomainName, 80);
+ LsapLoadString(hInstance, IDS_BUILTIN_DOMAIN_RID, szAccountName,
ARRAYSIZE(szAccountName));
+ LsapLoadString(hInstance, IDS_BUILTIN_DOMAIN_RID, szDomainName,
ARRAYSIZE(szDomainName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
LsapCreateSid(&NtAuthority,
@@ -519,7 +519,7 @@
NULL);
/* Administrators Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_ADMINS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_ADMINS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_ADMINS;
@@ -532,7 +532,7 @@
&LsapAdministratorsSid);
/* Users Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_USERS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_USERS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_USERS;
@@ -545,7 +545,7 @@
NULL);
/* Guests Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_GUESTS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_GUESTS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_GUESTS;
@@ -558,7 +558,7 @@
NULL);
/* Power User Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_POWER_USERS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_POWER_USERS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_POWER_USERS;
@@ -571,7 +571,7 @@
NULL);
/* Account Operators Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_ACCOUNT_OPS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_ACCOUNT_OPS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_ACCOUNT_OPS;
@@ -584,7 +584,7 @@
NULL);
/* System Operators Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_SYSTEM_OPS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_SYSTEM_OPS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_SYSTEM_OPS;
@@ -597,7 +597,7 @@
NULL);
/* Print Operators Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_PRINT_OPS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_PRINT_OPS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_PRINT_OPS;
@@ -610,7 +610,7 @@
NULL);
/* Backup Operators Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_BACKUP_OPS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_BACKUP_OPS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_BACKUP_OPS;
@@ -623,7 +623,7 @@
NULL);
/* Replicators Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_REPLICATOR, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_REPLICATOR, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_REPLICATOR;
@@ -636,7 +636,7 @@
NULL);
/* RAS Servers Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_RAS_SERVERS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_RAS_SERVERS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_RAS_SERVERS;
@@ -649,7 +649,7 @@
NULL);
/* Pre-Windows 2000 Compatible Access Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_PREW2KCOMPACCESS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_PREW2KCOMPACCESS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_PREW2KCOMPACCESS;
@@ -662,7 +662,7 @@
NULL);
/* Remote Desktop Users Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_REMOTE_DESKTOP_USERS, szAccountName, 80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_REMOTE_DESKTOP_USERS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS;
@@ -675,7 +675,7 @@
NULL);
/* Network Configuration Operators Alias Sid */
- LsapLoadString(hInstance, IDS_ALIAS_RID_NETWORK_CONFIGURATION_OPS, szAccountName,
80);
+ LsapLoadString(hInstance, IDS_ALIAS_RID_NETWORK_CONFIGURATION_OPS, szAccountName,
ARRAYSIZE(szAccountName));
SubAuthorities[0] = SECURITY_BUILTIN_DOMAIN_RID;
SubAuthorities[1] = DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS;