Hi

Going through my driver, I noticed that DrvEnablePDEV is called more often
than DrvDisablePDEV in a printjob'
The docs say I should allocate resources for PDEV in DrvEnablePDEV, and
deallocate in DrvDisablePDEV, but this way I get a memory leak

BTW, the driver seems to work !!!

Any help on this ?

TIA
LB

Re: DrvEnablePDEV is called more than DrvDisablePDEV by vipin

vipin
Thu Aug 19 09:06:58 CDT 2004

DrvEnablePdev is called in response ti CreateDC(...) win32 api and
DrvDisablePdev in response to DeleteDC(...) win32 api.

The application is creating DCs and not deleting the DCs, I would say in
this case. Which application are you printing from?

thanks
vipin

"Mr B" <ask@me> wrote in message
news:O9sFrYdhEHA.1392@TK2MSFTNGP11.phx.gbl...
> Hi
>
> Going through my driver, I noticed that DrvEnablePDEV is called more often
> than DrvDisablePDEV in a printjob'
> The docs say I should allocate resources for PDEV in DrvEnablePDEV, and
> deallocate in DrvDisablePDEV, but this way I get a memory leak
>
> BTW, the driver seems to work !!!
>
> Any help on this ?
>
> TIA
> LB
>
>



Re: DrvEnablePDEV is called more than DrvDisablePDEV by Calvin

Calvin
Thu Aug 19 09:13:22 CDT 2004

Wow, nice to know the context of Enable/DisablePDEV in print driver is
totally different than that in a display driver.
-
Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com

"vipin" <vipin@nospam.com> wrote in message
news:OZ1p2QfhEHA.1568@TK2MSFTNGP09.phx.gbl...
> DrvEnablePdev is called in response ti CreateDC(...) win32 api and
> DrvDisablePdev in response to DeleteDC(...) win32 api.
>
> The application is creating DCs and not deleting the DCs, I would say in
> this case. Which application are you printing from?
>
> thanks
> vipin
>
> "Mr B" <ask@me> wrote in message
> news:O9sFrYdhEHA.1392@TK2MSFTNGP11.phx.gbl...
> > Hi
> >
> > Going through my driver, I noticed that DrvEnablePDEV is called more
often
> > than DrvDisablePDEV in a printjob'
> > The docs say I should allocate resources for PDEV in DrvEnablePDEV, and
> > deallocate in DrvDisablePDEV, but this way I get a memory leak
> >
> > BTW, the driver seems to work !!!
> >
> > Any help on this ?
> >
> > TIA
> > LB
> >
> >
>
>



Re: DrvEnablePDEV is called more than DrvDisablePDEV by vipin

vipin
Thu Aug 19 09:49:05 CDT 2004

Hi Calvin,
I didn't understand what you meant by context. In NT4 the
printer driver is kernel mode(similar to how display drivers
are mapped) and on win2k/XP, the user mode printer drivers can run in either
application address space or spooler(spoolsv.exe) address
space. Did you mean this?

thanks
vipin


"Calvin Guan" <cguan@pleasenospam.ati.com> wrote in message
news:#WbT0afhEHA.592@TK2MSFTNGP11.phx.gbl...
> Wow, nice to know the context of Enable/DisablePDEV in print driver is
> totally different than that in a display driver.
> -
> Calvin Guan Software Engineer
> ATI Technologies Inc. www.ati.com
>
> "vipin" <vipin@nospam.com> wrote in message
> news:OZ1p2QfhEHA.1568@TK2MSFTNGP09.phx.gbl...
> > DrvEnablePdev is called in response ti CreateDC(...) win32 api and
> > DrvDisablePdev in response to DeleteDC(...) win32 api.
> >
> > The application is creating DCs and not deleting the DCs, I would say in
> > this case. Which application are you printing from?
> >
> > thanks
> > vipin
> >
> > "Mr B" <ask@me> wrote in message
> > news:O9sFrYdhEHA.1392@TK2MSFTNGP11.phx.gbl...
> > > Hi
> > >
> > > Going through my driver, I noticed that DrvEnablePDEV is called more
> often
> > > than DrvDisablePDEV in a printjob'
> > > The docs say I should allocate resources for PDEV in DrvEnablePDEV,
and
> > > deallocate in DrvDisablePDEV, but this way I get a memory leak
> > >
> > > BTW, the driver seems to work !!!
> > >
> > > Any help on this ?
> > >
> > > TIA
> > > LB
> > >
> > >
> >
> >
>
>



Re: DrvEnablePDEV is called more than DrvDisablePDEV by Calvin

Calvin
Thu Aug 19 10:00:21 CDT 2004

Hi Vipin,

I know nothing about printer driver-:)

Display drivers (not to confuse with the video miniport) in W2K/XP always
run in kernel mode session space. The DrvEnablePDEV of a display driver gets
call when user changes a new display mode or enable a desktop by calling
ChangeDisplaySettings(Ex) in W2K/XP.

Thanks,
Calvin
-
Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com
"vipin" <vipin@nospam.com> wrote in message
news:OGo$YofhEHA.1656@TK2MSFTNGP09.phx.gbl...
> Hi Calvin,
> I didn't understand what you meant by context. In NT4 the
> printer driver is kernel mode(similar to how display drivers
> are mapped) and on win2k/XP, the user mode printer drivers can run in
either
> application address space or spooler(spoolsv.exe) address
> space. Did you mean this?
>
> thanks
> vipin
>
>
> "Calvin Guan" <cguan@pleasenospam.ati.com> wrote in message
> news:#WbT0afhEHA.592@TK2MSFTNGP11.phx.gbl...
> > Wow, nice to know the context of Enable/DisablePDEV in print driver is
> > totally different than that in a display driver.
> > -
> > Calvin Guan Software Engineer
> > ATI Technologies Inc. www.ati.com
> >
> > "vipin" <vipin@nospam.com> wrote in message
> > news:OZ1p2QfhEHA.1568@TK2MSFTNGP09.phx.gbl...
> > > DrvEnablePdev is called in response ti CreateDC(...) win32 api and
> > > DrvDisablePdev in response to DeleteDC(...) win32 api.
> > >
> > > The application is creating DCs and not deleting the DCs, I would say
in
> > > this case. Which application are you printing from?
> > >
> > > thanks
> > > vipin
> > >
> > > "Mr B" <ask@me> wrote in message
> > > news:O9sFrYdhEHA.1392@TK2MSFTNGP11.phx.gbl...
> > > > Hi
> > > >
> > > > Going through my driver, I noticed that DrvEnablePDEV is called more
> > often
> > > > than DrvDisablePDEV in a printjob'
> > > > The docs say I should allocate resources for PDEV in DrvEnablePDEV,
> and
> > > > deallocate in DrvDisablePDEV, but this way I get a memory leak
> > > >
> > > > BTW, the driver seems to work !!!
> > > >
> > > > Any help on this ?
> > > >
> > > > TIA
> > > > LB
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: DrvEnablePDEV is called more than DrvDisablePDEV by vipin

vipin
Thu Aug 19 10:21:59 CDT 2004

Hi Calvin,
Right, But it just gets called in response to CreateDC(...)
api for display also, when you call changedisplaysettings(...), it would
call
CreateDC(...) internally and also when you create windows using
CreateWindow(...)/GetDC and at aother times when the user changes
modes because of palette initialization or for creating a new surface based
on the new screen dimensions.

thanks
vipin


"Calvin Guan" <cguan@pleasenospam.ati.com> wrote in message
news:OaBEC1fhEHA.712@TK2MSFTNGP09.phx.gbl...
> Hi Vipin,
>
> I know nothing about printer driver-:)
>
> Display drivers (not to confuse with the video miniport) in W2K/XP always
> run in kernel mode session space. The DrvEnablePDEV of a display driver
gets
> call when user changes a new display mode or enable a desktop by calling
> ChangeDisplaySettings(Ex) in W2K/XP.
>
> Thanks,
> Calvin
> -
> Calvin Guan Software Engineer
> ATI Technologies Inc. www.ati.com
> "vipin" <vipin@nospam.com> wrote in message
> news:OGo$YofhEHA.1656@TK2MSFTNGP09.phx.gbl...
> > Hi Calvin,
> > I didn't understand what you meant by context. In NT4 the
> > printer driver is kernel mode(similar to how display drivers
> > are mapped) and on win2k/XP, the user mode printer drivers can run in
> either
> > application address space or spooler(spoolsv.exe) address
> > space. Did you mean this?
> >
> > thanks
> > vipin
> >
> >
> > "Calvin Guan" <cguan@pleasenospam.ati.com> wrote in message
> > news:#WbT0afhEHA.592@TK2MSFTNGP11.phx.gbl...
> > > Wow, nice to know the context of Enable/DisablePDEV in print driver is
> > > totally different than that in a display driver.
> > > -
> > > Calvin Guan Software Engineer
> > > ATI Technologies Inc. www.ati.com
> > >
> > > "vipin" <vipin@nospam.com> wrote in message
> > > news:OZ1p2QfhEHA.1568@TK2MSFTNGP09.phx.gbl...
> > > > DrvEnablePdev is called in response ti CreateDC(...) win32 api and
> > > > DrvDisablePdev in response to DeleteDC(...) win32 api.
> > > >
> > > > The application is creating DCs and not deleting the DCs, I would
say
> in
> > > > this case. Which application are you printing from?
> > > >
> > > > thanks
> > > > vipin
> > > >
> > > > "Mr B" <ask@me> wrote in message
> > > > news:O9sFrYdhEHA.1392@TK2MSFTNGP11.phx.gbl...
> > > > > Hi
> > > > >
> > > > > Going through my driver, I noticed that DrvEnablePDEV is called
more
> > > often
> > > > > than DrvDisablePDEV in a printjob'
> > > > > The docs say I should allocate resources for PDEV in
DrvEnablePDEV,
> > and
> > > > > deallocate in DrvDisablePDEV, but this way I get a memory leak
> > > > >
> > > > > BTW, the driver seems to work !!!
> > > > >
> > > > > Any help on this ?
> > > > >
> > > > > TIA
> > > > > LB
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: DrvEnablePDEV is called more than DrvDisablePDEV by Calvin

Calvin
Thu Aug 19 10:51:33 CDT 2004

> Right, But it just gets called in response to
CreateDC(...)
> api for display also, when you call changedisplaysettings(...), it would
> call
> CreateDC(...) internally

Well, this is different from what I've observed in the debugger. I happened
to step through the assembly code from where a changedisplaysettings is made
up to the point our DrvEnablePDEV got called to pinpoint a nasty issue in
our driver.

changedisplaysettings is just a simple wrapper to the native API
USER32!NtUserChangeDisplaySettings.
It swithes to kernel mode w32k!NtUserChangeDisplaySettings then later calls
into DrvEnablePDEV. No DC creation is observed.

Thanks,
Calvin
-
Calvin Guan Software Engineer
ATI Technologies Inc. www.ati.com
"vipin" <vipin@nospam.com> wrote in message
news:OxLNx6fhEHA.2916@TK2MSFTNGP12.phx.gbl...



Re: DrvEnablePDEV is called more than DrvDisablePDEV by Mr

Mr
Thu Aug 19 12:20:36 CDT 2004

"vipin" wrote...

> DrvEnablePdev is called in response ti CreateDC(...) win32 api and
> DrvDisablePdev in response to DeleteDC(...) win32 api.
>
> The application is creating DCs and not deleting the DCs, I would say in
> this case. Which application are you printing from?

