17{
19 BYTE ZeroBuffer[50] = { 0 };
22 DWORD cchComputerName;
28
29 wszComputerName[0] =
L'\\';
30 wszComputerName[1] =
L'\\';
33 {
35 return;
36 }
37
38 cchComputerName += 2;
39
40
41 memset(TempBuffer, 0xDE,
sizeof(TempBuffer));
42 cbNeeded = 0xDEADBEEF;
43 dwReturned = 0xDEADBEEF;
45 ok(
EnumPrintersW(0,
NULL, 1, TempBuffer,
sizeof(TempBuffer), &cbNeeded, &dwReturned),
"EnumPrintersW returns FALSE\n");
47 ok(
memcmp(TempBuffer, ZeroBuffer,
sizeof(TempBuffer)) == 0,
"TempBuffer has not been zeroed!\n");
48 ok(cbNeeded == 0,
"cbNeeded is %lu!\n", cbNeeded);
49 ok(dwReturned == 0,
"dwReturned is %lu!\n", dwReturned);
50
51
52 cbNeeded = 0xDEADBEEF;
53 dwReturned = 0xDEADBEEF;
57 ok(cbNeeded == 0xDEADBEEF,
"cbNeeded is %lu!\n", cbNeeded);
58 ok(dwReturned == 0xDEADBEEF,
"dwReturned is %lu!\n", dwReturned);
59
60
61 cbNeeded = 0xDEADBEEF;
62 dwReturned = 0xDEADBEEF;
66 ok(cbNeeded == 0xDEADBEEF,
"cbNeeded is %lu!\n", cbNeeded);
67 ok(dwReturned == 0xDEADBEEF,
"dwReturned is %lu!\n", dwReturned);
68
69
71 {
73 continue;
74
75
79
80
84 ok(cbNeeded == 0,
"cbNeeded is %lu for Level %lu!\n", cbNeeded,
Level);
85 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
86
87
91 ok(cbNeeded == 0,
"cbNeeded is %lu for Level %lu!\n", cbNeeded,
Level);
92 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
93
94
98 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
99
100
101 if (cbNeeded > 0)
102 {
103
107 ok(cbNeeded > 0,
"cbNeeded is 0 for Level %lu!\n",
Level);
108 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
109
110
114 ok(cbTemp == 0,
"cbTemp is %lu for Level %lu!\n", cbTemp,
Level);
115 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
116
117
118
124
126 {
127
131 ok(cbNeeded == 0,
"cbNeeded is %lu for Level %lu!\n", cbNeeded,
Level);
132 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
133 }
134
135
136
140 ok(cbNeeded == cbTemp,
"cbNeeded is %lu, reference size is %lu for Level %lu!\n", cbNeeded, cbTemp,
Level);
141 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
142
143
144
148 ok(cbNeeded > cbTemp,
"cbNeeded is %lu, reference size is %lu for Level %lu!\n", cbNeeded, cbTemp,
Level);
149 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
150
152 {
153
154 wszComputerName[cchComputerName++] =
L'\\';
155 wszComputerName[cchComputerName] = 0;
159 ok(cbNeeded == 0,
"cbNeeded is %lu for Level %lu!\n", cbNeeded,
Level);
160 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
161 wszComputerName[--cchComputerName] = 0;
162 }
163
164
165
166
170 ok(cbNeeded == cbTemp,
"cbNeeded is %lu, reference size is %lu for Level %lu!\n", cbNeeded, cbTemp,
Level);
171 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
172
173
177 ok(cbNeeded > cbTemp,
"cbNeeded is %lu, reference size is %lu for Level %lu!\n", cbNeeded, cbTemp,
Level);
178 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
179
180
181
182 wszComputerName[cchComputerName++] =
L'\\';
183 wszComputerName[cchComputerName] = 0;
187 ok(cbNeeded == cbTemp,
"cbNeeded is %lu for Level %lu!\n", cbNeeded,
Level);
188 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
189
190
191 wszComputerName[cchComputerName++] =
L'a';
192 wszComputerName[cchComputerName] = 0;
196 ok(cbNeeded == cbTemp,
"cbNeeded is %lu for Level %lu!\n", cbNeeded,
Level);
197 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
198 cchComputerName -= 2;
199 wszComputerName[cchComputerName] = 0;
200 }
201 else
202 {
203 skip(
"cbNeeded is 0 on Level %lu, skipping additional tests!\n",
Level);
204 }
205 }
206
207
208
212 ok(cbNeeded > 0,
"cbNeeded is 0!\n");
213 ok(dwReturned == 0,
"dwReturned is %lu!\n", dwReturned);
214
219 ok(cbTemp == cbNeeded,
"cbTemp is %lu, cbNeeded is %lu!\n", cbTemp, cbNeeded);
220 ok(dwReturned > 0,
"dwReturned is %lu!\n", dwReturned);
221 ok(!
wcscmp(pPrinterInfo1->
pName,
L"Windows NT Local Print Providor"),
"pPrinterInfo1->pName is %S!\n", pPrinterInfo1->
pName);
222 ok(!
wcscmp(pPrinterInfo1->
pComment,
L"Locally connected Printers"),
"pPrinterInfo1->pComment is %S!\n", pPrinterInfo1->
pComment);
225}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
#define ERROR_INSUFFICIENT_BUFFER
#define HeapFree(x, y, z)
#define ERROR_INVALID_NAME
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
DWORD WINAPI GetLastError(void)
#define MAX_COMPUTERNAME_LENGTH
#define ERROR_INVALID_LEVEL
#define ERROR_INVALID_USER_BUFFER
#define RPC_X_NULL_REF_POINTER
#define PRINTER_ENUM_LOCAL
WINBOOL WINAPI EnumPrintersW(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned)
struct _PRINTER_INFO_1W * PPRINTER_INFO_1W
#define PRINTER_ENUM_DEFAULT
#define PRINTER_ENUM_NAME
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level