comparison cinst/windowsstore.c @ 185:ee37c085b9f7

Try to handle crypt32 errors. Print the error code as fallback
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 25 Mar 2014 18:03:49 +0000
parents 8cfcd38a9bb3
children 292e2cb60ef0
comparison
equal deleted inserted replaced
184:1f44aae4528e 185:ee37c085b9f7
15 FORMAT_MESSAGE_FROM_SYSTEM | 15 FORMAT_MESSAGE_FROM_SYSTEM |
16 FORMAT_MESSAGE_IGNORE_INSERTS, 16 FORMAT_MESSAGE_IGNORE_INSERTS,
17 NULL, err, 0, (LPWSTR) &bufPtr, 0, NULL); 17 NULL, err, 0, (LPWSTR) &bufPtr, 0, NULL);
18 if (!bufPtr) 18 if (!bufPtr)
19 { 19 {
20 HMODULE hWinhttp = GetModuleHandleW (L"winhttp"); 20 HMODULE hWinhttp = GetModuleHandleW (L"crypt32");
21 if (hWinhttp) 21 if (hWinhttp)
22 { 22 {
23 FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER | 23 FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER |
24 FORMAT_MESSAGE_FROM_HMODULE | 24 FORMAT_MESSAGE_FROM_HMODULE |
25 FORMAT_MESSAGE_IGNORE_INSERTS, 25 FORMAT_MESSAGE_IGNORE_INSERTS,
26 hWinhttp, HRESULT_CODE (err), 0, 26 hWinhttp, HRESULT_CODE (err), 0,
27 (LPWSTR) &bufPtr, 0, NULL); 27 (LPWSTR) &bufPtr, 0, NULL);
28 } 28 }
29 } 29 }
30 if (!bufPtr) 30 if (!bufPtr)
31 printf ("Error getting last error\n"); 31 printf ("Error getting last error for code: %lx \n", err);
32 return bufPtr; 32 return bufPtr;
33 } 33 }
34 34
35 int write_stores_win (char **to_install, char **to_remove, bool user_store) 35 int write_stores_win (char **to_install, char **to_remove, bool user_store)
36 { 36 {

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