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

View File

@@ -14,7 +14,17 @@
#include <Windows.h> #include <Windows.h>
#include <shlwapi.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 */ /* Functions */
/* * * *\ /* * * *\
InitializeRegistryKeys - InitializeRegistryKeys -
Takes the relevant Registry Keys and turns them Takes the relevant Registry Keys and turns them
@@ -24,10 +34,12 @@
\* * * */ \* * * */
BOOL InitializeRegistryKeys() BOOL InitializeRegistryKeys()
{ {
HKEY hkeyProgramManager; if (!RegCreateKeyEx(HKEY_CURRENT_USER, PROGMGR_KEY, 0, szProgMgr, 0, KEY_READ | KEY_WRITE, NULL, &hKeyProgramManager, NULL)) {
//HKEY hkeyPMSettings; 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);
if (!RegCreateKeyEx(HKEY_CURRENT_USER, PROGMGR_KEY, 0, 0, 0, KEY_READ | KEY_WRITE, NULL, &hkeyProgramManager, NULL)) {
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
@@ -47,7 +59,7 @@ BOOL IsProgMgrDefaultShell()
DWORD dwType; DWORD dwType;
DWORD dwBufferSize; 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 (RegQueryValueEx(hKeyWinlogon, L"Shell", 0, &dwType, (LPBYTE)szShell, &dwBufferSize) == ERROR_SUCCESS) {
if (StrStr(szShell, szProgMgr)) { if (StrStr(szShell, szProgMgr)) {
// ProgMgr detected >:) // ProgMgr detected >:)
@@ -69,3 +81,25 @@ BOOL IsProgMgrDefaultShell()
// No registry access. // No registry access.
return FALSE; 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> #include <wtypes.h>
/* Defines */ /* 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 #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 */ /* Global Variables */
//HKEY hKeyProgramManager; // HKEYs
//HKEY hKeyPMSettings; extern HKEY hKeyProgramManager;
extern HKEY hkeyProgramGroups;
extern HKEY hKeySettings;
/* Function Prototypes */ /* Function Prototypes */
BOOL InitializeRegistryKeys(VOID); BOOL InitializeRegistryKeys(VOID);

View File

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

View File

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