10#define WIN32_NO_STATUS
19 BYTE ZeroBuffer[50] = { 0 };
22 DWORD cchComputerName;
29 wszComputerName[0] =
L'\\';
30 wszComputerName[1] =
L'\\';
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);
52 cbNeeded = 0xDEADBEEF;
53 dwReturned = 0xDEADBEEF;
57 ok(cbNeeded == 0xDEADBEEF,
"cbNeeded is %lu!\n", cbNeeded);
58 ok(dwReturned == 0xDEADBEEF,
"dwReturned is %lu!\n", dwReturned);
61 cbNeeded = 0xDEADBEEF;
62 dwReturned = 0xDEADBEEF;
66 ok(cbNeeded == 0xDEADBEEF,
"cbNeeded is %lu!\n", cbNeeded);
67 ok(dwReturned == 0xDEADBEEF,
"dwReturned is %lu!\n", dwReturned);
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);
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);
98 ok(dwReturned == 0,
"dwReturned is %lu for Level %lu!\n", dwReturned,
Level);
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);
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);
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);
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);
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);
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;
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);
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);
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);
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;
203 skip(
"cbNeeded is 0 on Level %lu, skipping additional tests!\n",
Level);
212 ok(cbNeeded > 0,
"cbNeeded is 0!\n");
213 ok(dwReturned == 0,
"dwReturned is %lu!\n", dwReturned);
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);
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