Hi,
Earlier I left a post about my printer driver sometimes getting a call to
DrvSendPage in the middle of processing a call to DrvTextOut. I was somewhat
starting to blame MS-OFFICE applications, but this appears to be just
something the spooler does, since I can duplicate this just with a call to
EndDocPrinter or EndDoc in my own printing application.

The problem is that my driver is in the middle of DrvTextOut and suddenly I
see a call to DrvSendPage even though I have not yet returned from
DrvTextOut. This may be a clue, but I don't know how to interpret it: When
I had "DebugBreak()" as the second line to DrvTextOut (first line is a call
to OutputDebugString), it never gets executed, DrvSendPage gets called at
that point.

I do not have any clue as to why the spooler would do this, or how my driver
should handle it.

Thanks!

Re: DrvTextOut/DrvSendPage part 2 by Vipin

Vipin
Wed Jun 01 07:27:02 CDT 2005

there is some memory corruption happening, mostly a stack corruption, I
should say.
Please don't blame anyone, these things have existed and worked reliably for
quite long time, otherwise poeple won't have been able to print anything on
windows NT/2000/XP/2003

Thanks
Vipin

"Rockyh" <Rockyh@discussions.microsoft.com> wrote in message
news:C6A2BB69-1A73-4574-A5E7-E3A80E9EB62C@microsoft.com...
> Hi,
> Earlier I left a post about my printer driver sometimes getting a call to
> DrvSendPage in the middle of processing a call to DrvTextOut. I was
> somewhat
> starting to blame MS-OFFICE applications, but this appears to be just
> something the spooler does, since I can duplicate this just with a call to
> EndDocPrinter or EndDoc in my own printing application.
>
> The problem is that my driver is in the middle of DrvTextOut and suddenly
> I
> see a call to DrvSendPage even though I have not yet returned from
> DrvTextOut. This may be a clue, but I don't know how to interpret it:
> When
> I had "DebugBreak()" as the second line to DrvTextOut (first line is a
> call
> to OutputDebugString), it never gets executed, DrvSendPage gets called at
> that point.
>
> I do not have any clue as to why the spooler would do this, or how my
> driver
> should handle it.
>
> Thanks!



Re: DrvTextOut/DrvSendPage part 2 by Rockyh

Rockyh
Wed Jun 01 08:11:02 CDT 2005

Thank you Vipin,
I had a bad choice of wording, I was blaming the other software for finding
a flaw in my driver. I thought the other software was doing something
different that my driver was failing to handle.

The stack corruption is a good lead. Its something I have to deal with in
the embedded world, but never really thought about too much when I started
doing this driver stuff. Are there any tools that can help find something
like stack problems? Or articles that describe good techniques for finding
stack issues?

Thanks again, I really do appreciate getting a reply! Yesterday, I got
WinDbg fired up for the first time and attached to the spooler and the
problem went away! So you can see, this has been a very frustrating problem
for me!

Rocky

"Vipin" wrote:

> there is some memory corruption happening, mostly a stack corruption, I
> should say.
> Please don't blame anyone, these things have existed and worked reliably for
> quite long time, otherwise poeple won't have been able to print anything on
> windows NT/2000/XP/2003
>
> Thanks
> Vipin
>
> "Rockyh" <Rockyh@discussions.microsoft.com> wrote in message
> news:C6A2BB69-1A73-4574-A5E7-E3A80E9EB62C@microsoft.com...
> > Hi,
> > Earlier I left a post about my printer driver sometimes getting a call to
> > DrvSendPage in the middle of processing a call to DrvTextOut. I was
> > somewhat
> > starting to blame MS-OFFICE applications, but this appears to be just
> > something the spooler does, since I can duplicate this just with a call to
> > EndDocPrinter or EndDoc in my own printing application.
> >
> > The problem is that my driver is in the middle of DrvTextOut and suddenly
> > I
> > see a call to DrvSendPage even though I have not yet returned from
> > DrvTextOut. This may be a clue, but I don't know how to interpret it:
> > When
> > I had "DebugBreak()" as the second line to DrvTextOut (first line is a
> > call
> > to OutputDebugString), it never gets executed, DrvSendPage gets called at
> > that point.
> >
> > I do not have any clue as to why the spooler would do this, or how my
> > driver
> > should handle it.
> >
> > Thanks!
>
>
>

Re: DrvTextOut/DrvSendPage part 2 by Vipin

