Skip to content

Commit

Permalink
rollin broadway
Browse files Browse the repository at this point in the history
  • Loading branch information
freedom7341 committed Jul 28, 2024
1 parent 06d804e commit 90ac51d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
4 changes: 2 additions & 2 deletions CscdSvc/export.def
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LIBRARY CSCDSVC
EXPORTS
InstallUserHook @1
InitUserHook @2
InitUserHook @1
InstallUserHook @2
RemoveUserHook @3
18 changes: 3 additions & 15 deletions CscdSvc/hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ BOOL g_bThemeHooksActive = FALSE;
__declspec(dllexport) BOOL CALLBACK InstallUserHook()
{
WCHAR szFullPath[MAX_PATH];
WCHAR szQuotedPath[MAX_PATH + 2]; // + 2 for the quotation marks
USERAPIHOOKINFO uah;

OutputDebugString(TEXT("InstallUserHook called\n"));
Expand All @@ -55,20 +54,13 @@ __declspec(dllexport) BOOL CALLBACK InstallUserHook()
// Get our current directory and filename
GetModuleFileName(g_hModule, szFullPath, ARRAYSIZE(szFullPath));

// In case the path contains a space, it must be quoted so that
// it is correctly interpreted. For example,
// "d:\my share\myservice.exe" should be specified as
// ""d:\my share\myservice.exe"".
StringCbPrintf(szQuotedPath, MAX_PATH, TEXT("\"%s\""), szFullPath);

SvcMessageEvent(szQuotedPath);

// Fill out the ApiHookInfo structure
uah.m_size = sizeof(uah);
uah.m_funname1 = L"InitUserHook";
uah.m_dllname1 = szQuotedPath;
uah.m_funname2 = NULL;
uah.m_dllname2 = NULL;
uah.m_dllname1 = szFullPath;
uah.m_funname2 = L"InitUserHook";
uah.m_dllname2 = szFullPath;

// ApiHook is not support on Windows
// 2000 or below!
Expand All @@ -83,8 +75,6 @@ __declspec(dllexport) BOOL CALLBACK InitUserHook(UAPIHK State, PUSERAPIHOOK puah
{
OutputDebugString(TEXT("InitUserHook called\n"));

SvcMessageEvent(TEXT("InitUserHook called"));

// Don't initialize if the state isn't appropriate.
if (!puah || State != uahLoadInit)
{
Expand All @@ -94,8 +84,6 @@ __declspec(dllexport) BOOL CALLBACK InitUserHook(UAPIHK State, PUSERAPIHOOK puah

OutputDebugString(TEXT("InitUserHook initializing\n"));

SvcMessageEvent(TEXT("InitUserHook initializing"));

/* Store the original functions from user32 */
g_user32ApiHook = *puah;

Expand Down
2 changes: 0 additions & 2 deletions CscdSvc/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,6 @@ VOID SvcInit(DWORD dwArgc, LPTSTR* lpszArgv)
return;
}

SvcMessageEvent(TEXT("InstallUserHook"));

while (TRUE)
{
// Check whether to stop the service.
Expand Down

0 comments on commit 90ac51d

Please sign in to comment.