wined3d: Test and fix ddraw and d3d9 GetDC differences.
[wine] / dlls / advapi32 / lsa.c
1 /*
2  * Implementation of the Local Security Authority API
3  *
4  * Copyright 1999 Juergen Schmied
5  * Copyright 2002 Andriy Palamarchuk
6  * Copyright 2004 Mike McCormack
7  * Copyright 2005 Hans Leidekker
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23
24 #include <stdarg.h>
25
26 #include "ntstatus.h"
27 #define WIN32_NO_STATUS
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winreg.h"
31 #include "winternl.h"
32 #include "ntsecapi.h"
33 #include "advapi32_misc.h"
34
35 #include "wine/debug.h"
36
37 WINE_DEFAULT_DEBUG_CHANNEL(advapi);
38
39 #define ADVAPI_ForceLocalComputer(ServerName, FailureCode) \
40     if (!ADVAPI_IsLocalComputer(ServerName)) \
41 { \
42         FIXME("Action Implemented for local computer only. " \
43               "Requested for server %s\n", debugstr_w(ServerName)); \
44         return FailureCode; \
45 }
46
47 static void dumpLsaAttributes(const LSA_OBJECT_ATTRIBUTES *oa)
48 {
49     if (oa)
50     {
51         TRACE("\n\tlength=%u, rootdir=%p, objectname=%s\n\tattr=0x%08x, sid=%s qos=%p\n",
52               oa->Length, oa->RootDirectory,
53               oa->ObjectName?debugstr_w(oa->ObjectName->Buffer):"null",
54               oa->Attributes, debugstr_sid(oa->SecurityDescriptor),
55               oa->SecurityQualityOfService);
56     }
57 }
58
59 static void* ADVAPI_GetDomainName(unsigned sz, unsigned ofs)
60 {
61     HKEY key;
62     LONG ret;
63     BYTE* ptr = NULL;
64     UNICODE_STRING* ustr;
65
66     static const WCHAR wVNETSUP[] = {
67         'S','y','s','t','e','m','\\',
68         'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
69         'S','e','r','v','i','c','e','s','\\',
70         'V','x','D','\\','V','N','E','T','S','U','P','\0'};
71
72     ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, wVNETSUP, 0, KEY_READ, &key);
73     if (ret == ERROR_SUCCESS)
74     {
75         DWORD size = 0;
76         static const WCHAR wg[] = { 'W','o','r','k','g','r','o','u','p',0 };
77
78         ret = RegQueryValueExW(key, wg, NULL, NULL, NULL, &size);
79         if (ret == ERROR_MORE_DATA || ret == ERROR_SUCCESS)
80         {
81             ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sz + size);
82             if (!ptr) return NULL;
83             ustr = (UNICODE_STRING*)(ptr + ofs);
84             ustr->MaximumLength = size;
85             ustr->Buffer = (WCHAR*)(ptr + sz);
86             ret = RegQueryValueExW(key, wg, NULL, NULL, (LPBYTE)ustr->Buffer, &size);
87             if (ret != ERROR_SUCCESS)
88             {
89                 HeapFree(GetProcessHeap(), 0, ptr);
90                 ptr = NULL;
91             }   
92             else ustr->Length = size - sizeof(WCHAR);
93         }
94         RegCloseKey(key);
95     }
96     if (!ptr)
97     {
98         static const WCHAR wDomain[] = {'D','O','M','A','I','N','\0'};
99         ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
100                         sz + sizeof(wDomain));
101         if (!ptr) return NULL;
102         ustr = (UNICODE_STRING*)(ptr + ofs);
103         ustr->MaximumLength = sizeof(wDomain);
104         ustr->Buffer = (WCHAR*)(ptr + sz);
105         ustr->Length = sizeof(wDomain) - sizeof(WCHAR);
106         memcpy(ustr->Buffer, wDomain, sizeof(wDomain));
107     }
108     return ptr;
109 }
110
111 /******************************************************************************
112  * LsaAddAccountRights [ADVAPI32.@]
113  *
114  */
115 NTSTATUS WINAPI LsaAddAccountRights(
116     LSA_HANDLE policy,
117     PSID sid,
118     PLSA_UNICODE_STRING rights,
119     ULONG count)
120 {
121     FIXME("(%p,%p,%p,0x%08x) stub\n", policy, sid, rights, count);
122     return STATUS_OBJECT_NAME_NOT_FOUND;
123 }
124
125 /******************************************************************************
126  * LsaClose [ADVAPI32.@]
127  *
128  * Closes a handle to a Policy or TrustedDomain.
129  *
130  * PARAMS
131  *  ObjectHandle [I] Handle to a Policy or TrustedDomain.
132  *
133  * RETURNS
134  *  Success: STATUS_SUCCESS.
135  *  Failure: NTSTATUS code.
136  */
137 NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
138 {
139     FIXME("(%p) stub\n", ObjectHandle);
140     return STATUS_SUCCESS;
141 }
142
143 /******************************************************************************
144  * LsaCreateTrustedDomainEx [ADVAPI32.@]
145  *
146  */
147 NTSTATUS WINAPI LsaCreateTrustedDomainEx(
148     LSA_HANDLE policy,
149     PTRUSTED_DOMAIN_INFORMATION_EX domain_info,
150     PTRUSTED_DOMAIN_AUTH_INFORMATION auth_info,
151     ACCESS_MASK access,
152     PLSA_HANDLE domain)
153 {
154     FIXME("(%p,%p,%p,0x%08x,%p) stub\n", policy, domain_info, auth_info,
155           access, domain);
156     return STATUS_SUCCESS;
157 }
158
159 /******************************************************************************
160  * LsaDeleteTrustedDomain [ADVAPI32.@]
161  *
162  */
163 NTSTATUS WINAPI LsaDeleteTrustedDomain(LSA_HANDLE policy, PSID sid)
164 {
165     FIXME("(%p,%p) stub\n", policy, sid);
166     return STATUS_SUCCESS;
167 }
168
169 /******************************************************************************
170  * LsaEnumerateAccountRights [ADVAPI32.@]
171  *
172  */
173 NTSTATUS WINAPI LsaEnumerateAccountRights(
174     LSA_HANDLE policy,
175     PSID sid,
176     PLSA_UNICODE_STRING *rights,
177     PULONG count)
178 {
179     FIXME("(%p,%p,%p,%p) stub\n", policy, sid, rights, count);
180     *rights = 0;
181     *count = 0;
182     return STATUS_OBJECT_NAME_NOT_FOUND;
183 }
184
185 /******************************************************************************
186  * LsaEnumerateAccountsWithUserRight [ADVAPI32.@]
187  *
188  */
189 NTSTATUS WINAPI LsaEnumerateAccountsWithUserRight(
190     LSA_HANDLE policy,
191     PLSA_UNICODE_STRING rights,
192     PVOID *buffer,
193     PULONG count)
194 {
195     FIXME("(%p,%p,%p,%p) stub\n", policy, rights, buffer, count);
196     return STATUS_NO_MORE_ENTRIES;
197 }
198
199 /******************************************************************************
200  * LsaEnumerateTrustedDomains [ADVAPI32.@]
201  *
202  * Returns the names and SIDs of trusted domains.
203  *
204  * PARAMS
205  *  PolicyHandle          [I] Handle to a Policy object.
206  *  EnumerationContext    [I] Pointer to an enumeration handle.
207  *  Buffer                [O] Contains the names and SIDs of trusted domains.
208  *  PreferredMaximumLength[I] Preferred maximum size in bytes of Buffer.
209  *  CountReturned         [O] Number of elements in Buffer.
210  *
211  * RETURNS
212  *  Success: STATUS_SUCCESS,
213  *           STATUS_MORE_ENTRIES,
214  *           STATUS_NO_MORE_ENTRIES
215  *  Failure: NTSTATUS code.
216  *
217  * NOTES
218  *  LsaEnumerateTrustedDomains can be called multiple times to enumerate
219  *  all trusted domains.
220  */
221 NTSTATUS WINAPI LsaEnumerateTrustedDomains(
222     IN LSA_HANDLE PolicyHandle,
223     IN PLSA_ENUMERATION_HANDLE EnumerationContext,
224     OUT PVOID* Buffer,
225     IN ULONG PreferredMaximumLength,
226     OUT PULONG CountReturned)
227 {
228     FIXME("(%p,%p,%p,0x%08x,%p) stub\n", PolicyHandle, EnumerationContext,
229           Buffer, PreferredMaximumLength, CountReturned);
230
231     if (CountReturned) *CountReturned = 0;
232     return STATUS_SUCCESS;
233 }
234
235 /******************************************************************************
236  * LsaEnumerateTrustedDomainsEx [ADVAPI32.@]
237  *
238  */
239 NTSTATUS WINAPI LsaEnumerateTrustedDomainsEx(
240     LSA_HANDLE policy,
241     PLSA_ENUMERATION_HANDLE context,
242     PVOID *buffer,
243     ULONG length,
244     PULONG count)
245 {
246     FIXME("(%p,%p,%p,0x%08x,%p) stub\n", policy, context, buffer, length, count);
247
248     if (count) *count = 0;
249     return STATUS_SUCCESS;
250 }
251
252 /******************************************************************************
253  * LsaFreeMemory [ADVAPI32.@]
254  *
255  * Frees memory allocated by a LSA function.
256  *
257  * PARAMS
258  *  Buffer [I] Memory buffer to free.
259  *
260  * RETURNS
261  *  Success: STATUS_SUCCESS.
262  *  Failure: NTSTATUS code.
263  */
264 NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
265 {
266     TRACE("(%p)\n", Buffer);
267
268     HeapFree(GetProcessHeap(), 0, Buffer);
269     return STATUS_SUCCESS;
270 }
271
272 /******************************************************************************
273  * LsaLookupNames [ADVAPI32.@]
274  *
275  * Returns the SIDs of an array of user, group, or local group names.
276  *
277  * PARAMS
278  *  PolicyHandle      [I] Handle to a Policy object.
279  *  Count             [I] Number of names in Names.
280  *  Names             [I] Array of names to lookup.
281  *  ReferencedDomains [O] Array of domains where the names were found.
282  *  Sids              [O] Array of SIDs corresponding to Names.
283  *
284  * RETURNS
285  *  Success: STATUS_SUCCESS,
286  *           STATUS_SOME_NOT_MAPPED
287  *  Failure: STATUS_NONE_MAPPED or NTSTATUS code.
288  */
289 NTSTATUS WINAPI LsaLookupNames(
290     IN LSA_HANDLE PolicyHandle,
291     IN ULONG Count,
292     IN PLSA_UNICODE_STRING Names,
293     OUT PLSA_REFERENCED_DOMAIN_LIST* ReferencedDomains,
294     OUT PLSA_TRANSLATED_SID* Sids)
295 {
296     FIXME("(%p,0x%08x,%p,%p,%p) stub\n", PolicyHandle, Count, Names,
297           ReferencedDomains, Sids);
298
299     return STATUS_NONE_MAPPED;
300 }
301
302 static BOOL lookup_name( LSA_UNICODE_STRING *name, SID *sid, DWORD *sid_size, WCHAR *domain,
303                          DWORD *domain_size, SID_NAME_USE *use, BOOL *handled )
304 {
305     BOOL ret;
306
307     ret = lookup_local_wellknown_name( name, sid, sid_size, domain, domain_size, use, handled );
308     if (!*handled)
309         ret = lookup_local_user_name( name, sid, sid_size, domain, domain_size, use, handled );
310
311     return ret;
312 }
313
314 /******************************************************************************
315  * LsaLookupNames2 [ADVAPI32.@]
316  *
317  */
318 NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
319                                  PLSA_UNICODE_STRING names, PLSA_REFERENCED_DOMAIN_LIST *domains,
320                                  PLSA_TRANSLATED_SID2 *sids )
321 {
322     ULONG i, sid_size_total = 0, domain_size_total = 0, size, num_domains;
323     ULONG sid_size, domain_size, mapped;
324     BOOL ret, handled = FALSE;
325     SID_NAME_USE use;
326     SID *sid;
327
328     TRACE("(%p,0x%08x,0x%08x,%p,%p,%p)\n", policy, flags, count, names, domains, sids);
329
330     mapped = num_domains = 0;
331     for (i = 0; i < count; i++)
332     {
333         handled = FALSE;
334         sid_size = domain_size = 0;
335         ret = lookup_name( &names[i], NULL, &sid_size, NULL, &domain_size, &use, &handled );
336         if (handled)
337         {
338             sid_size_total += sid_size;
339             if (domain_size)
340             {
341                 FIXME("domain not handled\n");
342                 domain_size_total += domain_size;
343                 num_domains++;
344             }
345             mapped++;
346         }
347     }
348     TRACE("mapped %u out of %u\n", mapped, count);
349
350     size = sizeof(LSA_TRANSLATED_SID2) * count + sid_size_total;
351     if (!(*sids = HeapAlloc( GetProcessHeap(), 0, size) )) return STATUS_NO_MEMORY;
352
353     sid = (SID *)(*sids + count);
354
355     if (!(*domains = HeapAlloc( GetProcessHeap(), 0, sizeof(LSA_REFERENCED_DOMAIN_LIST) )))
356     {
357         HeapFree( GetProcessHeap(), 0, *sids );
358         return STATUS_NO_MEMORY;
359     }
360     (*domains)->Entries = 0;
361     (*domains)->Domains = NULL;
362
363     for (i = 0; i < count; i++)
364     {
365         (*sids)[i].Use = SidTypeUnknown;
366         (*sids)[i].DomainIndex = -1;
367         (*sids)[i].Flags = 0;
368
369         handled = FALSE;
370         sid_size = sid_size_total;
371         ret = lookup_name( &names[i], sid, &sid_size, NULL, &domain_size, &use, &handled );
372         if (handled)
373         {
374             (*sids)[i].Sid = sid;
375             (*sids)[i].Use = use;
376
377             sid += sid_size;
378             sid_size_total -= sid_size;
379         }
380     }
381
382     if (mapped == count) return STATUS_SUCCESS;
383     if (mapped > 0 && mapped < count) return STATUS_SOME_NOT_MAPPED;
384     return STATUS_NONE_MAPPED;
385 }
386
387 /******************************************************************************
388  * LsaLookupSids [ADVAPI32.@]
389  *
390  * Looks up the names that correspond to an array of SIDs.
391  *
392  * PARAMS
393  *  PolicyHandle      [I] Handle to a Policy object.
394  *  Count             [I] Number of SIDs in the Sids array.
395  *  Sids              [I] Array of SIDs to lookup.
396  *  ReferencedDomains [O] Array of domains where the sids were found.
397  *  Names             [O] Array of names corresponding to Sids.
398  *
399  * RETURNS
400  *  Success: STATUS_SUCCESS,
401  *           STATUS_SOME_NOT_MAPPED
402  *  Failure: STATUS_NONE_MAPPED or NTSTATUS code.
403  */
404 NTSTATUS WINAPI LsaLookupSids(
405     IN LSA_HANDLE PolicyHandle,
406     IN ULONG Count,
407     IN PSID *Sids,
408     OUT PLSA_REFERENCED_DOMAIN_LIST *ReferencedDomains,
409     OUT PLSA_TRANSLATED_NAME *Names )
410 {
411     FIXME("(%p,%u,%p,%p,%p) stub\n", PolicyHandle, Count, Sids,
412           ReferencedDomains, Names);
413
414     return STATUS_NONE_MAPPED;
415 }
416
417 /******************************************************************************
418  * LsaNtStatusToWinError [ADVAPI32.@]
419  *
420  * Converts an LSA NTSTATUS code to a Windows error code.
421  *
422  * PARAMS
423  *  Status [I] NTSTATUS code.
424  *
425  * RETURNS
426  *  Success: Corresponding Windows error code.
427  *  Failure: ERROR_MR_MID_NOT_FOUND.
428  */
429 ULONG WINAPI LsaNtStatusToWinError(NTSTATUS Status)
430 {
431     return RtlNtStatusToDosError(Status);
432 }
433
434 /******************************************************************************
435  * LsaOpenPolicy [ADVAPI32.@]
436  *
437  * Opens a handle to the Policy object on a local or remote system.
438  *
439  * PARAMS
440  *  SystemName       [I] Name of the target system.
441  *  ObjectAttributes [I] Connection attributes.
442  *  DesiredAccess    [I] Requested access rights.
443  *  PolicyHandle     [I/O] Handle to the Policy object.
444  *
445  * RETURNS
446  *  Success: STATUS_SUCCESS.
447  *  Failure: NTSTATUS code.
448  *
449  * NOTES
450  *  Set SystemName to NULL to open the local Policy object.
451  */
452 NTSTATUS WINAPI LsaOpenPolicy(
453     IN PLSA_UNICODE_STRING SystemName,
454     IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
455     IN ACCESS_MASK DesiredAccess,
456     IN OUT PLSA_HANDLE PolicyHandle)
457 {
458     FIXME("(%s,%p,0x%08x,%p) stub\n",
459           SystemName?debugstr_w(SystemName->Buffer):"(null)",
460           ObjectAttributes, DesiredAccess, PolicyHandle);
461
462     ADVAPI_ForceLocalComputer(SystemName ? SystemName->Buffer : NULL,
463                               STATUS_ACCESS_VIOLATION);
464     dumpLsaAttributes(ObjectAttributes);
465
466     if(PolicyHandle) *PolicyHandle = (LSA_HANDLE)0xcafe;
467     return STATUS_SUCCESS;
468 }
469
470 /******************************************************************************
471  * LsaOpenTrustedDomainByName [ADVAPI32.@]
472  *
473  */
474 NTSTATUS WINAPI LsaOpenTrustedDomainByName(
475     LSA_HANDLE policy,
476     PLSA_UNICODE_STRING name,
477     ACCESS_MASK access,
478     PLSA_HANDLE handle)
479 {
480     FIXME("(%p,%p,0x%08x,%p) stub\n", policy, name, access, handle);
481     return STATUS_OBJECT_NAME_NOT_FOUND;
482 }
483
484 /******************************************************************************
485  * LsaQueryInformationPolicy [ADVAPI32.@]
486  *
487  * Returns information about a Policy object.
488  *
489  * PARAMS
490  *  PolicyHandle     [I] Handle to a Policy object.
491  *  InformationClass [I] Type of information to retrieve.
492  *  Buffer           [O] Pointer to the requested information.
493  *
494  * RETURNS
495  *  Success: STATUS_SUCCESS.
496  *  Failure: NTSTATUS code.
497  */
498 NTSTATUS WINAPI LsaQueryInformationPolicy(
499     IN LSA_HANDLE PolicyHandle,
500     IN POLICY_INFORMATION_CLASS InformationClass,
501     OUT PVOID *Buffer)
502 {
503     TRACE("(%p,0x%08x,%p)\n", PolicyHandle, InformationClass, Buffer);
504
505     if(!Buffer) return STATUS_INVALID_PARAMETER;
506     switch (InformationClass)
507     {
508         case PolicyAuditEventsInformation: /* 2 */
509         {
510             PPOLICY_AUDIT_EVENTS_INFO p = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
511                                                     sizeof(POLICY_AUDIT_EVENTS_INFO));
512             p->AuditingMode = FALSE; /* no auditing */
513             *Buffer = p;
514         }
515         break;
516         case PolicyPrimaryDomainInformation: /* 3 */
517         {
518             /* Only the domain name is valid for the local computer.
519              * All other fields are zero.
520              */
521             PPOLICY_PRIMARY_DOMAIN_INFO pinfo;
522
523             pinfo = ADVAPI_GetDomainName(sizeof(*pinfo), offsetof(POLICY_PRIMARY_DOMAIN_INFO, Name));
524
525             TRACE("setting domain to %s\n", debugstr_w(pinfo->Name.Buffer));
526
527             *Buffer = pinfo;
528         }
529         break;
530         case PolicyAccountDomainInformation: /* 5 */
531         {
532             struct di
533             {
534                 POLICY_ACCOUNT_DOMAIN_INFO info;
535                 SID sid;
536                 DWORD padding[3];
537                 WCHAR domain[MAX_COMPUTERNAME_LENGTH + 1];
538             };
539
540             DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
541             struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*xdi));
542
543             xdi->info.DomainName.MaximumLength = dwSize * sizeof(WCHAR);
544             xdi->info.DomainName.Buffer = xdi->domain;
545             if (GetComputerNameW(xdi->info.DomainName.Buffer, &dwSize))
546                 xdi->info.DomainName.Length = dwSize * sizeof(WCHAR);
547
548             TRACE("setting name to %s\n", debugstr_w(xdi->info.DomainName.Buffer));
549
550             xdi->info.DomainSid = &xdi->sid;
551
552             /* read the computer SID from the registry */
553             if (!ADVAPI_GetComputerSid(&xdi->sid))
554             {
555                 HeapFree(GetProcessHeap(), 0, xdi);
556
557                 WARN("Computer SID not found\n");
558
559                 return STATUS_UNSUCCESSFUL;
560             }
561
562             TRACE("setting SID to %s\n", debugstr_sid(&xdi->sid));
563
564             *Buffer = xdi;
565         }
566         break;
567         case  PolicyDnsDomainInformation:       /* 12 (0xc) */
568         {
569             /* Only the domain name is valid for the local computer.
570              * All other fields are zero.
571              */
572             PPOLICY_DNS_DOMAIN_INFO pinfo;
573
574             pinfo = ADVAPI_GetDomainName(sizeof(*pinfo), offsetof(POLICY_DNS_DOMAIN_INFO, Name));
575
576             TRACE("setting domain to %s\n", debugstr_w(pinfo->Name.Buffer));
577
578             *Buffer = pinfo;
579         }
580         break;
581         case  PolicyAuditLogInformation:
582         case  PolicyPdAccountInformation:
583         case  PolicyLsaServerRoleInformation:
584         case  PolicyReplicaSourceInformation:
585         case  PolicyDefaultQuotaInformation:
586         case  PolicyModificationInformation:
587         case  PolicyAuditFullSetInformation:
588         case  PolicyAuditFullQueryInformation:
589         {
590             FIXME("category %d not implemented\n", InformationClass);
591             return STATUS_UNSUCCESSFUL;
592         }
593     }
594     return STATUS_SUCCESS;
595 }
596
597 /******************************************************************************
598  * LsaQueryTrustedDomainInfo [ADVAPI32.@]
599  *
600  */
601 NTSTATUS WINAPI LsaQueryTrustedDomainInfo(
602     LSA_HANDLE policy,
603     PSID sid,
604     TRUSTED_INFORMATION_CLASS class,
605     PVOID *buffer)
606 {
607     FIXME("(%p,%p,%d,%p) stub\n", policy, sid, class, buffer);
608     return STATUS_OBJECT_NAME_NOT_FOUND;
609 }
610
611 /******************************************************************************
612  * LsaQueryTrustedDomainInfoByName [ADVAPI32.@]
613  *
614  */
615 NTSTATUS WINAPI LsaQueryTrustedDomainInfoByName(
616     LSA_HANDLE policy,
617     PLSA_UNICODE_STRING name,
618     TRUSTED_INFORMATION_CLASS class,
619     PVOID *buffer)
620 {
621     FIXME("(%p,%p,%d,%p) stub\n", policy, name, class, buffer);
622     return STATUS_OBJECT_NAME_NOT_FOUND;
623 }
624
625 /******************************************************************************
626  * LsaRegisterPolicyChangeNotification [ADVAPI32.@]
627  *
628  */
629 NTSTATUS WINAPI LsaRegisterPolicyChangeNotification(
630     POLICY_NOTIFICATION_INFORMATION_CLASS class,
631     HANDLE event)
632 {
633     FIXME("(%d,%p) stub\n", class, event);
634     return STATUS_UNSUCCESSFUL;
635 }
636
637 /******************************************************************************
638  * LsaRemoveAccountRights [ADVAPI32.@]
639  *
640  */
641 NTSTATUS WINAPI LsaRemoveAccountRights(
642     LSA_HANDLE policy,
643     PSID sid,
644     BOOLEAN all,
645     PLSA_UNICODE_STRING rights,
646     ULONG count)
647 {
648     FIXME("(%p,%p,%d,%p,0x%08x) stub\n", policy, sid, all, rights, count);
649     return STATUS_SUCCESS;
650 }
651
652 /******************************************************************************
653  * LsaRetrievePrivateData [ADVAPI32.@]
654  *
655  * Retrieves data stored by LsaStorePrivateData.
656  *
657  * PARAMS
658  *  PolicyHandle [I] Handle to a Policy object.
659  *  KeyName      [I] Name of the key where the data is stored.
660  *  PrivateData  [O] Pointer to the private data.
661  *
662  * RETURNS
663  *  Success: STATUS_SUCCESS.
664  *  Failure: STATUS_OBJECT_NAME_NOT_FOUND or NTSTATUS code.
665  */
666 NTSTATUS WINAPI LsaRetrievePrivateData(
667     IN LSA_HANDLE PolicyHandle,
668     IN PLSA_UNICODE_STRING KeyName,
669     OUT PLSA_UNICODE_STRING* PrivateData)
670 {
671     FIXME("(%p,%p,%p) stub\n", PolicyHandle, KeyName, PrivateData);
672     return STATUS_OBJECT_NAME_NOT_FOUND;
673 }
674
675 /******************************************************************************
676  * LsaSetInformationPolicy [ADVAPI32.@]
677  *
678  * Modifies information in a Policy object.
679  *
680  * PARAMS
681  *  PolicyHandle     [I] Handle to a Policy object.
682  *  InformationClass [I] Type of information to set.
683  *  Buffer           [I] Pointer to the information to set.
684  *
685  * RETURNS
686  *  Success: STATUS_SUCCESS.
687  *  Failure: NTSTATUS code.
688  */
689 NTSTATUS WINAPI LsaSetInformationPolicy(
690     IN LSA_HANDLE PolicyHandle,
691     IN POLICY_INFORMATION_CLASS InformationClass,
692     IN PVOID Buffer)
693 {
694     FIXME("(%p,0x%08x,%p) stub\n", PolicyHandle, InformationClass, Buffer);
695
696     return STATUS_UNSUCCESSFUL;
697 }
698
699 /******************************************************************************
700  * LsaSetSecret [ADVAPI32.@]
701  *
702  * Set old and new values on a secret handle
703  *
704  * PARAMS
705  *  SecretHandle          [I] Handle to a secret object.
706  *  EncryptedCurrentValue [I] Pointer to encrypted new value, can be NULL
707  *  EncryptedOldValue     [I] Pointer to encrypted old value, can be NULL
708  *
709  * RETURNS
710  *  Success: STATUS_SUCCESS
711  *  Failure: NTSTATUS code.
712  */
713 NTSTATUS WINAPI LsaSetSecret(
714     IN LSA_HANDLE SecretHandle,
715     IN PLSA_UNICODE_STRING EncryptedCurrentValue,
716     IN PLSA_UNICODE_STRING EncryptedOldValue)
717 {
718     FIXME("(%p,%p,%p) stub\n", SecretHandle, EncryptedCurrentValue,
719             EncryptedOldValue);
720     return STATUS_SUCCESS;
721 }
722
723 /******************************************************************************
724  * LsaSetTrustedDomainInfoByName [ADVAPI32.@]
725  *
726  */
727 NTSTATUS WINAPI LsaSetTrustedDomainInfoByName(
728     LSA_HANDLE policy,
729     PLSA_UNICODE_STRING name,
730     TRUSTED_INFORMATION_CLASS class,
731     PVOID buffer)
732 {
733     FIXME("(%p,%p,%d,%p) stub\n", policy, name, class, buffer);
734     return STATUS_SUCCESS;
735 }
736
737 /******************************************************************************
738  * LsaSetTrustedDomainInformation [ADVAPI32.@]
739  *
740  */
741 NTSTATUS WINAPI LsaSetTrustedDomainInformation(
742     LSA_HANDLE policy,
743     PSID sid,
744     TRUSTED_INFORMATION_CLASS class,
745     PVOID buffer)
746 {
747     FIXME("(%p,%p,%d,%p) stub\n", policy, sid, class, buffer);
748     return STATUS_SUCCESS;
749 }
750
751 /******************************************************************************
752  * LsaStorePrivateData [ADVAPI32.@]
753  *
754  * Stores or deletes a Policy object's data under the specified reg key.
755  *
756  * PARAMS
757  *  PolicyHandle [I] Handle to a Policy object.
758  *  KeyName      [I] Name of the key where the data will be stored.
759  *  PrivateData  [O] Pointer to the private data.
760  *
761  * RETURNS
762  *  Success: STATUS_SUCCESS.
763  *  Failure: STATUS_OBJECT_NAME_NOT_FOUND or NTSTATUS code.
764  */
765 NTSTATUS WINAPI LsaStorePrivateData(
766     IN LSA_HANDLE PolicyHandle,
767     IN PLSA_UNICODE_STRING KeyName,
768     IN PLSA_UNICODE_STRING PrivateData)
769 {
770     FIXME("(%p,%p,%p) stub\n", PolicyHandle, KeyName, PrivateData);
771     return STATUS_OBJECT_NAME_NOT_FOUND;
772 }
773
774 /******************************************************************************
775  * LsaUnregisterPolicyChangeNotification [ADVAPI32.@]
776  *
777  */
778 NTSTATUS WINAPI LsaUnregisterPolicyChangeNotification(
779     POLICY_NOTIFICATION_INFORMATION_CLASS class,
780     HANDLE event)
781 {
782     FIXME("(%d,%p) stub\n", class, event);
783     return STATUS_SUCCESS;
784 }