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 /* 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.
32 #define SECUR32_ALLOC(bytes) LocalAlloc(0, (bytes))
33 #define SECUR32_FREE(p) LocalFree(p)
35 typedef struct _SecureProvider
39 SecurityFunctionTableA fnTableA;
40 SecurityFunctionTableW fnTableW;
43 typedef struct _SecurePackage
46 SecureProvider *provider;
49 /* Tries to find the package named packageName. If it finds it, implicitly
50 * loads the package if it isn't already loaded.
52 SecurePackage *SECUR32_findPackageW(PWSTR packageName);
54 /* Tries to find the package named packageName. (Thunks to _findPackageW)
56 SecurePackage *SECUR32_findPackageA(PSTR packageName);
58 /* A few string helpers; will return NULL if str is NULL. Free return with
60 PWSTR SECUR32_strdupW(PCWSTR str);
61 PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str);
62 PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str);
64 #endif /* ndef __SECUR32_PRIV_H__ */