Implement SetFileSecurityA/W.
[reactos.git] / reactos / lib / advapi32 / sec / misc.c
1 /* $Id: misc.c,v 1.24 2004/09/08 11:36:24 ekohl Exp $
2 *
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
7 */
8
9 #include "advapi32.h"
10 #include <accctrl.h>
11
12 #define NDEBUG
13 #include <debug.h>
14
15
16 /*
17 * @implemented
18 */
19 BOOL STDCALL
20 AreAllAccessesGranted(DWORD GrantedAccess,
21 DWORD DesiredAccess)
22 {
23 return((BOOL)RtlAreAllAccessesGranted(GrantedAccess,
24 DesiredAccess));
25 }
26
27
28 /*
29 * @implemented
30 */
31 BOOL STDCALL
32 AreAnyAccessesGranted(DWORD GrantedAccess,
33 DWORD DesiredAccess)
34 {
35 return((BOOL)RtlAreAnyAccessesGranted(GrantedAccess,
36 DesiredAccess));
37 }
38
39
40 /******************************************************************************
41 * GetFileSecurityA [ADVAPI32.@]
42 *
43 * Obtains Specified information about the security of a file or directory.
44 *
45 * PARAMS
46 * lpFileName [I] Name of the file to get info for
47 * RequestedInformation [I] SE_ flags from "winnt.h"
48 * pSecurityDescriptor [O] Destination for security information
49 * nLength [I] Length of pSecurityDescriptor
50 * lpnLengthNeeded [O] Destination for length of returned security information
51 *
52 * RETURNS
53 * Success: TRUE. pSecurityDescriptor contains the requested information.
54 * Failure: FALSE. lpnLengthNeeded contains the required space to return the info.
55 *
56 * NOTES
57 * The information returned is constrained by the callers access rights and
58 * privileges.
59 *
60 * @implemented
61 */
62 BOOL WINAPI
63 GetFileSecurityA(LPCSTR lpFileName,
64 SECURITY_INFORMATION RequestedInformation,
65 PSECURITY_DESCRIPTOR pSecurityDescriptor,
66 DWORD nLength,
67 LPDWORD lpnLengthNeeded)
68 {
69 UNICODE_STRING FileName;
70 NTSTATUS Status;
71 BOOL bResult;
72
73 Status = RtlCreateUnicodeStringFromAsciiz(&FileName,
74 (LPSTR)lpFileName);
75 if (!NT_SUCCESS(Status))
76 {
77 SetLastError(RtlNtStatusToDosError(Status));
78 return FALSE;
79 }
80
81 bResult = GetFileSecurityW(FileName.Buffer,
82 RequestedInformation,
83 pSecurityDescriptor,
84 nLength,
85 lpnLengthNeeded);
86
87 RtlFreeUnicodeString(&FileName);
88
89 return bResult;
90 }
91
92
93 /*
94 * @implemented
95 */
96 BOOL WINAPI
97 GetFileSecurityW(LPCWSTR lpFileName,
98 SECURITY_INFORMATION RequestedInformation,
99 PSECURITY_DESCRIPTOR pSecurityDescriptor,
100 DWORD nLength,
101 LPDWORD lpnLengthNeeded)
102 {
103 OBJECT_ATTRIBUTES ObjectAttributes;
104 IO_STATUS_BLOCK StatusBlock;
105 UNICODE_STRING FileName;
106 ULONG AccessMask = 0;
107 HANDLE FileHandle;
108 NTSTATUS Status;
109
110 DPRINT("GetFileSecurityW() called\n");
111
112 if (RequestedInformation &
113 (OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION))
114 {
115 AccessMask |= STANDARD_RIGHTS_READ;
116 }
117
118 if (RequestedInformation & SACL_SECURITY_INFORMATION)
119 {
120 AccessMask |= ACCESS_SYSTEM_SECURITY;
121 }
122
123 if (!RtlDosPathNameToNtPathName_U((LPWSTR)lpFileName,
124 &FileName,
125 NULL,
126 NULL))
127 {
128 DPRINT("Invalid path\n");
129 SetLastError(ERROR_INVALID_NAME);
130 return FALSE;
131 }
132
133 InitializeObjectAttributes(&ObjectAttributes,
134 &FileName,
135 OBJ_CASE_INSENSITIVE,
136 NULL,
137 NULL);
138
139 Status = NtOpenFile(&FileHandle,
140 AccessMask,
141 &ObjectAttributes,
142 &StatusBlock,
143 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
144 0);
145 if (!NT_SUCCESS(Status))
146 {
147 DPRINT("NtOpenFile() failed (Status %lx)\n", Status);
148 SetLastError(RtlNtStatusToDosError(Status));
149 return FALSE;
150 }
151
152 RtlFreeUnicodeString(&FileName);
153
154 Status = NtQuerySecurityObject(FileHandle,
155 RequestedInformation,
156 pSecurityDescriptor,
157 nLength,
158 lpnLengthNeeded);
159 NtClose(FileHandle);
160
161 if (!NT_SUCCESS(Status))
162 {
163 DPRINT("NtQuerySecurityObject() failed (Status %lx)\n", Status);
164 SetLastError(RtlNtStatusToDosError(Status));
165 return FALSE;
166 }
167
168 return TRUE;
169 }
170
171
172 /*
173 * @implemented
174 */
175 BOOL STDCALL
176 GetKernelObjectSecurity(HANDLE Handle,
177 SECURITY_INFORMATION RequestedInformation,
178 PSECURITY_DESCRIPTOR pSecurityDescriptor,
179 DWORD nLength,
180 LPDWORD lpnLengthNeeded)
181 {
182 NTSTATUS Status;
183
184 Status = NtQuerySecurityObject(Handle,
185 RequestedInformation,
186 pSecurityDescriptor,
187 nLength,
188 lpnLengthNeeded);
189 if (!NT_SUCCESS(Status))
190 {
191 SetLastError(RtlNtStatusToDosError(Status));
192 return(FALSE);
193 }
194 return(TRUE);
195 }
196
197
198 /******************************************************************************
199 * SetFileSecurityA [ADVAPI32.@]
200 * Sets the security of a file or directory
201 *
202 * @implemented
203 */
204 BOOL STDCALL
205 SetFileSecurityA (LPCSTR lpFileName,
206 SECURITY_INFORMATION SecurityInformation,
207 PSECURITY_DESCRIPTOR pSecurityDescriptor)
208 {
209 UNICODE_STRING FileName;
210 NTSTATUS Status;
211 BOOL bResult;
212
213 Status = RtlCreateUnicodeStringFromAsciiz(&FileName,
214 (LPSTR)lpFileName);
215 if (!NT_SUCCESS(Status))
216 {
217 SetLastError(RtlNtStatusToDosError(Status));
218 return FALSE;
219 }
220
221 bResult = SetFileSecurityW(FileName.Buffer,
222 SecurityInformation,
223 pSecurityDescriptor);
224
225 RtlFreeUnicodeString(&FileName);
226
227 return bResult;
228 }
229
230
231 /******************************************************************************
232 * SetFileSecurityW [ADVAPI32.@]
233 * Sets the security of a file or directory
234 *
235 * @implemented
236 */
237 BOOL STDCALL
238 SetFileSecurityW (LPCWSTR lpFileName,
239 SECURITY_INFORMATION SecurityInformation,
240 PSECURITY_DESCRIPTOR pSecurityDescriptor)
241 {
242 OBJECT_ATTRIBUTES ObjectAttributes;
243 IO_STATUS_BLOCK StatusBlock;
244 UNICODE_STRING FileName;
245 ULONG AccessMask = 0;
246 HANDLE FileHandle;
247 NTSTATUS Status;
248
249 DPRINT("SetFileSecurityW() called\n");
250
251 if (SecurityInformation &
252 (OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION))
253 {
254 AccessMask |= WRITE_OWNER;
255 }
256
257 if (SecurityInformation & DACL_SECURITY_INFORMATION)
258 {
259 AccessMask |= WRITE_DAC;
260 }
261
262 if (SecurityInformation & SACL_SECURITY_INFORMATION)
263 {
264 AccessMask |= ACCESS_SYSTEM_SECURITY;
265 }
266
267 if (!RtlDosPathNameToNtPathName_U((LPWSTR)lpFileName,
268 &FileName,
269 NULL,
270 NULL))
271 {
272 DPRINT("Invalid path\n");
273 SetLastError(ERROR_INVALID_NAME);
274 return FALSE;
275 }
276
277 InitializeObjectAttributes(&ObjectAttributes,
278 &FileName,
279 OBJ_CASE_INSENSITIVE,
280 NULL,
281 NULL);
282
283 Status = NtOpenFile(&FileHandle,
284 AccessMask,
285 &ObjectAttributes,
286 &StatusBlock,
287 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
288 0);
289 if (!NT_SUCCESS(Status))
290 {
291 DPRINT("NtOpenFile() failed (Status %lx)\n", Status);
292 SetLastError(RtlNtStatusToDosError(Status));
293 return FALSE;
294 }
295
296 RtlFreeUnicodeString(&FileName);
297
298 Status = NtSetSecurityObject(FileHandle,
299 SecurityInformation,
300 pSecurityDescriptor);
301 NtClose(FileHandle);
302
303 if (!NT_SUCCESS(Status))
304 {
305 DPRINT("NtSetSecurityObject() failed (Status %lx)\n", Status);
306 SetLastError(RtlNtStatusToDosError(Status));
307 return FALSE;
308 }
309
310 return TRUE;
311 }
312
313
314 /*
315 * @implemented
316 */
317 BOOL STDCALL
318 SetKernelObjectSecurity(HANDLE Handle,
319 SECURITY_INFORMATION SecurityInformation,
320 PSECURITY_DESCRIPTOR SecurityDescriptor)
321 {
322 NTSTATUS Status;
323
324 Status = NtSetSecurityObject(Handle,
325 SecurityInformation,
326 SecurityDescriptor);
327 if (!NT_SUCCESS(Status))
328 {
329 SetLastError(RtlNtStatusToDosError(Status));
330 return FALSE;
331 }
332 return TRUE;
333 }
334
335
336 /*
337 * @implemented
338 */
339 VOID STDCALL
340 MapGenericMask(PDWORD AccessMask,
341 PGENERIC_MAPPING GenericMapping)
342 {
343 RtlMapGenericMask(AccessMask,
344 GenericMapping);
345 }
346
347
348 /*
349 * @implemented
350 */
351 BOOL STDCALL
352 ImpersonateLoggedOnUser(HANDLE hToken)
353 {
354 SECURITY_QUALITY_OF_SERVICE Qos;
355 OBJECT_ATTRIBUTES ObjectAttributes;
356 HANDLE NewToken;
357 TOKEN_TYPE Type;
358 ULONG ReturnLength;
359 BOOL Duplicated;
360 NTSTATUS Status;
361
362 /* Get the token type */
363 Status = NtQueryInformationToken (hToken,
364 TokenType,
365 &Type,
366 sizeof(TOKEN_TYPE),
367 &ReturnLength);
368 if (!NT_SUCCESS(Status))
369 {
370 SetLastError (RtlNtStatusToDosError (Status));
371 return FALSE;
372 }
373
374 if (Type == TokenPrimary)
375 {
376 /* Create a duplicate impersonation token */
377 Qos.Length = sizeof(SECURITY_QUALITY_OF_SERVICE);
378 Qos.ImpersonationLevel = SecurityImpersonation;
379 Qos.ContextTrackingMode = SECURITY_DYNAMIC_TRACKING;
380 Qos.EffectiveOnly = FALSE;
381
382 ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
383 ObjectAttributes.RootDirectory = NULL;
384 ObjectAttributes.ObjectName = NULL;
385 ObjectAttributes.Attributes = 0;
386 ObjectAttributes.SecurityDescriptor = NULL;
387 ObjectAttributes.SecurityQualityOfService = &Qos;
388
389 Status = NtDuplicateToken (hToken,
390 TOKEN_IMPERSONATE | TOKEN_QUERY,
391 &ObjectAttributes,
392 FALSE,
393 TokenImpersonation,
394 &NewToken);
395 if (!NT_SUCCESS(Status))
396 {
397 SetLastError (RtlNtStatusToDosError (Status));
398 return FALSE;
399 }
400
401 Duplicated = TRUE;
402 }
403 else
404 {
405 /* User the original impersonation token */
406 NewToken = hToken;
407 Duplicated = FALSE;
408 }
409
410 /* Impersonate the the current thread */
411 Status = NtSetInformationThread (NtCurrentThread (),
412 ThreadImpersonationToken,
413 &NewToken,
414 sizeof(HANDLE));
415
416 if (Duplicated == TRUE)
417 {
418 NtClose (NewToken);
419 }
420
421 if (!NT_SUCCESS(Status))
422 {
423 SetLastError (RtlNtStatusToDosError (Status));
424 return FALSE;
425 }
426
427 return TRUE;
428 }
429
430
431 /*
432 * @implemented
433 */
434 BOOL STDCALL
435 ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
436 {
437 NTSTATUS Status;
438
439 Status = RtlImpersonateSelf(ImpersonationLevel);
440 if (!NT_SUCCESS(Status))
441 {
442 SetLastError(RtlNtStatusToDosError(Status));
443 return FALSE;
444 }
445 return TRUE;
446 }
447
448
449 /*
450 * @implemented
451 */
452 BOOL STDCALL
453 RevertToSelf(VOID)
454 {
455 NTSTATUS Status;
456 HANDLE Token = NULL;
457
458 Status = NtSetInformationThread(NtCurrentThread(),
459 ThreadImpersonationToken,
460 &Token,
461 sizeof(HANDLE));
462 if (!NT_SUCCESS(Status))
463 {
464 SetLastError(RtlNtStatusToDosError(Status));
465 return FALSE;
466 }
467 return TRUE;
468 }
469
470
471 /******************************************************************************
472 * GetUserNameA [ADVAPI32.@]
473 *
474 * Get the current user name.
475 *
476 * PARAMS
477 * lpszName [O] Destination for the user name.
478 * lpSize [I/O] Size of lpszName.
479 *
480 * RETURNS
481 * Success: The length of the user name, including terminating NUL.
482 * Failure: ERROR_MORE_DATA if *lpSize is too small.
483 *
484 * @unimplemented
485 */
486 BOOL WINAPI
487 GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
488 {
489 // size_t len;
490 // char name[] = { "Administrator" };
491
492 /* We need to include the null character when determining the size of the buffer. */
493 // len = strlen(name) + 1;
494 // if (len > *lpSize)
495 // {
496 // SetLastError(ERROR_MORE_DATA);
497 // *lpSize = len;
498 // return 0;
499 // }
500
501 // *lpSize = len;
502 // strcpy(lpszName, name);
503 DPRINT1("GetUserNameA: stub\n");
504 return TRUE;
505 }
506
507 /******************************************************************************
508 * GetUserNameW [ADVAPI32.@]
509 *
510 * See GetUserNameA.
511 *
512 * @unimplemented
513 */
514 BOOL WINAPI
515 GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
516 {
517 // char name[] = { "Administrator" };
518
519 // DWORD len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
520
521 // if (len > *lpSize)
522 // {
523 // SetLastError(ERROR_MORE_DATA);
524 // *lpSize = len;
525 // return FALSE;
526 // }
527
528 // *lpSize = len;
529 // MultiByteToWideChar( CP_ACP, 0, name, -1, lpszName, len );
530 DPRINT1("GetUserNameW: stub\n");
531 return TRUE;
532 }
533
534
535 /******************************************************************************
536 * LookupAccountSidA [ADVAPI32.@]
537 *
538 * @unimplemented
539 */
540 BOOL STDCALL
541 LookupAccountSidA (LPCSTR lpSystemName,
542 PSID lpSid,
543 LPSTR lpName,
544 LPDWORD cchName,
545 LPSTR lpReferencedDomainName,
546 LPDWORD cchReferencedDomainName,
547 PSID_NAME_USE peUse)
548 {
549 DPRINT1("LookupAccountSidA is unimplemented, but returns success\n");
550 lstrcpynA(lpName, "Administrator", *cchName);
551 lstrcpynA(lpReferencedDomainName, "ReactOS", *cchReferencedDomainName);
552 return TRUE;
553 }
554
555
556 /******************************************************************************
557 * LookupAccountSidW [ADVAPI32.@]
558 *
559 * @unimplemented
560 */
561 BOOL STDCALL
562 LookupAccountSidW (LPCWSTR lpSystemName,
563 PSID lpSid,
564 LPWSTR lpName,
565 LPDWORD cchName,
566 LPWSTR lpReferencedDomainName,
567 LPDWORD cchReferencedDomainName,
568 PSID_NAME_USE peUse)
569 {
570 DPRINT1("LookupAccountSidW is unimplemented, but returns success\n");
571 lstrcpynW(lpName, L"Administrator", *cchName);
572 lstrcpynW(lpReferencedDomainName, L"ReactOS", *cchReferencedDomainName);
573 return TRUE;
574 }
575
576
577 /**********************************************************************
578 * LookupPrivilegeValueA EXPORTED
579 *
580 * @implemented
581 */
582 BOOL STDCALL
583 LookupPrivilegeValueA (LPCSTR lpSystemName,
584 LPCSTR lpName,
585 PLUID lpLuid)
586 {
587 UNICODE_STRING SystemName;
588 UNICODE_STRING Name;
589 BOOL Result;
590
591 /* Remote system? */
592 if (lpSystemName != NULL)
593 {
594 RtlCreateUnicodeStringFromAsciiz (&SystemName,
595 (LPSTR)lpSystemName);
596 }
597
598 /* Check the privilege name is not NULL */
599 if (lpName == NULL)
600 {
601 SetLastError (ERROR_INVALID_PARAMETER);
602 return FALSE;
603 }
604
605 RtlCreateUnicodeStringFromAsciiz (&Name,
606 (LPSTR)lpName);
607
608 Result = LookupPrivilegeValueW ((lpSystemName != NULL) ? SystemName.Buffer : NULL,
609 Name.Buffer,
610 lpLuid);
611
612 RtlFreeUnicodeString (&Name);
613
614 /* Remote system? */
615 if (lpSystemName != NULL)
616 {
617 RtlFreeUnicodeString (&SystemName);
618 }
619
620 return Result;
621 }
622
623
624 /**********************************************************************
625 * LookupPrivilegeValueW EXPORTED
626 *
627 * @unimplemented
628 */
629 BOOL STDCALL
630 LookupPrivilegeValueW (LPCWSTR SystemName,
631 LPCWSTR PrivName,
632 PLUID Luid)
633 {
634 static const WCHAR * const DefaultPrivNames[] =
635 {
636 L"SeCreateTokenPrivilege",
637 L"SeAssignPrimaryTokenPrivilege",
638 L"SeLockMemoryPrivilege",
639 L"SeIncreaseQuotaPrivilege",
640 L"SeUnsolicitedInputPrivilege",
641 L"SeMachineAccountPrivilege",
642 L"SeTcbPrivilege",
643 L"SeSecurityPrivilege",
644 L"SeTakeOwnershipPrivilege",
645 L"SeLoadDriverPrivilege",
646 L"SeSystemProfilePrivilege",
647 L"SeSystemtimePrivilege",
648 L"SeProfileSingleProcessPrivilege",
649 L"SeIncreaseBasePriorityPrivilege",
650 L"SeCreatePagefilePrivilege",
651 L"SeCreatePermanentPrivilege",
652 L"SeBackupPrivilege",
653 L"SeRestorePrivilege",
654 L"SeShutdownPrivilege",
655 L"SeDebugPrivilege",
656 L"SeAuditPrivilege",
657 L"SeSystemEnvironmentPrivilege",
658 L"SeChangeNotifyPrivilege",
659 L"SeRemoteShutdownPrivilege",
660 L"SeUndockPrivilege",
661 L"SeSyncAgentPrivilege",
662 L"SeEnableDelegationPrivilege",
663 L"SeManageVolumePrivilege",
664 L"SeImpersonatePrivilege",
665 L"SeCreateGlobalPrivilege"
666 };
667 unsigned Priv;
668
669 if (NULL != SystemName && L'\0' != *SystemName)
670 {
671 DPRINT1("LookupPrivilegeValueW: not implemented for remote system\n");
672 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
673 return FALSE;
674 }
675
676 for (Priv = 0; Priv < sizeof(DefaultPrivNames) / sizeof(DefaultPrivNames[0]); Priv++)
677 {
678 if (0 == wcscmp(PrivName, DefaultPrivNames[Priv]))
679 {
680 Luid->LowPart = Priv + 1;
681 Luid->HighPart = 0;
682 return TRUE;
683 }
684 }
685
686 DPRINT1("LookupPrivilegeValueW: no such privilege %S\n", PrivName);
687 SetLastError(ERROR_NO_SUCH_PRIVILEGE);
688 return FALSE;
689 }
690
691
692 /**********************************************************************
693 * LookupPrivilegeDisplayNameA EXPORTED
694 *
695 * @unimplemented
696 */
697 BOOL STDCALL
698 LookupPrivilegeDisplayNameA (LPCSTR lpSystemName,
699 LPCSTR lpName,
700 LPSTR lpDisplayName,
701 LPDWORD cbDisplayName,
702 LPDWORD lpLanguageId)
703 {
704 DPRINT1("LookupPrivilegeDisplayNameA: stub\n");
705 SetLastError (ERROR_CALL_NOT_IMPLEMENTED);
706 return FALSE;
707 }
708
709
710 /**********************************************************************
711 * LookupPrivilegeDisplayNameW EXPORTED
712 *
713 * @unimplemented
714 */
715 BOOL STDCALL
716 LookupPrivilegeDisplayNameW (LPCWSTR lpSystemName,
717 LPCWSTR lpName,
718 LPWSTR lpDisplayName,
719 LPDWORD cbDisplayName,
720 LPDWORD lpLanguageId)
721 {
722 DPRINT1("LookupPrivilegeDisplayNameW: stub\n");
723 SetLastError (ERROR_CALL_NOT_IMPLEMENTED);
724 return FALSE;
725 }
726
727
728 /**********************************************************************
729 * LookupPrivilegeNameA EXPORTED
730 *
731 * @unimplemented
732 */
733 BOOL STDCALL
734 LookupPrivilegeNameA (LPCSTR lpSystemName,
735 PLUID lpLuid,
736 LPSTR lpName,
737 LPDWORD cbName)
738 {
739 DPRINT1("LookupPrivilegeNameA: stub\n");
740 SetLastError (ERROR_CALL_NOT_IMPLEMENTED);
741 return FALSE;
742 }
743
744
745 /**********************************************************************
746 * LookupPrivilegeNameW EXPORTED
747 *
748 * @unimplemented
749 */
750 BOOL STDCALL
751 LookupPrivilegeNameW (LPCWSTR lpSystemName,
752 PLUID lpLuid,
753 LPWSTR lpName,
754 LPDWORD cbName)
755 {
756 DPRINT1("LookupPrivilegeNameW: stub\n");
757 SetLastError (ERROR_CALL_NOT_IMPLEMENTED);
758 return FALSE;
759 }
760
761
762 /**********************************************************************
763 * GetNamedSecurityInfoW EXPORTED
764 *
765 * @unimplemented
766 */
767 DWORD STDCALL
768 GetNamedSecurityInfoW(LPWSTR pObjectName,
769 SE_OBJECT_TYPE ObjectType,
770 SECURITY_INFORMATION SecurityInfo,
771 PSID *ppsidOwner,
772 PSID *ppsidGroup,
773 PACL *ppDacl,
774 PACL *ppSacl,
775 PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
776 {
777 DPRINT1("GetNamedSecurityInfoW: stub\n");
778 return ERROR_CALL_NOT_IMPLEMENTED;
779 }
780
781
782 /**********************************************************************
783 * GetNamedSecurityInfoA EXPORTED
784 *
785 * @unimplemented
786 */
787 DWORD STDCALL
788 GetNamedSecurityInfoA(LPSTR pObjectName,
789 SE_OBJECT_TYPE ObjectType,
790 SECURITY_INFORMATION SecurityInfo,
791 PSID *ppsidOwner,
792 PSID *ppsidGroup,
793 PACL *ppDacl,
794 PACL *ppSacl,
795 PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
796 {
797 DPRINT1("GetNamedSecurityInfoA: stub\n");
798 return ERROR_CALL_NOT_IMPLEMENTED;
799 }
800
801
802 /**********************************************************************
803 * SetNamedSecurityInfoW EXPORTED
804 *
805 * @unimplemented
806 */
807 DWORD STDCALL
808 SetNamedSecurityInfoW(LPWSTR pObjectName,
809 SE_OBJECT_TYPE ObjectType,
810 SECURITY_INFORMATION SecurityInfo,
811 PSID psidOwner,
812 PSID psidGroup,
813 PACL pDacl,
814 PACL pSacl)
815 {
816 DPRINT1("SetNamedSecurityInfoW: stub\n");
817 return ERROR_CALL_NOT_IMPLEMENTED;
818 }
819
820
821 /**********************************************************************
822 * SetNamedSecurityInfoA EXPORTED
823 *
824 * @unimplemented
825 */
826 DWORD STDCALL
827 SetNamedSecurityInfoA(LPSTR pObjectName,
828 SE_OBJECT_TYPE ObjectType,
829 SECURITY_INFORMATION SecurityInfo,
830 PSID psidOwner,
831 PSID psidGroup,
832 PACL pDacl,
833 PACL pSacl)
834 {
835 DPRINT1("SetNamedSecurityInfoA: stub\n");
836 return ERROR_CALL_NOT_IMPLEMENTED;
837 }
838
839
840 /**********************************************************************
841 * GetSecurityInfo EXPORTED
842 *
843 * @unimplemented
844 */
845 DWORD STDCALL
846 GetSecurityInfo(HANDLE handle,
847 SE_OBJECT_TYPE ObjectType,
848 SECURITY_INFORMATION SecurityInfo,
849 PSID* ppsidOwner,
850 PSID* ppsidGroup,
851 PACL* ppDacl,
852 PACL* ppSacl,
853 PSECURITY_DESCRIPTOR* ppSecurityDescriptor)
854 {
855 DPRINT1("GetSecurityInfo: stub\n");
856 return ERROR_CALL_NOT_IMPLEMENTED;
857 }
858
859
860 /**********************************************************************
861 * ImpersonateNamedPipeClient EXPORTED
862 *
863 * @implemented
864 */
865 BOOL STDCALL
866 ImpersonateNamedPipeClient(HANDLE hNamedPipe)
867 {
868 IO_STATUS_BLOCK StatusBlock;
869 NTSTATUS Status;
870
871 DPRINT("ImpersonateNamedPipeClient() called\n");
872
873 Status = NtFsControlFile(hNamedPipe,
874 NULL,
875 NULL,
876 NULL,
877 &StatusBlock,
878 FSCTL_PIPE_IMPERSONATE,
879 NULL,
880 0,
881 NULL,
882 0);
883 if (!NT_SUCCESS(Status))
884 {
885 SetLastError(RtlNtStatusToDosError(Status));
886 return FALSE;
887 }
888
889 return TRUE;
890 }
891
892 /* EOF */