pain; suffering

This commit is contained in:
Brady McDermott
2023-10-24 19:38:51 -06:00
parent 5e878f98cf
commit 309ce4702b

View File

@@ -315,9 +315,9 @@ DWORD LoadConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups)
UINT cGroupKeys = 0; UINT cGroupKeys = 0;
UINT cGroupIndex = 0; UINT cGroupIndex = 0;
if (!(RegQueryInfoKey(hKeyProgramGroups, NULL, NULL, NULL, if (!RegQueryInfoKey(hKeyProgramGroups, NULL, NULL, NULL,
NULL, NULL, NULL, &cGroupKeys, NULL, NULL, NULL, &cGroupKeys,
NULL, NULL, NULL, NULL) == ERROR_SUCCESS)) NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{ {
dwConfigStatus = dwConfigStatus && RCE_SETTINGS; dwConfigStatus = dwConfigStatus && RCE_SETTINGS;
@@ -338,22 +338,31 @@ DWORD LoadConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups)
// the name of the registry key (val 3 here) // the name of the registry key (val 3 here)
// get the size of the group // get the size of the group
RegEnumValue(hKeyProgramGroups, cGroupIndex, (LPWSTR)&szValueName, RegEnumValue(hKeyProgramGroups, cGroupIndex, (LPWSTR)szValueName,
&cbValueName, NULL, NULL, NULL, &cbGroup); &cbValueName, NULL, &dwType, NULL, &cbGroup);
// allocate memory for the group // allocate and zero memory for the group
pGroup = malloc(cbGroup); pGroup = malloc(cbGroup);
ZeroMemory(pGroup, cbGroup);
// get the group // get the group
RegQueryValueEx(hKeyProgramGroups, (LPWSTR)&szValueName, NULL, NULL, RegQueryValueEx(hKeyProgramGroups, (LPWSTR)szValueName, NULL,
(LPBYTE)pGroup, &cbGroup); &dwType, (LPBYTE)pGroup, &cbGroup);
/*
RegGetValue(hKeyProgramGroups, NULL, (LPWSTR)szValueName,
RRF_RT_REG_BINARY, &dwType, (LPBYTE)pGroup, &cbGroup);
*/
// verify part of the group is valid
// TODO: use checksums instead of/alongside signatures
if (pGroup->dwSignature == GRP_SIGNATURE)
{
// load the group // load the group
CreateGroup(pGroup); CreateGroup(pGroup);
// free memory // free memory
if (pGroup)
free(pGroup); free(pGroup);
}
// increment // increment
cGroupIndex++; cGroupIndex++;