i hate this
This commit is contained in:
@@ -392,6 +392,7 @@ BOOL LoadItems(_In_ HWND hWndGroup)
|
||||
\* * * */
|
||||
BOOL RemoveItem(_In_ PITEM pi)
|
||||
{
|
||||
// TODO: implement this
|
||||
// return NULL if we can't get to the group
|
||||
if (pi == NULL)
|
||||
return FALSE;
|
||||
@@ -456,6 +457,40 @@ VOID UpdateGroup(_In_ PGROUP pg)
|
||||
return;
|
||||
}
|
||||
|
||||
/* * * *\
|
||||
VerifyGroup -
|
||||
Verifies that a group contains the
|
||||
correct information about itself.
|
||||
ABSTRACT -
|
||||
This function will check the checksum,
|
||||
verify the number of items, check other
|
||||
parts of the strucutre. If requested,
|
||||
it will repair the group if it is damaged.
|
||||
RETURNS -
|
||||
TRUE if group appears to be fine
|
||||
FALSE if the group is damaged
|
||||
\* * * */
|
||||
BOOL VerifyGroup(_In_ PGROUP pg, _In_ BOOL bRepair)
|
||||
{
|
||||
if (pg->dwSignature != GRP_SIGNATURE)
|
||||
return FALSE;
|
||||
|
||||
// if (pg->wVersion != GRP_VERSION)
|
||||
// some sort of version difference handling
|
||||
|
||||
if (pg->wChecksum == 1234)
|
||||
// TODO: calculate checksum function
|
||||
return FALSE;
|
||||
|
||||
// TODO: use ftlastwrite to throw an error
|
||||
// if system clock is in the future
|
||||
|
||||
// calculate the size of the group based on item of numbers
|
||||
|
||||
// TODO: change to return a dword error value
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* * * *\
|
||||
CalculateGroupMemory -
|
||||
Calculates the memory needed by a group.
|
||||
@@ -472,9 +507,7 @@ UINT CalculateGroupMemory(_In_ PGROUP pGroup, _In_ UINT cItems, _In_ BOOL bLean)
|
||||
// first add the size of a group strucutre
|
||||
cbGroupSize += sizeof(GROUP);
|
||||
|
||||
// calculate the total amount of items wanted, set
|
||||
// to 16 if there's less than 16 items so we always
|
||||
// have some memory ready
|
||||
// calculate the total amount of items wanted
|
||||
cItemBlock = pGroup->cItemArray + cItems;
|
||||
|
||||
if (!bLean)
|
||||
|
||||
@@ -85,6 +85,7 @@ BOOL RemoveItem(_In_ PITEM pi);
|
||||
BOOL ExecuteItem(_In_ PITEM pi);
|
||||
// Save/Load helper functions
|
||||
VOID UpdateGroup(_In_ PGROUP pg);
|
||||
BOOL VerifyGroup(_In_ PGROUP pg, _In_ BOOL bRepair);
|
||||
// Helper functions
|
||||
UINT CalculateGroupMemory(_In_ PGROUP pGroup, _In_ UINT cItems, _In_ BOOL bLean);
|
||||
// Group Window
|
||||
|
||||
@@ -129,7 +129,7 @@ DWORD RegistrySaveGroup(_In_ PGROUP pg)
|
||||
// Save group
|
||||
UpdateGroup(pg);
|
||||
if (!RegSetValueEx(hKeyProgramGroups, pg->szName, 0, REG_BINARY,
|
||||
(const BYTE*)pg, sizeof(*pg)) == ERROR_SUCCESS)
|
||||
(LPBYTE)pg, CalculateGroupMemory(pg, 0, 1)) == ERROR_SUCCESS)
|
||||
dwConfigStatus = dwConfigStatus && RCE_GROUPS;
|
||||
|
||||
return dwConfigStatus;
|
||||
@@ -148,8 +148,6 @@ DWORD RegistryLoadGroup(_Inout_ PGROUP pg, _Out_ DWORD dwBufferSize)
|
||||
|
||||
dwBufferSize = 0;
|
||||
|
||||
// TODO: rethink this
|
||||
|
||||
// If the pointers are invalid then fail out
|
||||
if (pg == NULL)
|
||||
return RCE_FAILURE;
|
||||
@@ -209,10 +207,7 @@ DWORD SaveConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups, _In_ BO
|
||||
{
|
||||
HWND hWndGroup = NULL;
|
||||
|
||||
// TODO: Get list of groups, iterate through,
|
||||
// save each one as an individual subkey based
|
||||
// on the name of the group
|
||||
|
||||
// Save each group that exists as a window
|
||||
EnumChildWindows(hWndMDIClient, &SaveWindowEnumProc, (LPARAM)bExit);
|
||||
}
|
||||
|
||||
@@ -348,7 +343,7 @@ DWORD LoadConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups)
|
||||
|
||||
// get the group
|
||||
dwTemp = RegQueryValueEx(hKeyProgramGroups, szValueName, NULL,
|
||||
&dwType, pGroup, &cbGroup);
|
||||
&dwType, (LPBYTE)pGroup, &cbGroup);
|
||||
|
||||
// verify part of the group is valid
|
||||
// TODO: use checksums instead of/alongside signatures
|
||||
|
||||
Reference in New Issue
Block a user