ReactOS 0.4.15-dev-7788-g1ad9096
sspi.c
Go to the documentation of this file.
1/* Copyright (C) 2004 Juan Lang
2 *
3 * This file implements loading of SSP DLLs.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#include "precomp.h"
21
22#include <assert.h>
23#include <lsass/lsass.h>
24
25#include <wine/debug.h>
27
28#define UNLEN 256
29
30typedef struct _SecurePackageTable
31{
34 struct list table;
36
37typedef struct _SecureProviderTable
38{
41 struct list table;
43
44static void SECUR32_initializeProviders(void);
45/* static */ void SECUR32_freeProviders(void);
46
49{
50 0, 0, &cs,
52 0, 0, { (DWORD_PTR)(__FILE__ ": cs") }
53};
54static CRITICAL_SECTION cs = { &cs_debug, -1, 0, 0, 0, 0 };
57
64 NULL, /* Reserved2 */
77 EncryptMessage, /* Reserved3 */
78 DecryptMessage, /* Reserved4 */
82 NULL, /* Reserved8 */
86 NULL
87};
88
95 NULL, /* Reserved2 */
108 EncryptMessage, /* Reserved3 */
109 DecryptMessage, /* Reserved4 */
113 NULL, /* Reserved8 */
117 NULL
118};
119
120/***********************************************************************
121 * InitSecurityInterfaceA (SECUR32.@)
122 */
124{
125 TRACE("InitSecurityInterfaceA() called\n");
127}
128
129/***********************************************************************
130 * InitSecurityInterfaceW (SECUR32.@)
131 */
133{
134 TRACE("InitSecurityInterfaceW() called\n");
136}
137
139{
140 PWSTR ret;
141
142 if (str)
143 {
144 ret = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(str) + 1) * sizeof(WCHAR));
145 if (ret)
146 lstrcpyW(ret, str);
147 }
148 else
149 ret = NULL;
150 return ret;
151}
152
154{
155 PWSTR ret;
156
157 if (str)
158 {
159 int charsNeeded = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
160
161 if (charsNeeded)
162 {
163 ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded * sizeof(WCHAR));
164 if (ret)
165 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, charsNeeded);
166 }
167 else
168 ret = NULL;
169 }
170 else
171 ret = NULL;
172 return ret;
173}
174
176{
177 PSTR ret;
178
179 if (str)
180 {
181 int charsNeeded = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0,
182 NULL, NULL);
183
184 if (charsNeeded)
185 {
186 ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded);
187 if (ret)
188 WideCharToMultiByte(CP_ACP, 0, str, -1, ret, charsNeeded,
189 NULL, NULL);
190 }
191 else
192 ret = NULL;
193 }
194 else
195 ret = NULL;
196 return ret;
197}
198
200 const SecurityFunctionTableA *inFnTableA,
201 const SecurityFunctionTableW *inFnTableW)
202{
203 if (fnTableA)
204 {
205 if (inFnTableA)
206 {
207 /* The size of the version 1 table is based on platform sdk's
208 * sspi.h, though the sample ssp also provided with platform sdk
209 * implies only functions through QuerySecurityPackageInfoA are
210 * implemented (yikes)
211 */
212 size_t tableSize = inFnTableA->dwVersion == 1 ?
213 (const BYTE *)&inFnTableA->SetContextAttributesA -
214 (const BYTE *)inFnTableA : sizeof(SecurityFunctionTableA);
215
216 memcpy(fnTableA, inFnTableA, tableSize);
217 /* override this, since we can do it internally anyway */
218 fnTableA->QuerySecurityPackageInfoA =
220 }
221 else if (inFnTableW)
222 {
223 /* functions with thunks */
224 if (inFnTableW->AcquireCredentialsHandleW)
225 fnTableA->AcquireCredentialsHandleA =
227 if (inFnTableW->InitializeSecurityContextW)
230 if (inFnTableW->ImportSecurityContextW)
231 fnTableA->ImportSecurityContextA =
233 if (inFnTableW->AddCredentialsW)
234 fnTableA->AddCredentialsA =
236 if (inFnTableW->QueryCredentialsAttributesW)
239 if (inFnTableW->QueryContextAttributesW)
240 fnTableA->QueryContextAttributesA =
242 if (inFnTableW->SetContextAttributesW)
243 fnTableA->SetContextAttributesA =
245 /* this can't be thunked, there's no extra param to know which
246 * package to forward to */
248 /* functions with no thunks needed */
249 fnTableA->AcceptSecurityContext = inFnTableW->AcceptSecurityContext;
250 fnTableA->CompleteAuthToken = inFnTableW->CompleteAuthToken;
251 fnTableA->DeleteSecurityContext = inFnTableW->DeleteSecurityContext;
253 inFnTableW->ImpersonateSecurityContext;
254 fnTableA->RevertSecurityContext = inFnTableW->RevertSecurityContext;
255 fnTableA->MakeSignature = inFnTableW->MakeSignature;
256 fnTableA->VerifySignature = inFnTableW->VerifySignature;
257 fnTableA->FreeContextBuffer = inFnTableW->FreeContextBuffer;
258 fnTableA->QuerySecurityPackageInfoA =
260 fnTableA->ExportSecurityContext =
261 inFnTableW->ExportSecurityContext;
262 fnTableA->QuerySecurityContextToken =
263 inFnTableW->QuerySecurityContextToken;
264 fnTableA->EncryptMessage = inFnTableW->EncryptMessage;
265 fnTableA->DecryptMessage = inFnTableW->DecryptMessage;
266 }
267 }
268}
269
271 const SecurityFunctionTableA *inFnTableA,
272 const SecurityFunctionTableW *inFnTableW)
273{
274 if (fnTableW)
275 {
276 if (inFnTableW)
277 {
278 /* The size of the version 1 table is based on platform sdk's
279 * sspi.h, though the sample ssp also provided with platform sdk
280 * implies only functions through QuerySecurityPackageInfoA are
281 * implemented (yikes)
282 */
283 size_t tableSize = inFnTableW->dwVersion == 1 ?
284 (const BYTE *)&inFnTableW->SetContextAttributesW -
285 (const BYTE *)inFnTableW : sizeof(SecurityFunctionTableW);
286
287 memcpy(fnTableW, inFnTableW, tableSize);
288 /* override this, since we can do it internally anyway */
289 fnTableW->QuerySecurityPackageInfoW =
291 }
292 else if (inFnTableA)
293 {
294 /* functions with thunks */
295 if (inFnTableA->AcquireCredentialsHandleA)
296 fnTableW->AcquireCredentialsHandleW =
298 if (inFnTableA->InitializeSecurityContextA)
301 if (inFnTableA->ImportSecurityContextA)
302 fnTableW->ImportSecurityContextW =
304 if (inFnTableA->AddCredentialsA)
305 fnTableW->AddCredentialsW =
307 if (inFnTableA->QueryCredentialsAttributesA)
310 if (inFnTableA->QueryContextAttributesA)
311 fnTableW->QueryContextAttributesW =
313 if (inFnTableA->SetContextAttributesA)
314 fnTableW->SetContextAttributesW =
316 /* this can't be thunked, there's no extra param to know which
317 * package to forward to */
319 /* functions with no thunks needed */
320 fnTableW->AcceptSecurityContext = inFnTableA->AcceptSecurityContext;
321 fnTableW->CompleteAuthToken = inFnTableA->CompleteAuthToken;
322 fnTableW->DeleteSecurityContext = inFnTableA->DeleteSecurityContext;
324 inFnTableA->ImpersonateSecurityContext;
325 fnTableW->RevertSecurityContext = inFnTableA->RevertSecurityContext;
326 fnTableW->MakeSignature = inFnTableA->MakeSignature;
327 fnTableW->VerifySignature = inFnTableA->VerifySignature;
328 fnTableW->FreeContextBuffer = inFnTableA->FreeContextBuffer;
329 fnTableW->QuerySecurityPackageInfoW =
331 fnTableW->ExportSecurityContext =
332 inFnTableA->ExportSecurityContext;
333 fnTableW->QuerySecurityContextToken =
334 inFnTableA->QuerySecurityContextToken;
335 fnTableW->EncryptMessage = inFnTableA->EncryptMessage;
336 fnTableW->DecryptMessage = inFnTableA->DecryptMessage;
337 }
338 }
339}
340
341static void _copyPackageInfo(PSecPkgInfoW info, const SecPkgInfoA *inInfoA,
342 const SecPkgInfoW *inInfoW)
343{
344 if (info && (inInfoA || inInfoW))
345 {
346 /* odd, I know, but up until Name and Comment the structures are
347 * identical
348 */
349 memcpy(info, inInfoW ? inInfoW : (const SecPkgInfoW *)inInfoA, sizeof(*info));
350 if (inInfoW)
351 {
352 info->Name = SECUR32_strdupW(inInfoW->Name);
353 info->Comment = SECUR32_strdupW(inInfoW->Comment);
354 }
355 else
356 {
357 info->Name = SECUR32_AllocWideFromMultiByte(inInfoA->Name);
358 info->Comment = SECUR32_AllocWideFromMultiByte(inInfoA->Comment);
359 }
360 }
361}
362
363// static
365 const SecurityFunctionTableW *fnTableW, PCWSTR moduleName)
366{
368
370
371 if (!providerTable)
372 {
374 if (!providerTable)
375 {
377 return NULL;
378 }
379
381 }
382
384 if (!ret)
385 {
387 return NULL;
388 }
389
391 ret->lib = NULL;
392
393 if (fnTableA || fnTableW)
394 {
395 ret->moduleName = moduleName ? SECUR32_strdupW(moduleName) : NULL;
396 _makeFnTableA(&ret->fnTableA, fnTableA, fnTableW);
397 _makeFnTableW(&ret->fnTableW, fnTableA, fnTableW);
398 ret->loaded = !moduleName;
399 }
400 else
401 {
402 ret->moduleName = SECUR32_strdupW(moduleName);
403 ret->loaded = FALSE;
404 }
405
407 return ret;
408}
409
410// static
412 const SecPkgInfoA *infoA, const SecPkgInfoW *infoW)
413{
414 ULONG i;
415
416 assert(provider);
417 assert(infoA || infoW);
418
420
421 if (!packageTable)
422 {
424 if (!packageTable)
425 {
427 return;
428 }
429
432 }
433
434 for (i = 0; i < toAdd; i++)
435 {
436 SecurePackage *package = HeapAlloc(GetProcessHeap(), 0, sizeof(SecurePackage));
437 if (!package)
438 continue;
439
440 list_add_tail(&packageTable->table, &package->entry);
441
442 package->provider = provider;
443 _copyPackageInfo(&package->infoW,
444 infoA ? &infoA[i] : NULL,
445 infoW ? &infoW[i] : NULL);
446 }
447 packageTable->numPackages += toAdd;
448
450}
451
452static void _tryLoadProvider(PWSTR moduleName)
453{
454 HMODULE lib = LoadLibraryW(moduleName);
455
456 if (lib)
457 {
458 INIT_SECURITY_INTERFACE_W pInitSecurityInterfaceW =
461 INIT_SECURITY_INTERFACE_A pInitSecurityInterfaceA =
464
465 TRACE("loaded %s, InitSecurityInterfaceA is %p, InitSecurityInterfaceW is %p\n",
466 debugstr_w(moduleName), pInitSecurityInterfaceA,
467 pInitSecurityInterfaceW);
468 if (pInitSecurityInterfaceW || pInitSecurityInterfaceA)
469 {
470 PSecurityFunctionTableA fnTableA = NULL;
471 PSecurityFunctionTableW fnTableW = NULL;
472 ULONG toAdd = 0;
476
477 if (pInitSecurityInterfaceA)
478 fnTableA = pInitSecurityInterfaceA();
479 if (pInitSecurityInterfaceW)
480 fnTableW = pInitSecurityInterfaceW();
481 if (fnTableW && fnTableW->EnumerateSecurityPackagesW)
482 {
483 if (fnTableW != &securityFunctionTableW)
484 ret = fnTableW->EnumerateSecurityPackagesW(&toAdd, &infoW);
485 else
486 TRACE("%s has built-in providers, skip adding\n", debugstr_w(moduleName));
487 }
488 else if (fnTableA && fnTableA->EnumerateSecurityPackagesA)
489 {
490 if (fnTableA != &securityFunctionTableA)
491 ret = fnTableA->EnumerateSecurityPackagesA(&toAdd, &infoA);
492 else
493 TRACE("%s has built-in providers, skip adding\n", debugstr_w(moduleName));
494 }
495 if (ret == SEC_E_OK && toAdd > 0 && (infoW || infoA))
496 {
498 moduleName);
499
500 if (provider)
501 SECUR32_addPackages(provider, toAdd, infoA, infoW);
502 if (infoW)
503 fnTableW->FreeContextBuffer(infoW);
504 else
505 fnTableA->FreeContextBuffer(infoA);
506 }
507 }
508 FreeLibrary(lib);
509 }
510 else
511 WARN("failed to load %s\n", debugstr_w(moduleName));
512}
513
514static const WCHAR securityProvidersKeyW[] = {
515 'S','Y','S','T','E','M','\\','C','u','r','r','e','n','t','C','o','n','t','r',
516 'o','l','S','e','t','\\','C','o','n','t','r','o','l','\\','S','e','c','u','r',
517 'i','t','y','P','r','o','v','i','d','e','r','s','\0'
518 };
519static const WCHAR securityProvidersW[] = {
520 'S','e','c','u','r','i','t','y','P','r','o','v','i','d','e','r','s',0
521 };
522
524{
525 HKEY key;
526 LSTATUS apiRet;
527
528 /* Now load providers from registry */
530 KEY_READ, &key);
531 if (apiRet == ERROR_SUCCESS)
532 {
533 WCHAR securityPkgNames[MAX_PATH]; /* arbitrary len */
534 DWORD size = sizeof(securityPkgNames), type;
535
537 (PBYTE)securityPkgNames, &size);
538 if (apiRet == ERROR_SUCCESS && type == REG_SZ)
539 {
540 WCHAR *ptr;
541
542 size = size / sizeof(WCHAR);
543 for (ptr = securityPkgNames;
544 ptr < securityPkgNames + size; )
545 {
546 WCHAR *comma;
547
548 for (comma = ptr; *comma && *comma != ','; comma++)
549 ;
550 if (*comma == ',')
551 *comma = '\0';
552 for (; *ptr && isspace(*ptr) && ptr < securityPkgNames + size;
553 ptr++)
554 ;
555 if (*ptr)
557 ptr += lstrlenW(ptr) + 1;
558 }
559 }
561 }
562
563 /* Now load the built-in providers (in Wine, this is done before the registry loading) */
564#ifdef __REACTOS__
566 /* First load built-in providers */
569 /* Load the Negotiate provider last so apps stumble over the working NTLM
570 * provider first. Attempting to fix bug #16905 while keeping the
571 * application reported on wine-users on 2006-09-12 working. */
573#endif
574
575}
576
578{
580 BOOL matched = FALSE;
581
582#ifdef __REACTOS__
583 if (!packageTable)
585#endif
586
587 if (packageTable && packageName)
588 {
590 {
591 matched = !lstrcmpiW(ret->infoW.Name, packageName);
592 if (matched)
593 break;
594 }
595
596 if (!matched)
597 return NULL;
598
599 if (ret->provider && !ret->provider->loaded)
600 {
601 ret->provider->lib = LoadLibraryW(ret->provider->moduleName);
602 if (ret->provider->lib)
603 {
604 INIT_SECURITY_INTERFACE_W pInitSecurityInterfaceW =
607 INIT_SECURITY_INTERFACE_A pInitSecurityInterfaceA =
610 PSecurityFunctionTableA fnTableA = NULL;
611 PSecurityFunctionTableW fnTableW = NULL;
612
613 if (pInitSecurityInterfaceA)
614 fnTableA = pInitSecurityInterfaceA();
615 if (pInitSecurityInterfaceW)
616 fnTableW = pInitSecurityInterfaceW();
617 /* don't update built-in SecurityFunctionTable */
618 if (fnTableA != &securityFunctionTableA)
619 _makeFnTableA(&ret->provider->fnTableA, fnTableA, fnTableW);
620 if (fnTableW != &securityFunctionTableW)
621 _makeFnTableW(&ret->provider->fnTableW, fnTableA, fnTableW);
622 ret->provider->loaded = TRUE;
623 }
624 else
625 ret = NULL;
626 }
627 }
628 return ret;
629}
630
632{
634
635 if (packageName)
636 {
637 UNICODE_STRING package;
638
639 RtlCreateUnicodeStringFromAsciiz(&package, packageName);
641 RtlFreeUnicodeString(&package);
642 }
643 else
644 ret = NULL;
645 return ret;
646}
647
648/* static */ void SECUR32_freeProviders(void)
649{
650 TRACE("\n");
652
653#ifndef __REACTOS__
655#endif
656
657 if (packageTable)
658 {
659 SecurePackage *package, *package_next;
660 LIST_FOR_EACH_ENTRY_SAFE(package, package_next, &packageTable->table,
662 {
663 HeapFree(GetProcessHeap(), 0, package->infoW.Name);
664 HeapFree(GetProcessHeap(), 0, package->infoW.Comment);
665 HeapFree(GetProcessHeap(), 0, package);
666 }
667
670 }
671
672 if (providerTable)
673 {
674 SecureProvider *provider, *provider_next;
675 LIST_FOR_EACH_ENTRY_SAFE(provider, provider_next, &providerTable->table,
677 {
678 HeapFree(GetProcessHeap(), 0, provider->moduleName);
679 if (provider->lib)
680 FreeLibrary(provider->lib);
681 HeapFree(GetProcessHeap(), 0, provider);
682 }
683
686 }
687
690}
691
692/***********************************************************************
693 * FreeContextBuffer (SECUR32.@)
694 *
695 * Doh--if pv was allocated by a crypto package, this may not be correct.
696 * The sample ssp seems to use LocalAlloc/LocalFee, but there doesn't seem to
697 * be any guarantee, nor is there an alloc function in secur32.
698 */
700{
701 HeapFree(GetProcessHeap(), 0, pv);
702
703 return SEC_E_OK;
704}
705
706/***********************************************************************
707 * EnumerateSecurityPackagesW (SECUR32.@)
708 */
710 PSecPkgInfoW *ppPackageInfo)
711{
713
714 TRACE("(%p, %p)\n", pcPackages, ppPackageInfo);
715
716#ifdef __REACTOS__
717 if (!packageTable)
719#endif
720
721 /* windows just crashes if pcPackages or ppPackageInfo is NULL, so will I */
722 *pcPackages = 0;
724 if (packageTable)
725 {
726 SecurePackage *package;
727 size_t bytesNeeded;
728
729 bytesNeeded = packageTable->numPackages * sizeof(SecPkgInfoW);
731 {
732 if (package->infoW.Name)
733 bytesNeeded += (lstrlenW(package->infoW.Name) + 1) * sizeof(WCHAR);
734 if (package->infoW.Comment)
735 bytesNeeded += (lstrlenW(package->infoW.Comment) + 1) * sizeof(WCHAR);
736 }
737 if (bytesNeeded)
738 {
739 *ppPackageInfo = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
740 if (*ppPackageInfo)
741 {
742 ULONG i = 0;
743 PWSTR nextString;
744
745 *pcPackages = packageTable->numPackages;
746 nextString = (PWSTR)((PBYTE)*ppPackageInfo +
749 {
750 PSecPkgInfoW pkgInfo = *ppPackageInfo + i++;
751
752 *pkgInfo = package->infoW;
753 if (package->infoW.Name)
754 {
755 TRACE("Name[%d] = %s\n", i - 1, debugstr_w(package->infoW.Name));
756 pkgInfo->Name = nextString;
757 lstrcpyW(nextString, package->infoW.Name);
758 nextString += lstrlenW(nextString) + 1;
759 }
760 else
761 pkgInfo->Name = NULL;
762 if (package->infoW.Comment)
763 {
764 TRACE("Comment[%d] = %s\n", i - 1, debugstr_w(package->infoW.Comment));
765 pkgInfo->Comment = nextString;
766 lstrcpyW(nextString, package->infoW.Comment);
767 nextString += lstrlenW(nextString) + 1;
768 }
769 else
770 pkgInfo->Comment = NULL;
771 }
772 }
773 else
775 }
776 }
778 TRACE("<-- 0x%08x\n", ret);
779 return ret;
780}
781
782/* Converts info (which is assumed to be an array of cPackages SecPkgInfoW
783 * structures) into an array of SecPkgInfoA structures, which it returns.
784 */
786 const SecPkgInfoW *info)
787{
789
790 if (info)
791 {
792 size_t bytesNeeded = cPackages * sizeof(SecPkgInfoA);
793 ULONG i;
794
795 for (i = 0; i < cPackages; i++)
796 {
797 if (info[i].Name)
798 bytesNeeded += WideCharToMultiByte(CP_ACP, 0, info[i].Name,
799 -1, NULL, 0, NULL, NULL);
800 if (info[i].Comment)
801 bytesNeeded += WideCharToMultiByte(CP_ACP, 0, info[i].Comment,
802 -1, NULL, 0, NULL, NULL);
803 }
804 ret = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
805 if (ret)
806 {
807 PSTR nextString;
808
809 nextString = (PSTR)((PBYTE)ret + cPackages * sizeof(SecPkgInfoA));
810 for (i = 0; i < cPackages; i++)
811 {
812 PSecPkgInfoA pkgInfo = ret + i;
813 int bytes;
814
815 memcpy(pkgInfo, &info[i], sizeof(SecPkgInfoA));
816 if (info[i].Name)
817 {
818 pkgInfo->Name = nextString;
819 /* just repeat back to WideCharToMultiByte how many bytes
820 * it requires, since we asked it earlier
821 */
823 NULL, 0, NULL, NULL);
825 pkgInfo->Name, bytes, NULL, NULL);
826 nextString += lstrlenA(nextString) + 1;
827 }
828 else
829 pkgInfo->Name = NULL;
830 if (info[i].Comment)
831 {
832 pkgInfo->Comment = nextString;
833 /* just repeat back to WideCharToMultiByte how many bytes
834 * it requires, since we asked it earlier
835 */
837 NULL, 0, NULL, NULL);
839 pkgInfo->Comment, bytes, NULL, NULL);
840 nextString += lstrlenA(nextString) + 1;
841 }
842 else
843 pkgInfo->Comment = NULL;
844 }
845 }
846 }
847 else
848 ret = NULL;
849 return ret;
850}
851
852/***********************************************************************
853 * EnumerateSecurityPackagesA (SECUR32.@)
854 */
856 PSecPkgInfoA *ppPackageInfo)
857{
860
861 ret = EnumerateSecurityPackagesW(pcPackages, &info);
862 if (ret == SEC_E_OK && *pcPackages && info)
863 {
864 *ppPackageInfo = thunk_PSecPkgInfoWToA(*pcPackages, info);
865 if (*pcPackages && !*ppPackageInfo)
866 {
867 *pcPackages = 0;
869 }
871 }
872 return ret;
873}
874
875/***********************************************************************
876 * GetComputerObjectNameA (SECUR32.@)
877 *
878 * Get the local computer's name using the format specified.
879 *
880 * PARAMS
881 * NameFormat [I] The format for the name.
882 * lpNameBuffer [O] Pointer to buffer to receive the name.
883 * nSize [I/O] Size in characters of buffer.
884 *
885 * RETURNS
886 * TRUE If the name was written to lpNameBuffer.
887 * FALSE If the name couldn't be written.
888 *
889 * NOTES
890 * If lpNameBuffer is NULL, then the size of the buffer needed to hold the
891 * name will be returned in *nSize.
892 *
893 * nSize returns the number of characters written when lpNameBuffer is not
894 * NULL or the size of the buffer needed to hold the name when the buffer
895 * is too short or lpNameBuffer is NULL.
896 *
897 * It the buffer is too short, ERROR_INSUFFICIENT_BUFFER error will be set.
898 */
900 EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize)
901{
902 BOOLEAN rc;
903 LPWSTR bufferW = NULL;
904 ULONG sizeW = *nSize;
905 TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize);
906 if (lpNameBuffer) {
907 bufferW = HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR));
908 if (bufferW == NULL) {
910 return FALSE;
911 }
912 }
913 rc = GetComputerObjectNameW(NameFormat, bufferW, &sizeW);
914 if (rc && bufferW) {
915 ULONG len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL);
917 *nSize = len;
918 }
919 else
920 *nSize = sizeW;
921 HeapFree(GetProcessHeap(), 0, bufferW);
922 return rc;
923}
924
925/***********************************************************************
926 * GetComputerObjectNameW (SECUR32.@)
927 */
929 EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize)
930{
931 LSA_HANDLE policyHandle;
932 LSA_OBJECT_ATTRIBUTES objectAttributes;
933 PPOLICY_DNS_DOMAIN_INFO domainInfo;
934 NTSTATUS ntStatus;
936 TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize);
937
938 if (NameFormat == NameUnknown)
939 {
941 return FALSE;
942 }
943
944 ZeroMemory(&objectAttributes, sizeof(objectAttributes));
945 objectAttributes.Length = sizeof(objectAttributes);
946
947 ntStatus = LsaOpenPolicy(NULL, &objectAttributes,
949 &policyHandle);
950 if (ntStatus != STATUS_SUCCESS)
951 {
953 WARN("LsaOpenPolicy failed with NT status %u\n", GetLastError());
954 return FALSE;
955 }
956
957 ntStatus = LsaQueryInformationPolicy(policyHandle,
959 (PVOID *)&domainInfo);
960 if (ntStatus != STATUS_SUCCESS)
961 {
963 WARN("LsaQueryInformationPolicy failed with NT status %u\n",
964 GetLastError());
965 LsaClose(policyHandle);
966 return FALSE;
967 }
968
969 if (domainInfo->Sid)
970 {
971 switch (NameFormat)
972 {
973 case NameSamCompatible:
974 {
976 DWORD size = sizeof(name)/sizeof(name[0]);
978 {
979 DWORD len = domainInfo->Name.Length + size + 3;
980 if (lpNameBuffer)
981 {
982 if (*nSize < len)
983 {
984 *nSize = len;
986 status = FALSE;
987 }
988 else
989 {
990 WCHAR bs[] = { '\\', 0 };
991 WCHAR ds[] = { '$', 0 };
992 lstrcpyW(lpNameBuffer, domainInfo->Name.Buffer);
996 status = TRUE;
997 }
998 }
999 else /* just requesting length required */
1000 {
1001 *nSize = len;
1002 status = TRUE;
1003 }
1004 }
1005 else
1006 {
1008 status = FALSE;
1009 }
1010 }
1011 break;
1012 case NameFullyQualifiedDN:
1013 case NameDisplay:
1014 case NameUniqueId:
1015 case NameCanonical:
1016 case NameUserPrincipal:
1017 case NameCanonicalEx:
1018 case NameServicePrincipal:
1019 case NameDnsDomain:
1020 FIXME("NameFormat %d not implemented\n", NameFormat);
1022 status = FALSE;
1023 break;
1024 default:
1026 status = FALSE;
1027 }
1028 }
1029 else
1030 {
1032 status = FALSE;
1033 }
1034
1035 LsaFreeMemory(domainInfo);
1036 LsaClose(policyHandle);
1037
1038 return status;
1039}
1040
1041/***********************************************************************
1042 * GetUserNameExA (SECUR32.@)
1043 */
1045 EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize)
1046{
1047 BOOLEAN rc;
1048 LPWSTR bufferW = NULL;
1049 ULONG sizeW = *nSize;
1050 TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize);
1051 if (lpNameBuffer) {
1052 bufferW = HeapAlloc(GetProcessHeap(), 0, sizeW * sizeof(WCHAR));
1053 if (bufferW == NULL) {
1055 return FALSE;
1056 }
1057 }
1058 rc = GetUserNameExW(NameFormat, bufferW, &sizeW);
1059 if (rc) {
1060 ULONG len = WideCharToMultiByte(CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL);
1061 if (len <= *nSize)
1062 {
1063 WideCharToMultiByte(CP_ACP, 0, bufferW, -1, lpNameBuffer, *nSize, NULL, NULL);
1064 *nSize = len - 1;
1065 }
1066 else
1067 {
1068 *nSize = len;
1069 rc = FALSE;
1071 }
1072 }
1073 else
1074 *nSize = sizeW;
1075 HeapFree(GetProcessHeap(), 0, bufferW);
1076 return rc;
1077}
1078
1080 EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize)
1081{
1082 TRACE("(%d %p %p)\n", NameFormat, lpNameBuffer, nSize);
1083
1084 switch (NameFormat)
1085 {
1086 case NameSamCompatible:
1087 {
1088 WCHAR samname[UNLEN + 1 + MAX_COMPUTERNAME_LENGTH + 1];
1089 LPWSTR out;
1090 DWORD len;
1091
1092 /* This assumes the current user is always a local account */
1094 if (GetComputerNameW(samname, &len))
1095 {
1096 out = samname + lstrlenW(samname);
1097 *out++ = '\\';
1098 len = UNLEN + 1;
1099 if (GetUserNameW(out, &len))
1100 {
1101 if (lstrlenW(samname) < *nSize)
1102 {
1103 lstrcpyW(lpNameBuffer, samname);
1104 *nSize = lstrlenW(samname);
1105 return TRUE;
1106 }
1107
1109 *nSize = lstrlenW(samname) + 1;
1110 }
1111 }
1112 return FALSE;
1113 }
1114
1115 case NameUnknown:
1116 case NameFullyQualifiedDN:
1117 case NameDisplay:
1118 case NameUniqueId:
1119 case NameCanonical:
1120 case NameUserPrincipal:
1121 case NameCanonicalEx:
1122 case NameServicePrincipal:
1123 case NameDnsDomain:
1125 return FALSE;
1126
1127 default:
1129 return FALSE;
1130 }
1131}
1132
1134 LPCSTR lpAccountName, EXTENDED_NAME_FORMAT AccountNameFormat,
1135 EXTENDED_NAME_FORMAT DesiredNameFormat, LPSTR lpTranslatedName,
1136 PULONG nSize)
1137{
1138 FIXME("%p %d %d %p %p\n", lpAccountName, AccountNameFormat,
1139 DesiredNameFormat, lpTranslatedName, nSize);
1140 return FALSE;
1141}
1142
1144 LPCWSTR lpAccountName, EXTENDED_NAME_FORMAT AccountNameFormat,
1145 EXTENDED_NAME_FORMAT DesiredNameFormat, LPWSTR lpTranslatedName,
1146 PULONG nSize)
1147{
1148 FIXME("%p %d %d %p %p\n", lpAccountName, AccountNameFormat,
1149 DesiredNameFormat, lpTranslatedName, nSize);
1150 return FALSE;
1151}
unsigned char BOOLEAN
#define isspace(c)
Definition: acclib.h:69
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
@ Comment
Definition: asmpp.cpp:34
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
LONG NTSTATUS
Definition: precomp.h:26
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define RegCloseKey(hKey)
Definition: registry.h:49
Definition: list.h:37
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:446
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define ERROR_SUCCESS
Definition: deptool.c:10
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3362
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4132
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
Definition: lsa.c:1183
ULONG WINAPI LsaNtStatusToWinError(IN NTSTATUS Status)
Definition: lsa.c:1131
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1473
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:701
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:194
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
#define FreeLibrary(x)
Definition: compat.h:748
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define lstrcpyW
Definition: compat.h:749
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define LoadLibraryW(x)
Definition: compat.h:747
#define lstrlenW
Definition: compat.h:750
static const WCHAR sizeW[]
Definition: editor.c:79
void SECUR32_initNegotiateSP(void)
Definition: negotiate.c:516
void SECUR32_initNTLMSP(void)
Definition: ntlm.c:2026
#define assert(x)
Definition: debug.h:53
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ds
Definition: i386-dis.c:443
uint32_t entry
Definition: isohybrid.c:63
void SECUR32_initKerberosSP(void)
Definition: kerberos.c:311
static const SecPkgInfoW infoW
Definition: kerberos.c:293
static const SecPkgInfoA infoA
Definition: kerberos.c:302
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static struct msdos_boot_sector bs
Definition: mkdosfs.c:539
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static PVOID ptr
Definition: dispmode.c:27
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
@ PolicyDnsDomainInformation
Definition: ntsecapi.h:254
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
BYTE * PBYTE
Definition: pedump.c:66
struct _SecPkgInfoW SecPkgInfoW
LONG SECURITY_STATUS
Definition: sspi.h:34
#define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION
Definition: sspi.h:1023
struct _SecPkgInfoA SecPkgInfoA
struct _SECURITY_FUNCTION_TABLE_A SecurityFunctionTableA
PSecurityFunctionTableW(SEC_ENTRY * INIT_SECURITY_INTERFACE_W)(void)
Definition: sspi.h:1031
PSecurityFunctionTableA(SEC_ENTRY * INIT_SECURITY_INTERFACE_A)(void)
Definition: sspi.h:1030
#define SECURITY_ENTRYPOINT_ANSIA
Definition: sspi.h:949
struct _SECURITY_FUNCTION_TABLE_W SecurityFunctionTableW
#define SECURITY_ENTRYPOINT_ANSIW
Definition: sspi.h:950
static FILE * out
Definition: regtests2xml.c:44
const WCHAR * str
void SECUR32_deinitSchannelSP(void)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
static LPSTR lpNameBuffer
Definition: secur32.c:50
static SecurePackageTable * packageTable
Definition: secur32_wine.c:52
static void _copyPackageInfo(PSecPkgInfoW info, const SecPkgInfoA *inInfoA, const SecPkgInfoW *inInfoW)
Definition: secur32_wine.c:292
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE(s)
Definition: solgame.cpp:4
BOOLEAN WINAPI TranslateNameA(LPCSTR lpAccountName, EXTENDED_NAME_FORMAT AccountNameFormat, EXTENDED_NAME_FORMAT DesiredNameFormat, LPSTR lpTranslatedName, PULONG nSize)
Definition: sspi.c:1133
struct _SecureProviderTable SecureProviderTable
static PWSTR SECUR32_strdupW(PCWSTR str)
Definition: sspi.c:138
void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd, const SecPkgInfoA *infoA, const SecPkgInfoW *infoW)
Definition: sspi.c:411
SecureProvider * SECUR32_addProvider(const SecurityFunctionTableA *fnTableA, const SecurityFunctionTableW *fnTableW, PCWSTR moduleName)
Definition: sspi.c:364
static SecurePackageTable * packageTable
Definition: sspi.c:55
#define UNLEN
Definition: sspi.c:28
static void _makeFnTableA(PSecurityFunctionTableA fnTableA, const SecurityFunctionTableA *inFnTableA, const SecurityFunctionTableW *inFnTableW)
Definition: sspi.c:199
static void _makeFnTableW(PSecurityFunctionTableW fnTableW, const SecurityFunctionTableA *inFnTableA, const SecurityFunctionTableW *inFnTableW)
Definition: sspi.c:270
static SecurityFunctionTableA securityFunctionTableA
Definition: sspi.c:58
void SECUR32_freeProviders(void)
Definition: sspi.c:648
static const WCHAR securityProvidersKeyW[]
Definition: sspi.c:514
static SecureProviderTable * providerTable
Definition: sspi.c:56
static void _tryLoadProvider(PWSTR moduleName)
Definition: sspi.c:452
SECURITY_STATUS WINAPI EnumerateSecurityPackagesW(PULONG pcPackages, PSecPkgInfoW *ppPackageInfo)
Definition: sspi.c:709
BOOLEAN WINAPI GetComputerObjectNameA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize)
Definition: sspi.c:899
static CRITICAL_SECTION cs
Definition: sspi.c:47
struct _SecurePackageTable SecurePackageTable
PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str)
Definition: sspi.c:175
static CRITICAL_SECTION_DEBUG cs_debug
Definition: sspi.c:48
PSecurityFunctionTableA WINAPI InitSecurityInterfaceA(void)
Definition: sspi.c:123
SECURITY_STATUS WINAPI FreeContextBuffer(PVOID pv)
Definition: sspi.c:699
SecurePackage * SECUR32_findPackageA(PCSTR packageName)
Definition: sspi.c:631
BOOLEAN WINAPI TranslateNameW(LPCWSTR lpAccountName, EXTENDED_NAME_FORMAT AccountNameFormat, EXTENDED_NAME_FORMAT DesiredNameFormat, LPWSTR lpTranslatedName, PULONG nSize)
Definition: sspi.c:1143
SECURITY_STATUS WINAPI EnumerateSecurityPackagesA(PULONG pcPackages, PSecPkgInfoA *ppPackageInfo)
Definition: sspi.c:855
static PSecPkgInfoA thunk_PSecPkgInfoWToA(ULONG cPackages, const SecPkgInfoW *info)
Definition: sspi.c:785
PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str)
Definition: sspi.c:153
static SecurityFunctionTableW securityFunctionTableW
Definition: sspi.c:89
static const WCHAR securityProvidersW[]
Definition: sspi.c:519
BOOLEAN WINAPI GetComputerObjectNameW(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize)
Definition: sspi.c:928
static void SECUR32_initializeProviders(void)
Definition: sspi.c:523
static void _copyPackageInfo(PSecPkgInfoW info, const SecPkgInfoA *inInfoA, const SecPkgInfoW *inInfoW)
Definition: sspi.c:341
BOOLEAN WINAPI GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize)
Definition: sspi.c:1044
PSecurityFunctionTableW WINAPI InitSecurityInterfaceW(void)
Definition: sspi.c:132
SecurePackage * SECUR32_findPackageW(PCWSTR packageName)
Definition: sspi.c:577
BOOLEAN WINAPI GetUserNameExW(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize)
Definition: sspi.c:1079
LIST_ENTRY ProcessLocksList
Definition: winbase.h:883
LSA_UNICODE_STRING Name
Definition: ntsecapi.h:574
DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext
Definition: sspi.h:964
FREE_CONTEXT_BUFFER_FN FreeContextBuffer
Definition: sspi.h:971
QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA
Definition: sspi.h:972
QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken
Definition: sspi.h:979
ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA
Definition: sspi.h:958
INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA
Definition: sspi.h:961
EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext
Definition: sspi.h:975
IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA
Definition: sspi.h:976
ENCRYPT_MESSAGE_FN EncryptMessage
Definition: sspi.h:980
VERIFY_SIGNATURE_FN VerifySignature
Definition: sspi.h:970
IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext
Definition: sspi.h:967
MAKE_SIGNATURE_FN MakeSignature
Definition: sspi.h:969
REVERT_SECURITY_CONTEXT_FN RevertSecurityContext
Definition: sspi.h:968
ADD_CREDENTIALS_FN_A AddCredentialsA
Definition: sspi.h:977
ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA
Definition: sspi.h:956
QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA
Definition: sspi.h:957
COMPLETE_AUTH_TOKEN_FN CompleteAuthToken
Definition: sspi.h:963
SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA
Definition: sspi.h:982
DECRYPT_MESSAGE_FN DecryptMessage
Definition: sspi.h:981
ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext
Definition: sspi.h:962
QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA
Definition: sspi.h:966
ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext
Definition: sspi.h:997
INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW
Definition: sspi.h:996
DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext
Definition: sspi.h:999
QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken
Definition: sspi.h:1014
ENCRYPT_MESSAGE_FN EncryptMessage
Definition: sspi.h:1015
VERIFY_SIGNATURE_FN VerifySignature
Definition: sspi.h:1005
EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext
Definition: sspi.h:1010
QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW
Definition: sspi.h:1007
ADD_CREDENTIALS_FN_W AddCredentialsW
Definition: sspi.h:1012
SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW
Definition: sspi.h:1017
ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW
Definition: sspi.h:993
DECRYPT_MESSAGE_FN DecryptMessage
Definition: sspi.h:1016
FREE_CONTEXT_BUFFER_FN FreeContextBuffer
Definition: sspi.h:1006
ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW
Definition: sspi.h:991
COMPLETE_AUTH_TOKEN_FN CompleteAuthToken
Definition: sspi.h:998
REVERT_SECURITY_CONTEXT_FN RevertSecurityContext
Definition: sspi.h:1003
IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW
Definition: sspi.h:1011
MAKE_SIGNATURE_FN MakeSignature
Definition: sspi.h:1004
QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW
Definition: sspi.h:1001
QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW
Definition: sspi.h:992
IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext
Definition: sspi.h:1002
SEC_CHAR * Comment
Definition: sspi.h:109
SEC_CHAR * Name
Definition: sspi.h:108
SEC_WCHAR * Comment
Definition: sspi.h:119
SEC_WCHAR * Name
Definition: sspi.h:118
struct list table
Definition: secur32_wine.c:30
SecPkgInfoW infoW
Definition: schannel_priv.h:35
Definition: copy.c:22
Definition: name.c:39
Definition: ps.c:97
SECURITY_STATUS SEC_ENTRY thunk_AddCredentialsW(PCredHandle hCredentials, SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PTimeStamp ptsExpiry)
Definition: thunks.c:308
SECURITY_STATUS SEC_ENTRY thunk_InitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
Definition: thunks.c:229
SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextA(SEC_CHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
Definition: thunks.c:864
SECURITY_STATUS SEC_ENTRY thunk_SetContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
Definition: thunks.c:798
SECURITY_STATUS SEC_ENTRY thunk_SetContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
Definition: thunks.c:831
SECURITY_STATUS SEC_ENTRY thunk_AddCredentialsA(PCredHandle hCredentials, SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PTimeStamp ptsExpiry)
Definition: thunks.c:268
SECURITY_STATUS SEC_ENTRY thunk_AcquireCredentialsHandleW(SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: thunks.c:53
SECURITY_STATUS SEC_ENTRY thunk_AcquireCredentialsHandleA(SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: thunks.c:26
SECURITY_STATUS SEC_ENTRY thunk_QueryCredentialsAttributesA(PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
Definition: thunks.c:83
SECURITY_STATUS SEC_ENTRY thunk_QueryCredentialsAttributesW(PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
Definition: thunks.c:136
SECURITY_STATUS SEC_ENTRY thunk_QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
Definition: thunks.c:766
SECURITY_STATUS SEC_ENTRY thunk_QueryContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
Definition: thunks.c:540
SECURITY_STATUS SEC_ENTRY thunk_InitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
Definition: thunks.c:189
SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextW(SEC_WCHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
Definition: thunks.c:880
#define DWORD_PTR
Definition: treelist.c:76
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG
Definition: typedefs.h:59
char * PSTR
Definition: typedefs.h:51
const uint16_t * PCWSTR
Definition: typedefs.h:57
const char * PCSTR
Definition: typedefs.h:52
uint32_t ULONG
Definition: typedefs.h:59
int ret
#define ZeroMemory
Definition: winbase.h:1712
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2084
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:243
_In_ LPCSTR lpAccountName
Definition: winbase.h:2741
#define WINAPI
Definition: msvc.h:6
#define SEC_E_OK
Definition: winerror.h:2356
#define ERROR_CANT_ACCESS_DOMAIN_INFO
Definition: winerror.h:832
#define SEC_E_INSUFFICIENT_MEMORY
Definition: winerror.h:2909
#define ERROR_INTERNAL_ERROR
Definition: winerror.h:840
#define ERROR_NONE_MAPPED
Definition: winerror.h:814
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
SECURITY_STATUS WINAPI EncryptMessage(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
Definition: wrapper.c:1006
SECURITY_STATUS WINAPI MakeSignature(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
Definition: wrapper.c:623
SECURITY_STATUS WINAPI AcquireCredentialsHandleW(SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: wrapper.c:105
SECURITY_STATUS WINAPI ExportSecurityContext(PCtxtHandle phContext, ULONG fFlags, PSecBuffer pPackedContext, void **pToken)
Definition: wrapper.c:807
SECURITY_STATUS WINAPI AddCredentialsW(PCredHandle hCredentials, SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PTimeStamp ptsExpiry)
Definition: wrapper.c:941
SECURITY_STATUS WINAPI InitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
Definition: wrapper.c:301
SECURITY_STATUS WINAPI CompleteAuthToken(PCtxtHandle phContext, PSecBufferDesc pToken)
Definition: wrapper.c:420
SECURITY_STATUS WINAPI ImportSecurityContextA(SEC_CHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
Definition: wrapper.c:837
SECURITY_STATUS WINAPI DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
Definition: wrapper.c:1036
SECURITY_STATUS WINAPI VerifySignature(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
Definition: wrapper.c:653
SECURITY_STATUS WINAPI QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
Definition: wrapper.c:535
SECURITY_STATUS WINAPI ApplyControlToken(PCtxtHandle phContext, PSecBufferDesc pInput)
Definition: wrapper.c:475
SECURITY_STATUS WINAPI ImportSecurityContextW(SEC_WCHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
Definition: wrapper.c:872
SECURITY_STATUS WINAPI QueryContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
Definition: wrapper.c:505
SECURITY_STATUS WINAPI AcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
Definition: wrapper.c:365
SECURITY_STATUS WINAPI AcquireCredentialsHandleA(SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse, PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn, PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: wrapper.c:59
SECURITY_STATUS WINAPI QueryCredentialsAttributesA(PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
Definition: wrapper.c:177
SECURITY_STATUS WINAPI InitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
Definition: wrapper.c:237
SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:450
SECURITY_STATUS WINAPI QuerySecurityPackageInfoW(SEC_WCHAR *pszPackageName, PSecPkgInfoW *ppPackageInfo)
Definition: wrapper.c:750
SECURITY_STATUS WINAPI ImpersonateSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:565
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151
SECURITY_STATUS WINAPI QuerySecurityPackageInfoA(SEC_CHAR *pszPackageName, PSecPkgInfoA *ppPackageInfo)
Definition: wrapper.c:683
SECURITY_STATUS WINAPI RevertSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:594
SECURITY_STATUS WINAPI QuerySecurityContextToken(PCtxtHandle phContext, HANDLE *phToken)
Definition: wrapper.c:976
SECURITY_STATUS WINAPI QueryCredentialsAttributesW(PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
Definition: wrapper.c:207
SECURITY_STATUS WINAPI AddCredentialsA(PCredHandle hCredentials, SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PTimeStamp ptsExpiry)
Definition: wrapper.c:906
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
unsigned char BYTE
Definition: xxhash.c:193