2004-03-11 21:38:58 +00:00
|
|
|
/*
|
|
|
|
* ReactOS W32 Subsystem
|
|
|
|
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-03-11 21:38:58 +00:00
|
|
|
*/
|
2005-01-06 13:58:04 +00:00
|
|
|
/* $Id$
|
2005-05-08 02:11:54 +00:00
|
|
|
*
|
2004-03-11 21:38:58 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS kernel
|
|
|
|
* PURPOSE: Engine floating point functions
|
|
|
|
* FILE: subsys/win32k/eng/float.c
|
|
|
|
* PROGRAMER: Jason Filby
|
|
|
|
* REVISION HISTORY:
|
|
|
|
*/
|
2005-06-29 07:09:25 +00:00
|
|
|
|
2007-05-14 03:55:28 +00:00
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2004-05-10 17:07:20 +00:00
|
|
|
#include <w32k.h>
|
2004-03-11 21:38:58 +00:00
|
|
|
|
2005-06-29 07:09:25 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
2007-05-14 03:55:28 +00:00
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
2004-03-11 21:38:58 +00:00
|
|
|
BOOL
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2004-03-11 21:38:58 +00:00
|
|
|
EngRestoreFloatingPointState ( IN VOID *Buffer )
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
Status = KeRestoreFloatingPointState((PKFLOATING_SAVE)Buffer);
|
2008-11-03 16:22:44 +00:00
|
|
|
if (!NT_SUCCESS(Status))
|
2004-03-11 21:38:58 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-04-09 20:03:21 +00:00
|
|
|
ULONG
|
2008-11-29 22:48:58 +00:00
|
|
|
APIENTRY
|
2004-03-11 21:38:58 +00:00
|
|
|
EngSaveFloatingPointState(OUT VOID *Buffer,
|
2007-05-15 20:48:58 +00:00
|
|
|
IN ULONG BufferSize)
|
2004-03-11 21:38:58 +00:00
|
|
|
{
|
|
|
|
KFLOATING_SAVE TempBuffer;
|
|
|
|
NTSTATUS Status;
|
|
|
|
if (Buffer == NULL || BufferSize == 0)
|
2005-05-08 02:11:54 +00:00
|
|
|
{
|
2004-03-11 21:38:58 +00:00
|
|
|
/* Check for floating point support. */
|
|
|
|
Status = KeSaveFloatingPointState(&TempBuffer);
|
|
|
|
if (Status != STATUS_SUCCESS)
|
2007-05-15 20:48:58 +00:00
|
|
|
{
|
|
|
|
return(0);
|
|
|
|
}
|
2004-03-11 21:38:58 +00:00
|
|
|
KeRestoreFloatingPointState(&TempBuffer);
|
|
|
|
return(sizeof(KFLOATING_SAVE));
|
|
|
|
}
|
|
|
|
if (BufferSize < sizeof(KFLOATING_SAVE))
|
|
|
|
{
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
Status = KeSaveFloatingPointState((PKFLOATING_SAVE)Buffer);
|
|
|
|
if (!NT_SUCCESS(Status))
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|