From fbf2e5da12578ae2d4390a20e624517a543553fa Mon Sep 17 00:00:00 2001
From: tatyana <tatyana@etersoft.ru>
Date: Wed, 31 Oct 2012 11:50:16 +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 |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 4b35741..8ed7c4a 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -936,7 +936,17 @@ 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) {
+	/* This hack is needed to solve
+	 * eterbug #8050
+	 * Do not open the keyroot when the keyname is NULL */
+	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
