Restoring the Direct3D Device

The RestoreDevice function restores lost video memory for the device surface and z-buffer.

static HRESULT 
RestoreDevice(void) 
{ 
    HRESULT hRes; 
 
    if (NULL != lpddZBuffer) 
    { 
        hRes = lpddZBuffer->lpVtbl->Restore(lpddZBuffer); 
        if (FAILED(hRes)) 
            return hRes; 
    } 
 
    if (NULL != lpddDevice) 
    { 
        hRes = lpddDevice->lpVtbl->Restore(lpddDevice); 
        if (FAILED(hRes)) 
            return hRes; 
    } 
 
    return DD_OK; 
}