Process sibling keys iteratively, thereby preventing exhaustion of the
stack.
This commit is contained in:
parent
7f274205a8
commit
a370fa83cb
|
@ -688,10 +688,24 @@ static int _w95_dump_dkv(_w95dkh *dkh,int nrLS,int nrMS,FILE *f)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static int _w95_dump_one_dke(LPCSTR key_name,_w95creg *creg,_w95rgkn *rgkn,_w95dke *dke,FILE *f,int level);
|
||||
|
||||
static int _w95_dump_dke(LPCSTR key_name,_w95creg *creg,_w95rgkn *rgkn,_w95dke *dke,FILE *f,int level)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
if (!_w95_dump_one_dke(key_name, creg, rgkn, dke, f, level))
|
||||
return FALSE;
|
||||
if (dke->next == 0xffffffff)
|
||||
return TRUE;
|
||||
dke = (_w95dke*)((char*)rgkn+dke->next);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* _w95_dump_dke [Internal]
|
||||
*/
|
||||
static int _w95_dump_dke(LPCSTR key_name,_w95creg *creg,_w95rgkn *rgkn,_w95dke *dke,FILE *f,int level)
|
||||
static int _w95_dump_one_dke(LPCSTR key_name,_w95creg *creg,_w95rgkn *rgkn,_w95dke *dke,FILE *f,int level)
|
||||
{
|
||||
_w95dkh * dkh;
|
||||
LPSTR new_key_name = NULL;
|
||||
|
@ -720,14 +734,6 @@ static int _w95_dump_dke(LPCSTR key_name,_w95creg *creg,_w95rgkn *rgkn,_w95dke *
|
|||
memcpy( new_key_name + len, dkh->name, dkh->keynamelen );
|
||||
new_key_name[len + dkh->keynamelen] = 0;
|
||||
|
||||
/* walk sibling keys */
|
||||
if (dke->next != 0xffffffff ) {
|
||||
if (!_w95_dump_dke(key_name, creg, rgkn, (_w95dke*)((char*)rgkn+dke->next),f,level)) {
|
||||
free(new_key_name);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* write the key path (something like [Software\\Microsoft\\..]) only if:
|
||||
1) key has some values
|
||||
2) key has no values and no subkeys
|
||||
|
|
Loading…
Reference in New Issue