Bug fixes.
diff --git a/include/winreg.h b/include/winreg.h
index 2becdef..c2ef8a9 100644
--- a/include/winreg.h
+++ b/include/winreg.h
@@ -31,18 +31,7 @@
#define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
#define REG_RESOURCE_LIST 8 /* resource list? huh? */
#define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
-
-#define HEX_REG_NONE 0x80000000
-#define HEX_REG_SZ 0x80000001
-#define HEX_REG_EXPAND_SZ 0x80000002
-#define HEX_REG_BINARY 0x80000003
-#define HEX_REG_DWORD 0x80000004
-#define HEX_REG_DWORD_LITTLE_ENDIAN 0x80000004
-#define HEX_REG_DWORD_BIG_ENDIAN 0x80000005
-#define HEX_REG_LINK 0x80000006
-#define HEX_REG_MULTI_SZ 0x80000007
-#define HEX_REG_RESOURCE_LIST 0x80000008
-#define HEX_REG_FULL_RESOURCE_DESCRIPTOR 0x80000009
+#define REG_RESOURCE_REQUIREMENTS_LIST 10
#define HKEY_CLASSES_ROOT ((HKEY) 0x80000000)
#define HKEY_CURRENT_USER ((HKEY) 0x80000001)
diff --git a/misc/registry.c b/misc/registry.c
index c9fb98a..99a4221 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -183,22 +183,19 @@
{
switch(key->type)
{
- case HEX_REG_EXPAND_SZ:
- case HEX_REG_SZ:
+ case REG_EXPAND_SZ:
case REG_SZ:
TRACE_(reg)(" Value %s, Data(sz)=%s\n",
debugstr_w(key->name),
debugstr_w((LPCWSTR)lpbData));
break;
- case HEX_REG_DWORD:
case REG_DWORD:
TRACE_(reg)(" Value %s, Data(dword)=0x%08lx\n",
debugstr_w(key->name),
(DWORD)*lpbData);
break;
- case HEX_REG_MULTI_SZ:
case REG_MULTI_SZ:
{
int i;
@@ -215,16 +212,7 @@
}
break;
- case HEX_REG_NONE:
- case HEX_REG_BINARY:
- case HEX_REG_LINK:
- case HEX_REG_RESOURCE_LIST:
- case HEX_REG_FULL_RESOURCE_DESCRIPTOR:
- case REG_NONE:
- case REG_LINK:
- case REG_RESOURCE_LIST:
- case REG_FULL_RESOURCE_DESCRIPTOR:
- case REG_BINARY:
+ default:
{
char szTemp[100]; /* 3*32 + 3 + 1 */
int i;
@@ -241,12 +229,6 @@
debugstr_w(key->name),
szTemp);
}
- break;
-
- default:
- FIXME_(reg)(" Value %s, Unknown data type %ld\n",
- debugstr_w(key->name),
- key->type);
} /* switch */
} /* if */
}
diff --git a/programs/regapi/regapi.c b/programs/regapi/regapi.c
index 59c74d3..b72fdf1 100644
--- a/programs/regapi/regapi.c
+++ b/programs/regapi/regapi.c
@@ -71,18 +71,18 @@
{"hex(7):", REG_MULTI_SZ},
{"hex(8):", REG_RESOURCE_LIST},
{"hex(9):", REG_FULL_RESOURCE_DESCRIPTOR},
- {"hex(80000000):", REG_NONE},
- {"hex(80000001):", REG_SZ},
- {"hex(80000002):", REG_EXPAND_SZ},
- {"hex(80000003):", REG_BINARY},
- {"hex(80000004):", REG_DWORD},
- {"hex(80000005):", REG_DWORD_BIG_ENDIAN},
- {"hex(80000006):", REG_LINK},
- {"hex(80000007):", REG_MULTI_SZ},
- {"hex(80000008):", REG_RESOURCE_LIST},
- {"hex(80000009):", REG_FULL_RESOURCE_DESCRIPTOR},
- {"hex(8000000a):", REG_BINARY}, /* REG_RESOURCE_REQUIREMENTS_LIST}, !Exist */
- {"hex(8000000A):", REG_BINARY}, /* REG_RESOURCE_REQUIREMENTS_LIST}, !Exist */
+ {"hex(10):", REG_RESOURCE_REQUIREMENTS_LIST},
+ {"hex(80000000):", 0x80000000},
+ {"hex(80000001):", 0x80000001},
+ {"hex(80000002):", 0x80000002},
+ {"hex(80000003):", 0x80000003},
+ {"hex(80000004):", 0x80000004},
+ {"hex(80000005):", 0x80000005},
+ {"hex(80000006):", 0x80000006},
+ {"hex(80000007):", 0x80000007},
+ {"hex(80000008):", 0x80000008},
+ {"hex(80000009):", 0x80000000},
+ {"hex(8000000a):", 0x8000000A}
};
const static int LAST_TYPE_MAP = sizeof(typeMap)/sizeof(dataTypeMap);
@@ -229,7 +229,7 @@
for (; counter < LAST_TYPE_MAP; counter++)
{
LONG len = strlen(typeMap[counter].mask);
- if ( strncmp( *lpValue, typeMap[counter].mask, len) == IDENTICAL)
+ if ( strncmpi( *lpValue, typeMap[counter].mask, len) == IDENTICAL)
{
/*
* We found it, modify the value's pointer in order to skip the data
@@ -480,7 +480,7 @@
DWORD dwType = NULL;
DWORD dwDataType;
- CHAR lpsCurrentValue[KEY_MAX_LEN];
+ LPSTR lpsCurrentValue;
LPSTR keyValue = argv[0];
LPSTR keyData = argv[1];
@@ -489,6 +489,7 @@
if ( (keyValue == NULL) || (keyData == NULL) )
return ERROR_INVALID_PARAMETER;
+ lpsCurrentValue=HeapAlloc(GetProcessHeap(), 0,KEY_MAX_LEN);
/*
* Default registry values are encoded in the input stream as '@' but as
* blank in the wine registry.
@@ -508,6 +509,12 @@
(LPBYTE)lpsCurrentValue,
&dwSize);
+ while(hRes==ERROR_MORE_DATA){
+ dwSize+=KEY_MAX_LEN;
+ lpsCurrentValue=HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,lpsCurrentValue,dwSize);
+ hRes = RegQueryValueExA(currentKeyHandle,keyValue,NULL,&dwType,(LPBYTE)lpsCurrentValue,&dwSize);
+ }
+
if( ( strlen(lpsCurrentValue) == 0 ) || /* The value is not existing */
( bForce )) /* -force option */
{
@@ -690,7 +697,7 @@
if( (keyValue[0] == '@') && (strlen(keyValue) == 1) )
{
LONG lLen = KEY_MAX_LEN;
- CHAR lpsData[KEY_MAX_LEN];
+ CHAR* lpsData=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,KEY_MAX_LEN);
/*
* We need to query the key default value
*/
@@ -700,6 +707,12 @@
(LPBYTE)lpsData,
&lLen);
+ while(hRes==ERROR_MORE_DATA){
+ lLen+=KEY_MAX_LEN;
+ lpsData=HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,lpsData,lLen);
+ hRes = RegQueryValue(currentKeyHandle,currentKeyName,(LPBYTE)lpsData,&lLen);
+ }
+
if (hRes == ERROR_SUCCESS)
{
lpsRes = HeapAlloc( GetProcessHeap(), 0, lLen);
@@ -709,7 +722,7 @@
else
{
DWORD dwLen = KEY_MAX_LEN;
- BYTE lpbData[KEY_MAX_LEN];
+ BYTE* lpbData=HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,KEY_MAX_LEN);
DWORD dwType;
/*
* We need to query a specific value for the key
@@ -722,6 +735,12 @@
(LPBYTE)lpbData,
&dwLen);
+ while(hRes==ERROR_MORE_DATA){
+ dwLen+=KEY_MAX_LEN;
+ lpbData=HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,lpbData,dwLen);
+ hRes = RegQueryValueEx(currentKeyHandle,keyValue,NULL,&dwType,(LPBYTE)lpbData,&dwLen);
+ }
+
if (hRes == ERROR_SUCCESS)
{
/*
@@ -730,6 +749,7 @@
switch ( dwType )
{
case REG_SZ:
+ case REG_EXPAND_SZ:
{
lpsRes = HeapAlloc( GetProcessHeap(), 0, dwLen);
strncpy(lpsRes, lpbData, dwLen);
@@ -747,6 +767,8 @@
}
}
}
+
+ HeapFree(GetProcessHeap(), 0, lpbData);
}
@@ -904,9 +926,13 @@
LPSTR token = NULL; /* current token analized */
LPSTR stdInput = NULL; /* line read from stdin */
INT cmdIndex = -1; /* index of the command in array */
+ LPSTR nextLine = NULL;
+ ULONG currentSize = STDIN_MAX_LEN;
stdInput = HeapAlloc(GetProcessHeap(), 0, STDIN_MAX_LEN);
- if (stdInput == NULL)
+ nextLine = HeapAlloc(GetProcessHeap(), 0, STDIN_MAX_LEN);
+
+ if (stdInput == NULL || nextLine== NULL)
return NOT_ENOUGH_MEMORY;
/*
@@ -946,8 +972,13 @@
/*
* read a line
*/
- stdInput = fgets(stdInput, STDIN_MAX_LEN, stdin);
+ ULONG curSize=STDIN_MAX_LEN;
+ char* s=NULL;
+ while((NULL!=(stdInput=fgets(stdInput,curSize,stdin))) && (NULL==(s=strchr(stdInput,'\n'))) ){
+ fseek(stdin,-curSize,SEEK_CUR+1);
+ stdInput=HeapReAlloc(GetProcessHeap(), 0,stdInput,curSize+=STDIN_MAX_LEN);
+ }
/*
* Make some handy generic stuff here...
*/
@@ -957,6 +988,24 @@
if( stdInput[0] == '#' ) /* this is a comment, skip */
continue;
+
+ while( stdInput[strlen(stdInput) -1] == '\\' ){ /* a '\' char in the end of the current line means */
+ /* that this line is not complete and we have to get */
+ stdInput[strlen(stdInput) -1]= NULL; /* the rest in the next lines */
+
+ nextLine = fgets(nextLine, STDIN_MAX_LEN, stdin);
+
+ nextLine[strlen(nextLine)-1] = NULL;
+
+ if ( (strlen(stdInput)+strlen(nextLine)) > currentSize){
+
+ stdInput=HeapReAlloc(GetProcessHeap(),0,stdInput,strlen(stdInput)+STDIN_MAX_LEN);
+
+ currentSize+=STDIN_MAX_LEN;
+ }
+
+ strcat(stdInput,nextLine+2);
+ }
}
/*
@@ -975,7 +1024,10 @@
if ( commandSaveRegistry[cmdIndex] != FALSE )
SHELL_SaveRegistry();
+ HeapFree(GetProcessHeap(), 0, nextLine);
+
HeapFree(GetProcessHeap(), 0, stdInput);
+
return SUCCESS;
}