Click here to Skip to main content
15,915,172 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSelf-deleting executable Pin
BlackDice11-Nov-04 5:58
BlackDice11-Nov-04 5:58 
GeneralRe: Self-deleting executable Pin
Rick York11-Nov-04 6:49
mveRick York11-Nov-04 6:49 
GeneralRe: Self-deleting executable Pin
Navin11-Nov-04 6:57
Navin11-Nov-04 6:57 
GeneralRe: Self-deleting executable Pin
BlackDice11-Nov-04 7:14
BlackDice11-Nov-04 7:14 
QuestionHOW CAN I CONVERT VISUAL C++ DLL(a DLL which writed in visual C++) TO BORLAND DLL? Pin
gurk@n11-Nov-04 5:13
gurk@n11-Nov-04 5:13 
AnswerRe: HOW CAN I CONVERT VISUAL C++ DLL(a DLL which writed in visual C++) TO BORLAND DLL? Pin
Anonymous11-Nov-04 7:46
Anonymous11-Nov-04 7:46 
GeneralVirtual serial port and TCP/IP Pin
Nikolaou11-Nov-04 4:41
Nikolaou11-Nov-04 4:41 
GeneralRe: Virtual serial port and TCP/IP Pin
Antti Keskinen11-Nov-04 6:58
Antti Keskinen11-Nov-04 6:58 
Hi !

The whole solution is to design, write and register a so-called pseudo-device driver. Pseudo-devices are software components that the Windows system recognizes as devices, but which require no actual hardware to exist.

When the driver is registered and running, you can open a handle to it (CreateFile) and use ReadFile/WriteFile calls to send and receive data from it. Because a serial communications device supports overlapped I/O, you can also use event objects to request signals from the operating system when an event occurs. The easiest way to understand an event object is to think of a hardware interrupt. Waiting for an event object to signal is very much like waiting for an interrupt to trigger.

The device itself, when created, must use the Windows Sockets API to create a socket connection to the specified server. Then it can start serving the application by responding to ReadFile/WriteFile calls appropriately.

To give you a nice & handy head-start, you should see David Dunlop's article 'Introduction to Device Drivers'. The article can be found here[^]. In this article, he will help you through the process of creating and registering a pseudo-device driver that does not do anything.

For a more in-depth look, go read mjtsai's article here[^]. Follow the article through, and fill in the necessary code for your pseudo-device to
a) identify itself as a serial communications device (AddDevice-call)
b) create and connect the socket when a handle is opened (IRP_MJ_CREATE)
c) offer data transfer services to/from the socket (IRP_MJ_READ/IRP_MJ_WRITE)
d) close the socket when a handle is closed (IRP_MJ_CLOSE)

As you can see, I have named the different events to which your pseudo-device driver needs to respond. The type of device you wish to represent is called 'FILE_DEVICE_SERIAL_PORT'. This information is given during the IoCreateDevice call.

For more information on how device drivers work, I suggest buying a good book. Programming the Windows Driver Model, 2nd Edition is one of the best I can recommend. But I hope this answer will get you started.

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Virtual serial port and TCP/IP Pin
Nikolaou6-Dec-04 0:08
Nikolaou6-Dec-04 0:08 
GeneralRe: Virtual serial port and TCP/IP Pin
Antti Keskinen6-Dec-04 6:14
Antti Keskinen6-Dec-04 6:14 
GeneralRe: Virtual serial port and TCP/IP Pin
Nikolaou6-Dec-04 23:37
Nikolaou6-Dec-04 23:37 
GeneralRe: Virtual serial port and TCP/IP Pin
Antti Keskinen8-Dec-04 8:03
Antti Keskinen8-Dec-04 8:03 
GeneralIP Address Converted to a Number Pin
jerry1211a11-Nov-04 4:30
jerry1211a11-Nov-04 4:30 
GeneralRe: IP Address Converted to a Number Pin
Antony M Kancidrowski11-Nov-04 7:07
Antony M Kancidrowski11-Nov-04 7:07 
GeneralRe: IP Address Converted to a Number Pin
geo_m11-Nov-04 19:39
geo_m11-Nov-04 19:39 
GeneralRaw Sockets on XP SP1 Pin
Anonymous11-Nov-04 3:21
Anonymous11-Nov-04 3:21 
GeneralRe: Raw Sockets on XP SP1 Pin
Antti Keskinen11-Nov-04 7:20
Antti Keskinen11-Nov-04 7:20 
General<b>Help!! How to access Static control from other class</B> Pin
VikramDelhi11-Nov-04 3:13
VikramDelhi11-Nov-04 3:13 
GeneralRe: <b>Help!! How to access Static control from other class</B> Pin
GDavy11-Nov-04 3:29
GDavy11-Nov-04 3:29 
GeneralRe: <b>Help!! How to access Static control from other class</B> Pin
VikramDelhi13-Nov-04 23:16
VikramDelhi13-Nov-04 23:16 
GeneralShell Question - Get Parent PIDL Pin
Marcus Spitzmiller11-Nov-04 3:12
Marcus Spitzmiller11-Nov-04 3:12 
GeneralRe: Shell Question - Get Parent PIDL Pin
Michael Dunn11-Nov-04 11:14
sitebuilderMichael Dunn11-Nov-04 11:14 
QuestionHow to draw Multiple-Documents in one view Pin
br0kera11-Nov-04 2:20
br0kera11-Nov-04 2:20 
AnswerRe: How to draw Multiple-Documents in one view Pin
bryce11-Nov-04 12:50
bryce11-Nov-04 12:50 
GeneralClosing Dialogs Pin
jj92111-Nov-04 1:23
jj92111-Nov-04 1:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.