Commit 92457cad4123c6ee9bc56ce548285e09d06c204c

Vicent Martí 2013-09-17T08:00:44

Merge pull request #1857 from linquize/find-git-path-win32 Fix failure in win32 git path guessing

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/win32/findfile.c b/src/win32/findfile.c
index a1c11fc..d8b8f60 100644
--- a/src/win32/findfile.c
+++ b/src/win32/findfile.c
@@ -130,9 +130,9 @@ static int win32_find_git_in_registry(
 
 	assert(buf);
 
-	path16.len = 0;
+	path16.len = MAX_PATH;
 
-	if (RegOpenKeyExW(hieve, key, 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) {
+	if (RegOpenKeyExW(hieve, key, 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
 		if (RegQueryValueExW(hKey, L"InstallLocation", NULL, &dwType,
 			(LPBYTE)&path16.path, &path16.len) == ERROR_SUCCESS)
 		{