tests for GetPrinterDriverDirectoryA

Stefan Leichter Stefan.Leichter at camLine.com
Mon Jan 13 15:45:50 CST 2003


Am Montag 13 Januar 2003 18:42 schrieben Sie:
> On Sun, 12 Jan 2003, Stefan Leichter wrote:
> > Am Sonntag 12 Januar 2003 02:43 schrieben Sie:
> > > I see this test has not been committed yet... I tested it and it works
> > > on Win95, Win98, NT4 and XP. It's a much better score than some other
> > > tests...
> > >
> > > However it fails on Wine:
> > > info.c:25: Test failed: pcbNeeded set to 18 instead of 19
> > > info.c:30: Test failed: pcbNeeded set to 18 instead of 19
> > > info.c:34: Test failed: expected result == 0, got 18
> > > info.c:35: Test failed: pcbNeeded set to 18 instead of 19
> > > info.c:48: Test failed: expected result != 0, got 0
> > > info.c:71: Test failed: expected result != 0, got 0
> > >
Hello,

after this patch wine will fix the errors listed above

Changelog
------------
	make GetPrinterDriverDirectoryA pass all tests in test directory

--- ../wine/dlls/winspool/info.c	Sun Jan 12 22:38:42 2003
+++ dlls/winspool/info.c	Mon Jan 13 22:16:02 2003
@@ -2505,11 +2505,12 @@
     ret = GetPrinterDriverDirectoryW( nameW.Buffer, environmentW.Buffer, Level,
 				      (LPBYTE)driverDirectoryW, len, &pcbNeededW );
     if (ret) {
-        ret = WideCharToMultiByte( CP_ACP, 0, driverDirectoryW, -1, 
+        DWORD needed;
+        needed = 1 + WideCharToMultiByte( CP_ACP, 0, driverDirectoryW, -1, 
                                    pDriverDirectory, cbBuf, NULL, NULL);
         if(pcbNeeded)
-            *pcbNeeded = WideCharToMultiByte( CP_ACP, 0, driverDirectoryW, -1,
-                                              NULL, 0, NULL, NULL);
+            *pcbNeeded = needed;
+        ret = (needed <= cbBuf) ? TRUE : FALSE;
     } else 
         if(pcbNeeded) *pcbNeeded = pcbNeededW * sizeof(CHAR)/sizeof(WCHAR);
 



More information about the wine-patches mailing list