mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-09 23:28:06 -05:00
Seek all Windows print functions in winspool.drv.
Rather than loading some from spoolss.dll, which some MSDN documentation suggests, but which doesn't work very well in practice. (Also, remove an unused variable.)
This commit is contained in:
parent
a9e1053c8a
commit
892d4a0188
@ -33,20 +33,25 @@ DECL_WINDOWS_FUNCTION(static, BOOL, WritePrinter,
|
||||
static void init_winfuncs(void)
|
||||
{
|
||||
static int initialised = FALSE;
|
||||
char buf[4096];
|
||||
if (initialised)
|
||||
return;
|
||||
{
|
||||
HMODULE winspool_module = load_system32_dll("winspool.drv");
|
||||
HMODULE spoolss_module = load_system32_dll("spoolss.dll");
|
||||
/* Some MSDN documentation claims that some of the below functions
|
||||
* should be loaded from spoolss.dll, but this doesn't seem to
|
||||
* be reliable in practice.
|
||||
* Nevertheless, we load spoolss.dll ourselves using our safe
|
||||
* loading method, against the possibility that winspool.drv
|
||||
* later loads it unsafely. */
|
||||
(void) load_system32_dll("spoolss.dll");
|
||||
GET_WINDOWS_FUNCTION_PP(winspool_module, EnumPrinters);
|
||||
GET_WINDOWS_FUNCTION_PP(winspool_module, OpenPrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(spoolss_module, ClosePrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(winspool_module, ClosePrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(winspool_module, StartDocPrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(spoolss_module, EndDocPrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(spoolss_module, StartPagePrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(spoolss_module, EndPagePrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(spoolss_module, WritePrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(winspool_module, EndDocPrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(winspool_module, StartPagePrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(winspool_module, EndPagePrinter);
|
||||
GET_WINDOWS_FUNCTION_PP(winspool_module, WritePrinter);
|
||||
}
|
||||
initialised = TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user