1,221
社区成员
发帖
与我相关
我的任务
分享
// ---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "winio.h"
// ---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
#pragma comment(lib, "WinIo32.lib")
TForm1 *Form1;
typedef bool(_stdcall*bRet1)();
typedef bool(_stdcall*bRet2)(WORD wPortAddr, DWORD dwPortVal, BYTE bSize);
typedef void(_stdcall*bVoid)();
// ---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) {
}
// ---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender) {
HINSTANCE h1 = LoadLibrary("WinIo32.dll");
if (h1)
{
// bool _stdcall InitializeWinIo();
// 2 地址 代理函数=(地址)::GetProcAddress(h,"原函数")
bRet1 iz = (bRet1)GetProcAddress(h1, "InitializeWinIo");
if (!iz)
{
// printf("fale in InitializeWinIo GetProcAddress");
ShowMessage("fale in InitializeWinIo GetProcAddress");
}
else
{
ShowMessage("111");
bool a = iz();
if (a)
{
ShowMessage("true");
}
else
{
ShowMessage("false");
}
}
}
else
{
ShowMessage("加载dll失败");
exit(0);
}
}
#include "WinIo.h"
#pragma comment( lib, "WinIo.lib" )
InstallWinIoDriver( "./winio.sys", false );
InitializeWinIo();
//读写应用……
ShutdownWinIo();
RemoveWinIoDriver();
这些函数在WinIo.h里有声明的……可以去搜搜winio编程用法,很多资料的