winspool/tests: fix broken test for GetPrinterDriver (updated)

Detlef Riekenberg at
Sun Apr 30 06:29:16 CDT 2006

Am Sonntag, den 30.04.2006, 11:57 +0900 schrieb Dmitry Timoshkov:
> > +            /* needed is modified in win9x. testing for "needed == (DWORD)-1" will fail */
> That's interesting, is there a pattern how win9x modifies it?

+ trace("(%d) returned %d with 0x%08lx/%ld and 0x%08lx/%ld\n", level,
+        ret, GetLastError(), GetLastError(), needed, needed);

Nothing usable:
IMHO, it's an address when level==-1 (ME: 0x0041afd4, 95:0x0051000c)
On level==0 it's set to 0.
In the other cases, the value depends on the Default Printer.
I have seen 213, 257, 294, 297, 319, 401

There is no Documentation, what the OS does with this Parameter when the
Function failed.

> >  
> > +        }
> > +        if(GetLastError() != ERROR_INSUFFICIENT_BUFFER) continue;
> This line above is misplaced, better do not remove 'continue;' in the invalid
> level case.

This will not work.
The first "continue" (ERROR_OUTOFMEMORY-check) leaves the if-case but
goes on in the for-loop.

Using a nested if is IMHO the ugly way.

Initializing "needed" with 0 is the easy way: We do not get an
ERROR_OUTOFMEMORY from win9x and can remove the extra check, but you
told us, that you do not want "needed=(DWORD)-1" to change.

It's not our Fault, that the App, that you want to get working, is so
buggy, that it depends on such an undocumented crap.  

Fixing your broken tests is really Time-consuming:
test_DEVMODE failed, when the Printername has more 

You can see the failing tests on XP in the WRT-Results.
When the Default Printer is on a Server, the Limit is 
reached fast.

NT3.51 has more failures: 
dmDriverExtra is 0 and dmDevicename is empty.
(dmSpecVersion and dmDriverVersion are also 0)

By By ...
      ... Detlef

More information about the wine-devel mailing list