12 HINSTANCE hKrb524 = 0;
13 HINSTANCE hSecur32 = 0;
14 HINSTANCE hComErr = 0;
15 HINSTANCE hService = 0;
16 HINSTANCE hProfile = 0;
18 HINSTANCE hToolHelp32 = 0;
21 DWORD AfsAvailable = 0;
24 DECL_FUNC_PTR(krb5_change_password);
25 DECL_FUNC_PTR(krb5_get_init_creds_opt_alloc);
26 DECL_FUNC_PTR(krb5_get_init_creds_opt_free);
27 DECL_FUNC_PTR(krb5_get_init_creds_opt_init);
28 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_tkt_life);
29 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
30 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_forwardable);
31 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_proxiable);
32 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
33 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_out_ccache);
34 DECL_FUNC_PTR(krb5_get_init_creds_password);
35 DECL_FUNC_PTR(krb5_build_principal_ext);
36 DECL_FUNC_PTR(krb5_cc_resolve);
37 DECL_FUNC_PTR(krb5_cc_default);
38 DECL_FUNC_PTR(krb5_cc_default_name);
39 DECL_FUNC_PTR(krb5_cc_set_default_name);
40 DECL_FUNC_PTR(krb5_cc_initialize);
41 DECL_FUNC_PTR(krb5_cc_destroy);
42 DECL_FUNC_PTR(krb5_cc_close);
43 DECL_FUNC_PTR(krb5_cc_store_cred);
44 DECL_FUNC_PTR(krb5_cc_copy_creds);
45 // DECL_FUNC_PTR(krb5_cc_retrieve_cred);
46 DECL_FUNC_PTR(krb5_cc_get_principal);
47 DECL_FUNC_PTR(krb5_cc_start_seq_get);
48 DECL_FUNC_PTR(krb5_cc_next_cred);
49 DECL_FUNC_PTR(krb5_cc_end_seq_get);
50 // DECL_FUNC_PTR(krb5_cc_remove_cred);
51 DECL_FUNC_PTR(krb5_cc_set_flags);
52 // DECL_FUNC_PTR(krb5_cc_get_type);
53 DECL_FUNC_PTR(krb5_free_context);
54 DECL_FUNC_PTR(krb5_free_cred_contents);
55 DECL_FUNC_PTR(krb5_free_principal);
56 DECL_FUNC_PTR(krb5_get_in_tkt_with_password);
57 DECL_FUNC_PTR(krb5_init_context);
58 DECL_FUNC_PTR(krb5_parse_name);
59 DECL_FUNC_PTR(krb5_timeofday);
60 DECL_FUNC_PTR(krb5_timestamp_to_sfstring);
61 DECL_FUNC_PTR(krb5_unparse_name);
62 DECL_FUNC_PTR(krb5_get_credentials);
63 DECL_FUNC_PTR(krb5_mk_req);
64 DECL_FUNC_PTR(krb5_sname_to_principal);
65 DECL_FUNC_PTR(krb5_get_credentials_renew);
66 DECL_FUNC_PTR(krb5_free_data);
67 DECL_FUNC_PTR(krb5_free_data_contents);
68 // DECL_FUNC_PTR(krb5_get_realm_domain);
69 DECL_FUNC_PTR(krb5_free_unparsed_name);
70 DECL_FUNC_PTR(krb5_os_localaddr);
71 DECL_FUNC_PTR(krb5_copy_keyblock_contents);
72 DECL_FUNC_PTR(krb5_copy_data);
73 DECL_FUNC_PTR(krb5_free_creds);
74 DECL_FUNC_PTR(krb5_build_principal);
75 DECL_FUNC_PTR(krb5_get_renewed_creds);
76 DECL_FUNC_PTR(krb5_get_default_config_files);
77 DECL_FUNC_PTR(krb5_free_config_files);
78 DECL_FUNC_PTR(krb5_get_default_realm);
79 DECL_FUNC_PTR(krb5_free_ticket);
80 DECL_FUNC_PTR(krb5_decode_ticket);
81 DECL_FUNC_PTR(krb5_get_host_realm);
82 DECL_FUNC_PTR(krb5_free_host_realm);
83 DECL_FUNC_PTR(krb5_c_random_make_octets);
84 DECL_FUNC_PTR(krb5_free_addresses);
85 DECL_FUNC_PTR(krb5_free_default_realm);
86 DECL_FUNC_PTR(krb5_principal_compare);
87 DECL_FUNC_PTR(krb5_string_to_deltat);
88 DECL_FUNC_PTR(krb5_is_config_principal);
91 DECL_FUNC_PTR(com_err);
92 DECL_FUNC_PTR(error_message);
95 DECL_FUNC_PTR(profile_init);
96 DECL_FUNC_PTR(profile_release);
97 DECL_FUNC_PTR(profile_get_subsection_names);
98 DECL_FUNC_PTR(profile_free_list);
99 DECL_FUNC_PTR(profile_get_string);
100 DECL_FUNC_PTR(profile_release_string);
101 DECL_FUNC_PTR(profile_get_integer);
104 DECL_FUNC_PTR(OpenSCManagerA);
105 DECL_FUNC_PTR(OpenServiceA);
106 DECL_FUNC_PTR(QueryServiceStatus);
107 DECL_FUNC_PTR(CloseServiceHandle);
108 DECL_FUNC_PTR(LsaNtStatusToWinError);
111 DECL_FUNC_PTR(LsaConnectUntrusted);
112 DECL_FUNC_PTR(LsaLookupAuthenticationPackage);
113 DECL_FUNC_PTR(LsaCallAuthenticationPackage);
114 DECL_FUNC_PTR(LsaFreeReturnBuffer);
115 DECL_FUNC_PTR(LsaGetLogonSessionData);
118 DECL_FUNC_PTR(cc_initialize);
119 DECL_FUNC_PTR(cc_shutdown);
120 DECL_FUNC_PTR(cc_get_NC_info);
121 DECL_FUNC_PTR(cc_free_NC_info);
123 FUNC_INFO k5_fi[] = {
124 MAKE_FUNC_INFO(krb5_change_password),
125 MAKE_FUNC_INFO(krb5_get_init_creds_opt_alloc),
126 MAKE_FUNC_INFO(krb5_get_init_creds_opt_free),
127 MAKE_FUNC_INFO(krb5_get_init_creds_opt_init),
128 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_tkt_life),
129 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_renew_life),
130 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_forwardable),
131 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_proxiable),
132 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_address_list),
133 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_out_ccache),
134 MAKE_FUNC_INFO(krb5_get_init_creds_password),
135 MAKE_FUNC_INFO(krb5_build_principal_ext),
136 MAKE_FUNC_INFO(krb5_cc_resolve),
137 MAKE_FUNC_INFO(krb5_cc_default),
138 MAKE_FUNC_INFO(krb5_cc_default_name),
139 MAKE_FUNC_INFO(krb5_cc_set_default_name),
140 MAKE_FUNC_INFO(krb5_cc_initialize),
141 MAKE_FUNC_INFO(krb5_cc_destroy),
142 MAKE_FUNC_INFO(krb5_cc_close),
143 MAKE_FUNC_INFO(krb5_cc_copy_creds),
144 MAKE_FUNC_INFO(krb5_cc_store_cred),
145 // MAKE_FUNC_INFO(krb5_cc_retrieve_cred),
146 MAKE_FUNC_INFO(krb5_cc_get_principal),
147 MAKE_FUNC_INFO(krb5_cc_start_seq_get),
148 MAKE_FUNC_INFO(krb5_cc_next_cred),
149 MAKE_FUNC_INFO(krb5_cc_end_seq_get),
150 // MAKE_FUNC_INFO(krb5_cc_remove_cred),
151 MAKE_FUNC_INFO(krb5_cc_set_flags),
152 // MAKE_FUNC_INFO(krb5_cc_get_type),
153 MAKE_FUNC_INFO(krb5_free_context),
154 MAKE_FUNC_INFO(krb5_free_cred_contents),
155 MAKE_FUNC_INFO(krb5_free_principal),
156 MAKE_FUNC_INFO(krb5_get_in_tkt_with_password),
157 MAKE_FUNC_INFO(krb5_init_context),
158 MAKE_FUNC_INFO(krb5_parse_name),
159 MAKE_FUNC_INFO(krb5_timeofday),
160 MAKE_FUNC_INFO(krb5_timestamp_to_sfstring),
161 MAKE_FUNC_INFO(krb5_unparse_name),
162 MAKE_FUNC_INFO(krb5_get_credentials),
163 MAKE_FUNC_INFO(krb5_mk_req),
164 MAKE_FUNC_INFO(krb5_sname_to_principal),
165 MAKE_FUNC_INFO(krb5_get_credentials_renew),
166 MAKE_FUNC_INFO(krb5_free_data),
167 MAKE_FUNC_INFO(krb5_free_data_contents),
168 // MAKE_FUNC_INFO(krb5_get_realm_domain),
169 MAKE_FUNC_INFO(krb5_free_unparsed_name),
170 MAKE_FUNC_INFO(krb5_os_localaddr),
171 MAKE_FUNC_INFO(krb5_copy_keyblock_contents),
172 MAKE_FUNC_INFO(krb5_copy_data),
173 MAKE_FUNC_INFO(krb5_free_creds),
174 MAKE_FUNC_INFO(krb5_build_principal),
175 MAKE_FUNC_INFO(krb5_get_renewed_creds),
176 MAKE_FUNC_INFO(krb5_free_addresses),
177 MAKE_FUNC_INFO(krb5_get_default_config_files),
178 MAKE_FUNC_INFO(krb5_free_config_files),
179 MAKE_FUNC_INFO(krb5_get_default_realm),
180 MAKE_FUNC_INFO(krb5_free_ticket),
181 MAKE_FUNC_INFO(krb5_decode_ticket),
182 MAKE_FUNC_INFO(krb5_get_host_realm),
183 MAKE_FUNC_INFO(krb5_free_host_realm),
184 MAKE_FUNC_INFO(krb5_c_random_make_octets),
185 MAKE_FUNC_INFO(krb5_free_default_realm),
186 MAKE_FUNC_INFO(krb5_principal_compare),
187 MAKE_FUNC_INFO(krb5_string_to_deltat),
188 MAKE_FUNC_INFO(krb5_is_config_principal),
192 FUNC_INFO profile_fi[] = {
193 MAKE_FUNC_INFO(profile_init),
194 MAKE_FUNC_INFO(profile_release),
195 MAKE_FUNC_INFO(profile_get_subsection_names),
196 MAKE_FUNC_INFO(profile_free_list),
197 MAKE_FUNC_INFO(profile_get_string),
198 MAKE_FUNC_INFO(profile_release_string),
199 MAKE_FUNC_INFO(profile_get_integer),
203 FUNC_INFO ce_fi[] = {
204 MAKE_FUNC_INFO(com_err),
205 MAKE_FUNC_INFO(error_message),
209 FUNC_INFO service_fi[] = {
210 MAKE_FUNC_INFO(OpenSCManagerA),
211 MAKE_FUNC_INFO(OpenServiceA),
212 MAKE_FUNC_INFO(QueryServiceStatus),
213 MAKE_FUNC_INFO(CloseServiceHandle),
214 MAKE_FUNC_INFO(LsaNtStatusToWinError),
218 FUNC_INFO lsa_fi[] = {
219 MAKE_FUNC_INFO(LsaConnectUntrusted),
220 MAKE_FUNC_INFO(LsaLookupAuthenticationPackage),
221 MAKE_FUNC_INFO(LsaCallAuthenticationPackage),
222 MAKE_FUNC_INFO(LsaFreeReturnBuffer),
223 MAKE_FUNC_INFO(LsaGetLogonSessionData),
228 FUNC_INFO ccapi_fi[] = {
229 MAKE_FUNC_INFO(cc_initialize),
230 MAKE_FUNC_INFO(cc_shutdown),
231 MAKE_FUNC_INFO(cc_get_NC_info),
232 MAKE_FUNC_INFO(cc_free_NC_info),
237 DECL_FUNC_PTR(GetModuleFileNameExA);
238 DECL_FUNC_PTR(EnumProcessModules);
240 FUNC_INFO psapi_fi[] = {
241 MAKE_FUNC_INFO(GetModuleFileNameExA),
242 MAKE_FUNC_INFO(EnumProcessModules),
246 // toolhelp functions
247 DECL_FUNC_PTR(CreateToolhelp32Snapshot);
248 DECL_FUNC_PTR(Module32First);
249 DECL_FUNC_PTR(Module32Next);
251 FUNC_INFO toolhelp_fi[] = {
252 MAKE_FUNC_INFO(CreateToolhelp32Snapshot),
253 MAKE_FUNC_INFO(Module32First),
254 MAKE_FUNC_INFO(Module32Next),
265 hLeashInst = hinstDLL;
269 case DLL_PROCESS_ATTACH:
272 LoadFuncs(KRB5_DLL, k5_fi, &hKrb5, 0, 1, 0, 0);
273 LoadFuncs(COMERR_DLL, ce_fi, &hComErr, 0, 0, 1, 0);
274 LoadFuncs(SERVICE_DLL, service_fi, &hService, 0, 1, 0, 0);
275 LoadFuncs(SECUR32_DLL, lsa_fi, &hSecur32, 0, 1, 1, 1);
276 LoadFuncs(PROFILE_DLL, profile_fi, &hProfile, 0, 1, 0, 0);
277 LoadFuncs(CCAPI_DLL, ccapi_fi, &hCcapi, 0, 1, 0, 0);
279 memset(&osvi, 0, sizeof(OSVERSIONINFO));
280 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
283 // XXX: We should really use feature testing, first
284 // checking for CreateToolhelp32Snapshot. If that's
285 // not around, we try the psapi stuff.
287 // Only load LSA functions if on NT/2000/XP
288 if(osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
291 LoadFuncs(TOOLHELPDLL, toolhelp_fi, &hToolHelp32, 0, 1, 0, 0);
294 else if(osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
297 LoadFuncs(PSAPIDLL, psapi_fi, &hPsapi, 0, 1, 0, 0);
303 * Register window class for the MITPasswordControl that
304 * replaces normal edit controls for password input.
305 * zero any fields we don't explicitly set
307 hLeashInst = hinstDLL;
309 Register_MITPasswordEditControl(hLeashInst);
314 GetAfsStatus(&AfsStatus);
316 AfsAvailable = afscompat_init();
318 if ( AfsStatus && !AfsAvailable )
324 case DLL_PROCESS_DETACH:
333 FreeLibrary(hProfile);
335 FreeLibrary(hComErr);
337 FreeLibrary(hService);
339 FreeLibrary(hSecur32);
343 FreeLibrary(hToolHelp32);