I tried Word, WordPad, NotePad and IE, all have the same behaviour
Here are the calls made into the driver when printing a single page from
Word




Thu Aug 19 19:13:32 2004 IFC_DRV : DrvEnableDriver

Thu Aug 19 19:13:32 2004 IFC_DRV : DrvEnablePDEV ( +1 )
Thu Aug 19 19:13:32 2004 IFC_DRV : DrvCompletePDEV

Thu Aug 19 19:13:33 2004 IFC_DRV : DrvEnablePDEV ( + 2 )
Thu Aug 19 19:13:33 2004 IFC_DRV : DrvCompletePDEV
Thu Aug 19 19:13:33 2004 IFC_DRV : DrvResetPDEV ( entry )
Thu Aug 19 19:13:33 2004 IFC_DRV : DrvResetPDEV
Thu Aug 19 19:13:33 2004 IFC_DRV : DrvDisablePDEV ( + 1 )

Thu Aug 19 19:13:34 2004 IFC_DRV : DrvEnablePDEV ( + 2 )
Thu Aug 19 19:13:34 2004 IFC_DRV : DrvCompletePDEV

Thu Aug 19 19:13:34 2004 IFC_DRV : DrvEnablePDEV ( + 3 )
Thu Aug 19 19:13:34 2004 IFC_DRV : DrvCompletePDEV

Thu Aug 19 19:13:35 2004 IFC_DRV : DrvEnableSurface
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvStartDoc
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvEnablePDEV ( + 4 )
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvCompletePDEV
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvResetPDEV ( entry )
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvResetPDEV
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvDisableSurface
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvDisablePDEV ( + 3 )

Thu Aug 19 19:13:35 2004 IFC_DRV : DrvEnableSurface
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvStartPage
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvSendPage
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvEnablePDEV ( + 4 )
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvCompletePDEV
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvResetPDEV ( entry )
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvResetPDEV
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvDisableSurface
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvDisablePDEV ( + 3 )

Thu Aug 19 19:13:35 2004 IFC_DRV : DrvEnableSurface
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvEndDoc
Thu Aug 19 19:13:35 2004 IFC_DRV : DrvDisableSurface

Thu Aug 19 19:13:35 2004 IFC_DRV : DrvDisablePDEV ( + 2 )

Thu Aug 19 19:13:36 2004 IFC_DRV : DrvDisablePDEV ( + 1 )




Re: DrvEnablePDEV is called more than DrvDisablePDEV by vipin

vipin
Fri Aug 20 00:54:26 CDT 2004

just checked and Changedisplaysettings doesn't call CreateDC. ok, but for
printer drivers the only way to trigger a DrvEnablePdev is using
CreateDC/ResetDC.

thanks
vipin

"Calvin Guan" <cguan@pleasenospam.ati.com> wrote in message
news:##mdpRghEHA.592@TK2MSFTNGP11.phx.gbl...
> > Right, But it just gets called in response to
> CreateDC(...)
> > api for display also, when you call changedisplaysettings(...), it would
> > call
> > CreateDC(...) internally
>
> Well, this is different from what I've observed in the debugger. I
happened
> to step through the assembly code from where a changedisplaysettings is
made
> up to the point our DrvEnablePDEV got called to pinpoint a nasty issue in
> our driver.
>
> changedisplaysettings is just a simple wrapper to the native API
> USER32!NtUserChangeDisplaySettings.
> It swithes to kernel mode w32k!NtUserChangeDisplaySettings then later
calls
> into DrvEnablePDEV. No DC creation is observed.
>
> Thanks,
> Calvin
> -
> Calvin Guan Software Engineer
> ATI Technologies Inc. www.ati.com
> "vipin" <vipin@nospam.com> wrote in message
> news:OxLNx6fhEHA.2916@TK2MSFTNGP12.phx.gbl...
>
>