Hi, I am reading a copy of source code and puzzled at the expression

CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;

The operator new must be overwrited somewhere, but I didnot find in
DDK.

So, any body could told me where is the overwrite occured?

Thanks!
WilliamX

Re: Where is the new operator defined? by Jeff

Jeff
Mon Mar 21 06:41:49 CST 2005

"WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
news:usm2p1atm.fsf@hotmail.com.discuss...
> Hi, I am reading a copy of source code and puzzled at the expression
>
> CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;
>
> The operator new must be overwrited somewhere, but I didnot find in
> DDK.
>
> So, any body could told me where is the overwrite occured?

My guess is that the code relies on some third-party driver framework, such
as WDF or Compuware's DriverWorks, which defines the new operator. The
standard DDK doesn't provide much in the way of C++ support for driver
development, as you might have noticed; so you won't find anything there.

Not having the source for that framework, it's pretty difficult to come up
with an exact implementation. However, based on the arguments, I'd guess
that the overwritten new operator is a wrapper around ExAllocatePoolWithTag,
since two of its three arguments are the arguments passed to new in your
code sample above.



Re: Where is the new operator defined? by Mark

Mark
Mon Mar 21 18:14:33 CST 2005

WilliamX wrote:
> Hi, I am reading a copy of source code and puzzled at the expression
>
> CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;
>
> The operator new must be overwrited somewhere, but I didnot find in
> DDK.
>
> So, any body could told me where is the overwrite occured?
>
> Thanks!
> WilliamX
You can download a free C++ runtime support implementation from my
website. This provides global new and delete and other stuff.

Alternatively you can implement new operators for each class.

Microsoft officially discourages people outside of Microsoft using C++
in the kernel.

Many of us ignore this advice :-)

--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

Re: Where is the new operator defined? by WilliamX

WilliamX
Mon Mar 21 21:55:17 CST 2005

"Jeff Henkels" <jeff@mapson.jeffhenkels.com> writes:

> "WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
> news:usm2p1atm.fsf@hotmail.com.discuss...
>> Hi, I am reading a copy of source code and puzzled at the expression
>>
>> CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;
>>
>> The operator new must be overwrited somewhere, but I didnot find in
>> DDK.
>>
>> So, any body could told me where is the overwrite occured?
>
> My guess is that the code relies on some third-party driver framework, such
> as WDF or Compuware's DriverWorks, which defines the new operator. The
> standard DDK doesn't provide much in the way of C++ support for driver
> development, as you might have noticed; so you won't find anything there.

Thank you, Jeff.

But the snip was coming from the sample of DDK, so I thought that
Microsoft must implement the new operator themselves.

It was located in src\wdm\bda\mauitune.

>
> Not having the source for that framework, it's pretty difficult to come up
> with an exact implementation. However, based on the arguments, I'd guess
> that the overwritten new operator is a wrapper around ExAllocatePoolWithTag,
> since two of its three arguments are the arguments passed to new in your
> code sample above.

Re: Where is the new operator defined? by WilliamX

WilliamX
Mon Mar 21 22:04:07 CST 2005

Mark Roddy <markr@hollistech.com> writes:

> WilliamX wrote:
>> Hi, I am reading a copy of source code and puzzled at the expression
>> CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;
>> The operator new must be overwrited somewhere, but I didnot find in
>> DDK.
>> So, any body could told me where is the overwrite occured?
>> Thanks!
>> WilliamX
> You can download a free C++ runtime support implementation from my
> website. This provides global new and delete and other stuff.

Thanks, I only wanna the ins and outs. :)

>
> Alternatively you can implement new operators for each class.
>
> Microsoft officially discourages people outside of Microsoft using C++
> in the kernel.
>
> Many of us ignore this advice :-)
>
> --
>
> =====================
> Mark Roddy DDK MVP
> Windows 2003/XP/2000 Consulting
> Hollis Technology Solutions 603-321-1032
> www.hollistech.com

Re: Where is the new operator defined? by Doron

Doron
Tue Mar 22 00:42:08 CST 2005

one the ksstreaming or or stream.sys headers includes an operator new you
can use in a driver. WDF exports no such function.

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
news:uzmww72sa.fsf@hotmail.com.discuss...
> "Jeff Henkels" <jeff@mapson.jeffhenkels.com> writes:
>
>> "WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
>> news:usm2p1atm.fsf@hotmail.com.discuss...
>>> Hi, I am reading a copy of source code and puzzled at the expression
>>>
>>> CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;
>>>
>>> The operator new must be overwrited somewhere, but I didnot find in
>>> DDK.
>>>
>>> So, any body could told me where is the overwrite occured?
>>
>> My guess is that the code relies on some third-party driver framework,
>> such
>> as WDF or Compuware's DriverWorks, which defines the new operator. The
>> standard DDK doesn't provide much in the way of C++ support for driver
>> development, as you might have noticed; so you won't find anything there.
>
> Thank you, Jeff.
>
> But the snip was coming from the sample of DDK, so I thought that
> Microsoft must implement the new operator themselves.
>
> It was located in src\wdm\bda\mauitune.
>
>>
>> Not having the source for that framework, it's pretty difficult to come
>> up
>> with an exact implementation. However, based on the arguments, I'd guess
>> that the overwritten new operator is a wrapper around
>> ExAllocatePoolWithTag,
>> since two of its three arguments are the arguments passed to new in your
>> code sample above.



Re: Where is the new operator defined? by WilliamX

WilliamX
Tue Mar 22 02:03:03 CST 2005

"Doron Holan [MS]" <doronh@nospam.microsoft.com> writes:

> one the ksstreaming or or stream.sys headers includes an operator new you
> can use in a driver. WDF exports no such function.

That's what I wanna, thanks.
But is there any doc which explained these overwrites?

>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
> news:uzmww72sa.fsf@hotmail.com.discuss...
>> "Jeff Henkels" <jeff@mapson.jeffhenkels.com> writes:
>>
>>> "WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
>>> news:usm2p1atm.fsf@hotmail.com.discuss...
>>>> Hi, I am reading a copy of source code and puzzled at the expression
>>>>
>>>> CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;
>>>>
>>>> The operator new must be overwrited somewhere, but I didnot find in
>>>> DDK.
>>>>
>>>> So, any body could told me where is the overwrite occured?
>>>
>>> My guess is that the code relies on some third-party driver framework,
>>> such
>>> as WDF or Compuware's DriverWorks, which defines the new operator. The
>>> standard DDK doesn't provide much in the way of C++ support for driver
>>> development, as you might have noticed; so you won't find anything there.
>>
>> Thank you, Jeff.
>>
>> But the snip was coming from the sample of DDK, so I thought that
>> Microsoft must implement the new operator themselves.
>>
>> It was located in src\wdm\bda\mauitune.
>>
>>>
>>> Not having the source for that framework, it's pretty difficult to come
>>> up
>>> with an exact implementation. However, based on the arguments, I'd guess
>>> that the overwritten new operator is a wrapper around
>>> ExAllocatePoolWithTag,
>>> since two of its three arguments are the arguments passed to new in your
>>> code sample above.

Re: Where is the new operator defined? by Mark

Mark
Tue Mar 22 18:35:14 CST 2005

WilliamX wrote:
> "Doron Holan [MS]" <doronh@nospam.microsoft.com> writes:
>
>
>>one the ksstreaming or or stream.sys headers includes an operator new you
>>can use in a driver. WDF exports no such function.
>
>
> That's what I wanna, thanks.
> But is there any doc which explained these overwrites?
>

Yes it is called the ARM (Annotated Reference Manual),
http://www.amazon.com/exec/obidos/ASIN/0201514591/102-9849552-0193734
or any good book, and there are probably 100 or so GOOD books, on C++
programming.

