ReactOS  0.4.13-dev-544-gede3fdd
secur32_priv.h File Reference
#include <wine/list.h>
#include "wine/wine_supp.h"
Include dependency graph for secur32_priv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _SecureProvider
 
struct  _SecurePackage
 

Typedefs

typedef struct _SecureProvider SecureProvider
 
typedef struct _SecurePackage SecurePackage
 

Functions

SecureProviderSECUR32_addProvider (const SecurityFunctionTableA *fnTableA, const SecurityFunctionTableW *fnTableW, PCWSTR moduleName) DECLSPEC_HIDDEN
 
void SECUR32_addPackages (SecureProvider *provider, ULONG toAdd, const SecPkgInfoA *infoA, const SecPkgInfoW *infoW) DECLSPEC_HIDDEN
 
SecurePackageSECUR32_findPackageW (PCWSTR packageName) DECLSPEC_HIDDEN
 
SecurePackageSECUR32_findPackageA (PCSTR packageName) DECLSPEC_HIDDEN
 
PWSTR SECUR32_AllocWideFromMultiByte (PCSTR str) DECLSPEC_HIDDEN
 
PSTR SECUR32_AllocMultiByteFromWide (PCWSTR str) DECLSPEC_HIDDEN
 

Typedef Documentation

◆ SecurePackage

◆ SecureProvider

Function Documentation

◆ SECUR32_addPackages()

void SECUR32_addPackages ( SecureProvider provider,
ULONG  toAdd,
const SecPkgInfoA infoA,
const SecPkgInfoW infoW 
)

Definition at line 362 of file secur32_wine.c.

364 {
365  ULONG i;
366 
367  assert(provider);
368  assert(infoA || infoW);
369 
371 
372  if (!packageTable)
373  {
375  if (!packageTable)
376  {
378  return;
379  }
380 
383  }
384 
385  for (i = 0; i < toAdd; i++)
386  {
387  SecurePackage *package = HeapAlloc(GetProcessHeap(), 0, sizeof(SecurePackage));
388  if (!package)
389  continue;
390 
391  list_add_tail(&packageTable->table, &package->entry);
392 
393  package->provider = provider;
394  _copyPackageInfo(&package->infoW,
395  infoA ? &infoA[i] : NULL,
396  infoW ? &infoW[i] : NULL);
397  }
398  packageTable->numPackages += toAdd;
399 
401 }
static SecurePackageTable * packageTable
Definition: secur32_wine.c:52
static const SecPkgInfoA infoA
Definition: kerberos.c:302
#define assert(x)
Definition: debug.h:53
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
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
smooth NULL
Definition: ftsmooth.c:416
struct list table
Definition: secur32_wine.c:30
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static const SecPkgInfoW infoW
Definition: kerberos.c:293
SecureProvider * provider
Definition: schannel_priv.h:36
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
unsigned int ULONG
Definition: retypes.h:1
static void _copyPackageInfo(PSecPkgInfoW info, const SecPkgInfoA *inInfoA, const SecPkgInfoW *inInfoW)
Definition: secur32_wine.c:292
SecPkgInfoW infoW
Definition: schannel_priv.h:35
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION cs
Definition: secur32_wine.c:44

Referenced by _tryLoadProvider().

◆ SECUR32_addProvider()

SecureProvider* SECUR32_addProvider ( const SecurityFunctionTableA fnTableA,
const SecurityFunctionTableW fnTableW,
PCWSTR  moduleName 
)

Definition at line 314 of file secur32_wine.c.

316 {
318 
320 
321  if (!providerTable)
322  {
324  if (!providerTable)
325  {
327  return NULL;
328  }
329 
331  }
332 
333  ret = HeapAlloc(GetProcessHeap(), 0, sizeof(SecureProvider));
334  if (!ret)
335  {
337  return NULL;
338  }
339 
340  list_add_tail(&providerTable->table, &ret->entry);
341  ret->lib = NULL;
342 
343 #ifndef __REACTOS__
344  if (fnTableA || fnTableW)
345  {
346  ret->moduleName = moduleName ? SECUR32_strdupW(moduleName) : NULL;
347  _makeFnTableA(&ret->fnTableA, fnTableA, fnTableW);
348  _makeFnTableW(&ret->fnTableW, fnTableA, fnTableW);
349  ret->loaded = !moduleName;
350  }
351  else
352 #endif
353  {
354  ret->moduleName = SECUR32_strdupW(moduleName);
355  ret->loaded = FALSE;
356  }
357 
359  return ret;
360 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static void _makeFnTableA(PSecurityFunctionTableA fnTableA, const SecurityFunctionTableA *inFnTableA, const SecurityFunctionTableW *inFnTableW)
Definition: sspi.c:199
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
static SecureProviderTable * providerTable
Definition: secur32_wine.c:53
static PWSTR SECUR32_strdupW(PCWSTR str)
Definition: secur32_wine.c:231
static void _makeFnTableW(PSecurityFunctionTableW fnTableW, const SecurityFunctionTableA *inFnTableA, const SecurityFunctionTableW *inFnTableW)
Definition: sspi.c:270
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION cs
Definition: secur32_wine.c:44

Referenced by _tryLoadProvider().

◆ SECUR32_AllocMultiByteFromWide()

PSTR SECUR32_AllocMultiByteFromWide ( PCWSTR  str)

Definition at line 268 of file secur32_wine.c.

269 {
270  PSTR ret;
271 
272  if (str)
273  {
274  int charsNeeded = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0,
275  NULL, NULL);
276 
277  if (charsNeeded)
278  {
279  ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded);
280  if (ret)
281  WideCharToMultiByte(CP_ACP, 0, str, -1, ret, charsNeeded,
282  NULL, NULL);
283  }
284  else
285  ret = NULL;
286  }
287  else
288  ret = NULL;
289  return ret;
290 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
signed char * PSTR
Definition: retypes.h:7

Referenced by thunk_AcquireCredentialsHandleW(), thunk_AddCredentialsW(), thunk_ContextAttributesWToA(), thunk_InitializeSecurityContextW(), and thunk_QueryCredentialsAttributesA().

◆ SECUR32_AllocWideFromMultiByte()

PWSTR SECUR32_AllocWideFromMultiByte ( PCSTR  str)

Definition at line 246 of file secur32_wine.c.

247 {
248  PWSTR ret;
249 
250  if (str)
251  {
252  int charsNeeded = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
253 
254  if (charsNeeded)
255  {
256  ret = HeapAlloc(GetProcessHeap(), 0, charsNeeded * sizeof(WCHAR));
257  if (ret)
258  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, charsNeeded);
259  }
260  else
261  ret = NULL;
262  }
263  else
264  ret = NULL;
265  return ret;
266 }
uint16_t * PWSTR
Definition: typedefs.h:54
#define CP_ACP
Definition: compat.h:99
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by _copyPackageInfo(), thunk_ContextAttributesAToW(), and thunk_QueryCredentialsAttributesW().

◆ SECUR32_findPackageA()

SecurePackage* SECUR32_findPackageA ( PCSTR  packageName)

Definition at line 631 of file sspi.c.

632 {
634 
635  if (packageName)
636  {
637  UNICODE_STRING package;
638 
639  RtlCreateUnicodeStringFromAsciiz(&package, packageName);
640  ret = SECUR32_findPackageW(package.Buffer);
641  RtlFreeUnicodeString(&package);
642  }
643  else
644  ret = NULL;
645  return ret;
646 }
SecurePackage * SECUR32_findPackageW(PCWSTR packageName)
Definition: sspi.c:577
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
int ret

◆ SECUR32_findPackageW()

SecurePackage* SECUR32_findPackageW ( PCWSTR  packageName)

Definition at line 577 of file sspi.c.

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 }
#define TRUE
Definition: types.h:120
#define SECURITY_ENTRYPOINT_ANSIA
Definition: sspi.h:935
static void _makeFnTableA(PSecurityFunctionTableA fnTableA, const SecurityFunctionTableA *inFnTableA, const SecurityFunctionTableW *inFnTableW)
Definition: sspi.c:199
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define SECURITY_ENTRYPOINT_ANSIW
Definition: sspi.h:936
unsigned int BOOL
Definition: ntddk_ex.h:94
PSecurityFunctionTableA(SEC_ENTRY * INIT_SECURITY_INTERFACE_A)(void)
Definition: sspi.h:1016
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
struct list table
Definition: secur32_wine.c:30
static SecurePackageTable * packageTable
Definition: sspi.c:55
PSecurityFunctionTableW(SEC_ENTRY * INIT_SECURITY_INTERFACE_W)(void)
Definition: sspi.h:1017
static SecurityFunctionTableA securityFunctionTableA
Definition: sspi.c:58
int ret
uint32_t entry
Definition: isohybrid.c:63
static SecurityFunctionTableW securityFunctionTableW
Definition: sspi.c:89
static void _makeFnTableW(PSecurityFunctionTableW fnTableW, const SecurityFunctionTableA *inFnTableA, const SecurityFunctionTableW *inFnTableW)
Definition: sspi.c:270
#define GetProcAddress(x, y)
Definition: compat.h:410
static void SECUR32_initializeProviders(void)
Definition: sspi.c:523

Referenced by SECUR32_findPackageA().