http://bugs.winehq.org/show_bug.cgi?id=10293
--- Comment #3 from Alexandre Julliard julliard@winehq.org 2007-11-05 06:44:05 --- (In reply to comment #2)
Hmm ... isn't winedevice supposed to be a "system process", which has special treatment in wine server?
The system process thing is to make sure the process terminates when all user processes are done, but it doesn't prevent it from terminating earlier if it wants to.
So let me explain the situation again, maybe there was an misunderstanding...
I don't think there's any misunderstanding, I'm just pointing out that the right fix is to make winedevice exit and restart a new instance for the new driver, instead of trying to restart the winedevice instance from inside itself.
Well, let me say few words about the "process exit" = "cure for all cleanup problems"... Although the wine server per process object directories are purged on process exit, I think it's good programming practice to have a clean shutdown sequence in winedevice too, allowing the kernel driver's Unload called. Just relying that process destroy cleans up all process objects/handle tables - including the leaked ones - to "fix" missing cleanups... uhm well.
Calling the Unload function can certainly be done, though it's not clear that it's actually necessary in any of the drivers I've seen. But things like closing handles or freeing libraries just before exiting the process is a waste of time.