Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / netidmgr_plugin / dynimport.h
blobfd4557fff9f5b3710e3ce8dfe30847b792709c70
1 /*
2 * Copyright (c) 2005 Massachusetts Institute of Technology
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
25 /* $Id$ */
27 #ifndef __KHIMAIRA_DYNIMPORT_H
28 #define __KHIMAIRA_DYNIMPORT_H
30 /* Dynamic imports */
31 #include<khdefs.h>
32 #include<tlhelp32.h>
34 #if defined(_WIN32_WINNT)
35 # if (_WIN32_WINNT < 0x0501)
36 # define AFS_WIN32_WINNT _WIN32_WINNT
37 # undef _WIN32_WINNT
38 # define _WIN32_WINNT 0x0501
39 # endif
40 #else
41 # define _WIN32_WINNT 0x0501
42 #endif
44 #include<ntsecapi.h>
45 #if defined(AFS_WIN32_WINNT)
46 #undef _WIN32_WINNT
47 #define _WIN32_WINNT AFS_WIN32_WINNT
48 #undef AFS_WIN32_WINNT
49 #endif
51 #ifndef FAR
52 #define FAR
53 #endif
55 extern HINSTANCE hKrb4;
56 extern HINSTANCE hKrb5;
57 extern HINSTANCE hProfile;
59 ///////////////////////////////////////////////////////////////////////////////
61 #ifdef _WIN64
62 #define CCAPI_DLL "krbcc64.dll"
63 #define KRBCC32_DLL "krbcc64.dll"
64 #else
65 #define CCAPI_DLL "krbcc32.dll"
66 #define KRBCC32_DLL "krbcc32.dll"
67 #endif
68 #define SERVICE_DLL "advapi32.dll"
69 #define SECUR32_DLL "secur32.dll"
71 //////////////////////////////////////////////////////////////////////////////
73 #include <loadfuncs-com_err.h>
74 #include <loadfuncs-krb5.h>
75 #include <loadfuncs-profile.h>
76 #include <loadfuncs-krb.h>
77 #include <loadfuncs-krb524.h>
78 #include <loadfuncs-lsa.h>
80 //// CCAPI
81 /* In order to avoid including the private CCAPI headers */
82 typedef int cc_int32;
84 #define CC_API_VER_1 1
85 #define CC_API_VER_2 2
87 #define CCACHE_API cc_int32
90 ** The Official Error Codes
92 #define CC_NOERROR 0
93 #define CC_BADNAME 1
94 #define CC_NOTFOUND 2
95 #define CC_END 3
96 #define CC_IO 4
97 #define CC_WRITE 5
98 #define CC_NOMEM 6
99 #define CC_FORMAT 7
100 #define CC_LOCKED 8
101 #define CC_BAD_API_VERSION 9
102 #define CC_NO_EXIST 10
103 #define CC_NOT_SUPP 11
104 #define CC_BAD_PARM 12
105 #define CC_ERR_CACHE_ATTACH 13
106 #define CC_ERR_CACHE_RELEASE 14
107 #define CC_ERR_CACHE_FULL 15
108 #define CC_ERR_CRED_VERSION 16
110 enum {
111 CC_CRED_VUNKNOWN = 0, // For validation
112 CC_CRED_V4 = 1,
113 CC_CRED_V5 = 2,
114 CC_CRED_VMAX = 3 // For validation
117 typedef struct opaque_dll_control_block_type* apiCB;
118 typedef struct _infoNC {
119 char* name;
120 char* principal;
121 cc_int32 vers;
122 } infoNC;
124 TYPEDEF_FUNC(
125 CCACHE_API,
126 CALLCONV_C,
127 cc_initialize,
129 apiCB** cc_ctx, // < DLL's primary control structure.
130 // returned here, passed everywhere else
131 cc_int32 api_version, // > ver supported by caller (use CC_API_VER_1)
132 cc_int32* api_supported, // < if ~NULL, max ver supported by DLL
133 const char** vendor // < if ~NULL, vendor name in read only C string
137 TYPEDEF_FUNC(
138 CCACHE_API,
139 CALLCONV_C,
140 cc_shutdown,
142 apiCB** cc_ctx // <> DLL's primary control structure. NULL after
146 TYPEDEF_FUNC(
147 CCACHE_API,
148 CALLCONV_C,
149 cc_get_NC_info,
151 apiCB* cc_ctx, // > DLL's primary control structure
152 struct _infoNC*** ppNCi // < (NULL before call) null terminated,
153 // list of a structs (free via cc_free_infoNC())
157 TYPEDEF_FUNC(
158 CCACHE_API,
159 CALLCONV_C,
160 cc_free_NC_info,
162 apiCB* cc_ctx,
163 struct _infoNC*** ppNCi // < free list of structs returned by
164 // cc_get_cache_names(). set to NULL on return
167 //// \CCAPI
169 extern DWORD AfsAvailable;
171 // service definitions
172 typedef SC_HANDLE (WINAPI *FP_OpenSCManagerA)(char *, char *, DWORD);
173 typedef SC_HANDLE (WINAPI *FP_OpenServiceA)(SC_HANDLE, char *, DWORD);
174 typedef BOOL (WINAPI *FP_QueryServiceStatus)(SC_HANDLE, LPSERVICE_STATUS);
175 typedef BOOL (WINAPI *FP_CloseServiceHandle)(SC_HANDLE);
177 //////////////////////////////////////////////////////////////////////////////
179 // CCAPI
180 extern DECL_FUNC_PTR(cc_initialize);
181 extern DECL_FUNC_PTR(cc_shutdown);
182 extern DECL_FUNC_PTR(cc_get_NC_info);
183 extern DECL_FUNC_PTR(cc_free_NC_info);
185 // krb4 functions
186 extern DECL_FUNC_PTR(get_krb_err_txt_entry);
187 extern DECL_FUNC_PTR(k_isinst);
188 extern DECL_FUNC_PTR(k_isname);
189 extern DECL_FUNC_PTR(k_isrealm);
190 extern DECL_FUNC_PTR(kadm_change_your_password);
191 extern DECL_FUNC_PTR(kname_parse);
192 extern DECL_FUNC_PTR(krb_get_cred);
193 extern DECL_FUNC_PTR(krb_get_krbhst);
194 extern DECL_FUNC_PTR(krb_get_lrealm);
195 extern DECL_FUNC_PTR(krb_get_pw_in_tkt);
196 extern DECL_FUNC_PTR(krb_get_tf_realm);
197 extern DECL_FUNC_PTR(krb_mk_req);
198 extern DECL_FUNC_PTR(krb_realmofhost);
199 extern DECL_FUNC_PTR(tf_init);
200 extern DECL_FUNC_PTR(tf_close);
201 extern DECL_FUNC_PTR(tf_get_cred);
202 extern DECL_FUNC_PTR(tf_get_pname);
203 extern DECL_FUNC_PTR(tf_get_pinst);
204 extern DECL_FUNC_PTR(LocalHostAddr);
205 extern DECL_FUNC_PTR(tkt_string);
206 extern DECL_FUNC_PTR(krb_set_tkt_string);
207 extern DECL_FUNC_PTR(initialize_krb_error_func);
208 extern DECL_FUNC_PTR(initialize_kadm_error_table);
209 extern DECL_FUNC_PTR(dest_tkt);
210 extern DECL_FUNC_PTR(lsh_LoadKrb4LeashErrorTables); // XXX
211 extern DECL_FUNC_PTR(krb_in_tkt);
212 extern DECL_FUNC_PTR(krb_save_credentials);
213 extern DECL_FUNC_PTR(krb_get_krbconf2);
214 extern DECL_FUNC_PTR(krb_get_krbrealm2);
215 extern DECL_FUNC_PTR(krb_life_to_time);
217 // krb5 functions
218 extern DECL_FUNC_PTR(krb5_change_password);
219 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_init);
220 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_tkt_life);
221 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
222 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_forwardable);
223 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_proxiable);
224 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
225 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
226 extern DECL_FUNC_PTR(krb5_get_init_creds_password);
227 extern DECL_FUNC_PTR(krb5_get_prompt_types);
228 extern DECL_FUNC_PTR(krb5_build_principal_ext);
229 extern DECL_FUNC_PTR(krb5_cc_get_name);
230 extern DECL_FUNC_PTR(krb5_cc_get_type);
231 extern DECL_FUNC_PTR(krb5_cc_resolve);
232 extern DECL_FUNC_PTR(krb5_cc_default);
233 extern DECL_FUNC_PTR(krb5_cc_default_name);
234 extern DECL_FUNC_PTR(krb5_cc_set_default_name);
235 extern DECL_FUNC_PTR(krb5_cc_initialize);
236 extern DECL_FUNC_PTR(krb5_cc_destroy);
237 extern DECL_FUNC_PTR(krb5_cc_close);
238 extern DECL_FUNC_PTR(krb5_cc_copy_creds);
239 extern DECL_FUNC_PTR(krb5_cc_store_cred);
240 extern DECL_FUNC_PTR(krb5_cc_retrieve_cred);
241 extern DECL_FUNC_PTR(krb5_cc_get_principal);
242 extern DECL_FUNC_PTR(krb5_cc_start_seq_get);
243 extern DECL_FUNC_PTR(krb5_cc_next_cred);
244 extern DECL_FUNC_PTR(krb5_cc_end_seq_get);
245 extern DECL_FUNC_PTR(krb5_cc_remove_cred);
246 extern DECL_FUNC_PTR(krb5_cc_set_flags);
247 // extern DECL_FUNC_PTR(krb5_cc_get_type);
248 extern DECL_FUNC_PTR(krb5_free_context);
249 extern DECL_FUNC_PTR(krb5_free_cred_contents);
250 extern DECL_FUNC_PTR(krb5_free_principal);
251 extern DECL_FUNC_PTR(krb5_get_in_tkt_with_password);
252 extern DECL_FUNC_PTR(krb5_init_context);
253 extern DECL_FUNC_PTR(krb5_parse_name);
254 extern DECL_FUNC_PTR(krb5_timeofday);
255 extern DECL_FUNC_PTR(krb5_timestamp_to_sfstring);
256 extern DECL_FUNC_PTR(krb5_unparse_name);
257 extern DECL_FUNC_PTR(krb5_get_credentials);
258 extern DECL_FUNC_PTR(krb5_mk_req);
259 extern DECL_FUNC_PTR(krb5_sname_to_principal);
260 extern DECL_FUNC_PTR(krb5_get_credentials_renew);
261 extern DECL_FUNC_PTR(krb5_free_data);
262 extern DECL_FUNC_PTR(krb5_free_data_contents);
263 // extern DECL_FUNC_PTR(krb5_get_realm_domain);
264 extern DECL_FUNC_PTR(krb5_free_unparsed_name);
265 extern DECL_FUNC_PTR(krb5_os_localaddr);
266 extern DECL_FUNC_PTR(krb5_copy_keyblock_contents);
267 extern DECL_FUNC_PTR(krb5_copy_data);
268 extern DECL_FUNC_PTR(krb5_free_creds);
269 extern DECL_FUNC_PTR(krb5_build_principal);
270 extern DECL_FUNC_PTR(krb5_get_renewed_creds);
271 extern DECL_FUNC_PTR(krb5_free_addresses);
272 extern DECL_FUNC_PTR(krb5_get_default_config_files);
273 extern DECL_FUNC_PTR(krb5_free_config_files);
274 extern DECL_FUNC_PTR(krb5_get_default_realm);
275 extern DECL_FUNC_PTR(krb5_set_default_realm);
276 extern DECL_FUNC_PTR(krb5_free_ticket);
277 extern DECL_FUNC_PTR(krb5_decode_ticket);
278 extern DECL_FUNC_PTR(krb5_get_host_realm);
279 extern DECL_FUNC_PTR(krb5_free_host_realm);
280 extern DECL_FUNC_PTR(krb5_c_random_make_octets);
281 extern DECL_FUNC_PTR(krb5_free_default_realm);
283 // Krb5 (3.2) functions
284 extern DECL_FUNC_PTR(krb5_get_error_message);
285 extern DECL_FUNC_PTR(krb5_free_error_message);
287 // Krb524 functions
288 extern DECL_FUNC_PTR(krb524_init_ets);
289 extern DECL_FUNC_PTR(krb524_convert_creds_kdc);
291 // ComErr functions
292 extern DECL_FUNC_PTR(com_err);
293 extern DECL_FUNC_PTR(error_message);
295 // Profile functions
296 extern DECL_FUNC_PTR(profile_init);
297 extern DECL_FUNC_PTR(profile_flush);
298 extern DECL_FUNC_PTR(profile_release);
299 extern DECL_FUNC_PTR(profile_get_subsection_names);
300 extern DECL_FUNC_PTR(profile_free_list);
301 extern DECL_FUNC_PTR(profile_get_string);
302 extern DECL_FUNC_PTR(profile_get_values);
303 extern DECL_FUNC_PTR(profile_get_relation_names);
304 extern DECL_FUNC_PTR(profile_clear_relation);
305 extern DECL_FUNC_PTR(profile_add_relation);
306 extern DECL_FUNC_PTR(profile_update_relation);
307 extern DECL_FUNC_PTR(profile_release_string);
309 // Service functions
310 extern DECL_FUNC_PTR(OpenSCManagerA);
311 extern DECL_FUNC_PTR(OpenServiceA);
312 extern DECL_FUNC_PTR(QueryServiceStatus);
313 extern DECL_FUNC_PTR(CloseServiceHandle);
314 extern DECL_FUNC_PTR(LsaNtStatusToWinError);
316 // LSA Functions
317 extern DECL_FUNC_PTR(LsaConnectUntrusted);
318 extern DECL_FUNC_PTR(LsaLookupAuthenticationPackage);
319 extern DECL_FUNC_PTR(LsaCallAuthenticationPackage);
320 extern DECL_FUNC_PTR(LsaFreeReturnBuffer);
321 extern DECL_FUNC_PTR(LsaGetLogonSessionData);
323 // toolhelp functions
324 TYPEDEF_FUNC(
325 HANDLE,
326 WINAPI,
327 CreateToolhelp32Snapshot,
328 (DWORD, DWORD)
330 TYPEDEF_FUNC(
331 BOOL,
332 WINAPI,
333 Module32First,
334 (HANDLE, LPMODULEENTRY32)
336 TYPEDEF_FUNC(
337 BOOL,
338 WINAPI,
339 Module32Next,
340 (HANDLE, LPMODULEENTRY32)
343 // psapi functions
344 TYPEDEF_FUNC(
345 DWORD,
346 WINAPI,
347 GetModuleFileNameExA,
348 (HANDLE, HMODULE, LPSTR, DWORD)
351 TYPEDEF_FUNC(
352 BOOL,
353 WINAPI,
354 EnumProcessModules,
355 (HANDLE, HMODULE*, DWORD, LPDWORD)
358 #define pGetModuleFileNameEx pGetModuleFileNameExA
359 #define TOOLHELPDLL "kernel32.dll"
360 #define PSAPIDLL "psapi.dll"
362 // psapi functions
363 extern DECL_FUNC_PTR(GetModuleFileNameExA);
364 extern DECL_FUNC_PTR(EnumProcessModules);
366 // toolhelp functions
367 extern DECL_FUNC_PTR(CreateToolhelp32Snapshot);
368 extern DECL_FUNC_PTR(Module32First);
369 extern DECL_FUNC_PTR(Module32Next);
371 khm_int32 init_imports(void);
372 khm_int32 exit_imports(void);
374 #endif