X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:date:message-id:references
	:mime-version:content-type:content-transfer-encoding; q=dns; s=
	default; b=QZLgLaSxwmC16cEK98WdM6QiTSh1ktA3lJmvj4DE/YR3Kdo8s5pwY
	UFGdOj2fJ1/wRKlbGtlQz6dvO70ttsrCFnPfPVMWsfxdwS+tZnLApM525W3xU2kH
	NCpPJMIlqsoRyYwcQDkQSwMWPbT5wr90gihfEn6qNsDghwAN4Bn09k=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:date:message-id:references
	:mime-version:content-type:content-transfer-encoding; s=default;
	 bh=n0yPZDi2FK2l2BtotO/R7BUTgp0=; b=ywo2qHgmBdJXdnlxXHq2NArPatF4
	7nJJycxgXdj8toQkANdQfyH0GDUm8VwTKl360wv2DmWJlVNEDqpenw0uy792xGbA
	dGAc8fSmrYBtRdlR0zWl0ILOE1Phfz0QJNHVscC9gT2D9V2xnP6+U7CesPOoLNgY
	gcZzsZxxbdSpqWo=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: plane.gmane.org
To: cygwin@cygwin.com
From: Mark Geisert <mark@maxrnd.com>
Subject: Re: File operations on a Windows Driver (character device)
Date: Thu, 21 May 2015 15:50:10 +0000 (UTC)
Lines: 62
Message-ID: <loom.20150521T172259-478@post.gmane.org>
References: <CACs=mWDRGh9KZBT45=8yy4J6h62v0RNYxczV91qRhhb8LcfY4Q@mail.gmail.com>	<5559FB9E.3040200@cygwin.com>	<CACs=mWCO8ejvsufP3C_HFAiKDrcsanGZ+J_EuQQGOm+u30T_zg@mail.gmail.com>	<loom.20150519T094146-560@post.gmane.org>	<CACs=mWBEe2CqkN=tizTMcCXLxvbkwNat8Uch_CTPSaDgFCUmYQ@mail.gmail.com>	<loom.20150520T030416-888@post.gmane.org> <CACs=mWDbdxH8+pmU3nWUOAKDh1X_SM0C_oKEkXUrarKO8z=20g@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes

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...

No <https://cygwin.com/acronyms/#TOFU>.
And also <https://cygwin.com/acronyms/#PCYMTNQREAIYR>.
Thanks!

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()
could work.

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.
HTH,

..mark


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

