Accessing a custom Windows device driver via Java's File API
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Oscar_Rambaldini
Posted On:   Tuesday, December 17, 2002 12:34 PM

I am interested in having a Java application communicate with a custom windows device driver via Java's file API. With Java (SDK 1.4.1) I have been successful in opening a device such as COM1 and reading and writing to it. File file = new File("\\.\COM1"); This would indicate that in concept, Java's file API is able to communicate with win32 devices. When I tried to communicate with my device driver however, I got "FileNotFoundException (Incorrect function)" File file = new File("\\.\mydevice"); To prove my device driver is functioning properly I also wrote a MFC Win32 app which uses the native win32 API function CreateFile. C   More>>

I am interested in having a Java application communicate with a custom windows device driver via Java's file API.



With Java (SDK 1.4.1) I have been successful in opening a device such as COM1 and reading and writing to it.



			
File file = new File("\\.\COM1");


This would indicate that in concept, Java's file API is able to communicate with win32 devices. When I tried to communicate with my device driver however, I got "FileNotFoundException (Incorrect function)"



			
File file = new File("\\.\mydevice");


To prove my device driver is functioning properly I also wrote a MFC Win32 app which uses the native win32 API function CreateFile.



			
CreateFile("\\.\mydevice", ...);


This worked fine, and I was able to read/write in both directions. I can't understand why the Java app is able to open a device such as COM1 but not my device.



Any suggestions? Is communication with COM1 a special case which doesn't follow the same rules as custom WDM devices?



Thanks, Oscar.

   <<Less
About | Sitemap | Contact