"Trying to enable physical device already in use." error



Hello,

I'm modifying a graphic driver (based on the mirror driver example from the
w2k3 DDK, using WinXP headers) to provide virtual desktops (software only).
Basically it works well, but when a secondary virtual monitor is being
enabled (right-klick on the monitor symbol, activate "attached" and press
"apply") in the display properties dialog (when the primary virtual monitor
is already enabled), Windows kind of halts (mouse pointer is still there and
functional, but the picture is black in VirtualPC). Here is the output of
WinDbg:

DrvGetModes(8117d7d0,0,0)
DrvGetModes(8117d7d0,3300,e191a250)
DrvGetModes(81171b98,0,0)
DrvGetModes(81171b98,3300,e1024008)
DrvGetModes(8117d7d0,0,0)
DrvGetModes(8117d7d0,3300,e17031c8)
DrvGetModes(81171b98,0,0)
DrvGetModes(81171b98,3300,e17031c8)
DrvGetModes(81171ec8,0,0)
DrvGetModes(81171ec8,3300,e17031c8)
DrvBitBlt( 0,0 640x480 (0) )
DrvAssertMode(e143dd28, 0)
DrvEnablePDEV: dmPelsWidth=640, dmPelsHeight=480, dmBitsPerPel=32
DrvCompletePDEV(e18571e0, e1023008)
DrvEnableSurface(e18571e0)
DrvNotify(e13cd1a0, 4, 0)
DrvCopyBits( 0,0 16x1 )
DrvCopyBits( 0,0 16x1 )
DrvCreateDeviceBitmap(...)
DrvCopyBits( 0,0 16x1 )
DrvCopyBits( 0,0 16x1 )
DrvBitBlt( 0,0 16x1 (0) )
DrvEnablePDEV: dmPelsWidth=640, dmPelsHeight=480, dmBitsPerPel=32
DrvCompletePDEV(e1407bb0, e1703188)
DrvEnableSurface(e1407bb0)
DrvNotify(e172c018, 4, 0)
DrvCopyBits( 0,0 16x1 )
DrvCopyBits( 0,0 16x1 )
DrvCreateDeviceBitmap(...)
DrvCopyBits( 0,0 16x1 )
DrvCopyBits( 0,0 16x1 )
DrvBitBlt( 0,0 16x1 (0) )
DrvNotify(e13cd1a0, 2, e1023580)
DrvNotify(e172c018, 2, e1703700)
DrvResetPDEV(e143dd28, e18571e0)
DrvAssertMode(e18571e0, 0)
DrvDisableSurface(e18571e0)
DrvDisablePDEV(e18571e0)
DrvAssertMode(e1407bb0, 0)
DrvDisableSurface(e1407bb0)
DrvDisablePDEV(e1407bb0)
Trying to enable physical device already in use.
DrvAssertMode(e143dd28, 1)
DrvSetPointerShape(e143dd28 -1 -1 fc65bc54)

I am quite clueless about what's wrong here as I cannot find the source of
the error message, after hours spent trying.
.