Mercurial > trustbridge
annotate cinst/windowsstore.h @ 289:9ad00a3255f4
Change cinst from stdin input to use arguments.
As we have to execute this process on Windows over the
shell a stdin / stdout communication is not really possible
without some major hacks. So you now have to supply an
instructions file and the path to the certificatelist as arguments when
this process is called
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 02 Apr 2014 13:52:02 +0000 |
parents | 4de97f74d038 |
children | 17e1c8f37d72 |
rev | line source |
---|---|
137
4904fe01055d
Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
1 #ifdef WIN32 |
4904fe01055d
Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
2 #ifndef WINDOWSSTORE_H |
4904fe01055d
Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
3 #define WINDOWSSTORE_H |
4904fe01055d
Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
4 |
219
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
5 #ifdef __cplusplus |
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
6 extern "C" { |
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
7 #endif |
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
8 |
137
4904fe01055d
Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
9 #include <windows.h> |
4904fe01055d
Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
10 #include <wincrypt.h> |
161
a4b1c77f3e6a
Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents:
137
diff
changeset
|
11 |
a4b1c77f3e6a
Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents:
137
diff
changeset
|
12 #include <stdbool.h> |
a4b1c77f3e6a
Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents:
137
diff
changeset
|
13 |
a4b1c77f3e6a
Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents:
137
diff
changeset
|
14 /** @brief Access the Windows certificate store |
137
4904fe01055d
Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
15 * |
247
4de97f74d038
Check for process elevation and write into system store accordingly
Andre Heinecke <aheinecke@intevation.de>
parents:
219
diff
changeset
|
16 * 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
|
17 * 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
|
18 * |
161
a4b1c77f3e6a
Change install_certificates_win to generic write_stores_win
Andre Heinecke <aheinecke@intevation.de>
parents:
137
diff
changeset
|
19 * @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
|
20 * @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
|
21 * @returns 0 on success an errorcode otherwise. |
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 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
|
24 |
219
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
25 /* 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
|
26 * 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
|
27 * in unit tests */ |
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
28 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
|
29 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
|
30 |
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
31 #ifdef __cplusplus |
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
32 } |
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
33 #endif |
57bef180d560
Add debug output and make windowsstore linkable from C++ code
Andre Heinecke <andre.heinecke@intevation.de>
parents:
161
diff
changeset
|
34 |
137
4904fe01055d
Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
35 #endif // WINDOWSSTORE_H |
4904fe01055d
Factor out windows specific parts
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
36 #endif // WIN32 |