minor formatting changes, created registry settings key

This commit is contained in:
freedom
2023-07-21 10:17:03 -06:00
parent ee89918c06
commit 30bfade7bf
5 changed files with 56 additions and 19 deletions

View File

@@ -32,6 +32,7 @@ HWND hWndProgMgr = NULL;
HWND hWndMDIClient = NULL;
/* Functions */
/* * * *\
wWinMain -
Program Manager's entry point.
@@ -52,14 +53,11 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
hAppInstance = hInstance;
// Create Important Strings
LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle));
// Create Strings
LoadString(hAppInstance, IDS_PMCLASS, szClass, ARRAYSIZE(szClass));
LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, ARRAYSIZE(szAppTitle));
LoadString(hAppInstance, IDS_WEBSITE, szWebsite, ARRAYSIZE(szWebsite));
// And add Task Manager...
//
// Register the Frame Window
wc.lpfnWndProc = WndProc;
wc.hInstance = hAppInstance;
@@ -82,8 +80,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
bIsDefaultShell = IsProgMgrDefaultShell();
GetUserNameEx(NameSamCompatible, szUsername, &dwUsernameLen);
// OutputDebugString(szUsername);
// Add username to window title
GetUserNameEx(NameSamCompatible, szUsername, &dwUsernameLen);\
StringCchCopy(szWindowTitle, ARRAYSIZE(szAppTitle), szAppTitle);
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), L" - ");

View File

@@ -14,7 +14,17 @@
#include <Windows.h>
#include <shlwapi.h>
/* Variables */
// Global HKEYs
HKEY hKeyProgramManager = NULL;
HKEY hKeyProgramGroups = NULL;
HKEY hKeySettings = NULL;
// Registry Subkeys
PWSTR szProgramGroups = L"Program Groups";
PWSTR szSettings = L"Settings";
/* Functions */
/* * * *\
InitializeRegistryKeys -
Takes the relevant Registry Keys and turns them
@@ -24,10 +34,12 @@
\* * * */
BOOL InitializeRegistryKeys()
{
HKEY hkeyProgramManager;
//HKEY hkeyPMSettings;
if (!RegCreateKeyEx(HKEY_CURRENT_USER, PROGMGR_KEY, 0, 0, 0, KEY_READ | KEY_WRITE, NULL, &hkeyProgramManager, NULL)) {
if (!RegCreateKeyEx(HKEY_CURRENT_USER, PROGMGR_KEY, 0, szProgMgr, 0, KEY_READ | KEY_WRITE, NULL, &hKeyProgramManager, NULL)) {
RegCreateKeyEx(hKeyProgramManager, szProgramGroups, 0, szProgMgr, 0,
KEY_READ | KEY_WRITE, NULL, &hKeyProgramGroups, NULL);
RegCreateKeyEx(hKeyProgramManager, szSettings, 0, szProgMgr, 0,
KEY_READ | KEY_WRITE, NULL, &hKeySettings, NULL);
return TRUE;
}
return FALSE;
@@ -47,7 +59,7 @@ BOOL IsProgMgrDefaultShell()
DWORD dwType;
DWORD dwBufferSize;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SHELL_KEY, 0, KEY_READ, &hKeyWinlogon) == ERROR_SUCCESS) {
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WINLOGON_KEY, 0, KEY_READ, &hKeyWinlogon) == ERROR_SUCCESS) {
if (RegQueryValueEx(hKeyWinlogon, L"Shell", 0, &dwType, (LPBYTE)szShell, &dwBufferSize) == ERROR_SUCCESS) {
if (StrStr(szShell, szProgMgr)) {
// ProgMgr detected >:)
@@ -68,4 +80,26 @@ BOOL IsProgMgrDefaultShell()
}
// No registry access.
return FALSE;
}
/* * * *\
QueryConfig -
Finds all settings and retrieves them from the registry.
RETURNS -
True if successful, false if unsuccessful.
\* * * */
BOOL QueryConfig()
{
return FALSE;
}
/* * * *\
SaveConfig -
Finds all settings and saves them to the registry.
RETURNS -
True if successful, false if unsuccessful.
\* * * */
BOOL SaveConfig()
{
return FALSE;
}

View File

@@ -14,15 +14,18 @@
#include <wtypes.h>
/* Defines */
#define SHELL_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"
#define PROGMAN_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Program Manager"
#define WINDOWS_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"
#define PROGMGR_KEY L"Software\\Freedom Desktop\\Program Manager II"
#define HKEYMAXLEN 261
// Key Paths
#define WINLOGON_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"
// #define PROGMAN_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Program Manager"
// #define WINDOWS_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"
#define PROGMGR_KEY L"Software\\Freedom Desktop\\Program Manager II"
/* Global Registry Keys */
//HKEY hKeyProgramManager;
//HKEY hKeyPMSettings;
/* Global Variables */
// HKEYs
extern HKEY hKeyProgramManager;
extern HKEY hkeyProgramGroups;
extern HKEY hKeySettings;
/* Function Prototypes */
BOOL InitializeRegistryKeys(VOID);

View File

@@ -13,6 +13,7 @@
#include <Windows.h>
/* Functions */
/* * * *\
RunFileDlg -
Produces a Run dialog window.

View File

@@ -15,6 +15,7 @@
#include <Windows.h>
/* Functions */
/* * * *\
WndProc -
Program Manager's window procedure.