ReactOS 0.4.15-dev-7958-gcd0bb1a
thunks.c File Reference
#include "precomp.h"
#include "wine/debug.h"
Include dependency graph for thunks.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (secur32)
 
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)
 
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)
 
SECURITY_STATUS SEC_ENTRY thunk_QueryCredentialsAttributesA (PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS SEC_ENTRY thunk_QueryCredentialsAttributesW (PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
 
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)
 
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)
 
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)
 
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)
 
static PSecPkgInfoA _copyPackageInfoFlatWToA (const SecPkgInfoW *infoW)
 
static SECURITY_STATUS thunk_ContextAttributesWToA (SecurePackage *package, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS SEC_ENTRY thunk_QueryContextAttributesA (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
 
static PSecPkgInfoW _copyPackageInfoFlatAToW (const SecPkgInfoA *infoA)
 
static SECURITY_STATUS thunk_ContextAttributesAToW (SecurePackage *package, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS SEC_ENTRY thunk_QueryContextAttributesW (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS SEC_ENTRY thunk_SetContextAttributesA (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
 
SECURITY_STATUS SEC_ENTRY thunk_SetContextAttributesW (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
 
SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextA (SEC_CHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
 
SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextW (SEC_WCHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
 

Function Documentation

◆ _copyPackageInfoFlatAToW()

static PSecPkgInfoW _copyPackageInfoFlatAToW ( const SecPkgInfoA infoA)
static

Definition at line 572 of file thunks.c.

573{
575
576 if (infoA)
577 {
578 size_t bytesNeeded = sizeof(SecPkgInfoW);
579 int nameLen = 0, commentLen = 0;
580
581 if (infoA->Name)
582 {
583 nameLen = MultiByteToWideChar(CP_ACP, 0, infoA->Name, -1,
584 NULL, 0);
585 bytesNeeded += nameLen * sizeof(WCHAR);
586 }
587 if (infoA->Comment)
588 {
589 commentLen = MultiByteToWideChar(CP_ACP, 0, infoA->Comment, -1,
590 NULL, 0);
591 bytesNeeded += commentLen * sizeof(WCHAR);
592 }
593 ret = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
594 if (ret)
595 {
596 PWSTR nextString = (PWSTR)((PBYTE)ret + sizeof(SecPkgInfoW));
597
598 memcpy(ret, infoA, sizeof(SecPkgInfoA));
599 if (infoA->Name)
600 {
601 ret->Name = nextString;
602 MultiByteToWideChar(CP_ACP, 0, infoA->Name, -1, nextString,
603 nameLen);
604 nextString += nameLen;
605 }
606 else
607 ret->Name = NULL;
608 if (infoA->Comment)
609 {
610 ret->Comment = nextString;
611 MultiByteToWideChar(CP_ACP, 0, infoA->Comment, -1, nextString,
612 commentLen);
613 }
614 else
615 ret->Comment = NULL;
616 }
617 }
618 else
619 ret = NULL;
620 return ret;
621}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define MultiByteToWideChar
Definition: compat.h:110
static const SecPkgInfoA infoA
Definition: kerberos.c:302
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BYTE * PBYTE
Definition: pedump.c:66
struct _SecPkgInfoW SecPkgInfoW
SEC_CHAR * Comment
Definition: sspi.h:109
SEC_CHAR * Name
Definition: sspi.h:108
uint16_t * PWSTR
Definition: typedefs.h:56
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by thunk_ContextAttributesAToW().

◆ _copyPackageInfoFlatWToA()

static PSecPkgInfoA _copyPackageInfoFlatWToA ( const SecPkgInfoW infoW)
static

Definition at line 347 of file thunks.c.

348{
350
351 if (infoW)
352 {
353 size_t bytesNeeded = sizeof(SecPkgInfoA);
354 int nameLen = 0, commentLen = 0;
355
356 if (infoW->Name)
357 {
358 nameLen = WideCharToMultiByte(CP_ACP, 0, infoW->Name, -1,
359 NULL, 0, NULL, NULL);
360 bytesNeeded += nameLen;
361 }
362 if (infoW->Comment)
363 {
364 commentLen = WideCharToMultiByte(CP_ACP, 0, infoW->Comment, -1,
365 NULL, 0, NULL, NULL);
366 bytesNeeded += commentLen;
367 }
368 ret = HeapAlloc(GetProcessHeap(), 0, bytesNeeded);
369 if (ret)
370 {
371 PSTR nextString = (PSTR)((PBYTE)ret + sizeof(SecPkgInfoA));
372
373 memcpy(ret, infoW, sizeof(SecPkgInfoA));
374 if (infoW->Name)
375 {
376 ret->Name = nextString;
377 WideCharToMultiByte(CP_ACP, 0, infoW->Name, -1, nextString,
378 nameLen, NULL, NULL);
379 nextString += nameLen;
380 }
381 else
382 ret->Name = NULL;
383 if (infoW->Comment)
384 {
385 ret->Comment = nextString;
386 WideCharToMultiByte(CP_ACP, 0, infoW->Comment, -1, nextString,
387 nameLen, NULL, NULL);
388 }
389 else
390 ret->Comment = NULL;
391 }
392 }
393 else
394 ret = NULL;
395 return ret;
396}
#define WideCharToMultiByte
Definition: compat.h:111
static const SecPkgInfoW infoW
Definition: kerberos.c:293
struct _SecPkgInfoA SecPkgInfoA
SEC_WCHAR * Comment
Definition: sspi.h:119
SEC_WCHAR * Name
Definition: sspi.h:118
char * PSTR
Definition: typedefs.h:51

Referenced by thunk_ContextAttributesWToA().

◆ thunk_AcquireCredentialsHandleA()

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 at line 26 of file thunks.c.

30{
32
33 TRACE("%s %s %d %p %p %p %p %p %p\n", debugstr_a(pszPrincipal),
34 debugstr_a(pszPackage), fCredentialsUse, pvLogonID, pAuthData, pGetKeyFn,
35 pvGetKeyArgument, phCredential, ptsExpiry);
36 if (pszPackage)
37 {
38 UNICODE_STRING principal, package;
39
40 RtlCreateUnicodeStringFromAsciiz(&principal, pszPrincipal);
41 RtlCreateUnicodeStringFromAsciiz(&package, pszPackage);
42 ret = AcquireCredentialsHandleW(principal.Buffer, package.Buffer,
43 fCredentialsUse, pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument,
44 phCredential, ptsExpiry);
45 RtlFreeUnicodeString(&principal);
46 RtlFreeUnicodeString(&package);
47 }
48 else
50 return ret;
51}
#define debugstr_a
Definition: kernel32.h:31
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
LONG SECURITY_STATUS
Definition: sspi.h:34
#define TRACE(s)
Definition: solgame.cpp:4
#define SEC_E_SECPKG_NOT_FOUND
Definition: winerror.h:2914
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

Referenced by _makeFnTableA().

◆ thunk_AcquireCredentialsHandleW()

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 at line 53 of file thunks.c.

57{
59
60 TRACE("%s %s %d %p %p %p %p %p %p\n", debugstr_w(pszPrincipal),
61 debugstr_w(pszPackage), fCredentialsUse, pvLogonID, pAuthData, pGetKeyFn,
62 pvGetKeyArgument, phCredential, ptsExpiry);
63 if (pszPackage)
64 {
65 PSTR principal, package;
66
67 principal = SECUR32_AllocMultiByteFromWide(pszPrincipal);
68 package = SECUR32_AllocMultiByteFromWide(pszPackage);
69 ret = AcquireCredentialsHandleA(principal, package, fCredentialsUse,
70 pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential,
71 ptsExpiry);
72 HeapFree(GetProcessHeap(), 0, principal);
73 HeapFree(GetProcessHeap(), 0, package);
74 }
75 else
77 return ret;
78}
#define HeapFree(x, y, z)
Definition: compat.h:735
#define debugstr_w
Definition: kernel32.h:32
PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str)
Definition: secur32_wine.c:268
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

Referenced by _makeFnTableW().

◆ thunk_AddCredentialsA()

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 at line 268 of file thunks.c.

272{
274
275 TRACE("%p %s %s %d %p %p %p %p\n", hCredentials, debugstr_a(pszPrincipal),
276 debugstr_a(pszPackage), fCredentialUse, pAuthData, pGetKeyFn,
277 pvGetKeyArgument, ptsExpiry);
278 if (hCredentials)
279 {
280 SecurePackage *package = (SecurePackage *)hCredentials->dwUpper;
281 PCredHandle cred = (PCtxtHandle)hCredentials->dwLower;
282
283 if (package && package->provider)
284 {
285 if (package->provider->fnTableW.AddCredentialsW)
286 {
287 UNICODE_STRING szPrincipal, szPackage;
288
289 RtlCreateUnicodeStringFromAsciiz(&szPrincipal, pszPrincipal);
290 RtlCreateUnicodeStringFromAsciiz(&szPackage, pszPackage);
291 ret = package->provider->fnTableW.AddCredentialsW(
292 cred, szPrincipal.Buffer, szPackage.Buffer, fCredentialUse,
293 pAuthData, pGetKeyFn, pvGetKeyArgument, ptsExpiry);
294 RtlFreeUnicodeString(&szPrincipal);
295 RtlFreeUnicodeString(&szPackage);
296 }
297 else
299 }
300 else
302 }
303 else
305 return ret;
306}
if(dx< 0)
Definition: linetemp.h:194
PSecHandle PCtxtHandle
Definition: sspi.h:71
ULONG_PTR dwLower
Definition: sspi.h:53
#define SEC_E_INVALID_HANDLE
Definition: winerror.h:2910
#define SEC_E_UNSUPPORTED_FUNCTION
Definition: winerror.h:2911

Referenced by _makeFnTableA().

◆ thunk_AddCredentialsW()

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 at line 308 of file thunks.c.

312{
314
315 TRACE("%p %s %s %d %p %p %p %p\n", hCredentials, debugstr_w(pszPrincipal),
316 debugstr_w(pszPackage), fCredentialUse, pAuthData, pGetKeyFn,
317 pvGetKeyArgument, ptsExpiry);
318 if (hCredentials)
319 {
320 SecurePackage *package = (SecurePackage *)hCredentials->dwUpper;
321 PCredHandle cred = (PCtxtHandle)hCredentials->dwLower;
322
323 if (package && package->provider)
324 {
325 if (package->provider->fnTableA.AddCredentialsA)
326 {
327 PSTR szPrincipal = SECUR32_AllocMultiByteFromWide(pszPrincipal);
328 PSTR szPackage = SECUR32_AllocMultiByteFromWide(pszPackage);
329
330 ret = package->provider->fnTableA.AddCredentialsA(
331 cred, szPrincipal, szPackage, fCredentialUse, pAuthData,
332 pGetKeyFn, pvGetKeyArgument, ptsExpiry);
333 HeapFree(GetProcessHeap(), 0, szPrincipal);
334 HeapFree(GetProcessHeap(), 0, szPackage);
335 }
336 else
338 }
339 else
341 }
342 else
344 return ret;
345}

Referenced by _makeFnTableW().

◆ thunk_ContextAttributesAToW()

static SECURITY_STATUS thunk_ContextAttributesAToW ( SecurePackage package,
ULONG  ulAttribute,
void pBuffer 
)
static

Definition at line 623 of file thunks.c.

625{
627
628 if (package && pBuffer)
629 {
630 switch (ulAttribute)
631 {
633 {
635 SEC_CHAR *oldUser = names->sUserName;
636
637 if (oldUser)
638 {
639 names->sUserName =
641 package->provider->fnTableW.FreeContextBuffer(oldUser);
642 }
643 break;
644 }
646 {
649 SEC_CHAR *oldAuth = names->sAuthorityName;
650
651 if (oldAuth)
652 {
653 names->sAuthorityName =
655 package->provider->fnTableW.FreeContextBuffer(oldAuth);
656 }
657 break;
658 }
660 {
662 SEC_CHAR *oldSigAlgName = info->sSignatureAlgorithmName;
663 SEC_CHAR *oldEncAlgName = info->sEncryptAlgorithmName;
664
665 if (oldSigAlgName)
666 {
667 info->sSignatureAlgorithmName =
668 (PSTR)SECUR32_AllocWideFromMultiByte(oldSigAlgName);
670 oldSigAlgName);
671 }
672 if (oldEncAlgName)
673 {
674 info->sEncryptAlgorithmName =
676 oldEncAlgName);
678 oldEncAlgName);
679 }
680 break;
681 }
683 {
686 PSecPkgInfoA oldPkgInfo = info->PackageInfo;
687
688 if (oldPkgInfo)
689 {
690 info->PackageInfo = (PSecPkgInfoA)
691 _copyPackageInfoFlatAToW(oldPkgInfo);
692 package->provider->fnTableW.FreeContextBuffer(oldPkgInfo);
693 }
694 break;
695 }
697 {
700 PSecPkgInfoA oldPkgInfo = info->PackageInfo;
701
702 if (oldPkgInfo)
703 {
704 info->PackageInfo = (PSecPkgInfoA)
705 _copyPackageInfoFlatAToW(oldPkgInfo);
706 package->provider->fnTableW.FreeContextBuffer(oldPkgInfo);
707 }
708 break;
709 }
711 {
714 PSTR oldClient = names->sClientName;
715 PSTR oldServer = names->sServerName;
716
717 if (oldClient)
718 {
720 oldClient);
721 package->provider->fnTableW.FreeContextBuffer(oldClient);
722 }
723 if (oldServer)
724 {
726 oldServer);
727 package->provider->fnTableW.FreeContextBuffer(oldServer);
728 }
729 break;
730 }
732 {
735 PSTR oldCred = name->sCredentialName;
736
737 if (oldCred)
738 {
739 name->sCredentialName =
741 package->provider->fnTableW.FreeContextBuffer(oldCred);
742 }
743 break;
744 }
745 /* no thunking needed: */
755 break;
756 default:
757 WARN("attribute type %d unknown\n", ulAttribute);
759 }
760 }
761 else
763 return ret;
764}
#define WARN(fmt,...)
Definition: debug.h:112
GLuint GLuint * names
Definition: glext.h:11545
#define SECPKG_ATTR_ACCESS_TOKEN
Definition: sspi.h:539
struct _SecPkgContext_CredentialNameA * PSecPkgContext_CredentialNameA
struct _SecPkgContext_NativeNamesA * PSecPkgContext_NativeNamesA
#define SECPKG_ATTR_SESSION_KEY
Definition: sspi.h:530
struct _SecPkgContext_KeyInfoA * PSecPkgContext_KeyInfoA
#define SECPKG_ATTR_AUTHORITY
Definition: sspi.h:527
#define SECPKG_ATTR_KEY_INFO
Definition: sspi.h:526
#define SECPKG_ATTR_PACKAGE_INFO
Definition: sspi.h:531
CHAR SEC_CHAR
Definition: sspi.h:30
#define SECPKG_ATTR_NEGOTIATION_INFO
Definition: sspi.h:533
struct _SecPkgContext_NegotiationInfoA * PSecPkgContext_NegotiationInfoA
#define SECPKG_ATTR_CREDENTIAL_NAME
Definition: sspi.h:537
struct _SecPkgContext_PackageInfoA * PSecPkgContext_PackageInfoA
struct _SecPkgContext_AuthorityA * PSecPkgContext_AuthorityA
#define SECPKG_ATTR_TARGET_INFORMATION
Definition: sspi.h:538
struct _SecPkgInfoA * PSecPkgInfoA
struct _SecPkgContext_NamesA * PSecPkgContext_NamesA
#define SECPKG_ATTR_PASSWORD_EXPIRY
Definition: sspi.h:529
#define SECPKG_ATTR_LIFESPAN
Definition: sspi.h:523
#define SECPKG_ATTR_SIZES
Definition: sspi.h:521
#define SECPKG_ATTR_STREAM_SIZES
Definition: sspi.h:525
#define SECPKG_ATTR_FLAGS
Definition: sspi.h:535
#define SECPKG_ATTR_NAMES
Definition: sspi.h:522
#define SECPKG_ATTR_DCE_INFO
Definition: sspi.h:524
#define SECPKG_ATTR_NATIVE_NAMES
Definition: sspi.h:534
PVOID pBuffer
PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str)
Definition: secur32_wine.c:246
FREE_CONTEXT_BUFFER_FN FreeContextBuffer
Definition: sspi.h:1006
SecureProvider * provider
Definition: schannel_priv.h:36
SecurityFunctionTableW fnTableW
Definition: secur32_priv.h:33
Definition: name.c:39
static PSecPkgInfoW _copyPackageInfoFlatAToW(const SecPkgInfoA *infoA)
Definition: thunks.c:572
#define SEC_E_OK
Definition: winerror.h:2356
#define SEC_E_INTERNAL_ERROR
Definition: winerror.h:2913
#define SEC_E_INVALID_TOKEN
Definition: winerror.h:2917

Referenced by thunk_QueryContextAttributesW(), and thunk_SetContextAttributesW().

◆ thunk_ContextAttributesWToA()

static SECURITY_STATUS thunk_ContextAttributesWToA ( SecurePackage package,
ULONG  ulAttribute,
void pBuffer 
)
static

Definition at line 398 of file thunks.c.

400{
402
403 if (package && pBuffer)
404 {
405 switch (ulAttribute)
406 {
408 {
410 SEC_WCHAR *oldUser = names->sUserName;
411
412 if (oldUser)
413 {
414 names->sUserName =
416 package->provider->fnTableW.FreeContextBuffer(oldUser);
417 }
418 break;
419 }
421 {
424 SEC_WCHAR *oldAuth = names->sAuthorityName;
425
426 if (oldAuth)
427 {
428 names->sAuthorityName =
430 package->provider->fnTableW.FreeContextBuffer(oldAuth);
431 }
432 break;
433 }
435 {
437 SEC_WCHAR *oldSigAlgName = info->sSignatureAlgorithmName;
438 SEC_WCHAR *oldEncAlgName = info->sEncryptAlgorithmName;
439
440 if (oldSigAlgName)
441 {
442 info->sSignatureAlgorithmName =
445 oldSigAlgName);
446 }
447 if (oldEncAlgName)
448 {
449 info->sEncryptAlgorithmName =
452 oldEncAlgName);
453 }
454 break;
455 }
457 {
460 PSecPkgInfoW oldPkgInfo = info->PackageInfo;
461
462 if (oldPkgInfo)
463 {
464 info->PackageInfo = (PSecPkgInfoW)
465 _copyPackageInfoFlatWToA(oldPkgInfo);
466 package->provider->fnTableW.FreeContextBuffer(oldPkgInfo);
467 }
468 break;
469 }
471 {
474 PSecPkgInfoW oldPkgInfo = info->PackageInfo;
475
476 if (oldPkgInfo)
477 {
478 info->PackageInfo = (PSecPkgInfoW)
479 _copyPackageInfoFlatWToA(oldPkgInfo);
480 package->provider->fnTableW.FreeContextBuffer(oldPkgInfo);
481 }
482 break;
483 }
485 {
488 PWSTR oldClient = names->sClientName;
489 PWSTR oldServer = names->sServerName;
490
491 if (oldClient)
492 {
494 oldClient);
495 package->provider->fnTableW.FreeContextBuffer(oldClient);
496 }
497 if (oldServer)
498 {
500 oldServer);
501 package->provider->fnTableW.FreeContextBuffer(oldServer);
502 }
503 break;
504 }
506 {
509 PWSTR oldCred = name->sCredentialName;
510
511 if (oldCred)
512 {
513 name->sCredentialName =
515 package->provider->fnTableW.FreeContextBuffer(oldCred);
516 }
517 break;
518 }
519 /* no thunking needed: */
529 break;
530 default:
531 WARN("attribute type %d unknown\n", ulAttribute);
533 }
534 }
535 else
537 return ret;
538}
struct _SecPkgContext_PackageInfoW * PSecPkgContext_PackageInfoW
struct _SecPkgInfoW * PSecPkgInfoW
struct _SecPkgContext_NamesW * PSecPkgContext_NamesW
struct _SecPkgContext_NativeNamesW * PSecPkgContext_NativeNamesW
struct _SecPkgContext_AuthorityW * PSecPkgContext_AuthorityW
struct _SecPkgContext_KeyInfoW * PSecPkgContext_KeyInfoW
WCHAR SEC_WCHAR
Definition: sspi.h:29
struct _SecPkgContext_NegotiationInfoW * PSecPkgContext_NegotiationInfoW
struct _SecPkgContext_CredentialNameW * PSecPkgContext_CredentialNameW
static PSecPkgInfoA _copyPackageInfoFlatWToA(const SecPkgInfoW *infoW)
Definition: thunks.c:347

