marko
2007-11-26 19:52:04 UTC
hi there, AV 3.4.0158 has a bug that is hindering our testing. the Printing
PrintAPI test is falsely generating the stop error "A DEVMODE buffer
parameter spans across non-readable memory page(s)". the problem occurs when
ANSI applications are being verified, and the cause of the bug appears to be
that the AV hook is dereferencing ANSI DEVMODEA structures as if they were
Unicode DEVMODEW structures. I can tell this because of the expected DEVMODE
size reported by AV.
here is a sample app that causes the problem:
#include <windows.h>
int WINAPI WinMain (
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR pszCmdLine,
int nCmdShow)
{
HANDLE hPrinter;
// assume that this system has Microsoft XPS Document Writer
// if not, just change it to any existing printer
if (OpenPrinterA("Microsoft XPS Document Writer", &hPrinter, NULL)) {
DWORD cbInfo;
PRINTER_INFO_2 *pInfo;
GetPrinterA(hPrinter, 2, NULL, 0, &cbInfo);
pInfo = (PRINTER_INFO_2 *)new BYTE [cbInfo];
GetPrinterA(hPrinter, 2, (BYTE *)pInfo, cbInfo, &cbInfo);
// this call to SetPrinterA will cause Application Verifier to falsely
// generate a DEVMODE error
SetPrinterA(hPrinter, 2, (BYTE *)pInfo, 0);
ClosePrinter(hPrinter);
delete pInfo;
}
return (0);
}
PrintAPI test is falsely generating the stop error "A DEVMODE buffer
parameter spans across non-readable memory page(s)". the problem occurs when
ANSI applications are being verified, and the cause of the bug appears to be
that the AV hook is dereferencing ANSI DEVMODEA structures as if they were
Unicode DEVMODEW structures. I can tell this because of the expected DEVMODE
size reported by AV.
here is a sample app that causes the problem:
#include <windows.h>
int WINAPI WinMain (
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR pszCmdLine,
int nCmdShow)
{
HANDLE hPrinter;
// assume that this system has Microsoft XPS Document Writer
// if not, just change it to any existing printer
if (OpenPrinterA("Microsoft XPS Document Writer", &hPrinter, NULL)) {
DWORD cbInfo;
PRINTER_INFO_2 *pInfo;
GetPrinterA(hPrinter, 2, NULL, 0, &cbInfo);
pInfo = (PRINTER_INFO_2 *)new BYTE [cbInfo];
GetPrinterA(hPrinter, 2, (BYTE *)pInfo, cbInfo, &cbInfo);
// this call to SetPrinterA will cause Application Verifier to falsely
// generate a DEVMODE error
SetPrinterA(hPrinter, 2, (BYTE *)pInfo, 0);
ClosePrinter(hPrinter);
delete pInfo;
}
return (0);
}