C++ (Qt)
#include <windows.h>
#include <stdio.h>
#include "winio.h"
#include <iostream>
void main()
{
DWORD dwPortVal;
DWORD dwMemVal;
bool bResult;
HANDLE hPhysicalMemory;
PBYTE pbLinAddr;
WORD port;
int i;
// Call InitializeWinIo to initialize the WinIo library.
bResult = InitializeWinIo();
if (bResult)
{
GetPortVal(0x40, &dwPortVal, 1);
if ( !(dwPortVal & 0x01) )
{
std::cout << "ok, " << dwPortVal;
SetPortVal(0x2E, dwPortVal | 0x01, 1);
}
if ( dwPortVal & 0x02 )
{
std::cout << "locked ";
}
if ( dwPortVal & 0x04 )
{
std::cout << "ready ";
}
ShutdownWinIo();
}
else
{
printf("Error during initialization of WinIo.\n");
//exit(1);
}
system("pause");
}
Вывод:
locked ready Press any key to continue . . .
Попробовал ещё пару раз запустить тот же код, теперь ответ получаю другой:
ok, 4294967280Press any key to continue . . .
ok, 78locked ready Press any key to continue . . .