Skip to content

Commit

Permalink
we're ever closer
Browse files Browse the repository at this point in the history
  • Loading branch information
freedom7341 committed Jul 24, 2024
1 parent 16cd962 commit d43b070
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CscdSvc/hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ __declspec(dllexport) BOOL CALLBACK InitUserHook(UAPIHK State, PUSERAPIHOOK puah
return TRUE;
}

MessageBox(NULL, L"test", L"InitUserHook called", MB_OK);

OutputDebugString(L"InitUserHook initializing\n");

/* Store the original functions from user32 */
Expand Down
16 changes: 12 additions & 4 deletions CscdSvc/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,6 @@ 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 @@ -271,11 +268,15 @@ VOID SvcInit(DWORD dwArgc, LPTSTR* lpszArgv)
// TO_DO: Perform work until service stops.

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

InstallUserHook();

while (TRUE)
{
Expand All @@ -285,6 +286,13 @@ VOID SvcInit(DWORD dwArgc, LPTSTR* lpszArgv)
ReportSvcStatus(SERVICE_STOPPED, NO_ERROR, 0);
return;
}

// Kill the user hook
if (!RemoveUserHook())
{
ReportSvcStatus(SERVICE_STOPPED, GetLastError(), 0);
return;
}
}

//
Expand Down

0 comments on commit d43b070

Please sign in to comment.