Add a little test program "winspool_print" that just prints a single line of unformat...
[reactos.git] / reactos / temp / winspool_print / main.c
1 #include <stdio.h>
2 #include <windows.h>
3
4 int main()
5 {
6 int ReturnValue = 1;
7 DWORD dwWritten;
8 HANDLE hPrinter = NULL;
9 DOC_INFO_1W docInfo;
10 char szString[] = "winspool_print Test\f";
11
12 if (!OpenPrinterW(L"Generic / Text Only", &hPrinter, NULL))
13 {
14 printf("OpenPrinterW failed\n");
15 goto Cleanup;
16 }
17
18 ZeroMemory(&docInfo, sizeof(docInfo));
19 docInfo.pDocName = L"winspool_print";
20
21 if (!StartDocPrinterW(hPrinter, 1, (LPBYTE)&docInfo))
22 {
23 printf("StartDocPrinterW failed, last error is %u!\n", GetLastError());
24 goto Cleanup;
25 }
26
27 if (!StartPagePrinter(hPrinter))
28 {
29 printf("StartPagePrinter failed, last error is %u!\n", GetLastError());
30 goto Cleanup;
31 }
32
33 if (!WritePrinter(hPrinter, szString, strlen(szString), &dwWritten))
34 {
35 printf("WritePrinter failed, last error is %u!\n", GetLastError());
36 goto Cleanup;
37 }
38
39 if (!EndPagePrinter(hPrinter))
40 {
41 printf("EndPagePrinter failed, last error is %u!\n", GetLastError());
42 goto Cleanup;
43 }
44
45 if (!EndDocPrinter(hPrinter))
46 {
47 printf("EndDocPrinter failed, last error is %u!\n", GetLastError());
48 goto Cleanup;
49 }
50
51 ReturnValue = 0;
52
53 Cleanup:
54 if (hPrinter)
55 ClosePrinter(hPrinter);
56
57 return ReturnValue;
58 }