annotate cinst/windowsstore.h @ 1309:32a44cfb78c0

Improve debug output and fix cert context leak on removal
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 13 Oct 2014 13:29:19 +0200
parents 17e1c8f37d72
children
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 247
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 247
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 247
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 247
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 247
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 247
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 247
diff changeset
7 */
137
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8 #ifdef WIN32
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9 #ifndef WINDOWSSTORE_H
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10 #define WINDOWSSTORE_H
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
11
219
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
12 #ifdef __cplusplus
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
13 extern "C" {
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
14 #endif
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
15
137
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
16 #include <windows.h>
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
17 #include <wincrypt.h>
161
a4b1c77f3e6a Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents: 137
diff changeset
18
a4b1c77f3e6a Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents: 137
diff changeset
19 #include <stdbool.h>
a4b1c77f3e6a Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents: 137
diff changeset
20
a4b1c77f3e6a Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents: 137
diff changeset
21 /** @brief Access the Windows certificate store
137
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
22 *
247
4de97f74d038 Check for process elevation and write into system store accordingly
Andre Heinecke <aheinecke@intevation.de>
parents: 219
diff changeset
23 * If the process is running with elevated rights this function
4de97f74d038 Check for process elevation and write into system store accordingly
Andre Heinecke <aheinecke@intevation.de>
parents: 219
diff changeset
24 * will write into the system store. User store is written otherwise.
4de97f74d038 Check for process elevation and write into system store accordingly
Andre Heinecke <aheinecke@intevation.de>
parents: 219
diff changeset
25 *
161
a4b1c77f3e6a Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents: 137
diff changeset
26 * @param [in] to_install strv of DER encoded certificates to be added.
a4b1c77f3e6a Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents: 137
diff changeset
27 * @param [in] to_remove strv of DER encoded certificates to be remvoed.
137
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
28 * @returns 0 on success an errorcode otherwise.
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
29 */
247
4de97f74d038 Check for process elevation and write into system store accordingly
Andre Heinecke <aheinecke@intevation.de>
parents: 219
diff changeset
30 int write_stores_win (char **to_install, char **to_remove);
137
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
31
219
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
32 /* The do_ functions are private helper functions and should not be used
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
33 * from other code. They are not static to allow it to use them directly
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
34 * in unit tests */
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
35 void do_remove(HCERTSTORE hStore, char **to_remove);
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
36 void do_install(HCERTSTORE hStore, char **to_install);
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
37
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
38 #ifdef __cplusplus
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
39 }
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
40 #endif
57bef180d560 Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents: 161
diff changeset
41
137
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
42 #endif // WINDOWSSTORE_H
4904fe01055d Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
43 #endif // WIN32

http://wald.intevation.org/projects/trustbridge/