This is the mail archive of the
mailing list for the Cygwin project.
Re: File operations on a Windows Driver (character device)
- From: Mark Geisert <mark at maxrnd dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 21 May 2015 15:50:10 +0000 (UTC)
- Subject: Re: File operations on a Windows Driver (character device)
- Authentication-results: sourceware.org; auth=none
- References: <CACs=mWDRGh9KZBT45=8yy4J6h62v0RNYxczV91qRhhb8LcfY4Q at mail dot gmail dot com> <5559FB9E dot 3040200 at cygwin dot com> <CACs=mWCO8ejvsufP3C_HFAiKDrcsanGZ+J_EuQQGOm+u30T_zg at mail dot gmail dot com> <loom dot 20150519T094146-560 at post dot gmane dot org> <CACs=mWBEe2CqkN=tizTMcCXLxvbkwNat8Uch_CTPSaDgFCUmYQ at mail dot gmail dot com> <loom dot 20150520T030416-888 at post dot gmane dot org> <CACs=mWDbdxH8+pmU3nWUOAKDh1X_SM0C_oKEkXUrarKO8z=20g at mail dot gmail dot com>
Alessio Faina writes:
> I've got the kernelspace part on github (
> https://github.com/PicMelter/uniioShd.git ).
> It consists of sys (the kernel module), testExe (loads/unloads on the
> fly the module
> in the kernel) and secondExe that just interact with the first
> executable and the kernel
> module if it is loaded. With the buildAll.bat if the WDK7.1 is
> present, all the applications
> are builded automatically.
> There is a Cyg.c that represent my effort to connect to the module,
> sending an ioctl and doing
> an mmap.
> I think that, even if it's a semplification of the program I'm
> porting, this little project
> is very close to what I'm trying to do with the main project.
> As I read somewhere else, cygwin doesn't support custom ioctl on
> custom modules, have I
> understood well? This may explain why I'm never able to send any ioctl
> to my module.
> For the mmap part, well, I've tried to follow with gdb what Cygwin is
> doing but II must admit
> that at some point I just lose track of what it's doing.
> If it's too messy, I can polish the code a little bit; consider that
> it's the environment where I'm
> always doing tests so rarely I have the time to clean the code...
First, a belated welcome to the Cygwin mailing list. Second, may I ask that
you please follow the list's posting conventions? That means...
And also <https://cygwin.com/acronyms/#PCYMTNQREAIYR>.
I looked at your GitHub code. I'm not at all experienced with Windows
kernel interfacing though. Are you saying that that Windows native code
works properly for you? If it doesn't, we're not likely able to help (and
it's off-topic for this list).
If it works, then you have two options. You are trying the first option,
which is to recode your test program for Cygwin line-by-line. You're using
Cygwin ioctl() and mmap(). I looked at the Cygwin source for its ioctl()
and found that it's not likely to work for you. If I'm reading it
correctly, it only supports some of the TCxxx terminal control ioctls.
That's a show-stopper, so I didn't even check whether your use of mmap()
The second option you could try, is this: Compile your existing Windows
native test program with gcc, thus making it a Cygwin program that calls
Windows syscalls. Cygwin doesn't prevent use of Windows syscalls. You
don't want to overdo it and collide with Cygwin's own internals, but
localized Windows syscalls can be OK. There's a <windows.h> in the Cygwin
distribution; it's in /usr/include/w32api. You may have minor issues
compiling and linking but those can be asked about here and more folks will
have insight on them.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple