Microsoft DirectX 8.0 |
Microsoft® DirectShow® provides several macros for validating pointers.
Declaration: Wxdebug.h
Macro | Description |
---|---|
CheckPointer | Checks whether a pointer is NULL. |
ValidateReadPtr | Verifies that the calling process has read access to a memory block. |
ValidateReadWritePtr | Verifies that the calling process has read/write access to a memory block. |
ValidateStringPtr | Verifies that the calling process has read access to a string. |
ValidateStringPtrA | Verifies that the calling process has read access to an ANSI string. |
ValidateStringPtrW | Verifies that the calling process has read access to a wide-character string. |
ValidateWritePtr | Verifies that the calling process has write access to a memory block. |
Checks whether a pointer is NULL. If the pointer is NULL, the function or method in which the macro appears returns the specified value.
Syntax
CheckPointer( p, ret );
Parameters
- p
- Pointer to check.
- ret
- Value that the function or method returns if p is NULL.
Example
HRESULT MyFunction(VOID *pSomeParameter) { CheckPointer(pSomeParameter, E_INVALIDARG) // Rest of the function (not shown). }
Verifies that the calling process has read access to a memory block. If not, the macro calls the DbgBreak macro.
Syntax
ValidateReadPtr( const void *p, UINT cb );
Parameters
- p
- Pointer to a memory block.
- cb
- Size of the memory block, in bytes.
Remarks
This macro is ignored unless DEBUG or VFWROBUST is defined when the DirectShow base-class header file is included. This macro can have a significant performance cost.
Verifies that the calling process has read/write access to a memory block. If not, the macro calls the DbgBreak macro.
Syntax
ValidateReadWritePtr( const void *p, UINT cb );
Parameters
- p
- Pointer to a memory block.
- cb
- Size of the memory block, in bytes.
Remarks
This macro is ignored unless DEBUG or VFWROBUST is defined when the DirectShow base-class header file is included. This macro can have a significant performance cost.
Verifies that the calling process has read access to a string. If not, the macro calls the DbgBreak macro.
Syntax
ValidateStringPtr( LPCTSTR p );
Parameters
- p
- Pointer to a NULL-terminated TCHAR string.
Remarks
This macro is ignored unless DEBUG or VFWROBUST is defined when the DirectShow base-class header file is included. This macro can have a significant performance cost.
Verifies that the calling process has read access to an ANSI string. If not, the macro calls the DbgBreak macro.
Syntax
ValidateStringPtrA( LPCSTR p );
Parameters
- p
- Pointer to a NULL-terminated ANSI string.
Remarks
This macro is ignored unless DEBUG or VFWROBUST is defined when the DirectShow base-class header file is included.
Verifies that the calling process has read access to a wide-character string. If not, the macro calls the DbgBreak macro.
Syntax
ValidateStringPtrW( LPCWSTR p );
Parameters
- p
- Pointer to a NULL-terminated wide-character string.
Remarks
This macro is ignored unless DEBUG or VFWROBUST is defined when the DirectShow base-class header file is included. This macro can have a significant performance cost.
Verifies that the calling process has write access to a memory block. If not, the macro calls the DbgBreak macro.
Syntax
ValidateWritePtr( const void *p, UINT cb );
Parameters
- p
- Pointer to a memory block.
- cb
- Size of the memory block, in bytes.
Remarks
This macro is ignored unless DEBUG or VFWROBUST is defined when the DirectShow base-class header file is included. This macro can have a significant performance cost.