GROUPS LOAD

This commit is contained in:
Brady McDermott
2023-10-25 11:49:37 -06:00
parent 309ce4702b
commit c1dd3ae999
3 changed files with 10 additions and 14 deletions

View File

@@ -77,8 +77,12 @@ BOOL InitializeGroups(VOID)
if (!RegisterClassEx(&wce)) if (!RegisterClassEx(&wce))
return FALSE; return FALSE;
// Now we can create the groups
if(LoadConfig(FALSE, FALSE, TRUE) != RCE_SUCCESS)
return FALSE;
// TODO: go thru registry and load all saved groups here // TODO: if loading groups fails, throw an error
return TRUE; return TRUE;
} }

View File

@@ -331,14 +331,15 @@ DWORD LoadConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups)
while (cGroupKeys >= cGroupIndex) while (cGroupKeys >= cGroupIndex)
{ {
WCHAR szValueName[MAX_TITLE_LENGTH] = TEXT(""); WCHAR szValueName[MAX_TITLE_LENGTH] = TEXT("");
UINT cbValueName = 0; UINT cbValueName = sizeof(szValueName);
DWORD dwTemp = 0;
// TODO: figure out where i'm really going to store the // TODO: figure out where i'm really going to store the
// group name, if not in the group structure then in // group name, if not in the group structure then in
// 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, szValueName,
&cbValueName, NULL, &dwType, NULL, &cbGroup); &cbValueName, NULL, &dwType, NULL, &cbGroup);
// allocate and zero memory for the group // allocate and zero memory for the group
@@ -346,12 +347,8 @@ DWORD LoadConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups)
ZeroMemory(pGroup, cbGroup); ZeroMemory(pGroup, cbGroup);
// get the group // get the group
RegQueryValueEx(hKeyProgramGroups, (LPWSTR)szValueName, NULL, dwTemp = RegQueryValueEx(hKeyProgramGroups, szValueName, NULL,
&dwType, (LPBYTE)pGroup, &cbGroup); &dwType, pGroup, &cbGroup);
/*
RegGetValue(hKeyProgramGroups, NULL, (LPWSTR)szValueName,
RRF_RT_REG_BINARY, &dwType, (LPBYTE)pGroup, &cbGroup);
*/
// verify part of the group is valid // verify part of the group is valid
// TODO: use checksums instead of/alongside signatures // TODO: use checksums instead of/alongside signatures

View File

@@ -35,11 +35,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case WM_CREATE: case WM_CREATE:
{ {
// Now we can create the groups
if(LoadConfig(FALSE, FALSE, TRUE) != RCE_SUCCESS)
return FALSE;
// TODO: if loading groups fails, throw an error
return TRUE; return TRUE;
} }