let's go gambling

This commit is contained in:
Brady McDermott
2024-10-21 18:34:06 -06:00
parent 154bed9106
commit b679f71607
2 changed files with 26 additions and 7 deletions

View File

@@ -114,25 +114,43 @@ BOOL IsProgMgrDefaultShell(VOID)
/* * * *\ /* * * *\
RegistrySaveGroup - RegistrySaveGroup -
Saves a group structure to registry. Saves a group structure to the registry.
RETURNS - RETURNS -
RCE_* configuration error value RCE_* configuration error value
\* * * */ \* * * */
DWORD RegistrySaveGroup(_In_ PGROUP pg) DWORD RegistrySaveGroup(_In_ PGROUP pg)
{ {
DWORD dwConfigStatus = RCE_SUCCESS; // If the pointer or HKEY is invalid then fail out
if ((pg == NULL) || (hKeyProgramGroups == NULL))
// If the pointer is invalid then fail out
if (pg == NULL)
return RCE_FAILURE; return RCE_FAILURE;
// Save group // Save group
UpdateGroup(pg); UpdateGroup(pg);
if (!RegSetValueEx(hKeyProgramGroups, pg->szName, 0, REG_BINARY, if (!RegSetValueEx(hKeyProgramGroups, pg->szName, 0, REG_BINARY,
(const BYTE*)pg, sizeof(*pg)) == ERROR_SUCCESS) (const BYTE*)pg, sizeof(*pg)) == ERROR_SUCCESS)
dwConfigStatus = dwConfigStatus && RCE_GROUPS; return RCE_GROUPS;
return dwConfigStatus; return RCE_SUCCESS;
}
/* * * *\
RegistryRemoveGroup -
Removes a group structure from the registry.
RETURNS -
RCE_* configuration error value
\* * * */
DWORD RegistryRemoveGroup(_In_ PGROUP pg)
{
// If the pointer or HKEY is invalid then fail out
if ((pg == NULL) || (hKeyProgramGroups == NULL))
return RCE_FAILURE;
// Try to remove the group matching the name
// If we fail, group does not exist in the registry
if (RegDeleteValue(hKeyProgramGroups, pg->szName) != ERROR_SUCCESS)
return RCE_FAILURE;
return RCE_SUCCESS;
} }
/* * * *\ /* * * *\

View File

@@ -48,6 +48,7 @@ BOOL InitializeRegistryKeys(VOID);
BOOL IsProgMgrDefaultShell(VOID); BOOL IsProgMgrDefaultShell(VOID);
// Groups // Groups
DWORD RegistrySaveGroup(_In_ PGROUP pg); DWORD RegistrySaveGroup(_In_ PGROUP pg);
DWORD RegistryRemoveGroup(_In_ PGROUP pg);
// Settings // Settings
DWORD SaveConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups, _In_ BOOL bExit); DWORD SaveConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups, _In_ BOOL bExit);
DWORD LoadConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups); DWORD LoadConfig(_In_ BOOL bSettings, _In_ BOOL bPos, _In_ BOOL bGroups);