forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help with "non-VDS" DLL

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Mon Feb 07, 2005 2:23 pm    Post subject: Help with "non-VDS" DLL Reply with quote

I wish to use a free dll that allows direct port access under 2000/NT/XP. I've experimented with it a bit but really don't have a firm grasp of the proper calling procedures. The developer has posted details for Delphi (as well as C & VB) so hopefully someone here can get me pointed in the right direction with some examples of the correct syntax.
The software is available at http://www.geekhideout.com/iodll.shtml
The instructions for Delphi are as follows:

    Delphi Prototypes
    procedure PortOut(Port : Word; Data : Byte);
    procedure PortWordOut(Port : Word; Data : Word);
    procedure PortDWordOut(Port : Word; Data : DWord);
    function PortIn(Port : Word) : Byte;
    function PortWordIn(Port : Word) : Word;
    function PortDWordIn(Port : Word) : DWord;
    procedure SetPortBit(Port : Word; Bit : Byte);
    procedure ClrPortBit(Port : Word; Bit : Byte);
    procedure NotPortBit(Port : Word; Bit : Byte);
    function GetPortBit(Port : Word; Bit : Byte) : WordBool;
    function RightPortShift(Port : Word; Val : WordBool) : WordBool;
    function LeftPortShift(Port : Word; Val : WordBool) : WordBool;
    function IsDriverInstalled : Boolean;
    Important! To use these functions in your Delphi program, the correct calling convention of stdcall is required. For example:
    procedure PortOut(Port : Word; Data : Byte); stdcall; external 'io.dll';

Here's a couple of lines that returns the expected result from the simplest function but I'm kind of lost after this..
Code:
LOADLIB io.dll
info @LIB(io.dll,PortIn,INT,890)
FREELIB io.dll


Any help would be greatly appreciated..
........David
Back to top
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Tue Feb 08, 2005 4:08 pm    Post subject: Reply with quote

David,

Just a guess on my part...
I suspect that this dll is designed to address io ports directly through the port's address, i.e. instead of using "COM1", you would have to use "3f8", assuming COM1 is assigned that address. Your usage would now look like this: info @LIB(io.dll,PortIn,STR:,INT:@binary(word,3f8))
To break down what was done:
@lib( - perform a library call
io.dll, - the library being called
PortIn, - the function within that library being used
STR:, - the TYPE being returned (in this case, a character in the form of a string)
INT:@binary(word,3f8) - the value being passed to the function (in this case, the port address) and its TYPE (word integer)

I hope this helps (and that I got it right...)
Hooligan

_________________
Hooligan

Why be normal?
Back to top
View user's profile Send private message
DavidR
Contributor
Contributor


Joined: 05 Aug 2003
Posts: 83
Location: Bethel Pennsylvania U.S.A.

PostPosted: Fri Feb 11, 2005 11:46 am    Post subject: Reply with quote

Thanks for the replies, I'm making some progress with this but another question comes up.
I'd like to (programatically) determine the base address of the Parallel ports installed on a particular computer. I can get this information by running debug in a command window and examining 0000:0408 where the base address of LPT1 is stored, Or I can look in the control panel under system/hardware but I'd like my program to be able to get this information on its own. I thought it might be available in the registry but was unable to locate it. Perhaps there's an API call that can return this number?
Any ideas ?
Thanks........
..............David
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group