[windows] get InstallDir from registry, working

This commit is contained in:
nick black 2021-11-26 07:01:48 -05:00
parent 35a3b1184d
commit 70bfd825d7
2 changed files with 17 additions and 8 deletions

View File

@ -9,15 +9,24 @@
#include <stdio.h>
char* notcurses_data_dir(void){
const char key[] = "Software\\Notcurses\\InstallDir";
DWORD plen = 0;
LSTATUS r = RegGetValueA(HKEY_CURRENT_USER,
"Software\\Notcurses"
"InstallDir",
RRF_RT_REG_SZ, NULL,
LSTATUS r = RegGetValueA(HKEY_CURRENT_USER, key,
NULL, RRF_RT_REG_SZ, NULL,
NULL, &plen);
fprintf(stderr, "PLEN: %u\n", plen);
// FIXME
return NULL;
if(r){
return NULL;
}
char* val = malloc(plen + 1);
if(val == NULL){
return NULL;
}
r = RegGetValueA(HKEY_CURRENT_USER, key, NULL, RRF_RT_REG_SZ, NULL, val, &plen);
if(r){
free(val);
return NULL;
}
return val;
}
char* strndup(const char* str, size_t size){

View File

@ -25,7 +25,7 @@ Header image = C:\msys64\home\niblack\src\notcurses\doc\icon.png
Show Label = 1
VisualStylesEnabled = 1
[Files]
Installation path = <ProgramFiles>\DSSCAW\<AppName>\
Installation path = <ProgramFiles>\<AppName>\
Autcip = 1
[Uninstall]
Vwau = 0