Commit graph

11 commits

Author SHA1 Message Date
Colin Finck c2c66aff7d Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
Colin Finck 154f1aaacd [PRINTING] [SKIPLIST] Use the new header with SPDX license identifier and relicense the entire Printing Stack as well as its Skiplist dependency under GPL-2.0+
Previously, the Printing Stack was a mix of GPLed and LGPLed code. Having everything under GPL-2.0+ makes things consistent and allows me to import code from most Open Source licenses.
Given that the Printing Stack components are exchangeable with their Windows counterparts and implement documented interfaces, this license change doesn't impose any additional restrictions on dependent components (like printer drivers).

svn path=/trunk/; revision=75988
2017-09-29 17:18:19 +00:00
Mark Jansen 9f1e4379e0 [SPOOLSS] Stub BuildOtherNamesFromMachineName as seen in wine commit cdb5f35. This fixes a crash in spoolss:spoolss
svn path=/trunk/; revision=75341
2017-07-14 20:05:27 +00:00
Colin Finck a82d7577b3 [PRINTING]
- Implement GetPrinterDataA, GetPrinterDataExA, GetPrinterDataExW, GetPrinterDataW, SetPrinterDataA, SetPrinterDataExA, SetPrinterDataExW, SetPrinterDataW.
  They support all features for Print Server and Printer Handles (minus security checks!)
  I've also added tests for them.
- Store Printer data in SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers instead of SYSTEM\CurrentControlSet\Control\Print\Printers and create a registry symlink from the former path to the new one just like Windows does.
  According to https://social.technet.microsoft.com/Forums/windowsserver/en-US/a683ab54-c43c-4ebe-af8f-1f7a65af2a51, this is needed when having >900 printers to work around a size limit of the SYSTEM registry hive. And if Windows has both locations, we need both for compatibility anyway.
- Add several settings which are queried by the new Printer Data APIs when working with Print Server Handles.
- Store the job directory in the Windows-compatible "DefaultSpoolDirectory" setting and make use of it.
- Revert the ASSERTs in LocalEnumPrinters again to let us verify the NULL pointer exceptions in localspl_apitest (thanks Serge! CORE-13433)
- Translate ERROR_INVALID_NAME to ERROR_INVALID_PRINTER_NAME in all cases in OpenPrinterW (thanks Victor! CORE-13412)
- Make EnumMonitorsW and EnumPortsW in spoolss more robust against failing Print Monitors.
- Remove the wrong !phPrinter check in OpenPrinterW to make Print Server Handles work for real.
- Fix error handling when memory allocation fails: HeapAlloc doesn't set last error, so it's just wrong to query or return it.

One more item done from https://reactos.org/wiki/Printing !
This is all still a big Work-in-Progress, with many subtle bugs deep down in ReactOS, for which I need to open additional tickets. But I didn't want to make this commit even bigger..

svn path=/trunk/; revision=75125
2017-06-19 14:18:19 +00:00
Colin Finck b83f56253b [LOCALSPL]
- Initialize all Print Monitors on startup and keep a list of them.
- Implement LocalEnumMonitors and LocalEnumPorts.
- Check the result of the initialization functions.

[SPOOLSS]
- Implement support for multiple Print Providers.
  Initialize them on startup and keep a list here as well.
- Implement all functions that had simple stubs in the C code. This still needs to be done for the remaining functions stubbed in the .spec file.
  But generally spoken, this always boils down to 3 cases:
    * Forward the call to the Local Spooler (for general functions like GetPrintProcessorDirectory).
    * Forward the call to the Print Provider we used for OpenPrinter (for functions like SetJob).
    * Forward the call to all Print Providers and collect the results (for functions like EnumPrinters).

svn path=/branches/colins-printing-for-freedom/; revision=68375
2015-07-07 17:06:48 +00:00
Colin Finck 7e4bcf78c4 [WINSPOOL]
Don't rely on pure magic to transmit the error code of the RPC call to the calling application. Instead use SetLastError on the return value of the call (this is what all these DWORD return values are for!)

[SPOOLSV]
For every RPC function, return the error code of the called Spooler Router function instead of the error code of RpcRevertToSelf.

[LOCALSPL, WINPRINT]
- Change the code structure in every function called from the Spooler Router to always set an error code, especially ERROR_SUCCESS on success.
- Store Attributes and Status values for a local printer.
- Fail in LocalAddJob if an invalid handle has been supplied or the printer is set to do direct printing.

svn path=/branches/colins-printing-for-freedom/; revision=68247
2015-06-23 13:46:14 +00:00
Colin Finck 5df5a009e2 [SPOOLSS] [SPOOLSV] [WINSPOOL]
- Add RPC calls in winspool, Router calls in spoolsv and Local Spooler calls in spoolss for most of the APIs I've implemented in localspl.
  This is still Work-In-Progress and missing some sanity checks, but a first step into something usable from the documented Spooler API side.
- Separate APIs into individual source files just like I did for localspl.

svn path=/branches/colins-printing-for-freedom/; revision=68237
2015-06-22 14:31:47 +00:00
Colin Finck 1e363204d6 [LOCALSPL_APITEST]
- Add more tests for fpEnumPrinters.
  For some reason, using SEH here works only once. We experience a hang in the testing process when you run the test again for a second time without restarting spoolsv. Needs more investigation.
- Ensure that the spooler service is running before starting any testing.
- Do proper cleanup in every case.

[LOCALSPL]
- Implement LocalEnumPrinters level 1 based on the API-Tests.
- Use DllAllocSplMem/DllFreeSplMem instead of HeapAlloc/HeapFree.
- Use AllocSplStr with DllFreeSplStr now that DuplicateStringW is gone.
- Use _countof where applicable.

[SPOOLSS]
- Found out that I was not the only one needing a wcsdup equivalent. My DuplicateStringW from localspl is actually exported as AllocSplStr in spoolss.
  This is actually part of a range of undocumented memory functions in spoolss, so implement and document AllocSplStr, DllAllocSplMem, DllFreeSplMem, DllFreeSplStr, ReallocSplMem and ReallocSplStr.
  Information about some of them was gathered through black box testing and DDK samples (down to Win95 DDK), which at least contained prototypes of them.
- Implement SplInitializeWinSpoolDrv based on the API-Test and simply return FALSE for SplIsUpgrade.

[SPOOLSS_APITEST]
- Add a test for ReallocSplStr, which was actually the most undocumented function of spoolss' memory functions.

[WINSPOOL]
SplInitializeWinSpoolDrv shows that we can't just auto-assign an ordinal to all winspool.drv functions. We even need to export some nameless functions by ordinal only.
Redo the whole .spec file based on the ordinals found in Windows Server 2003's winspool.drv. Trust WINE for the nameless stubs.

svn path=/branches/colins-printing-for-freedom/; revision=68089
2015-06-09 13:22:25 +00:00
Colin Finck beaa69af38 Time to commit some Work-In-Progress stuff before my diff gets too large..
[LOCALSPL]
- Begin work on the Local Spooler. Return a structure with function pointers in InitializePrintProvidor.
- Design and document internal structures for managing LocalSpl Handles, Printer Handles, Printers, Print Jobs and Print Processors.
  Manage Printers and Print Processors in Generic Tables, with one Job Queue per Printer managed as a Doubly Linked List.
- Implement LocalOpenPrinter, LocalEnumPrintProcessorDatatypes, LocalEnumPrintProcessors, LocalGetPrintProcessorDirectory, with focus on catching all corner cases.
  Currently working on LocalStartDocPrinter.
- Build upon the documentation at http://www.undocprint.org/formats/winspool/shd to read and write .SHD files.

[WINPRINT]
Begin work on the Standard Print Processor. Implement EnumPrintProcessorDatatypesW.

[WINSPOOL_APITEST]
Add an API Test for winspool.drv, currently testing some corner cases of ClosePrinter, EnumPrintProcessorDatatypesW, GetPrintProcessorDirectoryW, OpenPrinterW, StartDocPrinterW.
TODO: Find a way to actually test the localspl.dll functions instead of only winspool.drv. This DLL doesn't like to be tested standalone under Windows, e.g. without being used through spoolsv/spoolss.

[SPOOLSS]
Implement InitializeRouter by calling the InitializePrintProvidor function of localspl there.
This function should later also initialize further Print Providers.

[SPOOLSV]
Call InitializeRouter when starting up the service.

[WINSPOOL]
Add dummy functions for EnumPrintProcessorDatatypesA/EnumPrintProcessorDatatypesW.

[All modules]
Fix printf format specifiers for errors (%lu) and statuses (%ld).

svn path=/branches/colins-printing-for-freedom/; revision=67847
2015-05-22 15:29:07 +00:00
Colin Finck 2ffd28325a - Add a dummy winspool.drv SpoolerInit doing an RPC call to a dummy RpcSpoolerInit, which itself passes the call to a dummy spoolss.dll SpoolerInit.
This serves as an example to show how I expect most spooler functions to work.
- Implement the publicly exported and fundamental RevertToPrinterSelf and ImpersonatePrinterClient spoolss.dll functions.
- Fix WINSPOOL_HANDLE_bind.
- Fix build with GCC.

svn path=/branches/colins-printing-for-freedom/; revision=67693
2015-05-12 14:43:25 +00:00
Colin Finck 1ea68e0e6d - Add the first bits of the winspool/spoolsv/spoolss interface in a WIDL-compatible format.
References:
     - https://git.samba.org/?p=samba.git;a=blob;f=librpc/idl/spoolss.idl;hb=618af83d1bd07b12a9acc88b0d2111cab7a8bb2b
     - https://msdn.microsoft.com/en-us/library/cc244649.aspx
- Replace our stubbed spoolsv by a new basic implementation that already creates a thread to serve RPC requests.
- Add stubbed versions of localmon, localspl, spoolss, winprint, winspool matching the exports of the Windows Server 2003 DLLs.
  localmon and winprint are part of localspl in Windows Server 2003. I took the freedom of putting these distinct components into separate DLLs (as it's done for localmon in NT4 and for winprint in Win7).
- Implement some stubs myself to fix the build (e.g. comdlg32 uses some functions).
- Implement OpenPrinterA and OpenPrinterW in winspool. This is just ANSI-to-Unicode conversion and a RPC call.
- Remove the Wine-imported ntprint, this one also needs a complete rewrite once we're at this point.

svn path=/branches/colins-printing-for-freedom/; revision=67576
2015-05-06 12:47:20 +00:00