CloseHandle should be RegCloseKey.
Add extern decl for Py_GetProgramName().
diff --git a/PC/getpath_nt.c b/PC/getpath_nt.c
index 2de74f1..189fc27 100644
--- a/PC/getpath_nt.c
+++ b/PC/getpath_nt.c
@@ -112,7 +112,7 @@
 	}
 
 	if (newKey)
-		CloseHandle(newKey);
+		RegCloseKey(newKey);
 	return retval;
 }
 /* Return the initial python search path.  This is called once from
@@ -129,6 +129,7 @@
 	static char *buf = NULL;
 	char *p;
 	int n;
+	extern char *Py_GetProgramName();
 
 	if (buf != NULL) {
 		free(buf);