From cbb7373cc1833843df0909e9dcd37f68ee89d330 Mon Sep 17 00:00:00 2001 From: freedom7341 Date: Wed, 27 Sep 2023 13:58:44 -0600 Subject: [PATCH] update group format variable names --- progmgr/dialog.c | 8 ++++---- progmgr/group.c | 14 +++++++------- progmgr/group.h | 4 ++-- progmgr/registry.c | 3 ++- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/progmgr/dialog.c b/progmgr/dialog.c index 0c3d089..6c73eb4 100644 --- a/progmgr/dialog.c +++ b/progmgr/dialog.c @@ -41,8 +41,8 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM .ftLastWrite = 0, .szIconPath = L"", .iIconIndex = 0, - .cItems = 0, - .iItems = NULL + .cItemArray = 0, + .pItemArray = NULL }; BOOL bOKEnabled = FALSE; WCHAR szBuffer[MAX_TITLE_LENGTH] = { L"\0" }; @@ -64,8 +64,8 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM grp.wVersion = GRP_VERSION; grp.wChecksum = 0; grp.dwFlags = 0; - grp.cItems = 0; - grp.iItems = NULL; + grp.cItemArray = 0; + grp.pItemArray = NULL; // Set the window title LoadString(hAppInstance, IDS_DLT_GRP_NEW, szDlgTitle, ARRAYSIZE(szDlgTitle)); diff --git a/progmgr/group.c b/progmgr/group.c index cb6730e..f027eb4 100644 --- a/progmgr/group.c +++ b/progmgr/group.c @@ -91,7 +91,7 @@ HWND CreateGroupWindow(GROUP grp) HICON hIconTemp = NULL; HWND hWndGroup = NULL; HWND hWndListView = NULL; - HANDLE hGroupHeap = NULL; + PGROUP pGroup = NULL; // TODO: allocate memory for the group in the array // of group pointers in PGARRAY, then pass this to @@ -99,7 +99,7 @@ HWND CreateGroupWindow(GROUP grp) // Unless... this just works a different way and I don't have to // keep track of all these stupid little pointers... since I can // just associate this with the appropriate window. - hGroupHeap = HeapCreate(HEAP_GENERATE_EXCEPTIONS, sizeof(grp), 0); + pGroup = (PGROUP)malloc(sizeof(grp) + sizeof(ITEM) * grp.cItemArray); // Get group minimized/maximized flags @@ -123,8 +123,8 @@ HWND CreateGroupWindow(GROUP grp) if ((hWndGroup = (HWND)SendMessage(hWndMDIClient, WM_MDICREATE, 0, (LPARAM)(LPTSTR)&mcs)) == NULL) return NULL; - // Associate the group structure heap handle to the group window - SetWindowLongPtr(hWndGroup, GWLP_USERDATA, hGroupHeap); + // Associate the group structure pointer to the group window + SetWindowLongPtr(hWndGroup, GWLP_USERDATA, pGroup); // Load the group icon if (ExtractIconEx(grp.szIconPath, grp.iIconIndex, &hIconLarge, &hIconSmall, 1)) @@ -194,8 +194,8 @@ GROUP SaveGroup(PGROUP pg) .szName = L"", .dwFlags = 0, .ftLastWrite = 0, - .cItems = 0, - .iItems = NULL + .cItemArray = 0, + .pItemArray = NULL }; HWND hWndGrp = NULL; WCHAR szGroupName[MAX_TITLE_LENGTH]; @@ -218,7 +218,7 @@ GROUP SaveGroup(PGROUP pg) GetSystemTimeAsFileTime(&grp.ftLastWrite); // Save items... - grp.cItems = 0; + grp.cItemArray = 0; // TODO: iterate through listview to save items return grp; diff --git a/progmgr/group.h b/progmgr/group.h index 9a2d545..f134754 100644 --- a/progmgr/group.h +++ b/progmgr/group.h @@ -58,8 +58,8 @@ typedef struct _GROUP { WCHAR szIconPath[MAX_PATH + 1]; INT iIconIndex; // Items - WORD cItems; // Number of items - PITEM iItems; // Array of items + WORD cItemArray; // Number of items in pItemArray + PITEM pItemArray; // Array of items } GROUP, * PGROUP; /* Global Variables */ diff --git a/progmgr/registry.c b/progmgr/registry.c index cdba2e9..f9738e7 100644 --- a/progmgr/registry.c +++ b/progmgr/registry.c @@ -127,8 +127,9 @@ DWORD SaveGroupToRegistry(_In_ PGROUP pg) return RCE_FAILURE; // Save group + // TODO: save items properly if (!RegSetValueEx(hKeyProgramGroups, pg->szName, 0, REG_BINARY, - (const BYTE*)pg, (sizeof(*pg) + sizeof(ITEM) * pg->cItems)) == ERROR_SUCCESS) + (const BYTE*)pg, (sizeof(*pg) + sizeof(ITEM) * pg->cItemArray)) == ERROR_SUCCESS) dwConfigStatus = dwConfigStatus && RCE_GROUPS; return dwConfigStatus;