mirror of
https://github.com/reactos/reactos.git
synced 2024-07-12 07:35:10 +00:00
fix bug in NtGdiExtEscape - not checking for NULL == DriverFunctions.Escape.
also added buffer copying. svn path=/trunk/; revision=8243
This commit is contained in:
parent
d406d24f29
commit
14f2cc4e3b
|
@ -16,13 +16,15 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: print.c,v 1.12 2004/02/08 16:16:24 navaraf Exp $ */
|
/* $Id: print.c,v 1.13 2004/02/18 02:37:18 royce Exp $ */
|
||||||
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <win32k/print.h>
|
#include <win32k/print.h>
|
||||||
#include <win32k/dc.h>
|
#include <win32k/dc.h>
|
||||||
|
#include <include/error.h>
|
||||||
|
#include <internal/safe.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <win32k/debug1.h>
|
#include <win32k/debug1.h>
|
||||||
|
@ -59,33 +61,124 @@ NtGdiEscape(HDC hDC,
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT STDCALL
|
INT
|
||||||
NtGdiExtEscape(
|
STDCALL
|
||||||
HDC hDC,
|
IntEngExtEscape(
|
||||||
INT Escape,
|
HSURF Surface,
|
||||||
INT InSize,
|
INT Escape,
|
||||||
LPCSTR InData,
|
INT InSize,
|
||||||
INT OutSize,
|
LPVOID InData,
|
||||||
LPSTR OutData)
|
INT OutSize,
|
||||||
|
LPVOID OutData)
|
||||||
{
|
{
|
||||||
PDC pDC = DC_LockDc(hDC);
|
UNIMPLEMENTED;
|
||||||
INT Result;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (pDC == NULL)
|
INT
|
||||||
|
STDCALL
|
||||||
|
IntGdiExtEscape(
|
||||||
|
PDC dc,
|
||||||
|
INT Escape,
|
||||||
|
INT InSize,
|
||||||
|
LPCSTR InData,
|
||||||
|
INT OutSize,
|
||||||
|
LPSTR OutData)
|
||||||
|
{
|
||||||
|
if ( NULL == dc->DriverFunctions.Escape )
|
||||||
{
|
{
|
||||||
|
return IntEngExtEscape(
|
||||||
|
dc->Surface,
|
||||||
|
Escape,
|
||||||
|
InSize,
|
||||||
|
(PVOID)InData,
|
||||||
|
OutSize,
|
||||||
|
(PVOID)OutData);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return dc->DriverFunctions.Escape(
|
||||||
|
dc->Surface,
|
||||||
|
Escape,
|
||||||
|
InSize,
|
||||||
|
(PVOID)InData,
|
||||||
|
OutSize,
|
||||||
|
(PVOID)OutData );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
INT
|
||||||
|
STDCALL
|
||||||
|
NtGdiExtEscape(
|
||||||
|
HDC hDC,
|
||||||
|
INT Escape,
|
||||||
|
INT InSize,
|
||||||
|
LPCSTR UnsafeInData,
|
||||||
|
INT OutSize,
|
||||||
|
LPSTR UnsafeOutData)
|
||||||
|
{
|
||||||
|
PDC pDC = DC_LockDc(hDC);
|
||||||
|
LPVOID SafeInData = NULL;
|
||||||
|
LPVOID SafeOutData = NULL;
|
||||||
|
NTSTATUS Status;
|
||||||
|
INT Result;
|
||||||
|
|
||||||
|
if ( pDC == NULL )
|
||||||
|
{
|
||||||
|
SetLastWin32Error(ERROR_INVALID_HANDLE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result = pDC->DriverFunctions.Escape(
|
if ( InSize && UnsafeInData )
|
||||||
pDC->Surface,
|
{
|
||||||
Escape,
|
SafeInData = ExAllocatePool ( NonPagedPool, InSize );
|
||||||
InSize,
|
if ( !SafeInData )
|
||||||
(PVOID)InData,
|
{
|
||||||
OutSize,
|
DC_UnlockDc(hDC);
|
||||||
(PVOID)OutData);
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
Status = MmCopyFromCaller ( SafeInData, UnsafeInData, InSize );
|
||||||
|
if ( !NT_SUCCESS(Status) )
|
||||||
|
{
|
||||||
|
ExFreePool ( SafeInData );
|
||||||
|
DC_UnlockDc(hDC);
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( OutSize && UnsafeOutData )
|
||||||
|
{
|
||||||
|
SafeOutData = ExAllocatePool ( NonPagedPool, OutSize );
|
||||||
|
if ( !SafeOutData )
|
||||||
|
{
|
||||||
|
if ( SafeInData )
|
||||||
|
ExFreePool ( SafeInData );
|
||||||
|
DC_UnlockDc(hDC);
|
||||||
|
SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = IntGdiExtEscape ( pDC, Escape, InSize, SafeInData, OutSize, SafeOutData );
|
||||||
|
|
||||||
DC_UnlockDc(hDC);
|
DC_UnlockDc(hDC);
|
||||||
|
|
||||||
|
if ( SafeInData )
|
||||||
|
ExFreePool ( SafeInData );
|
||||||
|
|
||||||
|
if ( SafeOutData )
|
||||||
|
{
|
||||||
|
Status = MmCopyToCaller ( UnsafeOutData, SafeOutData, OutSize );
|
||||||
|
ExFreePool ( SafeOutData );
|
||||||
|
if ( !NT_SUCCESS(Status) )
|
||||||
|
{
|
||||||
|
SetLastNtError(Status);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue