Add a little test program "winspool_print" that just prints a single line of unformat...
authorColin Finck <colin@reactos.org>
Mon, 4 May 2015 13:39:07 +0000 (13:39 +0000)
committerColin Finck <colin@reactos.org>
Mon, 4 May 2015 13:39:07 +0000 (13:39 +0000)
This line will arrive as RAW data in the printing stack, so it doesn't need any processing through GDI and serves as a good test for the very basic printing components.

svn path=/branches/colins-printing-for-freedom/; revision=67544

reactos/CMakeLists.txt
reactos/temp/CMakeLists.txt [new file with mode: 0644]
reactos/temp/winspool_print/CMakeLists.txt [new file with mode: 0644]
reactos/temp/winspool_print/main.c [new file with mode: 0644]

index 59d6c4c..5f6f15f 100644 (file)
@@ -244,6 +244,7 @@ else()
     add_subdirectory(modules)
     add_subdirectory(ntoskrnl)
     add_subdirectory(subsystems)
     add_subdirectory(modules)
     add_subdirectory(ntoskrnl)
     add_subdirectory(subsystems)
+    add_subdirectory(temp)
     add_subdirectory(tools/wpp)
     add_subdirectory(win32ss)
 
     add_subdirectory(tools/wpp)
     add_subdirectory(win32ss)
 
diff --git a/reactos/temp/CMakeLists.txt b/reactos/temp/CMakeLists.txt
new file mode 100644 (file)
index 0000000..44afdeb
--- /dev/null
@@ -0,0 +1 @@
+add_subdirectory(winspool_print)
diff --git a/reactos/temp/winspool_print/CMakeLists.txt b/reactos/temp/winspool_print/CMakeLists.txt
new file mode 100644 (file)
index 0000000..9c20b51
--- /dev/null
@@ -0,0 +1,4 @@
+add_executable(winspool_print main.c)
+set_module_type(winspool_print win32cui)
+add_importlibs(winspool_print kernel32 msvcrt winspool)
+add_cd_file(TARGET winspool_print DESTINATION reactos/system32 FOR all)
diff --git a/reactos/temp/winspool_print/main.c b/reactos/temp/winspool_print/main.c
new file mode 100644 (file)
index 0000000..f1069fc
--- /dev/null
@@ -0,0 +1,58 @@
+#include <stdio.h>
+#include <windows.h>
+
+int main()
+{
+    int ReturnValue = 1;
+    DWORD dwWritten;
+    HANDLE hPrinter = NULL;
+    DOC_INFO_1W docInfo;
+    char szString[] = "winspool_print Test\f";
+
+    if (!OpenPrinterW(L"Generic / Text Only", &hPrinter, NULL))
+    {
+        printf("OpenPrinterW failed\n");
+        goto Cleanup;
+    }
+
+    ZeroMemory(&docInfo, sizeof(docInfo));
+    docInfo.pDocName = L"winspool_print";
+
+    if (!StartDocPrinterW(hPrinter, 1, (LPBYTE)&docInfo))
+    {
+        printf("StartDocPrinterW failed, last error is %u!\n", GetLastError());
+        goto Cleanup;
+    }
+
+    if (!StartPagePrinter(hPrinter))
+    {
+        printf("StartPagePrinter failed, last error is %u!\n", GetLastError());
+        goto Cleanup;
+    }
+
+    if (!WritePrinter(hPrinter, szString, strlen(szString), &dwWritten))
+    {
+        printf("WritePrinter failed, last error is %u!\n", GetLastError());
+        goto Cleanup;
+    }
+
+    if (!EndPagePrinter(hPrinter))
+    {
+        printf("EndPagePrinter failed, last error is %u!\n", GetLastError());
+        goto Cleanup;
+    }
+
+    if (!EndDocPrinter(hPrinter))
+    {
+        printf("EndDocPrinter failed, last error is %u!\n", GetLastError());
+        goto Cleanup;
+    }
+
+    ReturnValue = 0;
+
+Cleanup:
+    if (hPrinter)
+        ClosePrinter(hPrinter);
+
+    return ReturnValue;
+}