[c/c++]Vraag over Winio icm Borland

Pagina: 1
Acties:

  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Ik heb van www.internals.com het WinIo pakket gedownload, en van de site van Borland heb ik de commandlinetools. Vervolgens ben ik e.e.a. gaan installeren en instellen volgens wat er in de helpfile van WinIo staat:

In order to use WinIo in a C++ Builder application, you should take the following steps:

-Place winio.dll, winio.vxd and winio.sys in the directory where your application's executable file resides.
-Create a winio.lib file by running the IMPLIB utility that is bundled with C++ Builder.
-Add the generated winio.lib to your project file.
-Remove the WINIO_API constant from the function declarations in winio.h.
-Add the "#include "winio.h" statement to your source file.
-Call InitializeWinIo.
-Call the library's functions to access I/O ports and physical memory.
-Call ShutdownWinIo.

Ik kan echter niet opmaken waar ik winio.h vandaan moet halen, noch weet ik wat er bedoeld wordt met "add winio.lib to your project file". Die heb ik erbij in de dir gezet.
In de include dir van Borland staat geen winio.h en in de dir van winio zelf staat er alleen 1 bij de examples. Wie kan mij meer vertellen hierover?

[ Voor 4% gewijzigd door Krankenstein op 05-04-2003 01:26 ]


  • Bigs
  • Registratie: Mei 2000
  • Niet online
Die winio.h moet je gewoon van die examples naar je project dir kopieeren en dan die wijziging aanbrengen. Die libfile krijg je door IMPLIB uit te voeren op de DLL, het implib tooltje staat in de bin directory van builder, waarschijnlijk is IMPLIB WINIO.DLL voldoende.

Het staat er allemaal hoor :)

  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Die .lib heb ik al, er staat alleen "add to project file" en dat was wat verwarrend. Maar over die winio.h: wat moet ik daar dan uithalen? Niet alles aar WINIO_API bij staat neem ik aan ;).
Dit is 'em:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef WINIO_H
#define WINIO_H

#ifdef WINIO_DLL
#define WINIO_API _declspec(dllexport)
#else
#define WINIO_API _declspec(dllimport)
#endif

extern "C"
{
  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();

#endif

  • Creepy
  • Registratie: Juni 2001
  • Laatst online: 21:27

Creepy

Tactical Espionage Splatterer

Je weet wel dat de Borland Commandline Tools iets anders is dan Borland C++ Builder? (Borland C++ Builder is een complete RAD ontwikkelomgeving, de Borland Commandline Tools is de compiler die gebruikt word in Borland C++ Builder + nog wat extra benodigheden)

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney


  • farlane
  • Registratie: Maart 2000
  • Laatst online: 16:32
Krankenstein schreef op 05 april 2003 @ 02:08:
Niet alles aar WINIO_API bij staat neem ik aan ;).
Je wilt de funties importeren in je applicatie dus:

code:
1
2
3
4
5
6
7
8
9
10
#ifndef WINIO_H
#define WINIO_H

#undef WINIO_DLL

#ifdef WINIO_DLL
#define WINIO_API _declspec(dllexport)
#else
#define WINIO_API _declspec(dllimport)
#endif

Somniferous whisperings of scarlet fields. Sleep calling me and in my dreams i wander. My reality is abandoned (I traverse afar). Not a care if I never everwake.


  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Het werkt :)

Scheelt een heleboel errors bij het compilen ;)

Dat bovenste #ifndef heb ik trouwens maar #ifdef gemaakt ;)

  • farlane
  • Registratie: Maart 2000
  • Laatst online: 16:32
Krankenstein schreef op 05 April 2003 @ 20:29:
Dat bovenste #ifndef heb ik trouwens maar #ifdef gemaakt ;)
Dan doe je wel iets verkeerd.

Somniferous whisperings of scarlet fields. Sleep calling me and in my dreams i wander. My reality is abandoned (I traverse afar). Not a care if I never everwake.


  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Sorry

* Krankenstein zag het aan voor een typo

  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Het gaat nog niet goed. Ik krijg geen errors meer maar wel het volgende:

Output van bcc32

code:
1
2
3
4
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
test.cpp:
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Fatal: Unable to open file 'BORLANDC.OBJ'


En dat was ook het geval met een "hello world" testprogrammatje :?
Kon er niets over vinden met google :(

edit: dat bestand staat trouwens ook niet op mn HD...

[ Voor 10% gewijzigd door Krankenstein op 05-04-2003 21:40 ]


  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Update: ik ben erachter gekomen dat het wel werkt als je installeert in c:\borland\bcc55 (de default dir) maar niet in bijv. d:\develop\borlandc++. Ik ben er ook nog niet achter waar dat aan ligt. Zijn hier mensen die het wel weten?

  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Helaas wil mijn proggie nog steeds niet werken :'(

Het compilen verloopt niet goed. Bij de "Turbo Incremental Link loopt 'ie namelijk vast met de volgende output.

code:
1
2
3
4
5
6
7
8
9
10
C:\Borland\BCC55\Bin>bcc32 d:\develop\parpoort\parpoort.cpp
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
d:\develop\parpoort\parpoort.cpp:
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external 'InitializeWinIo' referenced from D:\DEVELOP\PARPOORT
\PARPOORT.OBJ
Error: Unresolved external 'GetPortVal' referenced from D:\DEVELOP\PARPOORT\PARP
OORT.OBJ
Error: Unresolved external 'ShutdownWinIo' referenced from D:\DEVELOP\PARPOORT\P
ARPOORT.OBJ


Mijn winio.h ziet er als volgt uit:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef WINIO_H
#define WINIO_H

#undef WINIO_DLL

#ifdef WINIO_DLL
#define WINIO_API _declspec(dllexport)
#else
#define WINIO_API _declspec(dllimport)
#endif

extern "C"
{
  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();

#endif


Mijn programma ziet er zo uit:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <windows.h>
#include <stdio.h>
#include "winio.h"

void main()
{
  DWORD dwPortVal;
  bool bResult;

  bResult = InitializeWinIo();

  if (bResult)
  {
    GetPortVal(0x378, &dwPortVal, 4);
    ShutdownWinIo();
  }
  else
  {
    printf("Error.\n");
    exit(1);
  }
}


Het is een test om te kijken of 'ie de waarde van de parallelle poort kan uitlezen en de code is min of meer gekopieerd uit de example code die bij winio zat meegeleverd. Ik heb al diverse dingen aan die winio.h veranderd maar dat doet eigenlijk niets aan de foutmelding. Weet iemand waar het dan aan zou kunnen liggen? Ik denk zelf dat het in de richting van winio.dll, winio.lib of zoiets is maar zoveel weet ik niet van c++ programming dus ik kan het net zo goed fout hebben :P.

  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Niemand?

  • Dawai
  • Registratie: December 2000
  • Laatst online: 08-07 23:56

Dawai

HERiTAGE CHESS CREW

Als ie die externals niet vindt heb je winio.lib niet toegevoegd aan je project (voor zover je een project hebt met die command line tools). In ieder geval moet je met die winio.lib linken, en dus op een of andere manier ervoor zorgen dat ie toegevoegd wordt aan de command line van de linker.

Programmer: red-eyed, mumbling mammal capable of conversing with inanimate objects.


  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Ik heb die winio.lib nu gewoon bij de rest van de bestandjes staan. Moet ik nog een regel toevoegen in mn programmacode ofzo?

  • Krankenstein
  • Registratie: Augustus 2000
  • Laatst online: 17-05 12:04
Ok ik heb het compilen en het linken nu apart uitgevoerd, en ik krijg netjes en zonder errors een .exe file. Maar nu het volgende probleem: Ik kan de .exe niet openen. Hij zegt "parpoort.exe is geen geldige Win32-toepassing". Wat doe ik daaraan?

Ik heb al diverse parameters bij het compilen en bij het linken geprobeerd, maar ik krijg steeds dezelfde error. Dit terwijl een simpel ( "Hello world!" ) testprogrammatje het wel doet.
Pagina: 1