user: Fix LB_GETTEXT unmapping for A<->W.
[wine/multimedia.git] / dlls / secur32 / secur32_priv.h
blob9aef362a70541a0212f8d71f77c1775b46c0b791
1 /*
2 * secur32 private definitions.
4 * Copyright (C) 2004 Juan Lang
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.
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.
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
21 #ifndef __SECUR32_PRIV_H__
22 #define __SECUR32_PRIV_H__
24 #include <sys/types.h>
25 #include "wine/list.h"
27 /* Memory allocation functions for memory accessible by callers of secur32.
28 * There is no REALLOC, because LocalReAlloc can only work if used in
29 * conjunction with LMEM_MOVEABLE and LocalLock, but callers aren't using
30 * LocalLock. I don't use the Heap functions because there seems to be an
31 * implicit assumption that LocalAlloc and Free will be used--MS' secur32
32 * imports them (but not the heap functions), the sample SSP uses them, and
33 * there isn't an exported secur32 function to allocate memory.
35 #define SECUR32_ALLOC(bytes) LocalAlloc(0, (bytes))
36 #define SECUR32_FREE(p) LocalFree(p)
38 typedef struct _SecureProvider
40 struct list entry;
41 BOOL loaded;
42 PWSTR moduleName;
43 HMODULE lib;
44 SecurityFunctionTableA fnTableA;
45 SecurityFunctionTableW fnTableW;
46 } SecureProvider;
48 typedef struct _SecurePackage
50 struct list entry;
51 SecPkgInfoW infoW;
52 SecureProvider *provider;
53 } SecurePackage;
55 typedef enum _helper_mode {
56 NTLM_SERVER,
57 NTLM_CLIENT,
58 NEGO_SERVER,
59 NEGO_CLIENT,
60 NUM_HELPER_MODES
61 } HelperMode;
63 typedef struct _NegoHelper {
64 pid_t helper_pid;
65 HelperMode mode;
66 SEC_CHAR *password;
67 int pwlen;
68 int pipe_in;
69 int pipe_out;
70 int version;
71 char *com_buf;
72 int com_buf_size;
73 int com_buf_offset;
74 } NegoHelper, *PNegoHelper;
76 /* Allocates space for and initializes a new provider. If fnTableA or fnTableW
77 * is non-NULL, assumes the provider is built-in (and is thus already loaded.)
78 * Otherwise moduleName must not be NULL.
79 * Returns a pointer to the stored provider entry, for use adding packages.
81 SecureProvider *SECUR32_addProvider(PSecurityFunctionTableA fnTableA,
82 PSecurityFunctionTableW fnTableW, PWSTR moduleName);
84 /* Allocates space for and adds toAdd packages with the given provider.
85 * provider must not be NULL, and either infoA or infoW may be NULL, but not
86 * both.
88 void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd,
89 const SecPkgInfoA *infoA, const SecPkgInfoW *infoW);
91 /* Tries to find the package named packageName. If it finds it, implicitly
92 * loads the package if it isn't already loaded.
94 SecurePackage *SECUR32_findPackageW(PWSTR packageName);
96 /* Tries to find the package named packageName. (Thunks to _findPackageW)
98 SecurePackage *SECUR32_findPackageA(PSTR packageName);
100 /* A few string helpers; will return NULL if str is NULL. Free return with
101 * SECUR32_FREE */
102 PWSTR SECUR32_strdupW(PCWSTR str);
103 PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str);
104 PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str);
106 /* Initialization functions for built-in providers */
107 void SECUR32_initSchannelSP(void);
108 void SECUR32_initNegotiateSP(void);
109 void SECUR32_initNTLMSP(void);
111 /* Functions from dispatcher.c used elsewhere in the code */
112 SECURITY_STATUS fork_helper(PNegoHelper *new_helper, const char *prog,
113 char * const argv[]);
115 SECURITY_STATUS run_helper(PNegoHelper helper, char *buffer,
116 unsigned int max_buflen, int *buflen);
118 void cleanup_helper(PNegoHelper helper);
120 void check_version(PNegoHelper helper);
122 /* Functions from base64_codec.c used elsewhere */
123 SECURITY_STATUS encodeBase64(PBYTE in_buf, int in_len, char* out_buf,
124 int max_len, int *out_len);
126 SECURITY_STATUS decodeBase64(char *in_buf, int in_len, BYTE *out_buf,
127 int max_len, int *out_len);
129 #endif /* ndef __SECUR32_PRIV_H__ */