From 24a17d0287e4ffb70fa61853c25d8700718670a3 Mon Sep 17 00:00:00 2001 From: freedom7341 Date: Fri, 22 Sep 2023 14:17:16 -0600 Subject: [PATCH] prep for memory management --- progmgr/dialog.c | 3 +++ progmgr/group.c | 1 + progmgr/memmgmt.c | 18 ++++++++++++++++++ progmgr/memmgmt.h | 15 +++++++++++++++ progmgr/progmgr.c | 7 ++++--- progmgr/progmgr.vcxproj | 2 ++ progmgr/progmgr.vcxproj.filters | 6 ++++++ progmgr/registry.c | 2 +- 8 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 progmgr/memmgmt.c create mode 100644 progmgr/memmgmt.h diff --git a/progmgr/dialog.c b/progmgr/dialog.c index f1803fb..01e8330 100644 --- a/progmgr/dialog.c +++ b/progmgr/dialog.c @@ -88,6 +88,9 @@ BOOL CALLBACK NewGroupDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LPARAM // Disable the OK button since we're starting with no text in the box. EnableWindow(GetDlgItem(hWndDlg, IDD_OK), bOKEnabled); + // Enable the common group checkbox if perms are good + EnableWindow(GetDlgItem(hWndDlg, IDD_COMMGROUP), bPermAdmin); + break; case WM_COMMAND: diff --git a/progmgr/group.c b/progmgr/group.c index 5e839ab..c635bcb 100644 --- a/progmgr/group.c +++ b/progmgr/group.c @@ -97,6 +97,7 @@ HWND CreateGroupWindow(GROUP grp) // of group pointers in PGARRAY, then pass this to // the group window in that little pointer thing :D + // Get group minimized/maximized flags mcs.szClass = szGrpClass; diff --git a/progmgr/memmgmt.c b/progmgr/memmgmt.c new file mode 100644 index 0000000..62bcaa8 --- /dev/null +++ b/progmgr/memmgmt.c @@ -0,0 +1,18 @@ +/* * * * * * * *\ + MEMMGMT.C - + Copyright (c) 2023 Vortesys + DESCRIPTION - + Program Manager's memory management functions + LICENSE INFORMATION - + MIT License, see LICENSE.txt in the root folder +\* * * * * * * */ + +/* Headers */ +#include "memmgmt.h" +// #define WIN32_LEAN_AND_MEAN +#include + +/* Variables */ + +/* Functions */ + diff --git a/progmgr/memmgmt.h b/progmgr/memmgmt.h new file mode 100644 index 0000000..8b0fba5 --- /dev/null +++ b/progmgr/memmgmt.h @@ -0,0 +1,15 @@ +/* * * * * * * *\ + MEMMGMT.H - + Copyright (c) 2023 Vortesys + DESCRIPTION - + Header containing the functions and variables + related to Program Manager's memory management. + LICENSE INFORMATION - + MIT License, see LICENSE.txt in the root folder +\* * * * * * * */ + +/* Pragmas */ +#pragma once + +/* Includes */ +#include \ No newline at end of file diff --git a/progmgr/progmgr.c b/progmgr/progmgr.c index 4c0f55a..c9b29a8 100644 --- a/progmgr/progmgr.c +++ b/progmgr/progmgr.c @@ -53,9 +53,10 @@ BOOL bPermPower; // Has power option permissions \* * * */ BOOL UpdatePermissions(VOID) { - bPermAdmin = SE_SHUTDOWN_NAME; - bPermGuest = SE_SHUTDOWN_NAME; - bPermPower = SE_SHUTDOWN_NAME; + // SE_SHUTDOWN_NAME + bPermAdmin = FALSE; + bPermGuest = FALSE; + bPermPower = FALSE; return FALSE; } diff --git a/progmgr/progmgr.vcxproj b/progmgr/progmgr.vcxproj index 801dc9a..4ad41dd 100644 --- a/progmgr/progmgr.vcxproj +++ b/progmgr/progmgr.vcxproj @@ -168,6 +168,7 @@ + @@ -176,6 +177,7 @@ + diff --git a/progmgr/progmgr.vcxproj.filters b/progmgr/progmgr.vcxproj.filters index 2a26198..a4d023d 100644 --- a/progmgr/progmgr.vcxproj.filters +++ b/progmgr/progmgr.vcxproj.filters @@ -36,6 +36,9 @@ Header Files + + Header Files + @@ -62,6 +65,9 @@ Source Files + + Source Files + diff --git a/progmgr/registry.c b/progmgr/registry.c index 1189014..cdba2e9 100644 --- a/progmgr/registry.c +++ b/progmgr/registry.c @@ -148,7 +148,7 @@ DWORD LoadGroupFromRegistry(_Inout_ PGROUP pg, _Out_ PDWORD pdwBufferSize) // TODO: rethink this // If the pointer is invalid then fail out - if (pg == NULL | pdwBufferSize == NULL) + if ((pg == NULL) | (pdwBufferSize == NULL)) return RCE_FAILURE; // Load group