[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ros-dev
Subject:    [ros-dev] DC_ATTR with DCE
From:       James Tabor <jimtabor () adsl-64-217-116-74 ! dsl ! hstntx ! swbell ! net>
Date:       2007-10-13 0:57:10
Message-ID: 471017E6.2090506 () adsl-64-217-116-74 ! dsl ! hstntx ! swbell ! net
[Download RAW message or body]

Hi All!

(subsystems\win32\win32k\ntuser\windc.c:156) FREE DCATTR!!!! NOT DCE_WINDOW_DC!!!!! hDC-> 6010078
(subsystems\win32\win32k\objects\dc.c:2549) DC_FreeDC DC_ATTR 0x2d80000
(subsystems\win32\win32k\ntuser\windc.c:551) ENTER!!!!!! DCX_CACHE!!!!!!   hDC-> 6010078
(subsystems\win32\win32k\ntuser\windc.c:272) Exit!!!!! DCX_CACHE!!!!!!   hDC-> 6010078
(subsystems\win32\win32k\objects\dc.c:2549) DC_FreeDC DC_ATTR 0x1020000
(subsystems\win32\win32k\ntuser\windc.c:156) FREE DCATTR!!!! NOT DCE_WINDOW_DC!!!!! hDC-> 14010092
(subsystems\win32\win32k\objects\dc.c:2549) DC_FreeDC DC_ATTR 0x1030000
(subsystems\win32\win32k\ntuser\windc.c:551) ENTER!!!!!! DCX_CACHE!!!!!!   hDC-> 14010092
(subsystems\win32\win32k\ntuser\windc.c:272) Exit!!!!! DCX_CACHE!!!!!!   hDC-> 14010092
(subsystems\win32\win32k\ntuser\windc.c:551) ENTER!!!!!! DCX_CACHE!!!!!!   hDC-> 14010092
(subsystems\win32\win32k\ntuser\windc.c:272) Exit!!!!! DCX_CACHE!!!!!!   hDC-> 14010092

Problem, Two Window DCE with DC objects are created and used through out the whole system and the 
ownership was passed to NULL for both DC objects. The dcattr, allocated and ownership belongs to the 
original process. So when testing the dcattr in user mode, creates user exception faults.

DC object one: 6010078 and object two: 14010092.

The Fix:

First, I free the "non owned window (DCX_CACHE) DCE DC" dcattr before the DC is placed in 
"inaccessible mode" so the ownership of the dcattr is not lost. All traces of ownership comes from 
the DC handle information. Once it is set NULL it is lost.

Second, I display the "Enter" (GetDCx) and "Exit" (ReleaseDC) for non owned window DCE DC. I'm doing 
this so I can trace it out.

and,,,....

For DCX_CACHE DCE: ENTER "Get" allocate a new dcattr for the current process. EXIT "Release" free 
the dcattr for that process. Windows does something similar to this.

Here is the patches,,, The test is: click on the time clock at the bottom right. Click on adjust 
time and date. There you go.... the Gdi patch allows access to the dcattr pen for the DCE DC now.

It works,,,,, Thanks, James

subsystems/win32/win32k:
Index: ntuser/windc.c
===================================================================
--- ntuser/windc.c      (revision 29544)
+++ ntuser/windc.c      (working copy)
@@ -153,6 +153,8 @@
       }
      else
      {
+       DPRINT1("FREE DCATTR!!!! NOT DCE_WINDOW_DC!!!!! hDC-> %x\n", pDce->hDC);
+       DC_FreeDcAttr(pDce->hDC,  NULL);  // Free the dcattr!
         DC_SetOwnership(pDce->hDC, NULL); // This hDC is inaccessible!
      }

@@ -267,6 +269,9 @@
           dce->DCXFlags |= DCX_DCEEMPTY;
         }
       }
+     DPRINT1("Exit!!!!! DCX_CACHE!!!!!!   hDC-> %x \n", dce->hDC);
+     DC_FreeDcAttr(dce->hDC,  NULL);  // Free the dcattr!
+     DC_SetOwnership(dce->hDC, NULL);
     }
     return 1;
  }
@@ -543,6 +548,14 @@
        DceUpdateVisRgn(Dce, Window, Flags);
     }

+   if (Dce->DCXFlags & DCX_CACHE)
+   {
+      DPRINT1("ENTER!!!!!! DCX_CACHE!!!!!!   hDC-> %x\n", Dce->hDC);
+      DC_SetOwnership( Dce->hDC, PsGetCurrentProcess());
+      DC_AllocateDcAttr( Dce->hDC, NULL);
+      DCU_SynchDcAttrtoUser( Dce->hDC, -1);  // Copy data from dc to dcattr
+//      Dce->pProcess = PsGetCurrentProcess();
+   }
     return(Dce->hDC);
  }

dll/win32/gdi32:
Index: dc.c
===================================================================
--- dc.c        (revision 29544)
+++ dc.c        (working copy)
@@ -320,7 +320,7 @@
  STDCALL
  GetDCObject( HDC hDC, INT iType)
  {
-#if 0
+//#if 0
   if((iType == GDI_OBJECT_TYPE_BRUSH) ||
      (iType == GDI_OBJECT_TYPE_EXTPEN)||
      (iType == GDI_OBJECT_TYPE_PEN)   ||
@@ -348,7 +348,7 @@
     }
     return hGO;
   }
-#endif
+//#endif
   return NtGdiGetDCObject( hDC, iType );
  }
_______________________________________________
Ros-dev mailing list
Ros-dev@reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic