mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
Add a little test program "winspool_print" that just prints a single line of unformatted text.
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
This commit is contained in:
parent
d5fd7aaa19
commit
f67a62efe5
4 changed files with 64 additions and 0 deletions
|
@ -244,6 +244,7 @@ else()
|
|||
add_subdirectory(modules)
|
||||
add_subdirectory(ntoskrnl)
|
||||
add_subdirectory(subsystems)
|
||||
add_subdirectory(temp)
|
||||
add_subdirectory(tools/wpp)
|
||||
add_subdirectory(win32ss)
|
||||
|
||||
|
|
1
reactos/temp/CMakeLists.txt
Normal file
1
reactos/temp/CMakeLists.txt
Normal file
|
@ -0,0 +1 @@
|
|||
add_subdirectory(winspool_print)
|
4
reactos/temp/winspool_print/CMakeLists.txt
Normal file
4
reactos/temp/winspool_print/CMakeLists.txt
Normal file
|
@ -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)
|
58
reactos/temp/winspool_print/main.c
Normal file
58
reactos/temp/winspool_print/main.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue