Begin stubs of built-in schannel provider.
[wine] / dlls / secur32 / secur32_priv.h
1 /*
2  * secur32 private definitions.
3  *
4  * Copyright (C) 2004 Juan Lang
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __SECUR32_PRIV_H__
22 #define __SECUR32_PRIV_H__
23
24 /* Memory allocation functions for memory accessible by callers of secur32.
25  * There is no REALLOC, because LocalReAlloc can only work if used in
26  * conjunction with LMEM_MOVEABLE and LocalLock, but callers aren't using
27  * LocalLock.  I don't use the Heap functions because there seems to be an
28  * implicit assumption that LocalAlloc and Free will be used--MS' secur32
29  * imports them (but not the heap functions), the sample SSP uses them, and
30  * there isn't an exported secur32 function to allocate memory.
31  */
32 #define SECUR32_ALLOC(bytes) LocalAlloc(0, (bytes))
33 #define SECUR32_FREE(p)      LocalFree(p)
34
35 typedef struct _SecureProvider
36 {
37     BOOL                    loaded;
38     PWSTR                   moduleName;
39     HMODULE                 lib;
40     SecurityFunctionTableA  fnTableA;
41     SecurityFunctionTableW  fnTableW;
42 } SecureProvider;
43
44 typedef struct _SecurePackage
45 {
46     SecPkgInfoW     infoW;
47     SecureProvider *provider;
48 } SecurePackage;
49
50 /* Allocates space for and initializes a new provider.  If fnTableA or fnTableW
51  * is non-NULL, assumes the provider is built-in (and is thus already loaded.)
52  * Otherwise moduleName must not be NULL.
53  * Returns a pointer to the stored provider entry, for use adding packages.
54  */
55 SecureProvider *SECUR32_addProvider(PSecurityFunctionTableA fnTableA,
56  PSecurityFunctionTableW fnTableW, PWSTR moduleName);
57
58 /* Allocates space for and adds toAdd packages with the given provider.
59  * provider must not be NULL, and either infoA or infoW may be NULL, but not
60  * both.
61  */
62 void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd,
63  const SecPkgInfoA *infoA, const SecPkgInfoW *infoW);
64
65 /* Tries to find the package named packageName.  If it finds it, implicitly
66  * loads the package if it isn't already loaded.
67  */
68 SecurePackage *SECUR32_findPackageW(PWSTR packageName);
69
70 /* Tries to find the package named packageName.  (Thunks to _findPackageW)
71  */
72 SecurePackage *SECUR32_findPackageA(PSTR packageName);
73
74 /* A few string helpers; will return NULL if str is NULL.  Free return with
75  * SECUR32_FREE */
76 PWSTR SECUR32_strdupW(PCWSTR str);
77 PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str);
78 PSTR  SECUR32_AllocMultiByteFromWide(PCWSTR str);
79
80 /* Initialization functions for built-in providers */
81 void SECUR32_initSchannelSP(void);
82
83 #endif /* ndef __SECUR32_PRIV_H__ */