fix access to 64 bit registry

This commit is contained in:
Vitor Santos Costa 2012-06-21 03:09:49 -05:00
parent 0ee26c6df9
commit 92f7c970b0

View File

@ -217,7 +217,7 @@ Yap_InitSysPath(void) {
return; return;
} }
buflen = strlen(LOCAL_FileNameBuf); buflen = strlen(LOCAL_FileNameBuf);
pt = LOCAL_FileNameBuf+strlen(LOCAL_FileNameBuf); pt = LOCAL_FileNameBuf+buflen;
while (*--pt != '\\') { while (*--pt != '\\') {
/* skip executable */ /* skip executable */
if (pt == LOCAL_FileNameBuf) { if (pt == LOCAL_FileNameBuf) {
@ -3185,9 +3185,15 @@ Yap_RegistryGetString(char *name)
char *ptr; char *ptr;
int i; int i;
#if SIZEOF_INT_P == 8
if ( !(key=reg_open_key(L"HKEY_LOCAL_MACHINE/SOFTWARE/YAP/Prolog64", FALSE)) ) {
return NULL;
}
#else
if ( !(key=reg_open_key(L"HKEY_LOCAL_MACHINE/SOFTWARE/YAP/Prolog", FALSE)) ) { if ( !(key=reg_open_key(L"HKEY_LOCAL_MACHINE/SOFTWARE/YAP/Prolog", FALSE)) ) {
return NULL; return NULL;
} }
#endif
if ( RegQueryValueEx(key, name, NULL, &type, data, &len) == ERROR_SUCCESS ) { if ( RegQueryValueEx(key, name, NULL, &type, data, &len) == ERROR_SUCCESS ) {
RegCloseKey(key); RegCloseKey(key);
switch(type) { switch(type) {