Merge pull request #1857 from linquize/find-git-path-win32 Fix failure in win32 git path guessing
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)
{