Author: tkreuzer
Date: Wed May 9 20:15:23 2012
New Revision: 56553
URL:
http://svn.reactos.org/svn/reactos?rev=56553&view=rev
Log:
[WIN32K]
- Make EngSecureMem probe the buffer, so we have at least a minimum functionality, even
though it's not safe
- Implement EngSecureMemForRead
- Use IntEngBitBlt from IntEngStretchBlt, when source and dest size are equal
Modified:
trunk/reactos/win32ss/gdi/eng/eng.h
trunk/reactos/win32ss/gdi/eng/mem.c
trunk/reactos/win32ss/gdi/eng/stretchblt.c
trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c
Modified: trunk/reactos/win32ss/gdi/eng/eng.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/eng.h?rev=…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/eng.h [iso-8859-1] Wed May 9 20:15:23 2012
@@ -26,3 +26,7 @@
ULONGLONG APIENTRY EngGetTickCount(VOID);
VOID DecompressBitmap(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG
Delta, ULONG iFormat);
+
+HANDLE
+APIENTRY
+EngSecureMemForRead(PVOID Address, ULONG Length);
Modified: trunk/reactos/win32ss/gdi/eng/mem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/mem.c?rev=…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/mem.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/mem.c [iso-8859-1] Wed May 9 20:15:23 2012
@@ -157,11 +157,53 @@
/*
* @implemented
*/
-HANDLE APIENTRY
+HANDLE
+APIENTRY
EngSecureMem(PVOID Address, ULONG Length)
{
- return (HANDLE)-1; // HACK!!!
+ {// HACK!!!
+ _SEH2_TRY
+ {
+ ProbeForWrite(Address, Length, 1);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ _SEH2_YIELD(return NULL);
+ }
+ _SEH2_END;
+ return (HANDLE)-1;
+ }
return MmSecureVirtualMemory(Address, Length, PAGE_READWRITE);
+}
+
+HANDLE
+APIENTRY
+EngSecureMemForRead(PVOID Address, ULONG Length)
+{
+ {// HACK!!!
+ ULONG cPages;
+ volatile BYTE *pjProbe;
+
+ _SEH2_TRY
+ {
+ ProbeForRead(Address, Length, 1);
+ cPages = ADDRESS_AND_SIZE_TO_SPAN_PAGES(Address, Length);
+ pjProbe = ALIGN_DOWN_POINTER_BY(Address, PAGE_SIZE);
+ while(cPages--)
+ {
+ /* Do a read probe */
+ (void)*pjProbe;
+ pjProbe += PAGE_SIZE;
+ }
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ _SEH2_YIELD(return NULL);
+ }
+ _SEH2_END;
+ return (HANDLE)-1;
+ }
+ return MmSecureVirtualMemory(Address, Length, PAGE_READONLY);
}
/*
Modified: trunk/reactos/win32ss/gdi/eng/stretchblt.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/stretchblt…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/stretchblt.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/stretchblt.c [iso-8859-1] Wed May 9 20:15:23 2012
@@ -390,6 +390,24 @@
/* Sanity check */
ASSERT(IS_VALID_ROP4(Rop4));
+ /* Check if source and dest size are equal */
+ if (((DestRect->right - DestRect->left) == (SourceRect->right -
SourceRect->left)) &&
+ ((DestRect->bottom - DestRect->top) == (SourceRect->bottom -
SourceRect->top)))
+ {
+ /* Pass the request to IntEngBitBlt */
+ return IntEngBitBlt(psoDest,
+ psoSource,
+ MaskSurf,
+ ClipRegion,
+ ColorTranslation,
+ DestRect,
+ (PPOINTL)SourceRect,
+ pMaskOrigin,
+ pbo,
+ BrushOrigin,
+ Rop4);
+ }
+
InputClippedRect = *DestRect;
if (InputClippedRect.right < InputClippedRect.left)
{
Modified: trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/gdi32/objects/…
==============================================================================
--- trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/gdi32/objects/bitmap.c [iso-8859-1] Wed May 9 20:15:23
2012
@@ -200,9 +200,9 @@
dwOffset,
pConvertedInfo,
Usage,
- 0,
- 0,
- 0,
+ ConvertedInfoSize,
+ 0, // fl
+ 0, // dwColorSpace
&bmBits);
if (BitmapInfo != pConvertedInfo)
RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo);