Mercurial > trustbridge
comparison cinst/windowsstore.c @ 321:824ef90a6721
Move is_elevated into common/util.c file for better reuse
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 07 Apr 2014 10:58:47 +0000 |
parents | 759a898990d1 |
children | 17e1c8f37d72 |
comparison
equal
deleted
inserted
replaced
320:1628615d904e | 321:824ef90a6721 |
---|---|
5 #include "windowsstore.h" | 5 #include "windowsstore.h" |
6 #include "errorcodes.h" | 6 #include "errorcodes.h" |
7 #include "listutil.h" | 7 #include "listutil.h" |
8 #include "strhelp.h" | 8 #include "strhelp.h" |
9 #include "logging.h" | 9 #include "logging.h" |
10 #include "util.h" | |
10 | 11 |
11 static PCCERT_CONTEXT | 12 static PCCERT_CONTEXT |
12 b64_to_cert_context(char *b64_data, size_t b64_size) | 13 b64_to_cert_context(char *b64_data, size_t b64_size) |
13 { | 14 { |
14 size_t buf_size = 0; | 15 size_t buf_size = 0; |
158 } | 159 } |
159 } | 160 } |
160 return; | 161 return; |
161 } | 162 } |
162 | 163 |
163 static bool is_elevated() { | |
164 HANDLE hToken = NULL; | |
165 bool ret = false; | |
166 if (OpenProcessToken (GetCurrentProcess(), TOKEN_QUERY, &hToken)) | |
167 { | |
168 DWORD elevation; | |
169 DWORD cbSize = sizeof (DWORD); | |
170 if (GetTokenInformation (hToken, TokenElevation, &elevation, | |
171 sizeof (TokenElevation), &cbSize)) | |
172 { | |
173 ret = elevation; | |
174 } | |
175 } | |
176 if (hToken) | |
177 CloseHandle (hToken); | |
178 | |
179 return ret; | |
180 } | |
181 | |
182 int | 164 int |
183 write_stores_win (char **to_install, char **to_remove) | 165 write_stores_win (char **to_install, char **to_remove) |
184 { | 166 { |
185 HCERTSTORE hStore = NULL; | 167 HCERTSTORE hStore = NULL; |
186 | 168 |