#include <apitest.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winreg.h>
#include <winspool.h>
#include <winsplp.h>
#include "../localspl_apitest.h"
#include <spoolss.h>
Go to the source code of this file.
◆ MAX_PRINTER_NAME
◆ WIN32_NO_STATUS
◆ GetDefaultPrinterFromRegistry()
We don't link against winspool, so we don't have GetDefaultPrinterW. We can easily implement a similar function ourselves though.
Definition at line 45 of file main.c.
46{
47 static const WCHAR wszWindowsKey[] =
L"Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows";
49
56
57
60 {
61 skip(
"RegOpenKeyExW failed with status %u!\n", dwErrorCode);
63 }
64
65
68 {
69 skip(
"RegQueryValueExW failed with status %u!\n", dwErrorCode);
71 }
72
73
75 if (!pwszDevice)
76 {
77 skip(
"HeapAlloc failed!\n");
79 }
80
81
84 {
85 skip(
"RegQueryValueExW failed with status %u!\n", dwErrorCode);
87 }
88
89
90
91 pwszComma =
wcschr(pwszDevice,
L',');
92 if (!pwszComma)
93 {
94 skip(
"Found no or invalid default printer: %S!\n", pwszDevice);
96 }
97
98
99 *pwszComma = 0;
100 pwszReturnValue = pwszDevice;
101
103 if (hWindowsKey)
105
106 return pwszReturnValue;
107}
static const WCHAR wszWindowsKey[]
static const WCHAR wszDeviceValue[]
#define RegCloseKey(hKey)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
static const WCHAR Cleanup[]
#define HKEY_CURRENT_USER
Referenced by START_TEST().
◆ GetLocalsplFuncs()
Definition at line 110 of file main.c.
111{
114
115
117 if (!hLocalspl)
118 {
121 }
122
123
125 if (!pfnInitializePrintProvidor)
126 {
129 }
130
131
133 {
136 }
137
139}
#define GetProcAddress(x, y)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
BOOL(WINAPI * PInitializePrintProvidor)(LPPRINTPROVIDOR, DWORD, LPWSTR)
DWORD WINAPI GetLastError(void)
Referenced by START_TEST().
◆ START_TEST()
Definition at line 27 of file fpSetJob.c.
28{
32
35
36
37 ok(!pp.fpSetJob(
NULL, 0, 0,
NULL, 0),
"fpSetJob returns TRUE\n");
39
40
42 if (!pwszDefaultPrinter)
43 {
44 skip(
"Could not determine the default printer!\n");
46 }
47
48 if (!pp.fpOpenPrinter(pwszDefaultPrinter, &hPrinter,
NULL))
49 {
50 skip(
"Could not open a handle to the default printer, last error is %lu!\n",
GetLastError());
52 }
53
54
55 ok(!pp.fpSetJob(hPrinter, 0, 0,
NULL, 0),
"fpSetJob returns TRUE\n");
57
59 if (pwszDefaultPrinter)
61
62 if (hPrinter)
63 pp.fpClosePrinter(hPrinter);
64}
#define ERROR_INVALID_PARAMETER
#define HeapFree(x, y, z)
#define ERROR_INVALID_HANDLE
PWSTR GetDefaultPrinterFromRegistry(VOID)
BOOL GetLocalsplFuncs(LPPRINTPROVIDOR pp)