Skip to content

Commit

Permalink
sweet baby cascades
Browse files Browse the repository at this point in the history
  • Loading branch information
freedom7341 committed Jul 24, 2024
1 parent e8937df commit 16cd962
Show file tree
Hide file tree
Showing 32 changed files with 84 additions and 391 deletions.
6 changes: 0 additions & 6 deletions Cascades.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.35026.282
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cascades", "src\cascades.vcxproj", "{F3917BF2-0C25-4C6D-B2EB-EE462DC22F14}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CscdSvc", "CscdSvc\CscdSvc.vcxproj", "{286EEF2A-FCB8-4FA7-A1BD-3F59CCFF4F1B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CscdCfg", "CscdCfg\CscdCfg.vcxproj", "{0071D3E6-CB60-43FD-A17F-9D7DF735A5B4}"
Expand All @@ -17,10 +15,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F3917BF2-0C25-4C6D-B2EB-EE462DC22F14}.Debug|x64.ActiveCfg = Debug|x64
{F3917BF2-0C25-4C6D-B2EB-EE462DC22F14}.Debug|x86.ActiveCfg = Debug|Win32
{F3917BF2-0C25-4C6D-B2EB-EE462DC22F14}.Release|x64.ActiveCfg = Release|x64
{F3917BF2-0C25-4C6D-B2EB-EE462DC22F14}.Release|x86.ActiveCfg = Release|Win32
{286EEF2A-FCB8-4FA7-A1BD-3F59CCFF4F1B}.Debug|x64.ActiveCfg = Debug|x64
{286EEF2A-FCB8-4FA7-A1BD-3F59CCFF4F1B}.Debug|x64.Build.0 = Debug|x64
{286EEF2A-FCB8-4FA7-A1BD-3F59CCFF4F1B}.Debug|x86.ActiveCfg = Debug|Win32
Expand Down
14 changes: 14 additions & 0 deletions CscdSvc/CscdSvc.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,24 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="draw.c" />
<ClCompile Include="hook.c" />
<ClCompile Include="svc.c" />
<ClCompile Include="thmfunc.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="draw.h" />
<ClInclude Include="hook.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="svc.h" />
<ClInclude Include="thmfunc.h" />
<ClInclude Include="usrapihk.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc" />
</ItemGroup>
<ItemGroup>
<None Include="export.def" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
34 changes: 34 additions & 0 deletions CscdSvc/CscdSvc.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,44 @@
<ClCompile Include="svc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="thmfunc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="draw.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="hook.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="svc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="thmfunc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="usrapihk.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="draw.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="hook.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resource.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="export.def">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>
3 changes: 1 addition & 2 deletions src/draw.c → CscdSvc/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
\* * * * * * * */

/* Headers */
#include "main.h"
#include "hook.h"
#include "draw.h"
#include "oebitmap.h"
#include <strsafe.h>

/* Global Variables */
Expand Down
11 changes: 11 additions & 0 deletions src/draw.h → CscdSvc/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
/* Includes */
#include <wtypes.h>

/* Definitions */
// NT Style Draw Frame Control Types
#define NSDFC_TYPE_BUTTON 0x00 // Standard window button
#define NSDFC_TYPE_CAPTION 0x01 // Caption bar button
// NT Style Draw Frame Control Styles
#define NSDFC_STYLE_NONE 0x00 // Standard
#define NSDFC_STYLE_PRESSED 0x01 // Pressed
#define NSDFC_STYLE_ACTIVE 0x02 // Active control
#define NSDFC_STYLE_MINIMIZE 0x10 // Minimized caption arrow
#define NSDFC_STYLE_MAXIMIZE 0x20 // Maximized caption arrow

