- 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

svn path=/trunk/; revision=56553
This commit is contained in:
Timo Kreuzer 2012-05-09 20:15:23 +00:00
parent e9fe00d4c8
commit 793a0684d3
4 changed files with 69 additions and 5 deletions

View file

@ -26,3 +26,7 @@ VOID FASTCALL IntGdiReleaseSemaphore ( HSEMAPHORE hsem );
ULONGLONG APIENTRY EngGetTickCount(VOID);
VOID DecompressBitmap(SIZEL Size, BYTE *CompressedBits, BYTE *UncompressedBits, LONG Delta, ULONG iFormat);
HANDLE
APIENTRY
EngSecureMemForRead(PVOID Address, ULONG Length);

View file

@ -157,13 +157,55 @@ HackUnsecureVirtualMemory(
/*
* @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);
}
/*
* @implemented
*/

View file

@ -390,6 +390,24 @@ IntEngStretchBlt(SURFOBJ *psoDest,
/* 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)
{

View file

@ -200,9 +200,9 @@ CreateDIBSection(
dwOffset,
pConvertedInfo,
Usage,
0,
0,
0,
ConvertedInfoSize,
0, // fl
0, // dwColorSpace
&bmBits);
if (BitmapInfo != pConvertedInfo)
RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo);