summaryrefslogtreecommitdiff
path: root/avstream/avscamera/sys/AvsCamera.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'avstream/avscamera/sys/AvsCamera.cpp')
-rw-r--r--avstream/avscamera/sys/AvsCamera.cpp115
1 files changed, 62 insertions, 53 deletions
diff --git a/avstream/avscamera/sys/AvsCamera.cpp b/avstream/avscamera/sys/AvsCamera.cpp
index 155ea689..3563b3dd 100644
--- a/avstream/avscamera/sys/AvsCamera.cpp
+++ b/avstream/avscamera/sys/AvsCamera.cpp
@@ -1,20 +1,20 @@
/**************************************************************************
-A/V Stream Camera Sample
+ A/V Stream Camera Sample
-Copyright (c) 2014, Microsoft Corporation.
+ Copyright (c) 2014, Microsoft Corporation.
-File:
+ File:
-AvsCamera.cpp
+ AvsCamera.cpp
-Abstract:
+ Abstract:
-Sample Camera driver initialization.
+ Sample Camera driver initialization.
-History:
+ History:
-created 5/15/2014
+ created 5/15/2014
**************************************************************************/
@@ -24,15 +24,15 @@ PVOID operator new
(
size_t iSize,
_When_((poolType & NonPagedPoolMustSucceed) != 0,
- __drv_reportError("Must succeed pool allocations are forbidden. "
- "Allocation failures cause a system crash"))
+ __drv_reportError("Must succeed pool allocations are forbidden. "
+ "Allocation failures cause a system crash"))
POOL_TYPE poolType
- )
+)
{
- PVOID result = ExAllocatePoolWithTag(poolType, iSize, 'wNCK');
+ PVOID result = ExAllocatePoolWithTag(poolType,iSize,'wNCK');
if (result) {
- RtlZeroMemory(result, iSize);
+ RtlZeroMemory(result,iSize);
}
return result;
@@ -42,22 +42,22 @@ PVOID operator new
(
size_t iSize,
_When_((poolType & NonPagedPoolMustSucceed) != 0,
- __drv_reportError("Must succeed pool allocations are forbidden. "
- "Allocation failures cause a system crash"))
+ __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);
+ PVOID result = ExAllocatePoolWithTag(poolType,iSize,tag);
if (result) {
- RtlZeroMemory(result, iSize);
+ RtlZeroMemory(result,iSize);
}
return result;
}
-PVOID
+PVOID
operator new[](
size_t iSize,
_When_((poolType & NonPagedPoolMustSucceed) != 0,
@@ -65,7 +65,7 @@ operator new[](
"Allocation failures cause a system crash"))
POOL_TYPE poolType,
ULONG tag
- )
+)
{
PVOID result = ExAllocatePoolWithTag(poolType, iSize, tag);
@@ -81,23 +81,23 @@ operator new[](
Routine Description:
-Array delete() operator.
+ Array delete() operator.
Arguments:
-pVoid -
-The memory to free.
+ pVoid -
+ The memory to free.
Return Value:
-None
+ None
--*/
-void
-__cdecl
+void
+__cdecl
operator delete[](
PVOID pVoid
- )
+)
{
if (pVoid)
{
@@ -109,26 +109,26 @@ operator delete[](
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
--*/
void __cdecl operator delete
(
void *pVoid,
size_t /*size*/
- )
+)
{
if (pVoid)
{
@@ -140,26 +140,26 @@ void __cdecl operator delete
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
--*/
void __cdecl operator delete[]
(
void *pVoid,
size_t /*size*/
- )
+)
{
if (pVoid)
{
@@ -167,10 +167,19 @@ void __cdecl operator delete[]
}
}
+void __cdecl operator delete
+(
+ PVOID pVoid
+ )
+{
+ if (pVoid) {
+ ExFreePool(pVoid);
+ }
+}
/**************************************************************************
-DESCRIPTOR AND DISPATCH LAYOUT
+ DESCRIPTOR AND DISPATCH LAYOUT
**************************************************************************/
@@ -181,7 +190,7 @@ DESCRIPTOR AND DISPATCH LAYOUT
// notifications as well as power management notifications are dispatched
// through this table.
//
-DEFINE_CAMERA_KSDEVICE_DISPATCH(AvsCameraDispatch, CAvsCameraDevice);
+DEFINE_CAMERA_KSDEVICE_DISPATCH( AvsCameraDispatch, CAvsCameraDevice );
//
// CaptureDeviceDescriptor:
@@ -203,7 +212,7 @@ AvsCameraDeviceDescriptor =
/**************************************************************************
-INITIALIZATION CODE
+ INITIALIZATION CODE
**************************************************************************/
@@ -212,7 +221,7 @@ extern "C" DRIVER_INITIALIZE DriverEntry;
extern "C"
NTSTATUS
-DriverEntry(
+DriverEntry (
_In_ PDRIVER_OBJECT DriverObject,
_In_ PUNICODE_STRING RegistryPath
)
@@ -221,20 +230,20 @@ DriverEntry(
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
--*/
@@ -246,7 +255,7 @@ As from KsInitializeDriver
// here.
//
return
- KsInitializeDriver(
+ KsInitializeDriver (
DriverObject,
RegistryPath,
&AvsCameraDeviceDescriptor