Vipin
Wed Jun 01 08:20:32 CDT 2005

yes, its possible you don't see on checked builds because of the
non-optimised machine code.
There is room for the overwrite code not to cause any corruption of the EIP.
free builds can do frame pointer optimisation. Also checkout the calling
conventions of exported functions, they can cause you havoc.

I think to first step to solve a problem is to think that problem resides in
the code you have written. GDI/spooler and operating systems have been used
for a while and trillions(Is it less?)
have passed through these components with no problem like you are
describing.

Thanks
Vipin

"Rockyh" <Rockyh@discussions.microsoft.com> wrote in message
news:A512239C-C391-42BB-9A59-481EA627BA58@microsoft.com...
> Thank you Vipin,
> I had a bad choice of wording, I was blaming the other software for
> finding
> a flaw in my driver. I thought the other software was doing something
> different that my driver was failing to handle.
>
> The stack corruption is a good lead. Its something I have to deal with in
> the embedded world, but never really thought about too much when I started
> doing this driver stuff. Are there any tools that can help find something
> like stack problems? Or articles that describe good techniques for
> finding
> stack issues?
>
> Thanks again, I really do appreciate getting a reply! Yesterday, I got
> WinDbg fired up for the first time and attached to the spooler and the
> problem went away! So you can see, this has been a very frustrating
> problem
> for me!
>
> Rocky
>
> "Vipin" wrote:
>
>> there is some memory corruption happening, mostly a stack corruption, I
>> should say.
>> Please don't blame anyone, these things have existed and worked reliably
>> for
>> quite long time, otherwise poeple won't have been able to print anything
>> on
>> windows NT/2000/XP/2003
>>
>> Thanks
>> Vipin
>>
>> "Rockyh" <Rockyh@discussions.microsoft.com> wrote in message
>> news:C6A2BB69-1A73-4574-A5E7-E3A80E9EB62C@microsoft.com...
>> > Hi,
>> > Earlier I left a post about my printer driver sometimes getting a call
>> > to
>> > DrvSendPage in the middle of processing a call to DrvTextOut. I was
>> > somewhat
>> > starting to blame MS-OFFICE applications, but this appears to be just
>> > something the spooler does, since I can duplicate this just with a call
>> > to
>> > EndDocPrinter or EndDoc in my own printing application.
>> >
>> > The problem is that my driver is in the middle of DrvTextOut and
>> > suddenly
>> > I
>> > see a call to DrvSendPage even though I have not yet returned from
>> > DrvTextOut. This may be a clue, but I don't know how to interpret it:
>> > When
>> > I had "DebugBreak()" as the second line to DrvTextOut (first line is a
>> > call
>> > to OutputDebugString), it never gets executed, DrvSendPage gets called
>> > at
>> > that point.
>> >
>> > I do not have any clue as to why the spooler would do this, or how my
>> > driver
>> > should handle it.
>> >
>> > Thanks!
>>
>>
>>



Re: DrvTextOut/DrvSendPage part 2 by Vipin

Vipin
Wed Jun 01 08:22:09 CDT 2005

You can use the application compatibility test, appverifier.exe, this can
detect all these issues.
It is downloadable on microsoft.com site for free. search for it.

Thanks
Vipin

"Rockyh" <Rockyh@discussions.microsoft.com> wrote in message
news:A512239C-C391-42BB-9A59-481EA627BA58@microsoft.com...
> Thank you Vipin,
> I had a bad choice of wording, I was blaming the other software for
> finding
> a flaw in my driver. I thought the other software was doing something
> different that my driver was failing to handle.
>
> The stack corruption is a good lead. Its something I have to deal with in
> the embedded world, but never really thought about too much when I started
> doing this driver stuff. Are there any tools that can help find something
> like stack problems? Or articles that describe good techniques for
> finding
> stack issues?
>
> Thanks again, I really do appreciate getting a reply! Yesterday, I got
> WinDbg fired up for the first time and attached to the spooler and the
> problem went away! So you can see, this has been a very frustrating
> problem
> for me!
>
> Rocky
>
> "Vipin" wrote:
>
>> there is some memory corruption happening, mostly a stack corruption, I
>> should say.
>> Please don't blame anyone, these things have existed and worked reliably
>> for
>> quite long time, otherwise poeple won't have been able to print anything
>> on
>> windows NT/2000/XP/2003
>>
>> Thanks
>> Vipin
>>
>> "Rockyh" <Rockyh@discussions.microsoft.com> wrote in message
>> news:C6A2BB69-1A73-4574-A5E7-E3A80E9EB62C@microsoft.com...
>> > Hi,
>> > Earlier I left a post about my printer driver sometimes getting a call
>> > to
>> > DrvSendPage in the middle of processing a call to DrvTextOut. I was
>> > somewhat
>> > starting to blame MS-OFFICE applications, but this appears to be just
>> > something the spooler does, since I can duplicate this just with a call
>> > to
>> > EndDocPrinter or EndDoc in my own printing application.
>> >
>> > The problem is that my driver is in the middle of DrvTextOut and
>> > suddenly
>> > I
>> > see a call to DrvSendPage even though I have not yet returned from
>> > DrvTextOut. This may be a clue, but I don't know how to interpret it:
>> > When
>> > I had "DebugBreak()" as the second line to DrvTextOut (first line is a
>> > call
>> > to OutputDebugString), it never gets executed, DrvSendPage gets called
>> > at
>> > that point.
>> >
>> > I do not have any clue as to why the spooler would do this, or how my
>> > driver
>> > should handle it.
>> >
>> > Thanks!
>>
>>
>>



