107 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			107 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
//
 | 
						|
// DEBUGPP.CPP
 | 
						|
//
 | 
						|
//  Source file for ArchiveLib 2.0
 | 
						|
//
 | 
						|
//  Copyright (c) Greenleaf Software, Inc. 1994-1996
 | 
						|
//  All Rights Reserved
 | 
						|
//
 | 
						|
// CONTENTS
 | 
						|
//
 | 
						|
//  IsBadWritePtr()
 | 
						|
//
 | 
						|
// REVISION HISTORY
 | 
						|
//
 | 
						|
//   February 14, 1996  2.0A : New release
 | 
						|
 | 
						|
#include "arclib.h"
 | 
						|
#if !defined( AL_IBM )
 | 
						|
#pragma hdrstop
 | 
						|
#endif
 | 
						|
 | 
						|
#include <windows.h>
 | 
						|
 | 
						|
//
 | 
						|
// NAME
 | 
						|
//
 | 
						|
//  IsBadWritePtr()
 | 
						|
//
 | 
						|
// PLATFORMS/ENVIRONMENTS
 | 
						|
//
 | 
						|
//  Windows
 | 
						|
//  C++  C
 | 
						|
//
 | 
						|
// SHORT DESCRIPTION
 | 
						|
//
 | 
						|
//  Test the validity of a pointer.
 | 
						|
//
 | 
						|
// C++ SYNOPSIS
 | 
						|
//
 | 
						|
//  #include "arclib.h"
 | 
						|
//
 | 
						|
//  BOOL WINAPI AL_CLASS_TYPE IsBadWritePtr( void FAR *lp, UINT cb );
 | 
						|
//
 | 
						|
// C SYNOPSIS
 | 
						|
//
 | 
						|
//  #include "arclib.h"
 | 
						|
//
 | 
						|
//  BOOL WINAPI AL_CLASS_TYPE IsBadWritePtr( void FAR *lp, UINT cb );
 | 
						|
//
 | 
						|
// VB SYNOPSIS
 | 
						|
//
 | 
						|
//  None.
 | 
						|
//
 | 
						|
// DELPHI SYNOPSIS
 | 
						|
//
 | 
						|
//  None.
 | 
						|
//
 | 
						|
// ARGUMENTS
 | 
						|
//
 | 
						|
//  lp  :  A pointer to an object allocated from the Window heap, or in
 | 
						|
//         the program's stack or static data space.
 | 
						|
//
 | 
						|
//  cb  :  The size of the object.
 | 
						|
//
 | 
						|
// DESCRIPTION
 | 
						|
//
 | 
						|
//  IsBadWritePtr() is a Windows API function that we use in the debug
 | 
						|
//  versions of the library.  It simply performas a check of segment
 | 
						|
//  access data to verify that the calling program has write access to
 | 
						|
//  a given block of memory.
 | 
						|
//
 | 
						|
//  The problem is that Borland Power Pack doesn't provide a version of
 | 
						|
//  this function.  This is bad, because the library sort of assumes that
 | 
						|
//  PP libraries are basically Windows Apps.  So...  I include this dummy
 | 
						|
//  function in PowerPack libraries.
 | 
						|
//
 | 
						|
// RETURNS
 | 
						|
//
 | 
						|
//  0, always, which means that pointer is good.
 | 
						|
//
 | 
						|
// EXAMPLE
 | 
						|
//
 | 
						|
// SEE ALSO
 | 
						|
//
 | 
						|
// REVISION HISTORY
 | 
						|
//
 | 
						|
//   November 13, 1995  2.00A : First release.
 | 
						|
//
 | 
						|
 | 
						|
 | 
						|
#if defined( AL_FLAT_MODEL ) && (AL_BORLAND > 0x452 )
 | 
						|
extern "C"
 | 
						|
WINBASEAPI
 | 
						|
BOOL
 | 
						|
WINAPI
 | 
						|
AL_PROTO
 | 
						|
IsBadWritePtr(  /* Tag debug function */
 | 
						|
    LPVOID,
 | 
						|
    UINT
 | 
						|
    )
 | 
						|
#else
 | 
						|
extern "C" BOOL WINAPI AL_CLASS_TYPE IsBadWritePtr(void FAR*, UINT)
 | 
						|
#endif
 | 
						|
{ return 0; }
 | 
						|
 | 
						|
 |