usbcontrol.h

来自「一个内核开发的usb加密解密驱动」· C头文件 代码 · 共 125 行

H
125
字号


#include "stdafx.h"
#include "USBControlBase.h"
#include "LogTrace.h"
#include <Ntsecapi.h>

#pragma warning(push)
  #pragma warning(disable: 4702)
  #include <list>
#pragma warning(pop)

#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
#define MAX_DOMAINS 10
#define NT_AUTHORITY_DOMAIN _TEXT("NT AUTHORITY")
#define NTLM_DOMAIN			_TEXT("NTLM")

//static bool DWORD CurDrives;
//static bool DWORD USBDrives;
//static bool DWORD PrevDrives;

using namespace std;

//static bool DWORD CurDrives;
//static bool DWORD USBDrives;
//static bool DWORD PrevDrives;

class CUSBControl: public CUSBControlSrvBase
{
public:

	//Default Contructor
	CUSBControl();

	//Default Destructor
	~CUSBControl();
private:
	//Logging class variable
	CLogTrace logger;

	//DeviceChange Event
	CUSBEvent * m_hDeviceChange;

	//Device Change Event Name
	LPWSTR m_szDeviceChangeEventName;

	//Handle to authentication thread
	HANDLE m_hAuthenticationThread;

	//USBDrives
	DWORD USBDrives;

	//Domain Names
	/*static TCHAR cbDomainNames[MAX_DOMAINS][MAX_PATH];*/

	//Number of Domain Names
	/*static DWORD szDomainNames;*/

public:
	// Initializing function
	/*virtual BOOL Init();*/

	//Main Processing Function
	virtual BOOL Run(DWORD USBDrives);

	//Set Device Change Event
	BOOL SetDevChangeEvent();

	//Initialize Authentication Thread
	BOOL InitAuthenticationThread();

	//Get session data
	static VOID GetSessionData(PLUID session, DWORD USBDrives,CUSBControl *csubControl);

	//Active Directory Authentication Thread
	static unsigned __stdcall ADAuthenticationThread( void * lpParameter );

	//Build the Domain Name Struct
	/*static*/ BOOL BuildDomainNames();

	//Domain Names
	/*static*/ TCHAR cbDomainNames[MAX_DOMAINS][MAX_PATH];

	//Number of Domain Names
	/*static*/ DWORD szDomainNames;

	/*Get USB Drives*/
	DWORD getUSBDrives();

	/*Set USB Drives*/
	VOID setUSBDrives(DWORD USBDrives);





	//Deb-Drv
	static bool InstallDriver( SC_HANDLE SchSCManager, LPCTSTR DriverName, LPCTSTR ServiceExe );
	static bool StartDriver( IN SC_HANDLE SchSCManager, IN LPCTSTR DriverName );
	static bool OpenDevice( IN LPCTSTR DriverName, HANDLE * lphDevice );
	static bool StopDriver( IN SC_HANDLE SchSCManager, IN LPCTSTR DriverName );
	static bool RemoveDriver( IN SC_HANDLE SchSCManager, IN LPCTSTR DriverName );
	static bool UnloadDeviceDriver( const TCHAR * Name );
	static bool LoadDeviceDriver( const TCHAR * Name, const TCHAR * DriverPath, HANDLE * lphDevice );
	static DWORD Hook_Drives(DWORD MaxDriveSet, DWORD CurDriveSet );
	static void DriverStop(void);
	static void DriverStart(void);
	static void DriverEnable(bool);












};

//static bool DWORD CurDrives;
//static bool DWORD USBDrives;
//static bool DWORD PrevDrives;

⌨️ 快捷键说明

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