Pointers to DirectDraw Surfaces
Driver writers might be tempted to keep a pointer to the DirectDrawSurface data structures inside their private driver-side surface structures. However, this practice does not succeed on Microsoft Windows 2000 and later because access to DirectDraw kernel-side data structures is mediated through a management scheme that insulates these structures from user mode and from drivers. EngLockDirectDrawSurface provides a pointer to the structure that is valid until the EngUnlockDirectDrawSurface routine is called.
Outside of this lock/unlock pair, the structure is not guaranteed to reside, or even exist, at the same location. Additionally, these lock/unlock pairs impede performance. If the driver keeps its own copies of the surface structures, then the locks are not needed. Updates to data within the driver-side surface structures are made during low-frequency calls like D3dCreateSurfaceEx. The result is that less code must be executed during high-frequency calls like D3dDrawPrimitives2.