3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS system libraries
5 * FILE: lib/advapi32/sec/misc.c
6 * PURPOSE: Miscellaneous security functions
22 AreAllAccessesGranted(DWORD GrantedAccess
,
25 return((BOOL
)RtlAreAllAccessesGranted(GrantedAccess
,
34 AreAnyAccessesGranted(DWORD GrantedAccess
,
37 return((BOOL
)RtlAreAnyAccessesGranted(GrantedAccess
,
42 /******************************************************************************
43 * GetFileSecurityA [ADVAPI32.@]
45 * Obtains Specified information about the security of a file or directory.
48 * lpFileName [I] Name of the file to get info for
49 * RequestedInformation [I] SE_ flags from "winnt.h"
50 * pSecurityDescriptor [O] Destination for security information
51 * nLength [I] Length of pSecurityDescriptor
52 * lpnLengthNeeded [O] Destination for length of returned security information
55 * Success: TRUE. pSecurityDescriptor contains the requested information.
56 * Failure: FALSE. lpnLengthNeeded contains the required space to return the info.
59 * The information returned is constrained by the callers access rights and
65 GetFileSecurityA(LPCSTR lpFileName
,
66 SECURITY_INFORMATION RequestedInformation
,
67 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
69 LPDWORD lpnLengthNeeded
)
71 UNICODE_STRING FileName
;
75 Status
= RtlCreateUnicodeStringFromAsciiz(&FileName
,
77 if (!NT_SUCCESS(Status
))
79 SetLastError(RtlNtStatusToDosError(Status
));
83 bResult
= GetFileSecurityW(FileName
.Buffer
,
89 RtlFreeUnicodeString(&FileName
);
99 GetFileSecurityW(LPCWSTR lpFileName
,
100 SECURITY_INFORMATION RequestedInformation
,
101 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
103 LPDWORD lpnLengthNeeded
)
105 OBJECT_ATTRIBUTES ObjectAttributes
;
106 IO_STATUS_BLOCK StatusBlock
;
107 UNICODE_STRING FileName
;
108 ULONG AccessMask
= 0;
112 DPRINT("GetFileSecurityW() called\n");
114 if (RequestedInformation
&
115 (OWNER_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| DACL_SECURITY_INFORMATION
))
117 AccessMask
|= STANDARD_RIGHTS_READ
;
120 if (RequestedInformation
& SACL_SECURITY_INFORMATION
)
122 AccessMask
|= ACCESS_SYSTEM_SECURITY
;
125 if (!RtlDosPathNameToNtPathName_U((LPWSTR
)lpFileName
,
130 DPRINT("Invalid path\n");
131 SetLastError(ERROR_INVALID_NAME
);
135 InitializeObjectAttributes(&ObjectAttributes
,
137 OBJ_CASE_INSENSITIVE
,
141 Status
= NtOpenFile(&FileHandle
,
145 FILE_SHARE_READ
| FILE_SHARE_WRITE
| FILE_SHARE_DELETE
,
147 if (!NT_SUCCESS(Status
))
149 DPRINT("NtOpenFile() failed (Status %lx)\n", Status
);
150 SetLastError(RtlNtStatusToDosError(Status
));
154 RtlFreeUnicodeString(&FileName
);
156 Status
= NtQuerySecurityObject(FileHandle
,
157 RequestedInformation
,
163 if (!NT_SUCCESS(Status
))
165 DPRINT("NtQuerySecurityObject() failed (Status %lx)\n", Status
);
166 SetLastError(RtlNtStatusToDosError(Status
));
178 GetKernelObjectSecurity(HANDLE Handle
,
179 SECURITY_INFORMATION RequestedInformation
,
180 PSECURITY_DESCRIPTOR pSecurityDescriptor
,
182 LPDWORD lpnLengthNeeded
)
186 Status
= NtQuerySecurityObject(Handle
,
187 RequestedInformation
,
191 if (!NT_SUCCESS(Status
))
193 SetLastError(RtlNtStatusToDosError(Status
));
200 /******************************************************************************
201 * SetFileSecurityA [ADVAPI32.@]
202 * Sets the security of a file or directory
207 SetFileSecurityA (LPCSTR lpFileName
,
208 SECURITY_INFORMATION SecurityInformation
,
209 PSECURITY_DESCRIPTOR pSecurityDescriptor
)
211 UNICODE_STRING FileName
;
215 Status
= RtlCreateUnicodeStringFromAsciiz(&FileName
,
217 if (!NT_SUCCESS(Status
))
219 SetLastError(RtlNtStatusToDosError(Status
));
223 bResult
= SetFileSecurityW(FileName
.Buffer
,
225 pSecurityDescriptor
);
227 RtlFreeUnicodeString(&FileName
);
233 /******************************************************************************
234 * SetFileSecurityW [ADVAPI32.@]
235 * Sets the security of a file or directory
240 SetFileSecurityW (LPCWSTR lpFileName
,
241 SECURITY_INFORMATION SecurityInformation
,
242 PSECURITY_DESCRIPTOR pSecurityDescriptor
)
244 OBJECT_ATTRIBUTES ObjectAttributes
;
245 IO_STATUS_BLOCK StatusBlock
;
246 UNICODE_STRING FileName
;
247 ULONG AccessMask
= 0;
251 DPRINT("SetFileSecurityW() called\n");
253 if (SecurityInformation
&
254 (OWNER_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
))
256 AccessMask
|= WRITE_OWNER
;
259 if (SecurityInformation
& DACL_SECURITY_INFORMATION
)
261 AccessMask
|= WRITE_DAC
;
264 if (SecurityInformation
& SACL_SECURITY_INFORMATION
)
266 AccessMask
|= ACCESS_SYSTEM_SECURITY
;
269 if (!RtlDosPathNameToNtPathName_U((LPWSTR
)lpFileName
,
274 DPRINT("Invalid path\n");
275 SetLastError(ERROR_INVALID_NAME
);
279 InitializeObjectAttributes(&ObjectAttributes
,
281 OBJ_CASE_INSENSITIVE
,
285 Status
= NtOpenFile(&FileHandle
,
289 FILE_SHARE_READ
| FILE_SHARE_WRITE
| FILE_SHARE_DELETE
,
291 if (!NT_SUCCESS(Status
))
293 DPRINT("NtOpenFile() failed (Status %lx)\n", Status
);
294 SetLastError(RtlNtStatusToDosError(Status
));
298 RtlFreeUnicodeString(&FileName
);
300 Status
= NtSetSecurityObject(FileHandle
,
302 pSecurityDescriptor
);
305 if (!NT_SUCCESS(Status
))
307 DPRINT("NtSetSecurityObject() failed (Status %lx)\n", Status
);
308 SetLastError(RtlNtStatusToDosError(Status
));
320 SetKernelObjectSecurity(HANDLE Handle
,
321 SECURITY_INFORMATION SecurityInformation
,
322 PSECURITY_DESCRIPTOR SecurityDescriptor
)
326 Status
= NtSetSecurityObject(Handle
,
329 if (!NT_SUCCESS(Status
))
331 SetLastError(RtlNtStatusToDosError(Status
));
342 ImpersonateLoggedOnUser(HANDLE hToken
)
344 SECURITY_QUALITY_OF_SERVICE Qos
;
345 OBJECT_ATTRIBUTES ObjectAttributes
;
352 /* Get the token type */
353 Status
= NtQueryInformationToken (hToken
,
358 if (!NT_SUCCESS(Status
))
360 SetLastError (RtlNtStatusToDosError (Status
));
364 if (Type
== TokenPrimary
)
366 /* Create a duplicate impersonation token */
367 Qos
.Length
= sizeof(SECURITY_QUALITY_OF_SERVICE
);
368 Qos
.ImpersonationLevel
= SecurityImpersonation
;
369 Qos
.ContextTrackingMode
= SECURITY_DYNAMIC_TRACKING
;
370 Qos
.EffectiveOnly
= FALSE
;
372 ObjectAttributes
.Length
= sizeof(OBJECT_ATTRIBUTES
);
373 ObjectAttributes
.RootDirectory
= NULL
;
374 ObjectAttributes
.ObjectName
= NULL
;
375 ObjectAttributes
.Attributes
= 0;
376 ObjectAttributes
.SecurityDescriptor
= NULL
;
377 ObjectAttributes
.SecurityQualityOfService
= &Qos
;
379 Status
= NtDuplicateToken (hToken
,
380 TOKEN_IMPERSONATE
| TOKEN_QUERY
,
385 if (!NT_SUCCESS(Status
))
387 SetLastError (RtlNtStatusToDosError (Status
));
395 /* User the original impersonation token */
400 /* Impersonate the the current thread */
401 Status
= NtSetInformationThread (NtCurrentThread (),
402 ThreadImpersonationToken
,
406 if (Duplicated
== TRUE
)
411 if (!NT_SUCCESS(Status
))
413 SetLastError (RtlNtStatusToDosError (Status
));
425 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
)
429 Status
= RtlImpersonateSelf(ImpersonationLevel
);
430 if (!NT_SUCCESS(Status
))
432 SetLastError(RtlNtStatusToDosError(Status
));
448 Status
= NtSetInformationThread(NtCurrentThread(),
449 ThreadImpersonationToken
,
452 if (!NT_SUCCESS(Status
))
454 SetLastError(RtlNtStatusToDosError(Status
));
461 /******************************************************************************
462 * GetUserNameA [ADVAPI32.@]
464 * Get the current user name.
467 * lpszName [O] Destination for the user name.
468 * lpSize [I/O] Size of lpszName.
474 GetUserNameA( LPSTR lpszName
, LPDWORD lpSize
)
476 UNICODE_STRING NameW
;
480 /* apparently Win doesn't check whether lpSize is valid at all! */
483 NameW
.MaximumLength
= (*lpSize
) * sizeof(WCHAR
);
484 NameW
.Buffer
= LocalAlloc(LMEM_FIXED
, NameW
.MaximumLength
);
485 if(NameW
.Buffer
== NULL
)
487 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
492 NameA
.MaximumLength
= ((*lpSize
) < 0xFFFF ? (USHORT
)(*lpSize
) : 0xFFFF);
493 NameA
.Buffer
= lpszName
;
495 Ret
= GetUserNameW(NameW
.Buffer
,
499 RtlUnicodeStringToAnsiString(&NameA
, &NameW
, FALSE
);
500 NameA
.Buffer
[NameA
.Length
] = '\0';
502 *lpSize
= NameA
.Length
+ 1;
505 LocalFree(NameW
.Buffer
);
510 /******************************************************************************
511 * GetUserNameW [ADVAPI32.@]
518 GetUserNameW ( LPWSTR lpszName
, LPDWORD lpSize
)
520 HANDLE hToken
= INVALID_HANDLE_VALUE
;
523 TOKEN_USER
* token_user
= NULL
;
525 SID_NAME_USE snu
= SidTypeUser
;
526 WCHAR
* domain_name
= NULL
;
529 if ( !OpenThreadToken ( GetCurrentThread(), TOKEN_QUERY
, FALSE
, &hToken
) )
531 DWORD dwLastError
= GetLastError();
532 if ( dwLastError
!= ERROR_NO_TOKEN
533 && dwLastError
!= ERROR_NO_IMPERSONATION_TOKEN
)
535 /* don't call SetLastError(),
536 as OpenThreadToken() ought to have set one */
539 if ( !OpenProcessToken ( GetCurrentProcess(), TOKEN_QUERY
, &hToken
) )
541 /* don't call SetLastError(),
542 as OpenProcessToken() ought to have set one */
546 tu_buf
= LocalAlloc ( LMEM_FIXED
, 36 );
549 SetLastError ( ERROR_NOT_ENOUGH_MEMORY
);
552 if ( !GetTokenInformation ( hToken
, TokenUser
, tu_buf
, 36, &tu_len
) || tu_len
> 36 )
554 LocalFree ( tu_buf
);
555 tu_buf
= LocalAlloc ( LMEM_FIXED
, tu_len
);
558 SetLastError ( ERROR_NOT_ENOUGH_MEMORY
);
561 if ( !GetTokenInformation ( hToken
, TokenUser
, tu_buf
, tu_len
, &tu_len
) )
563 /* don't call SetLastError(),
564 as GetTokenInformation() ought to have set one */
565 LocalFree ( tu_buf
);
566 CloseHandle ( hToken
);
570 token_user
= (TOKEN_USER
*)tu_buf
;
574 domain_name
= LocalAlloc ( LMEM_FIXED
, dn_len
* sizeof(WCHAR
) );
577 LocalFree ( tu_buf
);
578 SetLastError ( ERROR_NOT_ENOUGH_MEMORY
);
581 if ( !LookupAccountSidW ( NULL
, token_user
->User
.Sid
, lpszName
, &an_len
, domain_name
, &dn_len
, &snu
)
586 LocalFree ( domain_name
);
587 domain_name
= LocalAlloc ( LMEM_FIXED
, dn_len
* sizeof(WCHAR
) );
590 LocalFree ( tu_buf
);
591 SetLastError ( ERROR_NOT_ENOUGH_MEMORY
);
595 if ( !LookupAccountSidW ( NULL
, token_user
->User
.Sid
, lpszName
, &an_len
, domain_name
, &dn_len
, &snu
) )
597 /* don't call SetLastError(),
598 as LookupAccountSid() ought to have set one */
599 LocalFree ( domain_name
);
600 CloseHandle ( hToken
);
605 LocalFree ( domain_name
);
606 LocalFree ( tu_buf
);
607 CloseHandle ( hToken
);
609 if ( an_len
> *lpSize
)
612 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
620 /******************************************************************************
621 * LookupAccountSidA [ADVAPI32.@]
626 LookupAccountSidA (LPCSTR lpSystemName
,
630 LPSTR lpReferencedDomainName
,
631 LPDWORD cchReferencedDomainName
,
634 UNICODE_STRING NameW
, ReferencedDomainNameW
, SystemNameW
;
635 DWORD szName
, szReferencedDomainName
;
639 * save the buffer sizes the caller passed to us, as they may get modified and
640 * we require the original values when converting back to ansi
643 szReferencedDomainName
= *cchReferencedDomainName
;
646 * allocate buffers for the unicode strings to receive
652 NameW
.MaximumLength
= szName
* sizeof(WCHAR
);
653 NameW
.Buffer
= (PWSTR
)LocalAlloc(LMEM_FIXED
, NameW
.MaximumLength
);
654 if(NameW
.Buffer
== NULL
)
656 SetLastError(ERROR_OUTOFMEMORY
);
663 if(szReferencedDomainName
> 0)
665 ReferencedDomainNameW
.Length
= 0;
666 ReferencedDomainNameW
.MaximumLength
= szReferencedDomainName
* sizeof(WCHAR
);
667 ReferencedDomainNameW
.Buffer
= (PWSTR
)LocalAlloc(LMEM_FIXED
, ReferencedDomainNameW
.MaximumLength
);
668 if(ReferencedDomainNameW
.Buffer
== NULL
)
672 LocalFree(NameW
.Buffer
);
674 SetLastError(ERROR_OUTOFMEMORY
);
679 ReferencedDomainNameW
.Buffer
= NULL
;
682 * convert the system name to unicode - if present
685 if(lpSystemName
!= NULL
)
687 ANSI_STRING SystemNameA
;
689 RtlInitAnsiString(&SystemNameA
, lpSystemName
);
690 RtlAnsiStringToUnicodeString(&SystemNameW
, &SystemNameA
, TRUE
);
693 SystemNameW
.Buffer
= NULL
;
696 * it's time to call the unicode version
699 Ret
= LookupAccountSidW(SystemNameW
.Buffer
,
703 ReferencedDomainNameW
.Buffer
,
704 cchReferencedDomainName
,
709 * convert unicode strings back to ansi, don't forget that we can't convert
710 * more than 0xFFFF (USHORT) characters! Also don't forget to explicitly
711 * terminate the converted string, the Rtl functions don't do that!
718 NameA
.MaximumLength
= ((szName
<= 0xFFFF) ? (USHORT
)szName
: 0xFFFF);
719 NameA
.Buffer
= lpName
;
721 RtlUnicodeStringToAnsiString(&NameA
, &NameW
, FALSE
);
722 NameA
.Buffer
[NameA
.Length
] = '\0';
725 if(lpReferencedDomainName
!= NULL
)
727 ANSI_STRING ReferencedDomainNameA
;
729 ReferencedDomainNameA
.Length
= 0;
730 ReferencedDomainNameA
.MaximumLength
= ((szReferencedDomainName
<= 0xFFFF) ?
731 (USHORT
)szReferencedDomainName
: 0xFFFF);
732 ReferencedDomainNameA
.Buffer
= lpReferencedDomainName
;
734 RtlUnicodeStringToAnsiString(&ReferencedDomainNameA
, &ReferencedDomainNameW
, FALSE
);
735 ReferencedDomainNameA
.Buffer
[ReferencedDomainNameA
.Length
] = '\0';
740 * free previously allocated buffers
743 if(SystemNameW
.Buffer
!= NULL
)
745 RtlFreeUnicodeString(&SystemNameW
);
747 if(NameW
.Buffer
!= NULL
)
749 LocalFree(NameW
.Buffer
);
751 if(ReferencedDomainNameW
.Buffer
!= NULL
)
753 LocalFree(ReferencedDomainNameW
.Buffer
);
760 /******************************************************************************
761 * LookupAccountSidW [ADVAPI32.@]
770 LPDWORD pdwAccountName
,
772 LPDWORD pdwDomainName
,
773 PSID_NAME_USE peUse
)
775 LSA_UNICODE_STRING SystemName
;
776 LSA_OBJECT_ATTRIBUTES ObjectAttributes
;
777 LSA_HANDLE PolicyHandle
= INVALID_HANDLE_VALUE
;
779 PLSA_REFERENCED_DOMAIN_LIST ReferencedDomain
= NULL
;
780 PLSA_TRANSLATED_NAME TranslatedName
= NULL
;
783 RtlInitUnicodeString ( &SystemName
, pSystemName
);
784 ZeroMemory(&ObjectAttributes
, sizeof(ObjectAttributes
));
785 Status
= LsaOpenPolicy ( &SystemName
, &ObjectAttributes
, POLICY_LOOKUP_NAMES
, &PolicyHandle
);
786 if ( !NT_SUCCESS(Status
) )
788 SetLastError ( LsaNtStatusToWinError(Status
) );
791 Status
= LsaLookupSids ( PolicyHandle
, 1, &pSid
, &ReferencedDomain
, &TranslatedName
);
793 LsaClose ( PolicyHandle
);
795 if ( !NT_SUCCESS(Status
) || Status
== STATUS_SOME_NOT_MAPPED
)
797 SetLastError ( LsaNtStatusToWinError(Status
) );
803 if ( TranslatedName
)
805 DWORD dwSrcLen
= TranslatedName
->Name
.Length
/ sizeof(WCHAR
);
806 if ( *pdwAccountName
<= dwSrcLen
)
808 *pdwAccountName
= dwSrcLen
+ 1;
813 *pdwAccountName
= dwSrcLen
;
814 wcscpy ( pAccountName
, TranslatedName
->Name
.Buffer
);
817 *peUse
= TranslatedName
->Use
;
820 if ( ReferencedDomain
)
822 if ( ReferencedDomain
->Entries
> 0 )
824 DWORD dwSrcLen
= ReferencedDomain
->Domains
[0].Name
.Length
/ sizeof(WCHAR
);
825 if ( *pdwDomainName
<= dwSrcLen
)
827 *pdwDomainName
= dwSrcLen
+ 1;
832 *pdwDomainName
= dwSrcLen
;
833 wcscpy ( pDomainName
, ReferencedDomain
->Domains
[0].Name
.Buffer
);
839 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
842 if ( ReferencedDomain
)
843 LsaFreeMemory ( ReferencedDomain
);
844 if ( TranslatedName
)
845 LsaFreeMemory ( TranslatedName
);
852 /******************************************************************************
853 * LookupAccountNameA [ADVAPI32.@]
858 LookupAccountNameA (LPCSTR SystemName
,
862 LPSTR ReferencedDomainName
,
863 LPDWORD hReferencedDomainNameLength
,
864 PSID_NAME_USE SidNameUse
)
866 DPRINT1("LookupAccountNameA is unimplemented\n");
867 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
872 /******************************************************************************
873 * LookupAccountNameW [ADVAPI32.@]
878 LookupAccountNameW (LPCWSTR SystemName
,
882 LPWSTR ReferencedDomainName
,
883 LPDWORD hReferencedDomainNameLength
,
884 PSID_NAME_USE SidNameUse
)
886 DPRINT1("LookupAccountNameW is unimplemented\n");
887 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
892 /**********************************************************************
893 * LookupPrivilegeValueA EXPORTED
898 LookupPrivilegeValueA (LPCSTR lpSystemName
,
902 UNICODE_STRING SystemName
;
907 if (lpSystemName
!= NULL
)
909 RtlCreateUnicodeStringFromAsciiz (&SystemName
,
910 (LPSTR
)lpSystemName
);
913 /* Check the privilege name is not NULL */
916 SetLastError (ERROR_INVALID_PARAMETER
);
920 RtlCreateUnicodeStringFromAsciiz (&Name
,
923 Result
= LookupPrivilegeValueW ((lpSystemName
!= NULL
) ? SystemName
.Buffer
: NULL
,
927 RtlFreeUnicodeString (&Name
);
930 if (lpSystemName
!= NULL
)
932 RtlFreeUnicodeString (&SystemName
);
939 /**********************************************************************
940 * LookupPrivilegeValueW EXPORTED
945 LookupPrivilegeValueW (LPCWSTR SystemName
,
949 static const WCHAR
* const DefaultPrivNames
[] =
951 L
"SeCreateTokenPrivilege",
952 L
"SeAssignPrimaryTokenPrivilege",
953 L
"SeLockMemoryPrivilege",
954 L
"SeIncreaseQuotaPrivilege",
955 L
"SeUnsolicitedInputPrivilege",
956 L
"SeMachineAccountPrivilege",
958 L
"SeSecurityPrivilege",
959 L
"SeTakeOwnershipPrivilege",
960 L
"SeLoadDriverPrivilege",
961 L
"SeSystemProfilePrivilege",
962 L
"SeSystemtimePrivilege",
963 L
"SeProfileSingleProcessPrivilege",
964 L
"SeIncreaseBasePriorityPrivilege",
965 L
"SeCreatePagefilePrivilege",
966 L
"SeCreatePermanentPrivilege",
967 L
"SeBackupPrivilege",
968 L
"SeRestorePrivilege",
969 L
"SeShutdownPrivilege",
972 L
"SeSystemEnvironmentPrivilege",
973 L
"SeChangeNotifyPrivilege",
974 L
"SeRemoteShutdownPrivilege",
975 L
"SeUndockPrivilege",
976 L
"SeSyncAgentPrivilege",
977 L
"SeEnableDelegationPrivilege",
978 L
"SeManageVolumePrivilege",
979 L
"SeImpersonatePrivilege",
980 L
"SeCreateGlobalPrivilege"
984 if (NULL
!= SystemName
&& L
'\0' != *SystemName
)
986 DPRINT1("LookupPrivilegeValueW: not implemented for remote system\n");
987 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
991 for (Priv
= 0; Priv
< sizeof(DefaultPrivNames
) / sizeof(DefaultPrivNames
[0]); Priv
++)
993 if (0 == wcscmp(PrivName
, DefaultPrivNames
[Priv
]))
995 Luid
->LowPart
= Priv
+ 1;
1001 DPRINT1("LookupPrivilegeValueW: no such privilege %S\n", PrivName
);
1002 SetLastError(ERROR_NO_SUCH_PRIVILEGE
);
1007 /**********************************************************************
1008 * LookupPrivilegeDisplayNameA EXPORTED
1013 LookupPrivilegeDisplayNameA (LPCSTR lpSystemName
,
1015 LPSTR lpDisplayName
,
1016 LPDWORD cbDisplayName
,
1017 LPDWORD lpLanguageId
)
1019 DPRINT1("LookupPrivilegeDisplayNameA: stub\n");
1020 SetLastError (ERROR_CALL_NOT_IMPLEMENTED
);
1025 /**********************************************************************
1026 * LookupPrivilegeDisplayNameW EXPORTED
1031 LookupPrivilegeDisplayNameW (LPCWSTR lpSystemName
,
1033 LPWSTR lpDisplayName
,
1034 LPDWORD cbDisplayName
,
1035 LPDWORD lpLanguageId
)
1037 DPRINT1("LookupPrivilegeDisplayNameW: stub\n");
1038 SetLastError (ERROR_CALL_NOT_IMPLEMENTED
);
1043 /**********************************************************************
1044 * LookupPrivilegeNameA EXPORTED
1049 LookupPrivilegeNameA (LPCSTR lpSystemName
,
1054 DPRINT1("LookupPrivilegeNameA: stub\n");
1055 SetLastError (ERROR_CALL_NOT_IMPLEMENTED
);
1060 /**********************************************************************
1061 * LookupPrivilegeNameW EXPORTED
1066 LookupPrivilegeNameW (LPCWSTR lpSystemName
,
1071 DPRINT1("LookupPrivilegeNameW: stub\n");
1072 SetLastError (ERROR_CALL_NOT_IMPLEMENTED
);
1077 /**********************************************************************
1078 * GetNamedSecurityInfoW EXPORTED
1083 GetNamedSecurityInfoW(LPWSTR pObjectName
,
1084 SE_OBJECT_TYPE ObjectType
,
1085 SECURITY_INFORMATION SecurityInfo
,
1090 PSECURITY_DESCRIPTOR
*ppSecurityDescriptor
)
1092 DPRINT1("GetNamedSecurityInfoW: stub\n");
1093 return ERROR_CALL_NOT_IMPLEMENTED
;
1097 /**********************************************************************
1098 * GetNamedSecurityInfoA EXPORTED
1103 GetNamedSecurityInfoA(LPSTR pObjectName
,
1104 SE_OBJECT_TYPE ObjectType
,
1105 SECURITY_INFORMATION SecurityInfo
,
1110 PSECURITY_DESCRIPTOR
*ppSecurityDescriptor
)
1112 DPRINT1("GetNamedSecurityInfoA: stub\n");
1113 return ERROR_CALL_NOT_IMPLEMENTED
;
1117 /**********************************************************************
1118 * SetNamedSecurityInfoW EXPORTED
1123 SetNamedSecurityInfoW(LPWSTR pObjectName
,
1124 SE_OBJECT_TYPE ObjectType
,
1125 SECURITY_INFORMATION SecurityInfo
,
1131 DPRINT1("SetNamedSecurityInfoW: stub\n");
1132 return ERROR_CALL_NOT_IMPLEMENTED
;
1136 /**********************************************************************
1137 * SetNamedSecurityInfoA EXPORTED
1142 SetNamedSecurityInfoA(LPSTR pObjectName
,
1143 SE_OBJECT_TYPE ObjectType
,
1144 SECURITY_INFORMATION SecurityInfo
,
1150 DPRINT1("SetNamedSecurityInfoA: stub\n");
1151 return ERROR_CALL_NOT_IMPLEMENTED
;
1155 /**********************************************************************
1156 * GetSecurityInfo EXPORTED
1161 GetSecurityInfo(HANDLE handle
,
1162 SE_OBJECT_TYPE ObjectType
,
1163 SECURITY_INFORMATION SecurityInfo
,
1168 PSECURITY_DESCRIPTOR
* ppSecurityDescriptor
)
1170 DPRINT1("GetSecurityInfo: stub\n");
1171 return ERROR_CALL_NOT_IMPLEMENTED
;
1175 /**********************************************************************
1176 * SetSecurityInfo EXPORTED
1182 SetSecurityInfo(HANDLE handle
,
1183 SE_OBJECT_TYPE ObjectType
,
1184 SECURITY_INFORMATION SecurityInfo
,
1190 DPRINT1("SetSecurityInfo: stub\n");
1191 return ERROR_CALL_NOT_IMPLEMENTED
;
1195 /******************************************************************************
1196 * GetSecurityInfoExW EXPORTED
1198 DWORD WINAPI
GetSecurityInfoExA(
1200 SE_OBJECT_TYPE ObjectType
,
1201 SECURITY_INFORMATION SecurityInfo
,
1204 PACTRL_ACCESSA
*ppAccessList
,
1205 PACTRL_AUDITA
*ppAuditList
,
1210 DPRINT1("GetSecurityInfoExA stub!\n");
1211 return ERROR_BAD_PROVIDER
;
1215 /******************************************************************************
1216 * GetSecurityInfoExW EXPORTED
1218 DWORD WINAPI
GetSecurityInfoExW(
1220 SE_OBJECT_TYPE ObjectType
,
1221 SECURITY_INFORMATION SecurityInfo
,
1224 PACTRL_ACCESSW
*ppAccessList
,
1225 PACTRL_AUDITW
*ppAuditList
,
1230 DPRINT1("GetSecurityInfoExW stub!\n");
1231 return ERROR_BAD_PROVIDER
;
1235 /**********************************************************************
1236 * ImpersonateNamedPipeClient EXPORTED
1241 ImpersonateNamedPipeClient(HANDLE hNamedPipe
)
1243 IO_STATUS_BLOCK StatusBlock
;
1246 DPRINT("ImpersonateNamedPipeClient() called\n");
1248 Status
= NtFsControlFile(hNamedPipe
,
1253 FSCTL_PIPE_IMPERSONATE
,
1258 if (!NT_SUCCESS(Status
))
1260 SetLastError(RtlNtStatusToDosError(Status
));