ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
January 2020
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
21 participants
133 discussions
Start a n
N
ew thread
[reactos] 01/01: [Printing] Part of GDI Support
by James Tabor
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=adffa8ea7591f4d2d6530…
commit adffa8ea7591f4d2d6530a82361d419a9ffc8ad7 Author: James Tabor <james.tabor(a)reactos.org> AuthorDate: Fri Jan 31 17:38:47 2020 -0600 Commit: James Tabor <james.tabor(a)reactos.org> CommitDate: Fri Jan 31 17:38:47 2020 -0600 [Printing] Part of GDI Support Fix ups and added support to prevent GDI from crashing. These functions will be required for GDI. Part 1 of print support. --- win32ss/printing/base/spoolsv/printerdrivers.c | 4 +- win32ss/printing/base/winspool/precomp.h | 1 + win32ss/printing/base/winspool/printers.c | 20 +++- win32ss/printing/base/winspool/winspool.spec | 4 +- .../printing/include/marshalling/printerdrivers.h | 30 ++++++ .../printing/providers/localspl/printerdrivers.c | 119 ++++++++++++++++++++- 6 files changed, 169 insertions(+), 9 deletions(-) diff --git a/win32ss/printing/base/spoolsv/printerdrivers.c b/win32ss/printing/base/spoolsv/printerdrivers.c index a1f45865c15..ae85f84434d 100644 --- a/win32ss/printing/base/spoolsv/printerdrivers.c +++ b/win32ss/printing/base/spoolsv/printerdrivers.c @@ -49,6 +49,8 @@ _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); + dwErrorCode = RpcImpersonateClient(NULL); if (dwErrorCode != ERROR_SUCCESS) { @@ -61,7 +63,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 <= 3); + ASSERT(Level >= 1 && Level <= 5); MarshallDownStructure(pDriverAligned, pPrinterDriverMarshalling[Level]->pInfo, pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE); } else diff --git a/win32ss/printing/base/winspool/precomp.h b/win32ss/printing/base/winspool/precomp.h index cbfaac933ca..033b38d1b4c 100644 --- a/win32ss/printing/base/winspool/precomp.h +++ b/win32ss/printing/base/winspool/precomp.h @@ -15,6 +15,7 @@ #include <winreg.h> #include <winspool.h> #include <winspool_c.h> +#include <winddiui.h> #include <ndk/rtlfuncs.h> #include <spoolss.h> diff --git a/win32ss/printing/base/winspool/printers.c b/win32ss/printing/base/winspool/printers.c index 7fd34a40866..0e7729408b6 100644 --- a/win32ss/printing/base/winspool/printers.c +++ b/win32ss/printing/base/winspool/printers.c @@ -194,6 +194,14 @@ DeviceCapabilitiesW(LPCWSTR pDevice, LPCWSTR pPort, WORD fwCapability, LPWSTR pO return 0; } +INT WINAPI +DocumentEvent( HANDLE hPrinter, HDC hdc, int iEsc, ULONG cbIn, PVOID pvIn, ULONG cbOut, PVOID pvOut) +{ + ERR("DocumentEvent(%p, %p, %lu, %lu, %p, %lu, %p)\n", hPrinter, hdc, iEsc, cbIn, pvIn, cbOut, pvOut); + UNIMPLEMENTED; + return DOCUMENTEVENT_UNSUPPORTED; +} + LONG WINAPI DocumentPropertiesA(HWND hWnd, HANDLE hPrinter, LPSTR pDeviceName, PDEVMODEA pDevModeOutput, PDEVMODEA pDevModeInput, DWORD fMode) { @@ -1042,7 +1050,7 @@ GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDri DWORD dwErrorCode; PSPOOLER_HANDLE pHandle = (PSPOOLER_HANDLE)hPrinter; - TRACE("GetPrinterDriverW(%p, %S, %lu, %p, %lu, %p)\n", hPrinter, pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded); + ERR("GetPrinterDriverW(%p, %S, %lu, %p, %lu, %p)\n", hPrinter, pEnvironment, Level, pDriverInfo, cbBuf, pcbNeeded); // Sanity checks. if (!pHandle) @@ -1076,7 +1084,7 @@ GetPrinterDriverW(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDri if (dwErrorCode == ERROR_SUCCESS) { // Replace relative offset addresses in the output by absolute pointers. - ASSERT(Level <= 3); + ASSERT(Level <= 5); MarshallUpStructure(cbBuf, pDriverInfo, pPrinterDriverMarshalling[Level]->pInfo, pPrinterDriverMarshalling[Level]->cbStructureSize, TRUE); } @@ -1472,6 +1480,14 @@ SetPrinterW(HANDLE hPrinter, DWORD Level, PBYTE pPrinter, DWORD Command) return FALSE; } +BOOL WINAPI +SplDriverUnloadComplete(LPWSTR pDriverFile) +{ + ERR("DriverUnloadComplete(%S)\n", pDriverFile); + UNIMPLEMENTED; + return TRUE; // return true for now. +} + DWORD WINAPI StartDocPrinterA(HANDLE hPrinter, DWORD Level, PBYTE pDocInfo) { diff --git a/win32ss/printing/base/winspool/winspool.spec b/win32ss/printing/base/winspool/winspool.spec index 7c2888b236b..318a2df8ca9 100644 --- a/win32ss/printing/base/winspool/winspool.spec +++ b/win32ss/printing/base/winspool/winspool.spec @@ -74,7 +74,7 @@ 173 stdcall DeviceCapabilitiesW(wstr wstr long ptr ptr) 174 stub DeviceMode 175 stub DevicePropertySheets -176 stub DocumentEvent +176 stdcall DocumentEvent(ptr ptr long long ptr long ptr) 177 stdcall DocumentPropertiesA(ptr ptr ptr ptr ptr long) 178 stdcall DocumentPropertiesW(ptr ptr ptr ptr ptr long) 179 stub DocumentPropertySheets @@ -186,7 +186,7 @@ 285 stdcall SetPrinterDataExW(ptr wstr wstr long ptr long) 286 stdcall SetPrinterDataW(ptr wstr long ptr long) 287 stdcall SetPrinterW(ptr long ptr long) -288 stub SplDriverUnloadComplete +288 stdcall SplDriverUnloadComplete(ptr) 289 stub SpoolerDevQueryPrintW 290 stdcall SpoolerInit() 291 stub SpoolerPrinterEvent diff --git a/win32ss/printing/include/marshalling/printerdrivers.h b/win32ss/printing/include/marshalling/printerdrivers.h index 49951bdca27..ffaf50fa21c 100644 --- a/win32ss/printing/include/marshalling/printerdrivers.h +++ b/win32ss/printing/include/marshalling/printerdrivers.h @@ -41,6 +41,34 @@ static const MARSHALLING PrinterDriver3Marshalling = { } }; +static const MARSHALLING PrinterDriver4Marshalling = { + sizeof(DRIVER_INFO_4W), + { + { FIELD_OFFSET(DRIVER_INFO_4W, pName), RTL_FIELD_SIZE(DRIVER_INFO_4W, pName), RTL_FIELD_SIZE(DRIVER_INFO_4W, pName), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_4W, pEnvironment), RTL_FIELD_SIZE(DRIVER_INFO_4W, pEnvironment), RTL_FIELD_SIZE(DRIVER_INFO_4W, pEnvironment), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_4W, pDriverPath), RTL_FIELD_SIZE(DRIVER_INFO_4W, pDriverPath), RTL_FIELD_SIZE(DRIVER_INFO_4W, pDriverPath), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_4W, pDataFile), RTL_FIELD_SIZE(DRIVER_INFO_4W, pDataFile), RTL_FIELD_SIZE(DRIVER_INFO_4W, pDataFile), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_4W, pConfigFile), RTL_FIELD_SIZE(DRIVER_INFO_4W, pConfigFile), RTL_FIELD_SIZE(DRIVER_INFO_4W, pConfigFile), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_4W, pHelpFile), RTL_FIELD_SIZE(DRIVER_INFO_4W, pHelpFile), RTL_FIELD_SIZE(DRIVER_INFO_4W, pHelpFile), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_4W, pDependentFiles), RTL_FIELD_SIZE(DRIVER_INFO_4W, pDependentFiles), RTL_FIELD_SIZE(DRIVER_INFO_4W, pDependentFiles), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_4W, pMonitorName), RTL_FIELD_SIZE(DRIVER_INFO_4W, pMonitorName), RTL_FIELD_SIZE(DRIVER_INFO_4W, pMonitorName), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_4W, pDefaultDataType), RTL_FIELD_SIZE(DRIVER_INFO_4W, pDefaultDataType), RTL_FIELD_SIZE(DRIVER_INFO_4W, pDefaultDataType), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_4W, pszzPreviousNames), RTL_FIELD_SIZE(DRIVER_INFO_4W, pszzPreviousNames), RTL_FIELD_SIZE(DRIVER_INFO_4W, pDefaultDataType), TRUE }, + { MAXDWORD, 0, 0, FALSE } + } +}; + +static const MARSHALLING PrinterDriver5Marshalling = { + sizeof(DRIVER_INFO_5W), + { + { FIELD_OFFSET(DRIVER_INFO_5W, pName), RTL_FIELD_SIZE(DRIVER_INFO_5W, pName), RTL_FIELD_SIZE(DRIVER_INFO_5W, pName), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_5W, pEnvironment), RTL_FIELD_SIZE(DRIVER_INFO_5W, pEnvironment), RTL_FIELD_SIZE(DRIVER_INFO_5W, pEnvironment), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_5W, pDriverPath), RTL_FIELD_SIZE(DRIVER_INFO_5W, pDriverPath), RTL_FIELD_SIZE(DRIVER_INFO_5W, pDriverPath), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_5W, pDataFile), RTL_FIELD_SIZE(DRIVER_INFO_5W, pDataFile), RTL_FIELD_SIZE(DRIVER_INFO_5W, pDataFile), TRUE }, + { FIELD_OFFSET(DRIVER_INFO_5W, pConfigFile), RTL_FIELD_SIZE(DRIVER_INFO_5W, pConfigFile), RTL_FIELD_SIZE(DRIVER_INFO_5W, pConfigFile), TRUE }, + { MAXDWORD, 0, 0, FALSE } + } +}; static const MARSHALLING* pPrinterDriverMarshalling[] = { @@ -48,4 +76,6 @@ static const MARSHALLING* pPrinterDriverMarshalling[] = { &PrinterDriver1Marshalling, &PrinterDriver2Marshalling, &PrinterDriver3Marshalling, + &PrinterDriver4Marshalling, + &PrinterDriver5Marshalling, }; diff --git a/win32ss/printing/providers/localspl/printerdrivers.c b/win32ss/printing/providers/localspl/printerdrivers.c index 5bb5b3db73a..351667cecc8 100644 --- a/win32ss/printing/providers/localspl/printerdrivers.c +++ b/win32ss/printing/providers/localspl/printerdrivers.c @@ -7,7 +7,6 @@ #include "precomp.h" - // Local Constants static DWORD dwDriverInfo1Offsets[] = { FIELD_OFFSET(DRIVER_INFO_1W, pName), @@ -36,6 +35,29 @@ static DWORD dwDriverInfo3Offsets[] = { MAXDWORD }; +static DWORD dwDriverInfo4Offsets[] = { + FIELD_OFFSET(DRIVER_INFO_4W, pName), + FIELD_OFFSET(DRIVER_INFO_4W, pEnvironment), + FIELD_OFFSET(DRIVER_INFO_4W, pDriverPath), + FIELD_OFFSET(DRIVER_INFO_4W, pDataFile), + FIELD_OFFSET(DRIVER_INFO_4W, pConfigFile), + FIELD_OFFSET(DRIVER_INFO_4W, pHelpFile), + FIELD_OFFSET(DRIVER_INFO_4W, pDependentFiles), + FIELD_OFFSET(DRIVER_INFO_4W, pMonitorName), + FIELD_OFFSET(DRIVER_INFO_4W, pDefaultDataType), + FIELD_OFFSET(DRIVER_INFO_4W, pszzPreviousNames), + MAXDWORD +}; + +static DWORD dwDriverInfo5Offsets[] = { + FIELD_OFFSET(DRIVER_INFO_5W, pName), + FIELD_OFFSET(DRIVER_INFO_5W, pEnvironment), + FIELD_OFFSET(DRIVER_INFO_5W, pDriverPath), + FIELD_OFFSET(DRIVER_INFO_5W, pDataFile), + FIELD_OFFSET(DRIVER_INFO_5W, pConfigFile), + MAXDWORD +}; + static void ToMultiSz(LPWSTR pString) { @@ -118,7 +140,7 @@ _LocalGetPrinterDriverLevel3(PLOCAL_PRINTER_HANDLE pHandle, PDRIVER_INFO_3W* ppD pwszStrings[1] = wszCurrentEnvironment; // pEnvironment pwszStrings[2] = L"c:\\reactos\\system32\\localspl.dll"; // pDriverPath pwszStrings[3] = L"c:\\reactos\\system32\\localspl.dll"; // pDataFile - pwszStrings[4] = L"c:\\reactos\\system32\\printui.dll"; // pConfigFile + pwszStrings[4] = L"c:\\reactos\\system32\\printui.dll"; // pConfigFile pwszStrings[5] = L""; // pHelpFile pwszStrings[6] = L"localspl.dll|printui.dll|"; // pDependentFiles, | is separator and terminator! pwszStrings[7] = NULL; // pMonitorName @@ -148,6 +170,87 @@ _LocalGetPrinterDriverLevel3(PLOCAL_PRINTER_HANDLE pHandle, PDRIVER_INFO_3W* ppD (*ppDriverInfo)++; } +static void +_LocalGetPrinterDriverLevel4(PLOCAL_PRINTER_HANDLE pHandle, PDRIVER_INFO_4W* ppDriverInfo, PBYTE* ppDriverInfoEnd, PDWORD pcbNeeded) +{ + DWORD n; + PCWSTR pwszStrings[10]; + + /* Clearly these things should not be hardcoded, so when it is needed, someone can add meaningfull values here */ + pwszStrings[0] = pHandle->pPrinter->pwszPrinterDriver; // pName + pwszStrings[1] = wszCurrentEnvironment; // pEnvironment + pwszStrings[2] = L"c:\\reactos\\system32\\localspl.dll"; // pDriverPath + pwszStrings[3] = L"c:\\reactos\\system32\\localspl.dll"; // pDataFile + pwszStrings[4] = L"c:\\reactos\\system32\\printui.dll"; // pConfigFile + pwszStrings[5] = L""; // pHelpFile + pwszStrings[6] = L"localspl.dll|printui.dll|"; // pDependentFiles, | is separator and terminator! + pwszStrings[7] = NULL; // pMonitorName + pwszStrings[8] = NULL; // pDefaultDataType + pwszStrings[9] = NULL; // pszzPreviousNames + + // Calculate the string lengths. + if (!ppDriverInfo) + { + for (n = 0; n < _countof(pwszStrings); ++n) + { + if (pwszStrings[n]) + { + *pcbNeeded += (wcslen(pwszStrings[n]) + 1) * sizeof(WCHAR); + } + } + + *pcbNeeded += sizeof(DRIVER_INFO_4W); + return; + } + + (*ppDriverInfo)->cVersion = 3; + + // Finally copy the structure and advance to the next one in the output buffer. + *ppDriverInfoEnd = PackStrings(pwszStrings, (PBYTE)(*ppDriverInfo), dwDriverInfo4Offsets, *ppDriverInfoEnd); + ToMultiSz((*ppDriverInfo)->pDependentFiles); + (*ppDriverInfo)++; +} + +static void +_LocalGetPrinterDriverLevel5(PLOCAL_PRINTER_HANDLE pHandle, PDRIVER_INFO_5W* ppDriverInfo, PBYTE* ppDriverInfoEnd, PDWORD pcbNeeded) +{ + DWORD n; + PCWSTR pwszStrings[5]; + + /* Clearly these things should not be hardcoded, so when it is needed, someone can add meaningfull values here */ + pwszStrings[0] = pHandle->pPrinter->pwszPrinterDriver; // pName + pwszStrings[1] = wszCurrentEnvironment; // pEnvironment + pwszStrings[2] = L"c:\\reactos\\system32\\localspl.dll"; // pDriverPath UniDrv.dll + pwszStrings[3] = L"c:\\reactos\\system32\\localspl.dll"; // pDataFile.ppd + pwszStrings[4] = L"c:\\reactos\\system32\\printui.dll"; // pConfigFile UniDrvUI.dll + + // Calculate the string lengths. + if (!ppDriverInfo) + { + for (n = 0; n < _countof(pwszStrings); ++n) + { + if (pwszStrings[n]) + { + *pcbNeeded += (wcslen(pwszStrings[n]) + 1) * sizeof(WCHAR); + } + } + + *pcbNeeded += sizeof(DRIVER_INFO_5W); + return; + } + + (*ppDriverInfo)->cVersion = 3; + // Driver attributes, like UMPD/KMPD. + (*ppDriverInfo)->dwDriverAttributes = 0; // UMPD/KMPD, So where are they? + // Number of times the configuration file for this driver has been upgraded or downgraded since the last spooler restart. + (*ppDriverInfo)->dwConfigVersion = 1; + // Number of times the driver file for this driver has been upgraded or downgraded since the last spooler restart. + (*ppDriverInfo)->dwDriverVersion = 1; + + // Finally copy the structure and advance to the next one in the output buffer. + *ppDriverInfoEnd = PackStrings(pwszStrings, (PBYTE)(*ppDriverInfo), dwDriverInfo5Offsets, *ppDriverInfoEnd); + (*ppDriverInfo)++; +} BOOL WINAPI LocalGetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Level, LPBYTE pDriverInfo, DWORD cbBuf, LPDWORD pcbNeeded) { @@ -168,8 +271,8 @@ BOOL WINAPI LocalGetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Le pPrinterHandle = (PLOCAL_PRINTER_HANDLE)pHandle->pSpecificHandle; - // Only support 3 levels for now - if (Level > 3) + // Only support 5 levels for now + if (Level > 5) { // The caller supplied an invalid level. dwErrorCode = ERROR_INVALID_LEVEL; @@ -185,6 +288,10 @@ BOOL WINAPI LocalGetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Le _LocalGetPrinterDriverLevel2(pPrinterHandle, NULL, NULL, pcbNeeded); else if (Level == 3) _LocalGetPrinterDriverLevel3(pPrinterHandle, NULL, NULL, pcbNeeded); + else if (Level == 4) + _LocalGetPrinterDriverLevel4(pPrinterHandle, NULL, NULL, pcbNeeded); + else if (Level == 5) + _LocalGetPrinterDriverLevel5(pPrinterHandle, NULL, NULL, pcbNeeded); // Check if the supplied buffer is large enough. if (cbBuf < *pcbNeeded) @@ -202,6 +309,10 @@ BOOL WINAPI LocalGetPrinterDriver(HANDLE hPrinter, LPWSTR pEnvironment, DWORD Le _LocalGetPrinterDriverLevel2(pPrinterHandle, (PDRIVER_INFO_2W*)&pDriverInfo, &pEnd, NULL); else if (Level == 3) _LocalGetPrinterDriverLevel3(pPrinterHandle, (PDRIVER_INFO_3W*)&pDriverInfo, &pEnd, NULL); + else if (Level == 4) + _LocalGetPrinterDriverLevel4(pPrinterHandle, (PDRIVER_INFO_4W*)&pDriverInfo, &pEnd, NULL); + else if (Level == 5) + _LocalGetPrinterDriverLevel5(pPrinterHandle, (PDRIVER_INFO_5W*)&pDriverInfo, &pEnd, NULL); dwErrorCode = ERROR_SUCCESS;
4 years, 10 months
1
0
0
0
[reactos] 01/01: [FORMATTING] Fix indentation of winspool/printers.c
by Colin Finck
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=45f39ffc253012b2399dc…
commit 45f39ffc253012b2399dc1105bcb797caec6ae36 Author: Colin Finck <colin(a)reactos.org> AuthorDate: Fri Jan 31 18:47:53 2020 +0100 Commit: Colin Finck <colin(a)reactos.org> CommitDate: Fri Jan 31 18:47:53 2020 +0100 [FORMATTING] Fix indentation of winspool/printers.c No code changes --- win32ss/printing/base/winspool/printers.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/win32ss/printing/base/winspool/printers.c b/win32ss/printing/base/winspool/printers.c index a3ee6e69673..7fd34a40866 100644 --- a/win32ss/printing/base/winspool/printers.c +++ b/win32ss/printing/base/winspool/printers.c @@ -476,7 +476,7 @@ EnumPrintersA(DWORD Flags, PSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cbB { SetLastError(ERROR_NOT_ENOUGH_MEMORY); ERR("HeapAlloc failed!\n"); - goto Cleanup; + goto Cleanup; } WideCharToMultiByte(CP_ACP, 0, ppi1w[i].pDescription, -1, pszDescription, cch + 1, NULL, NULL); @@ -538,7 +538,7 @@ EnumPrintersA(DWORD Flags, PSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cbB { SetLastError(ERROR_NOT_ENOUGH_MEMORY); ERR("HeapAlloc failed!\n"); - goto Cleanup; + goto Cleanup; } WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pServerName, -1, pszServerName, cch + 1, NULL, NULL); @@ -754,7 +754,7 @@ EnumPrintersA(DWORD Flags, PSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cbB { SetLastError(ERROR_NOT_ENOUGH_MEMORY); ERR("HeapAlloc failed!\n"); - goto Cleanup; + goto Cleanup; } WideCharToMultiByte(CP_ACP, 0, ppi4w[i].pPrinterName, -1, pszPrinterName, cch + 1, NULL, NULL);
4 years, 10 months
1
0
0
0
[reactos] 01/01: [WINSPOOL] Add Implementation of EnumPrintersA (#2273)
by Doug Lyons
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e8b177825b0f447842860…
commit e8b177825b0f44784286032d6ec64606c7b0a718 Author: Doug Lyons <douglyons(a)douglyons.com> AuthorDate: Fri Jan 31 11:42:55 2020 -0600 Commit: GitHub <noreply(a)github.com> CommitDate: Fri Jan 31 18:42:55 2020 +0100 [WINSPOOL] Add Implementation of EnumPrintersA (#2273) --- win32ss/printing/base/winspool/printers.c | 446 +++++++++++++++++++++++++++++- 1 file changed, 445 insertions(+), 1 deletion(-) diff --git a/win32ss/printing/base/winspool/printers.c b/win32ss/printing/base/winspool/printers.c index 3d029144d51..a3ee6e69673 100644 --- a/win32ss/printing/base/winspool/printers.c +++ b/win32ss/printing/base/winspool/printers.c @@ -8,6 +8,7 @@ #include "precomp.h" #include <marshalling/printers.h> #include <marshalling/printerdrivers.h> +#include <strsafe.h> // Local Constants @@ -386,8 +387,451 @@ Cleanup: BOOL WINAPI EnumPrintersA(DWORD Flags, PSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) { + BOOL bReturnValue = FALSE; + DWORD cch; + PWSTR pwszName = NULL; + PSTR pszPrinterName = NULL; + PSTR pszServerName = NULL; + PSTR pszDescription = NULL; + PSTR pszName = NULL; + PSTR pszComment = NULL; + PSTR pszShareName = NULL; + PSTR pszPortName = NULL; + PSTR pszDriverName = NULL; + PSTR pszLocation = NULL; + PSTR pszSepFile = NULL; + PSTR pszPrintProcessor = NULL; + PSTR pszDatatype = NULL; + PSTR pszParameters = NULL; + DWORD i; + PPRINTER_INFO_1W ppi1w = NULL; + PPRINTER_INFO_1A ppi1a = NULL; + PPRINTER_INFO_2W ppi2w = NULL; + PPRINTER_INFO_2A ppi2a = NULL; + PPRINTER_INFO_4W ppi4w = NULL; + PPRINTER_INFO_4A ppi4a = NULL; + PPRINTER_INFO_5W ppi5w = NULL; + PPRINTER_INFO_5A ppi5a = NULL; + TRACE("EnumPrintersA(%lu, %s, %lu, %p, %lu, %p, %p)\n", Flags, Name, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned); - return FALSE; + + // Check for invalid levels here for early error return. MSDN says that only 1, 2, 4, and 5 are allowable. + if (Level != 1 && Level != 2 && Level != 4 && Level != 5) + { + SetLastError(ERROR_INVALID_LEVEL); + ERR("Invalid Level!\n"); + goto Cleanup; + } + + if (Name) + { + // Convert pName to a Unicode string pwszName. + cch = strlen(Name); + + pwszName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(WCHAR)); + if (!pwszName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + MultiByteToWideChar(CP_ACP, 0, Name, -1, pwszName, cch + 1); + } + + /* Ref:
https://stackoverflow.com/questions/41147180/why-enumprintersa-and-enumprin…
*/ + bReturnValue = EnumPrintersW(Flags, pwszName, Level, pPrinterEnum, cbBuf, pcbNeeded, pcReturned); + HeapFree(hProcessHeap, 0, pwszName); + + TRACE("*pcReturned is '%d' and bReturnValue is '%d' and GetLastError is '%ld'.\n", *pcReturned, bReturnValue, GetLastError()); + + /* We are mapping multiple different pointers to the same pPrinterEnum pointer here so that */ + /* we can do in-place conversion. We read the Unicode response from the EnumPrintersW and */ + /* then we write back the ANSI conversion into the same buffer for our EnumPrintersA output */ + + /* mapping to pPrinterEnum for Unicode (w) characters for Levels 1, 2, 4, and 5 */ + ppi1w = (PPRINTER_INFO_1W)pPrinterEnum; + ppi2w = (PPRINTER_INFO_2W)pPrinterEnum; + ppi4w = (PPRINTER_INFO_4W)pPrinterEnum; + ppi5w = (PPRINTER_INFO_5W)pPrinterEnum; + /* mapping to pPrinterEnum for ANSI (a) characters for Levels 1, 2, 4, and 5 */ + ppi1a = (PPRINTER_INFO_1A)pPrinterEnum; + ppi2a = (PPRINTER_INFO_2A)pPrinterEnum; + ppi4a = (PPRINTER_INFO_4A)pPrinterEnum; + ppi5a = (PPRINTER_INFO_5A)pPrinterEnum; + + for (i = 0; i < *pcReturned; i++) + { + switch (Level) + { + case 1: + { + if (ppi1w[i].pDescription) + { + // Convert Unicode pDescription to a ANSI string pszDescription. + cch = wcslen(ppi1w[i].pDescription); + + pszDescription = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszDescription) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi1w[i].pDescription, -1, pszDescription, cch + 1, NULL, NULL); + StringCchCopyA(ppi1a[i].pDescription, cch + 1, pszDescription); + + HeapFree(hProcessHeap, 0, pszDescription); + } + + if (ppi1w[i].pName) + { + // Convert Unicode pName to a ANSI string pszName. + cch = wcslen(ppi1w[i].pName); + + pszName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi1w[i].pName, -1, pszName, cch + 1, NULL, NULL); + StringCchCopyA(ppi1a[i].pName, cch + 1, pszName); + + HeapFree(hProcessHeap, 0, pszName); + } + + if (ppi1w[i].pComment) + { + // Convert Unicode pComment to a ANSI string pszComment. + cch = wcslen(ppi1w[i].pComment); + + pszComment = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszComment) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi1w[i].pComment, -1, pszComment, cch + 1, NULL, NULL); + StringCchCopyA(ppi1a[i].pComment, cch + 1, pszComment); + + HeapFree(hProcessHeap, 0, pszComment); + } + break; + } + + + case 2: + { + if (ppi2w[i].pServerName) + { + // Convert Unicode pServerName to a ANSI string pszServerName. + cch = wcslen(ppi2w[i].pServerName); + + pszServerName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszServerName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pServerName, -1, pszServerName, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pServerName, cch + 1, pszServerName); + + HeapFree(hProcessHeap, 0, pszServerName); + } + + if (ppi2w[i].pPrinterName) + { + // Convert Unicode pPrinterName to a ANSI string pszPrinterName. + cch = wcslen(ppi2w[i].pPrinterName); + + pszPrinterName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszPrinterName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pPrinterName, -1, pszPrinterName, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pPrinterName, cch + 1, pszPrinterName); + + HeapFree(hProcessHeap, 0, pszPrinterName); + } + + if (ppi2w[i].pShareName) + { + // Convert Unicode pShareName to a ANSI string pszShareName. + cch = wcslen(ppi2w[i].pShareName); + + pszShareName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszShareName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pShareName, -1, pszShareName, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pShareName, cch + 1, pszShareName); + + HeapFree(hProcessHeap, 0, pszShareName); + } + + if (ppi2w[i].pPortName) + { + // Convert Unicode pPortName to a ANSI string pszPortName. + cch = wcslen(ppi2w[i].pPortName); + + pszPortName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszPortName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pPortName, -1, pszPortName, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pPortName, cch + 1, pszPortName); + + HeapFree(hProcessHeap, 0, pszPortName); + } + + if (ppi2w[i].pDriverName) + { + // Convert Unicode pDriverName to a ANSI string pszDriverName. + cch = wcslen(ppi2w[i].pDriverName); + + pszDriverName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszDriverName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pDriverName, -1, pszDriverName, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pDriverName, cch + 1, pszDriverName); + + HeapFree(hProcessHeap, 0, pszDriverName); + } + + if (ppi2w[i].pComment) + { + // Convert Unicode pComment to a ANSI string pszComment. + cch = wcslen(ppi2w[i].pComment); + + pszComment = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszComment) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pComment, -1, pszComment, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pComment, cch + 1, pszComment); + + HeapFree(hProcessHeap, 0, pszComment); + } + + if (ppi2w[i].pLocation) + { + // Convert Unicode pLocation to a ANSI string pszLocation. + cch = wcslen(ppi2w[i].pLocation); + + pszLocation = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszLocation) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pLocation, -1, pszLocation, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pLocation, cch + 1, pszLocation); + + HeapFree(hProcessHeap, 0, pszLocation); + } + + + if (ppi2w[i].pSepFile) + { + // Convert Unicode pSepFile to a ANSI string pszSepFile. + cch = wcslen(ppi2w[i].pSepFile); + + pszSepFile = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszSepFile) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pSepFile, -1, pszSepFile, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pSepFile, cch + 1, pszSepFile); + + HeapFree(hProcessHeap, 0, pszSepFile); + } + + if (ppi2w[i].pPrintProcessor) + { + // Convert Unicode pPrintProcessor to a ANSI string pszPrintProcessor. + cch = wcslen(ppi2w[i].pPrintProcessor); + + pszPrintProcessor = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszPrintProcessor) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pPrintProcessor, -1, pszPrintProcessor, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pPrintProcessor, cch + 1, pszPrintProcessor); + + HeapFree(hProcessHeap, 0, pszPrintProcessor); + } + + + if (ppi2w[i].pDatatype) + { + // Convert Unicode pDatatype to a ANSI string pszDatatype. + cch = wcslen(ppi2w[i].pDatatype); + + pszDatatype = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszDatatype) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pDatatype, -1, pszDatatype, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pDatatype, cch + 1, pszDatatype); + + HeapFree(hProcessHeap, 0, pszDatatype); + } + + if (ppi2w[i].pParameters) + { + // Convert Unicode pParameters to a ANSI string pszParameters. + cch = wcslen(ppi2w[i].pParameters); + + pszParameters = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszParameters) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi2w[i].pParameters, -1, pszParameters, cch + 1, NULL, NULL); + StringCchCopyA(ppi2a[i].pParameters, cch + 1, pszParameters); + + HeapFree(hProcessHeap, 0, pszParameters); + } + break; + + } + + case 4: + { + if (ppi4w[i].pPrinterName) + { + // Convert Unicode pPrinterName to a ANSI string pszPrinterName. + cch = wcslen(ppi4w[i].pPrinterName); + + pszPrinterName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszPrinterName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi4w[i].pPrinterName, -1, pszPrinterName, cch + 1, NULL, NULL); + StringCchCopyA(ppi4a[i].pPrinterName, cch + 1, pszPrinterName); + + HeapFree(hProcessHeap, 0, pszPrinterName); + } + + if (ppi4w[i].pServerName) + { + // Convert Unicode pServerName to a ANSI string pszServerName. + cch = wcslen(ppi4w[i].pServerName); + + pszServerName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszServerName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi4w[i].pServerName, -1, pszServerName, cch + 1, NULL, NULL); + StringCchCopyA(ppi4a[i].pServerName, cch + 1, pszServerName); + + HeapFree(hProcessHeap, 0, pszServerName); + } + break; + } + + case 5: + { + if (ppi5w[i].pPrinterName) + { + // Convert Unicode pPrinterName to a ANSI string pszPrinterName. + cch = wcslen(ppi5w[i].pPrinterName); + + pszPrinterName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszPrinterName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi5w[i].pPrinterName, -1, pszPrinterName, cch + 1, NULL, NULL); + StringCchCopyA(ppi5a[i].pPrinterName, cch + 1, pszPrinterName); + + HeapFree(hProcessHeap, 0, pszPrinterName); + } + + if (ppi5w[i].pPortName) + { + // Convert Unicode pPortName to a ANSI string pszPortName. + cch = wcslen(ppi5w[i].pPortName); + + pszPortName = HeapAlloc(hProcessHeap, 0, (cch + 1) * sizeof(CHAR)); + if (!pszPortName) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ERR("HeapAlloc failed!\n"); + goto Cleanup; + } + + WideCharToMultiByte(CP_ACP, 0, ppi5w[i].pPortName, -1, pszPortName, cch + 1, NULL, NULL); + StringCchCopyA(ppi5a[i].pPortName, cch + 1, pszPortName); + + HeapFree(hProcessHeap, 0, pszPortName); + } + break; + } + + } // switch + } // for + +Cleanup: + + return bReturnValue; } BOOL WINAPI
4 years, 10 months
1
0
0
0
[reactos] 01/01: [SHELLEXT][ZIPFLDR] Be case sensitive (#2292)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fcc4347898c72e7685698…
commit fcc4347898c72e76856983573e61ab159a169189 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Jan 30 15:05:50 2020 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Jan 30 15:05:50 2020 +0900 [SHELLEXT][ZIPFLDR] Be case sensitive (#2292) The filenames in a zip folder were all lowercase. Now the filenames are case sensitive. --- dll/shellext/zipfldr/CZipEnumerator.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dll/shellext/zipfldr/CZipEnumerator.hpp b/dll/shellext/zipfldr/CZipEnumerator.hpp index 2c36aac2ea9..9948413d908 100644 --- a/dll/shellext/zipfldr/CZipEnumerator.hpp +++ b/dll/shellext/zipfldr/CZipEnumerator.hpp @@ -52,7 +52,8 @@ public: name = tmp.Mid(len, pos - len); folder = true; } - tmp = name.MakeLower(); + tmp = name; + tmp.MakeLower(); POSITION it = m_Returned.Find(tmp); if (!name.IsEmpty() && !it)
4 years, 10 months
1
0
0
0
[reactos] 01/01: [SHELLEXT][ZIPFLDR] Use CStringA::FormatMessage (#2287)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9c5017808a5fe1f5ad7f3…
commit 9c5017808a5fe1f5ad7f3df9812b9907c077adb5 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Jan 30 08:32:21 2020 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Jan 30 08:32:21 2020 +0900 [SHELLEXT][ZIPFLDR] Use CStringA::FormatMessage (#2287) Simplify our code. --- dll/shellext/zipfldr/CConfirmReplace.cpp | 18 ++++-------------- dll/shellext/zipfldr/CZipPassword.cpp | 17 +++-------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/dll/shellext/zipfldr/CConfirmReplace.cpp b/dll/shellext/zipfldr/CConfirmReplace.cpp index 4f51ee6bb69..8ee027a52ec 100644 --- a/dll/shellext/zipfldr/CConfirmReplace.cpp +++ b/dll/shellext/zipfldr/CConfirmReplace.cpp @@ -25,21 +25,11 @@ public: HICON hIcon = LoadIcon(NULL, IDI_EXCLAMATION); SendDlgItemMessage(IDC_EXCLAMATION_ICON, STM_SETICON, (WPARAM)hIcon); - /* Our CString does not support FormatMessage yet */ - CStringA message(MAKEINTRESOURCE(IDS_OVERWRITEFILE_TEXT)); - CHeapPtr<CHAR, CLocalAllocator> formatted; + CStringA message; + message.FormatMessage(IDS_OVERWRITEFILE_TEXT, m_Filename.GetString()); + ::SetDlgItemTextA(m_hWnd, IDC_MESSAGE, message); - DWORD_PTR args[2] = - { - (DWORD_PTR)m_Filename.GetString(), - NULL - }; - - ::FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ARGUMENT_ARRAY, - message, 0, 0, (LPSTR)&formatted, 0, (va_list*)args); - - ::SetDlgItemTextA(m_hWnd, IDC_MESSAGE, formatted); - return 0; + return TRUE; } LRESULT OnButton(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) diff --git a/dll/shellext/zipfldr/CZipPassword.cpp b/dll/shellext/zipfldr/CZipPassword.cpp index 99c896029d0..0a1964a23d1 100644 --- a/dll/shellext/zipfldr/CZipPassword.cpp +++ b/dll/shellext/zipfldr/CZipPassword.cpp @@ -33,20 +33,9 @@ public: } else { - /* Our CString does not support FormatMessage yet */ - CStringA message(MAKEINTRESOURCE(IDS_PASSWORD_FILE_TEXT)); - CHeapPtr<CHAR, CLocalAllocator> formatted; - - DWORD_PTR args[2] = - { - (DWORD_PTR)m_Filename.GetString(), - NULL - }; - - ::FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ARGUMENT_ARRAY, - message, 0, 0, (LPSTR)&formatted, 0, (va_list*)args); - - ::SetDlgItemTextA(m_hWnd, IDC_MESSAGE, formatted); + CStringA message; + message.FormatMessage(IDS_PASSWORD_FILE_TEXT, m_Filename.GetString()); + ::SetDlgItemTextA(m_hWnd, IDC_MESSAGE, message); } return TRUE; }
4 years, 11 months
1
0
0
0
[reactos] 05/05: [SDK] Add some missing propsheet fields + validate struct sizes
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cd3c1e94ff4510ddfe27e…
commit cd3c1e94ff4510ddfe27e67d75bf9039fd926db8 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Fri Jan 24 20:43:06 2020 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Wed Jan 29 22:58:43 2020 +0100 [SDK] Add some missing propsheet fields + validate struct sizes --- modules/rostests/apitests/comctl32/propsheet.c | 98 +++++++++++++++++++------- sdk/include/psdk/prsht.h | 18 +++++ 2 files changed, 92 insertions(+), 24 deletions(-) diff --git a/modules/rostests/apitests/comctl32/propsheet.c b/modules/rostests/apitests/comctl32/propsheet.c index 9daf5b0a401..e4d7be568b4 100644 --- a/modules/rostests/apitests/comctl32/propsheet.c +++ b/modules/rostests/apitests/comctl32/propsheet.c @@ -1,9 +1,10 @@ /* * PROJECT: ReactOS api tests * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) - * PURPOSE: Test for property sheet + * PURPOSE: Test for v6 property sheet * COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) */ + #include "wine/test.h" #include <windows.h> #include <windowsx.h> @@ -73,41 +74,68 @@ Page1DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; } +#ifdef _MSC_VER +#define CHECK_STRUCT_SIZE(x, y) C_ASSERT((x) == (y)) +#else +// Can't do this compile time, thanks gcc +// 'error: non-nested function with variably modified type' +#define CHECK_STRUCT_SIZE(x, y) ok((x) == (y), "Wrong size for %s, got %u, expected %u\n", #x, y, x) +#endif + +// Validate struct sizes +static void test_StructSizes() +{ +#ifdef _M_X64 + CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V1_SIZE, 72); + CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V2_SIZE, 88); + CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V3_SIZE, 96); + CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V4_SIZE, 104); + CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V1_SIZE, 72); + CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V2_SIZE, 96); + + CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V1_SIZE, 72); + CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V2_SIZE, 88); + CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V3_SIZE, 96); + CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V4_SIZE, 104); + CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V1_SIZE, 72); + CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V2_SIZE, 96); +#else + CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V1_SIZE, 40); + CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V2_SIZE, 48); + CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V3_SIZE, 52); + CHECK_STRUCT_SIZE(PROPSHEETPAGEA_V4_SIZE, 56); + CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V1_SIZE, 40); + CHECK_STRUCT_SIZE(PROPSHEETHEADERA_V2_SIZE, 52); + + CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V1_SIZE, 40); + CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V2_SIZE, 48); + CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V3_SIZE, 52); + CHECK_STRUCT_SIZE(PROPSHEETPAGEW_V4_SIZE, 56); + CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V1_SIZE, 40); + CHECK_STRUCT_SIZE(PROPSHEETHEADERW_V2_SIZE, 52); +#endif +} + typedef HPROPSHEETPAGE (WINAPI *FN_CreatePropertySheetPageW)(LPCPROPSHEETPAGEW); typedef int (WINAPI *FN_PropertySheetW)(LPCPROPSHEETHEADERW); +static FN_CreatePropertySheetPageW pCreatePropertySheetPageW; +static FN_PropertySheetW pPropertySheetW; -START_TEST(propsheet) +// Show that the Apply button is not enabled by default +static void test_ApplyButtonDisabled() { - PROPSHEETPAGEW psp; - PROPSHEETHEADERW header; + PROPSHEETPAGEW psp = {0}; + PROPSHEETHEADERW header = {0}; HPROPSHEETPAGE hpsp[1]; - HMODULE hComCtl32; - FN_CreatePropertySheetPageW pCreatePropertySheetPageW; - FN_PropertySheetW pPropertySheetW; - - hComCtl32 = LoadLibraryW(L"comctl32.dll"); - pCreatePropertySheetPageW = (FN_CreatePropertySheetPageW)GetProcAddress(hComCtl32, "CreatePropertySheetPageW"); - pPropertySheetW = (FN_PropertySheetW)GetProcAddress(hComCtl32, "PropertySheetW"); - - ok(pCreatePropertySheetPageW != NULL, "pCreatePropertySheetPageW was NULL.\n"); - ok(pPropertySheetW != NULL, "pPropertySheetW was NULL.\n"); - - if (!pCreatePropertySheetPageW || !pPropertySheetW) - { - skip("!pCreatePropertySheetPageW || !pPropertySheetW\n"); - return; - } - ZeroMemory(&psp, sizeof(psp)); psp.dwSize = sizeof(psp); psp.dwFlags = PSP_DEFAULT; psp.hInstance = GetModuleHandleW(NULL); psp.pszTemplate = MAKEINTRESOURCEW(1); psp.pfnDlgProc = Page1DlgProc; - hpsp[0] = (*pCreatePropertySheetPageW)(&psp); + hpsp[0] = pCreatePropertySheetPageW(&psp); ok(hpsp[0] != NULL, "hpsp[0] was NULL.\n"); - ZeroMemory(&header, sizeof(header)); header.dwSize = sizeof(header); header.dwFlags = 0; header.hInstance = GetModuleHandleW(NULL); @@ -115,7 +143,29 @@ START_TEST(propsheet) header.nPages = ARRAYSIZE(hpsp); header.phpage = hpsp; header.pszCaption = L"propsheet"; - ok((*pPropertySheetW)(&header) > 0, "PropertySheet returned non-positive value.\n"); + ok(pPropertySheetW(&header) > 0, "PropertySheet returned non-positive value.\n"); +} + + +START_TEST(propsheet) +{ + HMODULE hComCtl32; + + hComCtl32 = LoadLibraryW(L"comctl32.dll"); + pCreatePropertySheetPageW = (FN_CreatePropertySheetPageW)GetProcAddress(hComCtl32, "CreatePropertySheetPageW"); + pPropertySheetW = (FN_PropertySheetW)GetProcAddress(hComCtl32, "PropertySheetW"); + + ok(pCreatePropertySheetPageW != NULL, "pCreatePropertySheetPageW was NULL.\n"); + ok(pPropertySheetW != NULL, "pPropertySheetW was NULL.\n"); + + if (!pCreatePropertySheetPageW || !pPropertySheetW) + { + skip("!pCreatePropertySheetPageW || !pPropertySheetW\n"); + return; + } + + test_StructSizes(); + test_ApplyButtonDisabled(); FreeLibrary(hComCtl32); } diff --git a/sdk/include/psdk/prsht.h b/sdk/include/psdk/prsht.h index 0356c7e247e..a35537ebe4c 100644 --- a/sdk/include/psdk/prsht.h +++ b/sdk/include/psdk/prsht.h @@ -194,6 +194,15 @@ typedef struct _PROPSHEETPAGEA { LPCSTR pszHeaderTitle; LPCSTR pszHeaderSubTitle; #endif +#if (_WIN32_IE >= 0x0501) + HANDLE hActCtx; +#endif +#if (_WIN32_IE >= 0x0600) + _ANONYMOUS_UNION union { + HBITMAP hbmHeader; + LPCSTR pszbmHeader; + } DUMMYUNIONNAME3; +#endif } PROPSHEETPAGEA,*LPPROPSHEETPAGEA, PROPSHEETPAGEA_LATEST, *LPPROPSHEETPAGEA_LATEST; typedef const PROPSHEETPAGEA *LPCPROPSHEETPAGEA, *LPCPROPSHEETPAGEA_LATEST; @@ -222,6 +231,15 @@ typedef struct _PROPSHEETPAGEW { LPCWSTR pszHeaderTitle; LPCWSTR pszHeaderSubTitle; #endif +#if (_WIN32_IE >= 0x0501) + HANDLE hActCtx; +#endif +#if (_WIN32_IE >= 0x0600) + _ANONYMOUS_UNION union { + HBITMAP hbmHeader; + LPCWSTR pszbmHeader; + } DUMMYUNIONNAME3; +#endif } PROPSHEETPAGEW,*LPPROPSHEETPAGEW, PROPSHEETPAGEW_LATEST, *LPPROPSHEETPAGEW_LATEST; typedef const PROPSHEETPAGEW *LPCPROPSHEETPAGEW, *LPCPROPSHEETPAGEW_LATEST;
4 years, 11 months
1
0
0
0
[reactos] 04/05: [CMLIB] Use UNIMPLEMENTED_ONCE in HvHiveWillShrink
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=db55933b0ca1a095f8e31…
commit db55933b0ca1a095f8e3136053ae8b514c3dc908 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Fri Jan 24 20:09:07 2020 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Wed Jan 29 22:58:43 2020 +0100 [CMLIB] Use UNIMPLEMENTED_ONCE in HvHiveWillShrink --- sdk/include/host/typedefs.h | 1 + sdk/lib/cmlib/hivewrt.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/include/host/typedefs.h b/sdk/include/host/typedefs.h index d3bea3bbcef..eaa2c9f5c06 100644 --- a/sdk/include/host/typedefs.h +++ b/sdk/include/host/typedefs.h @@ -27,6 +27,7 @@ /* Basic definitions */ #define UNIMPLEMENTED { printf("%s unimplemented\n", __FUNCTION__); exit(1); } +#define UNIMPLEMENTED_ONCE { printf("%s unimplemented\n", __FUNCTION__); exit(1); } #define ASSERT(x) assert(x) #define ASSERTMSG(m, x) assert(x) #define DPRINT if (0) printf diff --git a/sdk/lib/cmlib/hivewrt.c b/sdk/lib/cmlib/hivewrt.c index ef4ceb001b6..76bf72b1b45 100644 --- a/sdk/lib/cmlib/hivewrt.c +++ b/sdk/lib/cmlib/hivewrt.c @@ -277,7 +277,7 @@ CMAPI HvHiveWillShrink(IN PHHIVE RegistryHive) { /* No shrinking yet */ - UNIMPLEMENTED; + UNIMPLEMENTED_ONCE; return FALSE; }
4 years, 11 months
1
0
0
0
[reactos] 03/05: [WIN32SS] Demote a trace message
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bbc97e964f12ebdfaf587…
commit bbc97e964f12ebdfaf5874d66824aa7395e0b027 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Fri Jan 24 20:08:20 2020 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Wed Jan 29 22:58:43 2020 +0100 [WIN32SS] Demote a trace message --- win32ss/user/ntuser/msgqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32ss/user/ntuser/msgqueue.c b/win32ss/user/ntuser/msgqueue.c index 04d2e06ef94..2f5d324c1ce 100644 --- a/win32ss/user/ntuser/msgqueue.c +++ b/win32ss/user/ntuser/msgqueue.c @@ -2199,7 +2199,7 @@ MsqIsHung(PTHREADINFO pti, DWORD TimeOut) !PsGetThreadFreezeCount(pti->pEThread) && !(pti->ppi->W32PF_flags & W32PF_APPSTARTING)) { - ERR("\nMsqIsHung(pti %p, TimeOut %lu)\n" + TRACE("\nMsqIsHung(pti %p, TimeOut %lu)\n" "pEThread %p, ThreadsProcess %p, ImageFileName '%s'\n" "dwTimeStamp = %lu\n" "pti->pcti->timeLastRead = %lu\n"
4 years, 11 months
1
0
0
0
[reactos] 02/05: [SYSSETUP] Zero out propsheet data fields This prevents +propsheet logging accessing uninitialized data
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=09edc062baf04e382008a…
commit 09edc062baf04e382008ae5a255812c98499eb52 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Fri Jan 24 20:07:38 2020 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Wed Jan 29 22:58:42 2020 +0100 [SYSSETUP] Zero out propsheet data fields This prevents +propsheet logging accessing uninitialized data --- dll/win32/syssetup/wizard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dll/win32/syssetup/wizard.c b/dll/win32/syssetup/wizard.c index bd5e6118301..d3aaf7c71f3 100644 --- a/dll/win32/syssetup/wizard.c +++ b/dll/win32/syssetup/wizard.c @@ -2661,7 +2661,7 @@ typedef DWORD(WINAPI *PFNREQUESTWIZARDPAGES)(PDWORD, HPROPSHEETPAGE *, PSETUPDAT VOID InstallWizard(VOID) { - PROPSHEETHEADER psh; + PROPSHEETHEADER psh = {0}; HPROPSHEETPAGE *phpage = NULL; PROPSHEETPAGE psp = {0}; UINT nPages = 0;
4 years, 11 months
1
0
0
0
[reactos] 01/05: [NEWDEV] Zero out propsheet data fields This prevents +propsheet logging accessing uninitialized data
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=097355db60f1e6543c9d0…
commit 097355db60f1e6543c9d0f2eeab04e8f32c4e398 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Fri Jan 24 20:07:24 2020 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Wed Jan 29 22:58:42 2020 +0100 [NEWDEV] Zero out propsheet data fields This prevents +propsheet logging accessing uninitialized data --- dll/win32/newdev/wizard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dll/win32/newdev/wizard.c b/dll/win32/newdev/wizard.c index a592456808e..ee24b059d8a 100644 --- a/dll/win32/newdev/wizard.c +++ b/dll/win32/newdev/wizard.c @@ -1300,9 +1300,9 @@ DisplayWizard( IN HWND hwndParent, IN UINT startPage) { - PROPSHEETHEADER psh; + PROPSHEETHEADER psh = {0}; HPROPSHEETPAGE ahpsp[IDD_MAXIMUMPAGE + 1]; - PROPSHEETPAGE psp; + PROPSHEETPAGE psp = {0}; /* zero based index */ startPage -= IDD_FIRSTPAGE;
4 years, 11 months
1
0
0
0
← Newer
1
2
3
4
...
14
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Results per page:
10
25
50
100
200