/* Function Prototypes */
LRESULT NTStyleWindowProc(_In_ HWND hWnd, _In_ UINT Msg, _In_ WPARAM wParam, _In_ LPARAM lParam, _In_ WNDPROC DefWndProc);
VOID NTStyleDrawWindow(_In_ HWND hWnd, _In_ WPARAM wParam, _In_ LPARAM lParam);
Expand Down
2 changes: 1 addition & 1 deletion src/export.def → CscdSvc/export.def
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LIBRARY CASCADES
LIBRARY CSCDSVC
EXPORTS
InstallUserHook @1
InitUserHook @2
Expand Down
43 changes: 1 addition & 42 deletions src/main.c → CscdSvc/hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <strsafe.h>
#include "usrapihk.h"
#include "main.h"
#include "hook.h"
#include "thmfunc.h"

/* Defines */
Expand All @@ -32,46 +31,6 @@ BOOL g_bThemeHooksActive = FALSE;

/* Functions */

/* * * *\
DllMain -
ApiHook's entry point
\* * * */
BOOL APIENTRY DllMain(
HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
// Store our HMODULE as a global var
g_hModule = hModule;

// Call InstallUserHook
if (InstallUserHook())
break;

// Return FALSE if it fails
return FALSE;

case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;

case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;

case DLL_PROCESS_DETACH:
// Call UnregisterUserApiHook
UnregisterUserApiHookDelay();

break;
}
return TRUE;
}

/* * * *\
InstallUserHook -
Load the User32 API hook.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions src/resource.h → CscdSvc/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#pragma once
#endif

/* Icon Library */
#define IDI_MAIN 1

/* Bitmaps */
#define IDB_MAX 1
#define IDB_MAX_S 2
Expand Down
11 changes: 7 additions & 4 deletions src/resource.rc → CscdSvc/resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "resource.h"
#undef APSTUDIO_HIDDEN_SYMBOLS

/* Icon Library */
IDI_MAIN ICON icons\ntstyle.ico

/* Bitmaps */
IDB_MAX BITMAP images\max.bmp
IDB_MAX_S BITMAP images\maxd.bmp
Expand All @@ -24,10 +27,10 @@ IDB_MENU BITMAP images\menu.bmp

/* Version Information */
#define APSTUDIO_HIDDEN_SYMBOLS
#define VER_FILEDESCRIPTION_STR "Cascades' Hook and Drawing DLL"
#define VER_INTERNALNAME_STR "cscdhook\0"
#define VER_ORIGINALFILENAME_STR "CSCDHOOK.DLL"
#define VER_PRODUCTNAME_STR "Cascades"
#define VER_FILEDESCRIPTION_STR "Cascades' Service Executable"
#define VER_INTERNALNAME_STR "CscdSvc\0"
#define VER_ORIGINALFILENAME_STR "CSCDSVC.EXE"
#define VER_PRODUCTNAME_STR "Cascades Service Executable for Windows NT"
#include "..\common\version.inc"
#undef APSTUDIO_HIDDEN_SYMBOLS

Expand Down
11 changes: 11 additions & 0 deletions CscdSvc/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <tchar.h>
#include <strsafe.h>
#include "svc.h"
#include "hook.h"
#include "..\CscdCom\error.h"

/* Defines */
Expand Down Expand Up @@ -225,6 +226,9 @@ VOID WINAPI SvcMain(DWORD dwArgc, LPTSTR* lpszArgv)

// Perform service-specific initialization and work.
SvcInit(dwArgc, lpszArgv);

// On shutdown, terminate the Api Hook
RemoveUserHook();
}

//
Expand Down Expand Up @@ -266,6 +270,13 @@ VOID SvcInit(DWORD dwArgc, LPTSTR* lpszArgv)

// TO_DO: Perform work until service stops.

// Install our user hook, if FALSE then fail.
if (InstallUserHook())
{
ReportSvcStatus(SERVICE_STOPPED, GetLastError(), 0);
return;
}

while (TRUE)
{
// Check whether to stop the service.
Expand Down
3 changes: 1 addition & 2 deletions src/thmfunc.c → CscdSvc/thmfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#define VC_EXTRALEAN
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include "usrapihk.h"
#include "main.h"
#include "hook.h"
#include "thmfunc.h"
#include "draw.h"

Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 16cd962

Please sign in to comment.