Re: DrvTextOut/DrvSendPage part 2 by Rockyh

Rockyh
Tue Jun 07 16:01:02 CDT 2005

Thank you Vipin, for your responses. I did eventually find my problem was
heap corruption. You sent me on the right track, but I never could figure
out how to get AppVerifier to work on my driver. This seems like it would be
a good test, but I had problems getting it to attach to the spooler process.
I don't suppose you have any pointers on how to use this tool for a driver.
Thanks
Rocky

"Vipin" wrote:

> You can use the application compatibility test, appverifier.exe, this can
> detect all these issues.
> It is downloadable on microsoft.com site for free. search for it.
>
> Thanks
> Vipin
>
> "Rockyh" <Rockyh@discussions.microsoft.com> wrote in message
> news:A512239C-C391-42BB-9A59-481EA627BA58@microsoft.com...
> > Thank you Vipin,
> > I had a bad choice of wording, I was blaming the other software for
> > finding
> > a flaw in my driver. I thought the other software was doing something
> > different that my driver was failing to handle.
> >
> > The stack corruption is a good lead. Its something I have to deal with in
> > the embedded world, but never really thought about too much when I started
> > doing this driver stuff. Are there any tools that can help find something
> > like stack problems? Or articles that describe good techniques for
> > finding
> > stack issues?
> >
> > Thanks again, I really do appreciate getting a reply! Yesterday, I got
> > WinDbg fired up for the first time and attached to the spooler and the
> > problem went away! So you can see, this has been a very frustrating
> > problem
> > for me!
> >
> > Rocky
> >
> > "Vipin" wrote:
> >
> >> there is some memory corruption happening, mostly a stack corruption, I
> >> should say.
> >> Please don't blame anyone, these things have existed and worked reliably
> >> for
> >> quite long time, otherwise poeple won't have been able to print anything
> >> on
> >> windows NT/2000/XP/2003
> >>
> >> Thanks
> >> Vipin
> >>
> >> "Rockyh" <Rockyh@discussions.microsoft.com> wrote in message
> >> news:C6A2BB69-1A73-4574-A5E7-E3A80E9EB62C@microsoft.com...
> >> > Hi,
> >> > Earlier I left a post about my printer driver sometimes getting a call
> >> > to
> >> > DrvSendPage in the middle of processing a call to DrvTextOut. I was
> >> > somewhat
> >> > starting to blame MS-OFFICE applications, but this appears to be just
> >> > something the spooler does, since I can duplicate this just with a call
> >> > to
> >> > EndDocPrinter or EndDoc in my own printing application.
> >> >
> >> > The problem is that my driver is in the middle of DrvTextOut and
> >> > suddenly
> >> > I
> >> > see a call to DrvSendPage even though I have not yet returned from
> >> > DrvTextOut. This may be a clue, but I don't know how to interpret it:
> >> > When
> >> > I had "DebugBreak()" as the second line to DrvTextOut (first line is a
> >> > call
> >> > to OutputDebugString), it never gets executed, DrvSendPage gets called
> >> > at
> >> > that point.
> >> >
> >> > I do not have any clue as to why the spooler would do this, or how my
> >> > driver
> >> > should handle it.
> >> >
> >> > Thanks!
> >>
> >>
> >>
>
>
>