1
votes

The question is pretty self-explanatory, I require the ability to open and control a socket from a kernel mode driver in windows xp. I know that vista and after provides a kernel mode winsock equivalent, but no such thing for XP.

Cheers

Edit I've had a recommendation to have a user-mode service doing the socket work, and one to use TDI. Which is best?

2
Do you really need this? I would create a user mode service, and communicate using that. Are there any reasons this is not feasible? - Christopher
If you feel that a user mode service is the more sensible approach then I can do that, I thought that there may be performance issues. - Alistair Evans
there might be security issues with parson data from the Internet in kernel mode. - Alexander Kjäll
Christoper, could you possibly put that user mode service suggestion as an answer, and then I can accept it? That suggestion worked just fine. - Alistair Evans

2 Answers

1
votes

TDI is not an easy interface to use. It is designed to abstract network transport drivers (TCP, NetBEUI, AppleTalk, etc) from applications. You will have to fully understand the API to be able to use it for socket work - this is certainly a lot more work than writing a user-mode service and communicating with that. You can issue a reverse IRP from the service to the driver, so the driver can trigger comms when it needs to.

Also, the more complexity you remove from your driver (here, into user-mode), the better.

However, using a user-mode service will require a context switch per data transfer to the driver, which for you might be on a per-packet basis. This is an overhead best avoided.

I'm curious as to why a driver needs to perform network I/O. This superficially at least seems to indicate a design issue.

1
votes

Use TDI interface, it's avaliable on XP and Vista.

http://msdn.microsoft.com/en-us/library/ff565112.aspx