copy USB2LPT.exe c:\porttalk22\
cd c:\porttalk22
C:\porttalk22\AllowIO USB2LPT.exe 0x378 0x379 0x37a 0x3bc ox3bd 0x3be
This works well, but I cannot debug my code, and the exception causes an
immediate termination. I tried to trap the error, but it still hangs up.
The routines that cause the exception are:
FUNCTION PortIn(IOport: WORD): BYTE; ASSEMBLER; REGISTER;
asm
MOV DX,AX
IN AL,DX
end;
PROCEDURE PortOut(IOport: WORD; Value: BYTE); ASSEMBLER; REGISTER;
ASM
XCHG DX,AX
OUT DX,AL
END;
Is there a way to ignore this attempted I/O, or somehow predict that it
will cause an exception by determining the processor's permission map? I
might be able to do it by running the entire Delphi IDE from the AllowIO
command line, but I'd rather not.
If I set the debug options to Run Unhandled by User Program or Debugger, I
will get the debugger error message, and I can continue. If I set it to Run
Handled by User Program or Debugger, it hangs up, and I must use Program
Reset.
Thanks,
Paul
> This works well, but I cannot debug my code, and the exception causes an
> immediate termination. I tried to trap the error, but it still hangs up.
Stupid idea: Just add a "debug mode" command line parameter to your
application, which avoids the port access.
That's a good idea. I can add the switch in the Run|Parameters list.
I was also able to add the porttalk.exe as my host application, and then
add the parameters so I could run the application with port access allowed,
but it does not run in the debugger.
The source code is available for allowio.exe. I wonder if that could be
used as part of the program to grant IO privileges. I'll have a look at
that.
Thanks,
Paul
You might also try running Delphi via allowio, too. Maybe the OS is
preventing your program from writing to the privileged port because it's
running in the context of the debugger that isn't allowed to write there.
--
Rob
cd\ "C:\Program Files\Borland\Delphi4\Bin\"
AllowIO Delphi32.exe 0x378 0x379 0x37a 0x3bc ox3bd 0x3be
It started to run Delphi but it could not find a file "ox3bd.bpg" in the
project directory where I launched the batch file. It is also not in the
Bin\ folder.
Unfortunately my attempts have caused three non-running copies of
Delphi32.exe to appear as processes in the device mangler, so I probably
should reboot and clean that up.
I'll probably just use the debug switch as a parameter. I know the IO code
works.
Thanks,
Paul
>> You might also try running Delphi via allowio, too. ...
> I tried the following batch file:
>
> cd\ "C:\Program Files\Borland\Delphi4\Bin\"
> AllowIO Delphi32.exe 0x378 0x379 0x37a 0x3bc ox3bd 0x3be
>
> It started to run Delphi but it could not find a file "ox3bd.bpg" ...
That seems to suggest AllowIO only takes four parameters and passes
the remaining ones to the encapsulated executable... or perhaps it
didn't recognise a string beginning with the letter O as a port
number and decided to skip it from there on.
Groetjes,
Maarten Wiltink
Actually, you caught a typo on my part. That "o" should be a "0"! After
correcting that, Delphi ran OK, but it still trapped the exception. Is the
debugger a separate process? Perhaps the permission map does not apply to
child processes?
Thanks!
Paul
did you try to config the IDE in the RUN option to always
run AllowIO.exe as the HOST and have your EXE on that command line?
I don't think you can debug your program this way but you
can test run it .