Hi there .
I've got a problem getting a program to work. I'm quite a newbie so please explain things a bit ok .
I've got this program code:
and winio.h looks like this:
bResult = InitializeWinIo();
GetPortVal(0x378, &dwPortVal, 4);
cout << dwPortVal << endl;
I'm trying to get it to work, but it won't . I've compiled it with Borland free commandline tools by first compiling it to a .obj file and then linking it with a .lib file I created from a .dll file, using implib. The linker does produce an .exe file, but when running it, it says "program.exe is not a valid Win32 file" (or something similar; I'm actually using a Dutch version of Windows 2000).
#define WINIO_API _declspec(dllexport)
#define WINIO_API _declspec(dllimport)
WINIO_API bool _stdcall InitializeWinIo();
WINIO_API void _stdcall ShutdownWinIo();
WINIO_API PBYTE _stdcall MapPhysToLin(PBYTE pbPhysAddr, DWORD dwPhysSize, HANDLE *pPhysicalMemoryHandle);
WINIO_API bool _stdcall UnmapPhysicalMemory(HANDLE PhysicalMemoryHandle, PBYTE pbLinAddr);
WINIO_API bool _stdcall GetPhysLong(PBYTE pbPhysAddr, PDWORD pdwPhysVal);
WINIO_API bool _stdcall SetPhysLong(PBYTE pbPhysAddr, DWORD dwPhysVal);
WINIO_API bool _stdcall GetPortVal(WORD wPortAddr, PDWORD pdwPortVal, BYTE bSize);
WINIO_API bool _stdcall SetPortVal(WORD wPortAddr, DWORD dwPortVal, BYTE bSize);
WINIO_API bool _stdcall InstallWinIoDriver(PSTR pszWinIoDriverPath, bool IsDemandLoaded = false);
WINIO_API bool _stdcall RemoveWinIoDriver();
extern bool IsNT;
extern HANDLE hDriver;
extern bool IsWinIoInitialized;
bool _stdcall StartWinIoDriver();
bool _stdcall StopWinIoDriver();
Can anyone please tell me what I'm doing wrong?
BTW: the program is a program that reads the parallell port of the PC. Since this is not directly possible in Windows 2000, I use WinIo (from www.internals.com) which bypasses the restrictions Windows has. Off course this is just an example program to see if WinIo works, but so far it hasn't.
I have attached parpoort.zip which contains the files I use.