nt_device_handle = CreateFile(
"\\\\.\\ALTLPT1",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL );
Which, incidentally doesn't seem to work when I compile it as part of a
Win32 Console Application under Visual C++ 6.0 (although it did under a
competitor product ... hmmm).
Anyway, this leads me to two questions:
1. The LPCTSTR lpFileName argument appears to map names to addresses of
named ports - is there a list of such ports available?
2. I'd like to open a file (stream?) handle to write to an address at
0x300, and 0x301 (on the ISA bus). In a PC not running the x86 in
protected mode I'd simply use 'in/outbytep and inp/outp' macros. Is
there a way I can construct an LPCTSTR file name to accomplish opening
an memory address?
I've googled things like "CreateFile Win32 inbyteb" and "CreateFile
Win32 port addresses" to no avail.
Help appreciated!
- Jamie
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
<rou...@yahoo.com> wrote in message
news:1123458900.3...@o13g2000cwo.googlegroups.com...
Thanks for the link, but after a quick skim of the URL, it appears the
library is not entirely useful for my project.
The "hang up over string type" is that I haven't seen documentation for
a name space that the first argument of CreateFile will willingly
accept. If "LPT1:" works, that's terrific, my problem is that I'm
trying to convert the code that uses the printer port ("LPT1") to an I/O
port on an ISA bus (0x300:0x301).
Another "hang up" is that I'm relegated to using "free" tools - despite
the fact that it cost 10 times as much for me (an embedded C programmer)
to learn enough of the Windows API to accomplish this.
** EMPHASIS **
Can CreateFile() be called to open a file stream to an arbitrary I/O
port address? If yes, how?
**
- Jamie
The standard driver for LPT1 will only support output. Given your
constraints, I'd suggest using a third-party device drive such as WinIO which
will let your program have direct access to the IO ports that LPT1 is
connected to.
--
-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
- http://www.mvps.org/ArcaneIncantations/consulting.htm
-gcha...@mvps.org
"Jamie Risk" <ri...@intectus.com> wrote in message
news:%23eZDPyB...@TK2MSFTNGP15.phx.gbl...
I believe you will need a device driver to what you want. There is a simple
device driver example for addressing the ISA bus. It is called genport and
can be found in the DDK sample directory. I don't write device drivers, but
found the example simple enough for me modify, build, and to use in
conjunction with an application that I wrote years ago.
- Neil Shore
You do need a device driver, but no need to write your own. There's a
widespread one called giveio, see for example
http://www.cs.ucr.edu/~eblock/pages/pictools/giveio.html
http://www.intel.com/design/pca/applicationsprocessors/swsup/RelNote_JFlashmm_V5_01_007.pdf
>
> - Neil Shore
>
> "Jamie Risk" wrote:
>
>> I downloaded some code from the Altera web site to program there parts
>> via a special cable connected to the serial port. In a portion of the
>> downloaded code there is a call to "CreateFile" as follows:
>>
>> nt_device_handle = CreateFile(
>> "\\\\.\\ALTLPT1",
>> GENERIC_READ | GENERIC_WRITE,
>> 0,
>> NULL,
>> OPEN_EXISTING,
>> FILE_ATTRIBUTE_NORMAL,
>> NULL );
>>
>> Which, incidentally doesn't seem to work when I compile it as part of a
>> Win32 Console Application under Visual C++ 6.0 (although it did under a
>> competitor product ... hmmm).
>>
>>
>> Anyway, this leads me to two questions:
>> 1. The LPCTSTR lpFileName argument appears to map names to addresses of
>> named ports - is there a list of such ports available?
The available port names depend on the installed drivers.
>>
>> 2. I'd like to open a file (stream?) handle to write to an address at
>> 0x300, and 0x301 (on the ISA bus). In a PC not running the x86 in
>> protected mode I'd simply use 'in/outbytep and inp/outp' macros. Is
>> there a way I can construct an LPCTSTR file name to accomplish opening
>> an memory address?
The giveio driver I think disables memory protected for whatever list of
ports you give it, so inp/outp work.
>>
>>
>>
>> I've googled things like "CreateFile Win32 inbyteb" and "CreateFile
>> Win32 port addresses" to no avail.
Because CreateFile is pretty much useless for this purpose, unless you have
a special driver like the Altera to talk to. "WinNT user mode port i/o"
would be a better query.
>>
>> Help appreciated!
>>
>> - Jamie
>>
>>
>>