X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT 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 AT cygwin DOT com From: Mark Geisert Subject: Re: File operations on a Windows Driver (character device) Date: Thu, 21 May 2015 15:50:10 +0000 (UTC) Lines: 62 Message-ID: References: <5559FB9E DOT 3040200 AT cygwin DOT 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 . And also . 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 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