big commit here, desktop stuff mostly, not 100% working yet but progress is progress and i gotta use git
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -55,3 +55,5 @@ dkms.conf
|
|||||||
/progmgr/RCa10968
|
/progmgr/RCa10968
|
||||||
/progmgr/icons/Thumbs.db
|
/progmgr/icons/Thumbs.db
|
||||||
/bin/
|
/bin/
|
||||||
|
/misc/supermiumman.png
|
||||||
|
/bin.7z
|
||||||
|
|||||||
BIN
misc/superman.ico
Normal file
BIN
misc/superman.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 766 B |
@@ -6,4 +6,131 @@
|
|||||||
Only visible as the default shell.
|
Only visible as the default shell.
|
||||||
LICENSE INFORMATION -
|
LICENSE INFORMATION -
|
||||||
MIT License, see LICENSE.txt in the root folder
|
MIT License, see LICENSE.txt in the root folder
|
||||||
\* * * * * * * */
|
\* * * * * * * */
|
||||||
|
|
||||||
|
/* Headers */
|
||||||
|
#include "progmgr.h"
|
||||||
|
#include "resource.h"
|
||||||
|
// #define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
|
/* Variables */
|
||||||
|
HWND hWndDesktop;
|
||||||
|
RECT rcRoot;
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
CreateDesktopWindow -
|
||||||
|
Creates the invisible desktop window.
|
||||||
|
RETURNS -
|
||||||
|
True if successful, false if unsuccessful.
|
||||||
|
\* * * */
|
||||||
|
BOOL CreateDesktopWindow()
|
||||||
|
{
|
||||||
|
MSG msg = { 0 };
|
||||||
|
WNDCLASSEX wc = { 0 };
|
||||||
|
WCHAR szBuffer[MAX_PATH];
|
||||||
|
WCHAR szClass[16];
|
||||||
|
|
||||||
|
// If we fail, we shouldn't be here anyways.
|
||||||
|
//if (GetShellWindow())
|
||||||
|
// return FALSE;
|
||||||
|
|
||||||
|
// Get size of the root HWND
|
||||||
|
GetWindowRect(GetDesktopWindow(), &rcRoot);
|
||||||
|
|
||||||
|
// Load the window class string
|
||||||
|
LoadString(hAppInstance, IDS_DTCLASS, szClass, ARRAYSIZE(szClass));
|
||||||
|
|
||||||
|
// Refresh the wallpaper...
|
||||||
|
SystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szBuffer, 0);
|
||||||
|
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, szBuffer, SPIF_SENDCHANGE);
|
||||||
|
|
||||||
|
// Reset the work area (removes dead-space after switching from another shell)
|
||||||
|
// May have unintended consequences. Doesn't work with multiple monitors.
|
||||||
|
SystemParametersInfo(SPI_SETWORKAREA, 0, &rcRoot, SPIF_SENDCHANGE);
|
||||||
|
|
||||||
|
// Register the desktop window
|
||||||
|
wc.cbSize = sizeof(WNDCLASSEX);
|
||||||
|
wc.lpfnWndProc = DeskWndProc;
|
||||||
|
wc.hInstance = hAppInstance;
|
||||||
|
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||||
|
wc.hbrBackground = (HBRUSH)(30);
|
||||||
|
wc.style = CS_NOCLOSE;
|
||||||
|
wc.lpszClassName = szClass;
|
||||||
|
if (!RegisterClassEx(&wc))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!CreateWindowEx(WS_EX_TOOLWINDOW, wc.lpszClassName, NULL, WS_VISIBLE,
|
||||||
|
rcRoot.left, rcRoot.top, rcRoot.right - rcRoot.left, rcRoot.bottom - rcRoot.top,
|
||||||
|
NULL, NULL, hAppInstance, NULL));
|
||||||
|
return 2;
|
||||||
|
|
||||||
|
while (GetMessage(&msg, NULL, 0, 0) > 0)
|
||||||
|
{
|
||||||
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
DeskWndProc -
|
||||||
|
Program Manager's desktop window procedure.
|
||||||
|
RETURNS -
|
||||||
|
Zero if nothing, otherwise returns the good stuff.
|
||||||
|
\* * * */
|
||||||
|
LRESULT CALLBACK DeskWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (message)
|
||||||
|
{
|
||||||
|
|
||||||
|
case WM_CREATE:
|
||||||
|
// Populate hWndDesktop
|
||||||
|
hWndDesktop = hWnd;
|
||||||
|
|
||||||
|
// Set the window position to shell
|
||||||
|
SetShellWindow(hWndDesktop);
|
||||||
|
ShowWindow(hWndDesktop, SW_MAXIMIZE);
|
||||||
|
|
||||||
|
// Strip the border from the desktop window
|
||||||
|
SetWindowLongPtr(hWndDesktop, GWL_STYLE, WS_POPUP);
|
||||||
|
|
||||||
|
// Size the window to take up the primary monitor's desktop
|
||||||
|
SetWindowPos(hWndDesktop, HWND_BOTTOM,
|
||||||
|
rcRoot.left, rcRoot.top, rcRoot.right - rcRoot.left, rcRoot.bottom - rcRoot.top,
|
||||||
|
SWP_FRAMECHANGED | SWP_NOACTIVATE);
|
||||||
|
|
||||||
|
// Finally, bring Program Manager to the foreground.
|
||||||
|
SetWindowPos(hWndProgMgr, HWND_TOP,
|
||||||
|
0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_ACTIVATE:
|
||||||
|
case WM_DPICHANGED:
|
||||||
|
case WM_DISPLAYCHANGE:
|
||||||
|
case WM_DEVICECHANGE:
|
||||||
|
// Get size of the root HWND
|
||||||
|
GetWindowRect(GetDesktopWindow(), &rcRoot);
|
||||||
|
SetWindowPos(hWndDesktop, HWND_BOTTOM,
|
||||||
|
rcRoot.left, rcRoot.top, rcRoot.right - rcRoot.left, rcRoot.bottom - rcRoot.top,
|
||||||
|
SWP_NOACTIVATE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_WINDOWPOSCHANGING:
|
||||||
|
case WM_SYSCOMMAND:
|
||||||
|
case WM_COMMAND:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_DESTROY:
|
||||||
|
case WM_CLOSE:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -49,7 +49,6 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
|
|||||||
WCHAR szUsername[UNLEN + 1] = L"";
|
WCHAR szUsername[UNLEN + 1] = L"";
|
||||||
DWORD dwUsernameLen = UNLEN;
|
DWORD dwUsernameLen = UNLEN;
|
||||||
WCHAR szWindowTitle[UNLEN + ARRAYSIZE(szAppTitle) + 4] = L"";
|
WCHAR szWindowTitle[UNLEN + ARRAYSIZE(szAppTitle) + 4] = L"";
|
||||||
RECT rWorkArea;
|
|
||||||
|
|
||||||
hAppInstance = hInstance;
|
hAppInstance = hInstance;
|
||||||
|
|
||||||
@@ -59,6 +58,9 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
|
|||||||
LoadString(hAppInstance, IDS_WEBSITE, szWebsite, ARRAYSIZE(szWebsite));
|
LoadString(hAppInstance, IDS_WEBSITE, szWebsite, ARRAYSIZE(szWebsite));
|
||||||
GetUserNameEx(NameSamCompatible, szUsername, &dwUsernameLen);
|
GetUserNameEx(NameSamCompatible, szUsername, &dwUsernameLen);
|
||||||
|
|
||||||
|
// Get Desktop background color
|
||||||
|
//CreateSolidBrush(GetBackgroundColor
|
||||||
|
|
||||||
// Register the Frame Window
|
// Register the Frame Window
|
||||||
wc.lpfnWndProc = WndProc;
|
wc.lpfnWndProc = WndProc;
|
||||||
wc.hInstance = hAppInstance;
|
wc.hInstance = hAppInstance;
|
||||||
@@ -95,12 +97,18 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
|
|||||||
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), L" - ");
|
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), L" - ");
|
||||||
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), szUsername);
|
StringCchCat(szWindowTitle, ARRAYSIZE(szWindowTitle), szUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CreateWindow(wc.lpszClassName, szWindowTitle, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
if (!CreateWindow(wc.lpszClassName, szWindowTitle, WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||||
rcMainWindow.left, rcMainWindow.top, rcMainWindow.right - rcMainWindow.left, rcMainWindow.bottom - rcMainWindow.top,
|
20, 20, 340, 220, 0, 0, hAppInstance, NULL))
|
||||||
0, 0, hAppInstance, NULL))
|
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
|
// Set the window size, but only if it's valid
|
||||||
|
if ((rcMainWindow.left != rcMainWindow.right) && (rcMainWindow.top != rcMainWindow.bottom))
|
||||||
|
SetWindowPos(hWndProgMgr, NULL,
|
||||||
|
rcMainWindow.left, rcMainWindow.top,
|
||||||
|
rcMainWindow.right - rcMainWindow.left,
|
||||||
|
rcMainWindow.bottom - rcMainWindow.top, SWP_NOZORDER);
|
||||||
|
|
||||||
// Load the menus...
|
// Load the menus...
|
||||||
hMenu = GetMenu(hWndProgMgr);
|
hMenu = GetMenu(hWndProgMgr);
|
||||||
hSystemMenu = GetSystemMenu(hWndProgMgr, FALSE);
|
hSystemMenu = GetSystemMenu(hWndProgMgr, FALSE);
|
||||||
@@ -130,14 +138,9 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi
|
|||||||
|
|
||||||
LoadString(hAppInstance, IDS_TASKMGR, szBuffer, ARRAYSIZE(szBuffer));
|
LoadString(hAppInstance, IDS_TASKMGR, szBuffer, ARRAYSIZE(szBuffer));
|
||||||
InsertMenu(hSystemMenu, 6, MF_BYPOSITION | MF_STRING, IDM_TASKMGR, szBuffer);
|
InsertMenu(hSystemMenu, 6, MF_BYPOSITION | MF_STRING, IDM_TASKMGR, szBuffer);
|
||||||
|
|
||||||
// Refresh the wallpaper...
|
// Create the desktop window...
|
||||||
SystemParametersInfo(SPI_GETDESKWALLPAPER, MAX_PATH, szBuffer, 0);
|
CreateDesktopWindow();
|
||||||
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, szBuffer, SPIF_SENDCHANGE);
|
|
||||||
|
|
||||||
// Reset the work area (removes dead-space after switching from another shell)
|
|
||||||
// May have unintended consequences.
|
|
||||||
SystemParametersInfo(SPI_SETWORKAREA, 0, (PVOID)&rWorkArea, SPIF_SENDCHANGE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (GetMessage(&msg, NULL, 0, 0) > 0)
|
while (GetMessage(&msg, NULL, 0, 0) > 0)
|
||||||
|
|||||||
@@ -40,9 +40,13 @@ extern WCHAR szProgMgr[];
|
|||||||
extern WCHAR szWebsite[64];
|
extern WCHAR szWebsite[64];
|
||||||
|
|
||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
// SHELLINT.C
|
// DESKTOP.C
|
||||||
|
BOOL CreateDesktopWindow();
|
||||||
|
LRESULT CALLBACK DeskWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
||||||
|
// SYSINT.C
|
||||||
BOOL RunFileDlg(HWND hWndOwner, HICON hIcon, LPWSTR lpszDir, LPWSTR lpszTitle, LPWSTR lpszDesc, DWORD dwFlags);
|
BOOL RunFileDlg(HWND hWndOwner, HICON hIcon, LPWSTR lpszDir, LPWSTR lpszTitle, LPWSTR lpszDesc, DWORD dwFlags);
|
||||||
BOOL ExitWindowsDialog(HWND hWndOwner);
|
BOOL ExitWindowsDialog(HWND hWndOwner);
|
||||||
|
BOOL SetShellWindow(HWND hWndShell);
|
||||||
// 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);
|
LRESULT CALLBACK CmdProc(HWND hWnd, WPARAM wParam, LPARAM lParam);
|
||||||
|
|||||||
@@ -167,7 +167,7 @@
|
|||||||
<ClCompile Include="desktop.c" />
|
<ClCompile Include="desktop.c" />
|
||||||
<ClCompile Include="progmgr.c" />
|
<ClCompile Include="progmgr.c" />
|
||||||
<ClCompile Include="registry.c" />
|
<ClCompile Include="registry.c" />
|
||||||
<ClCompile Include="shellint.c" />
|
<ClCompile Include="sysint.c" />
|
||||||
<ClCompile Include="wndproc.c" />
|
<ClCompile Include="wndproc.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
<ClCompile Include="desktop.c">
|
<ClCompile Include="desktop.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="shellint.c">
|
<ClCompile Include="sysint.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="wndproc.c">
|
<ClCompile Include="wndproc.c">
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ BOOL IsProgMgrDefaultShell()
|
|||||||
HKEY hKeyWinlogon;
|
HKEY hKeyWinlogon;
|
||||||
WCHAR szShell[HKEYMAXLEN] = L"";
|
WCHAR szShell[HKEYMAXLEN] = L"";
|
||||||
DWORD dwType;
|
DWORD dwType;
|
||||||
DWORD dwBufferSize = 0;
|
DWORD dwBufferSize = sizeof(szShell);
|
||||||
|
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WINLOGON_KEY,
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WINLOGON_KEY,
|
||||||
0, KEY_READ, &hKeyWinlogon) == ERROR_SUCCESS)
|
0, KEY_READ, &hKeyWinlogon) == ERROR_SUCCESS)
|
||||||
@@ -134,7 +134,7 @@ BOOL SaveConfig()
|
|||||||
(bSaveSettings && PMS_SAVESETTINGS) * PMS_SAVESETTINGS;
|
(bSaveSettings && PMS_SAVESETTINGS) * PMS_SAVESETTINGS;
|
||||||
|
|
||||||
if (!RegSetValueEx(hKeySettings, pszSettingsMask, 0, REG_DWORD,
|
if (!RegSetValueEx(hKeySettings, pszSettingsMask, 0, REG_DWORD,
|
||||||
&dwSettingsMask, sizeof(dwSettingsMask)) == ERROR_SUCCESS)
|
(const BYTE*)&dwSettingsMask, sizeof(dwSettingsMask)) == ERROR_SUCCESS)
|
||||||
bConfigStatus = FALSE;
|
bConfigStatus = FALSE;
|
||||||
|
|
||||||
// Get and save window position
|
// Get and save window position
|
||||||
@@ -143,7 +143,7 @@ BOOL SaveConfig()
|
|||||||
CopyRect(&rcWindow, &wpProgMgr.rcNormalPosition);
|
CopyRect(&rcWindow, &wpProgMgr.rcNormalPosition);
|
||||||
|
|
||||||
if (!RegSetValueEx(hKeySettings, pszSettingsWindow, 0, REG_BINARY,
|
if (!RegSetValueEx(hKeySettings, pszSettingsWindow, 0, REG_BINARY,
|
||||||
&rcWindow, sizeof(rcWindow)) == ERROR_SUCCESS)
|
(const BYTE*)&rcWindow, sizeof(rcWindow)) == ERROR_SUCCESS)
|
||||||
bConfigStatus = FALSE;
|
bConfigStatus = FALSE;
|
||||||
|
|
||||||
return bConfigStatus;
|
return bConfigStatus;
|
||||||
@@ -165,7 +165,7 @@ BOOL LoadConfig()
|
|||||||
|
|
||||||
// Load settings bitmask
|
// Load settings bitmask
|
||||||
if (!RegQueryValueEx(hKeySettings, pszSettingsMask, 0, &dwType,
|
if (!RegQueryValueEx(hKeySettings, pszSettingsMask, 0, &dwType,
|
||||||
&dwSettingsMask, &dwBufferSize) == ERROR_SUCCESS)
|
(LPBYTE)&dwSettingsMask, &dwBufferSize) == ERROR_SUCCESS)
|
||||||
bConfigStatus = FALSE;
|
bConfigStatus = FALSE;
|
||||||
|
|
||||||
// Apply bitmask to booleans
|
// Apply bitmask to booleans
|
||||||
@@ -177,7 +177,7 @@ BOOL LoadConfig()
|
|||||||
|
|
||||||
// Load window position... and apply it!
|
// Load window position... and apply it!
|
||||||
if (!RegQueryValueEx(hKeySettings, pszSettingsWindow, 0, &dwType,
|
if (!RegQueryValueEx(hKeySettings, pszSettingsWindow, 0, &dwType,
|
||||||
&rcMainWindow, &dwRectBufferSize) == ERROR_SUCCESS)
|
(LPBYTE)&rcMainWindow, &dwRectBufferSize) == ERROR_SUCCESS)
|
||||||
bConfigStatus = FALSE;
|
bConfigStatus = FALSE;
|
||||||
|
|
||||||
return bConfigStatus;
|
return bConfigStatus;
|
||||||
|
|||||||
Binary file not shown.
@@ -1,8 +1,8 @@
|
|||||||
/* * * * * * * *\
|
/* * * * * * * *\
|
||||||
SHELLINT.C -
|
SYSINT.C -
|
||||||
Copyright (c) 2023 freedom7341, Freedom Desktop
|
Copyright (c) 2023 freedom7341, Freedom Desktop
|
||||||
DESCRIPTION -
|
DESCRIPTION -
|
||||||
Program Manager's shell interface functions.
|
Program Manager's system interface functions.
|
||||||
LICENSE INFORMATION -
|
LICENSE INFORMATION -
|
||||||
MIT License, see LICENSE.txt in the root folder
|
MIT License, see LICENSE.txt in the root folder
|
||||||
\* * * * * * * */
|
\* * * * * * * */
|
||||||
@@ -33,8 +33,10 @@ BOOL RunFileDlg(HWND hWndOwner,
|
|||||||
{
|
{
|
||||||
FARPROC fLib = GetProcAddress(hLib, MAKEINTRESOURCEA(61));
|
FARPROC fLib = GetProcAddress(hLib, MAKEINTRESOURCEA(61));
|
||||||
if (fLib(hWndOwner, hIcon, lpszDir, lpszTitle, lpszDesc, dwFlags))
|
if (fLib(hWndOwner, hIcon, lpszDir, lpszTitle, lpszDesc, dwFlags))
|
||||||
|
{
|
||||||
FreeLibrary(hLib);
|
FreeLibrary(hLib);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -54,8 +56,32 @@ BOOL ExitWindowsDialog(HWND hWndOwner)
|
|||||||
{
|
{
|
||||||
FARPROC fLib = GetProcAddress(hLib, (LPCSTR)60);
|
FARPROC fLib = GetProcAddress(hLib, (LPCSTR)60);
|
||||||
if (fLib(hWndOwner))
|
if (fLib(hWndOwner))
|
||||||
|
{
|
||||||
FreeLibrary(hLib);
|
FreeLibrary(hLib);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* * * *\
|
||||||
|
SetShellWindow -
|
||||||
|
Sets a window as the shell window.
|
||||||
|
RETURNS -
|
||||||
|
True if successful, false if unsuccessful.
|
||||||
|
\* * * */
|
||||||
|
BOOL SetShellWindow(HWND hWndShell)
|
||||||
|
{
|
||||||
|
HMODULE hLib = GetModuleHandle(L"user32.dll");
|
||||||
|
|
||||||
|
if (hLib)
|
||||||
|
{
|
||||||
|
FARPROC fLib = GetProcAddress(hLib, "SetShellWindow");
|
||||||
|
if (fLib(hWndShell))
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -83,6 +83,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
goto WndProcDefault;
|
goto WndProcDefault;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
if (GetShellWindow())
|
||||||
|
SetShellWindow(0);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user