1997-03-05 09:22:35 +01:00
|
|
|
/*
|
|
|
|
* Win32 virtual memory functions
|
|
|
|
*
|
|
|
|
* Copyright 1997 Alexandre Julliard
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1997-03-05 09:22:35 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1997-03-05 09:22:35 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
2002-09-17 20:54:42 +02:00
|
|
|
|
2020-05-26 14:57:31 +02:00
|
|
|
#define WINE_NO_INLINE_STRING
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "ntstatus.h"
|
2005-11-28 17:32:54 +01:00
|
|
|
#define WIN32_NO_STATUS
|
2015-03-12 10:39:31 +01:00
|
|
|
#define NONAMELESSUNION
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1997-03-05 09:22:35 +01:00
|
|
|
#include "winbase.h"
|
2003-08-20 20:22:31 +02:00
|
|
|
#include "winnls.h"
|
2002-09-17 20:54:42 +02:00
|
|
|
#include "winternl.h"
|
1997-03-05 09:22:35 +01:00
|
|
|
#include "winerror.h"
|
2011-05-16 15:19:18 +02:00
|
|
|
#include "psapi.h"
|
2002-09-17 20:54:42 +02:00
|
|
|
#include "wine/exception.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1997-03-05 09:22:35 +01:00
|
|
|
|
2005-12-02 16:13:13 +01:00
|
|
|
#include "kernel_private.h"
|
|
|
|
|
2020-05-06 16:24:24 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(seh);
|
2008-11-14 10:49:45 +01:00
|
|
|
|
|
|
|
|
2020-01-13 16:09:53 +01:00
|
|
|
static LONG WINAPI badptr_handler( EXCEPTION_POINTERS *eptr )
|
|
|
|
{
|
|
|
|
EXCEPTION_RECORD *rec = eptr->ExceptionRecord;
|
|
|
|
|
|
|
|
if (rec->ExceptionCode == STATUS_ACCESS_VIOLATION) return EXCEPTION_EXECUTE_HANDLER;
|
|
|
|
if (rec->ExceptionCode == STATUS_STACK_OVERFLOW)
|
|
|
|
{
|
|
|
|
/* restore stack guard page */
|
|
|
|
void *addr = (char *)NtCurrentTeb()->DeallocationStack + system_info.PageSize;
|
|
|
|
SIZE_T size = (char *)rec - (char *)addr;
|
|
|
|
ULONG old_prot;
|
|
|
|
NtProtectVirtualMemory( GetCurrentProcess(), &addr, &size, PAGE_GUARD|PAGE_READWRITE, &old_prot );
|
|
|
|
return EXCEPTION_EXECUTE_HANDLER;
|
|
|
|
}
|
|
|
|
return EXCEPTION_CONTINUE_SEARCH;
|
|
|
|
}
|
|
|
|
|
2002-09-17 20:54:42 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* IsBadReadPtr (KERNEL32.@)
|
|
|
|
*
|
2005-11-08 12:01:03 +01:00
|
|
|
* Check for read access on a memory block.
|
|
|
|
*
|
2006-01-16 20:42:09 +01:00
|
|
|
* ptr [I] Address of memory block.
|
|
|
|
* size [I] Size of block.
|
|
|
|
*
|
2002-09-17 20:54:42 +02:00
|
|
|
* RETURNS
|
2006-01-16 20:42:09 +01:00
|
|
|
* Success: TRUE.
|
|
|
|
* Failure: FALSE. Process has read access to entire block.
|
2002-09-17 20:54:42 +02:00
|
|
|
*/
|
2016-03-01 09:53:31 +01:00
|
|
|
BOOL WINAPI IsBadReadPtr( LPCVOID ptr, UINT_PTR size )
|
2002-09-17 20:54:42 +02:00
|
|
|
{
|
|
|
|
if (!size) return FALSE; /* handle 0 size case w/o reference */
|
2005-03-25 17:38:50 +01:00
|
|
|
if (!ptr) return TRUE;
|
2002-09-17 20:54:42 +02:00
|
|
|
__TRY
|
Release 970415
Mon Apr 14 11:22:54 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/init.c]
Minor changes to help debug problems.
* [if1632/dummy.c] [if1632/gdi.spec]
Dummy routines for StartPage, EndPage, SetAbortProc, AbortProc.
* [misc/printdrv.c] [if1632/gdi.spec] [include/windows.h]
StartDoc16, EndDoc16 new functions.
Sun Apr 13 11:18:35 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [memory/virtual.c]
Implemented MapViewOfFile.
* [debugger/dbg.y]
Added 'info maps' command.
Fri Apr 11 16:34:08 1997 Frans van Dorsselaer <devel@rulhmpc58.LeidenUniv.nl>
* [controls/edit.c] [controls/EDIT.TODO]
Started restructuring. Performance improvements.
Fixed: wordwrap, scrollbar handling, scrolling, painting,
EditWndProc() is now reentrant, wordbreak procs,
better compliance to specs.
New: margins, format rectangle.
* [controls/widgets.c]
Changed the cursor for the edit control class to an I-beam.
* [include/callback.h]
Added 32 bit wordbreak callback.
Mon Apr 7 20:53:28 1997 Albrecht Kleine <kleine@ak.sax.de>
* [objects/metafile.c]
Added handling of some more metafile records:
META_CREATEREGION, META_INVERTREGION etc.
Sat Apr 5 09:23:02 MET DST 1997 Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
* [loader/signal.c]
Define kernel sigaction ourselves instead of getting it
from the kernel source.
Wed Apr 2 21:05:00 1997 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [control/menu.c]
Fix return value range for GetMenuState.
* [files/file.c]
Always fill out ofs->szPathName in FILE_DoOpenFile.
* [memory/string.c]
Add debug option string.
* [objects/cursoricon.c]
Fix return value for DestroyIcon32.
Mon Mar 31 17:16:12 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [DEVELOPERS-HINTS] [misc/*] [windows/*] [graphics/*]
Added description of the source tree. Moved several
files to fit it.
* [misc/shell.c]
Use Win32 heap functions.
1997-04-15 19:19:52 +02:00
|
|
|
{
|
2002-09-17 20:54:42 +02:00
|
|
|
volatile const char *p = ptr;
|
2011-10-28 17:04:33 +02:00
|
|
|
char dummy __attribute__((unused));
|
2016-03-01 09:53:31 +01:00
|
|
|
UINT_PTR count = size;
|
2002-09-17 20:54:42 +02:00
|
|
|
|
2013-01-08 22:02:21 +01:00
|
|
|
while (count > system_info.PageSize)
|
Release 970415
Mon Apr 14 11:22:54 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/init.c]
Minor changes to help debug problems.
* [if1632/dummy.c] [if1632/gdi.spec]
Dummy routines for StartPage, EndPage, SetAbortProc, AbortProc.
* [misc/printdrv.c] [if1632/gdi.spec] [include/windows.h]
StartDoc16, EndDoc16 new functions.
Sun Apr 13 11:18:35 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [memory/virtual.c]
Implemented MapViewOfFile.
* [debugger/dbg.y]
Added 'info maps' command.
Fri Apr 11 16:34:08 1997 Frans van Dorsselaer <devel@rulhmpc58.LeidenUniv.nl>
* [controls/edit.c] [controls/EDIT.TODO]
Started restructuring. Performance improvements.
Fixed: wordwrap, scrollbar handling, scrolling, painting,
EditWndProc() is now reentrant, wordbreak procs,
better compliance to specs.
New: margins, format rectangle.
* [controls/widgets.c]
Changed the cursor for the edit control class to an I-beam.
* [include/callback.h]
Added 32 bit wordbreak callback.
Mon Apr 7 20:53:28 1997 Albrecht Kleine <kleine@ak.sax.de>
* [objects/metafile.c]
Added handling of some more metafile records:
META_CREATEREGION, META_INVERTREGION etc.
Sat Apr 5 09:23:02 MET DST 1997 Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
* [loader/signal.c]
Define kernel sigaction ourselves instead of getting it
from the kernel source.
Wed Apr 2 21:05:00 1997 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [control/menu.c]
Fix return value range for GetMenuState.
* [files/file.c]
Always fill out ofs->szPathName in FILE_DoOpenFile.
* [memory/string.c]
Add debug option string.
* [objects/cursoricon.c]
Fix return value for DestroyIcon32.
Mon Mar 31 17:16:12 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [DEVELOPERS-HINTS] [misc/*] [windows/*] [graphics/*]
Added description of the source tree. Moved several
files to fit it.
* [misc/shell.c]
Use Win32 heap functions.
1997-04-15 19:19:52 +02:00
|
|
|
{
|
2002-09-17 20:54:42 +02:00
|
|
|
dummy = *p;
|
2013-01-08 22:02:21 +01:00
|
|
|
p += system_info.PageSize;
|
|
|
|
count -= system_info.PageSize;
|
Release 970415
Mon Apr 14 11:22:54 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/init.c]
Minor changes to help debug problems.
* [if1632/dummy.c] [if1632/gdi.spec]
Dummy routines for StartPage, EndPage, SetAbortProc, AbortProc.
* [misc/printdrv.c] [if1632/gdi.spec] [include/windows.h]
StartDoc16, EndDoc16 new functions.
Sun Apr 13 11:18:35 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [memory/virtual.c]
Implemented MapViewOfFile.
* [debugger/dbg.y]
Added 'info maps' command.
Fri Apr 11 16:34:08 1997 Frans van Dorsselaer <devel@rulhmpc58.LeidenUniv.nl>
* [controls/edit.c] [controls/EDIT.TODO]
Started restructuring. Performance improvements.
Fixed: wordwrap, scrollbar handling, scrolling, painting,
EditWndProc() is now reentrant, wordbreak procs,
better compliance to specs.
New: margins, format rectangle.
* [controls/widgets.c]
Changed the cursor for the edit control class to an I-beam.
* [include/callback.h]
Added 32 bit wordbreak callback.
Mon Apr 7 20:53:28 1997 Albrecht Kleine <kleine@ak.sax.de>
* [objects/metafile.c]
Added handling of some more metafile records:
META_CREATEREGION, META_INVERTREGION etc.
Sat Apr 5 09:23:02 MET DST 1997 Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
* [loader/signal.c]
Define kernel sigaction ourselves instead of getting it
from the kernel source.
Wed Apr 2 21:05:00 1997 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [control/menu.c]
Fix return value range for GetMenuState.
* [files/file.c]
Always fill out ofs->szPathName in FILE_DoOpenFile.
* [memory/string.c]
Add debug option string.
* [objects/cursoricon.c]
Fix return value for DestroyIcon32.
Mon Mar 31 17:16:12 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [DEVELOPERS-HINTS] [misc/*] [windows/*] [graphics/*]
Added description of the source tree. Moved several
files to fit it.
* [misc/shell.c]
Use Win32 heap functions.
1997-04-15 19:19:52 +02:00
|
|
|
}
|
2002-09-17 20:54:42 +02:00
|
|
|
dummy = p[0];
|
|
|
|
dummy = p[count - 1];
|
Release 970415
Mon Apr 14 11:22:54 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/init.c]
Minor changes to help debug problems.
* [if1632/dummy.c] [if1632/gdi.spec]
Dummy routines for StartPage, EndPage, SetAbortProc, AbortProc.
* [misc/printdrv.c] [if1632/gdi.spec] [include/windows.h]
StartDoc16, EndDoc16 new functions.
Sun Apr 13 11:18:35 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [memory/virtual.c]
Implemented MapViewOfFile.
* [debugger/dbg.y]
Added 'info maps' command.
Fri Apr 11 16:34:08 1997 Frans van Dorsselaer <devel@rulhmpc58.LeidenUniv.nl>
* [controls/edit.c] [controls/EDIT.TODO]
Started restructuring. Performance improvements.
Fixed: wordwrap, scrollbar handling, scrolling, painting,
EditWndProc() is now reentrant, wordbreak procs,
better compliance to specs.
New: margins, format rectangle.
* [controls/widgets.c]
Changed the cursor for the edit control class to an I-beam.
* [include/callback.h]
Added 32 bit wordbreak callback.
Mon Apr 7 20:53:28 1997 Albrecht Kleine <kleine@ak.sax.de>
* [objects/metafile.c]
Added handling of some more metafile records:
META_CREATEREGION, META_INVERTREGION etc.
Sat Apr 5 09:23:02 MET DST 1997 Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
* [loader/signal.c]
Define kernel sigaction ourselves instead of getting it
from the kernel source.
Wed Apr 2 21:05:00 1997 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [control/menu.c]
Fix return value range for GetMenuState.
* [files/file.c]
Always fill out ofs->szPathName in FILE_DoOpenFile.
* [memory/string.c]
Add debug option string.
* [objects/cursoricon.c]
Fix return value for DestroyIcon32.
Mon Mar 31 17:16:12 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [DEVELOPERS-HINTS] [misc/*] [windows/*] [graphics/*]
Added description of the source tree. Moved several
files to fit it.
* [misc/shell.c]
Use Win32 heap functions.
1997-04-15 19:19:52 +02:00
|
|
|
}
|
2020-01-13 16:09:53 +01:00
|
|
|
__EXCEPT( badptr_handler )
|
2005-03-22 22:16:39 +01:00
|
|
|
{
|
2020-05-06 16:24:24 +02:00
|
|
|
TRACE("%p caused page fault during read\n", ptr);
|
2005-03-22 22:16:39 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
2002-09-17 20:54:42 +02:00
|
|
|
__ENDTRY
|
|
|
|
return FALSE;
|
|
|
|
}
|
Release 970415
Mon Apr 14 11:22:54 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/init.c]
Minor changes to help debug problems.
* [if1632/dummy.c] [if1632/gdi.spec]
Dummy routines for StartPage, EndPage, SetAbortProc, AbortProc.
* [misc/printdrv.c] [if1632/gdi.spec] [include/windows.h]
StartDoc16, EndDoc16 new functions.
Sun Apr 13 11:18:35 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [memory/virtual.c]
Implemented MapViewOfFile.
* [debugger/dbg.y]
Added 'info maps' command.
Fri Apr 11 16:34:08 1997 Frans van Dorsselaer <devel@rulhmpc58.LeidenUniv.nl>
* [controls/edit.c] [controls/EDIT.TODO]
Started restructuring. Performance improvements.
Fixed: wordwrap, scrollbar handling, scrolling, painting,
EditWndProc() is now reentrant, wordbreak procs,
better compliance to specs.
New: margins, format rectangle.
* [controls/widgets.c]
Changed the cursor for the edit control class to an I-beam.
* [include/callback.h]
Added 32 bit wordbreak callback.
Mon Apr 7 20:53:28 1997 Albrecht Kleine <kleine@ak.sax.de>
* [objects/metafile.c]
Added handling of some more metafile records:
META_CREATEREGION, META_INVERTREGION etc.
Sat Apr 5 09:23:02 MET DST 1997 Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
* [loader/signal.c]
Define kernel sigaction ourselves instead of getting it
from the kernel source.
Wed Apr 2 21:05:00 1997 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [control/menu.c]
Fix return value range for GetMenuState.
* [files/file.c]
Always fill out ofs->szPathName in FILE_DoOpenFile.
* [memory/string.c]
Add debug option string.
* [objects/cursoricon.c]
Fix return value for DestroyIcon32.
Mon Mar 31 17:16:12 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [DEVELOPERS-HINTS] [misc/*] [windows/*] [graphics/*]
Added description of the source tree. Moved several
files to fit it.
* [misc/shell.c]
Use Win32 heap functions.
1997-04-15 19:19:52 +02:00
|
|
|
|
2001-10-09 23:50:44 +02:00
|
|
|
|
2002-09-17 20:54:42 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* IsBadWritePtr (KERNEL32.@)
|
|
|
|
*
|
2005-11-08 12:01:03 +01:00
|
|
|
* Check for write access on a memory block.
|
|
|
|
*
|
2006-01-16 20:42:09 +01:00
|
|
|
* PARAMS
|
|
|
|
* ptr [I] Address of memory block.
|
|
|
|
* size [I] Size of block in bytes.
|
|
|
|
*
|
2002-09-17 20:54:42 +02:00
|
|
|
* RETURNS
|
2006-01-16 20:42:09 +01:00
|
|
|
* Success: TRUE.
|
|
|
|
* Failure: FALSE. Process has write access to entire block.
|
2002-09-17 20:54:42 +02:00
|
|
|
*/
|
2016-03-01 09:53:31 +01:00
|
|
|
BOOL WINAPI IsBadWritePtr( LPVOID ptr, UINT_PTR size )
|
2002-09-17 20:54:42 +02:00
|
|
|
{
|
|
|
|
if (!size) return FALSE; /* handle 0 size case w/o reference */
|
2005-03-25 17:38:50 +01:00
|
|
|
if (!ptr) return TRUE;
|
2002-09-17 20:54:42 +02:00
|
|
|
__TRY
|
|
|
|
{
|
|
|
|
volatile char *p = ptr;
|
2016-03-01 09:53:31 +01:00
|
|
|
UINT_PTR count = size;
|
2001-10-09 23:50:44 +02:00
|
|
|
|
2013-01-08 22:02:21 +01:00
|
|
|
while (count > system_info.PageSize)
|
2002-09-17 20:54:42 +02:00
|
|
|
{
|
|
|
|
*p |= 0;
|
2013-01-08 22:02:21 +01:00
|
|
|
p += system_info.PageSize;
|
|
|
|
count -= system_info.PageSize;
|
2002-09-17 20:54:42 +02:00
|
|
|
}
|
|
|
|
p[0] |= 0;
|
|
|
|
p[count - 1] |= 0;
|
|
|
|
}
|
2020-01-13 16:09:53 +01:00
|
|
|
__EXCEPT( badptr_handler )
|
2005-03-22 22:16:39 +01:00
|
|
|
{
|
2020-05-06 16:24:24 +02:00
|
|
|
TRACE("%p caused page fault during write\n", ptr);
|
2005-03-22 22:16:39 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
2002-09-17 20:54:42 +02:00
|
|
|
__ENDTRY
|
|
|
|
return FALSE;
|
|
|
|
}
|
Release 970415
Mon Apr 14 11:22:54 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/init.c]
Minor changes to help debug problems.
* [if1632/dummy.c] [if1632/gdi.spec]
Dummy routines for StartPage, EndPage, SetAbortProc, AbortProc.
* [misc/printdrv.c] [if1632/gdi.spec] [include/windows.h]
StartDoc16, EndDoc16 new functions.
Sun Apr 13 11:18:35 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [memory/virtual.c]
Implemented MapViewOfFile.
* [debugger/dbg.y]
Added 'info maps' command.
Fri Apr 11 16:34:08 1997 Frans van Dorsselaer <devel@rulhmpc58.LeidenUniv.nl>
* [controls/edit.c] [controls/EDIT.TODO]
Started restructuring. Performance improvements.
Fixed: wordwrap, scrollbar handling, scrolling, painting,
EditWndProc() is now reentrant, wordbreak procs,
better compliance to specs.
New: margins, format rectangle.
* [controls/widgets.c]
Changed the cursor for the edit control class to an I-beam.
* [include/callback.h]
Added 32 bit wordbreak callback.
Mon Apr 7 20:53:28 1997 Albrecht Kleine <kleine@ak.sax.de>
* [objects/metafile.c]
Added handling of some more metafile records:
META_CREATEREGION, META_INVERTREGION etc.
Sat Apr 5 09:23:02 MET DST 1997 Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
* [loader/signal.c]
Define kernel sigaction ourselves instead of getting it
from the kernel source.
Wed Apr 2 21:05:00 1997 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [control/menu.c]
Fix return value range for GetMenuState.
* [files/file.c]
Always fill out ofs->szPathName in FILE_DoOpenFile.
* [memory/string.c]
Add debug option string.
* [objects/cursoricon.c]
Fix return value for DestroyIcon32.
Mon Mar 31 17:16:12 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [DEVELOPERS-HINTS] [misc/*] [windows/*] [graphics/*]
Added description of the source tree. Moved several
files to fit it.
* [misc/shell.c]
Use Win32 heap functions.
1997-04-15 19:19:52 +02:00
|
|
|
|
|
|
|
|
2002-09-17 20:54:42 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* IsBadHugeReadPtr (KERNEL32.@)
|
2005-11-08 12:01:03 +01:00
|
|
|
*
|
|
|
|
* Check for read access on a memory block.
|
|
|
|
*
|
2006-01-16 20:42:09 +01:00
|
|
|
* PARAMS
|
|
|
|
* ptr [I] Address of memory block.
|
|
|
|
* size [I] Size of block.
|
|
|
|
*
|
2002-09-17 20:54:42 +02:00
|
|
|
* RETURNS
|
2006-01-16 20:42:09 +01:00
|
|
|
* Success: TRUE.
|
|
|
|
* Failure: FALSE. Process has read access to entire block.
|
2002-09-17 20:54:42 +02:00
|
|
|
*/
|
2016-03-01 09:53:31 +01:00
|
|
|
BOOL WINAPI IsBadHugeReadPtr( LPCVOID ptr, UINT_PTR size )
|
2006-01-16 20:42:09 +01:00
|
|
|
{
|
2002-09-17 20:54:42 +02:00
|
|
|
return IsBadReadPtr( ptr, size );
|
|
|
|
}
|
Release 970415
Mon Apr 14 11:22:54 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/init.c]
Minor changes to help debug problems.
* [if1632/dummy.c] [if1632/gdi.spec]
Dummy routines for StartPage, EndPage, SetAbortProc, AbortProc.
* [misc/printdrv.c] [if1632/gdi.spec] [include/windows.h]
StartDoc16, EndDoc16 new functions.
Sun Apr 13 11:18:35 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [memory/virtual.c]
Implemented MapViewOfFile.
* [debugger/dbg.y]
Added 'info maps' command.
Fri Apr 11 16:34:08 1997 Frans van Dorsselaer <devel@rulhmpc58.LeidenUniv.nl>
* [controls/edit.c] [controls/EDIT.TODO]
Started restructuring. Performance improvements.
Fixed: wordwrap, scrollbar handling, scrolling, painting,
EditWndProc() is now reentrant, wordbreak procs,
better compliance to specs.
New: margins, format rectangle.
* [controls/widgets.c]
Changed the cursor for the edit control class to an I-beam.
* [include/callback.h]
Added 32 bit wordbreak callback.
Mon Apr 7 20:53:28 1997 Albrecht Kleine <kleine@ak.sax.de>
* [objects/metafile.c]
Added handling of some more metafile records:
META_CREATEREGION, META_INVERTREGION etc.
Sat Apr 5 09:23:02 MET DST 1997 Sven Verdoolaege <skimo@breughel.ufsia.ac.be>
* [loader/signal.c]
Define kernel sigaction ourselves instead of getting it
from the kernel source.
Wed Apr 2 21:05:00 1997 Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de>
* [control/menu.c]
Fix return value range for GetMenuState.
* [files/file.c]
Always fill out ofs->szPathName in FILE_DoOpenFile.
* [memory/string.c]
Add debug option string.
* [objects/cursoricon.c]
Fix return value for DestroyIcon32.
Mon Mar 31 17:16:12 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [DEVELOPERS-HINTS] [misc/*] [windows/*] [graphics/*]
Added description of the source tree. Moved several
files to fit it.
* [misc/shell.c]
Use Win32 heap functions.
1997-04-15 19:19:52 +02:00
|
|
|
|
|
|
|
|
2002-09-17 20:54:42 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* IsBadHugeWritePtr (KERNEL32.@)
|
2005-11-08 12:01:03 +01:00
|
|
|
*
|
|
|
|
* Check for write access on a memory block.
|
|
|
|
*
|
2006-01-16 20:42:09 +01:00
|
|
|
* PARAMS
|
|
|
|
* ptr [I] Address of memory block.
|
|
|
|
* size [I] Size of block.
|
|
|
|
*
|
2002-09-17 20:54:42 +02:00
|
|
|
* RETURNS
|
2006-01-16 20:42:09 +01:00
|
|
|
* Success: TRUE.
|
|
|
|
* Failure: FALSE. Process has write access to entire block.
|
2002-09-17 20:54:42 +02:00
|
|
|
*/
|
2016-03-01 09:53:31 +01:00
|
|
|
BOOL WINAPI IsBadHugeWritePtr( LPVOID ptr, UINT_PTR size )
|
2006-01-16 20:42:09 +01:00
|
|
|
{
|
2002-09-17 20:54:42 +02:00
|
|
|
return IsBadWritePtr( ptr, size );
|
1997-03-05 09:22:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1997-11-30 18:45:40 +01:00
|
|
|
/***********************************************************************
|
2002-09-17 20:54:42 +02:00
|
|
|
* IsBadCodePtr (KERNEL32.@)
|
1998-03-15 21:29:56 +01:00
|
|
|
*
|
2005-11-08 12:01:03 +01:00
|
|
|
* Check for read access on a memory address.
|
|
|
|
*
|
2006-01-16 20:42:09 +01:00
|
|
|
* PARAMS
|
|
|
|
* ptr [I] Address of function.
|
|
|
|
*
|
1998-03-15 21:29:56 +01:00
|
|
|
* RETURNS
|
2006-01-16 20:42:09 +01:00
|
|
|
* Success: TRUE.
|
|
|
|
* Failure: FALSE. Process has read access to specified memory.
|
1997-11-30 18:45:40 +01:00
|
|
|
*/
|
2006-01-16 20:42:09 +01:00
|
|
|
BOOL WINAPI IsBadCodePtr( FARPROC ptr )
|
2002-09-17 20:54:42 +02:00
|
|
|
{
|
|
|
|
return IsBadReadPtr( ptr, 1 );
|
|
|
|
}
|
1997-11-30 18:45:40 +01:00
|
|
|
|
|
|
|
|
2002-09-17 20:54:42 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* IsBadStringPtrA (KERNEL32.@)
|
|
|
|
*
|
2005-11-08 12:01:03 +01:00
|
|
|
* Check for read access on a range of memory pointed to by a string pointer.
|
|
|
|
*
|
2006-01-16 20:42:09 +01:00
|
|
|
* PARAMS
|
|
|
|
* str [I] Address of string.
|
|
|
|
* max [I] Maximum size of string.
|
|
|
|
*
|
2002-09-17 20:54:42 +02:00
|
|
|
* RETURNS
|
2006-01-16 20:42:09 +01:00
|
|
|
* Success: TRUE.
|
|
|
|
* Failure: FALSE. Read access to all bytes in string.
|
2002-09-17 20:54:42 +02:00
|
|
|
*/
|
2016-03-01 09:53:31 +01:00
|
|
|
BOOL WINAPI IsBadStringPtrA( LPCSTR str, UINT_PTR max )
|
2002-09-17 20:54:42 +02:00
|
|
|
{
|
2005-03-25 17:38:50 +01:00
|
|
|
if (!str) return TRUE;
|
2020-01-13 16:09:53 +01:00
|
|
|
|
2002-09-17 20:54:42 +02:00
|
|
|
__TRY
|
1997-11-30 18:45:40 +01:00
|
|
|
{
|
2002-09-17 20:54:42 +02:00
|
|
|
volatile const char *p = str;
|
|
|
|
while (p != str + max) if (!*p++) break;
|
1997-11-30 18:45:40 +01:00
|
|
|
}
|
2020-01-13 16:09:53 +01:00
|
|
|
__EXCEPT( badptr_handler )
|
2005-03-22 22:16:39 +01:00
|
|
|
{
|
2020-05-06 16:24:24 +02:00
|
|
|
TRACE("%p caused page fault during read\n", str);
|
2005-03-22 22:16:39 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
2002-09-17 20:54:42 +02:00
|
|
|
__ENDTRY
|
1997-11-30 18:45:40 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
1998-03-15 21:29:56 +01:00
|
|
|
|
1998-03-29 21:44:57 +02:00
|
|
|
|
1997-03-05 09:22:35 +01:00
|
|
|
/***********************************************************************
|
2002-09-17 20:54:42 +02:00
|
|
|
* IsBadStringPtrW (KERNEL32.@)
|
2006-01-16 20:42:09 +01:00
|
|
|
*
|
2005-11-08 12:01:03 +01:00
|
|
|
* See IsBadStringPtrA.
|
1997-03-05 09:22:35 +01:00
|
|
|
*/
|
2016-03-01 09:53:31 +01:00
|
|
|
BOOL WINAPI IsBadStringPtrW( LPCWSTR str, UINT_PTR max )
|
2002-09-17 20:54:42 +02:00
|
|
|
{
|
2005-03-25 17:38:50 +01:00
|
|
|
if (!str) return TRUE;
|
2020-01-13 16:09:53 +01:00
|
|
|
|
2002-09-17 20:54:42 +02:00
|
|
|
__TRY
|
1997-03-05 09:22:35 +01:00
|
|
|
{
|
2002-09-17 20:54:42 +02:00
|
|
|
volatile const WCHAR *p = str;
|
|
|
|
while (p != str + max) if (!*p++) break;
|
1997-03-05 09:22:35 +01:00
|
|
|
}
|
2020-01-13 16:09:53 +01:00
|
|
|
__EXCEPT( badptr_handler )
|
2005-03-22 22:16:39 +01:00
|
|
|
{
|
2020-05-06 16:24:24 +02:00
|
|
|
TRACE("%p caused page fault during read\n", str);
|
2005-03-22 22:16:39 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
2002-09-17 20:54:42 +02:00
|
|
|
__ENDTRY
|
|
|
|
return FALSE;
|
1997-03-05 09:22:35 +01:00
|
|
|
}
|
2020-05-26 14:57:31 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* lstrcatA (KERNEL32.@)
|
|
|
|
* lstrcat (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
LPSTR WINAPI lstrcatA( LPSTR dst, LPCSTR src )
|
|
|
|
{
|
|
|
|
__TRY
|
|
|
|
{
|
|
|
|
strcat( dst, src );
|
|
|
|
}
|
|
|
|
__EXCEPT( badptr_handler )
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
__ENDTRY
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* lstrcatW (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
LPWSTR WINAPI lstrcatW( LPWSTR dst, LPCWSTR src )
|
|
|
|
{
|
|
|
|
__TRY
|
|
|
|
{
|
2020-09-28 16:34:11 +02:00
|
|
|
wcscat( dst, src );
|
2020-05-26 14:57:31 +02:00
|
|
|
}
|
|
|
|
__EXCEPT( badptr_handler )
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
__ENDTRY
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* lstrcpyA (KERNEL32.@)
|
|
|
|
* lstrcpy (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
LPSTR WINAPI lstrcpyA( LPSTR dst, LPCSTR src )
|
|
|
|
{
|
|
|
|
__TRY
|
|
|
|
{
|
|
|
|
/* this is how Windows does it */
|
|
|
|
memmove( dst, src, strlen(src)+1 );
|
|
|
|
}
|
|
|
|
__EXCEPT( badptr_handler )
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
__ENDTRY
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* lstrcpyW (KERNEL32.@)
|
|
|
|
*/
|
|
|
|
LPWSTR WINAPI lstrcpyW( LPWSTR dst, LPCWSTR src )
|
|
|
|
{
|
|
|
|
__TRY
|
|
|
|
{
|
2020-09-28 16:34:11 +02:00
|
|
|
wcscpy( dst, src );
|
2020-05-26 14:57:31 +02:00
|
|
|
}
|
|
|
|
__EXCEPT( badptr_handler )
|
|
|
|
{
|
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
__ENDTRY
|
|
|
|
return dst;
|
|
|
|
}
|