a few small things, ZERO errors when compiling, feeling gangster about it, here it is
This commit is contained in:
Binary file not shown.
@@ -15,16 +15,17 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
/* Variables */
|
/* Variables */
|
||||||
// Miscellaneous
|
// Global
|
||||||
BOOL bIsDefaultShell = FALSE;
|
BOOL bIsDefaultShell = FALSE;
|
||||||
|
// Global Strings
|
||||||
|
WCHAR szAppTitle[32];
|
||||||
|
WCHAR szProgMgr[] = L"progmgr";
|
||||||
|
WCHAR szWebsite[64];
|
||||||
// Window Related
|
// Window Related
|
||||||
HICON hProgMgrIcon = NULL;
|
HICON hProgMgrIcon = NULL;
|
||||||
HINSTANCE hAppInstance;
|
HINSTANCE hAppInstance;
|
||||||
HWND hwndProgMgr = NULL;
|
HWND hwndProgMgr = NULL;
|
||||||
HWND hwndMDIClient = NULL;
|
HWND hwndMDIClient = NULL;
|
||||||
// Global Strings
|
|
||||||
WCHAR szAppTitle[32];
|
|
||||||
WCHAR szProgMgr[] = L"progmgr";
|
|
||||||
|
|
||||||
/* Program Entry Point */
|
/* Program Entry Point */
|
||||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
|
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
|
||||||
@@ -38,7 +39,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
|
|||||||
// Create Important Strings
|
// Create Important Strings
|
||||||
LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, CharSizeOf(szAppTitle));
|
LoadString(hAppInstance, IDS_APPTITLE, szAppTitle, CharSizeOf(szAppTitle));
|
||||||
LoadString(hAppInstance, IDS_PMCLASS, szClass, CharSizeOf(szClass));
|
LoadString(hAppInstance, IDS_PMCLASS, szClass, CharSizeOf(szClass));
|
||||||
|
LoadString(hAppInstance, IDS_WEBSITE, szWebsite, CharSizeOf(szWebsite));
|
||||||
|
|
||||||
// And add Task Manager...
|
// And add Task Manager...
|
||||||
// LoadString(hAppInstance, IDS_TASKMGR, szBuffer, CharSizeOf(szBuffer));
|
// LoadString(hAppInstance, IDS_TASKMGR, szBuffer, CharSizeOf(szBuffer));
|
||||||
|
|||||||
@@ -17,7 +17,18 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
|||||||
#include <wtypes.h>
|
#include <wtypes.h>
|
||||||
|
|
||||||
/* Macros and Defines */
|
/* Macros and Defines */
|
||||||
|
#define GET_WM_COMMAND_ID(wParam, lParam) LOWORD(wParam)
|
||||||
#define CharSizeOf(x) (sizeof(x) / sizeof(*x))
|
#define CharSizeOf(x) (sizeof(x) / sizeof(*x))
|
||||||
|
// RunFileDlg flags
|
||||||
|
#define RFF_NOBROWSE 0x0001 // Removes the browse button
|
||||||
|
#define RFF_NODEFAULT 0x0002 // No default item selected
|
||||||
|
#define RFF_CALCDIRECTORY 0x0004 // Calculates the working directory from the file name
|
||||||
|
#define RFF_NOLABEL 0x0008 // Removes the edit box label
|
||||||
|
#define RFF_NOSEPARATEMEM 0x0020 // Removes the Separate Memory Space check box, NT only
|
||||||
|
// RunFileDlg notification return values
|
||||||
|
#define RF_OK 0x0000 // Allow the application to run
|
||||||
|
#define RF_CANCEL 0x0001 // Cancel the operation and close the dialog
|
||||||
|
#define RF_RETRY 0x0002 // Cancel the operation, but leave the dialog open
|
||||||
|
|
||||||
/* Global Variables */
|
/* Global Variables */
|
||||||
// PROGMGR.C
|
// PROGMGR.C
|
||||||
@@ -27,7 +38,12 @@ extern HWND hwndProgMgr;
|
|||||||
extern HWND hwndMDIClient;
|
extern HWND hwndMDIClient;
|
||||||
extern WCHAR szAppTitle[32];
|
extern WCHAR szAppTitle[32];
|
||||||
extern WCHAR szProgMgr[];
|
extern WCHAR szProgMgr[];
|
||||||
|
extern WCHAR szWebsite[64];
|
||||||
|
|
||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
|
// SHELLINT.C
|
||||||
|
BOOL RunFile(HWND hWndOwner, HICON hIcon, LPWSTR lpszDir, LPWSTR lpszTitle, LPWSTR lpszDesc, DWORD dwFlags);
|
||||||
|
BOOL ShutdownDlg(HWND hWndOwner);
|
||||||
// WNDPROC.C
|
// WNDPROC.C
|
||||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
||||||
|
|||||||
@@ -158,6 +158,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="progmgr.c" />
|
<ClCompile Include="progmgr.c" />
|
||||||
<ClCompile Include="registry.c" />
|
<ClCompile Include="registry.c" />
|
||||||
|
<ClCompile Include="shellint.c" />
|
||||||
<ClCompile Include="wndproc.c" />
|
<ClCompile Include="wndproc.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
|
||||||
/* * * *\
|
/* * * *\
|
||||||
InitializeRegistryKeys -
|
InitializeRegistryKeys -
|
||||||
Takes the relevant Registry Keys and turns them
|
Takes the relevant Registry Keys and turns them
|
||||||
@@ -38,29 +37,22 @@ BOOL InitializeRegistryKeys()
|
|||||||
RETURNS -
|
RETURNS -
|
||||||
True if successful, false if unsuccessful.
|
True if successful, false if unsuccessful.
|
||||||
\* * * */
|
\* * * */
|
||||||
#if 0
|
|
||||||
BOOL IsProgMgrDefaultShell()
|
BOOL IsProgMgrDefaultShell()
|
||||||
{
|
{
|
||||||
HKEY hkeyWinlogon;
|
HKEY hkeyWinlogon;
|
||||||
DWORD dwType;
|
//DWORD szShell;
|
||||||
DWORD cbBuffer;
|
//DWORD cbBuffer = 0;
|
||||||
|
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SHELL_KEY, 0, KEY_READ, &hkeyWinlogon) == ERROR_SUCCESS) {
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SHELL_KEY, 0, KEY_READ, &hkeyWinlogon) == ERROR_SUCCESS) {
|
||||||
cbBuffer = sizeof(szBuffer);
|
//if (RegQueryValueEx(hkeyWinlogon, L"Shell", 0, NULL, szShell, &cbBuffer) == ERROR_SUCCESS) {
|
||||||
if (RegQueryValueEx(hkeyWinlogon, L"Shell", 0, NULL, (LPBYTE)szBuffer, &cbBuffer) == ERROR_SUCCESS) {
|
|
||||||
CharLower(szBuffer);
|
|
||||||
lpt = szBuffer;
|
|
||||||
while (lpt = wcsstr(lpt, szProgmgr)) {
|
|
||||||
// we probably found progman
|
// we probably found progman
|
||||||
lpt += lstrlen(szProgmgr);
|
//}
|
||||||
if (*lpt == TEXT(' ') || *lpt == TEXT('.') || *lpt == TEXT(',') || !*lpt)
|
}
|
||||||
bExitWindows = TRUE;
|
else {
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// assume that progman is the shell.
|
// assume that progman is the shell.
|
||||||
bExitWindows = TRUE;
|
}
|
||||||
}
|
|
||||||
|
RegCloseKey(hkeyWinlogon);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
#define PROGMAN_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Program Manager"
|
#define PROGMAN_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Program Manager"
|
||||||
#define WINDOWS_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"
|
#define WINDOWS_KEY L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows"
|
||||||
#define PROGMGR_KEY L"Software\\Freedom Desktop\\Program Manager II"
|
#define PROGMGR_KEY L"Software\\Freedom Desktop\\Program Manager II"
|
||||||
#define REGKEYMAXLENGTH 261
|
#define HKEYMAXLENGTH 261
|
||||||
|
|
||||||
/* Global Registry Keys */
|
/* Global Registry Keys */
|
||||||
//HKEY hkeyProgramManager;
|
//HKEY hkeyProgramManager;
|
||||||
|
|||||||
Binary file not shown.
59
progmgr/shellint.c
Normal file
59
progmgr/shellint.c
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/* * * * * * * *\
|
||||||
|
SHELLINT.C -
|
||||||
|
Copyright (c) 2023 freedom7341, Freedom Desktop
|
||||||
|
DESCRIPTION -
|
||||||
|
Program Manager's shell interface functions.
|
||||||
|
LICENSE INFORMATION -
|
||||||
|
MIT License, see LICENSE.txt in the root folder
|
||||||
|
\* * * * * * * */
|
||||||
|
|
||||||
|
/* Headers */
|
||||||
|
#include "progmgr.h"
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
/* * * *\
|
||||||
|
RunFile -
|
||||||
|
Produces a Run dialog window.
|
||||||
|
RETURNS -
|
||||||
|
True if successful, false if unsuccessful.
|
||||||
|
\* * * */
|
||||||
|
BOOL RunFile(HWND hWndOwner,
|
||||||
|
HICON hIcon,
|
||||||
|
LPWSTR lpszDir,
|
||||||
|
LPWSTR lpszTitle,
|
||||||
|
LPWSTR lpszDesc,
|
||||||
|
DWORD dwFlags)
|
||||||
|
{
|
||||||
|
HMODULE hLib = LoadLibrary(L"shell32.dll");
|
||||||
|
|
||||||
|
if (hLib) {
|
||||||
|
FARPROC fLib = GetProcAddress(hLib, MAKEINTRESOURCEA(61));
|
||||||
|
if (fLib(hWndOwner, hIcon, lpszDir, lpszTitle, lpszDesc, dwFlags))
|
||||||
|
FreeLibrary(hLib);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
ShutdownDlg -
|
||||||
|
Produces a Shutdown dialog window.
|
||||||
|
RETURNS -
|
||||||
|
True if successful, false if unsuccessful.
|
||||||
|
\* * * */
|
||||||
|
BOOL ShutdownDlg(HWND hWndOwner)
|
||||||
|
{
|
||||||
|
HMODULE hLib = LoadLibrary(L"shell32.dll");
|
||||||
|
|
||||||
|
if (hLib) {
|
||||||
|
FARPROC fLib = GetProcAddress(hLib, MAKEINTRESOURCEA(60));
|
||||||
|
if (fLib(hWndOwner))
|
||||||
|
FreeLibrary(hLib);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (message)
|
switch (message) {
|
||||||
{
|
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
RECT rc;
|
RECT rc;
|
||||||
@@ -49,23 +49,82 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
if (!hwndMDIClient) {
|
if (!hwndMDIClient) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//case WM_SYSCOMMAND:
|
|
||||||
//{
|
case WM_SYSCOMMAND:
|
||||||
|
{
|
||||||
// if (wParam == IDM_TASKMGR) {
|
// if (wParam == IDM_TASKMGR) {
|
||||||
//ShellExecute(hwndProgMgr, &TEXT("OPEN\0"), &TEXT("TASKMGR.EXE\0"), NULL, NULL, SW_NORMAL);
|
//ShellExecute(hwndProgMgr, &TEXT("OPEN\0"), &TEXT("TASKMGR.EXE\0"), NULL, NULL, SW_NORMAL);
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
//break;
|
//break;
|
||||||
//}
|
if (wParam == IDM_FILE_SHUTDOWN) {
|
||||||
|
CmdProc(hWnd, wParam, lParam);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (wParam == IDM_FILE_RUN) {
|
||||||
|
CmdProc(hWnd, wParam, lParam);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
goto WndProcDefault;
|
||||||
|
//return DefFrameProc(hWnd, hwndMDIClient, uiMsg, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
case WM_COMMAND:
|
||||||
|
if (CmdProc(hWnd, wParam, lParam)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
goto WndProcDefault;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
WndProcDefault:
|
||||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
CmdProc -
|
||||||
|
Program Manager's syscommand procedure.
|
||||||
|
RETURNS -
|
||||||
|
Zero if nothing, otherwise returns the good stuff.
|
||||||
|
\* * * */
|
||||||
|
LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (GET_WM_COMMAND_ID(wParam, lParam)) {
|
||||||
|
|
||||||
|
case IDM_FILE_RUN:
|
||||||
|
RunFile(hWnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDM_FILE_SHUTDOWN:
|
||||||
|
ShutdownDlg(hWnd);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDM_HELP_INDEX:
|
||||||
|
ShellExecute(NULL, L"open", szWebsite, NULL, NULL, SW_SHOWNORMAL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case IDM_HELP_ABOUT:
|
||||||
|
{
|
||||||
|
WCHAR szTitle[40];
|
||||||
|
OutputDebugString(L"ABOUT BALLS!");
|
||||||
|
HICON hIcon = LoadIcon(hAppInstance, MAKEINTRESOURCE(PROGMGRICON));
|
||||||
|
|
||||||
|
LoadString(hAppInstance, IDS_APPTITLE, szTitle, CharSizeOf(szTitle));
|
||||||
|
ShellAbout(hwndProgMgr, szTitle, NULL, hIcon);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user