Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Win32 launcher: Look for Python in HKLM (bug 1480)
  • Loading branch information
thp committed Mar 3, 2012
1 parent bded842 commit 2939c62
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/win32-launcher/gpodder.c
Expand Up @@ -61,14 +61,14 @@
if(x == NULL) {BAILOUT("Cannot find function: " #x);}}


const char *FindPythonDLL()
const char *FindPythonDLL(HKEY rootKey)
{
static char InstallPath[MAX_PATH];
DWORD InstallPathSize = MAX_PATH;
HKEY RegKey;
char *result = NULL;

if (RegOpenKeyEx(HKEY_CURRENT_USER,
if (RegOpenKeyEx(rootKey,
"Software\\Python\\PythonCore\\2.7\\InstallPath",
0, KEY_READ, &RegKey) != ERROR_SUCCESS) {
return NULL;
Expand Down Expand Up @@ -150,7 +150,11 @@ int main(int argc, char** argv)

if (python_dll == NULL) {
/* Try to detect "just for me"-installed Python version (bug 1480) */
dll_path = FindPythonDLL();
dll_path = FindPythonDLL(HKEY_CURRENT_USER);
if (dll_path == NULL) {
/* Try to detect "for all users" Python (bug 1480, comment 9) */
dll_path = FindPythonDLL(HKEY_LOCAL_MACHINE);
}
if (dll_path != NULL) {
python_dll = LoadLibrary(dll_path);
}
Expand Down

0 comments on commit 2939c62

Please sign in to comment.