⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hookintapp.c

📁 Undocumented Windows NT 经典书籍的源码
💻 C
字号:
#include <windows.h>
#include <stdio.h>

#include <winioctl.h>
#include "hookint.h"

#define MAX_SERVICES	0x1000


void PrintServiceUsage(HANDLE DeviceHandle)
{
	DWORD BytesReturned;
	BOOL rc;
	DWORD NumberOfServices;
	DWORD i;
	DWORD ServiceCounters[MAX_SERVICES];


	rc=DeviceIoControl(DeviceHandle,
					(DWORD)IOCTL_HOOKINT_SYSTEM_SERVICE_USAGE,
					NULL,
					0,
					ServiceCounters,
					sizeof(ServiceCounters),
					&BytesReturned,
					NULL);
	if (!rc) {
		printf("DeviceIoControl failed, rc=%d\n", GetLastError());
		return;
	}
	NumberOfServices=ServiceCounters[0];

	printf("Service Id    Number of times service called\n");
	for (i=0; i<NumberOfServices; i++) {
		printf("%03x           %08x\n", i, ServiceCounters[i+1]);
	}
}



main()
{
    char     completeDeviceName[64] = "";
    HANDLE   hDevice;

    strcpy (completeDeviceName,
            "\\\\.\\hookint"
            );


    hDevice = CreateFile (completeDeviceName,
                          GENERIC_READ | GENERIC_WRITE,
                          0,
                          NULL,
                          OPEN_EXISTING,
                          FILE_ATTRIBUTE_NORMAL,
                          NULL
                          );

    if (hDevice == ((HANDLE)-1))
    {
		printf("Unable to open device driver, make sure that hookint.sys is installed\n");
		return 0;
    }	
    else
    {
		PrintServiceUsage(hDevice);
        CloseHandle (hDevice);
    }
    return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -