diff --git a/sdk/include/reactos/drivers/directx/dxeng.h b/sdk/include/reactos/drivers/directx/dxeng.h
index 8a349ce6507..fa2f248e7cf 100644
--- a/sdk/include/reactos/drivers/directx/dxeng.h
+++ b/sdk/include/reactos/drivers/directx/dxeng.h
@@ -57,7 +57,7 @@ typedef enum _DXEGSHDEVDATA
   DxEGShDevData_DrvFuncs,
   DxEGShDevData_dhpdev,
   DxEGShDevData_eddg,
-  DxEGShDevData_dd_nCount,
+  DxEGShDevData_dd_locks,
   DxEGShDevData_dd_flags,
   DxEGShDevData_disable,
   DxEGShDevData_metadev,
diff --git a/sdk/include/reactos/drivers/directx/dxg.h b/sdk/include/reactos/drivers/directx/dxg.h
index 33a815a2a61..470597ad1de 100644
--- a/sdk/include/reactos/drivers/directx/dxg.h
+++ b/sdk/include/reactos/drivers/directx/dxg.h
@@ -197,7 +197,7 @@ typedef DWORD (NTAPI *PGD_DXGENERICTRUNK)(ULONG_PTR, ULONG_PTR, SIZE_T*, PVOID,
 //typedef x (NTAPI *PGD_DxDdHeapVidMemAllocAligned)(
 //typedef x (NTAPI *PGD_DxDdHeapVidMemFree)(
 typedef BOOLEAN (NTAPI *PGD_DXDDENABLEDIRECTDRAW)(PVOID, BOOLEAN);
-//typedef x (NTAPI *PGD_DxDdDisableDirectDraw)(
+typedef VOID (NTAPI *PGD_DXDDDISABLEDIRECTDRAW)(PVOID, BOOLEAN);
 //typedef x (NTAPI *PGD_DxDdSuspendDirectDraw)(
 //typedef x (NTAPI *PGD_DxDdResumeDirectDraw)(
 //typedef x (NTAPI *PGD_DxDdDynamicModeChange)(
diff --git a/win32ss/gdi/eng/pdevobj.c b/win32ss/gdi/eng/pdevobj.c
index 65469cfce76..8ca7c77cd2a 100644
--- a/win32ss/gdi/eng/pdevobj.c
+++ b/win32ss/gdi/eng/pdevobj.c
@@ -3,7 +3,8 @@
  * PROJECT:          ReactOS kernel
  * PURPOSE:          Support for physical devices
  * FILE:             win32ss/gdi/eng/pdevobj.c
- * PROGRAMER:        Timo Kreuzer (timo.kreuzer@reactos.org)
+ * PROGRAMERS:       Timo Kreuzer (timo.kreuzer@reactos.org)
+ *                   Oleg Dubinskiy (oleg.dubinskij30@gmail.com)
  */
 
 #include <win32k.h>
@@ -333,6 +334,66 @@ PDEVOBJ_pSurface(
     return ppdev->pSurface;
 }
 
+BOOL
+PDEVOBJ_bEnableDirectDraw(
+    _Inout_ PPDEVOBJ ppdev)
+{
+    PGD_DXDDENABLEDIRECTDRAW pfnDdEnableDirectDraw = (PGD_DXDDENABLEDIRECTDRAW)gpDxFuncs[DXG_INDEX_DxDdEnableDirectDraw].pfn;
+    BOOL assertVal;
+
+    /* Enable DirectDraw */
+    DPRINT1("DxDdEnableDirectDraw(ppdev %p)\n", ppdev);
+    assertVal = pfnDdEnableDirectDraw((HDEV)ppdev, TRUE);
+    DPRINT1("DxDdEnableDirectDraw(ppdev %p) => %d\n", ppdev, assertVal);
+
+    return assertVal;
+}
+
+VOID
+PDEVOBJ_vDisableDirectDraw(
+    _Inout_ PPDEVOBJ ppdev)
+{
+    PGD_DXDDDISABLEDIRECTDRAW pfnDdDisableDirectDraw = (PGD_DXDDDISABLEDIRECTDRAW)gpDxFuncs[DXG_INDEX_DxDdDisableDirectDraw].pfn;
+
+    /* Disable DirectDraw */
+    DPRINT1("DxDdDisableDirectDraw(ppdev %p)\n", ppdev);
+    pfnDdDisableDirectDraw((HDEV)ppdev, TRUE);
+}
+
+VOID
+PDEVOBJ_vResumeDirectDraw(
+    _Inout_ PPDEVOBJ ppdev)
+{
+    PGD_DXDDRESUMEDIRECTDRAW pfnDdResumeDirectDraw = (PGD_DXDDRESUMEDIRECTDRAW)gpDxFuncs[DXG_INDEX_DxDdResumeDirectDraw].pfn;
+
+    /* Resume DirectDraw after mode change */
+    DPRINT1("DxDdResumeDirectDraw(ppdev %p)\n", ppdev);
+    pfnDdResumeDirectDraw((HDEV)ppdev, 0);
+}
+
+VOID
+PDEVOBJ_vSuspendDirectDraw(
+    _Inout_ PPDEVOBJ ppdev)
+{
+    PGD_DXDDSUSPENDDIRECTDRAW pfnDdSuspendDirectDraw = (PGD_DXDDSUSPENDDIRECTDRAW)gpDxFuncs[DXG_INDEX_DxDdSuspendDirectDraw].pfn;
+
+    /* Suspend DirectDraw for mode change */
+    DPRINT1("DxDdSuspendDirectDraw(ppdev %p)\n", ppdev);
+    pfnDdSuspendDirectDraw((HDEV)ppdev, 0);
+}
+
+VOID
+PDEVOBJ_vSwitchDirectDraw(
+    _Inout_ PPDEVOBJ ppdev,
+    _Inout_ PPDEVOBJ ppdev2)
+{
+    PGD_DXDDDYNAMICMODECHANGE pfnDdDynamicModeChange = (PGD_DXDDDYNAMICMODECHANGE)gpDxFuncs[DXG_INDEX_DxDdDynamicModeChange].pfn;
+
+    /* Switch DirectDraw instances between the PDEVs */
+    DPRINT1("DxDdDynamicModeChange(ppdev %p, ppdev2 %p)\n", ppdev, ppdev2);
+    pfnDdDynamicModeChange((HDEV)ppdev, (HDEV)ppdev2, 0);
+}
+
 VOID
 PDEVOBJ_vEnableDisplay(
     _Inout_ PPDEVOBJ ppdev)
@@ -362,6 +423,8 @@ PDEVOBJ_bDisableDisplay(
     if (ppdev->flFlags & PDEV_DISABLED)
         return TRUE;
 
+    PDEVOBJ_vSuspendDirectDraw(ppdev);
+
     TRACE("DrvAssertMode(dhpdev %p, FALSE)\n", ppdev->dhpdev);
     assertVal = ppdev->pfn.AssertMode(ppdev->dhpdev, FALSE);
     TRACE("DrvAssertMode(dhpdev %p, FALSE) => %d\n", ppdev->dhpdev, assertVal);
@@ -610,6 +673,9 @@ PDEVOBJ_bDynamicModeChange(
     ppdev->pfn.CompletePDEV(ppdev->dhpdev, (HDEV)ppdev);
     ppdev2->pfn.CompletePDEV(ppdev2->dhpdev, (HDEV)ppdev2);
 
+    /* Switch DirectDraw mode */
+    PDEVOBJ_vSwitchDirectDraw(ppdev, ppdev2);
+
     return TRUE;
 }
 
@@ -639,6 +705,8 @@ PDEVOBJ_bSwitchMode(
     if (!PDEVOBJ_bDisableDisplay(ppdev))
     {
         DPRINT1("PDEVOBJ_bDisableDisplay() failed\n");
+        /* Resume DirectDraw in case of failure */
+        PDEVOBJ_vResumeDirectDraw(ppdev);
         goto leave;
     }
 
@@ -659,11 +727,19 @@ PDEVOBJ_bSwitchMode(
         goto leave2;
     }
 
-    /* 4. Get DirectDraw information */
-    /* 5. Enable DirectDraw Not traced */
-    /* 6. Copy old PDEV state to new PDEV instance */
+    /* 4. Enable DirectDraw for our new PDEV */
+    if (!PDEVOBJ_bEnableDirectDraw(ppdevTmp))
+    {
+        DPRINT1("PDEVOBJ_bEnableDirectDraw (ppdevTmp %p) failed\n", ppdevTmp);
+        PDEVOBJ_vRelease(ppdevTmp);
+        goto leave2;
+    }
+
+    /* 5. Temporarily suspend DirectDraw for mode change */
+    PDEVOBJ_vSuspendDirectDraw(ppdev);
+    PDEVOBJ_vSuspendDirectDraw(ppdevTmp);
 
-    /* 7. Switch the PDEVs */
+    /* 6. Switch the PDEVs */
     if (!PDEVOBJ_bDynamicModeChange(ppdev, ppdevTmp))
     {
         DPRINT1("PDEVOBJ_bDynamicModeChange() failed\n");
@@ -671,10 +747,20 @@ PDEVOBJ_bSwitchMode(
         goto leave2;
     }
 
-    /* 8. Disable DirectDraw */
+    /* 7. Resume DirectDraw */
+    PDEVOBJ_vResumeDirectDraw(ppdev);
+    PDEVOBJ_vResumeDirectDraw(ppdevTmp);
+
+    /* 8. Disable DirectDraw for temp PDEV */
+    PDEVOBJ_vDisableDirectDraw(ppdevTmp);
 
+    /* Release temp PDEV */
     PDEVOBJ_vRelease(ppdevTmp);
 
+    /* Initialize DirectDraw PDEVs */
+    ppdev->pEDDgpl->hDev = (HDEV)ppdev;
+    ppdev->pEDDgpl->dhpdev = ppdev->dhpdev;
+
     /* Update primary display capabilities */
     if (ppdev == gpmdev->ppdevGlobal)
     {
@@ -685,6 +771,7 @@ PDEVOBJ_bSwitchMode(
     retval = TRUE;
 
 leave2:
+
     /* Set the new video mode, or restore the original one in case of failure */
     PDEVOBJ_vEnableDisplay(ppdev);
 
diff --git a/win32ss/gdi/eng/pdevobj.h b/win32ss/gdi/eng/pdevobj.h
index 12673ac20f4..058d6840284 100644
--- a/win32ss/gdi/eng/pdevobj.h
+++ b/win32ss/gdi/eng/pdevobj.h
@@ -101,7 +101,7 @@ typedef struct _PDEVOBJ
 //  RFONT *                   prfntInactive;
 //  ULONG                     cInactive;
 //  BYTE                      ajbo[0x5C];
-//  ULONG                     cDirectDrawDisableLocks;
+    ULONG                     cDirectDrawDisableLocks;
 //  PVOID                     TypeOneInfo;
     PVOID                     pvGammaRamp;    /* Gamma ramp pointer. */
     PVOID                     RemoteTypeOne;
@@ -140,7 +140,6 @@ typedef struct _PDEVOBJ
     };
 
     /* ros specific */
-    ULONG         DxDd_nCount;
     GDIPOINTER    Pointer;
     /* Stuff to keep track of software cursors; win32k gdi part */
     UINT SafetyRemoveLevel; /* at what level was the cursor removed?
diff --git a/win32ss/reactx/dxg/ddraw.c b/win32ss/reactx/dxg/ddraw.c
index 1a639a39ef1..12ed339367d 100644
--- a/win32ss/reactx/dxg/ddraw.c
+++ b/win32ss/reactx/dxg/ddraw.c
@@ -563,7 +563,7 @@ DxDdReenableDirectDrawObject(
         gpEngFuncs.DxEngGetDCState(hDC, 2) != 1 &&
         !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_OpenRefs)) &&
         !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_disable)) &&
-        !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_dd_nCount)) &&
+        !(gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_dd_locks)) &&
         gpEngFuncs.DxEngGetHdevData(peDdGl->hDev, DxEGShDevData_DitherFmt) >= BMF_8BPP)
     {
         // reset acceleration and suspend flags
diff --git a/win32ss/reactx/ntddraw/dxeng.c b/win32ss/reactx/ntddraw/dxeng.c
index a096bf5f350..b98f344d3a1 100644
--- a/win32ss/reactx/ntddraw/dxeng.c
+++ b/win32ss/reactx/ntddraw/dxeng.c
@@ -324,9 +324,9 @@ DxEngGetHdevData(HDEV hDev,
         DPRINT1("requested DXEGSHDEVDATA DxEGShDevData_eddg\n");
         retVal = (DWORD_PTR) PDev->pEDDgpl;
         break;
-      case DxEGShDevData_dd_nCount:
-        DPRINT1("requested DXEGSHDEVDATA DxEGShDevData_dd_nCount\n");
-        retVal = (DWORD_PTR) PDev->DxDd_nCount;
+      case DxEGShDevData_dd_locks:
+        DPRINT1("requested DXEGSHDEVDATA DxEGShDevData_dd_locks\n");
+        retVal = (DWORD_PTR) PDev->cDirectDrawDisableLocks;
         break;
       case DxEGShDevData_dd_flags:
         DPRINT1("requested DXEGSHDEVDATA DxEGShDevData_dd_flags\n");
@@ -413,9 +413,10 @@ DxEngSetHdevData(HDEV hDev,
 
     DPRINT1("ReactX Calling : DxEngSetHdevData DXEGSHDEVDATA : %ld\n", Type);
 
-    if ( Type == DxEGShDevData_dd_nCount )
+    if ( Type == DxEGShDevData_dd_locks )
     {
-        ((PPDEVOBJ)hDev)->DxDd_nCount = Data;
+        ((PPDEVOBJ)hDev)->cDirectDrawDisableLocks = Data;
+        DPRINT1("Assinging value %d\n", Data);
         retVal = TRUE; // Set
     }
     return retVal;
@@ -676,11 +677,11 @@ DWORD APIENTRY DxEngScreenAccessCheck(VOID)
 BOOLEAN
 APIENTRY
 DxEngIsHdevLockedByCurrentThread(HDEV hDev)
-{   // Based on EngIsSemaphoreOwnedByCurrentThread w/o the Ex call.
-    PERESOURCE pSem = (PERESOURCE)(((PPDEVOBJ)hDev)->hsemDevLock);
-    return pSem->OwnerEntry.OwnerThread == (ERESOURCE_THREAD)PsGetCurrentThread();
-}
+{
+    DPRINT1("ReactX Calling : DxEngIsHdevLockedByCurrentThread \n");
 
+    return EngIsSemaphoreOwnedByCurrentThread(((PPDEVOBJ)hDev)->hsemDevLock);
+}
 
 /************************************************************************/
 /* DxEngUnreferenceHdev                                                 */
diff --git a/win32ss/reactx/ntddraw/intddraw.h b/win32ss/reactx/ntddraw/intddraw.h
index c1ab8c945b0..bcb725435e6 100644
--- a/win32ss/reactx/ntddraw/intddraw.h
+++ b/win32ss/reactx/ntddraw/intddraw.h
@@ -108,6 +108,11 @@ typedef VOID (APIENTRY *PGD_ENGFREEPRIVATEUSERMEM)(PDD_SURFACE_LOCAL, PVOID);
 typedef PDD_SURFACE_LOCAL (APIENTRY *PGD_ENGLOCKDIRECTDRAWSURFACE)(HANDLE);
 typedef BOOL (APIENTRY *PGD_ENGUNLOCKDIRECTDRAWSURFACE)(PDD_SURFACE_LOCAL);
 
+/* Other internal functions */
+typedef VOID (APIENTRY *PGD_DXDDDYNAMICMODECHANGE)(HDEV, HDEV, ULONG);
+typedef VOID (APIENTRY *PGD_DXDDRESUMEDIRECTDRAW)(HDEV, ULONG);
+typedef VOID (APIENTRY *PGD_DXDDSUSPENDDIRECTDRAW)(HDEV, ULONG);
+
 /* Gammaramp internal prototype */
 BOOL FASTCALL IntGetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp);
 BOOL FASTCALL IntSetDeviceGammaRamp(HDEV hPDev, PGAMMARAMP Ramp, BOOL);
