int main(int argc, char *argv[])
{   
  initializeSegments();
  int i;
  int j;
  for (j=0; j<4; j++)
    {
      for (i=0;i<10;i++)
	{
	  displayNumber(i);
	  printf("displayed %d\n", i);
	  fflush(stdout);
	  Sleep(500);
	}
    }
    RemoveWinIoDriver();
    return 0;
}
bool _stdcall InstallWinIoDriver(char* pszWinIoDriverPath, bool IsDemandLoaded)
{
  SC_HANDLE hSCManager;
  SC_HANDLE hService;

  // Remove any previous instance of the driver

  RemoveWinIoDriver();

  hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);

  if (hSCManager)
  {
    // Install the driver
    
    hService = CreateServiceA(hSCManager,
                             "WinRing0_1_2_0",
                             "WinRing0_1_2_0",
                             SERVICE_ALL_ACCESS,
                             SERVICE_KERNEL_DRIVER,
                             (IsDemandLoaded == true) ? SERVICE_DEMAND_START : SERVICE_SYSTEM_START,
                             SERVICE_ERROR_NORMAL,
                             pszWinIoDriverPath,
                             NULL,
                             NULL,
                             NULL,
                             NULL,
                             NULL);

    CloseServiceHandle(hSCManager);

    if (hService == NULL)
      return false;
  }
  else
    return false;

  CloseServiceHandle(hService);
  
  return true;
}
Exemple #3
0
void _stdcall ShutdownWinIo()
{
  DWORD dwBytesReturned;

  if (IsNT)
  {
    if (hDriver != INVALID_HANDLE_VALUE)
    {
      // Disable I/O port access

      DeviceIoControl(hDriver, IOCTL_WINIO_DISABLEDIRECTIO, NULL,
                      0, NULL, 0, &dwBytesReturned, NULL);

      CloseHandle(hDriver);

    }

    RemoveWinIoDriver();
  }
  else
    CloseHandle(hDriver);

  IsWinIoInitialized = false;
}