1 /* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS system libraries 4 * FILE: dll/win32/advapi32/sec/lsa.c 5 * PURPOSE: Local security authority functions 6 * PROGRAMMER: Emanuele Aliberti 7 * UPDATE HISTORY: 8 * 19990322 EA created 9 * 19990515 EA stubs 10 * 20030202 KJK compressed stubs 11 * 12 */ 13 #include <advapi32.h> 14 WINE_DEFAULT_DEBUG_CHANNEL(advapi); 15 16 17 static BOOL LsapIsLocalComputer(PLSA_UNICODE_STRING ServerName) 18 { 19 DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; 20 BOOL Result; 21 LPWSTR buf; 22 23 if (ServerName == NULL || ServerName->Length == 0 || ServerName->Buffer == NULL) 24 return TRUE; 25 26 buf = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(WCHAR)); 27 Result = GetComputerNameW(buf, &dwSize); 28 if (Result && (ServerName->Buffer[0] == '\\') && (ServerName->Buffer[1] == '\\')) 29 ServerName += 2; 30 Result = Result && !lstrcmpW(ServerName->Buffer, buf); 31 HeapFree(GetProcessHeap(), 0, buf); 32 33 return Result; 34 } 35 36 37 handle_t __RPC_USER 38 PLSAPR_SERVER_NAME_bind(PLSAPR_SERVER_NAME pszSystemName) 39 { 40 handle_t hBinding = NULL; 41 LPWSTR pszStringBinding; 42 RPC_STATUS status; 43 44 TRACE("PLSAPR_SERVER_NAME_bind() called\n"); 45 46 status = RpcStringBindingComposeW(NULL, 47 L"ncacn_np", 48 pszSystemName, 49 L"\\pipe\\lsarpc", 50 NULL, 51 &pszStringBinding); 52 if (status) 53 { 54 TRACE("RpcStringBindingCompose returned 0x%x\n", status); 55 return NULL; 56 } 57 58 /* Set the binding handle that will be used to bind to the server. */ 59 status = RpcBindingFromStringBindingW(pszStringBinding, 60 &hBinding); 61 if (status) 62 { 63 TRACE("RpcBindingFromStringBinding returned 0x%x\n", status); 64 } 65 66 status = RpcStringFreeW(&pszStringBinding); 67 if (status) 68 { 69 TRACE("RpcStringFree returned 0x%x\n", status); 70 } 71 72 return hBinding; 73 } 74 75 76 void __RPC_USER 77 PLSAPR_SERVER_NAME_unbind(PLSAPR_SERVER_NAME pszSystemName, 78 handle_t hBinding) 79 { 80 RPC_STATUS status; 81 82 TRACE("PLSAPR_SERVER_NAME_unbind() called\n"); 83 84 status = RpcBindingFree(&hBinding); 85 if (status) 86 { 87 TRACE("RpcBindingFree returned 0x%x\n", status); 88 } 89 } 90 91 92 /* 93 * @implemented 94 */ 95 NTSTATUS 96 WINAPI 97 LsaClose(IN LSA_HANDLE ObjectHandle) 98 { 99 NTSTATUS Status; 100 101 TRACE("LsaClose(0x%p) called\n", ObjectHandle); 102 103 RpcTryExcept 104 { 105 Status = LsarClose((PLSAPR_HANDLE)&ObjectHandle); 106 } 107 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 108 { 109 Status = I_RpcMapWin32Status(RpcExceptionCode()); 110 } 111 RpcEndExcept; 112 113 return Status; 114 } 115 116 117 /* 118 * @implemented 119 */ 120 NTSTATUS 121 WINAPI 122 LsaDelete(IN LSA_HANDLE ObjectHandle) 123 { 124 NTSTATUS Status; 125 126 TRACE("LsaDelete(0x%p) called\n", ObjectHandle); 127 128 RpcTryExcept 129 { 130 Status = LsarDelete((LSAPR_HANDLE)ObjectHandle); 131 } 132 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 133 { 134 Status = I_RpcMapWin32Status(RpcExceptionCode()); 135 } 136 RpcEndExcept; 137 138 return Status; 139 } 140 141 142 /* 143 * @implemented 144 */ 145 NTSTATUS 146 WINAPI 147 LsaAddAccountRights(IN LSA_HANDLE PolicyHandle, 148 IN PSID AccountSid, 149 IN PLSA_UNICODE_STRING UserRights, 150 IN ULONG CountOfRights) 151 { 152 LSAPR_USER_RIGHT_SET UserRightSet; 153 NTSTATUS Status; 154 155 TRACE("(%p,%p,%p,0x%08x) stub\n", PolicyHandle, AccountSid, UserRights, CountOfRights); 156 157 UserRightSet.Entries = CountOfRights; 158 UserRightSet.UserRights = (PRPC_UNICODE_STRING)UserRights; 159 160 RpcTryExcept 161 { 162 Status = LsarAddAccountRights((LSAPR_HANDLE)PolicyHandle, 163 (PRPC_SID)AccountSid, 164 &UserRightSet); 165 166 } 167 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 168 { 169 Status = I_RpcMapWin32Status(RpcExceptionCode()); 170 } 171 RpcEndExcept; 172 173 return Status; 174 } 175 176 177 /* 178 * @implemented 179 */ 180 NTSTATUS 181 WINAPI 182 LsaAddPrivilegesToAccount(IN LSA_HANDLE AccountHandle, 183 IN PPRIVILEGE_SET PrivilegeSet) 184 { 185 NTSTATUS Status; 186 187 TRACE("(%p,%p) stub\n", AccountHandle, PrivilegeSet); 188 189 RpcTryExcept 190 { 191 Status = LsarAddPrivilegesToAccount((LSAPR_HANDLE)AccountHandle, 192 (PLSAPR_PRIVILEGE_SET)PrivilegeSet); 193 } 194 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 195 { 196 Status = I_RpcMapWin32Status(RpcExceptionCode()); 197 } 198 RpcEndExcept; 199 200 return Status; 201 } 202 203 204 /* 205 * @implemented 206 */ 207 NTSTATUS 208 WINAPI 209 LsaCreateAccount(IN LSA_HANDLE PolicyHandle, 210 IN PSID AccountSid, 211 IN ULONG Flags, 212 OUT PLSA_HANDLE AccountHandle) 213 { 214 NTSTATUS Status; 215 216 TRACE("(%p,%p,0x%08x,%p)\n", PolicyHandle, AccountSid, Flags, AccountHandle); 217 218 RpcTryExcept 219 { 220 Status = LsarCreateAccount((LSAPR_HANDLE)PolicyHandle, 221 AccountSid, 222 Flags, 223 AccountHandle); 224 } 225 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 226 { 227 Status = I_RpcMapWin32Status(RpcExceptionCode()); 228 } 229 RpcEndExcept; 230 231 return Status; 232 } 233 234 235 /* 236 * @implemented 237 */ 238 NTSTATUS 239 WINAPI 240 LsaCreateTrustedDomain(IN LSA_HANDLE PolicyHandle, 241 IN PLSA_TRUST_INFORMATION TrustedDomainInformation, 242 IN ACCESS_MASK DesiredAccess, 243 OUT PLSA_HANDLE TrustedDomainHandle) 244 { 245 NTSTATUS Status; 246 247 TRACE("(%p,%p,0x%08x,%p)\n", PolicyHandle, TrustedDomainInformation, 248 DesiredAccess, TrustedDomainHandle); 249 250 RpcTryExcept 251 { 252 Status = LsarCreateTrustedDomain((LSAPR_HANDLE)PolicyHandle, 253 (PLSAPR_TRUST_INFORMATION)TrustedDomainInformation, 254 DesiredAccess, 255 (PLSAPR_HANDLE)TrustedDomainHandle); 256 } 257 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 258 { 259 Status = I_RpcMapWin32Status(RpcExceptionCode()); 260 } 261 RpcEndExcept; 262 263 return Status; 264 } 265 266 267 /* 268 * @unimplemented 269 */ 270 NTSTATUS 271 WINAPI 272 LsaCreateTrustedDomainEx( 273 LSA_HANDLE PolicyHandle, 274 PTRUSTED_DOMAIN_INFORMATION_EX TrustedDomainInformation, 275 PTRUSTED_DOMAIN_AUTH_INFORMATION AuthenticationInformation, 276 ACCESS_MASK DesiredAccess, 277 PLSA_HANDLE TrustedDomainHandle) 278 { 279 FIXME("(%p,%p,%p,0x%08x,%p) stub\n", PolicyHandle, TrustedDomainInformation, AuthenticationInformation, 280 DesiredAccess, TrustedDomainHandle); 281 return STATUS_SUCCESS; 282 } 283 284 285 /* 286 * @implemented 287 */ 288 NTSTATUS 289 WINAPI 290 LsaDeleteTrustedDomain(IN LSA_HANDLE PolicyHandle, 291 IN PSID TrustedDomainSid) 292 { 293 NTSTATUS Status; 294 295 TRACE("(%p,%p)\n", PolicyHandle, TrustedDomainSid); 296 297 RpcTryExcept 298 { 299 Status = LsarDeleteTrustedDomain((LSAPR_HANDLE)PolicyHandle, 300 TrustedDomainSid); 301 } 302 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 303 { 304 Status = I_RpcMapWin32Status(RpcExceptionCode()); 305 } 306 RpcEndExcept; 307 308 return Status; 309 } 310 311 312 /* 313 * @implemented 314 */ 315 NTSTATUS 316 WINAPI 317 LsaEnumerateAccountRights(IN LSA_HANDLE PolicyHandle, 318 IN PSID AccountSid, 319 OUT PLSA_UNICODE_STRING *UserRights, 320 OUT PULONG CountOfRights) 321 { 322 LSAPR_USER_RIGHT_SET UserRightsSet; 323 NTSTATUS Status; 324 325 TRACE("(%p,%p,%p,%p) stub\n", PolicyHandle, AccountSid, UserRights, CountOfRights); 326 327 UserRightsSet.Entries = 0; 328 UserRightsSet.UserRights = NULL; 329 330 RpcTryExcept 331 { 332 Status = LsarEnmuerateAccountRights((LSAPR_HANDLE)PolicyHandle, 333 AccountSid, 334 &UserRightsSet); 335 336 *CountOfRights = UserRightsSet.Entries; 337 *UserRights = (PUNICODE_STRING)UserRightsSet.UserRights; 338 } 339 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 340 { 341 Status = I_RpcMapWin32Status(RpcExceptionCode()); 342 343 if (UserRightsSet.UserRights != NULL) 344 { 345 MIDL_user_free(UserRightsSet.UserRights); 346 } 347 } 348 RpcEndExcept; 349 350 return Status; 351 } 352 353 354 /* 355 * @unimplemented 356 */ 357 NTSTATUS 358 WINAPI 359 LsaEnumerateAccountsWithUserRight( 360 LSA_HANDLE PolicyHandle, 361 OPTIONAL PLSA_UNICODE_STRING UserRights, 362 PVOID *EnumerationBuffer, 363 PULONG CountReturned) 364 { 365 FIXME("(%p,%p,%p,%p) stub\n", PolicyHandle, UserRights, EnumerationBuffer, CountReturned); 366 return STATUS_NO_MORE_ENTRIES; 367 } 368 369 /* 370 * @unimplemented 371 */ 372 NTSTATUS 373 WINAPI 374 LsaEnumerateTrustedDomains( 375 LSA_HANDLE PolicyHandle, 376 PLSA_ENUMERATION_HANDLE EnumerationContext, 377 PVOID *Buffer, 378 ULONG PreferedMaximumLength, 379 PULONG CountReturned) 380 { 381 FIXME("(%p,%p,%p,0x%08x,%p) stub\n", PolicyHandle, EnumerationContext, 382 Buffer, PreferedMaximumLength, CountReturned); 383 384 if (CountReturned) *CountReturned = 0; 385 return STATUS_SUCCESS; 386 } 387 388 /* 389 * @unimplemented 390 */ 391 NTSTATUS 392 WINAPI 393 LsaEnumerateTrustedDomainsEx( 394 LSA_HANDLE PolicyHandle, 395 PLSA_ENUMERATION_HANDLE EnumerationContext, 396 PVOID *Buffer, 397 ULONG PreferedMaximumLength, 398 PULONG CountReturned) 399 { 400 FIXME("(%p,%p,%p,0x%08x,%p) stub\n", PolicyHandle, EnumerationContext, Buffer, 401 PreferedMaximumLength, CountReturned); 402 if (CountReturned) *CountReturned = 0; 403 return STATUS_SUCCESS; 404 } 405 406 407 /* 408 * @implemented 409 */ 410 NTSTATUS 411 WINAPI 412 LsaFreeMemory(IN PVOID Buffer) 413 { 414 TRACE("(%p)\n", Buffer); 415 return RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); 416 } 417 418 419 /* 420 * @implemented 421 */ 422 NTSTATUS 423 WINAPI 424 LsaLookupNames(IN LSA_HANDLE PolicyHandle, 425 IN ULONG Count, 426 IN PLSA_UNICODE_STRING Names, 427 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, 428 OUT PLSA_TRANSLATED_SID *Sids) 429 { 430 LSAPR_TRANSLATED_SIDS TranslatedSids = {0, NULL}; 431 ULONG MappedCount = 0; 432 NTSTATUS Status; 433 434 TRACE("(%p,0x%08x,%p,%p,%p)\n", PolicyHandle, Count, Names, 435 ReferencedDomains, Sids); 436 437 if (ReferencedDomains == NULL || Sids == NULL) 438 return STATUS_INVALID_PARAMETER; 439 440 RpcTryExcept 441 { 442 *ReferencedDomains = NULL; 443 *Sids = NULL; 444 445 TranslatedSids.Entries = Count; 446 447 Status = LsarLookupNames((LSAPR_HANDLE)PolicyHandle, 448 Count, 449 (PRPC_UNICODE_STRING)Names, 450 (PLSAPR_REFERENCED_DOMAIN_LIST *)ReferencedDomains, 451 &TranslatedSids, 452 LsapLookupWksta, 453 &MappedCount); 454 455 *Sids = (PLSA_TRANSLATED_SID)TranslatedSids.Sids; 456 } 457 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 458 { 459 if (TranslatedSids.Sids != NULL) 460 MIDL_user_free(TranslatedSids.Sids); 461 462 Status = I_RpcMapWin32Status(RpcExceptionCode()); 463 } 464 RpcEndExcept; 465 466 return Status; 467 } 468 469 470 /* 471 * @implemented 472 */ 473 NTSTATUS 474 WINAPI 475 LsaLookupNames2(IN LSA_HANDLE PolicyHandle, 476 IN ULONG Flags, 477 IN ULONG Count, 478 IN PLSA_UNICODE_STRING Names, 479 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, 480 OUT PLSA_TRANSLATED_SID2 *Sids) 481 { 482 LSAPR_TRANSLATED_SIDS_EX2 TranslatedSids = {0, NULL}; 483 ULONG MappedCount = 0; 484 NTSTATUS Status; 485 486 TRACE("(%p,0x%08x,0x%08x,%p,%p,%p) stub\n", PolicyHandle, Flags, 487 Count, Names, ReferencedDomains, Sids); 488 489 if (ReferencedDomains == NULL || Sids == NULL) 490 return STATUS_INVALID_PARAMETER; 491 492 RpcTryExcept 493 { 494 *ReferencedDomains = NULL; 495 *Sids = NULL; 496 497 TranslatedSids.Entries = Count; 498 499 Status = LsarLookupNames3((LSAPR_HANDLE)PolicyHandle, 500 Count, 501 (PRPC_UNICODE_STRING)Names, 502 (PLSAPR_REFERENCED_DOMAIN_LIST *)ReferencedDomains, 503 &TranslatedSids, 504 LsapLookupWksta, 505 &MappedCount, 506 Flags, 507 2); 508 509 *Sids = (PLSA_TRANSLATED_SID2)TranslatedSids.Sids; 510 } 511 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 512 { 513 if (TranslatedSids.Sids != NULL) 514 MIDL_user_free(TranslatedSids.Sids); 515 516 Status = I_RpcMapWin32Status(RpcExceptionCode()); 517 } 518 RpcEndExcept; 519 520 return Status; 521 } 522 523 524 /* 525 * @implemented 526 */ 527 NTSTATUS 528 WINAPI 529 LsaLookupPrivilegeName(IN LSA_HANDLE PolicyHandle, 530 IN PLUID Value, 531 OUT PUNICODE_STRING *Name) 532 { 533 PRPC_UNICODE_STRING NameBuffer = NULL; 534 NTSTATUS Status; 535 536 TRACE("(%p,%p,%p)\n", PolicyHandle, Value, Name); 537 538 RpcTryExcept 539 { 540 Status = LsarLookupPrivilegeName(PolicyHandle, 541 Value, 542 &NameBuffer); 543 544 *Name = (PUNICODE_STRING)NameBuffer; 545 } 546 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 547 { 548 if (NameBuffer != NULL) 549 MIDL_user_free(NameBuffer); 550 551 Status = I_RpcMapWin32Status(RpcExceptionCode()); 552 } 553 RpcEndExcept; 554 555 return Status; 556 } 557 558 559 /* 560 * @implemented 561 */ 562 NTSTATUS 563 WINAPI 564 LsaLookupPrivilegeValue(IN LSA_HANDLE PolicyHandle, 565 IN PLSA_UNICODE_STRING Name, 566 OUT PLUID Value) 567 { 568 LUID Luid; 569 NTSTATUS Status; 570 571 TRACE("(%p,%p,%p)\n", PolicyHandle, Name, Value); 572 573 RpcTryExcept 574 { 575 Status = LsarLookupPrivilegeValue(PolicyHandle, 576 (PRPC_UNICODE_STRING)Name, 577 &Luid); 578 if (Status == STATUS_SUCCESS) 579 *Value = Luid; 580 } 581 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 582 { 583 Status = I_RpcMapWin32Status(RpcExceptionCode()); 584 } 585 RpcEndExcept; 586 587 return Status; 588 } 589 590 591 /* 592 * @implemented 593 */ 594 NTSTATUS 595 WINAPI 596 LsaLookupSids(IN LSA_HANDLE PolicyHandle, 597 IN ULONG Count, 598 IN PSID *Sids, 599 OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains, 600 OUT PLSA_TRANSLATED_NAME *Names) 601 { 602 LSAPR_SID_ENUM_BUFFER SidEnumBuffer; 603 LSAPR_TRANSLATED_NAMES TranslatedNames; 604 ULONG MappedCount = 0; 605 NTSTATUS Status; 606 607 TRACE("(%p,%u,%p,%p,%p)\n", PolicyHandle, Count, Sids, 608 ReferencedDomains, Names); 609 610 if (Count == 0) 611 return STATUS_INVALID_PARAMETER; 612 613 SidEnumBuffer.Entries = Count; 614 SidEnumBuffer.SidInfo = (PLSAPR_SID_INFORMATION)Sids; 615 616 RpcTryExcept 617 { 618 *ReferencedDomains = NULL; 619 *Names = NULL; 620 621 TranslatedNames.Entries = 0; 622 TranslatedNames.Names = NULL; 623 624 Status = LsarLookupSids((LSAPR_HANDLE)PolicyHandle, 625 &SidEnumBuffer, 626 (PLSAPR_REFERENCED_DOMAIN_LIST *)ReferencedDomains, 627 &TranslatedNames, 628 LsapLookupWksta, 629 &MappedCount); 630 631 *Names = (PLSA_TRANSLATED_NAME)TranslatedNames.Names; 632 } 633 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 634 { 635 if (TranslatedNames.Names != NULL) 636 { 637 MIDL_user_free(TranslatedNames.Names); 638 } 639 640 Status = I_RpcMapWin32Status(RpcExceptionCode()); 641 } 642 RpcEndExcept; 643 644 return Status; 645 } 646 647 648 /****************************************************************************** 649 * LsaNtStatusToWinError 650 * 651 * PARAMS 652 * Status [I] 653 * 654 * @implemented 655 */ 656 ULONG 657 WINAPI 658 LsaNtStatusToWinError(IN NTSTATUS Status) 659 { 660 TRACE("(%lx)\n", Status); 661 return RtlNtStatusToDosError(Status); 662 } 663 664 665 /* 666 * @implemented 667 */ 668 NTSTATUS 669 WINAPI 670 LsaOpenAccount(IN LSA_HANDLE PolicyHandle, 671 IN PSID AccountSid, 672 IN ULONG Flags, 673 OUT PLSA_HANDLE AccountHandle) 674 { 675 NTSTATUS Status; 676 677 TRACE("(%p,%p,0x%08x,%p)\n", PolicyHandle, AccountSid, Flags, AccountHandle); 678 679 RpcTryExcept 680 { 681 Status = LsarOpenAccount((LSAPR_HANDLE)PolicyHandle, 682 AccountSid, 683 Flags, 684 AccountHandle); 685 } 686 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 687 { 688 Status = I_RpcMapWin32Status(RpcExceptionCode()); 689 } 690 RpcEndExcept; 691 692 return Status; 693 } 694 695 696 /****************************************************************************** 697 * LsaOpenPolicy 698 * 699 * PARAMS 700 * x1 [] 701 * x2 [] 702 * x3 [] 703 * x4 [] 704 * 705 * @implemented 706 */ 707 NTSTATUS 708 WINAPI 709 LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName, 710 IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, 711 IN ACCESS_MASK DesiredAccess, 712 OUT PLSA_HANDLE PolicyHandle) 713 { 714 NTSTATUS Status; 715 716 TRACE("LsaOpenPolicy (%s,%p,0x%08x,%p)\n", 717 SystemName ? debugstr_w(SystemName->Buffer) : "(null)", 718 ObjectAttributes, DesiredAccess, PolicyHandle); 719 720 /* FIXME: RPC should take care of this */ 721 if (!LsapIsLocalComputer(SystemName)) 722 return RPC_NT_SERVER_UNAVAILABLE; 723 724 RpcTryExcept 725 { 726 *PolicyHandle = NULL; 727 728 Status = LsarOpenPolicy(SystemName ? SystemName->Buffer : NULL, 729 (PLSAPR_OBJECT_ATTRIBUTES)ObjectAttributes, 730 DesiredAccess, 731 PolicyHandle); 732 } 733 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 734 { 735 Status = I_RpcMapWin32Status(RpcExceptionCode()); 736 } 737 RpcEndExcept; 738 739 TRACE("LsaOpenPolicy() done (Status: 0x%08lx)\n", Status); 740 741 return Status; 742 } 743 744 745 /* 746 * @implemented 747 */ 748 NTSTATUS 749 WINAPI 750 LsaOpenTrustedDomainByName(IN LSA_HANDLE PolicyHandle, 751 IN PLSA_UNICODE_STRING TrustedDomainName, 752 IN ACCESS_MASK DesiredAccess, 753 OUT PLSA_HANDLE TrustedDomainHandle) 754 { 755 NTSTATUS Status; 756 757 TRACE("(%p,%p,0x%08x,%p)\n", PolicyHandle, TrustedDomainName, 758 DesiredAccess, TrustedDomainHandle); 759 760 RpcTryExcept 761 { 762 Status = LsarOpenTrustedDomainByName((LSAPR_HANDLE)PolicyHandle, 763 (PRPC_UNICODE_STRING)TrustedDomainName, 764 DesiredAccess, 765 TrustedDomainHandle); 766 } 767 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 768 { 769 Status = I_RpcMapWin32Status(RpcExceptionCode()); 770 } 771 RpcEndExcept; 772 773 return Status; 774 } 775 776 777 /* 778 * @unimplemented 779 */ 780 NTSTATUS 781 WINAPI 782 LsaQueryDomainInformationPolicy( 783 LSA_HANDLE PolicyHandle, 784 POLICY_DOMAIN_INFORMATION_CLASS InformationClass, 785 PVOID *Buffer) 786 { 787 FIXME("(%p,0x%08x,%p)\n", PolicyHandle, InformationClass, Buffer); 788 return STATUS_NOT_IMPLEMENTED; 789 } 790 791 792 /* 793 * @unimplemented 794 */ 795 NTSTATUS 796 WINAPI 797 LsaQueryForestTrustInformation( 798 LSA_HANDLE PolicyHandle, 799 PLSA_UNICODE_STRING TrustedDomainName, 800 PLSA_FOREST_TRUST_INFORMATION * ForestTrustInfo) 801 { 802 FIXME("(%p,%p,%p) stub\n", PolicyHandle, TrustedDomainName, ForestTrustInfo); 803 return STATUS_NOT_IMPLEMENTED; 804 } 805 806 807 /* 808 * @implemented 809 */ 810 NTSTATUS 811 WINAPI 812 LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, 813 IN POLICY_INFORMATION_CLASS InformationClass, 814 OUT PVOID *Buffer) 815 { 816 PLSAPR_POLICY_INFORMATION PolicyInformation = NULL; 817 NTSTATUS Status; 818 819 TRACE("(%p,0x%08x,%p)\n", PolicyHandle, InformationClass, Buffer); 820 821 RpcTryExcept 822 { 823 Status = LsarQueryInformationPolicy((LSAPR_HANDLE)PolicyHandle, 824 InformationClass, 825 &PolicyInformation); 826 *Buffer = PolicyInformation; 827 } 828 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 829 { 830 if (PolicyInformation != NULL) 831 MIDL_user_free(PolicyInformation); 832 833 Status = I_RpcMapWin32Status(RpcExceptionCode()); 834 } 835 RpcEndExcept; 836 837 TRACE("Done (Status: 0x%08x)\n", Status); 838 839 return Status; 840 } 841 842 843 /* 844 * @unimplemented 845 */ 846 NTSTATUS 847 WINAPI 848 LsaQueryTrustedDomainInfo( 849 LSA_HANDLE PolicyHandle, 850 PSID TrustedDomainSid, 851 TRUSTED_INFORMATION_CLASS InformationClass, 852 PVOID *Buffer) 853 { 854 FIXME("(%p,%p,%d,%p) stub\n", PolicyHandle, TrustedDomainSid, InformationClass, Buffer); 855 return STATUS_OBJECT_NAME_NOT_FOUND; 856 } 857 858 859 /* 860 * @implemented 861 */ 862 NTSTATUS 863 WINAPI 864 LsaQueryTrustedDomainInfoByName(IN LSA_HANDLE PolicyHandle, 865 IN PLSA_UNICODE_STRING TrustedDomainName, 866 IN TRUSTED_INFORMATION_CLASS InformationClass, 867 OUT PVOID *Buffer) 868 { 869 NTSTATUS Status; 870 871 TRACE("(%p,%p,%d,%p)\n", PolicyHandle, TrustedDomainName, InformationClass, Buffer); 872 873 if (InformationClass == TrustedDomainAuthInformationInternal || 874 InformationClass == TrustedDomainFullInformationInternal) 875 return STATUS_INVALID_INFO_CLASS; 876 877 RpcTryExcept 878 { 879 Status = LsarQueryTrustedDomainInfoByName((LSAPR_HANDLE)PolicyHandle, 880 (PRPC_UNICODE_STRING)TrustedDomainName, 881 InformationClass, 882 (unsigned long *)Buffer); // Shuld be: (PLSAPR_POLICY_INFORMATION *)Buffer 883 } 884 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 885 { 886 Status = I_RpcMapWin32Status(RpcExceptionCode()); 887 } 888 RpcEndExcept; 889 890 return Status; 891 } 892 893 894 /* 895 * @implemented 896 */ 897 NTSTATUS 898 WINAPI 899 LsaRemoveAccountRights(IN LSA_HANDLE PolicyHandle, 900 IN PSID AccountSid, 901 IN BOOLEAN AllRights, 902 IN PLSA_UNICODE_STRING UserRights, 903 IN ULONG CountOfRights) 904 { 905 LSAPR_USER_RIGHT_SET UserRightSet; 906 907 TRACE("(%p,%p,%d,%p,0x%08x) stub\n", PolicyHandle, AccountSid, AllRights, UserRights, CountOfRights); 908 909 UserRightSet.Entries = CountOfRights; 910 UserRightSet.UserRights = (PRPC_UNICODE_STRING)UserRights; 911 912 RpcTryExcept 913 { 914 LsarRemoveAccountRights((LSAPR_HANDLE)PolicyHandle, 915 (PRPC_SID)AccountSid, 916 AllRights, 917 &UserRightSet); 918 } 919 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 920 { 921 I_RpcMapWin32Status(RpcExceptionCode()); 922 } 923 RpcEndExcept; 924 925 return STATUS_SUCCESS; 926 } 927 928 929 /* 930 * @unimplemented 931 */ 932 NTSTATUS 933 WINAPI 934 LsaRetrievePrivateData( 935 LSA_HANDLE PolicyHandle, 936 PLSA_UNICODE_STRING KeyName, 937 PLSA_UNICODE_STRING *PrivateData) 938 { 939 FIXME("(%p,%p,%p) stub\n", PolicyHandle, KeyName, PrivateData); 940 return STATUS_OBJECT_NAME_NOT_FOUND; 941 } 942 943 /* 944 * @unimplemented 945 */ 946 NTSTATUS 947 WINAPI 948 LsaSetDomainInformationPolicy( 949 LSA_HANDLE PolicyHandle, 950 POLICY_DOMAIN_INFORMATION_CLASS InformationClass, 951 PVOID Buffer) 952 { 953 FIXME("(%p,0x%08x,%p) stub\n", PolicyHandle, InformationClass, Buffer); 954 return STATUS_UNSUCCESSFUL; 955 } 956 957 958 /* 959 * @implemented 960 */ 961 NTSTATUS 962 WINAPI 963 LsaSetInformationPolicy(IN LSA_HANDLE PolicyHandle, 964 IN POLICY_INFORMATION_CLASS InformationClass, 965 IN PVOID Buffer) 966 { 967 NTSTATUS Status; 968 969 TRACE("(%p,0x%08x,%p)\n", PolicyHandle, InformationClass, Buffer); 970 971 RpcTryExcept 972 { 973 Status = LsarSetInformationPolicy((LSAPR_HANDLE)PolicyHandle, 974 InformationClass, 975 (PLSAPR_POLICY_INFORMATION)Buffer); 976 } 977 RpcExcept(EXCEPTION_EXECUTE_HANDLER) 978 { 979 Status = I_RpcMapWin32Status(RpcExceptionCode()); 980 } 981 RpcEndExcept; 982 983 return Status; 984 } 985 986 987 /* 988 * @unimplemented 989 */ 990 NTSTATUS WINAPI LsaSetSecret( 991 IN LSA_HANDLE SecretHandle, 992 IN PLSA_UNICODE_STRING EncryptedCurrentValue, 993 IN PLSA_UNICODE_STRING EncryptedOldValue) 994 { 995 FIXME("(%p,%p,%p) stub\n", SecretHandle, EncryptedCurrentValue, 996 EncryptedOldValue); 997 return STATUS_SUCCESS; 998 } 999 1000 /* 1001 * @unimplemented 1002 */ 1003 NTSTATUS 1004 WINAPI 1005 LsaSetForestTrustInformation( 1006 LSA_HANDLE PolicyHandle, 1007 PLSA_UNICODE_STRING TrustedDomainName, 1008 PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo, 1009 BOOL CheckOnly, 1010 PLSA_FOREST_TRUST_COLLISION_INFORMATION *CollisionInfo) 1011 { 1012 FIXME("(%p,%p,%p,%d,%p) stub\n", PolicyHandle, TrustedDomainName, ForestTrustInfo, CheckOnly, CollisionInfo); 1013 return STATUS_NOT_IMPLEMENTED; 1014 } 1015 1016 /* 1017 * @unimplemented 1018 */ 1019 NTSTATUS 1020 WINAPI 1021 LsaSetTrustedDomainInfoByName( 1022 LSA_HANDLE PolicyHandle, 1023 PLSA_UNICODE_STRING TrustedDomainName, 1024 TRUSTED_INFORMATION_CLASS InformationClass, 1025 PVOID Buffer) 1026 { 1027 FIXME("(%p,%p,%d,%p) stub\n", PolicyHandle, TrustedDomainName, InformationClass, Buffer); 1028 return STATUS_SUCCESS; 1029 } 1030 1031 /* 1032 * @unimplemented 1033 */ 1034 NTSTATUS WINAPI LsaRegisterPolicyChangeNotification( 1035 POLICY_NOTIFICATION_INFORMATION_CLASS class, 1036 HANDLE event) 1037 { 1038 FIXME("(%d,%p) stub\n", class, event); 1039 return STATUS_UNSUCCESSFUL; 1040 } 1041 1042 /* 1043 * @unimplemented 1044 */ 1045 NTSTATUS 1046 WINAPI 1047 LsaSetTrustedDomainInformation( 1048 LSA_HANDLE PolicyHandle, 1049 PSID TrustedDomainSid, 1050 TRUSTED_INFORMATION_CLASS InformationClass, 1051 PVOID Buffer) 1052 { 1053 FIXME("(%p,%p,%d,%p) stub\n", PolicyHandle, TrustedDomainSid, InformationClass, Buffer); 1054 return STATUS_SUCCESS; 1055 } 1056 1057 /* 1058 * @unimplemented 1059 */ 1060 NTSTATUS 1061 WINAPI 1062 LsaStorePrivateData( 1063 LSA_HANDLE PolicyHandle, 1064 PLSA_UNICODE_STRING KeyName, 1065 PLSA_UNICODE_STRING PrivateData) 1066 { 1067 FIXME("(%p,%p,%p) stub\n", PolicyHandle, KeyName, PrivateData); 1068 return STATUS_OBJECT_NAME_NOT_FOUND; 1069 } 1070 1071 /* 1072 * @unimplemented 1073 */ 1074 NTSTATUS WINAPI LsaUnregisterPolicyChangeNotification( 1075 POLICY_NOTIFICATION_INFORMATION_CLASS class, 1076 HANDLE event) 1077 { 1078 FIXME("(%d,%p) stub\n", class, event); 1079 return STATUS_SUCCESS; 1080 } 1081 1082 /* 1083 * @unimplemented 1084 */ 1085 NTSTATUS 1086 WINAPI 1087 LsaGetUserName( 1088 PUNICODE_STRING *UserName, 1089 PUNICODE_STRING *DomainName) 1090 { 1091 FIXME("(%p,%p) stub\n", UserName, DomainName); 1092 return STATUS_NOT_IMPLEMENTED; 1093 } 1094 1095 /* 1096 * @unimplemented 1097 */ 1098 NTSTATUS 1099 WINAPI 1100 LsaQueryInfoTrustedDomain (DWORD Unknonw0, 1101 DWORD Unknonw1, 1102 DWORD Unknonw2) 1103 { 1104 FIXME("(%d,%d,%d) stub\n", Unknonw0, Unknonw1, Unknonw2); 1105 return STATUS_NOT_IMPLEMENTED; 1106 } 1107 1108 1109 /* EOF */ 1110