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

📄 controller.c

📁 名为 GHOST的Win32下的Rootkit源码, 是学习ROOTKIT编写入门的优秀学习材料.
💻 C
字号:
// Controller
// Copyright Ric Vieler, 2006
// Send an on/off command to MyDeviceDriver
#include <windows.h>
#include <stdio.h>
#include <io.h>
#include "IoManager.h"

void main(int argc, char *argv[])
{
  HANDLE deviceHandle;
  GHOST_IOCTLDATA control = { 0 };
  ULONG status = 0;

  if(( argc < 2 ) || ((stricmp(argv[1],"on") != 0)) && ((stricmp(argv[1],"off") != 0)))
  {
    printf ("Use Controller on\n");
    printf ("or  Controller off\n");
    return;
  }

  deviceHandle = CreateFile( GHOST_DEVICE_OPEN_NAME,
      GENERIC_READ | GENERIC_WRITE,
      0,
      NULL,
      OPEN_EXISTING,
      FILE_ATTRIBUTE_NORMAL,
      NULL);

  if (deviceHandle == INVALID_HANDLE_VALUE)
  {
    printf ("Could not find MyDeviceDriver.\n");
    return;
  }
  
  if(stricmp(argv[1],"on") == 0)
	  control.command = GHOST_ON;
  else
	  control.command = GHOST_OFF;

  if( DeviceIoControl(	deviceHandle,
      GHOST_ON_OFF_COMMAND,
      &control,
      sizeof(control), // input
      (PVOID)&control,
      sizeof(control), // output
      &status,
      NULL ) )
    printf ("MyDeviceDriver %s.\n", control.command == GHOST_ON ? "on" : "off" );
  else
    printf ("DeviceIoControl failed.\n");
 
  CloseHandle(deviceHandle);
}

⌨️ 快捷键说明

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