Referenced by thunk_QueryContextAttributesA(), and thunk_SetContextAttributesA().

◆ thunk_ImportSecurityContextA()

SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextA ( SEC_CHAR pszPackage,
PSecBuffer  pPackedContext,
void Token,
PCtxtHandle  phContext 
)

Definition at line 864 of file thunks.c.

867{
869 UNICODE_STRING package;
870
871 TRACE("%s %p %p %p\n", debugstr_a(pszPackage), pPackedContext, Token,
872 phContext);
873 RtlCreateUnicodeStringFromAsciiz(&package, pszPackage);
874 ret = ImportSecurityContextW(package.Buffer, pPackedContext, Token,
875 phContext);
876 RtlFreeUnicodeString(&package);
877 return ret;
878}
SECURITY_STATUS WINAPI ImportSecurityContextW(SEC_WCHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
Definition: wrapper.c:872

Referenced by _makeFnTableA().

◆ thunk_ImportSecurityContextW()

SECURITY_STATUS SEC_ENTRY thunk_ImportSecurityContextW ( SEC_WCHAR pszPackage,
PSecBuffer  pPackedContext,
void Token,
PCtxtHandle  phContext 
)

Definition at line 880 of file thunks.c.

883{
885 PSTR package = SECUR32_AllocMultiByteFromWide(pszPackage);
886
887 TRACE("%s %p %p %p\n", debugstr_w(pszPackage), pPackedContext, Token,
888 phContext);
889 ret = ImportSecurityContextA(package, pPackedContext, Token, phContext);
890 HeapFree(GetProcessHeap(), 0, package);
891 return ret;
892}
SECURITY_STATUS WINAPI ImportSecurityContextA(SEC_CHAR *pszPackage, PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext)
Definition: wrapper.c:837

Referenced by _makeFnTableW().

◆ thunk_InitializeSecurityContextA()

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 at line 189 of file thunks.c.

195{
197
198 TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
199 debugstr_a(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
200 Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
201 if (phCredential)
202 {
203 SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
204
205 if (package && package->provider)
206 {
207 if (package->provider->fnTableW.InitializeSecurityContextW)
208 {
210
212 ret = package->provider->fnTableW.InitializeSecurityContextW(
213 phCredential, phContext, target.Buffer, fContextReq, Reserved1,
214 TargetDataRep, pInput, Reserved2, phNewContext, pOutput,
215 pfContextAttr, ptsExpiry);
217 }
218 else
220 }
221 else
223 }
224 else
226 return ret;
227}
@ Reserved2
Definition: bcd.h:202
@ Reserved1
Definition: bcd.h:201
GLenum target
Definition: glext.h:7315

Referenced by _makeFnTableA().

◆ thunk_InitializeSecurityContextW()

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 at line 229 of file thunks.c.

235{
237
238 TRACE("%p %p %s %d %d %d %p %d %p %p %p %p\n", phCredential, phContext,
239 debugstr_w(pszTargetName), fContextReq, Reserved1, TargetDataRep, pInput,
240 Reserved1, phNewContext, pOutput, pfContextAttr, ptsExpiry);
241 if (phCredential)
242 {
243 SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
244
245 if (package && package->provider)
246 {
247 if (package->provider->fnTableA.InitializeSecurityContextA)
248 {
250
251 ret = package->provider->fnTableA.InitializeSecurityContextA(
252 phCredential, phContext, target, fContextReq, Reserved1,
253 TargetDataRep, pInput, Reserved2, phNewContext, pOutput,
254 pfContextAttr, ptsExpiry);
256 }
257 else
259 }
260 else
262 }
263 else
265 return ret;
266}

Referenced by _makeFnTableW().

◆ thunk_QueryContextAttributesA()

SECURITY_STATUS SEC_ENTRY thunk_QueryContextAttributesA ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void pBuffer 
)

Definition at line 540 of file thunks.c.

542{
544
545 TRACE("%p %d %p\n", phContext, ulAttribute, pBuffer);
546 if (phContext)
547 {
548 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
549 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
550
551 if (package && package->provider)
552 {
553 if (package->provider->fnTableW.QueryContextAttributesW)
554 {
555 ret = package->provider->fnTableW.QueryContextAttributesW(
556 ctxt, ulAttribute, pBuffer);
557 if (ret == SEC_E_OK)
558 ret = thunk_ContextAttributesWToA(package, ulAttribute,
559 pBuffer);
560 }
561 else
563 }
564 else
566 }
567 else
569 return ret;
570}
static SECURITY_STATUS thunk_ContextAttributesWToA(SecurePackage *package, ULONG ulAttribute, void *pBuffer)
Definition: thunks.c:398

Referenced by _makeFnTableA().

◆ thunk_QueryContextAttributesW()

SECURITY_STATUS SEC_ENTRY thunk_QueryContextAttributesW ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void pBuffer 
)

Definition at line 766 of file thunks.c.

768{
770
771 TRACE("%p %d %p\n", phContext, ulAttribute, pBuffer);
772 if (phContext)
773 {
774 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
775 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
776
777 if (package && package->provider)
778 {
779 if (package->provider->fnTableA.QueryContextAttributesA)
780 {
781 ret = package->provider->fnTableA.QueryContextAttributesA(
782 ctxt, ulAttribute, pBuffer);
783 if (ret == SEC_E_OK)
784 ret = thunk_ContextAttributesAToW(package, ulAttribute,
785 pBuffer);
786 }
787 else
789 }
790 else
792 }
793 else
795 return ret;
796}
static SECURITY_STATUS thunk_ContextAttributesAToW(SecurePackage *package, ULONG ulAttribute, void *pBuffer)
Definition: thunks.c:623

Referenced by _makeFnTableW().

◆ thunk_QueryCredentialsAttributesA()

SECURITY_STATUS SEC_ENTRY thunk_QueryCredentialsAttributesA ( PCredHandle  phCredential,
ULONG  ulAttribute,
void pBuffer 
)

Definition at line 83 of file thunks.c.

85{
87
88 TRACE("%p %d %p\n", phCredential, ulAttribute, pBuffer);
89 if (phCredential)
90 {
91 SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
92 PCredHandle cred = (PCredHandle)phCredential->dwLower;
93
94 if (package && package->provider)
95 {
96 if (package->provider->fnTableW.QueryCredentialsAttributesW)
97 {
98 ret = package->provider->fnTableW.QueryCredentialsAttributesW(
99 cred, ulAttribute, pBuffer);
100 if (ret == SEC_E_OK)
101 {
102 switch (ulAttribute)
103 {
105 {
108 SEC_WCHAR *oldUser = names->sUserName;
109
110 if (oldUser)
111 {
112 names->sUserName =
114 package->provider->fnTableW.FreeContextBuffer(
115 oldUser);
116 }
117 break;
118 }
119 default:
120 WARN("attribute type %d unknown\n", ulAttribute);
122 }
123 }
124 }
125 else
127 }
128 else
130 }
131 else
133 return ret;
134}
#define SECPKG_CRED_ATTR_NAMES
Definition: sspi.h:246
struct _SecPkgCredentials_NamesW * PSecPkgCredentials_NamesW
PSecHandle PCredHandle
Definition: sspi.h:68

