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

📄 vniccomm.cpp

📁 驱动设计文档
💻 CPP
字号:

#include "VNicComm.h"

VNicComm::VNicComm()
{

}

VNicComm::~VNicComm()
{

}

bool VNicComm::VNOpen()
{
    hFile=CreateFile(TEXT("\\\\.\\MyNdisDevice"),
		GENERIC_WRITE | GENERIC_READ,
		0,
		NULL,
		OPEN_EXISTING,
		0,//FILE_FLAG_OVERLAPPED,
		0
		);
    if(hFile == INVALID_HANDLE_VALUE) {
        return FALSE;
    }
	
	return true;
}

void VNicComm::VNClose()
{
	CloseHandle(hFile);
}

int VNicComm::VNRead(IN OUT unsigned char *ReadBuf,IN int ReadLength)
{
	ULONG bytesReturned;
	
	if (! ReadFile(hFile,ReadBuf,ReadLength,&bytesReturned,NULL))
	{
		return -1;
	} 

	return bytesReturned;
}

int VNicComm::VNWrite( IN unsigned char *WriteBuf,IN int WriteLength)
{
	ULONG bytesReturned;

    if (! WriteFile(hFile,WriteBuf,WriteLength,&bytesReturned,NULL))
	{
		return -1;
	}

	return bytesReturned;
}

⌨️ 快捷键说明

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