Mercurial > trustbridge
comparison common/util.c @ 1306:845048d4a69f
(issue159) Use user specific appdata directory for nss list with simple rights.
Using the ProgramData folder with resticted access rights failed in case
the process was not elevated.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 13 Oct 2014 12:31:37 +0200 |
parents | 0a803c3fb5a6 |
children | 2bacaec6e101 |
comparison
equal
deleted
inserted
replaced
1305:c56d2618aabe | 1306:845048d4a69f |
---|---|
509 all our shlobj calls into one file... */ | 509 all our shlobj calls into one file... */ |
510 wchar_t * | 510 wchar_t * |
511 get_program_data_folder () | 511 get_program_data_folder () |
512 { | 512 { |
513 wchar_t *folder_name = NULL; | 513 wchar_t *folder_name = NULL; |
514 if (SHGetKnownFolderPath (&FOLDERID_ProgramData, /* Get program data dir */ | 514 if (is_elevated()) |
515 KF_FLAG_CREATE | /* Create if it does not exist */ | 515 { |
516 KF_FLAG_INIT, /* Initialize it if created */ | 516 if (SHGetKnownFolderPath (&FOLDERID_ProgramData, /* Get program data dir */ |
517 INVALID_HANDLE_VALUE, /* Get it for the default user */ | 517 KF_FLAG_CREATE | /* Create if it does not exist */ |
518 &folder_name) != S_OK) | 518 KF_FLAG_INIT, /* Initialize it if created */ |
519 { | 519 INVALID_HANDLE_VALUE, /* Get it for the default user */ |
520 PRINTLASTERROR ("Failed to get folder path"); | 520 &folder_name) != S_OK) |
521 return NULL; | 521 { |
522 PRINTLASTERROR ("Failed to get folder path"); | |
523 return NULL; | |
524 } | |
525 } | |
526 else | |
527 { | |
528 if (SHGetKnownFolderPath (&FOLDERID_LocalAppData, /* Get program data dir */ | |
529 KF_FLAG_CREATE | /* Create if it does not exist */ | |
530 KF_FLAG_INIT, /* Initialize it if created */ | |
531 NULL, /* Get it for the default user */ | |
532 &folder_name) != S_OK) | |
533 { | |
534 PRINTLASTERROR ("Failed to get folder path"); | |
535 return NULL; | |
536 } | |
522 } | 537 } |
523 return folder_name; | 538 return folder_name; |
524 } | 539 } |
525 #endif | 540 #endif |
526 | 541 |