changeset 1416:8e841fe5668b

partial avifile-CVS merge
author arpi
date Sun, 29 Jul 2001 16:44:37 +0000
parents 4d77492e5d67
children aefabb5664f8
files loader/registry.c loader/win32.c
diffstat 2 files changed, 41 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/loader/registry.c	Sun Jul 29 16:40:32 2001 +0000
+++ b/loader/registry.c	Sun Jul 29 16:44:37 2001 +0000
@@ -405,13 +405,43 @@
 //		return 0;
 	}
 	else
-		if (status) *status=REG_OPENED_EXISTING_KEY;
+	{
+            // this is a hack as I don't know how RegEnumValueA works
+	    if (strstr(fullname, "zlib") || strstr(fullname, "mszh"))
+                return 1;
+	    if (status) *status=REG_OPENED_EXISTING_KEY;
+	}
 
 	t=insert_handle(generate_handle(), fullname);
 	*newkey=t->handle;
 	free(fullname);
 	return 0;
 }
+
+long RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
+		   LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count)
+{
+    // have no idea how this should work
+    //printf("Reg Enum 0x%x %d  %p %d   data: %p %d  %d >%s<\n", hkey, index, value, *val_count, data, *count, reg_size, data);
+    {
+	reg_handle_t* t = find_handle(hkey);
+	if (t)
+	{
+	    struct reg_value* v=find_value_by_name(t->name);
+            *count = v->len;
+	    memcpy(data, v->value, *count);
+            *val_count = v->len;
+	    memcpy(value, v->value, *val_count);
+            if (type)
+		*type = v->type;
+	    //printf("Found handle  %s\n", v->name);
+            return 0;
+	}
+    }
+
+    return -1;
+}
+
 long RegSetValueExA(long key, const char* name, long v1, long v2, const void* data, long size)
 {
     struct reg_value* t;
--- a/loader/win32.c	Sun Jul 29 16:40:32 2001 +0000
+++ b/loader/win32.c	Sun Jul 29 16:44:37 2001 +0000
@@ -43,6 +43,9 @@
 #include <loader.h>
 #include <com.h>
 
+long RegEnumValueA(HKEY hkey, DWORD index, LPSTR value, LPDWORD val_count,
+		   LPDWORD reserved, LPDWORD type, LPBYTE data, LPDWORD count);
+
 char* def_path=WIN32_PATH;
 
 static void do_cpuid(unsigned int *regs)
@@ -1664,14 +1667,12 @@
 //    printf("LoadLibrary wants: %s/%s\n", def_path, name);
 
     if(strncmp(name, "c:\\windows\\", 11)==0)name+=11;
+    if(strncmp(name, ".\\", 2)==0) name += 2;
     if(name[0]!='/')
     {
 	strcpy(qq, def_path);
 	strcat(qq, "/");
-	if(strncmp(name, ".\\", 2)==0)
-	    strcat(qq, name+2);
-	else
-	    strcat(qq, name);
+	strcat(qq, name);
     }
     printf("Loading DLL: %s", qq);fflush(stdout);
 //    printf("Entering LoadLibraryA(%s)\n", name);
@@ -2011,7 +2012,7 @@
 
 int WINAPI expIsBadStringPtrA(const char* string, int nchars)
 {
-    int result;
+    int result=0;
 //    if(string==0)result=1; else result=0;
 //    dbgprintf("IsBadStringPtrW(0x%x, %d) => %d", string, nchars, result);
 //    if(string)wch_print(string);
@@ -2451,8 +2452,11 @@
  
 // printf("RegEnumValueA(%x,%ld,%p,%p,%p,%p,%p,%p)\n",
 //   hkey, index, value, val_count, reserved, type, data, count );
+// return -1;
 
- return -1;
+ return RegEnumValueA(hkey, index, value, val_count,
+			 reserved, type, data, count);
+
 }