questions for safedisc implementation (AJ pleas read)

Ivan Leo Puoti ivanleo at
Wed Jan 5 01:52:37 CST 2005

Chances are I'll be quite busy during the next week, but Laurent Pinchart,
the guy who originally reverse engineered safedisc, asked a few 
questions on IRC about
implementing support for the native safedisc driver, feedback, 
particularly from AJ, would be very
appreciated, here is the IRC log.
peter_pan is Laurent.

< peter_pan> I'm trying to figure out how to implement "kernel services" in wine. a kernel service is a device driver which is loaded by StartService and runs in kernel space. the driver has a DriverEntry entry point, which, unlike regular services, seem to return immediately after registering callbacks. this might not always be the case though
23:41 < peter_pan> after DriverEntry returns, the process started by StartService currently exits. how should I handle calls to the callbacks registered by IoCreateDevice inside DriverEntry ? should they run in the calling process space, the wine server space or the service process space ?
23:41 < peter_pan> in the first case, I have to map the kernel service in all wine processes space, as the service can make use of global data (in windows the kernel service only exists once inside the kernel)
23:41 < peter_pan> in the third case, I will have to find a way to keep the service process alive (in a stopped state) after DriverEntry returns, and use wineserver and ptrace to call the callbacks from the user processes. this will imply inter process communication and inter process synchronization. or maybe I could just use IPC and keep the kernel space process waiting on a pipe or something. this wouldn't work for a kernel service which doesn't return from DriverEntry immediately, but I don't know if those exist.
23:41 < peter_pan> does anyone have any thought to share ?
23:47 <@Thunderbird> hi
23:47 <@Thunderbird> guess it needs to happen in wineserver
23:47 <@Thunderbird> better ask julliard about it
23:47 <@Thunderbird> if he is still awake
23:48 < peter_pan> he's been idling for 1 hour and 45 minutes
23:49 < peter_pan> are you there alexandre ?
23:50 <@Thunderbird> td might be online too ..
23:51  * TD is gone to a film, like NOW
23:51 <@TD> bye ....
23:51 < peter_pan> no luck either
23:51 < peter_pan> lol
23:52 <@Thunderbird> isn't there some function in wineserver that runs all the time?
23:53 < peter_pan> my opinion is that DriverEntry should be called in a separate process like it is now, as it can block, and that IoCreateDevice should map the image in the wineserver process space and update the callback table. the problem is that the changes to data sections made in DriverEntry must be somehow shared with wineserver.
23:55 < peter_pan> StartService will have to be modified to handle kernel services. it uses CreateProcess now, which calls DriverEntry (the entry point) with wrong parameters. we would need a way to mark a process as being a kernel process or a user process
23:57 <@Thunderbird> I guess that is good but I'm not qualified enough to say something about that
23:58 < peter_pan> using wineserver to host the driver callbacks would serialize the calls, which might not be a good thing to do. in windows, syscalls are executed in kernel space, but in the context of the calling process. it might be a good idea to do that here too. is the windows kernel interruptible ? can a process call a driver function while another process sleeps in the same functions, or while another process executes inside that function on another CPU ?
23:59 <@Thunderbird> how is this stuff handled in reactos?
23:59 < peter_pan> I have no idea
23:59 < peter_pan> maybe I should ask them

More information about the wine-devel mailing list