summaryrefslogtreecommitdiffstats
path: root/private/lsa/msprivs
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/lsa/msprivs
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/lsa/msprivs')
-rw-r--r--private/lsa/msprivs/makefile6
-rw-r--r--private/lsa/msprivs/mspr_rev.rc11
-rw-r--r--private/lsa/msprivs/msprivs.def7
-rw-r--r--private/lsa/msprivs/msprivs.xlsbin0 -> 32256 bytes
-rw-r--r--private/lsa/msprivs/msprivs2.rcbin0 -> 71929 bytes
-rw-r--r--private/lsa/msprivs/mstmp.c58
-rw-r--r--private/lsa/msprivs/sources67
-rw-r--r--private/lsa/msprivs/tprivs.c581
8 files changed, 730 insertions, 0 deletions
diff --git a/private/lsa/msprivs/makefile b/private/lsa/msprivs/makefile
new file mode 100644
index 000000000..6ee4f43fa
--- /dev/null
+++ b/private/lsa/msprivs/makefile
@@ -0,0 +1,6 @@
+#
+# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
+# file to this component. This file merely indirects to the real make file
+# that is shared by all the components of NT OS/2
+#
+!INCLUDE $(NTMAKEENV)\makefile.def
diff --git a/private/lsa/msprivs/mspr_rev.rc b/private/lsa/msprivs/mspr_rev.rc
new file mode 100644
index 000000000..1d3ea70fa
--- /dev/null
+++ b/private/lsa/msprivs/mspr_rev.rc
@@ -0,0 +1,11 @@
+#include <windows.h>
+#include <ntverp.h>
+
+#define VER_FILETYPE VFT_DLL
+#define VER_FILESUBTYPE VFT2_UNKNOWN
+#define VER_FILEDESCRIPTION_STR "Microsoft Privilege Translations"
+#define VER_INTERNALNAME_STR "mspriv.dll"
+
+#include "common.ver"
+RCINCLUDE msprivs2.rc
+
diff --git a/private/lsa/msprivs/msprivs.def b/private/lsa/msprivs/msprivs.def
new file mode 100644
index 000000000..f83f63ca1
--- /dev/null
+++ b/private/lsa/msprivs/msprivs.def
@@ -0,0 +1,7 @@
+LIBRARY msprivs
+
+DESCRIPTION 'Displayable Privilege Names For Microsoft Defined Privileges'
+
+EXPORTS
+ MsPrivsDummyEntry
+
diff --git a/private/lsa/msprivs/msprivs.xls b/private/lsa/msprivs/msprivs.xls
new file mode 100644
index 000000000..0f34d8d0c
--- /dev/null
+++ b/private/lsa/msprivs/msprivs.xls
Binary files differ
diff --git a/private/lsa/msprivs/msprivs2.rc b/private/lsa/msprivs/msprivs2.rc
new file mode 100644
index 000000000..322b4a427
--- /dev/null
+++ b/private/lsa/msprivs/msprivs2.rc
Binary files differ
diff --git a/private/lsa/msprivs/mstmp.c b/private/lsa/msprivs/mstmp.c
new file mode 100644
index 000000000..d3c223ac5
--- /dev/null
+++ b/private/lsa/msprivs/mstmp.c
@@ -0,0 +1,58 @@
+/*++
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ tmp.c
+
+Abstract:
+
+ Temporary (unnecessary) DLL entry point routine.
+
+
+ The entry in this file is a bit of a hack. The code isn't
+ needed, but our linker doesn't know how to build a dll with data only.
+ When MikeOl gets this fixed, we can remove this obligatory source
+ file.
+
+
+Author:
+
+ Jim Kelly 24-Mar-1992
+
+Revision History:
+
+--*/
+
+
+#include <nt.h>
+
+BOOLEAN
+MsPrivsDummyEntry(
+ IN PVOID DllHandle,
+ IN ULONG Reason,
+ IN PCONTEXT Context)
+
+/*++
+
+Routine Description:
+
+ This routine gets called when this DLL is loaded by the loader.
+ It does nothing and wouldn't be needed if the linker worked
+ correctly.
+
+Arguments:
+
+ None.
+
+
+Return Value:
+
+ None.
+
+--*/
+{
+
+ return TRUE;
+}
diff --git a/private/lsa/msprivs/sources b/private/lsa/msprivs/sources
new file mode 100644
index 000000000..d50b0bc38
--- /dev/null
+++ b/private/lsa/msprivs/sources
@@ -0,0 +1,67 @@
+!IF 0
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ sources.
+
+Abstract:
+
+ This file specifies the target component being built and the list of
+ sources files needed to build that component. Also specifies optional
+ compiler switches and libraries that are unique for the component being
+ built.
+
+
+Author:
+
+ Steve Wood (stevewo) 12-Apr-1990
+
+NOTE: Commented description of this file is in \nt\bak\bin\sources.tpl
+
+!ENDIF
+
+MAJORCOMP=lsa
+MINORCOMP=msprivs
+
+TARGETNAME=msprivs
+TARGETPATH=$(BASEDIR)\public\sdk\lib
+
+TARGETLIBS=
+
+TARGETTYPE=DYNLINK
+
+#
+# The following entry information is a bit of a hack. The code isn't
+# needed, but our linker doesn't know how to build a dll with data only.
+# When MikeOl gets this fixed, we can remove the code and this obligatory
+# entry and base information. By the way, the base choice is just one I
+# know isn't used elsewhere in the system.
+#
+
+DLLBASE=@$(BASEDIR)\public\sdk\lib\coffbase.txt,lsaap
+DLLENTRY=MsPrivsDummyEntry
+RCCODEPAGE=1252
+
+
+INCLUDES=.;..\inc;..\..\inc
+
+SOURCES= \
+ mspr_rev.rc \
+ mstmp.c
+
+
+UMRES=obj\*\mspr_rev.res
+
+UMLIBS= \
+ $(BASEDIR)\public\sdk\lib\*\advapi32.lib \
+ $(BASEDIR)\public\sdk\lib\*\rpcutil.lib \
+ $(BASEDIR)\public\sdk\lib\*\rpcrt4.lib \
+ $(BASEDIR)\public\sdk\lib\*\rpcndr.lib \
+ $(BASEDIR)\public\sdk\lib\*\ntdll.lib \
+ $(BASEDIR)\public\sdk\lib\*\advapi32.lib \
+ $(BASEDIR)\Public\Sdk\Lib\*\kernel32.lib
+
+C_DEFINES=-DRPC_NO_WINDOWS_H
+
diff --git a/private/lsa/msprivs/tprivs.c b/private/lsa/msprivs/tprivs.c
new file mode 100644
index 000000000..8e0e90e12
--- /dev/null
+++ b/private/lsa/msprivs/tprivs.c
@@ -0,0 +1,581 @@
+/*++
+
+Copyright (c) 1991 Microsoft Corporation
+
+Module Name:
+
+ tprivs.c
+
+Abstract:
+
+ Test privilege lookup services and ms privilege resource file.
+
+Author:
+
+ Jim Kelly (JimK) 26-Mar-1992
+
+Environment:
+
+Revision History:
+
+--*/
+
+
+#define UNICODE
+
+#include <nt.h>
+#include <ntrtl.h>
+#include <nturtl.h> // needed for winbase.h
+#include <rpc.h> // DataTypes and runtime APIs
+#include <windows.h> // LocalAlloc
+#include <ntlsa.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ntrpcp.h> // prototypes for MIDL user functions
+
+
+
+
+
+#define EQUAL_LUID( L1, L2 ) \
+ ( ((L1)->HighPart == (L2)->HighPart) && \
+ ((L1)->LowPart == (L2)->LowPart) )
+
+
+#define printfLuid( L ) \
+ printf("[%1d, %2d]", (L)->HighPart, (L)->LowPart)
+
+
+
+
+///////////////////////////////////////////////////////////////////////////
+// //
+// //
+// Module-wide data types //
+// //
+// //
+///////////////////////////////////////////////////////////////////////////
+
+
+typedef struct _KNOWN_PRIVILEGE {
+ LUID Luid;
+ UNICODE_STRING ProgrammaticName;
+} KNOWN_PRIVILEGE, *PKNOWN_PRIVILEGE;
+
+typedef struct _TPRIV_LANGUAGE {
+ USHORT Id;
+ PWSTR Name;
+} TPRIV_LANGUAGE, *PTPRIV_LANGUAGE;
+
+
+
+///////////////////////////////////////////////////////////////////////////
+// //
+// //
+// Module-wide variables //
+// //
+// //
+///////////////////////////////////////////////////////////////////////////
+
+//
+// name of target LSA system
+//
+
+PUNICODE_STRING SystemName = NULL;
+
+//
+// Test level
+//
+
+int Level;
+
+//
+// Handle to LSA Policy object
+//
+
+LSA_HANDLE PolicyHandle = NULL;
+
+
+ULONG KnownPrivilegeCount;
+KNOWN_PRIVILEGE KnownPrivilege[SE_MAX_WELL_KNOWN_PRIVILEGE];
+
+
+
+//
+// So that we can test each language
+//
+
+TPRIV_LANGUAGE Language[] = {
+ {MAKELANGID( LANG_ENGLISH, SUBLANG_NEUTRAL ), L"English, Neutral"},
+ {MAKELANGID( LANG_FRENCH, SUBLANG_NEUTRAL ), L"French, Neutral"},
+ {MAKELANGID( LANG_GERMAN, SUBLANG_NEUTRAL ), L"German, Neutral"},
+ {MAKELANGID( LANG_SPANISH, SUBLANG_NEUTRAL ), L"Spanish, Neutral"},
+ {MAKELANGID( LANG_DUTCH, SUBLANG_NEUTRAL ), L"Dutch, Neutral"},
+ {MAKELANGID( LANG_ITALIAN, SUBLANG_NEUTRAL ), L"Italian, Neutral"},
+ {MAKELANGID( LANG_DANISH, SUBLANG_NEUTRAL ), L"Danish, Neutral"},
+ {MAKELANGID( LANG_FINNISH, SUBLANG_NEUTRAL ), L"Finnish, Neutral"},
+ {MAKELANGID( LANG_NORWEGIAN, SUBLANG_NEUTRAL ), L"Norweigian, Neutral"},
+ {MAKELANGID( LANG_SWEDISH, SUBLANG_NEUTRAL ), L"Swedish, Neutral"},
+ {MAKELANGID( LANG_PORTUGUESE, SUBLANG_NEUTRAL ), L"Portuguese, Neutral"},
+ {0, L""} // End of array
+ };
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////
+// //
+// //
+// Routine prototypes //
+// //
+// //
+///////////////////////////////////////////////////////////////////////////
+
+
+
+NTSTATUS
+TestInitialize();
+
+NTSTATUS
+TestPrivilegeLookup();
+
+NTSTATUS
+TestLookupProgramName();
+
+NTSTATUS
+TestLookupDisplayName();
+
+NTSTATUS
+TestLookupValue();
+
+
+
+
+///////////////////////////////////////////////////////////////////////////
+// //
+// //
+// Routines //
+// //
+// //
+///////////////////////////////////////////////////////////////////////////
+
+
+
+
+VOID
+main (argc, argv)
+int argc;
+char **argv;
+
+{
+ ANSI_STRING ServerNameAnsi;
+ UNICODE_STRING SystemNameU;
+ int Index;
+ NTSTATUS Status = STATUS_SUCCESS;
+
+
+ SystemName = NULL;
+
+ if ((argc < 1) || (argc > 2)) {
+
+ printf("Usage: tprivs [\\servername]");
+ return;
+ }
+
+ //
+ // Parse the parameters (if any). Assume that a parameter beginning
+ // \\ is the server name and a parameter beginning -l is the level
+ //
+
+ SystemName = NULL;
+
+ if (argc >= 2) {
+
+ for(Index = 1; Index < argc; Index++) {
+
+ if (strncmp(argv[Index], "\\\\", 2) == 0) {
+
+ //
+ // Looks like an attempt to specify a server name.
+ // Construct a Unicode String containing the specified name
+ //
+
+ RtlInitString(&ServerNameAnsi, argv[Index]);
+ Status = RtlAnsiStringToUnicodeString(
+ &SystemNameU,
+ &ServerNameAnsi,
+ TRUE
+ );
+
+ if (!NT_SUCCESS(Status)) {
+
+ printf(
+ "Failure 0x%lx to convert Server Name to Unicode\n",
+ Status
+ );
+ printf("Test abandoned\n");
+ return;
+ }
+
+ SystemName = &SystemNameU;
+
+ } else {
+
+ printf(
+ "Usage: tprivs [\\ServerName]\n"
+ );
+
+ return;
+ }
+ }
+ }
+
+ printf("TPRIV - Test Beginning\n");
+
+ Status = TestInitialize();
+
+ if (NT_SUCCESS(Status)) {
+ Status = TestPrivilegeLookup();
+ }
+
+ if (NT_SUCCESS(Status)) {
+ printf("\n\nTest Succeeded\n");
+ } else {
+ printf("\n\nTest ** FAILED **\n");
+ }
+
+
+
+ printf("TPRIV - Test End\n");
+}
+
+
+NTSTATUS
+TestInitialize()
+{
+ NTSTATUS Status;
+ OBJECT_ATTRIBUTES ObjectAttributes;
+ LSA_HANDLE ConnectHandle = NULL;
+ SECURITY_QUALITY_OF_SERVICE SecurityQualityOfService;
+
+ //
+ // Set up the Security Quality Of Service
+ //
+
+ SecurityQualityOfService.Length = sizeof(SECURITY_QUALITY_OF_SERVICE);
+ SecurityQualityOfService.ImpersonationLevel = SecurityImpersonation;
+ SecurityQualityOfService.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING;
+ SecurityQualityOfService.EffectiveOnly = FALSE;
+
+ //
+ // Set up the object attributes prior to opening the LSA.
+ //
+
+ InitializeObjectAttributes(&ObjectAttributes,
+ NULL,
+ 0L,
+ (HANDLE)NULL,
+ NULL);
+
+ //
+ //
+ //
+ // The InitializeObjectAttributes macro presently stores NULL for
+ // the SecurityQualityOfService field, so we must manually copy that
+ // structure for now.
+ //
+
+ ObjectAttributes.SecurityQualityOfService = &SecurityQualityOfService;
+
+ //
+ // Open a handle to the LSA.
+ //
+
+ Status = LsaOpenPolicy(SystemName,
+ &ObjectAttributes,
+ GENERIC_EXECUTE,
+ &PolicyHandle
+ );
+
+ if (!NT_SUCCESS(Status)) {
+ printf("TPRIV: LsaOpenPolicy() failed 0x%lx\n", Status);
+ }
+
+
+
+
+ //
+ // Now set up our internal well-known privilege LUID to programmatic name
+ // mapping.
+ //
+
+ {
+ ULONG i;
+
+
+ i=0;
+
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_CREATE_TOKEN_PRIVILEGE);
+// RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_CREATE_TOKEN_NAME) );
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, L"SeCreateTokenPrivilege" );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_ASSIGNPRIMARYTOKEN_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_ASSIGNPRIMARYTOKEN_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_LOCK_MEMORY_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_LOCK_MEMORY_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_INCREASE_QUOTA_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_INCREASE_QUOTA_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_MACHINE_ACCOUNT_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_MACHINE_ACCOUNT_NAME) );
+ i++;
+
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_TCB_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_TCB_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_SECURITY_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_SECURITY_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_TAKE_OWNERSHIP_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_TAKE_OWNERSHIP_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_LOAD_DRIVER_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_LOAD_DRIVER_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_SYSTEM_PROFILE_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_SYSTEM_PROFILE_NAME) );
+ i++;
+
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_SYSTEMTIME_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_SYSTEMTIME_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_PROF_SINGLE_PROCESS_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_PROF_SINGLE_PROCESS_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_INC_BASE_PRIORITY_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_INC_BASE_PRIORITY_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_CREATE_PAGEFILE_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_CREATE_PAGEFILE_NAME) );
+ i++;
+
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_CREATE_PERMANENT_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_CREATE_PERMANENT_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_BACKUP_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_BACKUP_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_RESTORE_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_RESTORE_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_SHUTDOWN_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_SHUTDOWN_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_DEBUG_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_DEBUG_NAME) );
+ i++;
+
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_AUDIT_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_AUDIT_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_SYSTEM_ENVIRONMENT_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_SYSTEM_ENVIRONMENT_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_CHANGE_NOTIFY_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_CHANGE_NOTIFY_NAME) );
+ i++;
+ KnownPrivilege[i].Luid = RtlConvertLongToLargeInteger(SE_REMOTE_SHUTDOWN_PRIVILEGE);
+ RtlInitUnicodeString( &KnownPrivilege[i].ProgrammaticName, (SE_REMOTE_SHUTDOWN_NAME) );
+ i++;
+
+
+ KnownPrivilegeCount = i;
+
+ ASSERT( i == (SE_MAX_WELL_KNOWN_PRIVILEGE - SE_MIN_WELL_KNOWN_PRIVILEGE +1));
+ }
+
+
+
+ return(Status);
+}
+
+
+NTSTATUS
+TestPrivilegeLookup()
+
+{
+
+ NTSTATUS Status;
+
+
+ printf("\n\n");
+
+
+
+
+ printf(" Lookup Local Representation Values . . . . . . . .Suite\n");
+ Status = TestLookupValue();
+ if (!NT_SUCCESS(Status)) {
+ return(Status);
+ }
+
+ printf("\n Lookup Programmatic Privilege Names . . . . . . . .Suite\n");
+ Status = TestLookupProgramName();
+ if (!NT_SUCCESS(Status)) {
+ return(Status);
+ }
+
+ printf("\n Lookup Displayable Names . . . . . . . . . . . . .Suite\n");
+ Status = TestLookupDisplayName();
+ if (!NT_SUCCESS(Status)) {
+ return(Status);
+ }
+
+
+
+ return(Status);
+
+
+
+}
+
+
+NTSTATUS
+TestLookupValue()
+
+{
+ NTSTATUS CompletionStatus = STATUS_SUCCESS;
+ NTSTATUS Status;
+ ULONG i;
+ LUID Luid;
+
+
+ for (i=0; i<KnownPrivilegeCount; i++) {
+
+ printf(" %-32wZ => ", &KnownPrivilege[i].ProgrammaticName);
+ Status = LsaLookupPrivilegeValue(
+ PolicyHandle,
+ &KnownPrivilege[i].ProgrammaticName,
+ &Luid
+ );
+ if (!NT_SUCCESS(Status)) {
+ printf("** FAILED **\n");
+ printf(" Call Status is 0x%lx\n", Status);
+ CompletionStatus = Status;
+ } else {
+ if ( !EQUAL_LUID(&Luid,&KnownPrivilege[i].Luid) ) {
+ printf("** FAILED **\n");
+ printf(" LUID value not expected.\n");
+ printf(" Expected:");
+ printfLuid( (&KnownPrivilege[i].Luid) );
+ printf("\n Received:");
+ printfLuid( (&Luid) );
+ CompletionStatus = STATUS_UNSUCCESSFUL;
+ } else {
+ printfLuid( (&Luid) );
+ printf(" Succeeded\n");
+ }
+ }
+ }
+
+ return(CompletionStatus);
+}
+
+
+
+NTSTATUS
+TestLookupProgramName()
+
+{
+ NTSTATUS CompletionStatus = STATUS_SUCCESS;
+ NTSTATUS Status;
+ ULONG i;
+ PUNICODE_STRING Name;
+ BOOLEAN StringsEqual;
+
+
+ for (i=0; i<KnownPrivilegeCount; i++) {
+
+ printf(" ");
+ printfLuid( (&KnownPrivilege[i].Luid) );
+ printf(" => ");
+ Status = LsaLookupPrivilegeName(
+ PolicyHandle,
+ &KnownPrivilege[i].Luid,
+ &Name
+ );
+ if (!NT_SUCCESS(Status)) {
+ printf("** FAILED **\n");
+ printf(" Status is 0x%lx\n", Status);
+ CompletionStatus = Status;
+ } else {
+ StringsEqual = RtlEqualUnicodeString(
+ Name,
+ &KnownPrivilege[i].ProgrammaticName,
+ TRUE
+ );
+ if( StringsEqual == FALSE ) {
+ printf("** FAILED **\n");
+ printf(" Program Name not expected.\n"
+ " Expected: *%wZ*\n", &KnownPrivilege[i].ProgrammaticName);
+ printf(" Received: *%wZ*", Name);
+ CompletionStatus = STATUS_UNSUCCESSFUL;
+ } else {
+ printf("%-36wZ Succeeded\n", Name);
+ }
+ MIDL_user_free( Name );
+ }
+ }
+ return(CompletionStatus);
+}
+
+
+
+NTSTATUS
+TestLookupDisplayName()
+{
+ NTSTATUS CompletionStatus = STATUS_SUCCESS;
+ NTSTATUS Status;
+ ULONG i, j;
+ PUNICODE_STRING Name;
+ SHORT LanguageReturned;
+ SHORT OriginalLanguage;
+ UNICODE_STRING LanguageName;
+
+ OriginalLanguage = (USHORT)NtCurrentTeb()->CurrentLocale;
+
+ j=0;
+ while (Language[j].Id != 0) {
+ RtlInitUnicodeString( &LanguageName, Language[j].Name );
+ printf(" %wZ\n", &LanguageName);
+
+ for (i=0; i<KnownPrivilegeCount; i++) {
+
+ printf(" %-32wZ => ", &KnownPrivilege[i].ProgrammaticName);
+
+ NtCurrentTeb()->CurrentLocale = Language[j].Id;
+ Status = LsaLookupPrivilegeDisplayName(
+ PolicyHandle,
+ &KnownPrivilege[i].ProgrammaticName,
+ &Name,
+ &LanguageReturned
+ );
+ NtCurrentTeb()->CurrentLocale = OriginalLanguage;
+ if (!NT_SUCCESS(Status)) {
+ printf("** FAILED **\n");
+ printf(" Status is 0x%lx\n", Status);
+ CompletionStatus = Status;
+ } else {
+ printf(" %-45wZ\n", Name);
+ MIDL_user_free( Name );
+ }
+ }
+ printf("\n");
+ j++;
+ }
+ return(CompletionStatus);
+}