Skip to content

Commit

Permalink
let's go gambling
Browse files Browse the repository at this point in the history
  • Loading branch information
freedom7341 committed Oct 22, 2024
1 parent 154bed9 commit b679f71
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
32 changes: 25 additions & 7 deletions progmgr/registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,43 @@ BOOL IsProgMgrDefaultShell(VOID)

/* * * *\
RegistrySaveGroup -
Saves a group structure to registry.
Saves a group structure to the registry.
RETURNS -
RCE_* configuration error value
\* * * */
DWORD RegistrySaveGroup(_In_ PGROUP pg)
{
DWORD dwConfigStatus = RCE_SUCCESS;

// If the pointer is invalid then fail out
if (pg == NULL)
// If the pointer or HKEY is invalid then fail out
if ((pg == NULL) || (hKeyProgramGroups == NULL))
return RCE_FAILURE;

// Save group
UpdateGroup(pg);
if (!RegSetValueEx(hKeyProgramGroups, pg->szName, 0, REG_BINARY,
(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;
}

/* * * *\
Expand Down
1 change: 1 addition & 0 deletions progmgr/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ BOOL InitializeRegistryKeys(VOID);
BOOL IsProgMgrDefaultShell(VOID);
// Groups
DWORD RegistrySaveGroup(_In_ PGROUP pg);
DWORD RegistryRemoveGroup(_In_ PGROUP pg);
// Settings
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);
Expand Down

0 comments on commit b679f71

Please sign in to comment.