I need to develop communication with the display of a keyboard (44 keytec brand keys) using windows.
In C, for linux, using #include, the inb () and outb () functions work correctly.
For windows, the closest I got was to find inpout32.dll, but without success so far.
Example code tested:
#include <stdio.h>
#include <conio.h>
#include <windows.h>
/* Definitions in the build of inpout32.dll are: */
/* short _stdcall Inp32(short PortAddress); */
/* void _stdcall Out32(short PortAddress, short data); */
/* prototype (function typedef) for DLL function Inp32: */
typedef short _stdcall (*inpfuncPtr)(short portaddr);
typedef void _stdcall (*oupfuncPtr)(short portaddr, short datum);
void TxKbd(char dado, inpfuncPtr inp32, oupfuncPtr oup32);
void vDispStr(char *s, inpfuncPtr inp32, oupfuncPtr oup32);
int main(void)
{
HINSTANCE hLib;
inpfuncPtr inp32;
oupfuncPtr oup32;
char dado[81] = "";
short x;
int i;
/* Load the library */
hLib = LoadLibrary("inpout32.dll");
if (hLib == NULL) {
printf("LoadLibrary Failed.\n");
return -1;
}
/* get the address of the function */
inp32 = (inpfuncPtr) GetProcAddress(hLib, "Inp32");
printf("1");
if (inp32 == NULL) {
printf("GetProcAddress for Inp32 Failed.\n");
return -1;
}
printf("2");
oup32 = (oupfuncPtr) GetProcAddress(hLib, "Out32");
if (oup32 == NULL) {
printf("GetProcAddress for Oup32 Failed.\n");
return -1;
}
printf("3\n");
//while (0){ SEMPRE RETORNA 0x64
// printf( "digitando %i", (inp32)(0x64) );
//
// sleep(2);
// }
oup32(0x60, 40);
}
Has anyone ever had to do something like this?