From 6bd24c3512fbdbf9e143982fb294415a3703d435 Mon Sep 17 00:00:00 2001
From: tatyana <tatyana@etersoft.ru>
Date: Fri, 26 Oct 2012 12:35:34 +0400
Subject: [eter-2.0.0 2/2] ole32: Fixed opening the registry key when the
 subkey name is NULL(eterbug #8050)

---
 dlls/ole32/compobj.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 4b35741..0c8e2e7 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -936,7 +936,14 @@ static DWORD COM_RegReadPath(HKEY hkeyroot, const WCHAR *keyname, const WCHAR *v
 	WCHAR src[MAX_PATH];
 	DWORD dwLength = dstlen * sizeof(WCHAR);
 
-	if((ret = RegOpenKeyW(hkeyroot, keyname, &key)) == ERROR_SUCCESS) {
+	if (keyname && *keyname)
+	   ret = RegOpenKeyExW(hkeyroot, keyname, 0, KEY_READ, &key);
+	else
+	{
+	   key=hkeyroot;
+	   ret= ERROR_SUCCESS;
+	}
+	if(ret == ERROR_SUCCESS) {
           if( (ret = RegQueryValueExW(key, NULL, NULL, &keytype, (LPBYTE)src, &dwLength)) == ERROR_SUCCESS ) {
             if (keytype == REG_EXPAND_SZ) {
               if (dstlen <= ExpandEnvironmentStringsW(src, dst, dstlen)) ret = ERROR_MORE_DATA;
-- 
1.7.10.5