I personally recommend Scott Meyer's Effective C++ series.
http://www.amazon.com/exec/obidos/tg/detail/-/020163371X/ref=pd_sim_b_4/102-9849552-0193734?%5Fencoding=UTF8&v=glance


>
>>d
>>
>>--
>>Please do not send e-mail directly to this alias. this alias is for
>>newsgroup purposes only.
>>This posting is provided "AS IS" with no warranties, and confers no rights.
>>
>>
>>"WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
>>news:uzmww72sa.fsf@hotmail.com.discuss...
>>
>>>"Jeff Henkels" <jeff@mapson.jeffhenkels.com> writes:
>>>
>>>
>>>>"WilliamX" <fantast_xue@hotmail.com.discuss> wrote in message
>>>>news:usm2p1atm.fsf@hotmail.com.discuss...
>>>>
>>>>>Hi, I am reading a copy of source code and puzzled at the expression
>>>>>
>>>>> CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;
>>>>>
>>>>>The operator new must be overwrited somewhere, but I didnot find in
>>>>>DDK.
>>>>>
>>>>>So, any body could told me where is the overwrite occured?
>>>>
>>>>My guess is that the code relies on some third-party driver framework,
>>>>such
>>>>as WDF or Compuware's DriverWorks, which defines the new operator. The
>>>>standard DDK doesn't provide much in the way of C++ support for driver
>>>>development, as you might have noticed; so you won't find anything there.
>>>
>>>Thank you, Jeff.
>>>
>>>But the snip was coming from the sample of DDK, so I thought that
>>>Microsoft must implement the new operator themselves.
>>>
>>>It was located in src\wdm\bda\mauitune.
>>>
>>>
>>>>Not having the source for that framework, it's pretty difficult to come
>>>>up
>>>>with an exact implementation. However, based on the arguments, I'd guess
>>>>that the overwritten new operator is a wrapper around
>>>>ExAllocatePoolWithTag,
>>>>since two of its three arguments are the arguments passed to new in your
>>>>code sample above.


--

=====================
Mark Roddy DDK MVP
Windows 2003/XP/2000 Consulting
Hollis Technology Solutions 603-321-1032
www.hollistech.com

Re: Where is the new operator defined? by Tim

Tim
Wed Mar 23 23:22:00 CST 2005

WilliamX <fantast_xue@hotmail.com.discuss> wrote:

>> "WilliamX" <fantast_xue@hotmail.com.discuss> wrote:
>>
>>> Hi, I am reading a copy of source code and puzzled at the expression
>>>
>>> CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;
>>>
>>> The operator new must be overwrited somewhere, but I didnot find in
>>> DDK.
>>>
>>> So, any body could told me where is the overwrite occured?
>
>But the snip was coming from the sample of DDK, so I thought that
>Microsoft must implement the new operator themselves.

Yes, they do. They're in kcom.h. The easy way to find this out is:

cd \ddk\3790\inc
findstr /s /c:"operator new" *.h
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc

Re: Where is the new operator defined? by WilliamX

WilliamX
Sat Mar 26 10:27:21 CST 2005

Tim Roberts <timr@probo.com> writes:

> WilliamX <fantast_xue@hotmail.com.discuss> wrote:
>
>>> "WilliamX" <fantast_xue@hotmail.com.discuss> wrote:
>>>
>>>> Hi, I am reading a copy of source code and puzzled at the expression
>>>>
>>>> CFilter* pFilter = new(NonPagedPool,'IFsK') CFilter;
>>>>
>>>> The operator new must be overwrited somewhere, but I didnot find in
>>>> DDK.
>>>>
>>>> So, any body could told me where is the overwrite occured?
>>
>>But the snip was coming from the sample of DDK, so I thought that
>>Microsoft must implement the new operator themselves.
>
> Yes, they do. They're in kcom.h. The easy way to find this out is:
>
> cd \ddk\3790\inc
> findstr /s /c:"operator new" *.h

Thank you very much!
I am finding it!

> --
> - Tim Roberts, timr@probo.com
> Providenza & Boekelheide, Inc