winspool.drv/tests: Fix tests compilation with __WINESRC__ defined.

This commit is contained in:
André Hentschel 2013-10-24 23:06:43 +02:00 committed by Alexandre Julliard
parent 3df00e29ee
commit 2a319e2cdd
2 changed files with 86 additions and 89 deletions

View File

@ -1,6 +1,5 @@
TESTDLL = winspool.drv TESTDLL = winspool.drv
IMPORTS = winspool advapi32 IMPORTS = winspool advapi32
EXTRADEFS = -U__WINESRC__ -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION -DWIDL_C_INLINE_WRAPPERS
C_SRCS = \ C_SRCS = \
info.c info.c

View File

@ -158,14 +158,12 @@ static void find_default_printer(VOID)
HKEY hwindows; HKEY hwindows;
DWORD type; DWORD type;
/* NT 3.x and above */ /* NT 3.x and above */
if (RegOpenKeyEx(HKEY_CURRENT_USER, if (RegOpenKeyExA(HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows", "Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows",
0, KEY_QUERY_VALUE, &hwindows) == NO_ERROR) { 0, KEY_QUERY_VALUE, &hwindows) == NO_ERROR) {
needed = sizeof(buffer); needed = sizeof(buffer);
if (RegQueryValueEx(hwindows, "device", NULL, if (RegQueryValueExA(hwindows, "device", NULL, &type, (LPBYTE)buffer, &needed) == NO_ERROR) {
&type, (LPBYTE)buffer, &needed) == NO_ERROR) {
ptr = strchr(buffer, ','); ptr = strchr(buffer, ',');
if (ptr) { if (ptr) {
ptr[0] = '\0'; ptr[0] = '\0';
@ -807,7 +805,7 @@ static void test_EnumForms(LPSTR pName)
PFORM_INFO_1A pFI_1a; PFORM_INFO_1A pFI_1a;
PFORM_INFO_2A pFI_2a; PFORM_INFO_2A pFI_2a;
res = OpenPrinter(pName, &hprinter, NULL); res = OpenPrinterA(pName, &hprinter, NULL);
if (is_spooler_deactivated(res, GetLastError())) return; if (is_spooler_deactivated(res, GetLastError())) return;
if (!res || !hprinter) if (!res || !hprinter)
{ {
@ -1106,7 +1104,7 @@ static void test_EnumPorts(void)
*/ */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = EnumPorts(NULL, level, buffer, cbBuf, NULL, &pcReturned); res = EnumPortsA(NULL, level, buffer, cbBuf, NULL, &pcReturned);
/* NT: RPC_X_NULL_REF_POINTER (1780), 9x: success */ /* NT: RPC_X_NULL_REF_POINTER (1780), 9x: success */
ok( (!res && (GetLastError() == RPC_X_NULL_REF_POINTER) ) || ok( (!res && (GetLastError() == RPC_X_NULL_REF_POINTER) ) ||
( res && (GetLastError() == ERROR_SUCCESS) ), ( res && (GetLastError() == ERROR_SUCCESS) ),
@ -1116,7 +1114,7 @@ static void test_EnumPorts(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = EnumPorts(NULL, level, buffer, cbBuf, &pcbNeeded, NULL); res = EnumPortsA(NULL, level, buffer, cbBuf, &pcbNeeded, NULL);
/* NT: RPC_X_NULL_REF_POINTER (1780), 9x: success */ /* NT: RPC_X_NULL_REF_POINTER (1780), 9x: success */
ok( (!res && (GetLastError() == RPC_X_NULL_REF_POINTER) ) || ok( (!res && (GetLastError() == RPC_X_NULL_REF_POINTER) ) ||
( res && (GetLastError() == ERROR_SUCCESS) ), ( res && (GetLastError() == ERROR_SUCCESS) ),
@ -1268,7 +1266,7 @@ static void test_EnumPrinterDrivers(void)
ok(res, "EnumPrinterDriversA failed %u\n", GetLastError()); ok(res, "EnumPrinterDriversA failed %u\n", GetLastError());
if (res && pcReturned > 0) if (res && pcReturned > 0)
{ {
DRIVER_INFO_1 *di_1 = (DRIVER_INFO_1 *)buffer; DRIVER_INFO_1A *di_1 = (DRIVER_INFO_1A *)buffer;
ok((LPBYTE) di_1->pName == NULL || (LPBYTE) di_1->pName < buffer || ok((LPBYTE) di_1->pName == NULL || (LPBYTE) di_1->pName < buffer ||
(LPBYTE) di_1->pName >= (LPBYTE)(di_1 + pcReturned), (LPBYTE) di_1->pName >= (LPBYTE)(di_1 + pcReturned),
"Driver Information not in sequence; pName %p, top of data %p\n", "Driver Information not in sequence; pName %p, top of data %p\n",
@ -1779,7 +1777,7 @@ static void test_OpenPrinter(void)
DWORD res; DWORD res;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(NULL, NULL, NULL); res = OpenPrinterA(NULL, NULL, NULL);
if (is_spooler_deactivated(res, GetLastError())) return; if (is_spooler_deactivated(res, GetLastError())) return;
ok(!res && (GetLastError() == ERROR_INVALID_PARAMETER), ok(!res && (GetLastError() == ERROR_INVALID_PARAMETER),
@ -1790,7 +1788,7 @@ static void test_OpenPrinter(void)
/* Get Handle for the local Printserver (NT only)*/ /* Get Handle for the local Printserver (NT only)*/
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(NULL, &hprinter, NULL); res = OpenPrinterA(NULL, &hprinter, NULL);
if (is_spooler_deactivated(res, GetLastError())) return; if (is_spooler_deactivated(res, GetLastError())) return;
ok(res || (!res && GetLastError() == ERROR_INVALID_PARAMETER), ok(res || (!res && GetLastError() == ERROR_INVALID_PARAMETER),
"returned %d with %d (expected '!=0' or '0' with ERROR_INVALID_PARAMETER)\n", "returned %d with %d (expected '!=0' or '0' with ERROR_INVALID_PARAMETER)\n",
@ -1804,14 +1802,14 @@ static void test_OpenPrinter(void)
defaults.DesiredAccess=0; defaults.DesiredAccess=0;
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(NULL, &hprinter, &defaults); res = OpenPrinterA(NULL, &hprinter, &defaults);
ok(res, "returned %d with %d (expected '!=0')\n", res, GetLastError()); ok(res, "returned %d with %d (expected '!=0')\n", res, GetLastError());
if (res) ClosePrinter(hprinter); if (res) ClosePrinter(hprinter);
defaults.DesiredAccess=-1; defaults.DesiredAccess=-1;
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(NULL, &hprinter, &defaults); res = OpenPrinterA(NULL, &hprinter, &defaults);
todo_wine { todo_wine {
ok(!res && GetLastError() == ERROR_ACCESS_DENIED, ok(!res && GetLastError() == ERROR_ACCESS_DENIED,
"returned %d with %d (expected '0' with ERROR_ACCESS_DENIED)\n", "returned %d with %d (expected '0' with ERROR_ACCESS_DENIED)\n",
@ -1825,7 +1823,7 @@ static void test_OpenPrinter(void)
if (local_server != NULL) { if (local_server != NULL) {
hprinter = (HANDLE) 0xdeadbeef; hprinter = (HANDLE) 0xdeadbeef;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = OpenPrinter(local_server, &hprinter, NULL); res = OpenPrinterA(local_server, &hprinter, NULL);
ok(res || (!res && GetLastError() == ERROR_INVALID_PARAMETER), ok(res || (!res && GetLastError() == ERROR_INVALID_PARAMETER),
"returned %d with %d (expected '!=0' or '0' with ERROR_INVALID_PARAMETER)\n", "returned %d with %d (expected '!=0' or '0' with ERROR_INVALID_PARAMETER)\n",
res, GetLastError()); res, GetLastError());
@ -1835,7 +1833,7 @@ static void test_OpenPrinter(void)
/* Invalid Printername */ /* Invalid Printername */
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(illegal_name, &hprinter, NULL); res = OpenPrinterA(illegal_name, &hprinter, NULL);
ok(!res && ((GetLastError() == ERROR_INVALID_PRINTER_NAME) || ok(!res && ((GetLastError() == ERROR_INVALID_PRINTER_NAME) ||
(GetLastError() == ERROR_INVALID_PARAMETER) ), (GetLastError() == ERROR_INVALID_PARAMETER) ),
"returned %d with %d (expected '0' with: ERROR_INVALID_PARAMETER or" "returned %d with %d (expected '0' with: ERROR_INVALID_PARAMETER or"
@ -1844,7 +1842,7 @@ static void test_OpenPrinter(void)
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(empty, &hprinter, NULL); res = OpenPrinterA(empty, &hprinter, NULL);
/* NT: ERROR_INVALID_PRINTER_NAME, 9x: ERROR_INVALID_PARAMETER */ /* NT: ERROR_INVALID_PRINTER_NAME, 9x: ERROR_INVALID_PARAMETER */
ok( !res && ok( !res &&
((GetLastError() == ERROR_INVALID_PRINTER_NAME) || ((GetLastError() == ERROR_INVALID_PRINTER_NAME) ||
@ -1859,7 +1857,7 @@ static void test_OpenPrinter(void)
{ {
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(default_printer, &hprinter, NULL); res = OpenPrinterA(default_printer, &hprinter, NULL);
if((!res) && (GetLastError() == RPC_S_SERVER_UNAVAILABLE)) if((!res) && (GetLastError() == RPC_S_SERVER_UNAVAILABLE))
{ {
trace("The service 'Spooler' is required for '%s'\n", default_printer); trace("The service 'Spooler' is required for '%s'\n", default_printer);
@ -1869,7 +1867,7 @@ static void test_OpenPrinter(void)
if(res) ClosePrinter(hprinter); if(res) ClosePrinter(hprinter);
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(default_printer, NULL, NULL); res = OpenPrinterA(default_printer, NULL, NULL);
/* NT: FALSE with ERROR_INVALID_PARAMETER, 9x: TRUE */ /* NT: FALSE with ERROR_INVALID_PARAMETER, 9x: TRUE */
ok(res || (GetLastError() == ERROR_INVALID_PARAMETER), ok(res || (GetLastError() == ERROR_INVALID_PARAMETER),
"returned %d with %d (expected '!=0' or '0' with " "returned %d with %d (expected '!=0' or '0' with "
@ -1881,7 +1879,7 @@ static void test_OpenPrinter(void)
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(default_printer, &hprinter, &defaults); res = OpenPrinterA(default_printer, &hprinter, &defaults);
ok(res || GetLastError() == ERROR_ACCESS_DENIED, ok(res || GetLastError() == ERROR_ACCESS_DENIED,
"returned %d with %d (expected '!=0' or '0' with " "returned %d with %d (expected '!=0' or '0' with "
"ERROR_ACCESS_DENIED)\n", res, GetLastError()); "ERROR_ACCESS_DENIED)\n", res, GetLastError());
@ -1891,7 +1889,7 @@ static void test_OpenPrinter(void)
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(default_printer, &hprinter, &defaults); res = OpenPrinterA(default_printer, &hprinter, &defaults);
/* stop here, when a remote Printserver has no RPC-Service running */ /* stop here, when a remote Printserver has no RPC-Service running */
if (is_spooler_deactivated(res, GetLastError())) return; if (is_spooler_deactivated(res, GetLastError())) return;
ok(res || ((GetLastError() == ERROR_INVALID_DATATYPE) || ok(res || ((GetLastError() == ERROR_INVALID_DATATYPE) ||
@ -1907,7 +1905,7 @@ static void test_OpenPrinter(void)
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(default_printer, &hprinter, &defaults); res = OpenPrinterA(default_printer, &hprinter, &defaults);
ok(res || GetLastError() == ERROR_ACCESS_DENIED, ok(res || GetLastError() == ERROR_ACCESS_DENIED,
"returned %d with %d (expected '!=0' or '0' with " "returned %d with %d (expected '!=0' or '0' with "
"ERROR_ACCESS_DENIED)\n", res, GetLastError()); "ERROR_ACCESS_DENIED)\n", res, GetLastError());
@ -1917,7 +1915,7 @@ static void test_OpenPrinter(void)
defaults.DesiredAccess=PRINTER_ALL_ACCESS; defaults.DesiredAccess=PRINTER_ALL_ACCESS;
hprinter = (HANDLE) MAGIC_DEAD; hprinter = (HANDLE) MAGIC_DEAD;
SetLastError(MAGIC_DEAD); SetLastError(MAGIC_DEAD);
res = OpenPrinter(default_printer, &hprinter, &defaults); res = OpenPrinterA(default_printer, &hprinter, &defaults);
ok(res || GetLastError() == ERROR_ACCESS_DENIED, ok(res || GetLastError() == ERROR_ACCESS_DENIED,
"returned %d with %d (expected '!=0' or '0' with " "returned %d with %d (expected '!=0' or '0' with "
"ERROR_ACCESS_DENIED)\n", res, GetLastError()); "ERROR_ACCESS_DENIED)\n", res, GetLastError());
@ -2056,7 +2054,7 @@ static void test_XcvDataW_MonitorUI(void)
hXcv = NULL; hXcv = NULL;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = OpenPrinter(xcv_localport, &hXcv, &pd); res = OpenPrinterA(xcv_localport, &hXcv, &pd);
if (is_spooler_deactivated(res, GetLastError())) return; if (is_spooler_deactivated(res, GetLastError())) return;
if (is_access_denied(res, GetLastError())) return; if (is_access_denied(res, GetLastError())) return;
@ -2174,7 +2172,7 @@ static void test_XcvDataW_PortIsValid(void)
hXcv = NULL; hXcv = NULL;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = OpenPrinter(xcv_localport, &hXcv, &pd); res = OpenPrinterA(xcv_localport, &hXcv, &pd);
if (is_spooler_deactivated(res, GetLastError())) return; if (is_spooler_deactivated(res, GetLastError())) return;
if (is_access_denied(res, GetLastError())) return; if (is_access_denied(res, GetLastError())) return;
@ -2283,7 +2281,7 @@ static void test_GetPrinter(void)
} }
hprn = 0; hprn = 0;
ret = OpenPrinter(default_printer, &hprn, NULL); ret = OpenPrinterA(default_printer, &hprn, NULL);
if (!ret) if (!ret)
{ {
skip("Unable to open the default printer (%s)\n", default_printer); skip("Unable to open the default printer (%s)\n", default_printer);
@ -2295,7 +2293,7 @@ static void test_GetPrinter(void)
{ {
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
needed = (DWORD)-1; needed = (DWORD)-1;
ret = GetPrinter(hprn, level, NULL, 0, &needed); ret = GetPrinterA(hprn, level, NULL, 0, &needed);
if (ret) if (ret)
{ {
win_skip("Level %d is not supported on Win9x/WinMe\n", level); win_skip("Level %d is not supported on Win9x/WinMe\n", level);
@ -2327,13 +2325,13 @@ static void test_GetPrinter(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
filled = -1; filled = -1;
ret = GetPrinter(hprn, level, buf, needed, &filled); ret = GetPrinterA(hprn, level, buf, needed, &filled);
ok(ret, "level %d: GetPrinter error %d\n", level, GetLastError()); ok(ret, "level %d: GetPrinter error %d\n", level, GetLastError());
ok(needed == filled, "needed %d != filled %d\n", needed, filled); ok(needed == filled, "needed %d != filled %d\n", needed, filled);
if (level == 2) if (level == 2)
{ {
PRINTER_INFO_2 *pi_2 = (PRINTER_INFO_2 *)buf; PRINTER_INFO_2A *pi_2 = (PRINTER_INFO_2A *)buf;
ok(pi_2->pPrinterName!= NULL, "not expected NULL ptr\n"); ok(pi_2->pPrinterName!= NULL, "not expected NULL ptr\n");
ok(pi_2->pDriverName!= NULL, "not expected NULL ptr\n"); ok(pi_2->pDriverName!= NULL, "not expected NULL ptr\n");
@ -2364,7 +2362,7 @@ static void test_GetPrinterData(void)
/* ToDo: test parameter validation, test with the default printer */ /* ToDo: test parameter validation, test with the default printer */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = OpenPrinter(NULL, &hprn, NULL); res = OpenPrinterA(NULL, &hprn, NULL);
if (!res) if (!res)
{ {
/* printserver not available on win9x */ /* printserver not available on win9x */
@ -2419,7 +2417,7 @@ static void test_GetPrinterDataEx(void)
/* ToDo: test parameter validation, test with the default printer */ /* ToDo: test parameter validation, test with the default printer */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
res = OpenPrinter(NULL, &hprn, NULL); res = OpenPrinterA(NULL, &hprn, NULL);
if (!res) if (!res)
{ {
win_skip("Unable to open the printserver: %d\n", GetLastError()); win_skip("Unable to open the printserver: %d\n", GetLastError());
@ -2517,7 +2515,7 @@ static void test_GetPrinterDriver(void)
} }
hprn = 0; hprn = 0;
ret = OpenPrinter(default_printer, &hprn, NULL); ret = OpenPrinterA(default_printer, &hprn, NULL);
if (!ret) if (!ret)
{ {
skip("Unable to open the default printer (%s)\n", default_printer); skip("Unable to open the default printer (%s)\n", default_printer);
@ -2529,7 +2527,7 @@ static void test_GetPrinterDriver(void)
{ {
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
needed = (DWORD)-1; needed = (DWORD)-1;
ret = GetPrinterDriver(hprn, NULL, level, NULL, 0, &needed); ret = GetPrinterDriverA(hprn, NULL, level, NULL, 0, &needed);
ok(!ret, "level %d: GetPrinterDriver should fail\n", level); ok(!ret, "level %d: GetPrinterDriver should fail\n", level);
if (level >= 1 && level <= 6) if (level >= 1 && level <= 6)
{ {
@ -2564,13 +2562,13 @@ static void test_GetPrinterDriver(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
filled = -1; filled = -1;
ret = GetPrinterDriver(hprn, NULL, level, buf, needed, &filled); ret = GetPrinterDriverA(hprn, NULL, level, buf, needed, &filled);
ok(ret, "level %d: GetPrinterDriver error %d\n", level, GetLastError()); ok(ret, "level %d: GetPrinterDriver error %d\n", level, GetLastError());
ok(needed == filled, "needed %d != filled %d\n", needed, filled); ok(needed == filled, "needed %d != filled %d\n", needed, filled);
if (level == 2) if (level == 2)
{ {
DRIVER_INFO_2 *di_2 = (DRIVER_INFO_2 *)buf; DRIVER_INFO_2A *di_2 = (DRIVER_INFO_2A *)buf;
DWORD calculated = sizeof(*di_2); DWORD calculated = sizeof(*di_2);
HANDLE hf; HANDLE hf;
@ -2617,7 +2615,7 @@ static void test_GetPrinterDriver(void)
ok(filled >= calculated,"calculated %d != filled %d\n", calculated, filled); ok(filled >= calculated,"calculated %d != filled %d\n", calculated, filled);
/* Obscure test - demonstrate that Windows zero fills the buffer, even on failure */ /* Obscure test - demonstrate that Windows zero fills the buffer, even on failure */
ret = GetPrinterDriver(hprn, NULL, level, buf, needed - 2, &filled); ret = GetPrinterDriverA(hprn, NULL, level, buf, needed - 2, &filled);
ok(!ret, "level %d: GetPrinterDriver succeeded with less buffer than it should\n", level); ok(!ret, "level %d: GetPrinterDriver succeeded with less buffer than it should\n", level);
ok(di_2->pDataFile == NULL || ok(di_2->pDataFile == NULL ||
broken(di_2->pDataFile != NULL), /* Win9x/WinMe */ broken(di_2->pDataFile != NULL), /* Win9x/WinMe */
@ -2632,9 +2630,9 @@ static void test_GetPrinterDriver(void)
ok(ret, "ClosePrinter error %d\n", GetLastError()); ok(ret, "ClosePrinter error %d\n", GetLastError());
} }
static void test_DEVMODE(const DEVMODE *dm, LONG dmSize, LPCSTR exp_prn_name) static void test_DEVMODEA(const DEVMODEA *dm, LONG dmSize, LPCSTR exp_prn_name)
{ {
/* On NT3.51, some fields in DEVMODE are empty/zero /* On NT3.51, some fields in DEVMODEA are empty/zero
(dmDeviceName, dmSpecVersion, dmDriverVersion and dmDriverExtra) (dmDeviceName, dmSpecVersion, dmDriverVersion and dmDriverExtra)
We skip the Tests on this Platform */ We skip the Tests on this Platform */
if (dm->dmSpecVersion || dm->dmDriverVersion || dm->dmDriverExtra) { if (dm->dmSpecVersion || dm->dmDriverVersion || dm->dmDriverExtra) {
@ -2652,7 +2650,7 @@ static void test_DocumentProperties(void)
{ {
HANDLE hprn; HANDLE hprn;
LONG dm_size, ret; LONG dm_size, ret;
DEVMODE *dm; DEVMODEA *dm;
char empty_str[] = ""; char empty_str[] = "";
if (!default_printer) if (!default_printer)
@ -2662,7 +2660,7 @@ static void test_DocumentProperties(void)
} }
hprn = 0; hprn = 0;
ret = OpenPrinter(default_printer, &hprn, NULL); ret = OpenPrinterA(default_printer, &hprn, NULL);
if (!ret) if (!ret)
{ {
skip("Unable to open the default printer (%s)\n", default_printer); skip("Unable to open the default printer (%s)\n", default_printer);
@ -2670,19 +2668,19 @@ static void test_DocumentProperties(void)
} }
ok(hprn != 0, "wrong hprn %p\n", hprn); ok(hprn != 0, "wrong hprn %p\n", hprn);
dm_size = DocumentProperties(0, hprn, NULL, NULL, NULL, 0); dm_size = DocumentPropertiesA(0, hprn, NULL, NULL, NULL, 0);
trace("DEVMODE required size %d\n", dm_size); trace("DEVMODEA required size %d\n", dm_size);
ok(dm_size >= sizeof(DEVMODE), "unexpected DocumentProperties ret value %d\n", dm_size); ok(dm_size >= sizeof(DEVMODEA), "unexpected DocumentPropertiesA ret value %d\n", dm_size);
dm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dm_size); dm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dm_size);
ret = DocumentProperties(0, hprn, NULL, dm, dm, DM_OUT_BUFFER); ret = DocumentPropertiesA(0, hprn, NULL, dm, dm, DM_OUT_BUFFER);
ok(ret == IDOK, "DocumentProperties ret value %d != expected IDOK\n", ret); ok(ret == IDOK, "DocumentPropertiesA ret value %d != expected IDOK\n", ret);
ret = DocumentProperties(0, hprn, empty_str, dm, dm, DM_OUT_BUFFER); ret = DocumentPropertiesA(0, hprn, empty_str, dm, dm, DM_OUT_BUFFER);
ok(ret == IDOK, "DocumentProperties ret value %d != expected IDOK\n", ret); ok(ret == IDOK, "DocumentPropertiesA ret value %d != expected IDOK\n", ret);
test_DEVMODE(dm, dm_size, default_printer); test_DEVMODEA(dm, dm_size, default_printer);
HeapFree(GetProcessHeap(), 0, dm); HeapFree(GetProcessHeap(), 0, dm);
@ -2748,7 +2746,7 @@ static void test_DeviceCapabilities(void)
HANDLE hComdlg32; HANDLE hComdlg32;
BOOL (WINAPI *pPrintDlgA)(PRINTDLGA *); BOOL (WINAPI *pPrintDlgA)(PRINTDLGA *);
PRINTDLGA prn_dlg; PRINTDLGA prn_dlg;
DEVMODE *dm; DEVMODEA *dm;
DEVNAMES *dn; DEVNAMES *dn;
const char *driver, *device, *port; const char *driver, *device, *port;
WORD *papers; WORD *papers;
@ -2794,12 +2792,12 @@ static void test_DeviceCapabilities(void)
port = (const char *)dn + dn->wOutputOffset; port = (const char *)dn + dn->wOutputOffset;
trace("driver \"%s\" device \"%s\" port \"%s\"\n", driver, device, port); trace("driver \"%s\" device \"%s\" port \"%s\"\n", driver, device, port);
test_DEVMODE(dm, dm->dmSize + dm->dmDriverExtra, device); test_DEVMODEA(dm, dm->dmSize + dm->dmDriverExtra, device);
n_papers = DeviceCapabilities(device, port, DC_PAPERS, NULL, NULL); n_papers = DeviceCapabilitiesA(device, port, DC_PAPERS, NULL, NULL);
ok(n_papers > 0, "DeviceCapabilities DC_PAPERS failed\n"); ok(n_papers > 0, "DeviceCapabilitiesA DC_PAPERS failed\n");
papers = HeapAlloc(GetProcessHeap(), 0, sizeof(*papers) * n_papers); papers = HeapAlloc(GetProcessHeap(), 0, sizeof(*papers) * n_papers);
ret = DeviceCapabilities(device, port, DC_PAPERS, (LPSTR)papers, NULL); ret = DeviceCapabilitiesA(device, port, DC_PAPERS, (LPSTR)papers, NULL);
ok(ret == n_papers, "expected %d, got %d\n", n_papers, ret); ok(ret == n_papers, "expected %d, got %d\n", n_papers, ret);
#ifdef VERBOSE #ifdef VERBOSE
for (ret = 0; ret < n_papers; ret++) for (ret = 0; ret < n_papers; ret++)
@ -2807,11 +2805,11 @@ static void test_DeviceCapabilities(void)
#endif #endif
HeapFree(GetProcessHeap(), 0, papers); HeapFree(GetProcessHeap(), 0, papers);
n_paper_size = DeviceCapabilities(device, port, DC_PAPERSIZE, NULL, NULL); n_paper_size = DeviceCapabilitiesA(device, port, DC_PAPERSIZE, NULL, NULL);
ok(n_paper_size > 0, "DeviceCapabilities DC_PAPERSIZE failed\n"); ok(n_paper_size > 0, "DeviceCapabilitiesA DC_PAPERSIZE failed\n");
ok(n_paper_size == n_papers, "n_paper_size %d != n_papers %d\n", n_paper_size, n_papers); ok(n_paper_size == n_papers, "n_paper_size %d != n_papers %d\n", n_paper_size, n_papers);
paper_size = HeapAlloc(GetProcessHeap(), 0, sizeof(*paper_size) * n_paper_size); paper_size = HeapAlloc(GetProcessHeap(), 0, sizeof(*paper_size) * n_paper_size);
ret = DeviceCapabilities(device, port, DC_PAPERSIZE, (LPSTR)paper_size, NULL); ret = DeviceCapabilitiesA(device, port, DC_PAPERSIZE, (LPSTR)paper_size, NULL);
ok(ret == n_paper_size, "expected %d, got %d\n", n_paper_size, ret); ok(ret == n_paper_size, "expected %d, got %d\n", n_paper_size, ret);
#ifdef VERBOSE #ifdef VERBOSE
for (ret = 0; ret < n_paper_size; ret++) for (ret = 0; ret < n_paper_size; ret++)
@ -2819,11 +2817,11 @@ static void test_DeviceCapabilities(void)
#endif #endif
HeapFree(GetProcessHeap(), 0, paper_size); HeapFree(GetProcessHeap(), 0, paper_size);
n_paper_names = DeviceCapabilities(device, port, DC_PAPERNAMES, NULL, NULL); n_paper_names = DeviceCapabilitiesA(device, port, DC_PAPERNAMES, NULL, NULL);
ok(n_paper_names > 0, "DeviceCapabilities DC_PAPERNAMES failed\n"); ok(n_paper_names > 0, "DeviceCapabilitiesA DC_PAPERNAMES failed\n");
ok(n_paper_names == n_papers, "n_paper_names %d != n_papers %d\n", n_paper_names, n_papers); ok(n_paper_names == n_papers, "n_paper_names %d != n_papers %d\n", n_paper_names, n_papers);
paper_name = HeapAlloc(GetProcessHeap(), 0, sizeof(*paper_name) * n_paper_names); paper_name = HeapAlloc(GetProcessHeap(), 0, sizeof(*paper_name) * n_paper_names);
ret = DeviceCapabilities(device, port, DC_PAPERNAMES, (LPSTR)paper_name, NULL); ret = DeviceCapabilitiesA(device, port, DC_PAPERNAMES, (LPSTR)paper_name, NULL);
ok(ret == n_paper_names, "expected %d, got %d\n", n_paper_names, ret); ok(ret == n_paper_names, "expected %d, got %d\n", n_paper_names, ret);
#ifdef VERBOSE #ifdef VERBOSE
for (ret = 0; ret < n_paper_names; ret++) for (ret = 0; ret < n_paper_names; ret++)
@ -2831,26 +2829,26 @@ static void test_DeviceCapabilities(void)
#endif #endif
HeapFree(GetProcessHeap(), 0, paper_name); HeapFree(GetProcessHeap(), 0, paper_name);
n_copies = DeviceCapabilities(device, port, DC_COPIES, NULL, dm); n_copies = DeviceCapabilitiesA(device, port, DC_COPIES, NULL, dm);
ok(n_copies > 0, "DeviceCapabilities DC_COPIES failed\n"); ok(n_copies > 0, "DeviceCapabilitiesA DC_COPIES failed\n");
trace("n_copies = %d\n", n_copies); trace("n_copies = %d\n", n_copies);
/* these capabilities are not available on all printer drivers */ /* these capabilities are not available on all printer drivers */
if (0) if (0)
{ {
ret = DeviceCapabilities(device, port, DC_MAXEXTENT, NULL, NULL); ret = DeviceCapabilitiesA(device, port, DC_MAXEXTENT, NULL, NULL);
ok(ret != -1, "DeviceCapabilities DC_MAXEXTENT failed\n"); ok(ret != -1, "DeviceCapabilitiesA DC_MAXEXTENT failed\n");
ext = MAKEPOINTS(ret); ext = MAKEPOINTS(ret);
trace("max ext = %d x %d\n", ext.x, ext.y); trace("max ext = %d x %d\n", ext.x, ext.y);
ret = DeviceCapabilities(device, port, DC_MINEXTENT, NULL, NULL); ret = DeviceCapabilitiesA(device, port, DC_MINEXTENT, NULL, NULL);
ok(ret != -1, "DeviceCapabilities DC_MINEXTENT failed\n"); ok(ret != -1, "DeviceCapabilitiesA DC_MINEXTENT failed\n");
ext = MAKEPOINTS(ret); ext = MAKEPOINTS(ret);
trace("min ext = %d x %d\n", ext.x, ext.y); trace("min ext = %d x %d\n", ext.x, ext.y);
} }
fields = DeviceCapabilities(device, port, DC_FIELDS, NULL, NULL); fields = DeviceCapabilitiesA(device, port, DC_FIELDS, NULL, NULL);
ok(fields != (DWORD)-1, "DeviceCapabilities DC_FIELDS failed\n"); ok(fields != (DWORD)-1, "DeviceCapabilitiesA DC_FIELDS failed\n");
ok(fields == (dm->dmFields | DM_FORMNAME) || ok(fields == (dm->dmFields | DM_FORMNAME) ||
fields == ((dm->dmFields | DM_FORMNAME | DM_PAPERSIZE) & ~(DM_PAPERLENGTH|DM_PAPERWIDTH)) || fields == ((dm->dmFields | DM_FORMNAME | DM_PAPERSIZE) & ~(DM_PAPERLENGTH|DM_PAPERWIDTH)) ||
broken(fields == dm->dmFields), /* Win9x/WinMe */ broken(fields == dm->dmFields), /* Win9x/WinMe */
@ -2888,11 +2886,11 @@ static void test_OpenPrinter_defaults(void)
BOOL ret; BOOL ret;
DWORD needed; DWORD needed;
short default_size; short default_size;
ADDJOB_INFO_1 *add_job; ADDJOB_INFO_1A *add_job;
JOB_INFO_2 *job_info; JOB_INFO_2A *job_info;
DEVMODE my_dm; DEVMODEA my_dm;
PRINTER_DEFAULTS prn_def; PRINTER_DEFAULTSA prn_def;
PRINTER_INFO_2 *pi; PRINTER_INFO_2A *pi;
if (!default_printer) if (!default_printer)
{ {
@ -2903,35 +2901,35 @@ static void test_OpenPrinter_defaults(void)
/* Printer opened with NULL defaults. Retrieve default paper size /* Printer opened with NULL defaults. Retrieve default paper size
and confirm that jobs have this size. */ and confirm that jobs have this size. */
ret = OpenPrinter( default_printer, &printer, NULL ); ret = OpenPrinterA( default_printer, &printer, NULL );
if (!ret) if (!ret)
{ {
skip("Unable to open the default printer (%s)\n", default_printer); skip("Unable to open the default printer (%s)\n", default_printer);
return; return;
} }
ret = GetPrinter( printer, 2, NULL, 0, &needed ); ret = GetPrinterA( printer, 2, NULL, 0, &needed );
ok( !ret, "got %d\n", ret ); ok( !ret, "got %d\n", ret );
pi = HeapAlloc( GetProcessHeap(), 0, needed ); pi = HeapAlloc( GetProcessHeap(), 0, needed );
ret = GetPrinter( printer, 2, (BYTE *)pi, needed, &needed ); ret = GetPrinterA( printer, 2, (BYTE *)pi, needed, &needed );
ok( ret, "got %d\n", ret ); ok( ret, "got %d\n", ret );
default_size = pi->pDevMode->u1.s1.dmPaperSize; default_size = pi->pDevMode->u1.s1.dmPaperSize;
HeapFree( GetProcessHeap(), 0, pi ); HeapFree( GetProcessHeap(), 0, pi );
ret = AddJob( printer, 1, NULL, 0, &needed ); ret = AddJobA( printer, 1, NULL, 0, &needed );
ok( !ret, "got %d\n", ret ); ok( !ret, "got %d\n", ret );
add_job = HeapAlloc( GetProcessHeap(), 0, needed ); add_job = HeapAlloc( GetProcessHeap(), 0, needed );
ret = AddJob( printer, 1, (BYTE *)add_job, needed, &needed ); ret = AddJobA( printer, 1, (BYTE *)add_job, needed, &needed );
ok( ret, "got %d\n", ret ); ok( ret, "got %d\n", ret );
ret = GetJob( printer, add_job->JobId, 2, NULL, 0, &needed ); ret = GetJobA( printer, add_job->JobId, 2, NULL, 0, &needed );
ok( !ret, "got %d\n", ret ); ok( !ret, "got %d\n", ret );
job_info = HeapAlloc( GetProcessHeap(), 0, needed ); job_info = HeapAlloc( GetProcessHeap(), 0, needed );
ret = GetJob( printer, add_job->JobId, 2, (BYTE *)job_info, needed, &needed ); ret = GetJobA( printer, add_job->JobId, 2, (BYTE *)job_info, needed, &needed );
ok( ret, "got %d\n", ret ); ok( ret, "got %d\n", ret );
todo_wine todo_wine
ok( job_info->pDevMode != NULL, "got NULL devmode\n"); ok( job_info->pDevMode != NULL, "got NULL DEVMODEA\n");
if (job_info->pDevMode) if (job_info->pDevMode)
ok( job_info->pDevMode->u1.s1.dmPaperSize == default_size, "got %d default %d\n", ok( job_info->pDevMode->u1.s1.dmPaperSize == default_size, "got %d default %d\n",
job_info->pDevMode->u1.s1.dmPaperSize, default_size ); job_info->pDevMode->u1.s1.dmPaperSize, default_size );
@ -2952,31 +2950,31 @@ todo_wine
prn_def.pDevMode = &my_dm; prn_def.pDevMode = &my_dm;
prn_def.DesiredAccess = PRINTER_ACCESS_USE; prn_def.DesiredAccess = PRINTER_ACCESS_USE;
ret = OpenPrinter( default_printer, &printer, &prn_def ); ret = OpenPrinterA( default_printer, &printer, &prn_def );
ok( ret, "got %d\n", ret ); ok( ret, "got %d\n", ret );
/* GetPrinter stills returns default size */ /* GetPrinter stills returns default size */
ret = GetPrinter( printer, 2, NULL, 0, &needed ); ret = GetPrinterA( printer, 2, NULL, 0, &needed );
ok( !ret, "got %d\n", ret ); ok( !ret, "got %d\n", ret );
pi = HeapAlloc( GetProcessHeap(), 0, needed ); pi = HeapAlloc( GetProcessHeap(), 0, needed );
ret = GetPrinter( printer, 2, (BYTE *)pi, needed, &needed ); ret = GetPrinterA( printer, 2, (BYTE *)pi, needed, &needed );
ok( ret, "got %d\n", ret ); ok( ret, "got %d\n", ret );
ok( pi->pDevMode->u1.s1.dmPaperSize == default_size, "got %d default %d\n", ok( pi->pDevMode->u1.s1.dmPaperSize == default_size, "got %d default %d\n",
pi->pDevMode->u1.s1.dmPaperSize, default_size ); pi->pDevMode->u1.s1.dmPaperSize, default_size );
HeapFree( GetProcessHeap(), 0, pi ); HeapFree( GetProcessHeap(), 0, pi );
/* However the GetJob has the new size */ /* However the GetJobA has the new size */
ret = AddJob( printer, 1, NULL, 0, &needed ); ret = AddJobA( printer, 1, NULL, 0, &needed );
ok( !ret, "got %d\n", ret ); ok( !ret, "got %d\n", ret );
add_job = HeapAlloc( GetProcessHeap(), 0, needed ); add_job = HeapAlloc( GetProcessHeap(), 0, needed );
ret = AddJob( printer, 1, (BYTE *)add_job, needed, &needed ); ret = AddJobA( printer, 1, (BYTE *)add_job, needed, &needed );
ok( ret, "got %d\n", ret ); ok( ret, "got %d\n", ret );
ret = GetJob( printer, add_job->JobId, 2, NULL, 0, &needed ); ret = GetJobA( printer, add_job->JobId, 2, NULL, 0, &needed );
ok( !ret, "got %d\n", ret ); ok( !ret, "got %d\n", ret );
job_info = HeapAlloc( GetProcessHeap(), 0, needed ); job_info = HeapAlloc( GetProcessHeap(), 0, needed );
ret = GetJob( printer, add_job->JobId, 2, (BYTE *)job_info, needed, &needed ); ret = GetJobA( printer, add_job->JobId, 2, (BYTE *)job_info, needed, &needed );
ok( ret, "got %d\n", ret ); ok( ret, "got %d\n", ret );
ok( job_info->pDevMode->dmFields == DM_PAPERSIZE, "got %08x\n", ok( job_info->pDevMode->dmFields == DM_PAPERSIZE, "got %08x\n",