Referenced by _makeFnTableA().

◆ thunk_QueryCredentialsAttributesW()

SECURITY_STATUS SEC_ENTRY thunk_QueryCredentialsAttributesW ( PCredHandle  phCredential,
ULONG  ulAttribute,
void pBuffer 
)

Definition at line 136 of file thunks.c.

138{
140
141 TRACE("%p %d %p\n", phCredential, ulAttribute, pBuffer);
142 if (phCredential)
143 {
144 SecurePackage *package = (SecurePackage *)phCredential->dwUpper;
145 PCredHandle cred = (PCredHandle)phCredential->dwLower;
146
147 if (package && package->provider)
148 {
149 if (package->provider->fnTableA.QueryCredentialsAttributesA)
150 {
151 ret = package->provider->fnTableA.QueryCredentialsAttributesA(
152 cred, ulAttribute, pBuffer);
153 if (ret == SEC_E_OK)
154 {
155 switch (ulAttribute)
156 {
158 {
161 SEC_CHAR *oldUser = names->sUserName;
162
163 if (oldUser)
164 {
165 names->sUserName =
167 package->provider->fnTableA.FreeContextBuffer(
168 oldUser);
169 }
170 break;
171 }
172 default:
173 WARN("attribute type %d unknown\n", ulAttribute);
175 }
176 }
177 }
178 else
180 }
181 else
183 }
184 else
186 return ret;
187}
struct _SecPkgCredentials_NamesA * PSecPkgCredentials_NamesA

