1 /* $Id: misc.c,v 1.34 2004/12/14 22:11:16 weiden Exp $
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 MapGenericMask(PDWORD AccessMask
,
343 PGENERIC_MAPPING GenericMapping
)
345 RtlMapGenericMask(AccessMask
,
354 ImpersonateLoggedOnUser(HANDLE hToken
)
356 SECURITY_QUALITY_OF_SERVICE Qos
;
357 OBJECT_ATTRIBUTES ObjectAttributes
;
364 /* Get the token type */
365 Status
= NtQueryInformationToken (hToken
,
370 if (!NT_SUCCESS(Status
))
372 SetLastError (RtlNtStatusToDosError (Status
));
376 if (Type
== TokenPrimary
)
378 /* Create a duplicate impersonation token */
379 Qos
.Length
= sizeof(SECURITY_QUALITY_OF_SERVICE
);
380 Qos
.ImpersonationLevel
= SecurityImpersonation
;
381 Qos
.ContextTrackingMode
= SECURITY_DYNAMIC_TRACKING
;
382 Qos
.EffectiveOnly
= FALSE
;
384 ObjectAttributes
.Length
= sizeof(OBJECT_ATTRIBUTES
);
385 ObjectAttributes
.RootDirectory
= NULL
;
386 ObjectAttributes
.ObjectName
= NULL
;
387 ObjectAttributes
.Attributes
= 0;
388 ObjectAttributes
.SecurityDescriptor
= NULL
;
389 ObjectAttributes
.SecurityQualityOfService
= &Qos
;
391 Status
= NtDuplicateToken (hToken
,
392 TOKEN_IMPERSONATE
| TOKEN_QUERY
,
397 if (!NT_SUCCESS(Status
))
399 SetLastError (RtlNtStatusToDosError (Status
));
407 /* User the original impersonation token */
412 /* Impersonate the the current thread */
413 Status
= NtSetInformationThread (NtCurrentThread (),
414 ThreadImpersonationToken
,
418 if (Duplicated
== TRUE
)
423 if (!NT_SUCCESS(Status
))
425 SetLastError (RtlNtStatusToDosError (Status
));
437 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
)
441 Status
= RtlImpersonateSelf(ImpersonationLevel
);
442 if (!NT_SUCCESS(Status
))
444 SetLastError(RtlNtStatusToDosError(Status
));
460 Status
= NtSetInformationThread(NtCurrentThread(),
461 ThreadImpersonationToken
,
464 if (!NT_SUCCESS(Status
))
466 SetLastError(RtlNtStatusToDosError(Status
));
473 /******************************************************************************
474 * GetUserNameA [ADVAPI32.@]
476 * Get the current user name.
479 * lpszName [O] Destination for the user name.
480 * lpSize [I/O] Size of lpszName.
486 GetUserNameA( LPSTR lpszName
, LPDWORD lpSize
)
488 UNICODE_STRING NameW
;
492 /* apparently Win doesn't check whether lpSize is valid at all! */
495 NameW
.MaximumLength
= (*lpSize
) * sizeof(WCHAR
);
496 NameW
.Buffer
= LocalAlloc(LMEM_FIXED
, NameW
.MaximumLength
);
497 if(NameW
.Buffer
== NULL
)
499 SetLastError(ERROR_NOT_ENOUGH_MEMORY
);
504 NameA
.MaximumLength
= ((*lpSize
) < 0xFFFF ? (USHORT
)(*lpSize
) : 0xFFFF);
505 NameA
.Buffer
= lpszName
;
507 Ret
= GetUserNameW(NameW
.Buffer
,
511 RtlUnicodeStringToAnsiString(&NameA
, &NameW
, FALSE
);
512 NameA
.Buffer
[NameA
.Length
] = '\0';
514 *lpSize
= NameA
.Length
+ 1;
517 LocalFree(NameW
.Buffer
);
522 /******************************************************************************
523 * GetUserNameW [ADVAPI32.@]
530 GetUserNameW ( LPWSTR lpszName
, LPDWORD lpSize
)
532 HANDLE hToken
= INVALID_HANDLE_VALUE
;
535 TOKEN_USER
* token_user
= NULL
;
537 SID_NAME_USE snu
= SidTypeUser
;
538 WCHAR
* domain_name
= NULL
;
541 if ( !OpenThreadToken ( GetCurrentThread(), TOKEN_QUERY
, FALSE
, &hToken
) )
543 DWORD dwLastError
= GetLastError();
544 if ( dwLastError
!= ERROR_NO_TOKEN
545 && dwLastError
!= ERROR_NO_IMPERSONATION_TOKEN
)
547 /* don't call SetLastError(),
548 as OpenThreadToken() ought to have set one */
551 if ( !OpenProcessToken ( GetCurrentProcess(), TOKEN_QUERY
, &hToken
) )
553 /* don't call SetLastError(),
554 as OpenProcessToken() ought to have set one */
558 tu_buf
= LocalAlloc ( LMEM_FIXED
, 36 );
561 SetLastError ( ERROR_NOT_ENOUGH_MEMORY
);
564 if ( !GetTokenInformation ( hToken
, TokenUser
, tu_buf
, 36, &tu_len
) || tu_len
> 36 )
566 LocalFree ( tu_buf
);
567 tu_buf
= LocalAlloc ( LMEM_FIXED
, tu_len
);
570 SetLastError ( ERROR_NOT_ENOUGH_MEMORY
);
573 if ( !GetTokenInformation ( hToken
, TokenUser
, tu_buf
, tu_len
, &tu_len
) )
575 /* don't call SetLastError(),
576 as GetTokenInformation() ought to have set one */
577 LocalFree ( tu_buf
);
578 CloseHandle ( hToken
);
582 token_user
= (TOKEN_USER
*)tu_buf
;
586 domain_name
= LocalAlloc ( LMEM_FIXED
, dn_len
* sizeof(WCHAR
) );
589 LocalFree ( tu_buf
);
590 SetLastError ( ERROR_NOT_ENOUGH_MEMORY
);
593 if ( !LookupAccountSidW ( NULL
, token_user
->User
.Sid
, lpszName
, &an_len
, domain_name
, &dn_len
, &snu
)
598 LocalFree ( domain_name
);
599 domain_name
= LocalAlloc ( LMEM_FIXED
, dn_len
* sizeof(WCHAR
) );
602 LocalFree ( tu_buf
);
603 SetLastError ( ERROR_NOT_ENOUGH_MEMORY
);
607 if ( !LookupAccountSidW ( NULL
, token_user
->User
.Sid
, lpszName
, &an_len
, domain_name
, &dn_len
, &snu
) )
609 /* don't call SetLastError(),
610 as LookupAccountSid() ought to have set one */
611 LocalFree ( domain_name
);
612 CloseHandle ( hToken
);
617 LocalFree ( domain_name
);
618 LocalFree ( tu_buf
);
619 CloseHandle ( hToken
);
621 if ( an_len
> *lpSize
)
624 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
632 /******************************************************************************
633 * LookupAccountSidA [ADVAPI32.@]
638 LookupAccountSidA (LPCSTR lpSystemName
,
642 LPSTR lpReferencedDomainName
,
643 LPDWORD cchReferencedDomainName
,
646 UNICODE_STRING NameW
, ReferencedDomainNameW
, SystemNameW
;
647 DWORD szName
, szReferencedDomainName
;
651 * save the buffer sizes the caller passed to us, as they may get modified and
652 * we require the original values when converting back to ansi
655 szReferencedDomainName
= *cchReferencedDomainName
;
658 * allocate buffers for the unicode strings to receive
664 NameW
.MaximumLength
= szName
* sizeof(WCHAR
);
665 NameW
.Buffer
= (PWSTR
)LocalAlloc(LMEM_FIXED
, NameW
.MaximumLength
);
666 if(NameW
.Buffer
== NULL
)
668 SetLastError(ERROR_OUTOFMEMORY
);
675 if(szReferencedDomainName
> 0)
677 ReferencedDomainNameW
.Length
= 0;
678 ReferencedDomainNameW
.MaximumLength
= szReferencedDomainName
* sizeof(WCHAR
);
679 ReferencedDomainNameW
.Buffer
= (PWSTR
)LocalAlloc(LMEM_FIXED
, ReferencedDomainNameW
.MaximumLength
);
680 if(ReferencedDomainNameW
.Buffer
== NULL
)
684 LocalFree(NameW
.Buffer
);
686 SetLastError(ERROR_OUTOFMEMORY
);
691 ReferencedDomainNameW
.Buffer
= NULL
;
694 * convert the system name to unicode - if present
697 if(lpSystemName
!= NULL
)
699 ANSI_STRING SystemNameA
;
701 RtlInitAnsiString(&SystemNameA
, lpSystemName
);
702 RtlAnsiStringToUnicodeString(&SystemNameW
, &SystemNameA
, TRUE
);
705 SystemNameW
.Buffer
= NULL
;
708 * it's time to call the unicode version
711 Ret
= LookupAccountSidW(SystemNameW
.Buffer
,
715 ReferencedDomainNameW
.Buffer
,
716 cchReferencedDomainName
,
721 * convert unicode strings back to ansi, don't forget that we can't convert
722 * more than 0xFFFF (USHORT) characters! Also don't forget to explicitly
723 * terminate the converted string, the Rtl functions don't do that!
730 NameA
.MaximumLength
= ((szName
<= 0xFFFF) ? (USHORT
)szName
: 0xFFFF);
731 NameA
.Buffer
= lpName
;
733 RtlUnicodeStringToAnsiString(&NameA
, &NameW
, FALSE
);
734 NameA
.Buffer
[NameA
.Length
] = '\0';
737 if(lpReferencedDomainName
!= NULL
)
739 ANSI_STRING ReferencedDomainNameA
;
741 ReferencedDomainNameA
.Length
= 0;
742 ReferencedDomainNameA
.MaximumLength
= ((szReferencedDomainName
<= 0xFFFF) ?
743 (USHORT
)szReferencedDomainName
: 0xFFFF);
744 ReferencedDomainNameA
.Buffer
= lpReferencedDomainName
;
746 RtlUnicodeStringToAnsiString(&ReferencedDomainNameA
, &ReferencedDomainNameW
, FALSE
);
747 ReferencedDomainNameA
.Buffer
[ReferencedDomainNameA
.Length
] = '\0';
752 * free previously allocated buffers
755 if(SystemNameW
.Buffer
!= NULL
)
757 RtlFreeUnicodeString(&SystemNameW
);
759 if(NameW
.Buffer
!= NULL
)
761 LocalFree(NameW
.Buffer
);
763 if(ReferencedDomainNameW
.Buffer
!= NULL
)
765 LocalFree(ReferencedDomainNameW
.Buffer
);
772 /******************************************************************************
773 * LookupAccountSidW [ADVAPI32.@]
782 LPDWORD pdwAccountName
,
784 LPDWORD pdwDomainName
,
785 PSID_NAME_USE peUse
)
787 LSA_UNICODE_STRING SystemName
;
788 LSA_OBJECT_ATTRIBUTES ObjectAttributes
;
789 LSA_HANDLE PolicyHandle
= INVALID_HANDLE_VALUE
;
791 PLSA_REFERENCED_DOMAIN_LIST ReferencedDomain
= NULL
;
792 PLSA_TRANSLATED_NAME TranslatedName
= NULL
;
795 RtlInitUnicodeString ( &SystemName
, pSystemName
);
796 ZeroMemory(&ObjectAttributes
, sizeof(ObjectAttributes
));
797 Status
= LsaOpenPolicy ( &SystemName
, &ObjectAttributes
, POLICY_LOOKUP_NAMES
, &PolicyHandle
);
798 if ( !NT_SUCCESS(Status
) )
800 SetLastError ( LsaNtStatusToWinError(Status
) );
803 Status
= LsaLookupSids ( PolicyHandle
, 1, &pSid
, &ReferencedDomain
, &TranslatedName
);
805 LsaClose ( PolicyHandle
);
807 if ( !NT_SUCCESS(Status
) || Status
== STATUS_SOME_NOT_MAPPED
)
809 SetLastError ( LsaNtStatusToWinError(Status
) );
815 if ( TranslatedName
)
817 DWORD dwSrcLen
= TranslatedName
->Name
.Length
/ sizeof(WCHAR
);
818 if ( *pdwAccountName
<= dwSrcLen
)
820 *pdwAccountName
= dwSrcLen
+ 1;
825 *pdwAccountName
= dwSrcLen
;
826 wcscpy ( pAccountName
, TranslatedName
->Name
.Buffer
);
829 *peUse
= TranslatedName
->Use
;
832 if ( ReferencedDomain
)
834 if ( ReferencedDomain
->Entries
> 0 )
836 DWORD dwSrcLen
= ReferencedDomain
->Domains
[0].Name
.Length
/ sizeof(WCHAR
);
837 if ( *pdwDomainName
<= dwSrcLen
)
839 *pdwDomainName
= dwSrcLen
+ 1;
844 *pdwDomainName
= dwSrcLen
;
845 wcscpy ( pDomainName
, ReferencedDomain
->Domains
[0].Name
.Buffer
);
851 SetLastError(ERROR_INSUFFICIENT_BUFFER
);
854 if ( ReferencedDomain
)
855 LsaFreeMemory ( ReferencedDomain
);
856 if ( TranslatedName
)
857 LsaFreeMemory ( TranslatedName
);
864 /******************************************************************************
865 * LookupAccountNameA [ADVAPI32.@]
870 LookupAccountNameA (LPCSTR SystemName
,
874 LPSTR ReferencedDomainName
,
875 LPDWORD hReferencedDomainNameLength
,
876 PSID_NAME_USE SidNameUse
)
878 DPRINT1("LookupAccountNameA is unimplemented\n");
879 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
884 /******************************************************************************
885 * LookupAccountNameW [ADVAPI32.@]
890 LookupAccountNameW (LPCWSTR SystemName
,
894 LPWSTR ReferencedDomainName
,
895 LPDWORD hReferencedDomainNameLength
,
896 PSID_NAME_USE SidNameUse
)
898 DPRINT1("LookupAccountNameW is unimplemented\n");
899 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
904 /**********************************************************************
905 * LookupPrivilegeValueA EXPORTED
910 LookupPrivilegeValueA (LPCSTR lpSystemName
,
914 UNICODE_STRING SystemName
;
919 if (lpSystemName
!= NULL
)
921 RtlCreateUnicodeStringFromAsciiz (&SystemName
,
922 (LPSTR
)lpSystemName
);
925 /* Check the privilege name is not NULL */
928 SetLastError (ERROR_INVALID_PARAMETER
);
932 RtlCreateUnicodeStringFromAsciiz (&Name
,
935 Result
= LookupPrivilegeValueW ((lpSystemName
!= NULL
) ? SystemName
.Buffer
: NULL
,
939 RtlFreeUnicodeString (&Name
);
942 if (lpSystemName
!= NULL
)
944 RtlFreeUnicodeString (&SystemName
);
951 /**********************************************************************
952 * LookupPrivilegeValueW EXPORTED
957 LookupPrivilegeValueW (LPCWSTR SystemName
,
961 static const WCHAR
* const DefaultPrivNames
[] =
963 L
"SeCreateTokenPrivilege",
964 L
"SeAssignPrimaryTokenPrivilege",
965 L
"SeLockMemoryPrivilege",
966 L
"SeIncreaseQuotaPrivilege",
967 L
"SeUnsolicitedInputPrivilege",
968 L
"SeMachineAccountPrivilege",
970 L
"SeSecurityPrivilege",
971 L
"SeTakeOwnershipPrivilege",
972 L
"SeLoadDriverPrivilege",
973 L
"SeSystemProfilePrivilege",
974 L
"SeSystemtimePrivilege",
975 L
"SeProfileSingleProcessPrivilege",
976 L
"SeIncreaseBasePriorityPrivilege",
977 L
"SeCreatePagefilePrivilege",
978 L
"SeCreatePermanentPrivilege",
979 L
"SeBackupPrivilege",
980 L
"SeRestorePrivilege",
981 L
"SeShutdownPrivilege",
984 L
"SeSystemEnvironmentPrivilege",
985 L
"SeChangeNotifyPrivilege",
986 L
"SeRemoteShutdownPrivilege",
987 L
"SeUndockPrivilege",
988 L
"SeSyncAgentPrivilege",
989 L
"SeEnableDelegationPrivilege",
990 L
"SeManageVolumePrivilege",
991 L
"SeImpersonatePrivilege",
992 L
"SeCreateGlobalPrivilege"
996 if (NULL
!= SystemName
&& L
'\0' != *SystemName
)
998 DPRINT1("LookupPrivilegeValueW: not implemented for remote system\n");
999 SetLastError(ERROR_CALL_NOT_IMPLEMENTED
);
1003 for (Priv
= 0; Priv
< sizeof(DefaultPrivNames
) / sizeof(DefaultPrivNames
[0]); Priv
++)
1005 if (0 == wcscmp(PrivName
, DefaultPrivNames
[Priv
]))
1007 Luid
->LowPart
= Priv
+ 1;
1013 DPRINT1("LookupPrivilegeValueW: no such privilege %S\n", PrivName
);
1014 SetLastError(ERROR_NO_SUCH_PRIVILEGE
);
1019 /**********************************************************************
1020 * LookupPrivilegeDisplayNameA EXPORTED
1025 LookupPrivilegeDisplayNameA (LPCSTR lpSystemName
,
1027 LPSTR lpDisplayName
,
1028 LPDWORD cbDisplayName
,
1029 LPDWORD lpLanguageId
)
1031 DPRINT1("LookupPrivilegeDisplayNameA: stub\n");
1032 SetLastError (ERROR_CALL_NOT_IMPLEMENTED
);
1037 /**********************************************************************
1038 * LookupPrivilegeDisplayNameW EXPORTED
1043 LookupPrivilegeDisplayNameW (LPCWSTR lpSystemName
,
1045 LPWSTR lpDisplayName
,
1046 LPDWORD cbDisplayName
,
1047 LPDWORD lpLanguageId
)
1049 DPRINT1("LookupPrivilegeDisplayNameW: stub\n");
1050 SetLastError (ERROR_CALL_NOT_IMPLEMENTED
);
1055 /**********************************************************************
1056 * LookupPrivilegeNameA EXPORTED
1061 LookupPrivilegeNameA (LPCSTR lpSystemName
,
1066 DPRINT1("LookupPrivilegeNameA: stub\n");
1067 SetLastError (ERROR_CALL_NOT_IMPLEMENTED
);
1072 /**********************************************************************
1073 * LookupPrivilegeNameW EXPORTED
1078 LookupPrivilegeNameW (LPCWSTR lpSystemName
,
1083 DPRINT1("LookupPrivilegeNameW: stub\n");
1084 SetLastError (ERROR_CALL_NOT_IMPLEMENTED
);
1089 /**********************************************************************
1090 * GetNamedSecurityInfoW EXPORTED
1095 GetNamedSecurityInfoW(LPWSTR pObjectName
,
1096 SE_OBJECT_TYPE ObjectType
,
1097 SECURITY_INFORMATION SecurityInfo
,
1102 PSECURITY_DESCRIPTOR
*ppSecurityDescriptor
)
1104 DPRINT1("GetNamedSecurityInfoW: stub\n");
1105 return ERROR_CALL_NOT_IMPLEMENTED
;
1109 /**********************************************************************
1110 * GetNamedSecurityInfoA EXPORTED
1115 GetNamedSecurityInfoA(LPSTR pObjectName
,
1116 SE_OBJECT_TYPE ObjectType
,
1117 SECURITY_INFORMATION SecurityInfo
,
1122 PSECURITY_DESCRIPTOR
*ppSecurityDescriptor
)
1124 DPRINT1("GetNamedSecurityInfoA: stub\n");
1125 return ERROR_CALL_NOT_IMPLEMENTED
;
1129 /**********************************************************************
1130 * SetNamedSecurityInfoW EXPORTED
1135 SetNamedSecurityInfoW(LPWSTR pObjectName
,
1136 SE_OBJECT_TYPE ObjectType
,
1137 SECURITY_INFORMATION SecurityInfo
,
1143 DPRINT1("SetNamedSecurityInfoW: stub\n");
1144 return ERROR_CALL_NOT_IMPLEMENTED
;
1148 /**********************************************************************
1149 * SetNamedSecurityInfoA EXPORTED
1154 SetNamedSecurityInfoA(LPSTR pObjectName
,
1155 SE_OBJECT_TYPE ObjectType
,
1156 SECURITY_INFORMATION SecurityInfo
,
1162 DPRINT1("SetNamedSecurityInfoA: stub\n");
1163 return ERROR_CALL_NOT_IMPLEMENTED
;
1167 /**********************************************************************
1168 * GetSecurityInfo EXPORTED
1173 GetSecurityInfo(HANDLE handle
,
1174 SE_OBJECT_TYPE ObjectType
,
1175 SECURITY_INFORMATION SecurityInfo
,
1180 PSECURITY_DESCRIPTOR
* ppSecurityDescriptor
)
1182 DPRINT1("GetSecurityInfo: stub\n");
1183 return ERROR_CALL_NOT_IMPLEMENTED
;
1187 /**********************************************************************
1188 * SetSecurityInfo EXPORTED
1194 SetSecurityInfo(HANDLE handle
,
1195 SE_OBJECT_TYPE ObjectType
,
1196 SECURITY_INFORMATION SecurityInfo
,
1202 DPRINT1("SetSecurityInfo: stub\n");
1203 return ERROR_CALL_NOT_IMPLEMENTED
;
1207 /******************************************************************************
1208 * GetSecurityInfoExW EXPORTED
1210 DWORD WINAPI
GetSecurityInfoExA(
1212 SE_OBJECT_TYPE ObjectType
,
1213 SECURITY_INFORMATION SecurityInfo
,
1216 PACTRL_ACCESSA
*ppAccessList
,
1217 PACTRL_AUDITA
*ppAuditList
,
1222 DPRINT1("GetSecurityInfoExA stub!\n");
1223 return ERROR_BAD_PROVIDER
;
1227 /******************************************************************************
1228 * GetSecurityInfoExW EXPORTED
1230 DWORD WINAPI
GetSecurityInfoExW(
1232 SE_OBJECT_TYPE ObjectType
,
1233 SECURITY_INFORMATION SecurityInfo
,
1236 PACTRL_ACCESSW
*ppAccessList
,
1237 PACTRL_AUDITW
*ppAuditList
,
1242 DPRINT1("GetSecurityInfoExW stub!\n");
1243 return ERROR_BAD_PROVIDER
;
1247 /**********************************************************************
1248 * ImpersonateNamedPipeClient EXPORTED
1253 ImpersonateNamedPipeClient(HANDLE hNamedPipe
)
1255 IO_STATUS_BLOCK StatusBlock
;
1258 DPRINT("ImpersonateNamedPipeClient() called\n");
1260 Status
= NtFsControlFile(hNamedPipe
,
1265 FSCTL_PIPE_IMPERSONATE
,
1270 if (!NT_SUCCESS(Status
))
1272 SetLastError(RtlNtStatusToDosError(Status
));