Mail Archives: cygwin/1997/10/13/21:49:06
> For example, the NT DDK includes source for a "packet driver"
> which allows a user to connect to a NT protocol driver directly
> from user space. The included application does this by
> issueing a call to CreateFile with the unicode device name
> "\\.\Packet_Packet_<adaptername>". Is it possible to perform this
> same function using the GNU library? If so, I presume I would
> perform an "open" instead of the "CreateFile"? If so, what device
> name do I use? I've tried open("\\\\.\\Packet_Packet_<adaptername>"..
> but that didn't work.
you can mount the device and open it after mounting:
mount '\\.\Packet_Packet_foo' /dev/pack_foo
in prog.c:
int fd = open("/dev/pack_foo", O_RDWR);
but if you are going to be using device io controls anyway,
you're best off just sticking with the win32 calls to interact
with the device. Cygwin does not support arbitrary
ioctl's yet (ever?), just the specific ones implemented in the
cygwin.dll. So what you should do is something like:
#include <windows.h>
[...]
HANDLE devh;
devh = CreateFile("\\\\.\\Packet_Packet_foo", GENERIC_READ | GENERIC_WRITE,
0, 0, OPEN_EXISTING, 0);
if(handle == INVALID_HANDLE_VALUE) { ... }
[...]
if(!DeviceIoControl(devh, IOCTL_SOME_CODE, out, outlen,
in, inlen, &retlen, 0)) {
....
}
and similarly use ReadFile/WriteFile to do normal IO to the
device.
> Pete
Tim N.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -