summaryrefslogtreecommitdiff
path: root/avstream
diff options
context:
space:
mode:
authorTrevor Baron <[email protected]>2017-01-06 13:36:58 -0800
committerTrevor Baron <[email protected]>2017-01-06 13:36:58 -0800
commit5e36b0da44ef66ee06557e59a721c756849f045c (patch)
tree7a6869b1f330f4e487936380307c846003396468 /avstream
parent3070c2df6eb41d1fef3588447d3a6424eaf48b41 (diff)
fix Code Analysis Warnings C4595
Diffstat (limited to 'avstream')
-rw-r--r--avstream/avssamp/avssamp.cpp175
-rw-r--r--avstream/avssamp/avssamp.h132
2 files changed, 219 insertions, 88 deletions
diff --git a/avstream/avssamp/avssamp.cpp b/avstream/avssamp/avssamp.cpp
index 2cf0aac5..5a2c2b77 100644
--- a/avstream/avssamp/avssamp.cpp
+++ b/avstream/avssamp/avssamp.cpp
@@ -1,20 +1,20 @@
/**************************************************************************
- AVStream Filter-Centric Sample
+AVStream Filter-Centric Sample
- Copyright (c) 1999 - 2001, Microsoft Corporation
+Copyright (c) 1999 - 2001, Microsoft Corporation
- File:
+File:
- avssamp.cpp
+avssamp.cpp
- Abstract:
+Abstract:
- This is the main file for the filter-centric sample.
+This is the main file for the filter-centric sample.
- History:
+History:
- created 6/18/01
+created 6/18/01
**************************************************************************/
@@ -22,38 +22,165 @@
/**************************************************************************
- INITIALIZATION CODE
+INITIALIZATION CODE
**************************************************************************/
-
+
extern "C" DRIVER_INITIALIZE DriverEntry;
+PVOID operator new
+(
+ size_t iSize,
+ _When_((poolType & NonPagedPoolMustSucceed) != 0,
+ __drv_reportError("Must succeed pool allocations are forbidden. "
+ "Allocation failures cause a system crash"))
+ POOL_TYPE poolType
+ )
+{
+ PVOID result = ExAllocatePoolWithTag(poolType, iSize, 'wNCK');
+
+ if (result) {
+ RtlZeroMemory(result, iSize);
+ }
+
+ return result;
+}
+
+PVOID operator new
+(
+ size_t iSize,
+ _When_((poolType & NonPagedPoolMustSucceed) != 0,
+ __drv_reportError("Must succeed pool allocations are forbidden. "
+ "Allocation failures cause a system crash"))
+ POOL_TYPE poolType,
+ ULONG tag
+ )
+{
+ PVOID result = ExAllocatePoolWithTag(poolType, iSize, tag);
+
+ if (result) {
+ RtlZeroMemory(result, iSize);
+ }
+
+ return result;
+}
+
+/*++
+
+Routine Description:
+
+Array delete() operator.
+
+Arguments:
+
+pVoid -
+The memory to free.
+
+Return Value:
+
+None
+
+--*/
+void
+__cdecl
+operator delete[](
+ PVOID pVoid
+ )
+{
+ if (pVoid)
+ {
+ ExFreePool(pVoid);
+ }
+}
+
+/*++
+
+Routine Description:
+
+Sized delete() operator.
+
+Arguments:
+
+pVoid -
+The memory to free.
+
+size -
+The size of the memory to free.
+
+Return Value:
+
+None
+
+--*/
+void __cdecl operator delete
+(
+ void *pVoid,
+ size_t /*size*/
+ )
+{
+ if (pVoid)
+ {
+ ExFreePool(pVoid);
+ }
+}
+
+/*++
+
+Routine Description:
+
+Sized delete[]() operator.
+
+Arguments:
+
+pVoid -
+The memory to free.
+
+size -
+The size of the memory to free.
+
+Return Value:
+
+None
+
+--*/
+void __cdecl operator delete[]
+(
+ void *pVoid,
+ size_t /*size*/
+ )
+{
+ if (pVoid)
+ {
+ ExFreePool(pVoid);
+ }
+}
+
extern "C"
NTSTATUS
-DriverEntry (
+DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
- )
+)
/*++
Routine Description:
- Driver entry point. Pass off control to the AVStream initialization
- function (KsInitializeDriver) and return the status code from it.
+Driver entry point. Pass off control to the AVStream initialization
+function (KsInitializeDriver) and return the status code from it.
Arguments:
- DriverObject -
- The WDM driver object for our driver
+DriverObject -
+The WDM driver object for our driver
- RegistryPath -
- The registry path for our registry info
+RegistryPath -
+The registry path for our registry info
Return Value:
- As from KsInitializeDriver
+As from KsInitializeDriver
--*/
@@ -66,17 +193,17 @@ Return Value:
// here.
//
return
- KsInitializeDriver (
+ KsInitializeDriver(
DriverObject,
RegistryPath,
&CaptureDeviceDescriptor
- );
+ );
}
/**************************************************************************
- DESCRIPTOR AND DISPATCH LAYOUT
+DESCRIPTOR AND DISPATCH LAYOUT
**************************************************************************/
@@ -86,7 +213,7 @@ Return Value:
// The table of filter descriptors that this device supports. Each one of
// these will be used as a template to create a filter-factory on the device.
//
-DEFINE_KSFILTER_DESCRIPTOR_TABLE (FilterDescriptors) {
+DEFINE_KSFILTER_DESCRIPTOR_TABLE(FilterDescriptors) {
&CaptureFilterDescriptor
};
@@ -109,7 +236,7 @@ CaptureDeviceDescriptor = {
// by AVStream will be quite sufficient.
//
NULL,
- SIZEOF_ARRAY (FilterDescriptors),
+ SIZEOF_ARRAY(FilterDescriptors),
FilterDescriptors,
KSDEVICE_DESCRIPTOR_VERSION
};
diff --git a/avstream/avssamp/avssamp.h b/avstream/avssamp/avssamp.h
index 78319edf..7d0bd7c3 100644
--- a/avstream/avssamp/avssamp.h
+++ b/avstream/avssamp/avssamp.h
@@ -1,27 +1,27 @@
/**************************************************************************
- AVStream Filter-Centric Sample
+AVStream Filter-Centric Sample
- Copyright (c) 2001, Microsoft Corporation
+Copyright (c) 2001, Microsoft Corporation
- File:
+File:
- avssamp.h
+avssamp.h
- Abstract:
+Abstract:
- AVStream Filter-Centric Sample header file. This is the main
- header.
+AVStream Filter-Centric Sample header file. This is the main
+header.
- History:
+History:
- created 6/18/01
+created 6/18/01
**************************************************************************/
/*************************************************
- Standard Includes
+Standard Includes
*************************************************/
@@ -39,11 +39,10 @@ extern "C" {
#include <unknown.h>
#include <ks.h>
#include <ksmedia.h>
-#include <kcom.h>
#pragma warning (disable : 4100 4101 4131 4127 4189 4701 4706)
/*************************************************
- Misc Definitions
+Misc Definitions
*************************************************/
@@ -82,7 +81,7 @@ extern "C" {
/*************************************************
- Externed information
+Externed information
*************************************************/
@@ -102,12 +101,12 @@ CaptureFilterDescriptor;
extern
const
KSPIN_DESCRIPTOR_EX
-CaptureFilterPinDescriptors [CAPTURE_FILTER_PIN_COUNT];
+CaptureFilterPinDescriptors[CAPTURE_FILTER_PIN_COUNT];
extern
const
GUID
-CaptureFilterCategories [CAPTURE_FILTER_CATEGORIES_COUNT];
+CaptureFilterCategories[CAPTURE_FILTER_CATEGORIES_COUNT];
//
// video.cpp externs:
@@ -125,7 +124,7 @@ VideoCapturePinDispatch;
extern
const
PKSDATARANGE
-VideoCapturePinDataRanges [CAPTURE_PIN_DATA_RANGE_COUNT];
+VideoCapturePinDataRanges[CAPTURE_PIN_DATA_RANGE_COUNT];
//
// audio.cpp externs:
@@ -143,100 +142,105 @@ const
KSDEVICE_DESCRIPTOR
CaptureDeviceDescriptor;
+#ifndef _NEW_DELETE_OPERATORS_
+#define _NEW_DELETE_OPERATORS_
+
+PVOID operator new
+(
+ size_t iSize,
+ _When_((poolType & NonPagedPoolMustSucceed) != 0,
+ __drv_reportError("Must succeed pool allocations are forbidden. "
+ "Allocation failures cause a system crash"))
+ POOL_TYPE poolType
+ );
+
+PVOID operator new
+(
+ size_t iSize,
+ _When_((poolType & NonPagedPoolMustSucceed) != 0,
+ __drv_reportError("Must succeed pool allocations are forbidden. "
+ "Allocation failures cause a system crash"))
+ POOL_TYPE poolType,
+ ULONG tag
+ );
+
/*++
Routine Description:
- Array delete() operator.
+Array delete() operator.
Arguments:
- pVoid -
- The memory to free.
+pVoid -
+The memory to free.
Return Value:
- None
+None
--*/
-inline
-void
-__cdecl
+void
+__cdecl
operator delete[](
- PVOID pVoid
-)
-{
- if (pVoid)
- {
- ExFreePool(pVoid);
- }
-}
+ PVOID pVoid
+ );
/*++
Routine Description:
- Sized delete() operator.
+Sized delete() operator.
Arguments:
- pVoid -
- The memory to free.
+pVoid -
+The memory to free.
- size -
- The size of the memory to free.
+size -
+The size of the memory to free.
Return Value:
- None
+None
--*/
-inline void __cdecl operator delete
+void __cdecl operator delete
(
- void *pVoid,
- size_t /*size*/
- )
-{
- if (pVoid)
- {
- ExFreePool(pVoid);
- }
-}
+ void *pVoid,
+ size_t /*size*/
+ );
/*++
Routine Description:
- Sized delete[]() operator.
+Sized delete[]() operator.
Arguments:
- pVoid -
- The memory to free.
+pVoid -
+The memory to free.
- size -
- The size of the memory to free.
+size -
+The size of the memory to free.
Return Value:
- None
+None
--*/
-inline void __cdecl operator delete[]
+void __cdecl operator delete[]
(
- void *pVoid,
- size_t /*size*/
-)
-{
- if (pVoid)
- {
- ExFreePool(pVoid);
- }
-}
+ void *pVoid,
+ size_t /*size*/
+ );
+
+#endif // _NEW_DELETE_OPERATORS_
/*************************************************
- Internal Includes
+Internal Includes
*************************************************/