Referenced by _makeFnTableW().

◆ thunk_SetContextAttributesA()

SECURITY_STATUS SEC_ENTRY thunk_SetContextAttributesA ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void pBuffer,
ULONG  cbBuffer 
)

Definition at line 798 of file thunks.c.

800{
802
803 TRACE("%p %d %p %d\n", phContext, ulAttribute, pBuffer, cbBuffer);
804 if (phContext)
805 {
806 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
807 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
808
809 if (package && package->provider && pBuffer && cbBuffer)
810 {
811 if (package->provider->fnTableW.SetContextAttributesW)
812 {
813 /* TODO: gotta validate size too! */
814 ret = thunk_ContextAttributesWToA(package, ulAttribute,
815 pBuffer);
816 if (ret == SEC_E_OK)
817 ret = package->provider->fnTableW.SetContextAttributesW(
818 ctxt, ulAttribute, pBuffer, cbBuffer);
819 }
820 else
822 }
823 else
825 }
826 else
828 return ret;
829}

Referenced by _makeFnTableA().

◆ thunk_SetContextAttributesW()

SECURITY_STATUS SEC_ENTRY thunk_SetContextAttributesW ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void pBuffer,
ULONG  cbBuffer 
)

Definition at line 831 of file thunks.c.

833{
835
836 TRACE("%p %d %p %d\n", phContext, ulAttribute, pBuffer, cbBuffer);
837 if (phContext)
838 {
839 SecurePackage *package = (SecurePackage *)phContext->dwUpper;
840 PCtxtHandle ctxt = (PCtxtHandle)phContext->dwLower;
841
842 if (package && package->provider && pBuffer && cbBuffer)
843 {
844 if (package->provider->fnTableA.SetContextAttributesA)
845 {
846 /* TODO: gotta validate size too! */
847 ret = thunk_ContextAttributesAToW(package, ulAttribute,
848 pBuffer);
849 if (ret == SEC_E_OK)
850 ret = package->provider->fnTableA.SetContextAttributesA(
851 ctxt, ulAttribute, pBuffer, cbBuffer);
852 }
853 else
855 }
856 else
858 }
859 else
861 return ret;
862}

Referenced by _makeFnTableW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( secur32  )