https://git.reactos.org/?p=reactos.git;a=commitdiff;h=62c4b828b41fee3016266…
commit 62c4b828b41fee301626685c3722d6de9c030781
Author: James Tabor <james.tabor(a)reactos.org>
AuthorDate: Wed Aug 26 17:12:20 2020 -0500
Commit: James Tabor <james.tabor(a)reactos.org>
CommitDate: Wed Aug 26 17:12:20 2020 -0500
[Printing] Update and Add Functions
More forwards to LocalSpl and LocalMon. At sometime will be merged together.
Bug fixes.
Printer Driver code is a wine hack. (WIP)
Added information for shell tray icon notifications.
Sync wine WinSpool driver tests. Unplugged from build.
---
modules/rostests/winetests/winspool/info.c | 67 +-
sdk/include/psdk/winspool.h | 292 +++----
sdk/include/reactos/idl/winspool.idl | 37 +-
sdk/include/reactos/undocshell.h | 16 +
win32ss/printing/base/spoolss/CMakeLists.txt | 3 +
win32ss/printing/base/spoolss/forms.c | 95 +++
win32ss/printing/base/spoolss/monitors.c | 81 +-
win32ss/printing/base/spoolss/ports.c | 188 ++++-
win32ss/printing/base/spoolss/printerdata.c | 90 +++
win32ss/printing/base/spoolss/printerdrivers.c | 254 ++++++
win32ss/printing/base/spoolss/printers.c | 238 +++++-
win32ss/printing/base/spoolss/printprocessors.c | 36 +
win32ss/printing/base/spoolss/printproviders.c | 26 +
win32ss/printing/base/spoolss/spoolss.spec | 78 +-
win32ss/printing/base/spoolsv/CMakeLists.txt | 2 +
win32ss/printing/base/spoolsv/forms.c | 107 ++-
win32ss/printing/base/spoolsv/monitors.c | 32 +-
win32ss/printing/base/spoolsv/ports.c | 104 ++-
win32ss/printing/base/spoolsv/printerdrivers.c | 407 +++++++++-
win32ss/printing/base/spoolsv/printers.c | 91 ++-
win32ss/printing/base/spoolsv/printprocessors.c | 32 +-
win32ss/printing/base/spoolsv/printproviders.c | 33 +-
win32ss/printing/base/spoolsv/rpcstubs.c | 19 +-
win32ss/printing/base/spoolsv/spoolsv.spec | 18 +
win32ss/printing/base/spoolsv/xcv.c | 18 +-
win32ss/printing/base/winspool/forms.c | 27 +-
win32ss/printing/base/winspool/jobs.c | 28 +-
win32ss/printing/base/winspool/monitors.c | 27 +-
win32ss/printing/base/winspool/ports.c | 496 +++++++++++-
win32ss/printing/base/winspool/precomp.h | 3 +-
win32ss/printing/base/winspool/printerdata.c | 17 +-
win32ss/printing/base/winspool/printerdrivers.c | 81 +-
win32ss/printing/base/winspool/printers.c | 99 ++-
win32ss/printing/base/winspool/printprocessors.c | 6 +-
win32ss/printing/base/winspool/utils.c | 46 ++
win32ss/printing/base/winspool/winspool.spec | 2 +-
win32ss/printing/include/marshalling/forms.h | 11 +-
.../printing/include/marshalling/printerdrivers.h | 1 +
win32ss/printing/include/spoolss.h | 18 +
win32ss/printing/monitors/localmon/main.c | 51 +-
win32ss/printing/monitors/localmon/ports.c | 178 +++-
win32ss/printing/monitors/localmon/precomp.h | 14 +-
win32ss/printing/monitors/localmon/tools.c | 94 +++
win32ss/printing/monitors/localmon/xcv.c | 171 +++-
win32ss/printing/providers/localspl/CMakeLists.txt | 8 +-
win32ss/printing/providers/localspl/forms.c | 746 +++++++++++++++++
win32ss/printing/providers/localspl/main.c | 48 +-
win32ss/printing/providers/localspl/monitors.c | 438 +++++++++-
win32ss/printing/providers/localspl/ports.c | 308 +++++++
win32ss/printing/providers/localspl/precomp.h | 47 +-
.../printing/providers/localspl/printerdrivers.c | 900 +++++++++++++++++++--
win32ss/printing/providers/localspl/printers.c | 49 +-
win32ss/printing/providers/localspl/tools.c | 53 ++
win32ss/printing/providers/localspl/xcv.c | 199 +++++
54 files changed, 5983 insertions(+), 547 deletions(-)
diff --git a/modules/rostests/winetests/winspool/info.c
b/modules/rostests/winetests/winspool/info.c
index 475c13d9646..53aa67ba036 100644
--- a/modules/rostests/winetests/winspool/info.c
+++ b/modules/rostests/winetests/winspool/info.c
@@ -120,22 +120,6 @@ static BOOL is_access_denied(DWORD res, DWORD lasterror)
return FALSE;
}
-static BOOL on_win9x = FALSE;
-
-static BOOL check_win9x(void)
-{
- if (pGetPrinterW)
- {
- SetLastError(0xdeadbeef);
- pGetPrinterW(NULL, 0, NULL, 0, NULL);
- return (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED);
- }
- else
- {
- return TRUE;
- }
-}
-
static void find_default_printer(VOID)
{
static char buffer[DEFAULT_PRINTER_SIZE];
@@ -333,8 +317,6 @@ static void test_AddMonitor(void)
"returned %d with %d (expected '0' with
ERROR_INVALID_LEVEL)\n",
res, GetLastError());
- if (0)
- {
/* This test crashes win9x on vmware (works with win9x on qemu 0.8.1) */
SetLastError(MAGIC_DEAD);
res = AddMonitorA(NULL, 2, NULL);
@@ -344,7 +326,6 @@ static void test_AddMonitor(void)
(GetLastError() == ERROR_PRIVILEGE_NOT_HELD)),
"returned %d with %d (expected '0' with: MAGIC_DEAD or "
"ERROR_PRIVILEGE_NOT_HELD)\n", res, GetLastError());
- }
ZeroMemory(&mi2a, sizeof(MONITOR_INFO_2A));
SetLastError(MAGIC_DEAD);
@@ -1219,7 +1200,7 @@ static void test_EnumPrinterDrivers(void)
}
/* EnumPrinterDriversA returns the same number of bytes as EnumPrinterDriversW
*/
- if (!on_win9x && pEnumPrinterDriversW)
+ if (pEnumPrinterDriversW)
{
DWORD double_needed;
DWORD double_returned;
@@ -1407,15 +1388,14 @@ static void test_EnumPrintProcessors(void)
/* failure-Codes for NULL */
- if (0) {
- /* this test crashes on win98se */
- SetLastError(0xdeadbeef);
- pcbNeeded = 0xdeadbeef;
- pcReturned = 0xdeadbeef;
- res = EnumPrintProcessorsA(NULL, NULL, 1, NULL, cbBuf, &pcbNeeded,
&pcReturned);
- ok( !res && (GetLastError() == ERROR_INVALID_USER_BUFFER) ,
- "got %u with %u (expected '0' with
ERROR_INVALID_USER_BUFFER)\n",
- res, GetLastError());
+ SetLastError(0xdeadbeef);
+ pcbNeeded = 0xdeadbeef;
+ pcReturned = 0xdeadbeef;
+ res = EnumPrintProcessorsA(NULL, NULL, 1, NULL, cbBuf, &pcbNeeded,
&pcReturned);
+ todo_wine {
+ ok( !res && (GetLastError() == ERROR_INVALID_USER_BUFFER) ,
+ "got %u with %u (expected '0' with
ERROR_INVALID_USER_BUFFER)\n",
+ res, GetLastError());
}
SetLastError(0xdeadbeef);
@@ -1982,7 +1962,7 @@ static void test_SetDefaultPrinter(void)
}
if (!pSetDefaultPrinterA) return;
- /* only supported on win2k and above */
+ /* only supported on win2k and above */
/* backup the original value */
org_value[0] = '\0';
@@ -2356,7 +2336,7 @@ static void test_GetPrinter(void)
ok(needed > 0,"not expected needed buffer size %d\n", needed);
/* GetPrinterA returns the same number of bytes as GetPrinterW */
- if (!on_win9x && !ret && pGetPrinterW && level != 6
&& level != 7)
+ if (!ret && pGetPrinterW && level != 6 && level != 7)
{
DWORD double_needed;
ret = pGetPrinterW(hprn, level, NULL, 0, &double_needed);
@@ -2408,9 +2388,6 @@ static void test_GetPrinterData(void)
res = OpenPrinterA(NULL, &hprn, NULL);
if (!res)
{
- /* printserver not available on win9x */
- if (!on_win9x)
- win_skip("Unable to open the printserver: %d\n", GetLastError());
return;
}
@@ -2593,7 +2570,7 @@ static void test_GetPrinterDriver(void)
}
/* GetPrinterDriverA returns the same number of bytes as GetPrinterDriverW */
- if (!on_win9x && !ret && pGetPrinterDriverW)
+ if (!ret && pGetPrinterDriverW)
{
DWORD double_needed;
ret = pGetPrinterDriverW(hprn, NULL, level, NULL, 0, &double_needed);
@@ -2961,7 +2938,7 @@ static void test_OpenPrinter_defaults(void)
ret = GetJobA( printer, add_job->JobId, 2, (BYTE *)job_info, needed, &needed
);
ok( ret, "GetJobA() failed le=%d\n", GetLastError() );
-todo_wine
+ todo_wine
ok( job_info->pDevMode != NULL, "got NULL DEVMODEA\n");
if (job_info->pDevMode)
ok( job_info->pDevMode->u1.s1.dmPaperSize == default_size, "got %d
default %d\n",
@@ -3081,10 +3058,6 @@ START_TEST(info)
pSetDefaultPrinterA = (void *) GetProcAddress(hwinspool,
"SetDefaultPrinterA");
pXcvDataW = (void *) GetProcAddress(hwinspool, "XcvDataW");
- on_win9x = check_win9x();
- if (on_win9x)
- win_skip("Several W-functions are not available on Win9x/WinMe\n");
-
find_default_printer();
find_local_server();
find_tempfile();
@@ -3101,20 +3074,10 @@ START_TEST(info)
test_EnumForms(NULL);
if (default_printer) test_EnumForms(default_printer);
test_EnumMonitors();
-
- if (!winetest_interactive)
- skip("ROSTESTS-211: Skipping test_EnumPorts().\n");
- else
- test_EnumPorts();
-
+ test_EnumPorts();
test_EnumPrinterDrivers();
test_EnumPrinters();
-
- if (!winetest_interactive)
- skip("ROSTESTS-211: Skipping test_EnumPrintProcessors().\n");
- else
- test_EnumPrintProcessors();
-
+ test_EnumPrintProcessors();
test_GetDefaultPrinter();
test_GetPrinterDriverDirectory();
test_GetPrintProcessorDirectory();
diff --git a/sdk/include/psdk/winspool.h b/sdk/include/psdk/winspool.h
index 6c4d8383762..5bbbd26f804 100644
--- a/sdk/include/psdk/winspool.h
+++ b/sdk/include/psdk/winspool.h
@@ -351,55 +351,55 @@ extern "C" {
#define JOB_POSITION_UNSPECIFIED 0
- typedef struct _ADDJOB_INFO_1A {
+typedef struct _ADDJOB_INFO_1A {
LPSTR Path;
DWORD JobId;
- } ADDJOB_INFO_1A,*PADDJOB_INFO_1A,*LPADDJOB_INFO_1A;
+} ADDJOB_INFO_1A,*PADDJOB_INFO_1A,*LPADDJOB_INFO_1A;
- typedef struct _ADDJOB_INFO_1W {
+typedef struct _ADDJOB_INFO_1W {
LPWSTR Path;
DWORD JobId;
- } ADDJOB_INFO_1W,*PADDJOB_INFO_1W,*LPADDJOB_INFO_1W;
+} ADDJOB_INFO_1W,*PADDJOB_INFO_1W,*LPADDJOB_INFO_1W;
- __MINGW_TYPEDEF_AW(ADDJOB_INFO_1)
- __MINGW_TYPEDEF_AW(PADDJOB_INFO_1)
- __MINGW_TYPEDEF_AW(LPADDJOB_INFO_1)
+__MINGW_TYPEDEF_AW(ADDJOB_INFO_1)
+__MINGW_TYPEDEF_AW(PADDJOB_INFO_1)
+__MINGW_TYPEDEF_AW(LPADDJOB_INFO_1)
- typedef struct _DRIVER_INFO_1A {
+typedef struct _DRIVER_INFO_1A {
LPSTR pName;
- } DRIVER_INFO_1A,*PDRIVER_INFO_1A,*LPDRIVER_INFO_1A;
+} DRIVER_INFO_1A,*PDRIVER_INFO_1A,*LPDRIVER_INFO_1A;
- typedef struct _DRIVER_INFO_1W {
+typedef struct _DRIVER_INFO_1W {
LPWSTR pName;
- } DRIVER_INFO_1W,*PDRIVER_INFO_1W,*LPDRIVER_INFO_1W;
+} DRIVER_INFO_1W,*PDRIVER_INFO_1W,*LPDRIVER_INFO_1W;
- __MINGW_TYPEDEF_AW(DRIVER_INFO_1)
- __MINGW_TYPEDEF_AW(PDRIVER_INFO_1)
- __MINGW_TYPEDEF_AW(LPDRIVER_INFO_1)
+__MINGW_TYPEDEF_AW(DRIVER_INFO_1)
+__MINGW_TYPEDEF_AW(PDRIVER_INFO_1)
+__MINGW_TYPEDEF_AW(LPDRIVER_INFO_1)
- typedef struct _DRIVER_INFO_2A {
+typedef struct _DRIVER_INFO_2A {
DWORD cVersion;
LPSTR pName;
LPSTR pEnvironment;
LPSTR pDriverPath;
LPSTR pDataFile;
LPSTR pConfigFile;
- } DRIVER_INFO_2A,*PDRIVER_INFO_2A,*LPDRIVER_INFO_2A;
+} DRIVER_INFO_2A,*PDRIVER_INFO_2A,*LPDRIVER_INFO_2A;
- typedef struct _DRIVER_INFO_2W {
+typedef struct _DRIVER_INFO_2W {
DWORD cVersion;
LPWSTR pName;
LPWSTR pEnvironment;
LPWSTR pDriverPath;
LPWSTR pDataFile;
LPWSTR pConfigFile;
- } DRIVER_INFO_2W,*PDRIVER_INFO_2W,*LPDRIVER_INFO_2W;
+} DRIVER_INFO_2W,*PDRIVER_INFO_2W,*LPDRIVER_INFO_2W;
- __MINGW_TYPEDEF_AW(DRIVER_INFO_2)
- __MINGW_TYPEDEF_AW(PDRIVER_INFO_2)
- __MINGW_TYPEDEF_AW(LPDRIVER_INFO_2)
+__MINGW_TYPEDEF_AW(DRIVER_INFO_2)
+__MINGW_TYPEDEF_AW(PDRIVER_INFO_2)
+__MINGW_TYPEDEF_AW(LPDRIVER_INFO_2)
- typedef struct _DRIVER_INFO_3A {
+typedef struct _DRIVER_INFO_3A {
DWORD cVersion;
LPSTR pName;
LPSTR pEnvironment;
@@ -410,9 +410,9 @@ extern "C" {
LPSTR pDependentFiles;
LPSTR pMonitorName;
LPSTR pDefaultDataType;
- } DRIVER_INFO_3A,*PDRIVER_INFO_3A,*LPDRIVER_INFO_3A;
+} DRIVER_INFO_3A,*PDRIVER_INFO_3A,*LPDRIVER_INFO_3A;
- typedef struct _DRIVER_INFO_3W {
+typedef struct _DRIVER_INFO_3W {
DWORD cVersion;
LPWSTR pName;
LPWSTR pEnvironment;
@@ -423,13 +423,13 @@ extern "C" {
LPWSTR pDependentFiles;
LPWSTR pMonitorName;
LPWSTR pDefaultDataType;
- } DRIVER_INFO_3W,*PDRIVER_INFO_3W,*LPDRIVER_INFO_3W;
+} DRIVER_INFO_3W,*PDRIVER_INFO_3W,*LPDRIVER_INFO_3W;
- __MINGW_TYPEDEF_AW(DRIVER_INFO_3)
- __MINGW_TYPEDEF_AW(PDRIVER_INFO_3)
- __MINGW_TYPEDEF_AW(LPDRIVER_INFO_3)
+__MINGW_TYPEDEF_AW(DRIVER_INFO_3)
+__MINGW_TYPEDEF_AW(PDRIVER_INFO_3)
+__MINGW_TYPEDEF_AW(LPDRIVER_INFO_3)
- typedef struct _DRIVER_INFO_4A {
+typedef struct _DRIVER_INFO_4A {
DWORD cVersion;
LPSTR pName;
LPSTR pEnvironment;
@@ -441,9 +441,9 @@ extern "C" {
LPSTR pMonitorName;
LPSTR pDefaultDataType;
LPSTR pszzPreviousNames;
- } DRIVER_INFO_4A,*PDRIVER_INFO_4A,*LPDRIVER_INFO_4A;
+} DRIVER_INFO_4A,*PDRIVER_INFO_4A,*LPDRIVER_INFO_4A;
- typedef struct _DRIVER_INFO_4W {
+typedef struct _DRIVER_INFO_4W {
DWORD cVersion;
LPWSTR pName;
LPWSTR pEnvironment;
@@ -455,13 +455,13 @@ extern "C" {
LPWSTR pMonitorName;
LPWSTR pDefaultDataType;
LPWSTR pszzPreviousNames;
- } DRIVER_INFO_4W,*PDRIVER_INFO_4W,*LPDRIVER_INFO_4W;
+} DRIVER_INFO_4W,*PDRIVER_INFO_4W,*LPDRIVER_INFO_4W;
- __MINGW_TYPEDEF_AW(DRIVER_INFO_4)
- __MINGW_TYPEDEF_AW(PDRIVER_INFO_4)
- __MINGW_TYPEDEF_AW(LPDRIVER_INFO_4)
+__MINGW_TYPEDEF_AW(DRIVER_INFO_4)
+__MINGW_TYPEDEF_AW(PDRIVER_INFO_4)
+__MINGW_TYPEDEF_AW(LPDRIVER_INFO_4)
- typedef struct _DRIVER_INFO_5A {
+typedef struct _DRIVER_INFO_5A {
DWORD cVersion;
LPSTR pName;
LPSTR pEnvironment;
@@ -471,9 +471,9 @@ extern "C" {
DWORD dwDriverAttributes;
DWORD dwConfigVersion;
DWORD dwDriverVersion;
- } DRIVER_INFO_5A,*PDRIVER_INFO_5A,*LPDRIVER_INFO_5A;
+} DRIVER_INFO_5A,*PDRIVER_INFO_5A,*LPDRIVER_INFO_5A;
- typedef struct _DRIVER_INFO_5W {
+typedef struct _DRIVER_INFO_5W {
DWORD cVersion;
LPWSTR pName;
LPWSTR pEnvironment;
@@ -483,13 +483,13 @@ extern "C" {
DWORD dwDriverAttributes;
DWORD dwConfigVersion;
DWORD dwDriverVersion;
- } DRIVER_INFO_5W,*PDRIVER_INFO_5W,*LPDRIVER_INFO_5W;
+} DRIVER_INFO_5W,*PDRIVER_INFO_5W,*LPDRIVER_INFO_5W;
- __MINGW_TYPEDEF_AW(DRIVER_INFO_5)
- __MINGW_TYPEDEF_AW(PDRIVER_INFO_5)
- __MINGW_TYPEDEF_AW(LPDRIVER_INFO_5)
+__MINGW_TYPEDEF_AW(DRIVER_INFO_5)
+__MINGW_TYPEDEF_AW(PDRIVER_INFO_5)
+__MINGW_TYPEDEF_AW(LPDRIVER_INFO_5)
- typedef struct _DRIVER_INFO_6A {
+typedef struct _DRIVER_INFO_6A {
DWORD cVersion;
LPSTR pName;
LPSTR pEnvironment;
@@ -507,9 +507,9 @@ extern "C" {
LPSTR pszOEMUrl;
LPSTR pszHardwareID;
LPSTR pszProvider;
- } DRIVER_INFO_6A,*PDRIVER_INFO_6A,*LPDRIVER_INFO_6A;
+} DRIVER_INFO_6A,*PDRIVER_INFO_6A,*LPDRIVER_INFO_6A;
- typedef struct _DRIVER_INFO_6W {
+typedef struct _DRIVER_INFO_6W {
DWORD cVersion;
LPWSTR pName;
LPWSTR pEnvironment;
@@ -527,11 +527,11 @@ extern "C" {
LPWSTR pszOEMUrl;
LPWSTR pszHardwareID;
LPWSTR pszProvider;
- } DRIVER_INFO_6W,*PDRIVER_INFO_6W,*LPDRIVER_INFO_6W;
+} DRIVER_INFO_6W,*PDRIVER_INFO_6W,*LPDRIVER_INFO_6W;
- __MINGW_TYPEDEF_AW(DRIVER_INFO_6)
- __MINGW_TYPEDEF_AW(PDRIVER_INFO_6)
- __MINGW_TYPEDEF_AW(LPDRIVER_INFO_6)
+__MINGW_TYPEDEF_AW(DRIVER_INFO_6)
+__MINGW_TYPEDEF_AW(PDRIVER_INFO_6)
+__MINGW_TYPEDEF_AW(LPDRIVER_INFO_6)
typedef struct _DRIVER_INFO_8W {
DWORD cVersion;
@@ -606,39 +606,39 @@ __MINGW_TYPEDEF_AW(LPDRIVER_INFO_8)
#define APD_COPY_NEW_FILES 0x00000008
#define APD_COPY_FROM_DIRECTORY 0x00000010
- typedef struct _DOC_INFO_1A {
+typedef struct _DOC_INFO_1A {
LPSTR pDocName;
LPSTR pOutputFile;
LPSTR pDatatype;
- } DOC_INFO_1A,*PDOC_INFO_1A,*LPDOC_INFO_1A;
+} DOC_INFO_1A,*PDOC_INFO_1A,*LPDOC_INFO_1A;
- typedef struct _DOC_INFO_1W {
+typedef struct _DOC_INFO_1W {
LPWSTR pDocName;
LPWSTR pOutputFile;
LPWSTR pDatatype;
- } DOC_INFO_1W,*PDOC_INFO_1W,*LPDOC_INFO_1W;
+} DOC_INFO_1W,*PDOC_INFO_1W,*LPDOC_INFO_1W;
- __MINGW_TYPEDEF_AW(DOC_INFO_1)
- __MINGW_TYPEDEF_AW(PDOC_INFO_1)
- __MINGW_TYPEDEF_AW(LPDOC_INFO_1)
+__MINGW_TYPEDEF_AW(DOC_INFO_1)
+__MINGW_TYPEDEF_AW(PDOC_INFO_1)
+__MINGW_TYPEDEF_AW(LPDOC_INFO_1)
- typedef struct _FORM_INFO_1A {
+typedef struct _FORM_INFO_1A {
DWORD Flags;
LPSTR pName;
SIZEL Size;
RECTL ImageableArea;
- } FORM_INFO_1A,*PFORM_INFO_1A,*LPFORM_INFO_1A;
+} FORM_INFO_1A,*PFORM_INFO_1A,*LPFORM_INFO_1A;
- typedef struct _FORM_INFO_1W {
+typedef struct _FORM_INFO_1W {
DWORD Flags;
LPWSTR pName;
SIZEL Size;
RECTL ImageableArea;
- } FORM_INFO_1W,*PFORM_INFO_1W,*LPFORM_INFO_1W;
+} FORM_INFO_1W,*PFORM_INFO_1W,*LPFORM_INFO_1W;
- __MINGW_TYPEDEF_AW(FORM_INFO_1)
- __MINGW_TYPEDEF_AW(PFORM_INFO_1)
- __MINGW_TYPEDEF_AW(LPFORM_INFO_1)
+__MINGW_TYPEDEF_AW(FORM_INFO_1)
+__MINGW_TYPEDEF_AW(PFORM_INFO_1)
+__MINGW_TYPEDEF_AW(LPFORM_INFO_1)
typedef struct _FORM_INFO_2A {
DWORD Flags;
@@ -669,46 +669,50 @@ typedef struct _FORM_INFO_2W {
__MINGW_TYPEDEF_AW(FORM_INFO_2)
__MINGW_TYPEDEF_AW(PFORM_INFO_2)
- typedef struct _DOC_INFO_2A {
+#define STRING_NONE 0x00000001
+#define STRING_MUIDLL 0x00000002
+#define STRING_LANGPAIR 0x00000004
+
+typedef struct _DOC_INFO_2A {
LPSTR pDocName;
LPSTR pOutputFile;
LPSTR pDatatype;
DWORD dwMode;
DWORD JobId;
- } DOC_INFO_2A,*PDOC_INFO_2A,*LPDOC_INFO_2A;
+} DOC_INFO_2A,*PDOC_INFO_2A,*LPDOC_INFO_2A;
- typedef struct _DOC_INFO_2W {
+typedef struct _DOC_INFO_2W {
LPWSTR pDocName;
LPWSTR pOutputFile;
LPWSTR pDatatype;
DWORD dwMode;
DWORD JobId;
- } DOC_INFO_2W,*PDOC_INFO_2W,*LPDOC_INFO_2W;
+} DOC_INFO_2W,*PDOC_INFO_2W,*LPDOC_INFO_2W;
- __MINGW_TYPEDEF_AW(DOC_INFO_2)
- __MINGW_TYPEDEF_AW(PDOC_INFO_2)
- __MINGW_TYPEDEF_AW(LPDOC_INFO_2)
+__MINGW_TYPEDEF_AW(DOC_INFO_2)
+__MINGW_TYPEDEF_AW(PDOC_INFO_2)
+__MINGW_TYPEDEF_AW(LPDOC_INFO_2)
#define DI_CHANNEL 1
#define DI_READ_SPOOL_JOB 3
- typedef struct _DOC_INFO_3A {
+typedef struct _DOC_INFO_3A {
LPSTR pDocName;
LPSTR pOutputFile;
LPSTR pDatatype;
DWORD dwFlags;
- } DOC_INFO_3A,*PDOC_INFO_3A,*LPDOC_INFO_3A;
+} DOC_INFO_3A,*PDOC_INFO_3A,*LPDOC_INFO_3A;
- typedef struct _DOC_INFO_3W {
+typedef struct _DOC_INFO_3W {
LPWSTR pDocName;
LPWSTR pOutputFile;
LPWSTR pDatatype;
DWORD dwFlags;
- } DOC_INFO_3W,*PDOC_INFO_3W,*LPDOC_INFO_3W;
+} DOC_INFO_3W,*PDOC_INFO_3W,*LPDOC_INFO_3W;
- __MINGW_TYPEDEF_AW(DOC_INFO_3)
- __MINGW_TYPEDEF_AW(PDOC_INFO_3)
- __MINGW_TYPEDEF_AW(LPDOC_INFO_3)
+__MINGW_TYPEDEF_AW(DOC_INFO_3)
+__MINGW_TYPEDEF_AW(PDOC_INFO_3)
+__MINGW_TYPEDEF_AW(LPDOC_INFO_3)
#define DI_MEMORYMAP_WRITE 0x00000001
@@ -716,79 +720,79 @@ __MINGW_TYPEDEF_AW(PFORM_INFO_2)
#define FORM_BUILTIN 0x00000001
#define FORM_PRINTER 0x00000002
- typedef struct _PRINTPROCESSOR_INFO_1A {
+typedef struct _PRINTPROCESSOR_INFO_1A {
LPSTR pName;
- } PRINTPROCESSOR_INFO_1A,*PPRINTPROCESSOR_INFO_1A,*LPPRINTPROCESSOR_INFO_1A;
+} PRINTPROCESSOR_INFO_1A,*PPRINTPROCESSOR_INFO_1A,*LPPRINTPROCESSOR_INFO_1A;
- typedef struct _PRINTPROCESSOR_INFO_1W {
+typedef struct _PRINTPROCESSOR_INFO_1W {
LPWSTR pName;
- } PRINTPROCESSOR_INFO_1W,*PPRINTPROCESSOR_INFO_1W,*LPPRINTPROCESSOR_INFO_1W;
+} PRINTPROCESSOR_INFO_1W,*PPRINTPROCESSOR_INFO_1W,*LPPRINTPROCESSOR_INFO_1W;
- __MINGW_TYPEDEF_AW(PRINTPROCESSOR_INFO_1)
- __MINGW_TYPEDEF_AW(PPRINTPROCESSOR_INFO_1)
- __MINGW_TYPEDEF_AW(LPPRINTPROCESSOR_INFO_1)
+__MINGW_TYPEDEF_AW(PRINTPROCESSOR_INFO_1)
+__MINGW_TYPEDEF_AW(PPRINTPROCESSOR_INFO_1)
+__MINGW_TYPEDEF_AW(LPPRINTPROCESSOR_INFO_1)
- typedef struct _PRINTPROCESSOR_CAPS_1 {
+typedef struct _PRINTPROCESSOR_CAPS_1 {
DWORD dwLevel;
DWORD dwNupOptions;
DWORD dwPageOrderFlags;
DWORD dwNumberOfCopies;
- } PRINTPROCESSOR_CAPS_1,*PPRINTPROCESSOR_CAPS_1;
+} PRINTPROCESSOR_CAPS_1,*PPRINTPROCESSOR_CAPS_1;
#define NORMAL_PRINT 0x00000000
#define REVERSE_PRINT 0x00000001
- typedef struct _PORT_INFO_1A {
+typedef struct _PORT_INFO_1A {
LPSTR pName;
- } PORT_INFO_1A,*PPORT_INFO_1A,*LPPORT_INFO_1A;
- typedef struct _PORT_INFO_1W {
+} PORT_INFO_1A,*PPORT_INFO_1A,*LPPORT_INFO_1A;
+typedef struct _PORT_INFO_1W {
LPWSTR pName;
- } PORT_INFO_1W,*PPORT_INFO_1W,*LPPORT_INFO_1W;
+} PORT_INFO_1W,*PPORT_INFO_1W,*LPPORT_INFO_1W;
- __MINGW_TYPEDEF_AW(PORT_INFO_1)
- __MINGW_TYPEDEF_AW(PPORT_INFO_1)
- __MINGW_TYPEDEF_AW(LPPORT_INFO_1)
+__MINGW_TYPEDEF_AW(PORT_INFO_1)
+__MINGW_TYPEDEF_AW(PPORT_INFO_1)
+__MINGW_TYPEDEF_AW(LPPORT_INFO_1)
- typedef struct _PORT_INFO_2A {
+typedef struct _PORT_INFO_2A {
LPSTR pPortName;
LPSTR pMonitorName;
LPSTR pDescription;
DWORD fPortType;
DWORD Reserved;
- } PORT_INFO_2A,*PPORT_INFO_2A,*LPPORT_INFO_2A;
+} PORT_INFO_2A,*PPORT_INFO_2A,*LPPORT_INFO_2A;
- typedef struct _PORT_INFO_2W {
+typedef struct _PORT_INFO_2W {
LPWSTR pPortName;
LPWSTR pMonitorName;
LPWSTR pDescription;
DWORD fPortType;
DWORD Reserved;
- } PORT_INFO_2W,*PPORT_INFO_2W,*LPPORT_INFO_2W;
+} PORT_INFO_2W,*PPORT_INFO_2W,*LPPORT_INFO_2W;
- __MINGW_TYPEDEF_AW(PORT_INFO_2)
- __MINGW_TYPEDEF_AW(PPORT_INFO_2)
- __MINGW_TYPEDEF_AW(LPPORT_INFO_2)
+__MINGW_TYPEDEF_AW(PORT_INFO_2)
+__MINGW_TYPEDEF_AW(PPORT_INFO_2)
+__MINGW_TYPEDEF_AW(LPPORT_INFO_2)
#define PORT_TYPE_WRITE 0x0001
#define PORT_TYPE_READ 0x0002
#define PORT_TYPE_REDIRECTED 0x0004
#define PORT_TYPE_NET_ATTACHED 0x0008
- typedef struct _PORT_INFO_3A {
+typedef struct _PORT_INFO_3A {
DWORD dwStatus;
LPSTR pszStatus;
DWORD dwSeverity;
- } PORT_INFO_3A,*PPORT_INFO_3A,*LPPORT_INFO_3A;
+} PORT_INFO_3A,*PPORT_INFO_3A,*LPPORT_INFO_3A;
- typedef struct _PORT_INFO_3W {
+typedef struct _PORT_INFO_3W {
DWORD dwStatus;
LPWSTR pszStatus;
DWORD dwSeverity;
- } PORT_INFO_3W,*PPORT_INFO_3W,*LPPORT_INFO_3W;
+} PORT_INFO_3W,*PPORT_INFO_3W,*LPPORT_INFO_3W;
- __MINGW_TYPEDEF_AW(PORT_INFO_3)
- __MINGW_TYPEDEF_AW(PPORT_INFO_3)
- __MINGW_TYPEDEF_AW(LPPORT_INFO_3)
+__MINGW_TYPEDEF_AW(PORT_INFO_3)
+__MINGW_TYPEDEF_AW(PPORT_INFO_3)
+__MINGW_TYPEDEF_AW(LPPORT_INFO_3)
#define PORT_STATUS_TYPE_ERROR 1
#define PORT_STATUS_TYPE_WARNING 2
@@ -807,86 +811,86 @@ __MINGW_TYPEDEF_AW(PFORM_INFO_2)
#define PORT_STATUS_WARMING_UP 11
#define PORT_STATUS_POWER_SAVE 12
- typedef struct _MONITOR_INFO_1A{
+typedef struct _MONITOR_INFO_1A{
LPSTR pName;
- } MONITOR_INFO_1A,*PMONITOR_INFO_1A,*LPMONITOR_INFO_1A;
+} MONITOR_INFO_1A,*PMONITOR_INFO_1A,*LPMONITOR_INFO_1A;
- typedef struct _MONITOR_INFO_1W{
+typedef struct _MONITOR_INFO_1W{
LPWSTR pName;
- } MONITOR_INFO_1W,*PMONITOR_INFO_1W,*LPMONITOR_INFO_1W;
+} MONITOR_INFO_1W,*PMONITOR_INFO_1W,*LPMONITOR_INFO_1W;
- __MINGW_TYPEDEF_AW(MONITOR_INFO_1)
- __MINGW_TYPEDEF_AW(PMONITOR_INFO_1)
- __MINGW_TYPEDEF_AW(LPMONITOR_INFO_1)
+__MINGW_TYPEDEF_AW(MONITOR_INFO_1)
+__MINGW_TYPEDEF_AW(PMONITOR_INFO_1)
+__MINGW_TYPEDEF_AW(LPMONITOR_INFO_1)
- typedef struct _MONITOR_INFO_2A {
+typedef struct _MONITOR_INFO_2A {
LPSTR pName;
LPSTR pEnvironment;
LPSTR pDLLName;
- } MONITOR_INFO_2A,*PMONITOR_INFO_2A,*LPMONITOR_INFO_2A;
+} MONITOR_INFO_2A,*PMONITOR_INFO_2A,*LPMONITOR_INFO_2A;
- typedef struct _MONITOR_INFO_2W {
+typedef struct _MONITOR_INFO_2W {
LPWSTR pName;
LPWSTR pEnvironment;
LPWSTR pDLLName;
- } MONITOR_INFO_2W,*PMONITOR_INFO_2W,*LPMONITOR_INFO_2W;
+} MONITOR_INFO_2W,*PMONITOR_INFO_2W,*LPMONITOR_INFO_2W;
- __MINGW_TYPEDEF_AW(MONITOR_INFO_2)
- __MINGW_TYPEDEF_AW(PMONITOR_INFO_2)
- __MINGW_TYPEDEF_AW(LPMONITOR_INFO_2)
+__MINGW_TYPEDEF_AW(MONITOR_INFO_2)
+__MINGW_TYPEDEF_AW(PMONITOR_INFO_2)
+__MINGW_TYPEDEF_AW(LPMONITOR_INFO_2)
- typedef struct _DATATYPES_INFO_1A {
+typedef struct _DATATYPES_INFO_1A {
LPSTR pName;
- } DATATYPES_INFO_1A,*PDATATYPES_INFO_1A,*LPDATATYPES_INFO_1A;
+} DATATYPES_INFO_1A,*PDATATYPES_INFO_1A,*LPDATATYPES_INFO_1A;
- typedef struct _DATATYPES_INFO_1W {
+typedef struct _DATATYPES_INFO_1W {
LPWSTR pName;
- } DATATYPES_INFO_1W,*PDATATYPES_INFO_1W,*LPDATATYPES_INFO_1W;
+} DATATYPES_INFO_1W,*PDATATYPES_INFO_1W,*LPDATATYPES_INFO_1W;
- __MINGW_TYPEDEF_AW(DATATYPES_INFO_1)
- __MINGW_TYPEDEF_AW(PDATATYPES_INFO_1)
- __MINGW_TYPEDEF_AW(LPDATATYPES_INFO_1)
+__MINGW_TYPEDEF_AW(DATATYPES_INFO_1)
+__MINGW_TYPEDEF_AW(PDATATYPES_INFO_1)
+__MINGW_TYPEDEF_AW(LPDATATYPES_INFO_1)
- typedef struct _PRINTER_DEFAULTSA {
+typedef struct _PRINTER_DEFAULTSA {
LPSTR pDatatype;
LPDEVMODEA pDevMode;
ACCESS_MASK DesiredAccess;
- } PRINTER_DEFAULTSA,*PPRINTER_DEFAULTSA,*LPPRINTER_DEFAULTSA;
+} PRINTER_DEFAULTSA,*PPRINTER_DEFAULTSA,*LPPRINTER_DEFAULTSA;
- typedef struct _PRINTER_DEFAULTSW {
+typedef struct _PRINTER_DEFAULTSW {
LPWSTR pDatatype;
LPDEVMODEW pDevMode;
ACCESS_MASK DesiredAccess;
- } PRINTER_DEFAULTSW,*PPRINTER_DEFAULTSW,*LPPRINTER_DEFAULTSW;
+} PRINTER_DEFAULTSW,*PPRINTER_DEFAULTSW,*LPPRINTER_DEFAULTSW;
- __MINGW_TYPEDEF_AW(PRINTER_DEFAULTS)
- __MINGW_TYPEDEF_AW(PPRINTER_DEFAULTS)
- __MINGW_TYPEDEF_AW(LPPRINTER_DEFAULTS)
+__MINGW_TYPEDEF_AW(PRINTER_DEFAULTS)
+__MINGW_TYPEDEF_AW(PPRINTER_DEFAULTS)
+__MINGW_TYPEDEF_AW(LPPRINTER_DEFAULTS)
- typedef struct _PRINTER_ENUM_VALUESA {
+typedef struct _PRINTER_ENUM_VALUESA {
LPSTR pValueName;
DWORD cbValueName;
DWORD dwType;
LPBYTE pData;
DWORD cbData;
- } PRINTER_ENUM_VALUESA,*PPRINTER_ENUM_VALUESA,*LPPRINTER_ENUM_VALUESA;
+} PRINTER_ENUM_VALUESA,*PPRINTER_ENUM_VALUESA,*LPPRINTER_ENUM_VALUESA;
- typedef struct _PRINTER_ENUM_VALUESW {
+typedef struct _PRINTER_ENUM_VALUESW {
LPWSTR pValueName;
DWORD cbValueName;
DWORD dwType;
LPBYTE pData;
DWORD cbData;
- } PRINTER_ENUM_VALUESW,*PPRINTER_ENUM_VALUESW,*LPPRINTER_ENUM_VALUESW;
+} PRINTER_ENUM_VALUESW,*PPRINTER_ENUM_VALUESW,*LPPRINTER_ENUM_VALUESW;
- __MINGW_TYPEDEF_AW(PRINTER_ENUM_VALUES)
- __MINGW_TYPEDEF_AW(PPRINTER_ENUM_VALUES)
- __MINGW_TYPEDEF_AW(LPPRINTER_ENUM_VALUES)
+__MINGW_TYPEDEF_AW(PRINTER_ENUM_VALUES)
+__MINGW_TYPEDEF_AW(PPRINTER_ENUM_VALUES)
+__MINGW_TYPEDEF_AW(LPPRINTER_ENUM_VALUES)
#define EnumPrinters __MINGW_NAME_AW(EnumPrinters)
- WINBOOL WINAPI EnumPrintersA(DWORD Flags,LPSTR Name,DWORD Level,LPBYTE
pPrinterEnum,DWORD cbBuf,LPDWORD pcbNeeded,LPDWORD pcReturned);
- WINBOOL WINAPI EnumPrintersW(DWORD Flags,LPWSTR Name,DWORD Level,LPBYTE
pPrinterEnum,DWORD cbBuf,LPDWORD pcbNeeded,LPDWORD pcReturned);
+WINBOOL WINAPI EnumPrintersA(DWORD Flags,LPSTR Name,DWORD Level,LPBYTE pPrinterEnum,DWORD
cbBuf,LPDWORD pcbNeeded,LPDWORD pcReturned);
+WINBOOL WINAPI EnumPrintersW(DWORD Flags,LPWSTR Name,DWORD Level,LPBYTE
pPrinterEnum,DWORD cbBuf,LPDWORD pcbNeeded,LPDWORD pcReturned);
#define PRINTER_ENUM_DEFAULT 0x00000001
#define PRINTER_ENUM_LOCAL 0x00000002
diff --git a/sdk/include/reactos/idl/winspool.idl b/sdk/include/reactos/idl/winspool.idl
index 63c7527d808..f52528ec916 100644
--- a/sdk/include/reactos/idl/winspool.idl
+++ b/sdk/include/reactos/idl/winspool.idl
@@ -1173,14 +1173,14 @@ interface winspool {
DWORD _RpcAddPort(
[in, unique] WINSPOOL_HANDLE pName,
[in] ULONG_PTR hWnd,
- [in] WCHAR* pMonitorName
+ [in, string] WCHAR* pMonitorName
);
/* Function 0x26 */
DWORD _RpcConfigurePort(
[in, unique] WINSPOOL_HANDLE pName,
[in] ULONG_PTR hWnd,
- [in] WCHAR* pPortName
+ [in, string] WCHAR* pPortName
);
/* Function 0x27 */
@@ -1242,7 +1242,7 @@ interface winspool {
DWORD _RpcDeleteMonitor(
[in, unique] WINSPOOL_HANDLE pName,
[in, string, unique] WCHAR* pEnvironment,
- [in, string] WCHAR* pMonitorName
+ [in, string, unique] WCHAR* pMonitorName
);
/* Function 0x30 */
@@ -1342,7 +1342,7 @@ interface winspool {
/* Function 0x3D */
DWORD _RpcAddPortEx(
- [in] WINSPOOL_HANDLE pName,
+ [in, unique] WINSPOOL_HANDLE pName,
[in] WINSPOOL_PORT_CONTAINER* pPortContainer,
[in] WINSPOOL_PORT_VAR_CONTAINER* pPortVarContainer,
[in, string] WCHAR* pMonitorName
@@ -1362,9 +1362,12 @@ interface winspool {
/* Function 0x3F */
DWORD _RpcSpoolerInit();
- /* Function 0x40 (TODO) */
+ /* Function 0x40 */
DWORD _RpcResetPrinterEx(
- /* TODO */
+ [in] WINSPOOL_PRINTER_HANDLE hPrinter,
+ [in, string, unique] WCHAR* pDatatype,
+ [in] WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer,
+ [in] DWORD dwFlags
);
/* Function 0x41 */
@@ -1514,9 +1517,13 @@ interface winspool {
[in, string] const WCHAR* pKeyName
);
- /* Function 0x53 (TODO) */
+ /* Function 0x53 */
DWORD _RpcSeekPrinter(
- /* TODO */
+ [in] WINSPOOL_PRINTER_HANDLE hPrinter,
+ [in] LARGE_INTEGER liDistanceToMove,
+ [out] PLARGE_INTEGER pliNewPointer,
+ [in] DWORD dwMoveMethod,
+ [in] BOOL bWrite
);
/* Function 0x54 */
@@ -1553,7 +1560,7 @@ interface winspool {
/* Function 0x58 */
DWORD _RpcXcvData(
- [in] WINSPOOL_PRINTER_HANDLE hXcv,
+ [in, unique] WINSPOOL_PRINTER_HANDLE hXcv,
[in, string] const WCHAR* pszDataName,
[in, size_is(cbInputData)] BYTE* pInputData,
[in] DWORD cbInputData,
@@ -1577,7 +1584,7 @@ interface winspool {
/* Function 0x5B */
DWORD _RpcGetSpoolFileInfo(
- [in] WINSPOOL_PRINTER_HANDLE hPrinter,
+ [in, unique] WINSPOOL_PRINTER_HANDLE hPrinter,
[in] WINSPOOL_HANDLE hProcessHandle,
[in] DWORD Level,
[in] WINSPOOL_FILE_INFO_1* pFileInfo,
@@ -1587,8 +1594,8 @@ interface winspool {
/* Function 0x5C */
DWORD _RpcCommitSpoolData(
- [in] WINSPOOL_PRINTER_HANDLE hPrinter,
- [in] WINSPOOL_HANDLE hProcessHandle,
+ [in, unique] WINSPOOL_PRINTER_HANDLE hPrinter,
+ [in, unique] WINSPOOL_HANDLE hProcessHandle,
[in] DWORD cbCommit,
[in] DWORD Level,
[in] WINSPOOL_FILE_INFO_1* pFileInfo,
@@ -1598,7 +1605,7 @@ interface winspool {
/* Function 0x5D */
DWORD _RpcGetSpoolFileInfo2(
- [in] WINSPOOL_PRINTER_HANDLE hPrinter,
+ [in, unique] WINSPOOL_PRINTER_HANDLE hPrinter,
[in] DWORD dwProcessId,
[in] DWORD Level,
[in] WINSPOOL_FILE_INFO_CONTAINER* pFileInfoContainer
@@ -1615,12 +1622,12 @@ interface winspool {
/* Function 0x5F */
DWORD _RpcCloseSpoolFileHandle(
- [in] WINSPOOL_PRINTER_HANDLE hPrinter
+ [in, unique] WINSPOOL_PRINTER_HANDLE hPrinter
);
/* Function 0x60 */
DWORD _RpcFlushPrinter(
- [in] WINSPOOL_PRINTER_HANDLE hPrinter,
+ [in, unique] WINSPOOL_PRINTER_HANDLE hPrinter,
[in, size_is(cbBuf)] BYTE* pBuf,
[in] DWORD cbBuf,
[out] DWORD* pcWritten,
diff --git a/sdk/include/reactos/undocshell.h b/sdk/include/reactos/undocshell.h
index 4e55a38e274..a173174cb57 100644
--- a/sdk/include/reactos/undocshell.h
+++ b/sdk/include/reactos/undocshell.h
@@ -105,6 +105,22 @@ BOOL WINAPI StrRetToStrNW(LPWSTR,DWORD,LPSTRRET,const ITEMIDLIST*);
#define SHCNRF_RecursiveInterrupt 0x1000 /* Must be combined with
SHCNRF_InterruptLevel */
#define SHCNRF_NewDelivery 0x8000 /* Messages use shared memory */
+/****************************************************************************
+ * SHChangeNotify
+ */
+
+typedef struct _SHCNF_PRINTJOB_INFO
+{
+ DWORD JobId;
+ // More info,,,
+} SHCNF_PRINTJOB_INFO, *PSHCNF_PRINTJOB_INFO;
+
+//
+// Add missing types for print job notifications.
+//
+#define SHCNF_PRINTJOBA 0x0004
+#define SHCNF_PRINTJOBW 0x0007
+
/****************************************************************************
* Shell Common Dialogs
diff --git a/win32ss/printing/base/spoolss/CMakeLists.txt
b/win32ss/printing/base/spoolss/CMakeLists.txt
index cea56de0879..61a07536963 100644
--- a/win32ss/printing/base/spoolss/CMakeLists.txt
+++ b/win32ss/printing/base/spoolss/CMakeLists.txt
@@ -4,14 +4,17 @@ spec2def(spoolss.dll spoolss.spec ADD_IMPORTLIB)
list(APPEND SOURCE
../marshalling.c
context.c
+ forms.c
jobs.c
main.c
memory.c
monitors.c
ports.c
printerdata.c
+ printerdrivers.c
printers.c
printprocessors.c
+ printproviders.c
spoolfile.c
tools.c)
diff --git a/win32ss/printing/base/spoolss/forms.c
b/win32ss/printing/base/spoolss/forms.c
new file mode 100644
index 00000000000..823cf89b0fb
--- /dev/null
+++ b/win32ss/printing/base/spoolss/forms.c
@@ -0,0 +1,95 @@
+/*
+ * PROJECT: ReactOS Spooler Router
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Functions for managing print Forms
+ * COPYRIGHT: Copyright 2020 ReactOS
+ */
+
+#include "precomp.h"
+
+BOOL WINAPI
+AddFormW(HANDLE hPrinter, DWORD Level, PBYTE pForm)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return pHandle->pPrintProvider->PrintProvider.fpAddForm(pHandle->hPrinter,
Level, pForm);
+}
+
+BOOL WINAPI
+DeleteFormW(HANDLE hPrinter, PWSTR pFormName)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpDeleteForm(pHandle->hPrinter,
pFormName);
+}
+
+BOOL WINAPI
+EnumFormsW(HANDLE hPrinter, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded,
PDWORD pcReturned)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ if ( cbBuf && !pForm )
+ {
+ SetLastError(ERROR_INVALID_USER_BUFFER);
+ return FALSE;
+ }
+
+ return pHandle->pPrintProvider->PrintProvider.fpEnumForms(pHandle->hPrinter,
Level, pForm, cbBuf, pcbNeeded, pcReturned);
+}
+
+BOOL WINAPI
+GetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD
pcbNeeded)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ if ( cbBuf && pForm )
+ {
+ SetLastError(ERROR_INVALID_USER_BUFFER);
+ return FALSE;
+ }
+
+ return pHandle->pPrintProvider->PrintProvider.fpGetForm(pHandle->hPrinter,
pFormName, Level, pForm, cbBuf, pcbNeeded);
+}
+
+BOOL WINAPI
+SetFormW(HANDLE hPrinter, PWSTR pFormName, DWORD Level, PBYTE pForm)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return pHandle->pPrintProvider->PrintProvider.fpSetForm(pHandle->hPrinter,
pFormName, Level, pForm);
+}
diff --git a/win32ss/printing/base/spoolss/monitors.c
b/win32ss/printing/base/spoolss/monitors.c
index 0a6d8cb4d7f..949acfd8e56 100644
--- a/win32ss/printing/base/spoolss/monitors.c
+++ b/win32ss/printing/base/spoolss/monitors.c
@@ -7,6 +7,72 @@
#include "precomp.h"
+BOOL WINAPI
+AddMonitorW(PWSTR pName, DWORD Level, PBYTE pMonitors)
+{
+ BOOL bReturnValue = TRUE;
+ DWORD dwErrorCode = MAXDWORD;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+ PLIST_ENTRY pEntry;
+
+ // Loop through all Print Provider.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ // Check if this Print Provider provides the function.
+ if (!pPrintProvider->PrintProvider.fpAddMonitor)
+ continue;
+
+ bReturnValue = pPrintProvider->PrintProvider.fpAddMonitor(pName, Level,
pMonitors);
+
+ if ( !bReturnValue )
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ // dwErrorCode shall not be overwritten if a previous call already succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
+ }
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
+BOOL WINAPI
+DeleteMonitorW(PWSTR pName, PWSTR pEnvironment, PWSTR pMonitorName)
+{
+ BOOL bReturnValue = TRUE;
+ DWORD dwErrorCode = MAXDWORD;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+ PLIST_ENTRY pEntry;
+
+ // Loop through all Print Provider.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ // Check if this Print Provider provides the function.
+ if (!pPrintProvider->PrintProvider.fpDeleteMonitor)
+ continue;
+
+ bReturnValue = pPrintProvider->PrintProvider.fpDeleteMonitor(pName,
pEnvironment, pMonitorName);
+
+ if ( !bReturnValue )
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ // dwErrorCode shall not be overwritten if a previous call already succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
+ }
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
BOOL WINAPI
EnumMonitorsW(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf, PDWORD pcbNeeded,
PDWORD pcReturned)
{
@@ -14,6 +80,7 @@ EnumMonitorsW(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf,
PDWORD pcb
DWORD cbCallBuffer;
DWORD cbNeeded;
DWORD dwReturned;
+ DWORD dwErrorCode = MAXDWORD;
PBYTE pCallBuffer;
PSPOOLSS_PRINT_PROVIDER pPrintProvider;
PLIST_ENTRY pEntry;
@@ -47,6 +114,11 @@ EnumMonitorsW(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf,
PDWORD pcb
dwReturned = 0;
bReturnValue = pPrintProvider->PrintProvider.fpEnumMonitors(pName, Level,
pCallBuffer, cbCallBuffer, &cbNeeded, &dwReturned);
+ if ( !bReturnValue )
+ {
+ dwErrorCode = GetLastError();
+ }
+
// Add the returned counts to the total values.
*pcbNeeded += cbNeeded;
*pcReturned += dwReturned;
@@ -61,10 +133,11 @@ EnumMonitorsW(PWSTR pName, DWORD Level, PBYTE pMonitors, DWORD cbBuf,
PDWORD pcb
if (pCallBuffer)
pCallBuffer += cbNeeded;
- // Check if we shall not ask other Print Providers.
- if (bReturnValue == ROUTER_STOP_ROUTING)
- break;
+ // dwErrorCode shall not be overwritten if a previous EnumPrinters call already
succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
}
- return bReturnValue;
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
}
diff --git a/win32ss/printing/base/spoolss/ports.c
b/win32ss/printing/base/spoolss/ports.c
index 918ec1a2697..b0a34ad4c72 100644
--- a/win32ss/printing/base/spoolss/ports.c
+++ b/win32ss/printing/base/spoolss/ports.c
@@ -7,6 +7,142 @@
#include "precomp.h"
+BOOL WINAPI
+AddPortExW(PWSTR pName, DWORD Level, PBYTE lpBuffer, PWSTR lpMonitorName)
+{
+ BOOL bReturnValue = TRUE;
+ DWORD dwErrorCode = MAXDWORD;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+ PLIST_ENTRY pEntry;
+
+ FIXME("AddPortEx(%S, %lu, %p, %s)\n", pName, Level, lpBuffer,
debugstr_w(lpMonitorName));
+
+ // Loop through all Print Provider.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ // Check if this Print Provider provides the function.
+ if (!pPrintProvider->PrintProvider.fpAddPortEx)
+ continue;
+
+ bReturnValue = pPrintProvider->PrintProvider.fpAddPortEx(pName, Level,
lpBuffer, lpMonitorName);
+
+ if ( !bReturnValue )
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ // dwErrorCode shall not be overwritten if a previous call already succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
+ }
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
+BOOL WINAPI
+AddPortW(PWSTR pName, HWND hWnd, PWSTR pMonitorName)
+{
+ BOOL bReturnValue = TRUE;
+ DWORD dwErrorCode = MAXDWORD;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+ PLIST_ENTRY pEntry;
+
+ FIXME("AddPort(%S, %p, %s)\n", pName, hWnd, debugstr_w(pMonitorName));
+
+ // Loop through all Print Provider.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ // Check if this Print Provider provides the function.
+ if (!pPrintProvider->PrintProvider.fpAddPort)
+ continue;
+
+ bReturnValue = pPrintProvider->PrintProvider.fpAddPort(pName, hWnd,
pMonitorName);
+
+ if ( !bReturnValue )
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ // dwErrorCode shall not be overwritten if a previous call already succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
+ }
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
+BOOL WINAPI
+ConfigurePortW(PWSTR pName, HWND hWnd, PWSTR pPortName)
+{
+ BOOL bReturnValue = TRUE;
+ DWORD dwErrorCode = MAXDWORD;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+ PLIST_ENTRY pEntry;
+
+ // Loop through all Print Provider.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ // Check if this Print Provider provides the function.
+ if (!pPrintProvider->PrintProvider.fpConfigurePort)
+ continue;
+
+ bReturnValue = pPrintProvider->PrintProvider.fpConfigurePort(pName, hWnd,
pPortName);
+
+ if ( !bReturnValue )
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ // dwErrorCode shall not be overwritten if a previous call already succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
+ }
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
+BOOL WINAPI
+DeletePortW(PWSTR pName, HWND hWnd, PWSTR pPortName)
+{
+ BOOL bReturnValue = TRUE;
+ DWORD dwErrorCode = MAXDWORD;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+ PLIST_ENTRY pEntry;
+
+ // Loop through all Print Provider.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ // Check if this Print Provider provides the function.
+ if (!pPrintProvider->PrintProvider.fpDeletePort)
+ continue;
+
+ bReturnValue = pPrintProvider->PrintProvider.fpDeletePort(pName, hWnd,
pPortName);
+
+ if ( !bReturnValue )
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ // dwErrorCode shall not be overwritten if a previous call already succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
+ }
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
BOOL WINAPI
EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD pcbNeeded, PDWORD
pcReturned)
{
@@ -14,6 +150,7 @@ EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD
pcbNeeded
DWORD cbCallBuffer;
DWORD cbNeeded;
DWORD dwReturned;
+ DWORD dwErrorCode = MAXDWORD;
PBYTE pCallBuffer;
PSPOOLSS_PRINT_PROVIDER pPrintProvider;
PLIST_ENTRY pEntry;
@@ -38,11 +175,20 @@ EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf,
PDWORD pcbNeeded
{
pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+ // Check if this Print Provider provides an EnumPorts function.
+ if (!pPrintProvider->PrintProvider.fpEnumPorts)
+ continue;
+
// Call the EnumPorts function of this Print Provider.
cbNeeded = 0;
dwReturned = 0;
bReturnValue = pPrintProvider->PrintProvider.fpEnumPorts(pName, Level,
pCallBuffer, cbCallBuffer, &cbNeeded, &dwReturned);
+ if ( !bReturnValue )
+ {
+ dwErrorCode = GetLastError();
+ }
+
// Add the returned counts to the total values.
*pcbNeeded += cbNeeded;
*pcReturned += dwReturned;
@@ -57,10 +203,44 @@ EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf,
PDWORD pcbNeeded
if (pCallBuffer)
pCallBuffer += cbNeeded;
- // Check if we shall not ask other Print Providers.
- if (bReturnValue == ROUTER_STOP_ROUTING)
- break;
+ // dwErrorCode shall not be overwritten if a previous EnumPrinters call already
succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
+ }
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
+BOOL WINAPI
+SetPortW(PWSTR pName, PWSTR pPortName, DWORD dwLevel, PBYTE pPortInfo)
+{
+ BOOL bReturnValue = TRUE;
+ DWORD dwErrorCode = MAXDWORD;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+ PLIST_ENTRY pEntry;
+
+ // Loop through all Print Provider.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ // Check if this Print Provider provides the function.
+ if (!pPrintProvider->PrintProvider.fpSetPort)
+ continue;
+
+ bReturnValue = pPrintProvider->PrintProvider.fpSetPort(pName, pPortName,
dwLevel, pPortInfo);
+
+ if ( !bReturnValue )
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ // dwErrorCode shall not be overwritten if a previous call already succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
}
- return bReturnValue;
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
}
diff --git a/win32ss/printing/base/spoolss/printerdata.c
b/win32ss/printing/base/spoolss/printerdata.c
index fe44d42e56c..a9a26fb9211 100644
--- a/win32ss/printing/base/spoolss/printerdata.c
+++ b/win32ss/printing/base/spoolss/printerdata.c
@@ -7,6 +7,96 @@
#include "precomp.h"
+DWORD WINAPI
+DeletePrinterDataExW(HANDLE hPrinter, PCWSTR pKeyName, PCWSTR pValueName)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpDeletePrinterDataEx(pHandle->hPrinter,
pKeyName, pValueName);
+}
+
+DWORD WINAPI
+DeletePrinterDataW(HANDLE hPrinter, PWSTR pValueName)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpDeletePrinterData(pHandle->hPrinter,
pValueName);
+}
+
+DWORD WINAPI
+DeletePrinterKeyW(HANDLE hPrinter, PCWSTR pKeyName)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpDeletePrinterKey(pHandle->hPrinter,
pKeyName);
+}
+
+DWORD WINAPI
+EnumPrinterDataExW(HANDLE hPrinter, PCWSTR pKeyName, PBYTE pEnumValues, DWORD
cbEnumValues, PDWORD pcbEnumValues, PDWORD pnEnumValues)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpEnumPrinterDataEx(pHandle->hPrinter,
pKeyName, pEnumValues, cbEnumValues, pcbEnumValues, pnEnumValues);
+}
+
+DWORD WINAPI
+EnumPrinterDataW(HANDLE hPrinter, DWORD dwIndex, PWSTR pValueName, DWORD cbValueName,
PDWORD pcbValueName, PDWORD pType, PBYTE pData, DWORD cbData, PDWORD pcbData)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpEnumPrinterData(pHandle->hPrinter,
dwIndex, pValueName, cbValueName, pcbValueName, pType, pData, cbData, pcbData);
+}
+
+DWORD WINAPI
+EnumPrinterKeyW(HANDLE hPrinter, PCWSTR pKeyName, PWSTR pSubkey, DWORD cbSubkey, PDWORD
pcbSubkey)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpEnumPrinterKey(pHandle->hPrinter,
pKeyName, pSubkey, cbSubkey, pcbSubkey);
+}
+
DWORD WINAPI
GetPrinterDataExW(HANDLE hPrinter, LPCWSTR pKeyName, LPCWSTR pValueName, LPDWORD pType,
LPBYTE pData, DWORD nSize, LPDWORD pcbNeeded)
{
diff --git a/win32ss/printing/base/spoolss/printerdrivers.c
b/win32ss/printing/base/spoolss/printerdrivers.c
new file mode 100644
index 00000000000..f5787bd03c7
--- /dev/null
+++ b/win32ss/printing/base/spoolss/printerdrivers.c
@@ -0,0 +1,254 @@
+/*
+ * PROJECT: ReactOS Spooler Router
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Functions related to Printer Configuration Data
+ * COPYRIGHT: Copyright 2020 ReactOS
+ */
+
+#include "precomp.h"
+
+BOOL WINAPI
+AddPrinterDriverExW(PWSTR pName, DWORD Level, PBYTE pDriverInfo, DWORD dwFileCopyFlags)
+{
+ BOOL bReturnValue;
+ DWORD dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+ PLIST_ENTRY pEntry;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+
+ // Loop through all Print Providers.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ bReturnValue = pPrintProvider->PrintProvider.fpAddPrinterDriverEx(pName,
Level, pDriverInfo, dwFileCopyFlags);
+
+ if (bReturnValue == ROUTER_SUCCESS)
+ {
+ dwErrorCode = ERROR_SUCCESS;
+ goto Cleanup;
+ }
+ else if (bReturnValue == ROUTER_STOP_ROUTING)
+ {
+ ERR("A Print Provider returned ROUTER_STOP_ROUTING for Printer
\"%S\"!\n", pName);
+ dwErrorCode = GetLastError();
+ goto Cleanup;
+ }
+ }
+
+Cleanup:
+ // ERROR_INVALID_NAME by the Print Provider is translated to
ERROR_INVALID_PRINTER_NAME here, but not in other APIs as far as I know.
+ if (dwErrorCode == ERROR_INVALID_NAME)
+ dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
+BOOL WINAPI
+AddPrinterDriverW(PWSTR pName, DWORD Level, PBYTE pDriverInfo)
+{
+ TRACE("AddPrinterDriverW(%S, %lu, %p)\n", pName, Level, pDriverInfo);
+ return AddPrinterDriverExW(pName, Level, pDriverInfo, APD_COPY_NEW_FILES);
+}
+
+BOOL WINAPI
+DeletePrinterDriverExW(PWSTR pName, PWSTR pEnvironment, PWSTR pDriverName, DWORD
dwDeleteFlag, DWORD dwVersionFlag)
+{
+ BOOL bReturnValue;
+ DWORD dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+ PLIST_ENTRY pEntry;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+
+ // Loop through all Print Providers.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ bReturnValue = pPrintProvider->PrintProvider.fpDeletePrinterDriverEx(pName,
pEnvironment, pDriverName, dwDeleteFlag, dwVersionFlag);
+
+ if (bReturnValue == ROUTER_SUCCESS)
+ {
+ dwErrorCode = ERROR_SUCCESS;
+ goto Cleanup;
+ }
+ else if (bReturnValue == ROUTER_STOP_ROUTING)
+ {
+ ERR("A Print Provider returned ROUTER_STOP_ROUTING for Printer
\"%S\"!\n", pName);
+ dwErrorCode = GetLastError();
+ goto Cleanup;
+ }
+ }
+
+Cleanup:
+ // ERROR_INVALID_NAME by the Print Provider is translated to
ERROR_INVALID_PRINTER_NAME here, but not in other APIs as far as I know.
+ if (dwErrorCode == ERROR_INVALID_NAME)
+ dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
+BOOL WINAPI
+DeletePrinterDriverW(PWSTR pName, PWSTR pEnvironment, PWSTR pDriverName)
+{
+ TRACE("DeletePrinterDriverW(%S, %S, %S)\n", pName, pEnvironment,
pDriverName);
+ return DeletePrinterDriverExW(pName, pEnvironment, pDriverName, 0, 0);
+}
+
+BOOL WINAPI
+EnumPrinterDriversW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE pDriverInfo,
DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
+{
+ DWORD cbCallBuffer;
+ DWORD cbNeeded;
+ DWORD dwErrorCode = MAXDWORD;
+ DWORD dwReturned;
+ PBYTE pCallBuffer;
+ BOOL Ret = FALSE;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+ PLIST_ENTRY pEntry;
+
+ // Begin counting.
+ *pcbNeeded = 0;
+ *pcReturned = 0;
+
+ if ( cbBuf && !pDriverInfo )
+ {
+ dwErrorCode = ERROR_INVALID_USER_BUFFER;
+ goto Cleanup;
+ }
+
+ // At the beginning, we have the full buffer available.
+ cbCallBuffer = cbBuf;
+ pCallBuffer = pDriverInfo;
+
+ // Loop through all Print Providers.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ // Call the EnumPrinters function of this Print Provider.
+ cbNeeded = 0;
+ dwReturned = 0;
+
+ Ret = pPrintProvider->PrintProvider.fpEnumPrinterDrivers( pName, pEnvironment,
Level, pCallBuffer, cbCallBuffer, &cbNeeded, &dwReturned);
+
+ if ( !Ret )
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ // Add the returned counts to the total values.
+ *pcbNeeded += cbNeeded;
+ *pcReturned += dwReturned;
+
+ // Reduce the available buffer size for the next call without risking an
underflow.
+ if (cbNeeded < cbCallBuffer)
+ cbCallBuffer -= cbNeeded;
+ else
+ cbCallBuffer = 0;
+
+ // Advance the buffer if the caller provided it.
+ if (pCallBuffer)
+ pCallBuffer += cbNeeded;
+
+ // dwErrorCode shall not be overwritten if a previous EnumPrinters call already
succeeded.
+ if (dwErrorCode != ERROR_SUCCESS)
+ dwErrorCode = GetLastError();
+ }
+
+Cleanup:
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
+BOOL WINAPI
+GetPrinterDriverW(HANDLE hPrinter, PWSTR pEnvironment, DWORD Level, PBYTE pDriverInfo,
DWORD cbBuf, PDWORD pcbNeeded)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpGetPrinterDriver(pHandle->hPrinter,
pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded);
+}
+
+
+BOOL WINAPI
+GetPrinterDriverExW(
+ HANDLE hPrinter,
+ LPWSTR pEnvironment,
+ DWORD Level,
+ LPBYTE pDriverInfo,
+ DWORD cbBuf,
+ LPDWORD pcbNeeded,
+ DWORD dwClientMajorVersion,
+ DWORD dwClientMinorVersion,
+ PDWORD pdwServerMajorVersion,
+ PDWORD pdwServerMinorVersion )
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ FIXME("GetPrinterDriverExW(%p, %lu, %lu, %p, %lu, %p, %lu, %lu, %p, %p)\n",
hPrinter, pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded, dwClientMajorVersion,
dwClientMinorVersion, pdwServerMajorVersion, pdwServerMinorVersion);
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ if ( cbBuf && !pDriverInfo )
+ {
+ SetLastError(ERROR_INVALID_USER_BUFFER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpGetPrinterDriverEx(pHandle->hPrinter,
pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded, dwClientMajorVersion,
dwClientMinorVersion, pdwServerMajorVersion, pdwServerMinorVersion);
+}
+
+BOOL WINAPI
+GetPrinterDriverDirectoryW(PWSTR pName, PWSTR pEnvironment, DWORD Level, PBYTE
pDriverDirectory, DWORD cbBuf, PDWORD pcbNeeded)
+{
+ BOOL bReturnValue;
+ DWORD dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+ PLIST_ENTRY pEntry;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+
+ if ( cbBuf && !pDriverDirectory )
+ {
+ SetLastError(ERROR_INVALID_USER_BUFFER);
+ return FALSE;
+ }
+
+ // Loop through all Print Providers.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ bReturnValue =
pPrintProvider->PrintProvider.fpGetPrinterDriverDirectory(pName, pEnvironment, Level,
pDriverDirectory, cbBuf, pcbNeeded);
+
+ if (bReturnValue == ROUTER_SUCCESS)
+ {
+ dwErrorCode = ERROR_SUCCESS;
+ goto Cleanup;
+ }
+ else if (bReturnValue == ROUTER_STOP_ROUTING)
+ {
+ ERR("A Print Provider returned ROUTER_STOP_ROUTING for Printer
\"%S\"!\n", pName);
+ dwErrorCode = GetLastError();
+ goto Cleanup;
+ }
+ }
+
+Cleanup:
+ // ERROR_INVALID_NAME by the Print Provider is translated to
ERROR_INVALID_PRINTER_NAME here, but not in other APIs as far as I know.
+ if (dwErrorCode == ERROR_INVALID_NAME)
+ dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
diff --git a/win32ss/printing/base/spoolss/printers.c
b/win32ss/printing/base/spoolss/printers.c
index 3414717ca02..db35d47bffb 100644
--- a/win32ss/printing/base/spoolss/printers.c
+++ b/win32ss/printing/base/spoolss/printers.c
@@ -7,6 +7,170 @@
#include "precomp.h"
+BOOL WINAPI
+AbortPrinter(HANDLE hPrinter)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpAbortPrinter(pHandle->hPrinter);
+}
+
+//
+// See [MS-RPRN] 2.2.1.11 SPLCLIENT_INFO, SPLCLIENT_INFO Level.
+//
+HANDLE WINAPI
+AddPrinterExW( PWSTR pName, DWORD Level, PBYTE pPrinter, PBYTE pClientInfo, DWORD
ClientInfoLevel)
+{
+ BOOL bReturnValue;
+ DWORD dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+ HANDLE hPrinter = NULL;
+ PWSTR pPrinterName = NULL;
+ PLIST_ENTRY pEntry;
+ PSPOOLSS_PRINTER_HANDLE pHandle;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+
+ if ( Level != 2 )
+ {
+ FIXME( "Unsupported level %d\n", Level );
+ SetLastError( ERROR_INVALID_LEVEL );
+ return hPrinter;
+ }
+ else
+ {
+ PPRINTER_INFO_2W pi2w = (PPRINTER_INFO_2W)pPrinter;
+ pPrinterName = pi2w->pPrinterName;
+ }
+
+ // Loop through all Print Providers to find one able to open this Printer.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ hPrinter = pPrintProvider->PrintProvider.fpAddPrinterEx(pName, Level,
pPrinter, pClientInfo, ClientInfoLevel);
+
+ bReturnValue = GetLastError();
+
+ // Fallback.... ?
+
+ if ( hPrinter == NULL && bReturnValue == ERROR_NOT_SUPPORTED )
+ {
+ hPrinter = pPrintProvider->PrintProvider.fpAddPrinter(pName, Level,
pPrinter);
+ }
+
+ bReturnValue = GetLastError();
+
+ if ( bReturnValue == ROUTER_SUCCESS && hPrinter )
+ {
+ // This Print Provider has opened this Printer.
+ // Store this information and return a handle.
+ pHandle = DllAllocSplMem(sizeof(SPOOLSS_PRINTER_HANDLE));
+ if (!pHandle)
+ {
+ dwErrorCode = ERROR_NOT_ENOUGH_MEMORY;
+ ERR("DllAllocSplMem failed!\n");
+ goto Cleanup;
+ }
+
+ pHandle->pPrintProvider = pPrintProvider;
+ pHandle->hPrinter = hPrinter;
+
+ dwErrorCode = ERROR_SUCCESS;
+ goto Cleanup;
+ }
+ else if (bReturnValue == ROUTER_STOP_ROUTING)
+ {
+ ERR("A Print Provider returned ROUTER_STOP_ROUTING for Printer
\"%S\"!\n", pPrinterName);
+ dwErrorCode = GetLastError();
+ goto Cleanup;
+ }
+ }
+
+Cleanup:
+ // ERROR_INVALID_NAME by the Print Provider is translated to
ERROR_INVALID_PRINTER_NAME here, but not in other APIs as far as I know.
+ if (dwErrorCode == ERROR_INVALID_NAME)
+ dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+
+ SetLastError(dwErrorCode);
+ return hPrinter;
+}
+
+HANDLE WINAPI
+AddPrinterW(PWSTR pName, DWORD Level, PBYTE pPrinter)
+{
+ BOOL bReturnValue;
+ DWORD dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+ HANDLE hPrinter = NULL;
+ PWSTR pPrinterName = NULL;
+ PLIST_ENTRY pEntry;
+ PSPOOLSS_PRINTER_HANDLE pHandle;
+ PSPOOLSS_PRINT_PROVIDER pPrintProvider;
+
+ FIXME("AddPrinterW(%S, %lu, %p)\n", pName, Level, pPrinter);
+
+ if ( Level != 2 )
+ {
+ FIXME( "Unsupported level %d\n", Level );
+ SetLastError( ERROR_INVALID_LEVEL );
+ return hPrinter;
+ }
+ else
+ {
+ PPRINTER_INFO_2W pi2w = (PPRINTER_INFO_2W)pPrinter;
+ pPrinterName = pi2w->pPrinterName;
+ }
+
+ // Xp return AddPrinterExW( pName, Level, pPrinter, NULL, 0); but,,,, W7u just
Forward Direct.
+
+ // Loop through all Print Providers to find one able to open this Printer.
+ for (pEntry = PrintProviderList.Flink; pEntry != &PrintProviderList; pEntry =
pEntry->Flink)
+ {
+ pPrintProvider = CONTAINING_RECORD(pEntry, SPOOLSS_PRINT_PROVIDER, Entry);
+
+ hPrinter = pPrintProvider->PrintProvider.fpAddPrinter(pName, Level,
pPrinter);
+
+ bReturnValue = GetLastError();
+
+ if ( bReturnValue == ROUTER_SUCCESS && hPrinter )
+ {
+ // This Print Provider has opened this Printer.
+ // Store this information and return a handle.
+ pHandle = DllAllocSplMem(sizeof(SPOOLSS_PRINTER_HANDLE));
+ if (!pHandle)
+ {
+ dwErrorCode = ERROR_NOT_ENOUGH_MEMORY;
+ ERR("DllAllocSplMem failed!\n");
+ goto Cleanup;
+ }
+
+ pHandle->pPrintProvider = pPrintProvider;
+ pHandle->hPrinter = hPrinter;
+
+ dwErrorCode = ERROR_SUCCESS;
+ goto Cleanup;
+ }
+ else if (bReturnValue == ROUTER_STOP_ROUTING)
+ {
+ ERR("A Print Provider returned ROUTER_STOP_ROUTING for Printer
\"%S\"!\n", pPrinterName);
+ dwErrorCode = GetLastError();
+ goto Cleanup;
+ }
+ }
+
+Cleanup:
+ // ERROR_INVALID_NAME by the Print Provider is translated to
ERROR_INVALID_PRINTER_NAME here, but not in other APIs as far as I know.
+ if (dwErrorCode == ERROR_INVALID_NAME)
+ dwErrorCode = ERROR_INVALID_PRINTER_NAME;
+
+ SetLastError(dwErrorCode);
+ return hPrinter;
+}
BOOL WINAPI
ClosePrinter(HANDLE hPrinter)
@@ -14,6 +178,8 @@ ClosePrinter(HANDLE hPrinter)
BOOL bReturnValue;
PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+ FIXME("ClosePrinter %p\n",hPrinter);
+
// Sanity checks.
if (!pHandle)
{
@@ -25,13 +191,28 @@ ClosePrinter(HANDLE hPrinter)
// Call CloseHandle of the Print Provider.
bReturnValue =
pHandle->pPrintProvider->PrintProvider.fpClosePrinter(pHandle->hPrinter);
-
+ FIXME("ClosePrinter 2\n");
// Free our handle information.
DllFreeSplMem(pHandle);
-
+ FIXME("ClosePrinter 3\n");
return bReturnValue;
}
+BOOL WINAPI
+DeletePrinter(HANDLE hPrinter)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return
pHandle->pPrintProvider->PrintProvider.fpDeletePrinter(pHandle->hPrinter);
+}
+
BOOL WINAPI
EndDocPrinter(HANDLE hPrinter)
{
@@ -70,6 +251,7 @@ EnumPrintersW(DWORD Flags, PWSTR Name, DWORD Level, PBYTE pPrinterEnum,
DWORD cb
DWORD dwErrorCode = MAXDWORD;
DWORD dwReturned;
PBYTE pCallBuffer;
+ BOOL Ret = FALSE;
PSPOOLSS_PRINT_PROVIDER pPrintProvider;
PLIST_ENTRY pEntry;
@@ -95,7 +277,12 @@ EnumPrintersW(DWORD Flags, PWSTR Name, DWORD Level, PBYTE
pPrinterEnum, DWORD cb
// Call the EnumPrinters function of this Print Provider.
cbNeeded = 0;
dwReturned = 0;
- pPrintProvider->PrintProvider.fpEnumPrinters(Flags, Name, Level, pCallBuffer,
cbCallBuffer, &cbNeeded, &dwReturned);
+ Ret = pPrintProvider->PrintProvider.fpEnumPrinters(Flags, Name, Level,
pCallBuffer, cbCallBuffer, &cbNeeded, &dwReturned);
+
+ if ( !Ret )
+ {
+ dwErrorCode = GetLastError();
+ }
// Add the returned counts to the total values.
*pcbNeeded += cbNeeded;
@@ -122,7 +309,7 @@ Cleanup:
}
BOOL WINAPI
-GetPrinterDriverW(HANDLE hPrinter, PWSTR pEnvironment, DWORD Level, PBYTE pDriverInfo,
DWORD cbBuf, PDWORD pcbNeeded)
+GetPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pPrinter, DWORD cbBuf, PDWORD pcbNeeded)
{
PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
@@ -133,11 +320,14 @@ GetPrinterDriverW(HANDLE hPrinter, PWSTR pEnvironment, DWORD Level,
PBYTE pDrive
return FALSE;
}
- return
pHandle->pPrintProvider->PrintProvider.fpGetPrinterDriver(pHandle->hPrinter,
pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded);
+ return
pHandle->pPrintProvider->PrintProvider.fpGetPrinter(pHandle->hPrinter, Level,
pPrinter, cbBuf, pcbNeeded);
}
-BOOL WINAPI
-GetPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pPrinter, DWORD cbBuf, PDWORD pcbNeeded)
+//
+// Forward Dead API to Local/Remote....
+//
+DWORD WINAPI
+PrinterMessageBoxW(HANDLE hPrinter, DWORD Error, HWND hWnd, LPWSTR pText, LPWSTR
pCaption, DWORD dwType)
{
PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
@@ -148,7 +338,7 @@ GetPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pPrinter, DWORD cbBuf,
PDWORD pc
return FALSE;
}
- return
pHandle->pPrintProvider->PrintProvider.fpGetPrinter(pHandle->hPrinter, Level,
pPrinter, cbBuf, pcbNeeded);
+ return
pHandle->pPrintProvider->PrintProvider.fpPrinterMessageBox(pHandle->hPrinter,
Error, hWnd, pText, pCaption, dwType);
}
BOOL WINAPI
@@ -218,6 +408,36 @@ ReadPrinter(HANDLE hPrinter, PVOID pBuf, DWORD cbBuf, PDWORD
pNoBytesRead)
return
pHandle->pPrintProvider->PrintProvider.fpReadPrinter(pHandle->hPrinter, pBuf,
cbBuf, pNoBytesRead);
}
+BOOL WINAPI
+SeekPrinter( HANDLE hPrinter, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER
pliNewPointer, DWORD dwMoveMethod, BOOL bWrite )
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return pHandle->pPrintProvider->PrintProvider.fpSeekPrinter(
pHandle->hPrinter, liDistanceToMove, pliNewPointer, dwMoveMethod, bWrite );
+}
+
+BOOL WINAPI
+SetPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pPrinter, DWORD Command)
+{
+ PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hPrinter;
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ return pHandle->pPrintProvider->PrintProvider.fpSetPrinter(
pHandle->hPrinter, Level, pPrinter, Command );
+}
+
DWORD WINAPI
StartDocPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pDocInfo)
{
@@ -268,6 +488,8 @@ XcvDataW(HANDLE hXcv, PCWSTR pszDataName, PBYTE pInputData, DWORD
cbInputData, P
{
PSPOOLSS_PRINTER_HANDLE pHandle = (PSPOOLSS_PRINTER_HANDLE)hXcv;
+ FIXME("XcvDataW( %p, %S,,,)\n",hXcv, pszDataName);
+
// Sanity checks.
if (!pHandle)
{
diff --git a/win32ss/printing/base/spoolss/printprocessors.c
b/win32ss/printing/base/spoolss/printprocessors.c
index 2a760bf96a1..2401cc89af9 100644
--- a/win32ss/printing/base/spoolss/printprocessors.c
+++ b/win32ss/printing/base/spoolss/printprocessors.c
@@ -6,6 +6,23 @@
*/
#include "precomp.h"
+#include <prtprocenv.h>
+
+BOOL WINAPI
+AddPrintProcessorW(PWSTR pName, PWSTR pEnvironment, PWSTR pPathName, PWSTR
pPrintProcessorName)
+{
+ if (!pEnvironment || !*pEnvironment)
+ pEnvironment = (PWSTR)wszCurrentEnvironment;
+ return FALSE;
+}
+
+BOOL WINAPI
+DeletePrintProcessorW(PWSTR pName, PWSTR pEnvironment, PWSTR pPrintProcessorName)
+{
+ if (!pEnvironment || !*pEnvironment)
+ pEnvironment = (PWSTR)wszCurrentEnvironment;
+ return FALSE;
+}
BOOL WINAPI
EnumPrintProcessorDatatypesW(PWSTR pName, PWSTR pPrintProcessorName, DWORD Level, PBYTE
pDatatypes, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
@@ -19,6 +36,12 @@ EnumPrintProcessorDatatypesW(PWSTR pName, PWSTR pPrintProcessorName,
DWORD Level
return FALSE;
}
+ if ( cbBuf && !pDatatypes )
+ {
+ SetLastError(ERROR_INVALID_USER_BUFFER);
+ return FALSE;
+ }
+
// Always call this function on the Local Spooler.
pPrintProvider = CONTAINING_RECORD(PrintProviderList.Flink, SPOOLSS_PRINT_PROVIDER,
Entry);
return pPrintProvider->PrintProvider.fpEnumPrintProcessorDatatypes(pName,
pPrintProcessorName, Level, pDatatypes, cbBuf, pcbNeeded, pcReturned);
@@ -29,6 +52,13 @@ EnumPrintProcessorsW(PWSTR pName, PWSTR pEnvironment, DWORD Level,
PBYTE pPrintP
{
// Always call this function on the Local Spooler.
PSPOOLSS_PRINT_PROVIDER pPrintProvider = CONTAINING_RECORD(PrintProviderList.Flink,
SPOOLSS_PRINT_PROVIDER, Entry);
+
+ if ( cbBuf && !pPrintProcessorInfo )
+ {
+ SetLastError(ERROR_INVALID_USER_BUFFER);
+ return FALSE;
+ }
+
return pPrintProvider->PrintProvider.fpEnumPrintProcessors(pName, pEnvironment,
Level, pPrintProcessorInfo, cbBuf, pcbNeeded, pcReturned);
}
@@ -44,6 +74,12 @@ GetPrintProcessorDirectoryW(PWSTR pName, PWSTR pEnvironment, DWORD
Level, PBYTE
return FALSE;
}
+ if ( cbBuf && !pPrintProcessorInfo )
+ {
+ SetLastError(ERROR_INVALID_USER_BUFFER);
+ return FALSE;
+ }
+
// Always call this function on the Local Spooler.
pPrintProvider = CONTAINING_RECORD(PrintProviderList.Flink, SPOOLSS_PRINT_PROVIDER,
Entry);
return pPrintProvider->PrintProvider.fpGetPrintProcessorDirectory(pName,
pEnvironment, Level, pPrintProcessorInfo, cbBuf, pcbNeeded);
diff --git a/win32ss/printing/base/spoolss/printproviders.c
b/win32ss/printing/base/spoolss/printproviders.c
new file mode 100644
index 00000000000..9f29f6abfb1
--- /dev/null
+++ b/win32ss/printing/base/spoolss/printproviders.c
@@ -0,0 +1,26 @@
+/*
+ * PROJECT: ReactOS Spooler Router
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Functions for managing print Providers
+ * COPYRIGHT: Copyright 2020 ReactOS
+ */
+
+#include "precomp.h"
+
+//
+// These do not forward!!!
+//
+
+BOOL WINAPI
+AddPrintProvidorW(PWSTR pName, DWORD Level, PBYTE pProviderInfo)
+{
+ FIXME("AddPrintProvidorW(%S, %lu, %p)\n", pName, Level, pProviderInfo);
+ return FALSE;
+}
+
+BOOL WINAPI
+DeletePrintProvidorW(PWSTR pName, PWSTR pEnvironment, PWSTR pPrintProviderName)
+{
+ FIXME("DeletePrintProvidorW(%s, %s, %s)\n", pName, pEnvironment,
pPrintProviderName);
+ return FALSE;
+}
diff --git a/win32ss/printing/base/spoolss/spoolss.spec
b/win32ss/printing/base/spoolss/spoolss.spec
index 2ea70ea4440..fa7bdab3671 100644
--- a/win32ss/printing/base/spoolss/spoolss.spec
+++ b/win32ss/printing/base/spoolss/spoolss.spec
@@ -1,18 +1,18 @@
-@ stub AbortPrinter
+@ stdcall AbortPrinter(ptr)
@ stub AddDriverCatalog
-@ stub AddFormW
+@ stdcall AddFormW(ptr long ptr)
@ stdcall AddJobW(long long ptr long ptr)
-@ stub AddMonitorW
+@ stdcall AddMonitorW(wstr long ptr)
@ stub AddPerMachineConnectionW
-@ stub AddPortExW
-@ stub AddPortW
+@ stdcall AddPortExW(wstr long ptr wstr)
+@ stdcall AddPortW(wstr ptr wstr)
@ stub AddPrinterConnectionW
-@ stub AddPrinterDriverExW
-@ stub AddPrinterDriverW
-@ stub AddPrinterExW
-@ stub AddPrinterW
-@ stub AddPrintProcessorW
-@ stub AddPrintProvidorW
+@ stdcall AddPrinterDriverExW(wstr long ptr long)
+@ stdcall AddPrinterDriverW(wstr long ptr)
+@ stdcall AddPrinterExW(wstr long ptr ptr long)
+@ stdcall AddPrinterW(wstr long ptr)
+@ stdcall AddPrintProcessorW(wstr wstr wstr wstr)
+@ stdcall AddPrintProvidorW(wstr long ptr)
@ stub AdjustPointers
@ stub AdjustPointersInStructuresArray
@ stub AlignKMPtr
@@ -36,37 +36,37 @@
@ stub ClusterSplClose
@ stub ClusterSplIsAlive
@ stub ClusterSplOpen
-@ stub ConfigurePortW
+@ stdcall ConfigurePortW(wstr ptr wstr)
@ stub CreatePrinterIC
@ stub DbgGetPointers
-@ stub DeleteFormW
-@ stub DeleteMonitorW
+@ stdcall DeleteFormW(ptr wstr)
+@ stdcall DeleteMonitorW(wstr wstr wstr)
@ stub DeletePerMachineConnectionW
-@ stub DeletePortW
-@ stub DeletePrinter
+@ stdcall DeletePortW(wstr ptr wstr)
+@ stdcall DeletePrinter(ptr)
@ stub DeletePrinterConnectionW
-@ stub DeletePrinterDataExW
-@ stub DeletePrinterDataW
-@ stub DeletePrinterDriverExW
-@ stub DeletePrinterDriverW
+@ stdcall DeletePrinterDataExW(ptr wstr wstr)
+@ stdcall DeletePrinterDataW(ptr wstr)
+@ stdcall DeletePrinterDriverExW(wstr wstr wstr long long)
+@ stdcall DeletePrinterDriverW(wstr wstr wstr)
@ stub DeletePrinterIC
-@ stub DeletePrinterKeyW
-@ stub DeletePrintProcessorW
-@ stub DeletePrintProvidorW
+@ stdcall DeletePrinterKeyW(ptr wstr)
+@ stdcall DeletePrintProcessorW(wstr wstr wstr)
+@ stdcall DeletePrintProvidorW(wstr wstr wstr)
@ stdcall DllAllocSplMem(long)
@ stdcall DllFreeSplMem(ptr)
@ stdcall DllFreeSplStr(ptr)
@ stdcall EndDocPrinter(long)
@ stdcall EndPagePrinter(long)
-@ stub EnumFormsW
+@ stdcall EnumFormsW(ptr long ptr long ptr ptr)
@ stdcall EnumJobsW(long long long long ptr long ptr ptr)
@ stdcall EnumMonitorsW(wstr long ptr long ptr ptr)
@ stub EnumPerMachineConnectionsW
@ stdcall EnumPortsW(wstr long ptr long ptr ptr)
-@ stub EnumPrinterDataExW
-@ stub EnumPrinterDataW
-@ stub EnumPrinterDriversW
-@ stub EnumPrinterKeyW
+@ stdcall EnumPrinterDataExW(ptr wstr ptr long ptr ptr)
+@ stdcall EnumPrinterDataW(ptr long wstr long ptr ptr ptr long ptr)
+@ stdcall EnumPrinterDriversW(wstr wstr long ptr long ptr ptr)
+@ stdcall EnumPrinterKeyW(ptr wstr wstr long ptr)
@ stdcall EnumPrintersW(long wstr long ptr long ptr ptr)
@ stdcall EnumPrintProcessorDatatypesW(wstr wstr long ptr long ptr ptr)
@ stdcall EnumPrintProcessorsW(wstr wstr long ptr long ptr ptr)
@@ -76,14 +76,14 @@
@ stub FormatRegistryKeyForPrinter
@ stub FreeOtherNames
@ stub GetClientUserHandle
-@ stub GetFormW
+@ stdcall GetFormW(ptr wstr long ptr long ptr)
@ stub GetJobAttributes
@ stdcall GetJobW(long long long ptr long ptr)
@ stub GetNetworkId
@ stdcall GetPrinterDataExW(long wstr wstr ptr ptr long ptr)
@ stdcall GetPrinterDataW(long wstr ptr ptr long ptr)
-@ stub GetPrinterDriverDirectoryW
-@ stub GetPrinterDriverExW
+@ stdcall GetPrinterDriverDirectoryW(wstr wstr long ptr long ptr)
+@ stdcall GetPrinterDriverExW(ptr wstr long ptr long ptr long long ptr ptr)
@ stdcall GetPrinterDriverW(long wstr long ptr long ptr)
@ stdcall GetPrinterW(long long ptr long ptr)
@ stdcall GetPrintProcessorDirectoryW(wstr wstr long ptr long ptr)
@@ -102,7 +102,7 @@
@ stdcall MarshallUpStructuresArray(long ptr long ptr long long)
@ stub MIDL_user_allocate1
@ stub MIDL_user_free1
-@ stub OldGetPrinterDriverW
+@ stdcall OldGetPrinterDriverW(long wstr long ptr long ptr) GetPrinterDriverW
@ stub OpenPrinterExW
@ stub OpenPrinterPortW
@ stdcall OpenPrinterW(wstr ptr ptr)
@@ -110,7 +110,7 @@
@ stub PartialReplyPrinterChangeNotification
@ stub PlayGdiScriptOnPrinterIC
@ stub PrinterHandleRundown
-@ stub PrinterMessageBoxW
+@ stdcall PrinterMessageBoxW(ptr long ptr wstr wstr long)
@ stub ProvidorFindClosePrinterChangeNotification
@ stub ProvidorFindFirstPrinterChangeNotification
@ stub pszDbgAllocMsgA
@@ -121,7 +121,7 @@
@ stub ReplyClosePrinter
@ stub ReplyOpenPrinter
@ stub ReplyPrinterChangeNotification
-@ stub ResetPrinterW
+@ stdcall -stub ResetPrinterW(ptr ptr)
@ stdcall RevertToPrinterSelf()
@ stub RouterAllocBidiMem
@ stub RouterAllocBidiResponseContainer
@@ -133,18 +133,18 @@
@ stub RouterRefreshPrinterChangeNotification
@ stub RouterReplyPrinter
@ stdcall ScheduleJob(long long)
-@ stub SeekPrinter
+@ stdcall SeekPrinter(ptr int64 ptr long long)
@ stub SendRecvBidiData
@ stub SetAllocFailCount
-@ stub SetFormW
+@ stdcall SetFormW(ptr wstr long ptr)
@ stdcall SetJobW(long long long ptr long)
-@ stub SetPortW
+@ stdcall SetPortW(wstr wstr long ptr)
@ stdcall SetPrinterDataExW(long wstr wstr long ptr long)
@ stdcall SetPrinterDataW(long wstr long ptr long)
-@ stub SetPrinterW
+@ stdcall SetPrinterW(ptr long ptr long)
@ stdcall SplCloseSpoolFileHandle(ptr)
@ stdcall SplCommitSpoolData(ptr ptr long long ptr long ptr)
-@ stub SplDriverUnloadComplete
+@ stdcall -stub SplDriverUnloadComplete(wstr)
@ stdcall SplGetSpoolFileInfo(ptr ptr long ptr long ptr)
@ stdcall SplInitializeWinSpoolDrv(ptr)
@ stub SplIsSessionZero
diff --git a/win32ss/printing/base/spoolsv/CMakeLists.txt
b/win32ss/printing/base/spoolsv/CMakeLists.txt
index 2fadb38a0cb..1506f4d5dc3 100644
--- a/win32ss/printing/base/spoolsv/CMakeLists.txt
+++ b/win32ss/printing/base/spoolsv/CMakeLists.txt
@@ -2,6 +2,8 @@
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl)
add_rpc_files(server ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/winspool.idl)
+spec2def(spoolsv.exe spoolsv.spec ADD_IMPORTLIB)
+
list(APPEND SOURCE
forms.c
init.c
diff --git a/win32ss/printing/base/spoolsv/forms.c
b/win32ss/printing/base/spoolsv/forms.c
index 533ad935f99..0dc2fd86574 100644
--- a/win32ss/printing/base/spoolsv/forms.c
+++ b/win32ss/printing/base/spoolsv/forms.c
@@ -6,38 +6,125 @@
*/
#include "precomp.h"
+#include <marshalling/forms.h>
DWORD
_RpcAddForm(WINSPOOL_PRINTER_HANDLE hPrinter, WINSPOOL_FORM_CONTAINER*
pFormInfoContainer)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!AddFormW(hPrinter, pFormInfoContainer->Level,
(PBYTE)pFormInfoContainer->FormInfo.pFormInfo1))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcDeleteForm(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pFormName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!DeleteFormW(hPrinter, pFormName))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcEnumForms(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE* pForm, DWORD cbBuf,
DWORD* pcbNeeded, DWORD* pcReturned)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+ PBYTE pFormsEnumAligned;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ pFormsEnumAligned = AlignRpcPtr(pForm, &cbBuf);
+
+ if (EnumFormsW(hPrinter, Level, pFormsEnumAligned, cbBuf, pcbNeeded, pcReturned))
+ {
+ // Replace absolute pointer addresses in the output by relative offsets.
+ ASSERT(Level >= 1 && Level <= 2);
+ MarshallDownStructuresArray(pFormsEnumAligned, *pcReturned,
pFormInfoMarshalling[Level]->pInfo, pFormInfoMarshalling[Level]->cbStructureSize,
TRUE);
+ }
+ else
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ RpcRevertToSelf();
+ UndoAlignRpcPtr(pForm, pFormsEnumAligned, cbBuf, pcbNeeded);
+
+ return dwErrorCode;
}
DWORD
_RpcGetForm(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pFormName, DWORD Level, BYTE* pForm,
DWORD cbBuf, DWORD* pcbNeeded)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+ PBYTE pFormAligned;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ pFormAligned = AlignRpcPtr(pForm, &cbBuf);
+
+ if (GetFormW(hPrinter, pFormName, Level, pFormAligned, cbBuf, pcbNeeded))
+ {
+ // Replace absolute pointer addresses in the output by relative offsets.
+ ASSERT(Level >= 1 && Level <= 2);
+ MarshallDownStructure(pFormAligned, pFormInfoMarshalling[Level]->pInfo,
pFormInfoMarshalling[Level]->cbStructureSize, TRUE);
+ }
+ else
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ RpcRevertToSelf();
+ UndoAlignRpcPtr(pForm, pFormAligned, cbBuf, pcbNeeded);
+
+ return dwErrorCode;
}
DWORD
_RpcSetForm(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pFormName, WINSPOOL_FORM_CONTAINER*
pFormInfoContainer)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!SetFormW(hPrinter, pFormName, pFormInfoContainer->Level,
(PBYTE)pFormInfoContainer->FormInfo.pFormInfo1))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
diff --git a/win32ss/printing/base/spoolsv/monitors.c
b/win32ss/printing/base/spoolsv/monitors.c
index 0b83ccad009..07642f13ebb 100644
--- a/win32ss/printing/base/spoolsv/monitors.c
+++ b/win32ss/printing/base/spoolsv/monitors.c
@@ -11,15 +11,39 @@
DWORD
_RpcAddMonitor(WINSPOOL_HANDLE pName, WINSPOOL_MONITOR_CONTAINER* pMonitorContainer)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!AddMonitorW(pName, pMonitorContainer->Level,
(PBYTE)pMonitorContainer->MonitorInfo.pMonitorInfo2))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcDeleteMonitor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pMonitorName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!DeleteMonitorW( pName, pEnvironment, pMonitorName ))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
diff --git a/win32ss/printing/base/spoolsv/ports.c
b/win32ss/printing/base/spoolsv/ports.c
index 8b510d7ee03..7dbb06cbdbe 100644
--- a/win32ss/printing/base/spoolsv/ports.c
+++ b/win32ss/printing/base/spoolsv/ports.c
@@ -11,29 +11,101 @@
DWORD
_RpcAddPort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR* pMonitorName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ FIXME("AddPort(%S, %p, %s)\n", pName, hWnd, debugstr_w(pMonitorName));
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!AddPortW( pName, (HWND)hWnd, pMonitorName ))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcAddPortEx(WINSPOOL_HANDLE pName, WINSPOOL_PORT_CONTAINER* pPortContainer,
WINSPOOL_PORT_VAR_CONTAINER* pPortVarContainer, WCHAR* pMonitorName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode, Level = pPortContainer->Level;
+ WINSPOOL_PORT_INFO_FF PortInfoFF;
+ PBYTE lpBuffer;
+
+ FIXME("AddPortEx(%S, %lu, %s)\n", pName, Level, debugstr_w(pMonitorName));
+
+ switch (Level)
+ {
+ case 1:
+ lpBuffer = (PBYTE)pPortContainer->PortInfo.pPortInfo1;
+ break;
+
+ case 0xFFFFFFFF:
+ PortInfoFF.pPortName = pPortContainer->PortInfo.pPortInfoFF->pPortName;
+ PortInfoFF.cbMonitorData = pPortVarContainer->cbMonitorData;
+ PortInfoFF.pMonitorData = pPortVarContainer->pMonitorData;
+ lpBuffer = (PBYTE)&PortInfoFF;
+ break;
+
+ default:
+ ERR("Level = %d, unsupported!\n", Level);
+ return ERROR_INVALID_LEVEL;
+ }
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!AddPortExW(pName, Level, lpBuffer, pMonitorName ))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcConfigurePort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR* pPortName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!ConfigurePortW( pName, (HWND)hWnd, pPortName ))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcDeletePort(WINSPOOL_HANDLE pName, ULONG_PTR hWnd, WCHAR* pPortName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!DeletePortW( pName, (HWND)hWnd, pPortName ))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
@@ -71,6 +143,18 @@ _RpcEnumPorts(WINSPOOL_HANDLE pName, DWORD Level, BYTE* pPort, DWORD
cbBuf, DWOR
DWORD
_RpcSetPort(WINSPOOL_HANDLE pName, WCHAR* pPortName, WINSPOOL_PORT_CONTAINER*
pPortContainer)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!SetPortW(pName, pPortName, pPortContainer->Level,
(PBYTE)pPortContainer->PortInfo.pPortInfo3))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
diff --git a/win32ss/printing/base/spoolsv/printerdrivers.c
b/win32ss/printing/base/spoolsv/printerdrivers.c
index ae85f84434d..4fbd5445b7d 100644
--- a/win32ss/printing/base/spoolsv/printerdrivers.c
+++ b/win32ss/printing/base/spoolsv/printerdrivers.c
@@ -11,36 +11,325 @@
DWORD
_RpcAddPrinterDriver(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER* pDriverContainer)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+ PBYTE pDriverInfo = NULL;
+
+ switch ( pDriverContainer->Level )
+ {
+ case 8:
+ {
+ WINSPOOL_DRIVER_INFO_8 *pdi = pDriverContainer->DriverInfo.Level8;
+ PDRIVER_INFO_8W pdi8w = DllAllocSplMem(sizeof(DRIVER_INFO_8W));
+ pDriverInfo = (PBYTE)pdi8w;
+
+ pdi8w->pszPrintProcessor = pdi->pPrintProcessor;
+ pdi8w->pszVendorSetup = pdi->pVendorSetup;
+ pdi8w->pszzColorProfiles = pdi->pszzColorProfiles;
+ pdi8w->pszInfPath = pdi->pInfPath;
+ pdi8w->pszzCoreDriverDependencies = pdi->pszzCoreDriverDependencies;
+ pdi8w->ftMinInboxDriverVerDate = pdi->ftMinInboxDriverVerDate;
+ pdi8w->dwlMinInboxDriverVerVersion = pdi->dwlMinInboxDriverVerVersion;
+ }
+ case 6:
+ {
+ WINSPOOL_DRIVER_INFO_6 *pdi = pDriverContainer->DriverInfo.Level6;
+ PDRIVER_INFO_6W pdi6w;
+
+ if ( pDriverInfo == NULL )
+ {
+ pdi6w = DllAllocSplMem(sizeof(DRIVER_INFO_6W));
+ pDriverInfo = (PBYTE)pdi6w;
+ }
+ else
+ {
+ pdi6w = (PDRIVER_INFO_6W)pDriverInfo;
+ }
+
+ pdi6w->pszMfgName = pdi->pMfgName;
+ pdi6w->pszOEMUrl = pdi->pOEMUrl;
+ pdi6w->pszHardwareID = pdi->pHardwareID;
+ pdi6w->pszProvider = pdi->pProvider;
+ pdi6w->ftDriverDate = pdi->ftDriverDate;
+ pdi6w->dwlDriverVersion = pdi->dwlDriverVersion;
+ }
+ case 4:
+ {
+ WINSPOOL_DRIVER_INFO_4 *pdi = pDriverContainer->DriverInfo.Level4;
+ PDRIVER_INFO_4W pdi4w;
+
+ if ( pDriverInfo == NULL )
+ {
+ pdi4w = DllAllocSplMem(sizeof(DRIVER_INFO_4W));
+ pDriverInfo = (PBYTE)pdi4w;
+ }
+ else
+ {
+ pdi4w = (PDRIVER_INFO_4W)pDriverInfo;
+ }
+
+ pdi4w->pszzPreviousNames = pdi->pszzPreviousNames;
+ }
+ case 3:
+ {
+ WINSPOOL_DRIVER_INFO_3 *pdi = pDriverContainer->DriverInfo.Level3;
+ PDRIVER_INFO_3W pdi3w;
+
+ if ( pDriverInfo == NULL )
+ {
+ pdi3w = DllAllocSplMem(sizeof(DRIVER_INFO_3W));
+ pDriverInfo = (PBYTE)pdi3w;
+ }
+ else
+ {
+ pdi3w = (PDRIVER_INFO_3W)pDriverInfo;
+ }
+
+ pdi3w->pHelpFile = pdi->pHelpFile;
+ pdi3w->pDependentFiles = pdi->pDependentFiles;
+ pdi3w->pMonitorName = pdi->pMonitorName;
+ pdi3w->pDefaultDataType = pdi->pDefaultDataType;
+ pdi3w->pDependentFiles = pdi->pDependentFiles;
+ }
+ case 2:
+ {
+ WINSPOOL_DRIVER_INFO_2 *pdi = pDriverContainer->DriverInfo.Level2;
+ PDRIVER_INFO_2W pdi2w;
+
+ if ( pDriverInfo == NULL )
+ {
+ pdi2w = DllAllocSplMem(sizeof(DRIVER_INFO_2W));
+ pDriverInfo = (PBYTE)pdi2w;
+ }
+ else
+ {
+ pdi2w = (PDRIVER_INFO_2W)pDriverInfo;
+ }
+
+ pdi2w->pName = pdi->pName;
+ pdi2w->pEnvironment = pdi->pEnvironment;
+ pdi2w->pDriverPath = pdi->pDriverPath;
+ pdi2w->pDataFile = pdi->pDataFile;
+ pdi2w->pConfigFile = pdi->pConfigFile;
+ }
+ break;
+ //
+ // At this point pDriverInfo is null.
+ //
+ default:
+ return ERROR_INVALID_LEVEL;
+ }
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!AddPrinterDriverW( pName, pDriverContainer->Level, pDriverInfo ))
+ dwErrorCode = GetLastError();
+
+ if ( pDriverInfo ) DllFreeSplMem( pDriverInfo );
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcAddPrinterDriverEx(WINSPOOL_HANDLE pName, WINSPOOL_DRIVER_CONTAINER*
pDriverContainer, DWORD dwFileCopyFlags)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+ PBYTE pDriverInfo = NULL;
+
+ switch ( pDriverContainer->Level )
+ {
+ case 8:
+ {
+ WINSPOOL_DRIVER_INFO_8 *pdi = pDriverContainer->DriverInfo.Level8;
+ PDRIVER_INFO_8W pdi8w = DllAllocSplMem(sizeof(DRIVER_INFO_8W));
+ pDriverInfo = (PBYTE)pdi8w;
+
+ pdi8w->pszPrintProcessor = pdi->pPrintProcessor;
+ pdi8w->pszVendorSetup = pdi->pVendorSetup;
+ pdi8w->pszzColorProfiles = pdi->pszzColorProfiles;
+ pdi8w->pszInfPath = pdi->pInfPath;
+ pdi8w->pszzCoreDriverDependencies = pdi->pszzCoreDriverDependencies;
+ pdi8w->ftMinInboxDriverVerDate = pdi->ftMinInboxDriverVerDate;
+ pdi8w->dwlMinInboxDriverVerVersion = pdi->dwlMinInboxDriverVerVersion;
+ }
+ case 6:
+ {
+ WINSPOOL_DRIVER_INFO_6 *pdi = pDriverContainer->DriverInfo.Level6;
+ PDRIVER_INFO_6W pdi6w;
+
+ if ( pDriverInfo == NULL )
+ {
+ pdi6w = DllAllocSplMem(sizeof(DRIVER_INFO_6W));
+ pDriverInfo = (PBYTE)pdi6w;
+ }
+ else
+ {
+ pdi6w = (PDRIVER_INFO_6W)pDriverInfo;
+ }
+
+ pdi6w->pszMfgName = pdi->pMfgName;
+ pdi6w->pszOEMUrl = pdi->pOEMUrl;
+ pdi6w->pszHardwareID = pdi->pHardwareID;
+ pdi6w->pszProvider = pdi->pProvider;
+ pdi6w->ftDriverDate = pdi->ftDriverDate;
+ pdi6w->dwlDriverVersion = pdi->dwlDriverVersion;
+ }
+ case 4:
+ {
+ WINSPOOL_DRIVER_INFO_4 *pdi = pDriverContainer->DriverInfo.Level4;
+ PDRIVER_INFO_4W pdi4w;
+
+ if ( pDriverInfo == NULL )
+ {
+ pdi4w = DllAllocSplMem(sizeof(DRIVER_INFO_4W));
+ pDriverInfo = (PBYTE)pdi4w;
+ }
+ else
+ {
+ pdi4w = (PDRIVER_INFO_4W)pDriverInfo;
+ }
+
+ pdi4w->pszzPreviousNames = pdi->pszzPreviousNames;
+ }
+ case 3:
+ {
+ WINSPOOL_DRIVER_INFO_3 *pdi = pDriverContainer->DriverInfo.Level3;
+ PDRIVER_INFO_3W pdi3w;
+
+ if ( pDriverInfo == NULL )
+ {
+ pdi3w = DllAllocSplMem(sizeof(DRIVER_INFO_3W));
+ pDriverInfo = (PBYTE)pdi3w;
+ }
+ else
+ {
+ pdi3w = (PDRIVER_INFO_3W)pDriverInfo;
+ }
+
+ pdi3w->pHelpFile = pdi->pHelpFile;
+ pdi3w->pDependentFiles = pdi->pDependentFiles;
+ pdi3w->pMonitorName = pdi->pMonitorName;
+ pdi3w->pDefaultDataType = pdi->pDefaultDataType;
+ pdi3w->pDependentFiles = pdi->pDependentFiles;
+ }
+ case 2:
+ {
+ WINSPOOL_DRIVER_INFO_2 *pdi = pDriverContainer->DriverInfo.Level2;
+ PDRIVER_INFO_2W pdi2w;
+
+ if ( pDriverInfo == NULL )
+ {
+ pdi2w = DllAllocSplMem(sizeof(DRIVER_INFO_2W));
+ pDriverInfo = (PBYTE)pdi2w;
+ }
+ else
+ {
+ pdi2w = (PDRIVER_INFO_2W)pDriverInfo;
+ }
+
+ pdi2w->pName = pdi->pName;
+ pdi2w->pEnvironment = pdi->pEnvironment;
+ pdi2w->pDriverPath = pdi->pDriverPath;
+ pdi2w->pDataFile = pdi->pDataFile;
+ pdi2w->pConfigFile = pdi->pConfigFile;
+ }
+ break;
+ //
+ // At this point pDriverInfo is null.
+ //
+ default:
+ return ERROR_INVALID_LEVEL;
+ }
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!AddPrinterDriverExW( pName, pDriverContainer->Level, pDriverInfo,
dwFileCopyFlags ))
+ dwErrorCode = GetLastError();
+
+ if ( pDriverInfo ) DllFreeSplMem( pDriverInfo );
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcDeletePrinterDriver(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pDriverName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!DeletePrinterDriverW(pName, pEnvironment, pDriverName))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcDeletePrinterDriverEx(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pDriverName,
DWORD dwDeleteFlag, DWORD dwVersionNum)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!DeletePrinterDriverExW(pName, pEnvironment, pDriverName, dwDeleteFlag,
dwVersionNum))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcEnumPrinterDrivers(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level, BYTE*
pDrivers, DWORD cbBuf, DWORD* pcbNeeded, DWORD* pcReturned)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+ PBYTE pPrinterDriversEnumAligned;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ pPrinterDriversEnumAligned = AlignRpcPtr(pDrivers, &cbBuf);
+
+ if (EnumPrinterDriversW(pName, pEnvironment, Level, pPrinterDriversEnumAligned,
cbBuf, pcbNeeded, pcReturned))
+ {
+ // Replace absolute pointer addresses in the output by relative offsets.
+ ASSERT(Level <= 6 || Level == 8);
+ MarshallDownStructuresArray(pPrinterDriversEnumAligned, *pcReturned,
pPrinterDriverMarshalling[Level]->pInfo,
pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE);
+ }
+ else
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ RpcRevertToSelf();
+ UndoAlignRpcPtr(pDrivers, pPrinterDriversEnumAligned, cbBuf, pcbNeeded);
+
+ return dwErrorCode;
}
DWORD
@@ -49,7 +338,7 @@ _RpcGetPrinterDriver(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR*
pEnvironment, DWOR
DWORD dwErrorCode;
PBYTE pDriverAligned;
- ERR("_RpcGetPrinterDriver(%p, %lu, %lu, %p, %lu, %p)\n", hPrinter,
pEnvironment, Level, pDriver, cbBuf, pcbNeeded);
+ TRACE("_RpcGetPrinterDriver(%p, %lu, %lu, %p, %lu, %p)\n", hPrinter,
pEnvironment, Level, pDriver, cbBuf, pcbNeeded);
dwErrorCode = RpcImpersonateClient(NULL);
if (dwErrorCode != ERROR_SUCCESS)
@@ -63,7 +352,7 @@ _RpcGetPrinterDriver(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR*
pEnvironment, DWOR
if (GetPrinterDriverW(hPrinter, pEnvironment, Level, pDriverAligned, cbBuf,
pcbNeeded))
{
// Replace relative offset addresses in the output by absolute pointers.
- ASSERT(Level >= 1 && Level <= 5);
+ ASSERT(Level <= 6 || Level == 8);
MarshallDownStructure(pDriverAligned, pPrinterDriverMarshalling[Level]->pInfo,
pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE);
}
else
@@ -77,16 +366,102 @@ _RpcGetPrinterDriver(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR*
pEnvironment, DWOR
return dwErrorCode;
}
+BOOL WINAPI YGetPrinterDriver2(
+ HANDLE hPrinter,
+ LPWSTR pEnvironment,
+ DWORD Level,
+ LPBYTE pDriver,
+ DWORD cbBuf,
+ LPDWORD pcbNeeded,
+ DWORD dwClientMajorVersion,
+ DWORD dwClientMinorVersion,
+ PDWORD pdwServerMajorVersion,
+ PDWORD pdwServerMinorVersion,
+ BOOL bRPC ) // Seems that all Y fuctions have this.
+{
+ DWORD dwErrorCode;
+ PBYTE pDriverAligned;
+
+ FIXME("_Rpc(Y)GetPrinterDriver2(%p, %lu, %lu, %p, %lu, %p, %lu, %lu, %p,
%p)\n", hPrinter, pEnvironment, Level, pDriver, cbBuf, pcbNeeded,
dwClientMajorVersion, dwClientMinorVersion, pdwServerMajorVersion,
pdwServerMinorVersion);
+
+ if ( bRPC )
+ {
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+ }
+
+ pDriverAligned = AlignRpcPtr(pDriver, &cbBuf);
+
+ if (GetPrinterDriverExW(hPrinter, pEnvironment, Level, pDriverAligned, cbBuf,
pcbNeeded, dwClientMajorVersion, dwClientMinorVersion, pdwServerMajorVersion,
pdwServerMinorVersion))
+ {
+ // Replace relative offset addresses in the output by absolute pointers.
+ ASSERT(Level <= 6 || Level == 8);
+ MarshallDownStructure(pDriverAligned, pPrinterDriverMarshalling[Level]->pInfo,
pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE);
+ }
+ else
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ if ( bRPC ) RpcRevertToSelf();
+ UndoAlignRpcPtr(pDriver, pDriverAligned, cbBuf, pcbNeeded);
+
+ return dwErrorCode;
+}
+
DWORD
_RpcGetPrinterDriver2(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pEnvironment, DWORD Level,
BYTE* pDriver, DWORD cbBuf, DWORD* pcbNeeded, DWORD dwClientMajorVersion, DWORD
dwClientMinorVersion, DWORD* pdwServerMaxVersion, DWORD* pdwServerMinVersion)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+ PBYTE pDriverAligned;
+
+ FIXME("_RpcGetPrinterDriver2(%p, %lu, %lu, %p, %lu, %p, %lu, %lu, %p,
%p)\n", hPrinter, pEnvironment, Level, pDriver, cbBuf, pcbNeeded,
dwClientMajorVersion, dwClientMinorVersion, pdwServerMaxVersion, pdwServerMinVersion);
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ pDriverAligned = AlignRpcPtr(pDriver, &cbBuf);
+
+ if (GetPrinterDriverExW(hPrinter, pEnvironment, Level, pDriverAligned, cbBuf,
pcbNeeded, dwClientMajorVersion, dwClientMinorVersion, pdwServerMaxVersion,
pdwServerMinVersion))
+ {
+ // Replace relative offset addresses in the output by absolute pointers.
+ ASSERT(Level <= 6 || Level == 8);
+ MarshallDownStructure(pDriverAligned, pPrinterDriverMarshalling[Level]->pInfo,
pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE);
+ }
+ else
+ {
+ dwErrorCode = GetLastError();
+ }
+
+ RpcRevertToSelf();
+ UndoAlignRpcPtr(pDriver, pDriverAligned, cbBuf, pcbNeeded);
+
+ return dwErrorCode;
}
DWORD
_RpcGetPrinterDriverDirectory(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, DWORD Level,
BYTE* pDriverDirectory, DWORD cbBuf, DWORD* pcbNeeded)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!GetPrinterDriverDirectoryW(pName, pEnvironment, Level, pDriverDirectory, cbBuf,
pcbNeeded))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
diff --git a/win32ss/printing/base/spoolsv/printers.c
b/win32ss/printing/base/spoolsv/printers.c
index 08eec5f0714..b1eb9070a06 100644
--- a/win32ss/printing/base/spoolsv/printers.c
+++ b/win32ss/printing/base/spoolsv/printers.c
@@ -11,8 +11,20 @@
DWORD
_RpcAbortPrinter(WINSPOOL_PRINTER_HANDLE hPrinter)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!AbortPrinter(hPrinter))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
@@ -53,8 +65,20 @@ _RpcClosePrinter(WINSPOOL_PRINTER_HANDLE* phPrinter)
DWORD
_RpcDeletePrinter(WINSPOOL_PRINTER_HANDLE hPrinter)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!DeletePrinter(hPrinter))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
@@ -224,17 +248,64 @@ _RpcResetPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pDatatype,
WINSPOOL_DE
}
DWORD
-_RpcResetPrinterEx(VOID)
+_RpcResetPrinterEx(WINSPOOL_PRINTER_HANDLE hPrinter, WCHAR* pDatatype,
WINSPOOL_DEVMODE_CONTAINER* pDevModeContainer, DWORD dwFlags)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+ PRINTER_DEFAULTSW pdw;
+
+ if (pDatatype)
+ {
+ pdw.pDatatype = pDatatype;
+ }
+ else
+ {
+ pdw.pDatatype = dwFlags & RESETPRINTERDEFAULTDATATYPE ? (PWSTR)-1 : NULL;
+ }
+
+ if (pDevModeContainer->pDevMode)
+ {
+ pdw.pDevMode = (PDEVMODEW)pDevModeContainer->pDevMode;
+ // Fixme : Need to check DevMode before forward call, by copy devmode.c from
WinSpool.
+ // Local SV!SplIsValidDevmode((PDW)pDevModeContainer->pDevMode,
pDevModeContainer->cbBuf)
+ }
+ else
+ {
+ pdw.pDevMode = dwFlags & RESETPRINTERDEFAULTDEVMODE ? (PDEVMODEW)-1 : NULL;
+
+ }
+ pdw.DesiredAccess = 0;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!ResetPrinterW(hPrinter, &pdw))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
-_RpcSeekPrinter(VOID)
+_RpcSeekPrinter( WINSPOOL_PRINTER_HANDLE hPrinter, LARGE_INTEGER liDistanceToMove,
PLARGE_INTEGER pliNewPointer, DWORD dwMoveMethod, BOOL bWrite )
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!SeekPrinter(hPrinter, liDistanceToMove, pliNewPointer, dwMoveMethod, bWrite))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
diff --git a/win32ss/printing/base/spoolsv/printprocessors.c
b/win32ss/printing/base/spoolsv/printprocessors.c
index fcdb7d50d46..4dffb8c4f35 100644
--- a/win32ss/printing/base/spoolsv/printprocessors.c
+++ b/win32ss/printing/base/spoolsv/printprocessors.c
@@ -11,15 +11,39 @@
DWORD
_RpcAddPrintProcessor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR* pPathName,
WCHAR* pPrintProcessorName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!AddPrintProcessorW(pName, pEnvironment, pPathName, pPrintProcessorName))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
_RpcDeletePrintProcessor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR*
pPrintProcessorName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!DeletePrintProcessorW(pName, pEnvironment, pPrintProcessorName))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
diff --git a/win32ss/printing/base/spoolsv/printproviders.c
b/win32ss/printing/base/spoolsv/printproviders.c
index 3e04c3273de..b4d2b79755e 100644
--- a/win32ss/printing/base/spoolsv/printproviders.c
+++ b/win32ss/printing/base/spoolsv/printproviders.c
@@ -10,13 +10,38 @@
DWORD
_RpcAddPrintProvidor(WINSPOOL_HANDLE pName, WINSPOOL_PROVIDOR_CONTAINER*
pProvidorContainer)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!AddPrintProvidorW(pName, pProvidorContainer->Level,
(PBYTE)pProvidorContainer->ProvidorInfo.pProvidorInfo1))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
+
}
DWORD
_RpcDeletePrintProvidor(WINSPOOL_HANDLE pName, WCHAR* pEnvironment, WCHAR*
pPrintProviderName)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!DeletePrintProvidorW(pName, pEnvironment, pPrintProviderName))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
diff --git a/win32ss/printing/base/spoolsv/rpcstubs.c
b/win32ss/printing/base/spoolsv/rpcstubs.c
index f1a4cabd48d..33c194e178d 100644
--- a/win32ss/printing/base/spoolsv/rpcstubs.c
+++ b/win32ss/printing/base/spoolsv/rpcstubs.c
@@ -42,11 +42,26 @@ _RpcDeletePrinterConnection(WINSPOOL_HANDLE pName)
return ERROR_INVALID_FUNCTION;
}
+//
+// Forward Dead API....
+//
DWORD
_RpcPrinterMessageBox(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Error, ULONG_PTR hWnd,
WCHAR* pText, WCHAR* pCaption, DWORD dwType)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ PrinterMessageBoxW(hPrinter, Error, (HWND)hWnd, pText, pCaption, dwType);
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
DWORD
diff --git a/win32ss/printing/base/spoolsv/spoolsv.spec
b/win32ss/printing/base/spoolsv/spoolsv.spec
new file mode 100644
index 00000000000..ba9ddaa9e46
--- /dev/null
+++ b/win32ss/printing/base/spoolsv/spoolsv.spec
@@ -0,0 +1,18 @@
+@ stdcall -stub YAbortPrinter(ptr long)
+@ stdcall -stub YAddJob(long long ptr long ptr long)
+@ stdcall -stub YDriverUnloadComplete(wstr long)
+@ stdcall -stub YEndDocPrinter(long long)
+@ stdcall -stub YEndPagePrinter(long long)
+@ stdcall -stub YFlushPrinter(ptr ptr long ptr long long)
+@ stdcall -stub YGetPrinter(ptr long ptr long ptr long)
+@ stdcall YGetPrinterDriver2(ptr wstr long ptr long ptr long long ptr ptr long)
+@ stdcall -stub YGetPrinterDriverDirectory(wstr wstr long ptr long ptr long)
+@ stdcall -stub YReadPrinter(ptr ptr long ptr long)
+@ stdcall -stub YSeekPrinter(ptr int64 ptr long long long)
+@ stdcall -stub YSetJob(ptr long long ptr long long)
+@ stdcall -stub YSetPort(wstr wstr long ptr long)
+@ stdcall -stub YSetPrinter(ptr long ptr long long)
+@ stdcall -stub YSplReadPrinter(ptr ptr long long)
+@ stdcall -stub YStartDocPrinter(ptr long ptr long)
+@ stdcall -stub YStartPagePrinter(ptr long)
+@ stdcall -stub YWritePrinter(ptr ptr long ptr long)
diff --git a/win32ss/printing/base/spoolsv/xcv.c b/win32ss/printing/base/spoolsv/xcv.c
index 30136748ecb..a9d45282196 100644
--- a/win32ss/printing/base/spoolsv/xcv.c
+++ b/win32ss/printing/base/spoolsv/xcv.c
@@ -10,6 +10,20 @@
DWORD
_RpcXcvData(WINSPOOL_PRINTER_HANDLE hXcv, const WCHAR* pszDataName, BYTE* pInputData,
DWORD cbInputData, BYTE* pOutputData, DWORD cbOutputData, DWORD* pcbOutputNeeded, DWORD*
pdwStatus)
{
- UNIMPLEMENTED;
- return ERROR_INVALID_FUNCTION;
+ DWORD dwErrorCode;
+
+ FIXME("RpcXcvData( %p, %S,,,)\n",hXcv, pszDataName);
+
+ dwErrorCode = RpcImpersonateClient(NULL);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode);
+ return dwErrorCode;
+ }
+
+ if (!XcvDataW(hXcv, pszDataName, pInputData, cbInputData, pOutputData, cbOutputData,
pcbOutputNeeded, pdwStatus))
+ dwErrorCode = GetLastError();
+
+ RpcRevertToSelf();
+ return dwErrorCode;
}
diff --git a/win32ss/printing/base/winspool/forms.c
b/win32ss/printing/base/winspool/forms.c
index 7d8a0e65d9e..5fd33998e52 100644
--- a/win32ss/printing/base/winspool/forms.c
+++ b/win32ss/printing/base/winspool/forms.c
@@ -177,6 +177,7 @@ BOOL WINAPI
EnumFormsA(HANDLE hPrinter, DWORD Level, PBYTE pForm, DWORD cbBuf, PDWORD pcbNeeded,
PDWORD pcReturned)
{
DWORD dwErrorCode, i;
+ PFORM_INFO_1W pfi1w = (PFORM_INFO_1W)pForm;
PFORM_INFO_2W pfi2w = (PFORM_INFO_2W)pForm;
TRACE("EnumFormsA(%p, %lu, %p, %lu, %p, %p)\n", hPrinter, Level, pForm,
cbBuf, pcbNeeded, pcReturned);
@@ -203,13 +204,18 @@ EnumFormsA(HANDLE hPrinter, DWORD Level, PBYTE pForm, DWORD cbBuf,
PDWORD pcbNee
{
goto Cleanup;
}
- // Fall through...
- case 1:
dwErrorCode = UnicodeToAnsiInPlace(pfi2w[i].pName);
if (dwErrorCode != ERROR_SUCCESS)
{
goto Cleanup;
}
+ break;
+ case 1:
+ dwErrorCode = UnicodeToAnsiInPlace(pfi1w[i].pName);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ goto Cleanup;
+ }
}
}
return TRUE;
@@ -269,7 +275,8 @@ GetFormA(HANDLE hPrinter, PSTR pFormName, DWORD Level, PBYTE pForm,
DWORD cbBuf,
{
DWORD dwErrorCode, len;
LPWSTR FormNameW = NULL;
- FORM_INFO_2W* pfi2w = (FORM_INFO_2W*)pForm;
+ PFORM_INFO_1W pfi1w = (PFORM_INFO_1W)pForm;
+ PFORM_INFO_2W pfi2w = (PFORM_INFO_2W)pForm;
TRACE("GetFormA(%p, %s, %lu, %p, %lu, %p)\n", hPrinter, pFormName, Level,
pForm, cbBuf, pcbNeeded);
@@ -300,20 +307,18 @@ GetFormA(HANDLE hPrinter, PSTR pFormName, DWORD Level, PBYTE pForm,
DWORD cbBuf,
{
goto Cleanup;
}
- // Fall through...
- case 1:
dwErrorCode = UnicodeToAnsiInPlace(pfi2w->pName);
if (dwErrorCode != ERROR_SUCCESS)
{
goto Cleanup;
}
break;
-
- default:
- ERR("Level = %d, unsupported!\n", Level);
- dwErrorCode = ERROR_INVALID_HANDLE;
- SetLastError(dwErrorCode);
- break;
+ case 1:
+ dwErrorCode = UnicodeToAnsiInPlace(pfi1w->pName);
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ goto Cleanup;
+ }
}
}
Cleanup:
diff --git a/win32ss/printing/base/winspool/jobs.c
b/win32ss/printing/base/winspool/jobs.c
index 7cc17d40470..69531438653 100644
--- a/win32ss/printing/base/winspool/jobs.c
+++ b/win32ss/printing/base/winspool/jobs.c
@@ -65,10 +65,12 @@ AddJobW(HANDLE hPrinter, DWORD Level, PBYTE pData, DWORD cbBuf, PDWORD
pcbNeeded
if (dwErrorCode == ERROR_SUCCESS)
{
+ JOB_INFO_1W* pji1w = (JOB_INFO_1W*)pData;
+
// Replace relative offset addresses in the output by absolute pointers.
MarshallUpStructure(cbBuf, pData, AddJobInfo1Marshalling.pInfo,
AddJobInfo1Marshalling.cbStructureSize, TRUE);
pHandle->bJob = TRUE;
- FIXME("Notify Tray Icon\n");
+ UpdateTrayIcon( hPrinter, pji1w->JobId );
}
Cleanup:
@@ -489,23 +491,23 @@ SetJobA(HANDLE hPrinter, DWORD JobId, DWORD Level, PBYTE pJobInfo,
DWORD Command
case 1:
{
JOB_INFO_1W *info1W = (JOB_INFO_1W*)JobW;
- HeapFree(GetProcessHeap(), 0, info1W->pUserName);
- HeapFree(GetProcessHeap(), 0, info1W->pDocument);
- HeapFree(GetProcessHeap(), 0, info1W->pDatatype);
- HeapFree(GetProcessHeap(), 0, info1W->pStatus);
+ if (info1W->pUserName) HeapFree(GetProcessHeap(), 0, info1W->pUserName);
+ if (info1W->pDocument) HeapFree(GetProcessHeap(), 0, info1W->pDocument);
+ if (info1W->pDatatype) HeapFree(GetProcessHeap(), 0, info1W->pDatatype);
+ if (info1W->pStatus) HeapFree(GetProcessHeap(), 0, info1W->pStatus);
break;
}
case 2:
{
JOB_INFO_2W *info2W = (JOB_INFO_2W*)JobW;
- HeapFree(GetProcessHeap(), 0, info2W->pUserName);
- HeapFree(GetProcessHeap(), 0, info2W->pDocument);
- HeapFree(GetProcessHeap(), 0, info2W->pNotifyName);
- HeapFree(GetProcessHeap(), 0, info2W->pDatatype);
- HeapFree(GetProcessHeap(), 0, info2W->pPrintProcessor);
- HeapFree(GetProcessHeap(), 0, info2W->pParameters);
- HeapFree(GetProcessHeap(), 0, info2W->pDevMode);
- HeapFree(GetProcessHeap(), 0, info2W->pStatus);
+ if (info2W->pUserName) HeapFree(GetProcessHeap(), 0, info2W->pUserName);
+ if (info2W->pDocument) HeapFree(GetProcessHeap(), 0, info2W->pDocument);
+ if (info2W->pNotifyName) HeapFree(GetProcessHeap(), 0,
info2W->pNotifyName);
+ if (info2W->pDatatype) HeapFree(GetProcessHeap(), 0, info2W->pDatatype);
+ if (info2W->pPrintProcessor) HeapFree(GetProcessHeap(), 0,
info2W->pPrintProcessor);
+ if (info2W->pParameters) HeapFree(GetProcessHeap(), 0,
info2W->pParameters);
+ if (info2W->pDevMode) HeapFree(GetProcessHeap(), 0, info2W->pDevMode);
+ if (info2W->pStatus) HeapFree(GetProcessHeap(), 0, info2W->pStatus);
break;
}
}
diff --git a/win32ss/printing/base/winspool/monitors.c
b/win32ss/printing/base/winspool/monitors.c
index 720d3537334..736575519fb 100644
--- a/win32ss/printing/base/winspool/monitors.c
+++ b/win32ss/printing/base/winspool/monitors.c
@@ -18,7 +18,7 @@ AddMonitorA(PSTR pName, DWORD Level, PBYTE pMonitors)
MONITOR_INFO_2W mi2w;
mi2a = (LPMONITOR_INFO_2A) pMonitors;
- TRACE("AddMonitorA(%s, %d, %p) : %s %s %s\n", debugstr_a(pName), Level,
pMonitors,
+ FIXME("AddMonitorA(%s, %d, %p) : %s %s %s\n", debugstr_a(pName), Level,
pMonitors,
debugstr_a(mi2a ? mi2a->pName : NULL),
debugstr_a(mi2a ? mi2a->pEnvironment : NULL),
debugstr_a(mi2a ? mi2a->pDLLName : NULL));
@@ -65,10 +65,10 @@ AddMonitorA(PSTR pName, DWORD Level, PBYTE pMonitors)
res = AddMonitorW(nameW, Level, (LPBYTE) &mi2w);
- HeapFree(GetProcessHeap(), 0, mi2w.pName);
- HeapFree(GetProcessHeap(), 0, mi2w.pEnvironment);
- HeapFree(GetProcessHeap(), 0, mi2w.pDLLName);
- HeapFree(GetProcessHeap(), 0, nameW);
+ if (mi2w.pName) HeapFree(GetProcessHeap(), 0, mi2w.pName);
+ if (mi2w.pEnvironment) HeapFree(GetProcessHeap(), 0, mi2w.pEnvironment);
+ if (mi2w.pDLLName) HeapFree(GetProcessHeap(), 0, mi2w.pDLLName);
+ if (nameW) HeapFree(GetProcessHeap(), 0, nameW);
return (res);
}
@@ -78,7 +78,8 @@ AddMonitorW(PWSTR pName, DWORD Level, PBYTE pMonitors)
{
DWORD dwErrorCode;
WINSPOOL_MONITOR_CONTAINER MonitorInfoContainer;
- TRACE("AddMonitorW(%S, %lu, %p)\n", pName, Level, pMonitors);
+
+ FIXME("AddMonitorW(%S, %lu, %p)\n", pName, Level, pMonitors);
if (Level != 2)
{
@@ -101,7 +102,7 @@ AddMonitorW(PWSTR pName, DWORD Level, PBYTE pMonitors)
ERR("_RpcAddMonitor failed with exception code %lu!\n", dwErrorCode);
}
RpcEndExcept;
-
+FIXME("AddMonitorW Error Code %lu\n", dwErrorCode);
SetLastError(dwErrorCode);
return (dwErrorCode == ERROR_SUCCESS);
}
@@ -136,9 +137,9 @@ DeleteMonitorA(PSTR pName, PSTR pEnvironment, PSTR pMonitorName)
res = DeleteMonitorW(nameW, EnvironmentW, MonitorNameW);
- HeapFree(GetProcessHeap(), 0, MonitorNameW);
- HeapFree(GetProcessHeap(), 0, EnvironmentW);
- HeapFree(GetProcessHeap(), 0, nameW);
+ if (MonitorNameW) HeapFree(GetProcessHeap(), 0, MonitorNameW);
+ if (EnvironmentW) HeapFree(GetProcessHeap(), 0, EnvironmentW);
+ if (nameW) HeapFree(GetProcessHeap(), 0, nameW);
return (res);
}
@@ -148,7 +149,7 @@ DeleteMonitorW(PWSTR pName, PWSTR pEnvironment, PWSTR pMonitorName)
{
DWORD dwErrorCode;
- TRACE("DeleteMonitorW(%S, %S, %S)\n", pName, pEnvironment, pMonitorName);
+ FIXME("DeleteMonitorW(%S, %S, %S)\n", pName, pEnvironment, pMonitorName);
// Do the RPC call
RpcTryExcept
@@ -296,8 +297,8 @@ emA_cleanup:
if (pcbNeeded) *pcbNeeded = needed;
if (pcReturned) *pcReturned = (res) ? numentries : 0;
- HeapFree(GetProcessHeap(), 0, nameW);
- HeapFree(GetProcessHeap(), 0, bufferW);
+ if (nameW) HeapFree(GetProcessHeap(), 0, nameW);
+ if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW);
FIXME("returning %d with %d (%d byte for %d entries)\n", (res),
GetLastError(), needed, numentries);
diff --git a/win32ss/printing/base/winspool/ports.c
b/win32ss/printing/base/winspool/ports.c
index 6444bf0a7f0..2dd27556a8a 100644
--- a/win32ss/printing/base/winspool/ports.c
+++ b/win32ss/printing/base/winspool/ports.c
@@ -8,27 +8,40 @@
#include "precomp.h"
#include <marshalling/ports.h>
+typedef struct _MONITORUIDATA
+{
+ HMODULE hLibrary;
+ HANDLE hActCtx;
+ ULONG_PTR ulpCookie;
+ PWSTR pModuleName;
+ BOOL Activeated;
+} MONITORUIDATA, *PMONITORUIDATA;
+
+typedef DWORD (*PPfpFunction)(LPWSTR, ULONG_PTR, LPWSTR);
+
typedef struct _PORTTHREADINFO
{
- LPWSTR pName;
- HWND hWnd;
- LPWSTR pPortName;
- FARPROC fpFunction;
- DWORD dwErrorCode;
- HANDLE hEvent;
+ LPWSTR pName;
+ ULONG_PTR hWnd;
+ LPWSTR pPortName;
+ PPfpFunction fpFunction;
+ DWORD dwErrorCode;
+ HANDLE hEvent;
} PORTTHREADINFO, *PPORTTHREADINFO;
VOID WINAPI
IntPortThread( PPORTTHREADINFO pPortThreadInfo )
{
+ FIXME("IPT : %s\n",debugstr_w( pPortThreadInfo->pPortName ));
// Do the RPC call
RpcTryExcept
{
- pPortThreadInfo->dwErrorCode = (*pPortThreadInfo->fpFunction)(
pPortThreadInfo->pName, pPortThreadInfo->hWnd, pPortThreadInfo->pPortName);
+ pPortThreadInfo->dwErrorCode = pPortThreadInfo->fpFunction(
pPortThreadInfo->pName, pPortThreadInfo->hWnd, pPortThreadInfo->pPortName );
}
RpcExcept(EXCEPTION_EXECUTE_HANDLER)
{
pPortThreadInfo->dwErrorCode = RpcExceptionCode();
+ ERR("IPT : _RpcXyzPort failed with exception code %lu!\n",
pPortThreadInfo->dwErrorCode);
}
RpcEndExcept;
@@ -39,7 +52,7 @@ IntPortThread( PPORTTHREADINFO pPortThreadInfo )
// Start a thread to wait on a printer port.
//
BOOL WINAPI
-StartPortThread( LPWSTR pName, HWND hWnd, LPWSTR pPortName, FARPROC fpFunction )
+StartPortThread( LPWSTR pName, HWND hWnd, LPWSTR pPortName, PPfpFunction fpFunction )
{
PORTTHREADINFO PortThreadInfo;
HANDLE htHandle;
@@ -49,7 +62,7 @@ StartPortThread( LPWSTR pName, HWND hWnd, LPWSTR pPortName, FARPROC
fpFunction )
if ( hWnd ) EnableWindow( hWnd, FALSE );
PortThreadInfo.pName = pName;
- PortThreadInfo.hWnd = hWnd;
+ PortThreadInfo.hWnd = (ULONG_PTR)hWnd;
PortThreadInfo.pPortName = pPortName;
PortThreadInfo.fpFunction = fpFunction;
PortThreadInfo.dwErrorCode = ERROR_SUCCESS;
@@ -86,6 +99,322 @@ StartPortThread( LPWSTR pName, HWND hWnd, LPWSTR pPortName, FARPROC
fpFunction )
return (PortThreadInfo.dwErrorCode == ERROR_SUCCESS);
}
+BOOL WINAPI
+GetMonitorUIFullName( PWSTR pDeviceName, PWSTR *pModuleName )
+{
+ STRSAFE_LPWSTR SysDir;
+ UINT length;
+ HRESULT hr;
+
+ *pModuleName = NULL;
+
+ SysDir = HeapAlloc(hProcessHeap, 0, MAX_PATH*sizeof(WCHAR));
+
+ if ( SysDir )
+ {
+ memset( SysDir, 0, MAX_PATH*sizeof(WCHAR) );
+
+ length = GetSystemDirectoryW( SysDir, MAX_PATH*sizeof(WCHAR) );
+
+ if ( length > 0 )
+ {
+ StringCbCatW(SysDir, MAX_PATH*sizeof(WCHAR), L"\\");
+
+ hr = StringCchCatW( SysDir, MAX_PATH*sizeof(WCHAR), pDeviceName );
+ if ( !FAILED(hr) )
+ {
+ *pModuleName = SysDir;
+ return TRUE;
+ }
+ SetLastError(HRESULT_CODE(hr));
+ }
+
+ HeapFree(hProcessHeap, 0, SysDir);
+ }
+ return FALSE;
+}
+
+BOOL WINAPI
+GetMonitorUIActivationContext( PWSTR pDeviceName, PMONITORUIDATA pmuid )
+{
+ // ACTCTXW actctx;
+ // HANDLE handle;
+ BOOL Ret = FALSE;
+
+ FIXME("GMUIAC : Module pDeviceName %S\n",pDeviceName);
+
+ if ( !GetMonitorUIFullName( pDeviceName, &pmuid->pModuleName ) )
+ {
+ ERR("GetMonitorUIFullName Failed\n");
+ return Ret;
+ }
+/* OMG! SxS again?
+ memset(&actctx, 0, sizeof(ACTCTXW));
+ actctx.cbSize = sizeof(ACTCTXW);
+ actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;
+ actctx.lpResourceName = MAKEINTRESOURCEW(123); This might be the reason....
+ actctx.lpSource = pmuid->pModuleName;
+
+ handle = CreateActCtxW(&actctx);
+
+ if ( handle != INVALID_HANDLE_VALUE )
+ {
+ pmuid->hActCtx = handle;
+ if ( ActivateActCtx( handle, &pmuid->ulpCookie ) )
+ {
+ pmuid->Activeated = TRUE;
+ Ret = TRUE;
+ }
+ else
+ {
+ pmuid->Activeated = FALSE;
+ }
+ }
+ else
+ {
+ ERR("GetMonitorUIActivationContext Failed
%S\n",pmuid->pModuleName);
+ }*/
+ pmuid->hActCtx = INVALID_HANDLE_VALUE;
+ Ret = TRUE;
+ return Ret;
+}
+
+VOID FASTCALL
+FreeMonitorUI( PMONITORUIDATA pmuid )
+{
+ if ( pmuid )
+ {
+ if ( pmuid->hLibrary )
+ {
+ FreeLibrary( pmuid->hLibrary );
+ }
+ if ( pmuid->Activeated )
+ {
+ DeactivateActCtx( 0, pmuid->ulpCookie );
+ }
+ if ( pmuid->hActCtx != INVALID_HANDLE_VALUE )
+ {
+ ReleaseActCtx( pmuid->hActCtx );
+ }
+ if ( pmuid->pModuleName )
+ {
+ DllFreeSplMem( pmuid->pModuleName );
+ }
+ DllFreeSplMem( pmuid );
+ }
+}
+
+BOOL FASTCALL
+StrNCatBuff( PWSTR ptr, size_t Size, PWSTR args, ...)
+{
+ va_list Args;
+ PWSTR pwstr;
+ HRESULT hr;
+ BOOL Ret = TRUE;
+
+ va_start(Args, args );
+
+ for ( pwstr = args ; pwstr ; pwstr = va_arg( Args, PWSTR ) )
+ {
+ hr = StringCchCatNW( ptr, Size, pwstr, wcslen(pwstr) );
+ if ( FAILED(hr) )
+ {
+ SetLastError(HRESULT_CODE(hr));
+ Ret = FALSE;
+ break;
+ }
+ }
+
+ va_end(Args);
+
+ return Ret;
+}
+
+PWSTR WINAPI
+ConstructXcvName( PWSTR pName, PWSTR pMonitorPortName, PWSTR pXcvName )
+{
+ BOOL Ret = FALSE;
+ PWSTR pwstr = NULL;
+ size_t sXcv, smpn = 0, Size = 0;
+
+ if ( pName )
+ {
+ Size = wcslen( pName ) + 1;
+ }
+
+ sXcv = wcslen( pXcvName ) + Size;
+
+ if ( pMonitorPortName )
+ {
+ smpn = wcslen( pMonitorPortName );
+ }
+
+ Size = sXcv + smpn + 3;
+
+ pwstr = DllAllocSplMem( Size * sizeof(WCHAR) );
+
+ memset( pwstr, 0, Size );
+
+ if ( pwstr )
+ {
+ // The caller wants an Xcv handle and provided a string like:
+ // ", XcvMonitor Local Port"
+ // "\\COMPUTERNAME\, XcvMonitor Local Port"
+ // ", XcvPort LPT1:"
+ // "\\COMPUTERNAME\, XcvPort LPT1:"
+ //
+ // This produces; !pName ",XcvMonitor " or pName
"\\COMPUTERNAME\XcvMonitor "
+ //
+ Ret = StrNCatBuff( pwstr,
+ Size,
+ pName ? pName : L"",
+ pName ? L"\\" : L",",
+ pXcvName,
+ L" ",
+ pMonitorPortName ? pMonitorPortName : L"",
+ NULL );
+ }
+
+ if ( !Ret )
+ {
+ DllFreeSplMem( pwstr );
+ pwstr = NULL;
+ }
+
+ return pwstr;
+}
+
+DWORD WINAPI
+GetMonitorUI( PWSTR pName, PWSTR pMonitorPortName, PWSTR pXcvName, PMONITORUI *pmui,
PMONITORUIDATA *ppmuid )
+{
+ DWORD dwErrorCode = ERROR_SUCCESS, cbOutputNeeded, dwStatus;
+ HANDLE hPrinter = NULL;
+ HMODULE hModule;
+ PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
+ PWSTR pDevice = NULL, pOutputString = NULL;
+ PMONITORUIDATA pmuid = NULL;
+ PRINTER_DEFAULTSW wDefault = { 0, 0, PRINTER_ATTRIBUTE_QUEUED };
+ BYTE OutputData[1024], InputData[4];
+
+ *pmui = NULL;
+ *ppmuid = NULL;
+
+ pDevice = ConstructXcvName( pName, pMonitorPortName, pXcvName );
+
+ if ( !pDevice )
+ {
+ return GetLastError();
+ }
+
+ FIXME("GMUI : XcvName : %S\n",pDevice);
+
+ if ( OpenPrinterW( (LPWSTR)pDevice, &hPrinter, &wDefault ) )
+ {
+ pHandle = (PSPOOLER_HANDLE)hPrinter;
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcXcvData( pHandle->hPrinter,
+ L"MonitorUI",
+ (PBYTE)&InputData,
+ 0,
+ (PBYTE)&OutputData,
+ 1024,
+ &cbOutputNeeded,
+ &dwStatus );
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ dwErrorCode = RpcExceptionCode();
+ ERR("GMUI : _RpcXcvData failed with exception code %lu!\n",
dwErrorCode);
+ }
+ RpcEndExcept;
+
+ if ( dwErrorCode == ERROR_INSUFFICIENT_BUFFER )
+ {
+ pOutputString = DllAllocSplMem( cbOutputNeeded );
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcXcvData( pHandle->hPrinter,
+ L"MonitorUI",
+ (PBYTE)&InputData,
+ 0,
+ (PBYTE)pOutputString,
+ cbOutputNeeded,
+ &cbOutputNeeded,
+ &dwStatus );
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ dwErrorCode = RpcExceptionCode();
+ ERR("GMUI : _RpcXcvData failed with exception code %lu!\n",
dwErrorCode);
+ }
+ RpcEndExcept;
+ }
+
+ if ( dwErrorCode != ERROR_SUCCESS || dwStatus != ERROR_SUCCESS )
+ {
+ goto Cleanup;
+ }
+
+ pmuid = DllAllocSplMem( sizeof(MONITORUIDATA) );
+ if ( pmuid )
+ {
+ memset( pmuid, 0, sizeof(MONITORUIDATA) );
+ pmuid->hActCtx = INVALID_HANDLE_VALUE;
+ }
+ else
+ {
+ ERR("GMUI : Memory error\n");
+ dwErrorCode = GetLastError();
+ goto Cleanup;
+ }
+
+ if ( GetMonitorUIActivationContext( pOutputString ? pOutputString :
(PWSTR)&OutputData, pmuid ) )
+ {
+ FIXME("GMUI : MonitorUI Path : %S\n",pmuid->pModuleName);
+
+ hModule = LoadLibraryW( pmuid->pModuleName );
+ if ( hModule )
+ {
+ FARPROC fpInitializePrintMonitorUI = (PVOID) GetProcAddress( hModule,
"InitializePrintMonitorUI" );
+ if ( fpInitializePrintMonitorUI )
+ {
+ pmuid->hLibrary = hModule;
+ *pmui = (PMONITORUI)(*fpInitializePrintMonitorUI)();
+ *ppmuid = pmuid;
+ }
+ else
+ {
+ ERR("GMUI : Failed to get MUI %S\n",pmuid->pModuleName);
+ FreeMonitorUI( pmuid );
+ }
+ }
+ else
+ {
+ ERR("GMUI : Failed to load library
%S\n",pmuid->pModuleName);
+ }
+ }
+ }
+ else
+ {
+ ERR("GMUI : Failed to open printer handle\n");
+ }
+
+ dwErrorCode = GetLastError();
+
+Cleanup:
+ if ( hPrinter ) ClosePrinter( hPrinter );
+ if ( pOutputString ) DllFreeSplMem( pOutputString );
+ if ( pDevice ) DllFreeSplMem( pDevice );
+
+ FIXME("GMUI : Error Code Exit %d\n",dwErrorCode);
+
+ return dwErrorCode;
+}
BOOL WINAPI
AddPortA(PSTR pName, HWND hWnd, PSTR pMonitorName)
@@ -113,8 +442,8 @@ AddPortA(PSTR pName, HWND hWnd, PSTR pMonitorName)
res = AddPortW(nameW, hWnd, monitorW);
- HeapFree(GetProcessHeap(), 0, nameW);
- HeapFree(GetProcessHeap(), 0, monitorW);
+ if (nameW) HeapFree(GetProcessHeap(), 0, nameW);
+ if (monitorW) HeapFree(GetProcessHeap(), 0, monitorW);
return res;
}
@@ -127,12 +456,12 @@ AddPortExW(PWSTR pName, DWORD Level, PBYTE lpBuffer, PWSTR
lpMonitorName)
WINSPOOL_PORT_VAR_CONTAINER PortVarContainer;
WINSPOOL_PORT_INFO_FF *pPortInfoFF;
- TRACE("AddPortExW(%S, %lu, %p, %S)\n", pName, Level, lpBuffer,
lpMonitorName);
+ FIXME("AddPortExW(%S, %lu, %p, %S)\n", pName, Level, lpBuffer,
lpMonitorName);
switch (Level)
{
case 1:
- // FIXME!!!! Only Level 1 is supported? See note in wine winspool test info.c
: line 575.
+ // FIXME!!!! Only Level 1 is supported? See note in wine winspool test info.c
: line 575. It's just not supported here.
PortInfoContainer.PortInfo.pPortInfo1 = (WINSPOOL_PORT_INFO_1*)lpBuffer;
PortInfoContainer.Level = Level;
PortVarContainer.cbMonitorData = 0;
@@ -182,7 +511,7 @@ AddPortExA(PSTR pName, DWORD Level, PBYTE lpBuffer, PSTR
lpMonitorName)
pi1A = (PORT_INFO_1A *)lpBuffer;
pPortInfoFF = (WINSPOOL_PORT_INFO_FF*)lpBuffer;
- TRACE("AddPortExA(%s, %d, %p, %s): %s\n", debugstr_a(pName), Level,
lpBuffer, debugstr_a(lpMonitorName), debugstr_a(pi1A ? pi1A->pName : NULL));
+ FIXME("AddPortExA(%s, %d, %p, %s): %s\n", debugstr_a(pName), Level,
lpBuffer, debugstr_a(lpMonitorName), debugstr_a(pi1A ? pi1A->pName : NULL));
if ( !lpBuffer || !lpMonitorName )
{
@@ -256,8 +585,44 @@ Cleanup:
BOOL WINAPI
AddPortW(PWSTR pName, HWND hWnd, PWSTR pMonitorName)
{
- TRACE("AddPortW(%S, %p, %S)\n", pName, hWnd, pMonitorName);
- return StartPortThread(pName, hWnd, pMonitorName, (FARPROC)_RpcAddPort);
+ DWORD SessionId, dwErrorCode = 0;
+ PMONITORUIDATA pmuid;
+ PMONITORUI pmui = NULL;
+ BOOL Ret = FALSE;
+
+ FIXME("AddPortW(%S, %p, %S)\n", pName, hWnd, pMonitorName);
+
+ dwErrorCode = GetMonitorUI( pName, pMonitorName, L"XcvMonitor", &pmui,
&pmuid );
+ FIXME("AddPortW Error %d\n",dwErrorCode);
+ if (dwErrorCode != ERROR_SUCCESS )
+ {
+ if ( dwErrorCode == ERROR_NOT_SUPPORTED ||
+ dwErrorCode == ERROR_MOD_NOT_FOUND ||
+ dwErrorCode == ERROR_INVALID_PRINT_MONITOR ||
+ dwErrorCode == ERROR_UNKNOWN_PORT ||
+ dwErrorCode == ERROR_INVALID_PRINTER_NAME )
+ {
+ if ( ProcessIdToSessionId( GetCurrentProcessId(), &SessionId ) &&
SessionId ) // Looking if this is remote.
+ {
+ dwErrorCode = ERROR_NOT_SUPPORTED;
+ }
+ else
+ {
+ Ret = StartPortThread( pName, hWnd, pMonitorName,
(PPfpFunction)_RpcAddPort );
+ FIXME("AddPortW return StartPortThread\n");
+ dwErrorCode = GetLastError();
+ }
+ }
+ }
+ else
+ {
+ Ret = (*pmui->pfnAddPortUI)( pName, hWnd, pMonitorName, NULL );
+ }
+
+ SetLastError(dwErrorCode);
+ FreeMonitorUI( pmuid );
+
+ return Ret;
}
BOOL WINAPI
@@ -288,8 +653,8 @@ ConfigurePortA(PSTR pName, HWND hWnd, PSTR pPortName)
res = ConfigurePortW(nameW, hWnd, portW);
- HeapFree(GetProcessHeap(), 0, nameW);
- HeapFree(GetProcessHeap(), 0, portW);
+ if (nameW) HeapFree(GetProcessHeap(), 0, nameW);
+ if (portW) HeapFree(GetProcessHeap(), 0, portW);
return res;
}
@@ -297,8 +662,43 @@ ConfigurePortA(PSTR pName, HWND hWnd, PSTR pPortName)
BOOL WINAPI
ConfigurePortW(PWSTR pName, HWND hWnd, PWSTR pPortName)
{
- TRACE("ConfigurePortW(%S, %p, %S)\n", pName, hWnd, pPortName);
- return StartPortThread(pName, hWnd, pPortName, (FARPROC)_RpcConfigurePort);
+ DWORD SessionId, dwErrorCode = 0;
+ PMONITORUIDATA pmuid;
+ PMONITORUI pmui = NULL;
+ BOOL Ret = FALSE;
+
+ FIXME("ConfigurePortW(%S, %p, %S)\n", pName, hWnd, pPortName);
+
+ dwErrorCode = GetMonitorUI( pName, pPortName, L"XcvPort", &pmui,
&pmuid );
+
+ if (dwErrorCode != ERROR_SUCCESS )
+ {
+ if ( dwErrorCode == ERROR_NOT_SUPPORTED ||
+ dwErrorCode == ERROR_MOD_NOT_FOUND ||
+ dwErrorCode == ERROR_INVALID_PRINT_MONITOR ||
+ dwErrorCode == ERROR_UNKNOWN_PORT ||
+ dwErrorCode == ERROR_INVALID_PRINTER_NAME )
+ {
+ if ( ProcessIdToSessionId( GetCurrentProcessId(), &SessionId ) &&
SessionId ) // Looking if this is remote.
+ {
+ dwErrorCode = ERROR_NOT_SUPPORTED;
+ }
+ else
+ {
+ Ret = StartPortThread(pName, hWnd, pPortName,
(PPfpFunction)_RpcConfigurePort );
+ dwErrorCode = GetLastError();
+ }
+ }
+ }
+ else
+ {
+ Ret = (*pmui->pfnConfigurePortUI)( pName, hWnd, pPortName );
+ }
+
+ SetLastError(dwErrorCode);
+ FreeMonitorUI( pmuid );
+
+ return Ret;
}
BOOL WINAPI
@@ -309,7 +709,7 @@ DeletePortA(PSTR pName, HWND hWnd, PSTR pPortName)
INT len;
DWORD res;
- TRACE("DeletePortA(%s, %p, %s)\n", debugstr_a(pName), hWnd,
debugstr_a(pPortName));
+ FIXME("DeletePortA(%s, %p, %s)\n", debugstr_a(pName), hWnd,
debugstr_a(pPortName));
/* convert servername to unicode */
if (pName)
@@ -329,8 +729,8 @@ DeletePortA(PSTR pName, HWND hWnd, PSTR pPortName)
res = DeletePortW(nameW, hWnd, portW);
- HeapFree(GetProcessHeap(), 0, nameW);
- HeapFree(GetProcessHeap(), 0, portW);
+ if (nameW) HeapFree(GetProcessHeap(), 0, nameW);
+ if (portW) HeapFree(GetProcessHeap(), 0, portW);
return res;
}
@@ -338,8 +738,36 @@ DeletePortA(PSTR pName, HWND hWnd, PSTR pPortName)
BOOL WINAPI
DeletePortW(PWSTR pName, HWND hWnd, PWSTR pPortName)
{
- TRACE("DeletePortW(%S, %p, %S)\n", pName, hWnd, pPortName);
- return StartPortThread(pName, hWnd, pPortName, (FARPROC)_RpcDeletePort);
+ DWORD dwErrorCode = 0;
+ PMONITORUIDATA pmuid;
+ PMONITORUI pmui = NULL;
+ BOOL Ret = FALSE;
+
+ FIXME("DeletePortW(%S, %p, %S)\n", pName, hWnd, pPortName);
+
+ dwErrorCode = GetMonitorUI( pName, pPortName, L"XcvPort", &pmui,
&pmuid );
+ FIXME("DeletePortW Error %d\n",dwErrorCode);
+ if (dwErrorCode != ERROR_SUCCESS )
+ {
+ if ( dwErrorCode == ERROR_NOT_SUPPORTED ||
+ dwErrorCode == ERROR_MOD_NOT_FOUND ||
+ dwErrorCode == ERROR_INVALID_PRINT_MONITOR ||
+ dwErrorCode == ERROR_UNKNOWN_PORT ||
+ dwErrorCode == ERROR_INVALID_PRINTER_NAME )
+ {
+ Ret = StartPortThread(pName, hWnd, pPortName, (PPfpFunction)_RpcDeletePort
);
+ dwErrorCode = GetLastError();
+ }
+ }
+ else
+ {
+ Ret = (*pmui->pfnDeletePortUI)( pName, hWnd, pPortName );
+ }
+
+ SetLastError(dwErrorCode);
+ FreeMonitorUI( pmuid );
+
+ return Ret;
}
BOOL WINAPI
@@ -354,6 +782,13 @@ EnumPortsA(PSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf, PDWORD
pcbNeeded,
TRACE("EnumPortsA(%s, %d, %p, %d, %p, %p)\n", debugstr_a(pName), Level,
pPorts, cbBuf, pcbNeeded, pcReturned);
+ if ((Level < 1) || (Level > 2))
+ {
+ ERR("Level = %d, unsupported!\n", Level);
+ SetLastError(ERROR_INVALID_LEVEL);
+ return FALSE;
+ }
+
/* convert servername to unicode */
if (pName)
{
@@ -470,8 +905,8 @@ cleanup:
if (pcbNeeded) *pcbNeeded = needed;
if (pcReturned) *pcReturned = (res) ? numentries : 0;
- HeapFree(GetProcessHeap(), 0, nameW);
- HeapFree(GetProcessHeap(), 0, bufferW);
+ if (nameW) HeapFree(GetProcessHeap(), 0, nameW);
+ if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW);
TRACE("returning %d with %d (%d byte for %d of %d entries)\n",
(res), GetLastError(), needed, (res)? numentries : 0, numentries);
@@ -486,6 +921,13 @@ EnumPortsW(PWSTR pName, DWORD Level, PBYTE pPorts, DWORD cbBuf,
PDWORD pcbNeeded
TRACE("EnumPortsW(%S, %lu, %p, %lu, %p, %p)\n", pName, Level, pPorts,
cbBuf, pcbNeeded, pcReturned);
+ if ((Level < 1) || (Level > 2))
+ {
+ ERR("Level = %d, unsupported!\n", Level);
+ SetLastError(ERROR_INVALID_LEVEL);
+ return FALSE;
+ }
+
// Do the RPC call
RpcTryExcept
{
diff --git a/win32ss/printing/base/winspool/precomp.h
b/win32ss/printing/base/winspool/precomp.h
index 267f07351c9..ec67b79bb30 100644
--- a/win32ss/printing/base/winspool/precomp.h
+++ b/win32ss/printing/base/winspool/precomp.h
@@ -62,9 +62,10 @@ extern CRITICAL_SECTION rtlCritSec;
// utils.c
DWORD UnicodeToAnsiInPlace(PWSTR pwszField);
DWORD UnicodeToAnsiZZInPlace(PWSTR pwszzField);
-SECURITY_DESCRIPTOR * get_sd( SECURITY_DESCRIPTOR *sd, DWORD *size );
+SECURITY_DESCRIPTOR * get_sd(SECURITY_DESCRIPTOR *sd, DWORD *size);
LONG WINAPI IntProtectHandle(HANDLE,BOOL);
BOOL WINAPI IntUnprotectHandle(HANDLE);
+VOID UpdateTrayIcon(HANDLE hPrinter, DWORD JobId);
// devmode.c
extern void RosConvertAnsiDevModeToUnicodeDevmode(PDEVMODEA pDevModeInput, PDEVMODEW
*pDevModeOutput);
diff --git a/win32ss/printing/base/winspool/printerdata.c
b/win32ss/printing/base/winspool/printerdata.c
index 7e574e95d9e..d49733d0438 100644
--- a/win32ss/printing/base/winspool/printerdata.c
+++ b/win32ss/printing/base/winspool/printerdata.c
@@ -57,7 +57,7 @@ DeletePrinterDataA(HANDLE hPrinter, PSTR pValueName)
res = DeletePrinterDataW( hPrinter, valuenameW );
- HeapFree(GetProcessHeap(), 0, valuenameW);
+ if (valuenameW) HeapFree(GetProcessHeap(), 0, valuenameW);
return res;
@@ -89,8 +89,8 @@ DeletePrinterDataExA(HANDLE hPrinter, PCSTR pKeyName, PCSTR pValueName)
res = DeletePrinterDataExW( hPrinter, keynameW, valuenameW );
- HeapFree(GetProcessHeap(), 0, keynameW);
- HeapFree(GetProcessHeap(), 0, valuenameW);
+ if (keynameW) HeapFree(GetProcessHeap(), 0, keynameW);
+ if (valuenameW) HeapFree(GetProcessHeap(), 0, valuenameW);
return res;
}
@@ -129,7 +129,7 @@ DeletePrinterKeyA(HANDLE hPrinter, PCSTR pKeyName)
res = DeletePrinterKeyW( hPrinter, keynameW );
- HeapFree(GetProcessHeap(), 0, keynameW);
+ if (keynameW) HeapFree(GetProcessHeap(), 0, keynameW);
return res;
}
@@ -219,18 +219,17 @@ EnumPrinterDataExA(HANDLE hPrinter, PCSTR pKeyName, PBYTE
pEnumValues, DWORD cbE
dwBufSize = 0;
for (dwIndex = 0; dwIndex < *pnEnumValues; ++dwIndex)
{
- PPRINTER_ENUM_VALUESW ppev =
- &((PPRINTER_ENUM_VALUESW) pEnumValues)[dwIndex];
+ PPRINTER_ENUM_VALUESW ppev = &((PPRINTER_ENUM_VALUESW) pEnumValues)[dwIndex];
if (dwBufSize < ppev->cbValueName)
dwBufSize = ppev->cbValueName;
- if (dwBufSize < ppev->cbData && (ppev->dwType == REG_SZ ||
- ppev->dwType == REG_EXPAND_SZ || ppev->dwType == REG_MULTI_SZ))
+ if ( dwBufSize < ppev->cbData &&
+ (ppev->dwType == REG_SZ || ppev->dwType == REG_EXPAND_SZ || ppev->dwType ==
REG_MULTI_SZ))
dwBufSize = ppev->cbData;
}
- TRACE ("Largest Unicode name or value is %i bytes\n", dwBufSize);
+ FIXME ("Largest Unicode name or value is %i bytes\n", dwBufSize);
pBuffer = HeapAlloc (hHeap, 0, dwBufSize);
if (pBuffer == NULL)
diff --git a/win32ss/printing/base/winspool/printerdrivers.c
b/win32ss/printing/base/winspool/printerdrivers.c
index a30b611820c..75031176c06 100644
--- a/win32ss/printing/base/winspool/printerdrivers.c
+++ b/win32ss/printing/base/winspool/printerdrivers.c
@@ -7,6 +7,7 @@
#include "precomp.h"
#include <marshalling/printerdrivers.h>
+
extern const WCHAR wszCurrentEnvironment[];
static int multi_sz_lenA(const char *str)
@@ -231,26 +232,26 @@ AddPrinterDriverExA(PSTR pName, DWORD Level, PBYTE pDriverInfo,
DWORD dwFileCopy
res = AddPrinterDriverExW(nameW, Level, (LPBYTE) &diW, dwFileCopyFlags);
TRACE("got %u with %u\n", res, GetLastError());
- HeapFree(GetProcessHeap(), 0, nameW);
- HeapFree(GetProcessHeap(), 0, diW.pName);
- HeapFree(GetProcessHeap(), 0, diW.pEnvironment);
- HeapFree(GetProcessHeap(), 0, diW.pDriverPath);
- HeapFree(GetProcessHeap(), 0, diW.pDataFile);
- HeapFree(GetProcessHeap(), 0, diW.pConfigFile);
- HeapFree(GetProcessHeap(), 0, diW.pHelpFile);
- HeapFree(GetProcessHeap(), 0, diW.pDependentFiles);
- HeapFree(GetProcessHeap(), 0, diW.pMonitorName);
- HeapFree(GetProcessHeap(), 0, diW.pDefaultDataType);
- HeapFree(GetProcessHeap(), 0, diW.pszzPreviousNames);
- HeapFree(GetProcessHeap(), 0, diW.pszMfgName);
- HeapFree(GetProcessHeap(), 0, diW.pszOEMUrl);
- HeapFree(GetProcessHeap(), 0, diW.pszHardwareID);
- HeapFree(GetProcessHeap(), 0, diW.pszProvider);
- HeapFree(GetProcessHeap(), 0, diW.pszPrintProcessor);
- HeapFree(GetProcessHeap(), 0, diW.pszVendorSetup);
- HeapFree(GetProcessHeap(), 0, diW.pszzColorProfiles);
- HeapFree(GetProcessHeap(), 0, diW.pszInfPath);
- HeapFree(GetProcessHeap(), 0, diW.pszzCoreDriverDependencies);
+ if (nameW) HeapFree(GetProcessHeap(), 0, nameW);
+ if (diW.pName) HeapFree(GetProcessHeap(), 0, diW.pName);
+ if (diW.pEnvironment) HeapFree(GetProcessHeap(), 0, diW.pEnvironment);
+ if (diW.pDriverPath) HeapFree(GetProcessHeap(), 0, diW.pDriverPath);
+ if (diW.pDataFile) HeapFree(GetProcessHeap(), 0, diW.pDataFile);
+ if (diW.pConfigFile) HeapFree(GetProcessHeap(), 0, diW.pConfigFile);
+ if (diW.pHelpFile) HeapFree(GetProcessHeap(), 0, diW.pHelpFile);
+ if (diW.pDependentFiles) HeapFree(GetProcessHeap(), 0, diW.pDependentFiles);
+ if (diW.pMonitorName) HeapFree(GetProcessHeap(), 0, diW.pMonitorName);
+ if (diW.pDefaultDataType) HeapFree(GetProcessHeap(), 0, diW.pDefaultDataType);
+ if (diW.pszzPreviousNames) HeapFree(GetProcessHeap(), 0, diW.pszzPreviousNames);
+ if (diW.pszMfgName) HeapFree(GetProcessHeap(), 0, diW.pszMfgName);
+ if (diW.pszOEMUrl) HeapFree(GetProcessHeap(), 0, diW.pszOEMUrl);
+ if (diW.pszHardwareID) HeapFree(GetProcessHeap(), 0, diW.pszHardwareID);
+ if (diW.pszProvider) HeapFree(GetProcessHeap(), 0, diW.pszProvider);
+ if (diW.pszPrintProcessor) HeapFree(GetProcessHeap(), 0, diW.pszPrintProcessor);
+ if (diW.pszVendorSetup) HeapFree(GetProcessHeap(), 0, diW.pszVendorSetup);
+ if (diW.pszzColorProfiles) HeapFree(GetProcessHeap(), 0, diW.pszzColorProfiles);
+ if (diW.pszInfPath) HeapFree(GetProcessHeap(), 0, diW.pszInfPath);
+ if (diW.pszzCoreDriverDependencies) HeapFree(GetProcessHeap(), 0,
diW.pszzCoreDriverDependencies);
TRACE("=> %u with %u\n", res, GetLastError());
return res;
@@ -259,7 +260,7 @@ AddPrinterDriverExA(PSTR pName, DWORD Level, PBYTE pDriverInfo, DWORD
dwFileCopy
BOOL WINAPI
AddPrinterDriverExW(PWSTR pName, DWORD Level, PBYTE pDriverInfo, DWORD dwFileCopyFlags)
{
- DWORD dwErrorCode;
+ DWORD dwErrorCode = ERROR_SUCCESS;
WINSPOOL_DRIVER_INFO_8 * pdi = NULL;
WINSPOOL_DRIVER_CONTAINER pDriverContainer;
@@ -310,7 +311,6 @@ AddPrinterDriverExW(PWSTR pName, DWORD Level, PBYTE pDriverInfo, DWORD
dwFileCop
}
case 4:
{
-
PDRIVER_INFO_4W pdi4w = (PDRIVER_INFO_4W)pDriverInfo;
if ( pdi == NULL ) pdi = HeapAlloc(hProcessHeap, 0,
sizeof(WINSPOOL_DRIVER_INFO_4));
@@ -398,6 +398,7 @@ DeletePrinterDriverA(PSTR pName, PSTR pEnvironment, PSTR pDriverName)
BOOL WINAPI
DeletePrinterDriverExA(PSTR pName, PSTR pEnvironment, PSTR pDriverName, DWORD
dwDeleteFlag, DWORD dwVersionFlag)
{
+ DWORD dwErrorCode;
UNICODE_STRING NameW, EnvW, DriverW;
BOOL ret;
@@ -409,10 +410,13 @@ DeletePrinterDriverExA(PSTR pName, PSTR pEnvironment, PSTR
pDriverName, DWORD dw
ret = DeletePrinterDriverExW(NameW.Buffer, EnvW.Buffer, DriverW.Buffer, dwDeleteFlag,
dwVersionFlag);
+ dwErrorCode = GetLastError();
+
RtlFreeUnicodeString(&DriverW);
RtlFreeUnicodeString(&EnvW);
RtlFreeUnicodeString(&NameW);
+ SetLastError(dwErrorCode);
return ret;
}
@@ -461,20 +465,22 @@ DeletePrinterDriverW(PWSTR pName, PWSTR pEnvironment, PWSTR
pDriverName)
BOOL WINAPI
EnumPrinterDriversA(PSTR pName, PSTR pEnvironment, DWORD Level, PBYTE pDriverInfo, DWORD
cbBuf, PDWORD pcbNeeded, PDWORD pcReturned)
{
- BOOL ret;
+ BOOL ret = FALSE;
DWORD dwErrorCode, i;
UNICODE_STRING pNameW, pEnvironmentW;
PWSTR pwstrNameW, pwstrEnvironmentW;
PDRIVER_INFO_1W pdi1w = (PDRIVER_INFO_1W)pDriverInfo;
PDRIVER_INFO_8W pdi8w = (PDRIVER_INFO_8W)pDriverInfo;
- TRACE("EnumPrinterDriversA(%s, %s, %lu, %p, %lu, %p, %p)\n", pName,
pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded, pcReturned);
+ FIXME("EnumPrinterDriversA(%s, %s, %lu, %p, %lu, %p, %p)\n", pName,
pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded, pcReturned);
pwstrNameW = AsciiToUnicode(&pNameW, pName);
pwstrEnvironmentW = AsciiToUnicode(&pEnvironmentW, pEnvironment);
ret = EnumPrinterDriversW( pwstrNameW, pwstrEnvironmentW, Level, pDriverInfo, cbBuf,
pcbNeeded, pcReturned );
+ dwErrorCode = GetLastError();
+
if (ret)
{
for ( i = 0; i < *pcReturned; i++ )
@@ -613,11 +619,13 @@ EnumPrinterDriversA(PSTR pName, PSTR pEnvironment, DWORD Level,
PBYTE pDriverInf
}
}
}
+ dwErrorCode = ERROR_SUCCESS;
}
Cleanup:
RtlFreeUnicodeString(&pNameW);
RtlFreeUnicodeString(&pEnvironmentW);
-
+ SetLastError(dwErrorCode);
+ FIXME("EnumPrinterDriversA Exit %d Err %d\n",ret,GetLastError());
return ret;
}
@@ -626,10 +634,10 @@ EnumPrinterDriversW(PWSTR pName, PWSTR pEnvironment, DWORD Level,
PBYTE pDriverI
{
DWORD dwErrorCode;
- TRACE("EnumPrinterDriversW(%S, %S, %lu, %p, %lu, %p, %p)\n", pName,
pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded, pcReturned);
+ FIXME("EnumPrinterDriversW(%S, %S, %lu, %p, %lu, %p, %p)\n", pName,
pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded, pcReturned);
// Dismiss invalid levels already at this point.
- if (Level > 8 || Level == 7 || Level < 1)
+ if (Level < 1 || Level == 7 || Level > 8)
{
dwErrorCode = ERROR_INVALID_LEVEL;
goto Cleanup;
@@ -663,7 +671,7 @@ EnumPrinterDriversW(PWSTR pName, PWSTR pEnvironment, DWORD Level,
PBYTE pDriverI
}
Cleanup:
- SetLastError(dwErrorCode);
+ SetLastError(dwErrorCode); FIXME("EnumPrinterDriversW Exit Err
%d\n",dwErrorCode);
return (dwErrorCode == ERROR_SUCCESS);
}
@@ -688,7 +696,7 @@ GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level,
LPBYTE pDriv
if (Level < 1 || Level == 7 || Level > 8)
{
dwErrorCode = ERROR_INVALID_LEVEL;
- ERR("Invalid Level!\n");
+ ERR("Invalid Level! %d\n",Level);
goto Cleanup;
}
@@ -817,13 +825,13 @@ GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level,
LPBYTE pDriv
case 2:
case 5:
{
- dwErrorCode = UnicodeToAnsiInPlace(pdi8w->pName);
+ dwErrorCode = UnicodeToAnsiInPlace(pdi8w->pConfigFile);
if (dwErrorCode != ERROR_SUCCESS)
{
goto Cleanup;
}
+ dwErrorCode = UnicodeToAnsiInPlace(pdi8w->pDataFile);
- dwErrorCode = UnicodeToAnsiInPlace(pdi8w->pEnvironment);
if (dwErrorCode != ERROR_SUCCESS)
{
goto Cleanup;
@@ -835,13 +843,13 @@ GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, DWORD Level,
LPBYTE pDriv
goto Cleanup;
}
- dwErrorCode = UnicodeToAnsiInPlace(pdi8w->pDataFile);
+ dwErrorCode = UnicodeToAnsiInPlace(pdi8w->pEnvironment);
if (dwErrorCode != ERROR_SUCCESS)
{
goto Cleanup;
}
- dwErrorCode = UnicodeToAnsiInPlace(pdi8w->pConfigFile);
+ dwErrorCode = UnicodeToAnsiInPlace(pdi8w->pName);
if (dwErrorCode != ERROR_SUCCESS)
{
goto Cleanup;
@@ -977,6 +985,12 @@ GetPrinterDriverDirectoryW(PWSTR pName, PWSTR pEnvironment, DWORD
Level, PBYTE p
TRACE("GetPrinterDriverDirectoryW(%S, %S, %lu, %p, %lu, %p)\n", pName,
pEnvironment, Level, pDriverDirectory, cbBuf, pcbNeeded);
+ if (Level != 1)
+ {
+ dwErrorCode = ERROR_INVALID_LEVEL;
+ goto Cleanup;
+ }
+
if ( !pEnvironment || !*pEnvironment )
{
pEnvironment = (PWSTR)wszCurrentEnvironment;
@@ -994,6 +1008,7 @@ GetPrinterDriverDirectoryW(PWSTR pName, PWSTR pEnvironment, DWORD
Level, PBYTE p
}
RpcEndExcept;
+Cleanup:
SetLastError(dwErrorCode);
return (dwErrorCode == ERROR_SUCCESS);
}
diff --git a/win32ss/printing/base/winspool/printers.c
b/win32ss/printing/base/winspool/printers.c
index f88948f2efa..1c39d7ae009 100644
--- a/win32ss/printing/base/winspool/printers.c
+++ b/win32ss/printing/base/winspool/printers.c
@@ -509,7 +509,7 @@ LoadPrinterDriver( HANDLE hspool )
hLibrary = LoadLibrary(pdi->pConfigFile);
- FIXME("IGPD : Get Printer Driver %S\n",pdi->pConfigFile);
+ FIXME("IGPD : Get Printer Driver Config File :
%S\n",pdi->pConfigFile);
RtlFreeHeap( GetProcessHeap(), 0, pdi);
return hLibrary;
@@ -657,7 +657,7 @@ DevQueryPrintEx( PDEVQUERYPRINT_INFO pDQPInfo )
INT WINAPI
DocumentEvent( HANDLE hPrinter, HDC hdc, int iEsc, ULONG cbIn, PVOID pvIn, ULONG cbOut,
PVOID pvOut)
{
- TRACE("DocumentEvent(%p, %p, %lu, %lu, %p, %lu, %p)\n", hPrinter, hdc,
iEsc, cbIn, pvIn, cbOut, pvOut);
+ FIXME("DocumentEvent(%p, %p, %lu, %lu, %p, %lu, %p)\n", hPrinter, hdc,
iEsc, cbIn, pvIn, cbOut, pvOut);
UNIMPLEMENTED;
return DOCUMENTEVENT_UNSUPPORTED;
}
@@ -2938,6 +2938,38 @@ ResetPrinterW(HANDLE hPrinter, PPRINTER_DEFAULTSW pDefault)
return FALSE;
}
+BOOL WINAPI
+SeekPrinter( HANDLE hPrinter, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER
pliNewPointer, DWORD dwMoveMethod, BOOL bWrite )
+{
+ DWORD dwErrorCode;
+ PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
+
+ FIXME("SeekPrinter(%p, %I64u, %p, %lu, %d)\n", hPrinter,
liDistanceToMove.QuadPart, pliNewPointer, dwMoveMethod, bWrite);
+
+ // Sanity checks.
+ if (!pHandle)
+ {
+ dwErrorCode = ERROR_INVALID_HANDLE;
+ goto Cleanup;
+ }
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcSeekPrinter(pHandle->hPrinter, liDistanceToMove,
pliNewPointer, dwMoveMethod, bWrite);
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ dwErrorCode = RpcExceptionCode();
+ ERR("_RpcSeekPrinter failed with exception code %lu!\n", dwErrorCode);
+ }
+ RpcEndExcept;
+
+Cleanup:
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
+}
+
BOOL WINAPI
SetDefaultPrinterA(LPCSTR pszPrinter)
{
@@ -3802,7 +3834,7 @@ StartDocPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pDocInfo)
dwReturnValue = pHandle->dwJobID;
if ( !pHandle->bTrayIcon )
{
- FIXME("Notify Tray Icon\n");
+ UpdateTrayIcon( hPrinter, pHandle->dwJobID );
}
}
@@ -3905,6 +3937,65 @@ Cleanup:
BOOL WINAPI
XcvDataW(HANDLE hXcv, PCWSTR pszDataName, PBYTE pInputData, DWORD cbInputData, PBYTE
pOutputData, DWORD cbOutputData, PDWORD pcbOutputNeeded, PDWORD pdwStatus)
{
+ DWORD dwErrorCode, Bogus = 0;
+ PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hXcv;
+
TRACE("XcvDataW(%p, %S, %p, %lu, %p, %lu, %p, %p)\n", hXcv, pszDataName,
pInputData, cbInputData, pOutputData, cbOutputData, pcbOutputNeeded, pdwStatus);
- return FALSE;
+
+ if ( pcbOutputNeeded == NULL )
+ {
+ dwErrorCode = ERROR_INVALID_PARAMETER;
+ goto Cleanup;
+ }
+
+ // Sanity checks.
+ if (!pHandle) // ( IntProtectHandle( hXcv, FALSE ) )
+ {
+ dwErrorCode = ERROR_INVALID_HANDLE;
+ goto Cleanup;
+ }
+
+ //
+ // Do fixups.
+ //
+ if ( pInputData == NULL )
+ {
+ if ( !cbInputData )
+ {
+ pInputData = (PBYTE)&Bogus;
+ }
+ }
+
+ if ( pOutputData == NULL )
+ {
+ if ( !cbOutputData )
+ {
+ pOutputData = (PBYTE)&Bogus;
+ }
+ }
+
+ // Do the RPC call
+ RpcTryExcept
+ {
+ dwErrorCode = _RpcXcvData( pHandle->hPrinter,
+ pszDataName,
+ pInputData,
+ cbInputData,
+ pOutputData,
+ cbOutputData,
+ pcbOutputNeeded,
+ pdwStatus );
+ }
+ RpcExcept(EXCEPTION_EXECUTE_HANDLER)
+ {
+ dwErrorCode = RpcExceptionCode();
+ ERR("_RpcXcvData failed with exception code %lu!\n", dwErrorCode);
+ }
+ RpcEndExcept;
+
+ //IntUnprotectHandle( hXcv );
+
+Cleanup:
+ SetLastError(dwErrorCode);
+ return (dwErrorCode == ERROR_SUCCESS);
}
diff --git a/win32ss/printing/base/winspool/printprocessors.c
b/win32ss/printing/base/winspool/printprocessors.c
index d40d81e4523..f0f79f256f3 100644
--- a/win32ss/printing/base/winspool/printprocessors.c
+++ b/win32ss/printing/base/winspool/printprocessors.c
@@ -246,9 +246,9 @@ epp_cleanup:
if (pcbNeeded) *pcbNeeded = needed;
if (pcReturned) *pcReturned = (res) ? numentries : 0;
- HeapFree(GetProcessHeap(), 0, nameW);
- HeapFree(GetProcessHeap(), 0, envW);
- HeapFree(GetProcessHeap(), 0, bufferW);
+ if (nameW) HeapFree(GetProcessHeap(), 0, nameW);
+ if (envW) HeapFree(GetProcessHeap(), 0, envW);
+ if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW);
TRACE("returning %d with %d (%d byte for %d entries)\n", (res),
GetLastError(), needed, numentries);
diff --git a/win32ss/printing/base/winspool/utils.c
b/win32ss/printing/base/winspool/utils.c
index 8dae057601b..3fa4a37ef2d 100644
--- a/win32ss/printing/base/winspool/utils.c
+++ b/win32ss/printing/base/winspool/utils.c
@@ -6,6 +6,14 @@
*/
#include "precomp.h"
+#include <shlobj.h>
+#include <undocshell.h>
+
+#define MAX_GETPRINTER_SIZE 4096 - MAX_PATH
+typedef void (WINAPI *PPfpSHChangeNotify)(LONG wEventId, UINT uFlags, LPCVOID dwItem1,
LPCVOID dwItem2);
+
+static HMODULE hShell32 = (HMODULE)-1;
+
/*
* Converts an incoming Unicode string to an ANSI string.
@@ -330,3 +338,41 @@ SECURITY_DESCRIPTOR * get_sd( SECURITY_DESCRIPTOR *sd, DWORD *size )
return retsd;
}
+VOID
+UpdateTrayIcon( HANDLE hPrinter, DWORD JobId )
+{
+ PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter;
+ SHCNF_PRINTJOB_INFO spji;
+ PRINTER_INFO_1W pi1w[MAX_GETPRINTER_SIZE] = {0};
+ DWORD cbNeeded;
+ PPfpSHChangeNotify fpFunction;
+
+ pHandle->bTrayIcon = TRUE;
+
+ spji.JobId = JobId;
+
+ if (!GetPrinterW( hPrinter, 1, (PBYTE)&pi1w, MAX_GETPRINTER_SIZE, &cbNeeded)
)
+ {
+ ERR("UpdateTrayIcon : GetPrinterW cbNeeded %d\n");
+ return;
+ }
+
+ if ( hShell32 == (HMODULE)-1 )
+ {
+ hShell32 = LoadLibraryW(L"shell32.dll");
+ }
+
+ if ( hShell32 )
+ {
+ fpFunction = (PPfpSHChangeNotify)GetProcAddress( hShell32,
"SHChangeNotify" );
+
+ if ( fpFunction )
+ {
+ fpFunction( SHCNE_CREATE, (SHCNF_FLUSHNOWAIT|SHCNF_FLUSH|SHCNF_PRINTJOBW),
pi1w->pName , &spji );
+ }
+ }
+ else
+ {
+ ERR("UpdateTrayIcon : No Shell32!\n");
+ }
+}
diff --git a/win32ss/printing/base/winspool/winspool.spec
b/win32ss/printing/base/winspool/winspool.spec
index e459f5adbe4..dbd454ca0c5 100644
--- a/win32ss/printing/base/winspool/winspool.spec
+++ b/win32ss/printing/base/winspool/winspool.spec
@@ -172,7 +172,7 @@
271 stdcall ResetPrinterA(ptr ptr)
272 stdcall ResetPrinterW(ptr ptr)
273 stdcall ScheduleJob(ptr long)
-274 stdcall -stub SeekPrinter(ptr int64 ptr long long)
+274 stdcall SeekPrinter(ptr int64 ptr long long)
275 stub SetAllocFailCount
276 stdcall SetFormA(ptr str long str)
277 stdcall SetFormW(ptr str long str)
diff --git a/win32ss/printing/include/marshalling/forms.h
b/win32ss/printing/include/marshalling/forms.h
index 90af25969da..14540a25311 100644
--- a/win32ss/printing/include/marshalling/forms.h
+++ b/win32ss/printing/include/marshalling/forms.h
@@ -8,7 +8,10 @@
static const MARSHALLING FormInfo1Marshalling = {
sizeof(FORM_INFO_1W),
{
+ { FIELD_OFFSET(FORM_INFO_1W, Flags), RTL_FIELD_SIZE(FORM_INFO_1W, Flags),
RTL_FIELD_SIZE(FORM_INFO_1W, Flags), FALSE },
{ FIELD_OFFSET(FORM_INFO_1W, pName), RTL_FIELD_SIZE(FORM_INFO_1W, pName),
RTL_FIELD_SIZE(FORM_INFO_1W, pName), TRUE },
+ { FIELD_OFFSET(FORM_INFO_1W, Size), RTL_FIELD_SIZE(FORM_INFO_1W, Size),
RTL_FIELD_SIZE(FORM_INFO_1W, Size), FALSE },
+ { FIELD_OFFSET(FORM_INFO_1W, ImageableArea), RTL_FIELD_SIZE(FORM_INFO_1W,
ImageableArea), RTL_FIELD_SIZE(FORM_INFO_1W, ImageableArea), FALSE },
{ MAXDWORD, 0, 0, FALSE }
}
};
@@ -16,10 +19,16 @@ static const MARSHALLING FormInfo1Marshalling = {
static const MARSHALLING FormInfo2Marshalling = {
sizeof(FORM_INFO_2W),
{
+ { FIELD_OFFSET(FORM_INFO_2W, Flags), RTL_FIELD_SIZE(FORM_INFO_2W, Flags),
RTL_FIELD_SIZE(FORM_INFO_2W, Flags), FALSE },
{ FIELD_OFFSET(FORM_INFO_2W, pName), RTL_FIELD_SIZE(FORM_INFO_2W, pName),
RTL_FIELD_SIZE(FORM_INFO_2W, pName), TRUE },
+ { FIELD_OFFSET(FORM_INFO_2W, Size), RTL_FIELD_SIZE(FORM_INFO_2W, Size),
RTL_FIELD_SIZE(FORM_INFO_2W, Size), FALSE },
+ { FIELD_OFFSET(FORM_INFO_2W, ImageableArea), RTL_FIELD_SIZE(FORM_INFO_2W,
ImageableArea), RTL_FIELD_SIZE(FORM_INFO_2W, ImageableArea), FALSE },
{ FIELD_OFFSET(FORM_INFO_2W, pKeyword), RTL_FIELD_SIZE(FORM_INFO_2W, pKeyword),
RTL_FIELD_SIZE(FORM_INFO_2W, pKeyword), TRUE },
+ { FIELD_OFFSET(FORM_INFO_2W, StringType), RTL_FIELD_SIZE(FORM_INFO_2W,
StringType), RTL_FIELD_SIZE(FORM_INFO_2W, StringType), FALSE },
{ FIELD_OFFSET(FORM_INFO_2W, pMuiDll), RTL_FIELD_SIZE(FORM_INFO_2W, pMuiDll),
RTL_FIELD_SIZE(FORM_INFO_2W, pMuiDll), TRUE },
- { FIELD_OFFSET(FORM_INFO_2W, pDisplayName), RTL_FIELD_SIZE(FORM_INFO_2W,
pDisplayName), RTL_FIELD_SIZE(FORM_INFO_2W, pDisplayName), FALSE },
+ { FIELD_OFFSET(FORM_INFO_2W, dwResourceId), RTL_FIELD_SIZE(FORM_INFO_2W,
dwResourceId), RTL_FIELD_SIZE(FORM_INFO_2W, dwResourceId), FALSE },
+ { FIELD_OFFSET(FORM_INFO_2W, pDisplayName), RTL_FIELD_SIZE(FORM_INFO_2W,
pDisplayName), RTL_FIELD_SIZE(FORM_INFO_2W, pDisplayName), TRUE },
+ { FIELD_OFFSET(FORM_INFO_2W, wLangId), RTL_FIELD_SIZE(FORM_INFO_2W, wLangId),
RTL_FIELD_SIZE(FORM_INFO_2W, wLangId), FALSE },
{ MAXDWORD, 0, 0, FALSE }
}
};
diff --git a/win32ss/printing/include/marshalling/printerdrivers.h
b/win32ss/printing/include/marshalling/printerdrivers.h
index d46c77454c3..7a8fcd5fea0 100644
--- a/win32ss/printing/include/marshalling/printerdrivers.h
+++ b/win32ss/printing/include/marshalling/printerdrivers.h
@@ -125,5 +125,6 @@ static const MARSHALLING* pPrinterDriverMarshalling[] = {
&PrinterDriver4Marshalling,
&PrinterDriver5Marshalling,
&PrinterDriver6Marshalling,
+ NULL,
&PrinterDriver8Marshalling,
};
diff --git a/win32ss/printing/include/spoolss.h b/win32ss/printing/include/spoolss.h
index 51de84082f7..30a54906417 100644
--- a/win32ss/printing/include/spoolss.h
+++ b/win32ss/printing/include/spoolss.h
@@ -8,6 +8,21 @@
#ifndef _REACTOS_SPOOLSS_H
#define _REACTOS_SPOOLSS_H
+#define RESETPRINTERDEFAULTDATATYPE 0x0001
+#define RESETPRINTERDEFAULTDEVMODE 0x0002
+
+#define PORT_IS_UNKNOWN 0
+#define PORT_IS_LPT 1
+#define PORT_IS_COM 2
+#define PORT_IS_FILE 3
+#define PORT_IS_FILENAME 4
+#define PORT_IS_WINE 5
+#define PORT_IS_UNIXNAME 5
+#define PORT_IS_PIPE 6
+#define PORT_IS_VNET 7
+#define PORT_IS_XPS 8
+
+
// Constants
#define MAX_PRINTER_NAME 220
@@ -64,6 +79,7 @@ typedef struct _FILE_INFO_1
DWORD dwOptions;
} FILE_INFO_1, *PFILE_INFO_1;
+BOOL WINAPI AddPortExW(LPWSTR, DWORD, LPBYTE, LPWSTR);
PVOID WINAPI AlignRpcPtr(PVOID pBuffer, PDWORD pcbBuffer);
PWSTR WINAPI AllocSplStr(PCWSTR pwszInput);
PVOID WINAPI DllAllocSplMem(DWORD dwBytes);
@@ -73,11 +89,13 @@ BOOL WINAPI InitializeRouter(HANDLE SpoolerStatusHandle);
PBYTE WINAPI PackStrings(PCWSTR* pSource, PBYTE pDest, const DWORD* DestOffsets, PBYTE
pEnd);
PVOID WINAPI ReallocSplMem(PVOID pOldMem, DWORD cbOld, DWORD cbNew);
BOOL WINAPI ReallocSplStr(PWSTR* ppwszString, PCWSTR pwszInput);
+BOOL WINAPI SeekPrinter(HANDLE hPrinter,LARGE_INTEGER liDistanceToMove,PLARGE_INTEGER
pliNewPointer,DWORD dwMoveMethod,BOOL bWrite);
BOOL WINAPI SplInitializeWinSpoolDrv(PVOID* pTable);
BOOL WINAPI SpoolerInit(VOID);
PDWORD WINAPI UndoAlignRpcPtr(PVOID pDestinationBuffer, PVOID pSourceBuffer, DWORD
cbBuffer, PDWORD pcbNeeded);
BOOL WINAPI SplGetSpoolFileInfo(HANDLE hPrinter,HANDLE hProcessHandle,DWORD
Level,FILE_INFO_1 *pFileInfo,DWORD dwSize,DWORD* dwNeeded );
BOOL WINAPI SplCommitSpoolData(HANDLE hPrinter,HANDLE hProcessHandle,DWORD cbCommit,DWORD
Level,FILE_INFO_1 *pFileInfo,DWORD dwSize,DWORD* dwNeeded);
BOOL WINAPI SplCloseSpoolFileHandle( HANDLE hPrinter );
+BOOL WINAPI GetPrinterDriverExW(HANDLE hPrinter,LPWSTR pEnvironment,DWORD Level,LPBYTE
pDriverInfo,DWORD cbBuf,LPDWORD pcbNeeded,DWORD dwClientMajorVersion,DWORD
dwClientMinorVersion,PDWORD pdwServerMajorVersion,PDWORD pdwServerMinorVersion );
#endif
diff --git a/win32ss/printing/monitors/localmon/main.c
b/win32ss/printing/monitors/localmon/main.c
index 8350e8e5189..c8984e442a4 100644
--- a/win32ss/printing/monitors/localmon/main.c
+++ b/win32ss/printing/monitors/localmon/main.c
@@ -24,10 +24,10 @@ static MONITOR2 _MonitorFunctions = {
LocalmonReadPort, // pfnReadPort
LocalmonEndDocPort, // pfnEndDocPort
LocalmonClosePort, // pfnClosePort
- NULL, // pfnAddPort
- NULL, // pfnAddPortEx
- NULL, // pfnConfigurePort
- NULL, // pfnDeletePort
+ LocalmonAddPort, // pfnAddPort moved to localui.dll since w2k, but~
+ LocalmonAddPortEx, // pfnAddPortEx
+ LocalmonConfigurePort, // pfnConfigurePort moved to localui.dll since w2k,
but~
+ LocalmonDeletePort, // pfnDeletePort moved to localui.dll since w2k,
but~
LocalmonGetPrinterDataFromPort, // pfnGetPrinterDataFromPort
LocalmonSetPortTimeOuts, // pfnSetPortTimeOuts
LocalmonXcvOpenPort, // pfnXcvOpenPort
@@ -114,32 +114,48 @@ LocalmonShutdown(HANDLE hMonitor)
PLOCALMON_HANDLE pLocalmon;
PLOCALMON_PORT pPort;
PLOCALMON_XCV pXcv;
+ PLIST_ENTRY pEntry;
TRACE("LocalmonShutdown(%p)\n", hMonitor);
pLocalmon = (PLOCALMON_HANDLE)hMonitor;
+ if ( pLocalmon->Sig != SIGLCMMON )
+ {
+ ERR("LocalmonShutdown : Invalid Monitor Handle\n",hMonitor);
+ return;
+ }
+
// Close all virtual file ports.
- while (!IsListEmpty(&pLocalmon->FilePorts))
+ if (!IsListEmpty(&pLocalmon->FilePorts))
{
- pPort = CONTAINING_RECORD(&pLocalmon->FilePorts.Flink, LOCALMON_PORT,
Entry);
- LocalmonClosePort((HANDLE)pPort);
+ for (pEntry = pLocalmon->FilePorts.Flink; pEntry !=
&pLocalmon->FilePorts; pEntry = pEntry->Flink)
+ {
+ pPort = CONTAINING_RECORD(&pLocalmon->FilePorts.Flink, LOCALMON_PORT,
Entry);
+ LocalmonClosePort((HANDLE)pPort);
+ }
}
// Do the same for the open Xcv ports.
- while (!IsListEmpty(&pLocalmon->XcvHandles))
+ if (!IsListEmpty(&pLocalmon->XcvHandles))
{
- pXcv = CONTAINING_RECORD(&pLocalmon->XcvHandles.Flink, LOCALMON_XCV,
Entry);
- LocalmonXcvClosePort((HANDLE)pXcv);
+ for (pEntry = pLocalmon->XcvHandles.Flink; pEntry !=
&pLocalmon->XcvHandles; pEntry = pEntry->Flink)
+ {
+ pXcv = CONTAINING_RECORD(pEntry, LOCALMON_XCV, Entry);
+ LocalmonXcvClosePort((HANDLE)pXcv);
+ }
}
// Now close all registry ports, remove them from the list and free their memory.
- while (!IsListEmpty(&pLocalmon->RegistryPorts))
+ if (!IsListEmpty(&pLocalmon->RegistryPorts))
{
- pPort = CONTAINING_RECORD(&pLocalmon->RegistryPorts.Flink, LOCALMON_PORT,
Entry);
- LocalmonClosePort((HANDLE)pPort);
- RemoveEntryList(&pPort->Entry);
- DllFreeSplMem(pPort);
+ for (pEntry = pLocalmon->RegistryPorts.Flink; pEntry !=
&pLocalmon->RegistryPorts; pEntry = pEntry->Flink)
+ {
+ pPort = CONTAINING_RECORD(pEntry, LOCALMON_PORT, Entry);
+ if ( LocalmonClosePort((HANDLE)pPort) ) continue;
+ RemoveEntryList(&pPort->Entry);
+ DllFreeSplMem(pPort);
+ }
}
// Finally clean the LOCALMON_HANDLE structure itself.
@@ -164,6 +180,7 @@ InitializePrintMonitor2(PMONITORINIT pMonitorInit, PHANDLE phMonitor)
// Create a new LOCALMON_HANDLE structure.
pLocalmon = DllAllocSplMem(sizeof(LOCALMON_HANDLE));
+ pLocalmon->Sig = SIGLCMMON;
InitializeCriticalSection(&pLocalmon->Section);
InitializeListHead(&pLocalmon->FilePorts);
InitializeListHead(&pLocalmon->RegistryPorts);
@@ -198,9 +215,10 @@ InitializePrintMonitor2(PMONITORINIT pMonitorInit, PHANDLE
phMonitor)
goto Cleanup;
}
+ pPort->Sig = SIGLCMPORT;
pPort->pLocalmon = pLocalmon;
pPort->hFile = INVALID_HANDLE_VALUE;
- pPort->pwszPortName = (PWSTR)((PBYTE)pPort + sizeof(LOCALMON_PORT));
+ pPort->pwszPortName = (PWSTR)(pPort+1);
// Get the port name.
cchPortName = cchMaxPortName + 1;
@@ -229,6 +247,7 @@ InitializePrintMonitor2(PMONITORINIT pMonitorInit, PHANDLE phMonitor)
// Add it to the list.
InsertTailList(&pLocalmon->RegistryPorts, &pPort->Entry);
+ TRACE("InitializePrintMonitor2 Port : %s
\n",debugstr_w(pPort->pwszPortName));
// Don't let the cleanup routine free this.
pPort = NULL;
diff --git a/win32ss/printing/monitors/localmon/ports.c
b/win32ss/printing/monitors/localmon/ports.c
index bee1a22fb23..a1f527a548f 100644
--- a/win32ss/printing/monitors/localmon/ports.c
+++ b/win32ss/printing/monitors/localmon/ports.c
@@ -139,7 +139,6 @@ _ClosePortHandles(PLOCALMON_PORT pPort)
DefineDosDeviceW(DDD_REMOVE_DEFINITION, pwszNonspooledPortName, NULL);
DllFreeSplMem(pwszNonspooledPortName);
}
-
DllFreeSplMem(pwszPortNameWithoutColon);
}
}
... 3873 lines suppressed ...