Set (when registry loaded) data to "\0" and length to 2 in empty
string value case, in place of setting data to NULL and length to 0,
and this is without initializing output buffer parameter of
RegQueryValue*.

diff --git a/misc/registry.c b/misc/registry.c
index 05d0f48..d55b46a 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -947,6 +947,14 @@
 	if (val->lastmodified<lastmodified) {
 		val->lastmodified=lastmodified;
 		val->type = type;
+
+                if ((type == REG_SZ || type == REG_EXPAND_SZ) && !data){
+
+                    data=xmalloc(sizeof(WCHAR));
+                    memset(data,0,sizeof(WCHAR));
+                    len =sizeof(WCHAR);
+                }
+
 		val->len  = len;
 		if (val->data) 
 			free(val->data);
@@ -2504,9 +2512,6 @@
 	if ((lpbData && ! lpcbData) || lpdwReserved)
 	  return ERROR_INVALID_PARAMETER;
 
-        if (lpbData && lpcbData)
-            memset(lpbData,0,*lpcbData);
-
 	/* An empty name string is equivalent to NULL */
 	if (lpValueName && !*lpValueName)
 	  lpValueName = NULL;
@@ -2576,9 +2581,6 @@
     TRACE(reg,"(%x,%s,%p,%ld)\n",hkey,debugstr_w(lpszSubKey),lpszData,
           lpcbData?*lpcbData:0);
 
-    if (lpszData && lpcbData)
-        memset(lpszData,0,*lpcbData);
-
     /* Only open subkey, if we really do descend */
     if (lpszSubKey && *lpszSubKey) {
         ret = RegOpenKeyW( hkey, lpszSubKey, &xhkey );
@@ -2621,9 +2623,6 @@
 	{  return ERROR_INVALID_PARAMETER;
 	}
 
-        if (lpbData && lpcbData)
-            memset(lpbData,0,*lpcbData);
-
 	lpszValueNameW = lpszValueName ? strdupA2W(lpszValueName) : NULL;	
 	
 	/* get just the type first */
@@ -2694,9 +2693,6 @@
     TRACE(reg,"(%x,%s,%p,%ld)\n",hkey,debugstr_a(lpszSubKey),lpszData,
           lpcbData?*lpcbData:0);
 
-    if (lpszData && lpcbData)
-        memset(lpszData,0,*lpcbData);
-    
     if (lpszSubKey && *lpszSubKey) {
         ret = RegOpenKey16( hkey, lpszSubKey, &xhkey );
         if( ret != ERROR_SUCCESS )