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
April 2017
----- 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
14 participants
179 discussions
Start a n
N
ew thread
[tfaber] 74436: [NTOS:IO] - Fix some extremely broken casts
by tfaber@svn.reactos.org
Author: tfaber Date: Sun Apr 30 19:24:53 2017 New Revision: 74436 URL:
http://svn.reactos.org/svn/reactos?rev=74436&view=rev
Log: [NTOS:IO] - Fix some extremely broken casts Modified: trunk/reactos/ntoskrnl/io/iomgr/error.c Modified: trunk/reactos/ntoskrnl/io/iomgr/error.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/error.c?…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/error.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/error.c [iso-8859-1] Sun Apr 30 19:24:53 2017 @@ -486,11 +486,7 @@ VOID NTAPI -IopFreeApc(IN PKAPC Apc, - IN PKNORMAL_ROUTINE *NormalRoutine, - IN PVOID *NormalContext, - IN PVOID *SystemArgument1, - IN PVOID *SystemArgument2) +IopFreeApc(IN PKAPC Apc) { /* Free the APC */ ExFreePool(Apc); @@ -498,15 +494,13 @@ VOID NTAPI -IopRaiseHardError(IN PKAPC Apc, - IN PKNORMAL_ROUTINE *NormalRoutine, - IN PVOID *NormalContext, - IN PVOID *SystemArgument1, - IN PVOID *SystemArgument2) -{ - PIRP Irp = (PIRP)NormalContext; - //PVPB Vpb = (PVPB)SystemArgument1; - //PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT)SystemArgument2; +IopRaiseHardError(IN PVOID NormalContext, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2) +{ + PIRP Irp = NormalContext; + //PVPB Vpb = SystemArgument1; + //PDEVICE_OBJECT DeviceObject = SystemArgument2; UNIMPLEMENTED; @@ -683,8 +677,8 @@ &Thread->Tcb, Irp->ApcEnvironment, NULL, - (PKRUNDOWN_ROUTINE)IopFreeApc, - (PKNORMAL_ROUTINE)IopRaiseHardError, + IopFreeApc, + IopRaiseHardError, KernelMode, Irp);
7 years, 7 months
1
0
0
0
[tfaber] 74435: [WIN32K] - Check for null members when cleaning up DCs and brushes. Fixes crashes in some failure cases when running out of GDI handles. CORE-13155
by tfaber@svn.reactos.org
Author: tfaber Date: Sun Apr 30 18:41:56 2017 New Revision: 74435 URL:
http://svn.reactos.org/svn/reactos?rev=74435&view=rev
Log: [WIN32K] - Check for null members when cleaning up DCs and brushes. Fixes crashes in some failure cases when running out of GDI handles. CORE-13155 Modified: trunk/reactos/win32ss/gdi/eng/engbrush.c trunk/reactos/win32ss/gdi/ntgdi/dclife.c Modified: trunk/reactos/win32ss/gdi/eng/engbrush.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engbrush.c…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/engbrush.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/engbrush.c [iso-8859-1] Sun Apr 30 18:41:56 2017 @@ -175,9 +175,18 @@ } /* Dereference the palettes */ - PALETTE_ShareUnlockPalette(pebo->ppalSurf); - PALETTE_ShareUnlockPalette(pebo->ppalDC); - if (pebo->ppalDIB) PALETTE_ShareUnlockPalette(pebo->ppalDIB); + if (pebo->ppalSurf) + { + PALETTE_ShareUnlockPalette(pebo->ppalSurf); + } + if (pebo->ppalDC) + { + PALETTE_ShareUnlockPalette(pebo->ppalDC); + } + if (pebo->ppalDIB) + { + PALETTE_ShareUnlockPalette(pebo->ppalDIB); + } } VOID Modified: trunk/reactos/win32ss/gdi/ntgdi/dclife.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/dclife.c…
============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/dclife.c [iso-8859-1] Sun Apr 30 18:41:56 2017 @@ -91,7 +91,6 @@ /* Insert the object */ if (!GDIOBJ_hInsertObject(&pdc->BaseObject, GDI_OBJ_HMGR_POWNED)) { - /// FIXME: this is broken, since the DC is not initialized yet... DPRINT1("Could not insert DC into handle table.\n"); GDIOBJ_vFreeObject(&pdc->BaseObject); return NULL; @@ -370,7 +369,8 @@ EBRUSHOBJ_vCleanup(&pdc->eboBackground); /* Release font */ - LFONT_ShareUnlockFont(pdc->dclevel.plfnt); + if (pdc->dclevel.plfnt) + LFONT_ShareUnlockFont(pdc->dclevel.plfnt); /* Free regions */ if (pdc->dclevel.prgnClip) @@ -394,10 +394,11 @@ pdc->dclevel.hPath = 0; pdc->dclevel.flPath = 0; } - if(pdc->dclevel.pSurface) + if (pdc->dclevel.pSurface) SURFACE_ShareUnlockSurface(pdc->dclevel.pSurface); - PDEVOBJ_vRelease(pdc->ppdev); + if (pdc->ppdev) + PDEVOBJ_vRelease(pdc->ppdev); } VOID
7 years, 7 months
1
0
0
0
[ekohl] 74434: [INTL] - Get rid of alloca, malloc and free. - Always check the return values of HeapAlloc. - Rename fUserLocaleChanged to bUserLocaleChanged and fGeoIdChanged to bGeoIdChanged. - Us...
by ekohl@svn.reactos.org
Author: ekohl Date: Sun Apr 30 15:39:41 2017 New Revision: 74434 URL:
http://svn.reactos.org/svn/reactos?rev=74434&view=rev
Log: [INTL] - Get rid of alloca, malloc and free. - Always check the return values of HeapAlloc. - Rename fUserLocaleChanged to bUserLocaleChanged and fGeoIdChanged to bGeoIdChanged. - Use WCHAR instead of TCHAR. - Fix indentation and coding style. - Remove setupreg.c because it is an unused copy of misc.c. Removed: trunk/reactos/dll/cpl/intl/setupreg.c Modified: trunk/reactos/dll/cpl/intl/advanced.c trunk/reactos/dll/cpl/intl/currency.c trunk/reactos/dll/cpl/intl/date.c trunk/reactos/dll/cpl/intl/generalp.c trunk/reactos/dll/cpl/intl/intl.c trunk/reactos/dll/cpl/intl/intl.h trunk/reactos/dll/cpl/intl/misc.c trunk/reactos/dll/cpl/intl/numbers.c trunk/reactos/dll/cpl/intl/sort.c trunk/reactos/dll/cpl/intl/time.c Modified: trunk/reactos/dll/cpl/intl/advanced.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/advanced.c?re…
============================================================================== --- trunk/reactos/dll/cpl/intl/advanced.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/advanced.c [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -188,15 +188,15 @@ if (bNoShow == FALSE) { - index = SendMessageW(hLangList, - CB_ADDSTRING, - 0, - (LPARAM)lang); - - SendMessageW(hLangList, - CB_SETITEMDATA, - index, - (LPARAM)lcid); + index = SendMessageW(hLangList, + CB_ADDSTRING, + 0, + (LPARAM)lang); + + SendMessageW(hLangList, + CB_SETITEMDATA, + index, + (LPARAM)lcid); } return TRUE; @@ -245,7 +245,10 @@ return; } } - else wsprintf(szDPI, L"%d", dwDPI); + else + { + wsprintf(szDPI, L"%d", dwDPI); + } RegCloseKey(hKey); } @@ -266,7 +269,6 @@ wsprintf(szSection, L"Font.CP%s.%s", szDefCP, szDPI); hFontInf = SetupOpenInfFileW(L"font.inf", NULL, INF_STYLE_WIN4, NULL); - if (hFontInf == INVALID_HANDLE_VALUE) return; @@ -277,12 +279,15 @@ } Count = (UINT) SetupGetLineCount(hFontInf, szSection); - if (Count <= 0) return; + if (Count <= 0) + return; if (!SetupInstallFromInfSectionW(hwnd, hFontInf, szSection, SPINST_REGISTRY & ~SPINST_FILES, NULL, NULL, 0, NULL, NULL, NULL, NULL)) + { MessageBoxW(hwnd, L"Unable to install a new language for programs don't support unicode!", NULL, MB_ICONERROR | MB_OK); + } SetupCloseInfFile(hFontInf); } @@ -421,10 +426,7 @@ break; case WM_NOTIFY: - { - LPNMHDR lpnm = (LPNMHDR)lParam; - - if (lpnm->code == (UINT)PSN_APPLY) + if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg); @@ -432,8 +434,7 @@ SaveFontSubstitutionSettings(hwndDlg, pGlobalData); SaveFontLinkingSettings(hwndDlg, pGlobalData); } - } - break; + break; } return FALSE; Modified: trunk/reactos/dll/cpl/intl/currency.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/currency.c?re…
============================================================================== --- trunk/reactos/dll/cpl/intl/currency.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/currency.c [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -439,7 +439,7 @@ if (!SetCurrencyFieldSep(hwndDlg, pGlobalData)) break; - pGlobalData->fUserLocaleChanged = TRUE; + pGlobalData->bUserLocaleChanged = TRUE; UpdateExamples(hwndDlg, pGlobalData); } Modified: trunk/reactos/dll/cpl/intl/date.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/date.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/date.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/date.c [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -55,9 +55,8 @@ UINT nDateCompCount=0; UINT nDateSepCount=0; - pszFoundSep = (LPWSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); - - if(!pszFoundSep) + pszFoundSep = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); + if (pszFoundSep == NULL) return NULL; wcscpy(pszFoundSep,STD_DATE_SEP); @@ -171,15 +170,19 @@ } pszFoundSep = FindDateSep(szShortDateFmt); - - /* Substring replacement of separator */ - wcscpy(szFoundDateSep, pszFoundSep); - pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFoundDateSep); - wcscpy(szShortDateFmt, pszResultStr); - free(pszResultStr); - - if (pszFoundSep) - free(pszFoundSep); + if (pszFoundSep != NULL) + { + /* Substring replacement of separator */ + wcscpy(szFoundDateSep, pszFoundSep); + pszResultStr = ReplaceSubStr(szShortDateFmt, szShortDateSep, szFoundDateSep); + if (pszResultStr != NULL) + { + wcscpy(szShortDateFmt, pszResultStr); + HeapFree(GetProcessHeap(), 0, pszResultStr); + } + + HeapFree(GetProcessHeap(), 0, pszFoundSep); + } /* Save short date format */ wcscpy(pGlobalData->szShortDateFormat, szShortDateFmt); @@ -393,19 +396,19 @@ hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR); /* Get spin value */ - nSpinVal=LOWORD(SendMessageW(hWndYearSpin, - UDM_GETPOS, - 0, - 0)); + nSpinVal = LOWORD(SendMessageW(hWndYearSpin, + UDM_GETPOS, + 0, + 0)); /* convert to wide char */ _itow(nSpinVal, szMaxDateVal, DECIMAL_RADIX); /* Save max date value */ SetCalendarInfoW(lcid, - CAL_GREGORIAN, - 48 , /* CAL_ITWODIGITYEARMAX */ - (PCWSTR)szMaxDateVal); + CAL_GREGORIAN, + 48 , /* CAL_ITWODIGITYEARMAX */ + (PCWSTR)szMaxDateVal); } /* Get max date value from registry set */ @@ -457,13 +460,13 @@ /* Limit text lengths */ SendDlgItemMessageW(hwndDlg, IDC_FIRSTYEAR_EDIT, - EM_LIMITTEXT, - MAX_YEAR_EDIT, - 0); + EM_LIMITTEXT, + MAX_YEAR_EDIT, + 0); SendDlgItemMessageW(hwndDlg, IDC_SECONDYEAR_EDIT, - EM_LIMITTEXT, - MAX_YEAR_EDIT, - 0); + EM_LIMITTEXT, + MAX_YEAR_EDIT, + 0); hWndYearSpin = GetDlgItem(hwndDlg, IDC_SCR_MAX_YEAR); @@ -584,7 +587,7 @@ if (!SetShortDateSep(hwndDlg, pGlobalData)) break; - pGlobalData->fUserLocaleChanged = TRUE; + pGlobalData->bUserLocaleChanged = TRUE; SetMaxDate(hwndDlg, pGlobalData->UserLCID); InitShortDateCB(hwndDlg, pGlobalData); Modified: trunk/reactos/dll/cpl/intl/generalp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/generalp.c?re…
============================================================================== --- trunk/reactos/dll/cpl/intl/generalp.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/generalp.c [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -1429,7 +1429,7 @@ SetNewLocale(pGlobalData, NewLcid); UpdateLocaleSample(hwndDlg, pGlobalData); - pGlobalData->fUserLocaleChanged = TRUE; + pGlobalData->bUserLocaleChanged = TRUE; PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } @@ -1456,7 +1456,7 @@ break; pGlobalData->geoid = NewGeoID; - pGlobalData->fGeoIdChanged = TRUE; + pGlobalData->bGeoIdChanged = TRUE; PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } @@ -1466,7 +1466,7 @@ if (CustomizeLocalePropertySheet(GetParent(hwndDlg), pGlobalData) > 0) { UpdateLocaleSample(hwndDlg, pGlobalData); - pGlobalData->fUserLocaleChanged = TRUE; + pGlobalData->bUserLocaleChanged = TRUE; PropSheet_Changed(GetParent(hwndDlg), hwndDlg); } break; @@ -1474,30 +1474,26 @@ break; case WM_NOTIFY: + if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) { - LPNMHDR lpnm = (LPNMHDR)lParam; - - if (lpnm->code == (UINT)PSN_APPLY) + /* Apply changes */ + PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg); + + /* Set new locale */ + if (pGlobalData->bUserLocaleChanged == TRUE) { - /* Apply changes */ - PropSheet_UnChanged(GetParent(hwndDlg), hwndDlg); - - /* Set new locale */ - if (pGlobalData->fUserLocaleChanged == TRUE) - { - SaveCurrentLocale(pGlobalData); - pGlobalData->fUserLocaleChanged = FALSE; - } - - /* Set new GEO ID */ - if (pGlobalData->fGeoIdChanged == TRUE) - { - SaveGeoID(pGlobalData); - pGlobalData->fGeoIdChanged = FALSE; - } - - AddNewKbLayoutsByLcid(pGlobalData->UserLCID); + SaveCurrentLocale(pGlobalData); + pGlobalData->bUserLocaleChanged = FALSE; } + + /* Set new GEO ID */ + if (pGlobalData->bGeoIdChanged == TRUE) + { + SaveGeoID(pGlobalData); + pGlobalData->bGeoIdChanged = FALSE; + } + + AddNewKbLayoutsByLcid(pGlobalData->UserLCID); } break; } Modified: trunk/reactos/dll/cpl/intl/intl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/intl.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/intl.c [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -51,16 +51,16 @@ VOID PrintErrorMsgBox(UINT msg) { - TCHAR szErrorText[BUFFERSIZE]; - TCHAR szErrorCaption[BUFFERSIZE]; - - LoadString(hApplet, msg, szErrorText, sizeof(szErrorText)/sizeof(TCHAR)); - LoadString(hApplet, IDS_ERROR, szErrorCaption, sizeof(szErrorCaption)/sizeof(TCHAR)); - - MessageBox(NULL, szErrorText, szErrorCaption, MB_OK | MB_ICONERROR); -} - -VOID + WCHAR szErrorText[BUFFERSIZE]; + WCHAR szErrorCaption[BUFFERSIZE]; + + LoadStringW(hApplet, msg, szErrorText, sizeof(szErrorText) / sizeof(WCHAR)); + LoadStringW(hApplet, IDS_ERROR, szErrorCaption, sizeof(szErrorCaption) / sizeof(WCHAR)); + + MessageBoxW(NULL, szErrorText, szErrorCaption, MB_OK | MB_ICONERROR); +} + +INT ResourceMessageBox( HWND hwnd, UINT uType, @@ -73,7 +73,7 @@ LoadStringW(hApplet, uMessageId, szErrorText, sizeof(szErrorText) / sizeof(WCHAR)); LoadStringW(hApplet, uCaptionId, szErrorCaption, sizeof(szErrorCaption) / sizeof(WCHAR)); - MessageBoxW(hwnd, szErrorText, szErrorCaption, uType); + return MessageBoxW(hwnd, szErrorText, szErrorCaption, uType); } static VOID Modified: trunk/reactos/dll/cpl/intl/intl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.h?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/intl.h [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/intl.h [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -12,7 +12,6 @@ #include <winuser.h> #include <cpl.h> #include <setupapi.h> -#include <malloc.h> #include <ndk/exfuncs.h> #include "resource.h" @@ -110,11 +109,11 @@ LCID UserLCID; LCID SystemLCID; - BOOL fUserLocaleChanged; + BOOL bUserLocaleChanged; BOOL bApplyToDefaultUser; GEOID geoid; - BOOL fGeoIdChanged; + BOOL bGeoIdChanged; /* Misc */ BOOL bIsUserAdmin; @@ -134,7 +133,7 @@ /* intl.c */ VOID PrintErrorMsgBox(UINT msg); -VOID +INT ResourceMessageBox( HWND hwnd, UINT uType, Modified: trunk/reactos/dll/cpl/intl/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/misc.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/misc.c [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -9,7 +9,9 @@ INT nStrCnt; INT nStrSize; - pszDestStr = (PWSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); + pszDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); + if (pszDestStr == NULL) + return NULL; wcscpy(pszDestStr, szInsStr); @@ -45,7 +47,9 @@ INT nSpaceOffset = 0; BOOL wasNul=FALSE; - pszDestStr = (PWSTR)malloc(255 * sizeof(WCHAR)); + pszDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, 255 * sizeof(WCHAR)); + if (pszDestStr == NULL) + return NULL; wcscpy(pszDestStr, szSourceStr); @@ -80,7 +84,7 @@ /* Insert space to finded position plus all pos before */ pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset); wcscpy(pszDestStr,pszTempStr); - free(pszTempStr); + HeapFree(GetProcessHeap(), 0, pszTempStr); /* Num of spaces total increment */ if (!wasNul) @@ -102,7 +106,7 @@ { pszTempStr = InsSpacePos(pszDestStr, nFmtCount); wcscpy(pszDestStr, pszTempStr); - free(pszTempStr); + HeapFree(GetProcessHeap(), 0, pszTempStr); } } @@ -121,7 +125,9 @@ UINT nDestStrCnt; UINT nFirstCharCnt; - szDestStr = (PWSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); + szDestStr = (PWSTR)HeapAlloc(GetProcessHeap(), 0, MAX_SAMPLES_STR_SIZE * sizeof(WCHAR)); + if (szDestStr == NULL) + return NULL; nDestStrCnt = 0; nFirstCharCnt = 0; Modified: trunk/reactos/dll/cpl/intl/numbers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/numbers.c?rev…
============================================================================== --- trunk/reactos/dll/cpl/intl/numbers.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/numbers.c [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -198,11 +198,14 @@ for (nCBIndex = 0; nCBIndex < MAX_FIELD_DIG_SAMPLES; nCBIndex++) { pszFieldDigNumSmpl = InsSpacesFmt(SAMPLE_NUMBER, lpFieldDigNumSamples[nCBIndex]); - SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING, - CB_ADDSTRING, - 0, - (LPARAM)pszFieldDigNumSmpl); - free(pszFieldDigNumSmpl); + if (pszFieldDigNumSmpl != NULL) + { + SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING, + CB_ADDSTRING, + 0, + (LPARAM)pszFieldDigNumSmpl); + HeapFree(GetProcessHeap(), 0, pszFieldDigNumSmpl); + } } SendDlgItemMessageW(hwndDlg, IDC_NUMBERSDGROUPING, @@ -280,18 +283,24 @@ pszResultStr = ReplaceSubStr(lpNegNumFmtSamples[nCBIndex], pGlobalData->szNumDecimalSep, L","); - wcscpy(szNewSample, pszResultStr); - free(pszResultStr); + if (pszResultStr != NULL) + { + wcscpy(szNewSample, pszResultStr); + HeapFree(GetProcessHeap(), 0, pszResultStr); + } /* Replace standard negative sign to setted */ pszResultStr = ReplaceSubStr(szNewSample, pGlobalData->szNumNegativeSign, L"-"); - SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT, - CB_ADDSTRING, - 0, - (LPARAM)pszResultStr); - free(pszResultStr); + if (pszResultStr != NULL) + { + SendDlgItemMessageW(hwndDlg, IDC_NUMBERSNNUMFORMAT, + CB_ADDSTRING, + 0, + (LPARAM)pszResultStr); + HeapFree(GetProcessHeap(), 0, pszResultStr); + } } /* Set current item to value from registry */ @@ -320,11 +329,14 @@ pszResultStr = ReplaceSubStr(lpLeadNumFmtSamples[nCBIndex], pGlobalData->szNumDecimalSep, L","); - SendDlgItemMessage(hwndDlg, IDC_NUMBERSDISPLEADZER, - CB_ADDSTRING, - 0, - (LPARAM)pszResultStr); - free(pszResultStr); + if (pszResultStr != NULL) + { + SendDlgItemMessage(hwndDlg, IDC_NUMBERSDISPLEADZER, + CB_ADDSTRING, + 0, + (LPARAM)pszResultStr); + HeapFree(GetProcessHeap(), 0, pszResultStr); + } } /* Set current item to value from registry */ @@ -692,7 +704,7 @@ if (!SetNumUnitsSys(hwndDlg, pGlobalData)) break; - pGlobalData->fUserLocaleChanged = TRUE; + pGlobalData->bUserLocaleChanged = TRUE; UpdateNumSamples(hwndDlg, pGlobalData); } Removed: trunk/reactos/dll/cpl/intl/setupreg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/setupreg.c?re…
============================================================================== --- trunk/reactos/dll/cpl/intl/setupreg.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/setupreg.c (removed) @@ -1,231 +0,0 @@ -/* - * PROJECT: ReactOS International Control Panel - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/cpl/intl/setupreg.c - * PURPOSE: ReactOS International Control Panel - * PROGRAMMERS: Alexey Zavyalov (gen_x(a)mail.ru) -*/ - -/* INCLUDES *****************************************************************/ - -#include "intl.h" - -/* GLOBALS ******************************************************************/ - -#define NUM_SHEETS 4 - -/* FUNCTIONS ****************************************************************/ - -/* Insert the space */ -TCHAR* -InsSpacePos(const TCHAR *szInsStr, const int nPos) -{ - LPTSTR pszDestStr; - int nDestStrCnt=0; - int nStrCnt; - int nStrSize; - - pszDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR)); - - _tcscpy(pszDestStr, szInsStr); - - nStrSize = _tcslen(szInsStr); - - for (nStrCnt = 0; nStrCnt < nStrSize; nStrCnt++) - { - if (nStrCnt == nStrSize - nPos) - { - pszDestStr[nDestStrCnt] = _T(' '); - nDestStrCnt++; - } - - pszDestStr[nDestStrCnt] = szInsStr[nStrCnt]; - nDestStrCnt++; - } - - pszDestStr[nDestStrCnt] = _T('\0'); - - return pszDestStr; -} - -/* Insert the spaces by format string separated by ';' */ -LPTSTR -InsSpacesFmt(const TCHAR *szSourceStr, const TCHAR *szFmtStr) -{ - LPTSTR pszDestStr; - LPTSTR pszTempStr; - TCHAR szFmtVal[255]; - int nFmtCount=0; - int nValCount=0; - int nLastVal=0; - int nSpaceOffset=0; - BOOL wasNul=FALSE; - - pszDestStr = (LPTSTR) malloc(255 * sizeof(TCHAR)); - - _tcscpy(pszDestStr, szSourceStr); - - /* If format is clean return source string */ - if (!*szFmtStr) - return pszDestStr; - - /* Search for all format values */ - for (nFmtCount = 0; nFmtCount <= (int)_tcslen(szFmtStr); nFmtCount++) - { - if (szFmtStr[nFmtCount] == _T(';') || szFmtStr[nFmtCount] == _T('\0')) - { - if (_ttoi(szFmtVal) == 0 && !wasNul) - { - wasNul = TRUE; - break; - } - - /* If was 0, repeat spaces */ - if (wasNul) - { - nSpaceOffset += nLastVal; - } - else - { - nSpaceOffset += _ttoi(szFmtVal); - } - - szFmtVal[nValCount] = _T('\0'); - nValCount=0; - - /* Insert space to finded position plus all pos before */ - pszTempStr = InsSpacePos(pszDestStr, nSpaceOffset); - _tcscpy(pszDestStr, pszTempStr); - free(pszTempStr); - - /* Num of spaces total increment */ - if (!wasNul) - { - nSpaceOffset++; - nLastVal = _ttoi(szFmtVal); - } - } - else - { - szFmtVal[nValCount++] = szFmtStr[nFmtCount]; - } - } - - /* Create spaces for rest part of string */ - if (wasNul && nLastVal!=0) - { - for (nFmtCount = nSpaceOffset + nLastVal; nFmtCount < _tcslen(pszDestStr); nFmtCount += nLastVal + 1) - { - pszTempStr = InsSpacePos(pszDestStr, nFmtCount); - _tcscpy(pszDestStr,pszTempStr); - free(pszTempStr); - } - } - - return pszDestStr; -} - -/* Replace given template in source string with string to replace and return received string */ -TCHAR* -ReplaceSubStr(const TCHAR *szSourceStr, - const TCHAR *szStrToReplace, - const TCHAR *szTempl) -{ - int nCharCnt; - int nSubStrCnt; - int nDestStrCnt; - int nFirstCharCnt; - LPTSTR szDestStr; - - szDestStr = (LPTSTR)malloc(MAX_SAMPLES_STR_SIZE * sizeof(TCHAR)); - nDestStrCnt = 0; - nFirstCharCnt = 0; - - _tcscpy(szDestStr, _T(L"")); - - while (nFirstCharCnt < (int)_tcslen(szSourceStr)) - { - if (szSourceStr[nFirstCharCnt] == szTempl[0]) - { - nSubStrCnt=0; - for (nCharCnt = nFirstCharCnt; nCharCnt < nFirstCharCnt + (int)_tcslen(szTempl); nCharCnt++) - { - if (szSourceStr[nCharCnt] == szTempl[nSubStrCnt]) - { - nSubStrCnt++; - } - else - { - break; - } - - if ((int)_tcslen(szTempl) == nSubStrCnt) - { - _tcscat(szDestStr, szStrToReplace); - nDestStrCnt = (int)_tcslen(szDestStr); - nFirstCharCnt += (int)_tcslen(szTempl) - 1; - break; - } - } - } - else - { - szDestStr[nDestStrCnt++] = wszSourceStr[nFirstCharCnt]; - szDestStr[nDestStrCnt] = _T('\0'); - } - - nFirstCharCnt++; - } - - return szDestStr; -} - -static -VOID -InitPropSheetPage(PROPSHEETPAGE *PsPage, WORD IdDlg, DLGPROC DlgProc) -{ - ZeroMemory(PsPage, sizeof(PROPSHEETPAGE)); - PsPage->dwSize = sizeof(PROPSHEETPAGE); - PsPage->dwFlags = PSP_DEFAULT; - PsPage->hInstance = hApplet; - PsPage->pszTemplate = MAKEINTRESOURCE(IdDlg); - PsPage->pfnDlgProc = DlgProc; -} - -/* Create applets */ -LONG -APIENTRY -SetupApplet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam) -{ - - PROPSHEETPAGE PsPage[NUM_SHEETS]; - PROPSHEETHEADER psh; - TCHAR Caption[MAX_STR_SIZE]; - - UNREFERENCED_PARAMETER(lParam); - UNREFERENCED_PARAMETER(wParam); - UNREFERENCED_PARAMETER(uMsg); - UNREFERENCED_PARAMETER(hwnd); - - LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR)); - - ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USECALLBACK | PSH_PROPTITLE; - psh.hwndParent = NULL; - psh.hInstance = hApplet; - psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDC_CPLICON)); - psh.pszCaption = Caption; - psh.nPages = sizeof(PsPage) / sizeof(PROPSHEETPAGE); - psh.nStartPage = 0; - psh.ppsp = PsPage; - - InitPropSheetPage(&PsPage[0], IDD_NUMSOPTSSETUP, NumsOptsSetProc); - InitPropSheetPage(&PsPage[1], IDD_CURRENCYOPTSSETUP, CurrencyOptsSetProc); - InitPropSheetPage(&PsPage[2], IDD_TIMEOPTSSETUP, TimeOptsSetProc); - InitPropSheetPage(&PsPage[3], IDD_DATEOPTSSETUP, DateOptsSetProc); - - return (LONG)(PropertySheet(&psh) != -1); -} - -/* EOF */ Modified: trunk/reactos/dll/cpl/intl/sort.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/sort.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/sort.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/sort.c [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -198,7 +198,7 @@ /* Save the new LCID */ pGlobalData->UserLCID = NewLcid; - pGlobalData->fUserLocaleChanged = TRUE; + pGlobalData->bUserLocaleChanged = TRUE; } break; } Modified: trunk/reactos/dll/cpl/intl/time.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/time.c?rev=74…
============================================================================== --- trunk/reactos/dll/cpl/intl/time.c [iso-8859-1] (original) +++ trunk/reactos/dll/cpl/intl/time.c [iso-8859-1] Sun Apr 30 15:39:41 2017 @@ -53,30 +53,40 @@ static VOID GetSelectedComboEntry(HWND hwndDlg, DWORD dwIdc, WCHAR *Buffer, UINT uSize) { - int nIndex; HWND hChildWnd; + PWSTR tmp; + INT nIndex; + UINT uReqSize; /* Get handle to time format control */ hChildWnd = GetDlgItem(hwndDlg, dwIdc); + /* Get index to selected time format */ nIndex = SendMessageW(hChildWnd, CB_GETCURSEL, 0, 0); if (nIndex == CB_ERR) + { /* No selection? Get content of the edit control */ SendMessageW(hChildWnd, WM_GETTEXT, uSize, (LPARAM)Buffer); - else { - PWSTR tmp; - UINT uReqSize; - + } + else + { /* Get requested size, including the null terminator; * it shouldn't be required because the previous CB_LIMITTEXT, * but it would be better to check it anyways */ uReqSize = SendMessageW(hChildWnd, CB_GETLBTEXTLEN, (WPARAM)nIndex, 0) + 1; + /* Allocate enough space to be more safe */ - tmp = (PWSTR)_alloca(uReqSize*sizeof(WCHAR)); - /* Get selected time format text */ - SendMessageW(hChildWnd, CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)tmp); - /* Finally, copy the result into the output */ - wcsncpy(Buffer, tmp, uSize); + tmp = (PWSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, uReqSize * sizeof(WCHAR)); + if (tmp != NULL) + { + /* Get selected time format text */ + SendMessageW(hChildWnd, CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)tmp); + + /* Finally, copy the result into the output */ + wcsncpy(Buffer, tmp, uSize); + + HeapFree(GetProcessHeap(), 0, tmp); + } } } @@ -239,7 +249,7 @@ { /* Get selected/typed time format text */ GetSelectedComboEntry(hwndDlg, IDC_TIMEFORMAT, - pGlobalData->szTimeFormat, + pGlobalData->szTimeFormat, MAX_TIMEFORMAT); /* Get selected/typed time separator text */ @@ -257,7 +267,7 @@ pGlobalData->szTimePM, MAX_TIMEPMSYMBOL); - pGlobalData->fUserLocaleChanged = TRUE; + pGlobalData->bUserLocaleChanged = TRUE; /* Update the time format sample */ UpdateTimeSample(hwndDlg, pGlobalData);
7 years, 7 months
1
0
0
0
[cfinck] 74433: [LOCALSPL] [SPOOLSV] [WINSPOOL] - Refactor the code returning PRINTER_INFO_* yet another time to support both EnumPrinters and GetPrinter calls. - Implement support for PRINTER_INFO...
by cfinck@svn.reactos.org
Author: cfinck Date: Sun Apr 30 15:12:53 2017 New Revision: 74433 URL:
http://svn.reactos.org/svn/reactos?rev=74433&view=rev
Log: [LOCALSPL] [SPOOLSV] [WINSPOOL] - Refactor the code returning PRINTER_INFO_* yet another time to support both EnumPrinters and GetPrinter calls. - Implement support for PRINTER_INFO_1 through PRINTER_INFO_9 as well as the mostly unknown PRINTER_INFO_STRESS (level 0) structure and return as much information as we can. - Implement GetPrinterW / LocalGetPrinter. The Printers Shell folder in Explorer now shows our "Dummy Printer on LPT1" and we pass all 291 winspool:EnumPrinters API tests :) Modified: trunk/reactos/win32ss/printing/base/spoolsv/printers.c trunk/reactos/win32ss/printing/base/winspool/precomp.h trunk/reactos/win32ss/printing/base/winspool/printers.c trunk/reactos/win32ss/printing/include/spoolss.h trunk/reactos/win32ss/printing/providers/localspl/main.c trunk/reactos/win32ss/printing/providers/localspl/precomp.h trunk/reactos/win32ss/printing/providers/localspl/printers.c Modified: trunk/reactos/win32ss/printing/base/spoolsv/printers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/base/spoo…
============================================================================== --- trunk/reactos/win32ss/printing/base/spoolsv/printers.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/base/spoolsv/printers.c [iso-8859-1] Sun Apr 30 15:12:53 2017 @@ -8,23 +8,33 @@ #include "precomp.h" static void -_MarshallDownPrinterInfo(PBYTE pPrinterInfo, DWORD Level) -{ - PPRINTER_INFO_1W pPrinterInfo1; - PPRINTER_INFO_2W pPrinterInfo2; - +_MarshallDownPrinterInfo(PBYTE* ppPrinterInfo, DWORD Level) +{ // Replace absolute pointer addresses in the output by relative offsets. - if (Level == 1) - { - pPrinterInfo1 = (PPRINTER_INFO_1W)pPrinterInfo; + if (Level == 0) + { + PPRINTER_INFO_STRESS pPrinterInfo0 = (PPRINTER_INFO_STRESS)(*ppPrinterInfo); + + pPrinterInfo0->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo0->pPrinterName - (ULONG_PTR)pPrinterInfo0); + + if (pPrinterInfo0->pServerName) + pPrinterInfo0->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo0->pServerName - (ULONG_PTR)pPrinterInfo0); + + *ppPrinterInfo += sizeof(PRINTER_INFO_STRESS); + } + else if (Level == 1) + { + PPRINTER_INFO_1W pPrinterInfo1 = (PPRINTER_INFO_1W)(*ppPrinterInfo); pPrinterInfo1->pName = (PWSTR)((ULONG_PTR)pPrinterInfo1->pName - (ULONG_PTR)pPrinterInfo1); pPrinterInfo1->pDescription = (PWSTR)((ULONG_PTR)pPrinterInfo1->pDescription - (ULONG_PTR)pPrinterInfo1); pPrinterInfo1->pComment = (PWSTR)((ULONG_PTR)pPrinterInfo1->pComment - (ULONG_PTR)pPrinterInfo1); + + *ppPrinterInfo += sizeof(PRINTER_INFO_1W); } else if (Level == 2) { - pPrinterInfo2 = (PPRINTER_INFO_2W)pPrinterInfo; + PPRINTER_INFO_2W pPrinterInfo2 = (PPRINTER_INFO_2W)(*ppPrinterInfo); pPrinterInfo2->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pPrinterName - (ULONG_PTR)pPrinterInfo2); pPrinterInfo2->pShareName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pShareName - (ULONG_PTR)pPrinterInfo2); @@ -42,7 +52,66 @@ pPrinterInfo2->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pServerName - (ULONG_PTR)pPrinterInfo2); if (pPrinterInfo2->pSecurityDescriptor) - pPrinterInfo2->pSecurityDescriptor = (PWSTR)((ULONG_PTR)pPrinterInfo2->pSecurityDescriptor - (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pSecurityDescriptor = (PSECURITY_DESCRIPTOR)((ULONG_PTR)pPrinterInfo2->pSecurityDescriptor - (ULONG_PTR)pPrinterInfo2); + + *ppPrinterInfo += sizeof(PRINTER_INFO_2W); + } + else if (Level == 3) + { + PPRINTER_INFO_3 pPrinterInfo3 = (PPRINTER_INFO_3)(*ppPrinterInfo); + + pPrinterInfo3->pSecurityDescriptor = (PSECURITY_DESCRIPTOR)((ULONG_PTR)pPrinterInfo3->pSecurityDescriptor - (ULONG_PTR)pPrinterInfo3); + + *ppPrinterInfo += sizeof(PRINTER_INFO_3); + } + else if (Level == 4) + { + PPRINTER_INFO_4W pPrinterInfo4 = (PPRINTER_INFO_4W)(*ppPrinterInfo); + + pPrinterInfo4->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo4->pPrinterName - (ULONG_PTR)pPrinterInfo4); + + if (pPrinterInfo4->pServerName) + pPrinterInfo4->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo4->pServerName - (ULONG_PTR)pPrinterInfo4); + + *ppPrinterInfo += sizeof(PRINTER_INFO_4W); + } + else if (Level == 5) + { + PPRINTER_INFO_5W pPrinterInfo5 = (PPRINTER_INFO_5W)(*ppPrinterInfo); + + pPrinterInfo5->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo5->pPrinterName - (ULONG_PTR)pPrinterInfo5); + pPrinterInfo5->pPortName = (PWSTR)((ULONG_PTR)pPrinterInfo5->pPortName - (ULONG_PTR)pPrinterInfo5); + + *ppPrinterInfo += sizeof(PRINTER_INFO_5W); + } + else if (Level == 6) + { + *ppPrinterInfo += sizeof(PRINTER_INFO_6); + } + else if (Level == 7) + { + PPRINTER_INFO_7W pPrinterInfo7 = (PPRINTER_INFO_7W)(*ppPrinterInfo); + + if (pPrinterInfo7->pszObjectGUID) + pPrinterInfo7->pszObjectGUID = (PWSTR)((ULONG_PTR)pPrinterInfo7->pszObjectGUID - (ULONG_PTR)pPrinterInfo7); + + *ppPrinterInfo += sizeof(PRINTER_INFO_7W); + } + else if (Level == 8) + { + PPRINTER_INFO_8W pPrinterInfo8 = (PPRINTER_INFO_8W)(*ppPrinterInfo); + + pPrinterInfo8->pDevMode = (PDEVMODEW)((ULONG_PTR)pPrinterInfo8->pDevMode - (ULONG_PTR)pPrinterInfo8); + + *ppPrinterInfo += sizeof(PRINTER_INFO_8W); + } + else if (Level == 9) + { + PPRINTER_INFO_9W pPrinterInfo9 = (PPRINTER_INFO_9W)(*ppPrinterInfo); + + pPrinterInfo9->pDevMode = (PDEVMODEW)((ULONG_PTR)pPrinterInfo9->pDevMode - (ULONG_PTR)pPrinterInfo9); + + *ppPrinterInfo += sizeof(PRINTER_INFO_9W); } } @@ -155,16 +224,8 @@ DWORD i; PBYTE p = pPrinterEnumAligned; - // Replace absolute pointer addresses in the output by relative offsets. for (i = 0; i < *pcReturned; i++) - { - _MarshallDownPrinterInfo(p, Level); - - if (Level == 1) - p += sizeof(PRINTER_INFO_1W); - else if (Level == 2) - p += sizeof(PRINTER_INFO_2W); - } + _MarshallDownPrinterInfo(&p, Level); } RpcRevertToSelf(); @@ -183,8 +244,30 @@ DWORD _RpcGetPrinter(WINSPOOL_PRINTER_HANDLE hPrinter, DWORD Level, BYTE* pPrinter, DWORD cbBuf, DWORD* pcbNeeded) { - UNIMPLEMENTED; - return ERROR_INVALID_FUNCTION; + DWORD dwErrorCode; + PBYTE pPrinterAligned; + + dwErrorCode = RpcImpersonateClient(NULL); + if (dwErrorCode != ERROR_SUCCESS) + { + ERR("RpcImpersonateClient failed with error %lu!\n", dwErrorCode); + return dwErrorCode; + } + + pPrinterAligned = AlignRpcPtr(pPrinter, &cbBuf); + GetPrinterW(hPrinter, Level, pPrinterAligned, cbBuf, pcbNeeded); + dwErrorCode = GetLastError(); + + if (dwErrorCode == ERROR_SUCCESS) + { + PBYTE p = pPrinterAligned; + _MarshallDownPrinterInfo(&p, Level); + } + + RpcRevertToSelf(); + UndoAlignRpcPtr(pPrinter, pPrinterAligned, cbBuf, pcbNeeded); + + return dwErrorCode; } DWORD Modified: trunk/reactos/win32ss/printing/base/winspool/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/base/wins…
============================================================================== --- trunk/reactos/win32ss/printing/base/winspool/precomp.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/base/winspool/precomp.h [iso-8859-1] Sun Apr 30 15:12:53 2017 @@ -2,7 +2,7 @@ * PROJECT: ReactOS Print Spooler API * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation * PURPOSE: Precompiled Header for all source files - * COPYRIGHT: Copyright 2015 Colin Finck <colin(a)reactos.org> + * COPYRIGHT: Copyright 2015-2017 Colin Finck <colin(a)reactos.org> */ #ifndef _PRECOMP_H @@ -15,6 +15,8 @@ #include <winreg.h> #include <winspool.h> #include <winspool_c.h> + +#include <spoolss.h> #include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(winspool); Modified: trunk/reactos/win32ss/printing/base/winspool/printers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/base/wins…
============================================================================== --- trunk/reactos/win32ss/printing/base/winspool/printers.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/base/winspool/printers.c [iso-8859-1] Sun Apr 30 15:12:53 2017 @@ -8,23 +8,33 @@ #include "precomp.h" static void -_MarshallUpPrinterInfo(PBYTE pPrinterInfo, DWORD Level) -{ - PPRINTER_INFO_1W pPrinterInfo1; - PPRINTER_INFO_2W pPrinterInfo2; - - // Replace relative offset addresses in the output by absolute pointers. - if (Level == 1) - { - pPrinterInfo1 = (PPRINTER_INFO_1W)pPrinterInfo; +_MarshallUpPrinterInfo(PBYTE* ppPrinterInfo, DWORD Level) +{ + // Replace relative offset addresses in the output by absolute pointers and advance to the next structure. + if (Level == 0) + { + PPRINTER_INFO_STRESS pPrinterInfo0 = (PPRINTER_INFO_STRESS)(*ppPrinterInfo); + + pPrinterInfo0->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo0->pPrinterName + (ULONG_PTR)pPrinterInfo0); + + if (pPrinterInfo0->pServerName) + pPrinterInfo0->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo0->pServerName + (ULONG_PTR)pPrinterInfo0); + + *ppPrinterInfo += sizeof(PRINTER_INFO_STRESS); + } + else if (Level == 1) + { + PPRINTER_INFO_1W pPrinterInfo1 = (PPRINTER_INFO_1W)(*ppPrinterInfo); pPrinterInfo1->pName = (PWSTR)((ULONG_PTR)pPrinterInfo1->pName + (ULONG_PTR)pPrinterInfo1); pPrinterInfo1->pDescription = (PWSTR)((ULONG_PTR)pPrinterInfo1->pDescription + (ULONG_PTR)pPrinterInfo1); pPrinterInfo1->pComment = (PWSTR)((ULONG_PTR)pPrinterInfo1->pComment + (ULONG_PTR)pPrinterInfo1); + + *ppPrinterInfo += sizeof(PRINTER_INFO_1W); } else if (Level == 2) { - pPrinterInfo2 = (PPRINTER_INFO_2W)pPrinterInfo; + PPRINTER_INFO_2W pPrinterInfo2 = (PPRINTER_INFO_2W)(*ppPrinterInfo); pPrinterInfo2->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pPrinterName + (ULONG_PTR)pPrinterInfo2); pPrinterInfo2->pShareName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pShareName + (ULONG_PTR)pPrinterInfo2); @@ -42,7 +52,66 @@ pPrinterInfo2->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo2->pServerName + (ULONG_PTR)pPrinterInfo2); if (pPrinterInfo2->pSecurityDescriptor) - pPrinterInfo2->pSecurityDescriptor = (PWSTR)((ULONG_PTR)pPrinterInfo2->pSecurityDescriptor + (ULONG_PTR)pPrinterInfo2); + pPrinterInfo2->pSecurityDescriptor = (PSECURITY_DESCRIPTOR)((ULONG_PTR)pPrinterInfo2->pSecurityDescriptor + (ULONG_PTR)pPrinterInfo2); + + *ppPrinterInfo += sizeof(PRINTER_INFO_2W); + } + else if (Level == 3) + { + PPRINTER_INFO_3 pPrinterInfo3 = (PPRINTER_INFO_3)(*ppPrinterInfo); + + pPrinterInfo3->pSecurityDescriptor = (PSECURITY_DESCRIPTOR)((ULONG_PTR)pPrinterInfo3->pSecurityDescriptor + (ULONG_PTR)pPrinterInfo3); + + *ppPrinterInfo += sizeof(PRINTER_INFO_3); + } + else if (Level == 4) + { + PPRINTER_INFO_4W pPrinterInfo4 = (PPRINTER_INFO_4W)(*ppPrinterInfo); + + pPrinterInfo4->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo4->pPrinterName + (ULONG_PTR)pPrinterInfo4); + + if (pPrinterInfo4->pServerName) + pPrinterInfo4->pServerName = (PWSTR)((ULONG_PTR)pPrinterInfo4->pServerName + (ULONG_PTR)pPrinterInfo4); + + *ppPrinterInfo += sizeof(PRINTER_INFO_4W); + } + else if (Level == 5) + { + PPRINTER_INFO_5W pPrinterInfo5 = (PPRINTER_INFO_5W)(*ppPrinterInfo); + + pPrinterInfo5->pPrinterName = (PWSTR)((ULONG_PTR)pPrinterInfo5->pPrinterName + (ULONG_PTR)pPrinterInfo5); + pPrinterInfo5->pPortName = (PWSTR)((ULONG_PTR)pPrinterInfo5->pPortName + (ULONG_PTR)pPrinterInfo5); + + *ppPrinterInfo += sizeof(PRINTER_INFO_5W); + } + else if (Level == 6) + { + *ppPrinterInfo += sizeof(PRINTER_INFO_6); + } + else if (Level == 7) + { + PPRINTER_INFO_7W pPrinterInfo7 = (PPRINTER_INFO_7W)(*ppPrinterInfo); + + if (pPrinterInfo7->pszObjectGUID) + pPrinterInfo7->pszObjectGUID = (PWSTR)((ULONG_PTR)pPrinterInfo7->pszObjectGUID + (ULONG_PTR)pPrinterInfo7); + + *ppPrinterInfo += sizeof(PRINTER_INFO_7W); + } + else if (Level == 8) + { + PPRINTER_INFO_8W pPrinterInfo8 = (PPRINTER_INFO_8W)(*ppPrinterInfo); + + pPrinterInfo8->pDevMode = (PDEVMODEW)((ULONG_PTR)pPrinterInfo8->pDevMode + (ULONG_PTR)pPrinterInfo8); + + *ppPrinterInfo += sizeof(PRINTER_INFO_8W); + } + else if (Level == 9) + { + PPRINTER_INFO_9W pPrinterInfo9 = (PPRINTER_INFO_9W)(*ppPrinterInfo); + + pPrinterInfo9->pDevMode = (PDEVMODEW)((ULONG_PTR)pPrinterInfo9->pDevMode + (ULONG_PTR)pPrinterInfo9); + + *ppPrinterInfo += sizeof(PRINTER_INFO_9W); } } @@ -306,8 +375,6 @@ EnumPrintersW(DWORD Flags, PWSTR Name, DWORD Level, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned) { DWORD dwErrorCode; - DWORD i; - PBYTE p = pPrinterEnum; // Dismiss invalid levels already at this point. if (Level == 3 || Level > 5) @@ -333,16 +400,11 @@ if (dwErrorCode == ERROR_SUCCESS) { - // Replace relative offset addresses in the output by absolute pointers. + DWORD i; + PBYTE p = pPrinterEnum; + for (i = 0; i < *pcReturned; i++) - { - _MarshallUpPrinterInfo(p, Level); - - if (Level == 1) - p += sizeof(PRINTER_INFO_1W); - else if (Level == 2) - p += sizeof(PRINTER_INFO_2W); - } + _MarshallUpPrinterInfo(&p, Level); } Cleanup: @@ -383,7 +445,39 @@ BOOL WINAPI GetPrinterW(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded) { - return FALSE; + DWORD dwErrorCode; + + // Dismiss invalid levels already at this point. + if (Level > 9) + { + dwErrorCode = ERROR_INVALID_LEVEL; + goto Cleanup; + } + + if (cbBuf && pPrinter) + ZeroMemory(pPrinter, cbBuf); + + // Do the RPC call + RpcTryExcept + { + dwErrorCode = _RpcGetPrinter(hPrinter, Level, pPrinter, cbBuf, pcbNeeded); + } + RpcExcept(EXCEPTION_EXECUTE_HANDLER) + { + dwErrorCode = RpcExceptionCode(); + ERR("_RpcGetPrinter failed with exception code %lu!\n", dwErrorCode); + } + RpcEndExcept; + + if (dwErrorCode == ERROR_SUCCESS) + { + PBYTE p = pPrinter; + _MarshallUpPrinterInfo(&p, Level); + } + +Cleanup: + SetLastError(dwErrorCode); + return (dwErrorCode == ERROR_SUCCESS); } BOOL WINAPI Modified: trunk/reactos/win32ss/printing/include/spoolss.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/include/s…
============================================================================== --- trunk/reactos/win32ss/printing/include/spoolss.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/include/spoolss.h [iso-8859-1] Sun Apr 30 15:12:53 2017 @@ -19,6 +19,41 @@ } MARSHALL_DOWN_INFO, *PMARSHALL_DOWN_INFO; +/** From MS-RPRN, 2.2.1.10.1 */ +typedef struct _PRINTER_INFO_STRESS +{ + PWSTR pPrinterName; + PWSTR pServerName; + DWORD cJobs; + DWORD cTotalJobs; + DWORD cTotalBytes; + SYSTEMTIME stUpTime; + DWORD MaxcRef; + DWORD cTotalPagesPrinted; + DWORD dwGetVersion; + DWORD fFreeBuild; + DWORD cSpooling; + DWORD cMaxSpooling; + DWORD cRef; + DWORD cErrorOutOfPaper; + DWORD cErrorNotReady; + DWORD cJobError; + DWORD dwNumberOfProcessors; + DWORD dwProcessorType; + DWORD dwHighPartTotalBytes; + DWORD cChangeID; + DWORD dwLastError; + DWORD Status; + DWORD cEnumerateNetworkPrinters; + DWORD cAddNetPrinters; + USHORT wProcessorArchitecture; + USHORT wProcessorLevel; + DWORD cRefIC; + DWORD dwReserved2; + DWORD dwReserved3; +} +PRINTER_INFO_STRESS, *PPRINTER_INFO_STRESS; + PVOID WINAPI AlignRpcPtr(PVOID pBuffer, PDWORD pcbBuffer); PWSTR WINAPI AllocSplStr(PCWSTR pwszInput); PVOID WINAPI DllAllocSplMem(DWORD dwBytes); Modified: trunk/reactos/win32ss/printing/providers/localspl/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/providers…
============================================================================== --- trunk/reactos/win32ss/printing/providers/localspl/main.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/providers/localspl/main.c [iso-8859-1] Sun Apr 30 15:12:53 2017 @@ -31,7 +31,7 @@ NULL, // fpAddPrinter NULL, // fpDeletePrinter NULL, // fpSetPrinter - NULL, // fpGetPrinter + LocalGetPrinter, // fpGetPrinter LocalEnumPrinters, // fpEnumPrinters NULL, // fpAddPrinterDriver NULL, // fpEnumPrinterDrivers Modified: trunk/reactos/win32ss/printing/providers/localspl/precomp.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/providers…
============================================================================== --- trunk/reactos/win32ss/printing/providers/localspl/precomp.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/providers/localspl/precomp.h [iso-8859-1] Sun Apr 30 15:12:53 2017 @@ -2,7 +2,7 @@ * PROJECT: ReactOS Local Spooler * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation * PURPOSE: Precompiled Header for all source files - * COPYRIGHT: Copyright 2015 Colin Finck <colin(a)reactos.org> + * COPYRIGHT: Copyright 2015-2017 Colin Finck <colin(a)reactos.org> */ #ifndef _PRECOMP_H @@ -277,6 +277,7 @@ extern SKIPLIST PrinterList; BOOL InitializePrinterList(); BOOL WINAPI LocalEnumPrinters(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned); +BOOL WINAPI LocalGetPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded); BOOL WINAPI LocalOpenPrinter(PWSTR lpPrinterName, HANDLE* phPrinter, PPRINTER_DEFAULTSW pDefault); BOOL WINAPI LocalReadPrinter(HANDLE hPrinter, PVOID pBuf, DWORD cbBuf, PDWORD pNoBytesRead); DWORD WINAPI LocalStartDocPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pDocInfo); Modified: trunk/reactos/win32ss/printing/providers/localspl/printers.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/printing/providers…
============================================================================== --- trunk/reactos/win32ss/printing/providers/localspl/printers.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/printing/providers/localspl/printers.c [iso-8859-1] Sun Apr 30 15:12:53 2017 @@ -10,11 +10,68 @@ // Global Variables SKIPLIST PrinterList; +// Forward Declarations +static void _LocalGetPrinterLevel0(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_STRESS* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); +static void _LocalGetPrinterLevel1(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_1W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); +static void _LocalGetPrinterLevel2(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_2W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); +static void _LocalGetPrinterLevel3(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_3* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); +static void _LocalGetPrinterLevel4(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_4W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); +static void _LocalGetPrinterLevel5(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_5W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); +static void _LocalGetPrinterLevel6(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_6* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); +static void _LocalGetPrinterLevel7(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_7W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); +static void _LocalGetPrinterLevel8(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_8W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); +static void _LocalGetPrinterLevel9(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_9W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName); + // Local Constants +typedef void (*PLocalGetPrinterLevelFunc)(PLOCAL_PRINTER, PVOID, PBYTE*, PDWORD, DWORD, PWSTR); + +static const PLocalGetPrinterLevelFunc pfnGetPrinterLevels[] = { + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel0, + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel1, + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel2, + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel3, + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel4, + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel5, + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel6, + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel7, + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel8, + (PLocalGetPrinterLevelFunc)&_LocalGetPrinterLevel9 +}; + +static DWORD dwPrinterInfo0Offsets[] = { + FIELD_OFFSET(PRINTER_INFO_STRESS, pPrinterName), + MAXDWORD +}; + static DWORD dwPrinterInfo1Offsets[] = { FIELD_OFFSET(PRINTER_INFO_1W, pName), FIELD_OFFSET(PRINTER_INFO_1W, pComment), FIELD_OFFSET(PRINTER_INFO_1W, pDescription), + MAXDWORD +}; + +static DWORD dwPrinterInfo2Offsets[] = { + FIELD_OFFSET(PRINTER_INFO_2W, pPrinterName), + FIELD_OFFSET(PRINTER_INFO_2W, pShareName), + FIELD_OFFSET(PRINTER_INFO_2W, pPortName), + FIELD_OFFSET(PRINTER_INFO_2W, pDriverName), + FIELD_OFFSET(PRINTER_INFO_2W, pComment), + FIELD_OFFSET(PRINTER_INFO_2W, pLocation), + FIELD_OFFSET(PRINTER_INFO_2W, pSepFile), + FIELD_OFFSET(PRINTER_INFO_2W, pPrintProcessor), + FIELD_OFFSET(PRINTER_INFO_2W, pDatatype), + FIELD_OFFSET(PRINTER_INFO_2W, pParameters), + MAXDWORD +}; + +static DWORD dwPrinterInfo4Offsets[] = { + FIELD_OFFSET(PRINTER_INFO_4W, pPrinterName), + MAXDWORD +}; + +static DWORD dwPrinterInfo5Offsets[] = { + FIELD_OFFSET(PRINTER_INFO_5W, pPrinterName), + FIELD_OFFSET(PRINTER_INFO_5W, pPortName), MAXDWORD }; @@ -437,145 +494,390 @@ return ERROR_SUCCESS; } -static DWORD -_LocalEnumPrintersLevel0(DWORD Flags, PCWSTR Name, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned, DWORD cchComputerName, PWSTR wszComputerName) -{ - return ERROR_INVALID_LEVEL; -} - -static DWORD -_LocalEnumPrintersLevel1(DWORD Flags, PCWSTR Name, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned, DWORD cchComputerName, PWSTR wszComputerName) +static void +_LocalGetPrinterLevel0(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_STRESS* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) +{ + size_t cbName; + PWSTR p; + PWSTR pwszStrings[1]; + SYSTEM_INFO SystemInfo; + + // Calculate the string lengths. + cbName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR); + + if (!ppPrinterInfo) + { + *pcbNeeded += sizeof(PRINTER_INFO_STRESS) + cbName; + return; + } + + // Set the general fields. + ZeroMemory(*ppPrinterInfo, sizeof(PRINTER_INFO_STRESS)); + (*ppPrinterInfo)->cJobs = pPrinter->JobList.NodeCount; + (*ppPrinterInfo)->dwGetVersion = GetVersion(); + (*ppPrinterInfo)->Status = pPrinter->dwStatus; + +#if !defined(DBG) + (*ppPrinterInfo)->fFreeBuild = 1; +#endif + + GetSystemInfo(&SystemInfo); + (*ppPrinterInfo)->dwNumberOfProcessors = SystemInfo.dwNumberOfProcessors; + (*ppPrinterInfo)->dwProcessorType = SystemInfo.dwProcessorType; + (*ppPrinterInfo)->wProcessorArchitecture = SystemInfo.wProcessorArchitecture; + (*ppPrinterInfo)->wProcessorLevel = SystemInfo.wProcessorLevel; + + // Copy the Printer Name. + pwszStrings[0] = DllAllocSplMem(cbName); + p = pwszStrings[0]; + StringCbCopyExW(p, cbName, wszComputerName, &p, &cbName, 0); + StringCbCopyExW(p, cbName, pPrinter->pwszPrinterName, &p, &cbName, 0); + + // Finally copy the structure and advance to the next one in the output buffer. + *ppPrinterInfoEnd = PackStrings(pwszStrings, (PBYTE)(*ppPrinterInfo), dwPrinterInfo0Offsets, *ppPrinterInfoEnd); + (*ppPrinterInfo)++; + + // Free the memory for temporary strings. + DllFreeSplMem(pwszStrings[0]); +} + +static void +_LocalGetPrinterLevel1(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_1W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) { const WCHAR wszComma[] = L","; size_t cbName; size_t cbComment; size_t cbDescription; + PWSTR p; + PWSTR pwszStrings[3]; + + // Calculate the string lengths. + // Attention: pComment equals the "Description" registry value while pDescription is concatenated out of several strings. + // On top of this, the computer name is prepended to the printer name if the user supplied the local computer name during the query. + cbName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR); + cbComment = (wcslen(pPrinter->pwszDescription) + 1) * sizeof(WCHAR); + cbDescription = cbName + (wcslen(pPrinter->pwszPrinterDriver) + 1 + wcslen(pPrinter->pwszLocation) + 1) * sizeof(WCHAR); + + if (!ppPrinterInfo) + { + *pcbNeeded += sizeof(PRINTER_INFO_1W) + cbName + cbComment + cbDescription; + return; + } + + // Indicate that this is a Printer. + (*ppPrinterInfo)->Flags = PRINTER_ENUM_ICON8; + + // Copy the Printer Name. + pwszStrings[0] = DllAllocSplMem(cbName); + p = pwszStrings[0]; + StringCbCopyExW(p, cbName, wszComputerName, &p, &cbName, 0); + StringCbCopyExW(p, cbName, pPrinter->pwszPrinterName, &p, &cbName, 0); + + // Copy the Printer comment (equals the "Description" registry value). + pwszStrings[1] = pPrinter->pwszDescription; + + // Copy the description, which for PRINTER_INFO_1W has the form "Name,Printer Driver,Location" + pwszStrings[2] = DllAllocSplMem(cbDescription); + p = pwszStrings[2]; + StringCbCopyExW(p, cbDescription, wszComputerName, &p, &cbDescription, 0); + StringCbCopyExW(p, cbDescription, pPrinter->pwszPrinterName, &p, &cbDescription, 0); + StringCbCopyExW(p, cbDescription, wszComma, &p, &cbDescription, 0); + StringCbCopyExW(p, cbDescription, pPrinter->pwszPrinterDriver, &p, &cbDescription, 0); + StringCbCopyExW(p, cbDescription, wszComma, &p, &cbDescription, 0); + StringCbCopyExW(p, cbDescription, pPrinter->pwszLocation, &p, &cbDescription, 0); + + // Finally copy the structure and advance to the next one in the output buffer. + *ppPrinterInfoEnd = PackStrings(pwszStrings, (PBYTE)(*ppPrinterInfo), dwPrinterInfo1Offsets, *ppPrinterInfoEnd); + (*ppPrinterInfo)++; + + // Free the memory for temporary strings. + DllFreeSplMem(pwszStrings[0]); + DllFreeSplMem(pwszStrings[2]); +} + +static void +_LocalGetPrinterLevel2(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_2W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) +{ + WCHAR wszEmpty[] = L""; + + size_t cbDevMode; + size_t cbPrinterName; + size_t cbShareName; + size_t cbPortName; + size_t cbDriverName; + size_t cbComment; + size_t cbLocation; + size_t cbSepFile; + size_t cbPrintProcessor; + size_t cbDatatype; + size_t cbParameters; + PWSTR p; + PWSTR pwszStrings[10]; + + // Calculate the string lengths. + cbDevMode = pPrinter->pDefaultDevMode->dmSize + pPrinter->pDefaultDevMode->dmDriverExtra; + cbPrinterName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR); + + if (!ppPrinterInfo) + { + // Attention: pComment equals the "Description" registry value. + cbShareName = sizeof(wszEmpty); + cbPortName = (wcslen(pPrinter->pPort->pwszName) + 1) * sizeof(WCHAR); + cbDriverName = (wcslen(pPrinter->pwszPrinterDriver) + 1) * sizeof(WCHAR); + cbComment = (wcslen(pPrinter->pwszDescription) + 1) * sizeof(WCHAR); + cbLocation = (wcslen(pPrinter->pwszLocation) + 1) * sizeof(WCHAR); + cbSepFile = sizeof(wszEmpty); + cbPrintProcessor = (wcslen(pPrinter->pPrintProcessor->pwszName) + 1) * sizeof(WCHAR); + cbDatatype = (wcslen(pPrinter->pwszDefaultDatatype) + 1) * sizeof(WCHAR); + cbParameters = sizeof(wszEmpty); + + *pcbNeeded += sizeof(PRINTER_INFO_2W) + cbDevMode + cbPrinterName + cbShareName + cbPortName + cbDriverName + cbComment + cbLocation + cbSepFile + cbPrintProcessor + cbDatatype + cbParameters; + return; + } + + // Set the general fields. + ZeroMemory(*ppPrinterInfo, sizeof(PRINTER_INFO_2W)); + (*ppPrinterInfo)->Attributes = pPrinter->dwAttributes; + (*ppPrinterInfo)->cJobs = pPrinter->JobList.NodeCount; + (*ppPrinterInfo)->Status = pPrinter->dwStatus; + + // Set the pDevMode field (and copy the DevMode). + *ppPrinterInfoEnd -= cbDevMode; + CopyMemory(*ppPrinterInfoEnd, pPrinter->pDefaultDevMode, cbDevMode); + (*ppPrinterInfo)->pDevMode = (PDEVMODEW)(*ppPrinterInfoEnd); + + // Set the pPrinterName field. + pwszStrings[0] = DllAllocSplMem(cbPrinterName); + p = pwszStrings[0]; + StringCbCopyExW(p, cbPrinterName, wszComputerName, &p, &cbPrinterName, 0); + StringCbCopyExW(p, cbPrinterName, pPrinter->pwszPrinterName, &p, &cbPrinterName, 0); + + // Set the pShareName field. + pwszStrings[1] = wszEmpty; + + // Set the pPortName field. + pwszStrings[2] = pPrinter->pPort->pwszName; + + // Set the pDriverName field. + pwszStrings[3] = pPrinter->pwszPrinterDriver; + + // Set the pComment field ((equals the "Description" registry value). + pwszStrings[4] = pPrinter->pwszDescription; + + // Set the pLocation field. + pwszStrings[5] = pPrinter->pwszLocation; + + // Set the pSepFile field. + pwszStrings[6] = wszEmpty; + + // Set the pPrintProcessor field. + pwszStrings[7] = pPrinter->pPrintProcessor->pwszName; + + // Set the pDatatype field. + pwszStrings[8] = pPrinter->pwszDefaultDatatype; + + // Set the pParameters field. + pwszStrings[9] = wszEmpty; + + // Finally copy the structure and advance to the next one in the output buffer. + *ppPrinterInfoEnd = PackStrings(pwszStrings, (PBYTE)(*ppPrinterInfo), dwPrinterInfo2Offsets, *ppPrinterInfoEnd); + (*ppPrinterInfo)++; + + // Free the memory for temporary strings. + DllFreeSplMem(pwszStrings[0]); +} + +static void +_LocalGetPrinterLevel3(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_3* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) +{ + SECURITY_DESCRIPTOR SecurityDescriptor = { 0 }; + + if (!ppPrinterInfo) + { + *pcbNeeded += sizeof(PRINTER_INFO_3) + sizeof(SECURITY_DESCRIPTOR); + return; + } + + FIXME("Return a valid security descriptor for PRINTER_INFO_3\n"); + + // Set the pSecurityDescriptor field (and copy the Security Descriptor). + *ppPrinterInfoEnd -= sizeof(SECURITY_DESCRIPTOR); + CopyMemory(*ppPrinterInfoEnd, &SecurityDescriptor, sizeof(SECURITY_DESCRIPTOR)); + (*ppPrinterInfo)->pSecurityDescriptor = (PSECURITY_DESCRIPTOR)(*ppPrinterInfoEnd); + + // Advance to the next structure. + (*ppPrinterInfo)++; +} + +static void +_LocalGetPrinterLevel4(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_4W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) +{ + size_t cbPrinterName; + PWSTR p; + PWSTR pwszStrings[1]; + + // Calculate the string lengths. + cbPrinterName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR); + + if (!ppPrinterInfo) + { + *pcbNeeded += sizeof(PRINTER_INFO_4W) + cbPrinterName; + return; + } + + // Set the general fields. + (*ppPrinterInfo)->pServerName = NULL; + (*ppPrinterInfo)->Attributes = pPrinter->dwAttributes; + + // Set the pPrinterName field. + pwszStrings[0] = DllAllocSplMem(cbPrinterName); + p = pwszStrings[0]; + StringCbCopyExW(p, cbPrinterName, wszComputerName, &p, &cbPrinterName, 0); + StringCbCopyExW(p, cbPrinterName, pPrinter->pwszPrinterName, &p, &cbPrinterName, 0); + + // Finally copy the structure and advance to the next one in the output buffer. + *ppPrinterInfoEnd = PackStrings(pwszStrings, (PBYTE)(*ppPrinterInfo), dwPrinterInfo4Offsets, *ppPrinterInfoEnd); + (*ppPrinterInfo)++; + + // Free the memory for temporary strings. + DllFreeSplMem(pwszStrings[0]); +} + +static void +_LocalGetPrinterLevel5(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_5W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) +{ + size_t cbPrinterName; + size_t cbPortName; + PWSTR p; + PWSTR pwszStrings[1]; + + // Calculate the string lengths. + cbPrinterName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR); + + if (!ppPrinterInfo) + { + cbPortName = (wcslen(pPrinter->pPort->pwszName) + 1) * sizeof(WCHAR); + + *pcbNeeded += sizeof(PRINTER_INFO_5W) + cbPrinterName + cbPortName; + return; + } + + // Set the general fields. + (*ppPrinterInfo)->Attributes = pPrinter->dwAttributes; + (*ppPrinterInfo)->DeviceNotSelectedTimeout = 0; + (*ppPrinterInfo)->TransmissionRetryTimeout = 0; + + // Set the pPrinterName field. + pwszStrings[0] = DllAllocSplMem(cbPrinterName); + p = pwszStrings[0]; + StringCbCopyExW(p, cbPrinterName, wszComputerName, &p, &cbPrinterName, 0); + StringCbCopyExW(p, cbPrinterName, pPrinter->pwszPrinterName, &p, &cbPrinterName, 0); + + // Set the pPortName field. + pwszStrings[1] = pPrinter->pPort->pwszName; + + // Finally copy the structure and advance to the next one in the output buffer. + *ppPrinterInfoEnd = PackStrings(pwszStrings, (PBYTE)(*ppPrinterInfo), dwPrinterInfo5Offsets, *ppPrinterInfoEnd); + (*ppPrinterInfo)++; + + // Free the memory for temporary strings. + DllFreeSplMem(pwszStrings[0]); +} + +static void +_LocalGetPrinterLevel6(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_6* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) +{ + if (!ppPrinterInfo) + { + *pcbNeeded += sizeof(PRINTER_INFO_6); + return; + } + + // Set the general fields. + (*ppPrinterInfo)->dwStatus = pPrinter->dwStatus; + + // Advance to the next structure. + (*ppPrinterInfo)++; +} + +static void +_LocalGetPrinterLevel7(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_7W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) +{ + if (!ppPrinterInfo) + { + *pcbNeeded += sizeof(PRINTER_INFO_7W); + return; + } + + FIXME("No Directory Support, returning DSPRINT_UNPUBLISH for PRINTER_INFO_7 all the time!\n"); + + // Set the general fields. + (*ppPrinterInfo)->dwAction = DSPRINT_UNPUBLISH; + (*ppPrinterInfo)->pszObjectGUID = NULL; + + // Advance to the next structure. + (*ppPrinterInfo)++; +} + +static void +_LocalGetPrinterLevel8(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_8W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) +{ + DWORD cbDevMode; + + // Calculate the string lengths. + cbDevMode = pPrinter->pDefaultDevMode->dmSize + pPrinter->pDefaultDevMode->dmDriverExtra; + + if (!ppPrinterInfo) + { + *pcbNeeded += sizeof(PRINTER_INFO_8W) + cbDevMode; + return; + } + + // Set the pDevMode field (and copy the DevMode). + *ppPrinterInfoEnd -= cbDevMode; + CopyMemory(*ppPrinterInfoEnd, pPrinter->pDefaultDevMode, cbDevMode); + (*ppPrinterInfo)->pDevMode = (PDEVMODEW)(*ppPrinterInfoEnd); + + // Advance to the next structure. + (*ppPrinterInfo)++; +} + +static void +_LocalGetPrinterLevel9(PLOCAL_PRINTER pPrinter, PPRINTER_INFO_9W* ppPrinterInfo, PBYTE* ppPrinterInfoEnd, PDWORD pcbNeeded, DWORD cchComputerName, PWSTR wszComputerName) +{ + DWORD cbDevMode; + + // Calculate the string lengths. + cbDevMode = pPrinter->pDefaultDevMode->dmSize + pPrinter->pDefaultDevMode->dmDriverExtra; + + if (!ppPrinterInfo) + { + *pcbNeeded += sizeof(PRINTER_INFO_9W) + cbDevMode; + return; + } + + FIXME("Per-user settings are not yet implemented, returning the global DevMode for PRINTER_INFO_9!\n"); + + // Set the pDevMode field (and copy the DevMode). + *ppPrinterInfoEnd -= cbDevMode; + CopyMemory(*ppPrinterInfoEnd, pPrinter->pDefaultDevMode, cbDevMode); + (*ppPrinterInfo)->pDevMode = (PDEVMODEW)(*ppPrinterInfoEnd); + + // Advance to the next structure. + (*ppPrinterInfo)++; +} + +BOOL WINAPI +LocalEnumPrinters(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned) +{ + DWORD cchComputerName = 0; DWORD dwErrorCode; DWORD i; - PBYTE pPrinterInfo; - PBYTE pPrinterStrings; + PBYTE pPrinterInfoEnd; PSKIPLIST_NODE pNode; + WCHAR wszComputerName[2 + MAX_COMPUTERNAME_LENGTH + 1 + 1] = { 0 }; PLOCAL_PRINTER pPrinter; - PWSTR p; - PWSTR pwszStrings[3]; - - if (Flags & PRINTER_ENUM_NAME && !Name) - { - // The caller wants information about this Print Provider. - // spoolss packs this into an array of information about all Print Providers. - dwErrorCode = _DumpLevel1PrintProviderInformation(pPrinterEnum, cbBuf, pcbNeeded, pcReturned); - goto Cleanup; - } - - // Count the required buffer size and the number of printers. - i = 0; - - for (pNode = PrinterList.Head.Next[0]; pNode; pNode = pNode->Next[0]) - { - pPrinter = (PLOCAL_PRINTER)pNode->Element; - - // TODO: If PRINTER_ENUM_SHARED is given, add this Printer if it's shared instead of just ignoring it. - if (Flags & PRINTER_ENUM_SHARED) - continue; - - // Attention: pComment equals the "Description" registry value while pDescription is concatenated out of several strings. - // On top of this, the computer name is prepended to the printer name if the user supplied the local computer name during the query. - cbName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR); - cbComment = (wcslen(pPrinter->pwszDescription) + 1) * sizeof(WCHAR); - cbDescription = cbName + (wcslen(pPrinter->pwszPrinterDriver) + 1 + wcslen(pPrinter->pwszLocation) + 1) * sizeof(WCHAR); - - *pcbNeeded += sizeof(PRINTER_INFO_1W) + cbName + cbComment + cbDescription; - i++; - } - - // Check if the supplied buffer is large enough. - if (cbBuf < *pcbNeeded) - { - dwErrorCode = ERROR_INSUFFICIENT_BUFFER; - goto Cleanup; - } - - // Initialize the variables for filling the output buffer using PackStrings. - pPrinterInfo = pPrinterEnum; - pPrinterStrings = &pPrinterEnum[*pcbNeeded]; - - // Copy over the Printer information. - for (pNode = PrinterList.Head.Next[0]; pNode; pNode = pNode->Next[0]) - { - pPrinter = (PLOCAL_PRINTER)pNode->Element; - - // TODO: If PRINTER_ENUM_SHARED is given, add this Printer if it's shared instead of just ignoring it. - if (Flags & PRINTER_ENUM_SHARED) - continue; - - // Indicate that this is a Printer. - ((PPRINTER_INFO_1W)pPrinterInfo)->Flags = PRINTER_ENUM_ICON8; - - // Calculate the string lengths. - cbName = (cchComputerName + wcslen(pPrinter->pwszPrinterName) + 1) * sizeof(WCHAR); - cbComment = (wcslen(pPrinter->pwszDescription) + 1) * sizeof(WCHAR); - cbDescription = cbName + (wcslen(pPrinter->pwszPrinterDriver) + 1 + wcslen(pPrinter->pwszLocation) + 1) * sizeof(WCHAR); - - // Copy the Printer Name. - pwszStrings[0] = DllAllocSplMem(cbName); - p = pwszStrings[0]; - StringCbCopyExW(p, cbName, wszComputerName, &p, &cbName, 0); - StringCbCopyExW(p, cbName, pPrinter->pwszPrinterName, &p, &cbName, 0); - - // Copy the Printer comment (equals the "Description" registry value). - pwszStrings[1] = pPrinter->pwszDescription; - - // Copy the description, which for PRINTER_INFO_1W has the form "Name,Printer Driver,Location" - pwszStrings[2] = DllAllocSplMem(cbDescription); - p = pwszStrings[2]; - StringCbCopyExW(p, cbDescription, wszComputerName, &p, &cbDescription, 0); - StringCbCopyExW(p, cbDescription, pPrinter->pwszPrinterName, &p, &cbDescription, 0); - StringCbCopyExW(p, cbDescription, wszComma, &p, &cbDescription, 0); - StringCbCopyExW(p, cbDescription, pPrinter->pwszPrinterDriver, &p, &cbDescription, 0); - StringCbCopyExW(p, cbDescription, wszComma, &p, &cbDescription, 0); - StringCbCopyExW(p, cbDescription, pPrinter->pwszLocation, &p, &cbDescription, 0); - - // Finally copy the structure and advance to the next one in the output buffer. - pPrinterStrings = PackStrings(pwszStrings, pPrinterInfo, dwPrinterInfo1Offsets, pPrinterStrings); - pPrinterInfo += sizeof(PRINTER_INFO_1W); - - // Free the memory for temporary strings. - DllFreeSplMem(pwszStrings[0]); - DllFreeSplMem(pwszStrings[2]); - } - - *pcReturned = i; - dwErrorCode = ERROR_SUCCESS; - -Cleanup: - return dwErrorCode; -} - -static DWORD -_LocalEnumPrintersLevel2(DWORD Flags, PCWSTR Name, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned, DWORD cchComputerName, PWSTR wszComputerName) -{ - return ERROR_INVALID_LEVEL; -} - -static DWORD -_LocalEnumPrintersLevel4(DWORD Flags, PCWSTR Name, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned, DWORD cchComputerName, PWSTR wszComputerName) -{ - return ERROR_INVALID_LEVEL; -} - -static DWORD -_LocalEnumPrintersLevel5(DWORD Flags, PCWSTR Name, PBYTE pPrinterEnum, DWORD cbBuf, PDWORD pcbNeeded, PDWORD pcReturned, DWORD cchComputerName, PWSTR wszComputerName) -{ - return ERROR_INVALID_LEVEL; -} - -BOOL WINAPI -LocalEnumPrinters(DWORD Flags, LPWSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned) -{ - DWORD cchComputerName = 0; - DWORD dwErrorCode; - WCHAR wszComputerName[2 + MAX_COMPUTERNAME_LENGTH + 1 + 1] = { 0 }; ASSERT(pcbNeeded); ASSERT(pcReturned); @@ -601,37 +903,111 @@ goto Cleanup; } + if (Level == 3 || Level > 5) + { + // The caller supplied an invalid level for EnumPrinters. + dwErrorCode = ERROR_INVALID_LEVEL; + goto Cleanup; + } + + if (Level == 1 && Flags & PRINTER_ENUM_NAME && !Name) + { + // The caller wants information about this Print Provider. + // spoolss packs this into an array of information about all Print Providers. + dwErrorCode = _DumpLevel1PrintProviderInformation(pPrinterEnum, cbBuf, pcbNeeded, pcReturned); + goto Cleanup; + } + // Check the supplied Name parameter (if any). // This may return a Computer Name string we later prepend to the output. dwErrorCode = _LocalEnumPrintersCheckName(Flags, Name, wszComputerName, &cchComputerName); if (dwErrorCode != ERROR_SUCCESS) goto Cleanup; - if (Level == 0) - { - dwErrorCode = _LocalEnumPrintersLevel0(Flags, Name, pPrinterEnum, cbBuf, pcbNeeded, pcReturned, cchComputerName, wszComputerName); - } - else if (Level == 1) - { - dwErrorCode = _LocalEnumPrintersLevel1(Flags, Name, pPrinterEnum, cbBuf, pcbNeeded, pcReturned, cchComputerName, wszComputerName); - } - else if (Level == 2) - { - dwErrorCode = _LocalEnumPrintersLevel2(Flags, Name, pPrinterEnum, cbBuf, pcbNeeded, pcReturned, cchComputerName, wszComputerName); - } - else if (Level == 4) - { - dwErrorCode = _LocalEnumPrintersLevel4(Flags, Name, pPrinterEnum, cbBuf, pcbNeeded, pcReturned, cchComputerName, wszComputerName); - } - else if (Level == 5) - { - dwErrorCode = _LocalEnumPrintersLevel5(Flags, Name, pPrinterEnum, cbBuf, pcbNeeded, pcReturned, cchComputerName, wszComputerName); - } - else - { - // The caller supplied an invalid level. + // Count the required buffer size and the number of printers. + i = 0; + for (pNode = PrinterList.Head.Next[0]; pNode; pNode = pNode->Next[0]) + { + pPrinter = (PLOCAL_PRINTER)pNode->Element; + + // TODO: If PRINTER_ENUM_SHARED is given, add this Printer if it's shared instead of just ignoring it. + if (Flags & PRINTER_ENUM_SHARED) + { + FIXME("Printer Sharing is not supported yet, returning no printers!\n"); + continue; + } + + pfnGetPrinterLevels[Level](pPrinter, NULL, NULL, pcbNeeded, cchComputerName, wszComputerName); + i++; + } + + // Check if the supplied buffer is large enough. + if (cbBuf < *pcbNeeded) + { + dwErrorCode = ERROR_INSUFFICIENT_BUFFER; + goto Cleanup; + } + + // Copy over the Printer information. + pPrinterInfoEnd = &pPrinterEnum[*pcbNeeded]; + + for (pNode = PrinterList.Head.Next[0]; pNode; pNode = pNode->Next[0]) + { + pPrinter = (PLOCAL_PRINTER)pNode->Element; + + // TODO: If PRINTER_ENUM_SHARED is given, add this Printer if it's shared instead of just ignoring it. + if (Flags & PRINTER_ENUM_SHARED) + continue; + + pfnGetPrinterLevels[Level](pPrinter, &pPrinterEnum, &pPrinterInfoEnd, NULL, cchComputerName, wszComputerName); + } + + *pcReturned = i; + dwErrorCode = ERROR_SUCCESS; + +Cleanup: + SetLastError(dwErrorCode); + return (dwErrorCode == ERROR_SUCCESS); +} + +BOOL WINAPI +LocalGetPrinter(HANDLE hPrinter, DWORD Level, LPBYTE pPrinter, DWORD cbBuf, LPDWORD pcbNeeded) +{ + DWORD dwErrorCode; + PBYTE pPrinterEnd; + PLOCAL_HANDLE pHandle = (PLOCAL_HANDLE)hPrinter; + PLOCAL_PRINTER_HANDLE pPrinterHandle; + + // Check if this is a printer handle. + if (pHandle->HandleType != HandleType_Printer) + { + dwErrorCode = ERROR_INVALID_HANDLE; + goto Cleanup; + } + + pPrinterHandle = (PLOCAL_PRINTER_HANDLE)pHandle->pSpecificHandle; + + if (Level > 9) + { + // The caller supplied an invalid level for GetPrinter. dwErrorCode = ERROR_INVALID_LEVEL; - } + goto Cleanup; + } + + // Count the required buffer size. + pfnGetPrinterLevels[Level](pPrinterHandle->pPrinter, NULL, NULL, pcbNeeded, 0, NULL); + + // Check if the supplied buffer is large enough. + if (cbBuf < *pcbNeeded) + { + dwErrorCode = ERROR_INSUFFICIENT_BUFFER; + goto Cleanup; + } + + // Copy over the Printer information. + pPrinterEnd = &pPrinter[*pcbNeeded]; + pfnGetPrinterLevels[Level](pPrinterHandle->pPrinter, &pPrinter, &pPrinterEnd, NULL, 0, NULL); + dwErrorCode = ERROR_SUCCESS; Cleanup: SetLastError(dwErrorCode);
7 years, 7 months
1
0
0
0
[pschweitzer] 74432: [KERNEL32_APITEST] - Refactor a bit tests, to split more logically tests - Fix a bug in tests - Add new tests for MountMgr showing our storage stack doesn't behave as expected
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Apr 30 11:43:04 2017 New Revision: 74432 URL:
http://svn.reactos.org/svn/reactos?rev=74432&view=rev
Log: [KERNEL32_APITEST] - Refactor a bit tests, to split more logically tests - Fix a bug in tests - Add new tests for MountMgr showing our storage stack doesn't behave as expected Modified: trunk/rostests/apitests/kernel32/DeviceIoControl.c Modified: trunk/rostests/apitests/kernel32/DeviceIoControl.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/DeviceI…
============================================================================== --- trunk/rostests/apitests/kernel32/DeviceIoControl.c [iso-8859-1] (original) +++ trunk/rostests/apitests/kernel32/DeviceIoControl.c [iso-8859-1] Sun Apr 30 11:43:04 2017 @@ -8,32 +8,19 @@ #include <apitest.h> #include <strsafe.h> #include <winioctl.h> +#include <mountmgr.h> -START_TEST(DeviceIoControl) +WCHAR Letter; +HANDLE Device; + +static +VOID +GetDiskGeometry(VOID) { UINT Ret; - WCHAR Letter; - HANDLE Device; DISK_GEOMETRY DG; DWORD Size, Error; - WCHAR Path[MAX_PATH]; DISK_GEOMETRY_EX DGE; - - Path[0] = 'C'; - Path[1] = ':'; - Path[2] = '\\'; - Ret = GetSystemDirectoryW(Path, MAX_PATH); - ok(Ret > 0, "GetSystemDirectory failed\n"); - - Letter = Path[0]; - ok(Path[1] == ':', "Not a drive letter: %c\n", Path[1]); - ok(Path[2] == '\\', "Not a drive letter: %c\n", Path[2]); - - Ret = StringCchPrintfW(Path, MAX_PATH, L"%\\\\?\\c:", Letter); - ok(Ret == S_OK, "StringCchPrintfW failed: %d\n", Ret); - - Device = CreateFileW(Path, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - ok(Device != INVALID_HANDLE_VALUE, "CreateFileW for %S failed: %ld\n", Path, GetLastError()); Size = 0; Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, &DG, sizeof(DG) - 1, &Size, NULL); @@ -63,6 +50,93 @@ Ret = DeviceIoControl(Device, IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, NULL, 0, &DGE, sizeof(DGE), &Size, NULL); ok(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError()); ok(Size == sizeof(DGE), "Invalid output size: %ld\n", Size); +} + +static +VOID +QueryDeviceName(VOID) +{ + UINT Ret; + BOOL IsValid; + DWORD Size, Error; + MOUNTDEV_NAME MDN, *AllocatedMDN; + + Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_DEVICE_NAME, NULL, 0, &MDN, sizeof(MDN) - 1, &Size, NULL); + ok(Ret == 0, "DeviceIoControl succeed\n"); + Error = GetLastError(); + ok(Error == ERROR_INVALID_PARAMETER, "Expecting ERROR_INVALID_PARAMETER, got %ld\n", Error); + ok(Size == 40 /* ?! */, "Invalid output size: %ld\n", Size); + + Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_DEVICE_NAME, NULL, 0, &MDN, sizeof(MDN), &Size, NULL); + ok(Ret == 0, "DeviceIoControl succeed\n"); + Error = GetLastError(); + ok(Error == ERROR_MORE_DATA, "Expecting ERROR_MORE_DATA, got %ld\n", Error); + ok(Size == sizeof(MOUNTDEV_NAME), "Invalid output size: %ld\n", Size); + + AllocatedMDN = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MOUNTDEV_NAME, Name) + MDN.NameLength + sizeof(UNICODE_NULL)); + if (AllocatedMDN == NULL) + { + skip("Memory allocation failure\n"); + return; + } + + Size = 0; + Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_DEVICE_NAME, NULL, 0, AllocatedMDN, FIELD_OFFSET(MOUNTDEV_NAME, Name) + MDN.NameLength, &Size, NULL); + ok(Ret != 0, "DeviceIoControl failed: %ld\n", GetLastError()); + ok(Size == FIELD_OFFSET(MOUNTDEV_NAME, Name) + MDN.NameLength, "Invalid output size: %ld\n", Size); + ok(AllocatedMDN->NameLength == MDN.NameLength, "Mismatching sizes: %d %d\n", AllocatedMDN->NameLength, MDN.NameLength); + + if (Ret != 0) + { + IsValid = FALSE; + AllocatedMDN->Name[AllocatedMDN->NameLength / sizeof(WCHAR) - 1] = UNICODE_NULL; + + if (wcsstr(AllocatedMDN->Name, L"\\Device\\HarddiskVolume") != NULL) + { + IsValid = TRUE; + } + else if (wcsstr(AllocatedMDN->Name, L"\\DosDevices\\") != NULL) + { + IsValid = (AllocatedMDN->Name[12] == Letter && AllocatedMDN->Name[13] == L':'); + } + + ok(IsValid, "Invalid name: %.*S", AllocatedMDN->NameLength, AllocatedMDN->Name); + } + else + { + skip("Failed to query device name\n"); + } + + HeapFree(GetProcessHeap(), 0, AllocatedMDN); +} + +START_TEST(DeviceIoControl) +{ + UINT Ret; + WCHAR Path[MAX_PATH]; + + Path[0] = 'C'; + Path[1] = ':'; + Path[2] = '\\'; + Ret = GetSystemDirectoryW(Path, MAX_PATH); + ok(Ret > 0, "GetSystemDirectory failed\n"); + + Letter = towupper(Path[0]); + ok(Path[1] == ':', "Not a drive letter: %c\n", Path[1]); + ok(Path[2] == '\\', "Not a drive letter: %c\n", Path[2]); + + Ret = StringCchPrintfW(Path, MAX_PATH, L"\\\\?\\%c:", Letter); + ok(Ret == S_OK, "StringCchPrintfW failed: %d\n", Ret); + + Device = CreateFileW(Path, 0, FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (Device == INVALID_HANDLE_VALUE) + { + skip("CreateFileW for %S failed: %ld\n", Path, GetLastError()); + return; + } + + GetDiskGeometry(); + QueryDeviceName(); CloseHandle(Device); }
7 years, 7 months
1
0
0
0
[ekohl] 74431: [BOOTDATA] Make service display names and descriptions translatable. CORE-11855
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Apr 29 17:17:10 2017 New Revision: 74431 URL:
http://svn.reactos.org/svn/reactos?rev=74431&view=rev
Log: [BOOTDATA] Make service display names and descriptions translatable. CORE-11855 Modified: trunk/reactos/boot/bootdata/hivesys.inf Modified: trunk/reactos/boot/bootdata/hivesys.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/bootdata/hivesys.inf?…
============================================================================== --- trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] (original) +++ trunk/reactos/boot/bootdata/hivesys.inf [iso-8859-1] Sat Apr 29 17:17:10 2017 @@ -1464,8 +1464,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\swenum","Type",0x00010001,0x00000001 ; Audio Service -HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","DisplayName",0x00000000,"Audio Service" -HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Description",0x00000000,"Provides audio facilities to applications" +HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","DisplayName",0x00000000, "%AUDIO_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Description",0x00000000,"%AUDIO_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ErrorControl",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Group",0x00000000,"Audio" HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ImagePath",0x00020000,"%SystemRoot%\system32\audiosrv.exe" @@ -1474,8 +1474,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Type",0x00010001,0x00000010 ; Background Intelligent Transfer Service (BITS) -HKLM,"SYSTEM\CurrentControlSet\Services\BITS","DisplayName",0x00000000,"BITS" -HKLM,"SYSTEM\CurrentControlSet\Services\BITS","Description",0x00000000,"Background Intelligent Transfer Service (BITS)" +HKLM,"SYSTEM\CurrentControlSet\Services\BITS","DisplayName",0x00000000,"%BITS_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\BITS","Description",0x00000000,"%BITS_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\BITS","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\BITS","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k netsvcs" HKLM,"SYSTEM\CurrentControlSet\Services\BITS","ObjectName",0x00000000,"LocalSystem" @@ -1506,8 +1506,8 @@ ; Event logging service HKLM,"SYSTEM\CurrentControlSet\Services\EventLog",,0x00000010 -HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","DisplayName",0x00000000,"Event Logger" -HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Description",0x00000000,"Logs events or messages sent by the operating system in a database accessible via the event log viewer" +HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","DisplayName",0x00000000,"%EVENTLOG_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Description",0x00000000,"%EVENTLOG_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ErrorControl",0x00010001,0x00000000 HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","Group",0x00000000,"Event Log" HKLM,"SYSTEM\CurrentControlSet\Services\EventLog","ImagePath",0x00020000,"%SystemRoot%\system32\eventlog.exe" @@ -1542,8 +1542,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Fs_Rec","Type",0x00010001,0x00000008 ; Server service -HKLM,"SYSTEM\CurrentControlSet\Services\lanmanserver","DisplayName",0x00000000,"Server service" -HKLM,"SYSTEM\CurrentControlSet\Services\lanmanserver","Description",0x00000000,"Supports sharing for file, printers and resources on the network" +HKLM,"SYSTEM\CurrentControlSet\Services\lanmanserver","DisplayName",0x00000000,"%SERVER_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\lanmanserver","Description",0x00000000,"%SERVER_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\lanmanserver","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\lanmanserver","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k netsvcs" HKLM,"SYSTEM\CurrentControlSet\Services\lanmanserver","ObjectName",0x00000000,"LocalSystem" @@ -1552,8 +1552,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\lanmanserver\Parameters","ServiceDll",0x00020000,"%SystemRoot%\system32\srvsvc.dll" ; Workstation service -HKLM,"SYSTEM\CurrentControlSet\Services\lanmanworkstation","DisplayName",0x00000000,"Workstation service" -HKLM,"SYSTEM\CurrentControlSet\Services\lanmanworkstation","Description",0x00000000,"Responsible for creating and maintaining network connections to servers" +HKLM,"SYSTEM\CurrentControlSet\Services\lanmanworkstation","DisplayName",0x00000000,"%WORKSTATION_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\lanmanworkstation","Description",0x00000000,"%WORKSTATION_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\lanmanworkstation","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\lanmanworkstation","Group",0x00000000,"Network Provider" HKLM,"SYSTEM\CurrentControlSet\Services\lanmanworkstation","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k netsvcs" @@ -1585,8 +1585,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Type",0x00010001,0x00000001 ; NetLogon -;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","DisplayName",0x00000000,"Net Logon" -;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","Description",0x00000000,"Sets up a secure channel to a domain controller for domain authentication" +;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","DisplayName",0x00000000,"%NETLOGON_SERVICE%" +;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","Description",0x00000000,"%NETLOGON_SERVICE_DESCRIPTION%" ;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","ErrorControl",0x00010001,0x00000001 ;HKLM,"SYSTEM\CurrentControlSet\Services\Netlogon","ImagePath",0x00020000,"%SystemRoot%\system32\lsass.exe" ;HKLM,"SYSTEM\CurrentControlSet\Services\NetLogon","Start",0x00010001,0x00000003 @@ -1895,8 +1895,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Pci\Parameters","101300D6101880D6",0x00030003,00,00,00,00,00,00,00,00 ; Plug and Play manager -HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","DisplayName",0x00000000,"Plug and Play" -HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Description",0x00000000,"Detects hardware changes and installs needed software if possible" +HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","DisplayName",0x00000000,"%PLUGPLAY_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Description",0x00000000,"%PLUGPLAY_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","Group",0x00000000,"PlugPlay" HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k DcomLaunch" @@ -1906,8 +1906,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\PlugPlay\Parameters","ServiceDll",0x00020000,"%SystemRoot%\system32\umpnpmgr.dll" ; RPC service -HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","DisplayName",0x00000000,"Remote Procedure Call" -HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","Description",0x00000000,"RPC subsystem which is responsible for Remote procedure Calls on the local machine" +HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","DisplayName",0x00000000,"%RPCSS_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","Description",0x00000000,"%RPCSS_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\Rpcss","FailureActions",0x00030003, \ 00,00,00,00,00,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,60,ea,00,00 @@ -1919,8 +1919,8 @@ ; Scheduler service HKLM,"SYSTEM\CurrentControlSet\Services\Schedule","DependOnService",0x00010000,"RPCSS" -HKLM,"SYSTEM\CurrentControlSet\Services\Schedule","DisplayName",0x00000000,"Scheduler service" -HKLM,"SYSTEM\CurrentControlSet\Services\Schedule","Description",0x00000000,"Allows starting of programs at specific times" +HKLM,"SYSTEM\CurrentControlSet\Services\Schedule","Description",0x00000000,"SCHEDULE_SERVICE_DESCRIPTION%" +HKLM,"SYSTEM\CurrentControlSet\Services\Schedule","DisplayName",0x00000000,"%SCHEDULE_SERVICE%" HKLM,"SYSTEM\CurrentControlSet\Services\Schedule","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\Schedule","Group",0x00000000,"SchedulerGroup" HKLM,"SYSTEM\CurrentControlSet\Services\Schedule","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k netsvcs" @@ -1932,8 +1932,8 @@ ; Spooler service HKLM,"SYSTEM\CurrentControlSet\Services\Spooler","DependOnService",0x00010000,"RPCSS" -HKLM,"SYSTEM\CurrentControlSet\Services\Spooler","DisplayName",0x00000000,"Printer Spooler" -HKLM,"SYSTEM\CurrentControlSet\Services\Spooler","Description",0x00000000,"Printer Spooler" +HKLM,"SYSTEM\CurrentControlSet\Services\Spooler","Description",0x00000000,"%SPOOLER_SERVICE_DESCRIPTION%" +HKLM,"SYSTEM\CurrentControlSet\Services\Spooler","DisplayName",0x00000000,"%SPOOLER_SERVICE%" HKLM,"SYSTEM\CurrentControlSet\Services\Spooler","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\Spooler","FailureActions",0x00000003, \ 60,54,00,00,00,00,00,00,00,00,00,00,03,00,00,00,00,00,00,00, \ @@ -1946,8 +1946,8 @@ ; WLAN service HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","DependOnService",0x00010000,"RPCSS" -HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","DisplayName",0x00000000,"WLAN Service" -HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","Description",0x00000000,"WLAN Service" +HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","DisplayName",0x00000000,"%WLANSVC_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","Description",0x00000000,"%WLANSVC_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","Group",0x00000000,"TDI" HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","ImagePath",0x00020000,"%SystemRoot%\system32\wlansvc.exe" @@ -1956,8 +1956,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\WlanSvc","Type",0x00010001,0x00000110 ; Simple TCP services -HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Description",0x00000000,"Supports the following TCP/IP services: Chargen, Daytime, Discard, Echo, QOTD" -HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","DisplayName",0x00000000,"Simple TCP/IP Services" +HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Description",0x00000000,"%TCPSVCS_SERVICE_DECRIPTION%" +HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","DisplayName",0x00000000,"%TCPSVCS_SERVICE%" HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Group",0x00000000,"Network" HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ImagePath",0x00020000,"%SystemRoot%\system32\tcpsvcs.exe" @@ -1966,8 +1966,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Type",0x00010001,0x00000020 ; ReactOS Telnet Service -HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Description",0x00000000,"ReactOS Telnet Service" -HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","DisplayName",0x00000000,"ReactOS Telnet Service" +HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Description",0x00000000,"%TELNETD_SERVICE_DESCRIPTION%" +HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","DisplayName",0x00000000,"%TELNETD_SERVICE%" HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Group",0x00000000,"Network" HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ImagePath",0x00020000,"%SystemRoot%\system32\telnetd.exe" @@ -1976,8 +1976,8 @@ HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Type",0x00010001,0x00000020 ; Themes service -HKLM,"SYSTEM\CurrentControlSet\Services\Themes","DisplayName",0x00000000,"Themes" -HKLM,"SYSTEM\CurrentControlSet\Services\Themes","Description",0x00000000,"Themes support" +HKLM,"SYSTEM\CurrentControlSet\Services\Themes","DisplayName",0x00000000,"%THEMES_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\Themes","Description",0x00000000,"%THEMES_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\Themes","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\Themes","FailureActions",0x00000003, \ 80,51,01,00,00,00,00,00,00,00,00,00,03,00,00,00,00,00,00,00, \ @@ -1992,8 +1992,8 @@ ; ReactOS Installer Service HKLM,"SYSTEM\CurrentControlSet\Services\MSIServer","DependOnService",0x00010000,"RPCSS" -HKLM,"SYSTEM\CurrentControlSet\Services\MSIServer","DisplayName",0x00000000,"ReactOS Installer" -HKLM,"SYSTEM\CurrentControlSet\Services\MSIServer","Description",0x00000000,"Controls installation, maintenance, and removal of software packaged as an MSI (Windows Installer)" +HKLM,"SYSTEM\CurrentControlSet\Services\MSIServer","DisplayName",0x00000000,"%MSISERVER_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\MSIServer","Description",0x00000000,"%MSISERVER_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\MSIServer","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\MSIServer","ImagePath",0x00020000,"%SystemRoot%\system32\msiexec.exe /V" HKLM,"SYSTEM\CurrentControlSet\Services\MSIServer","ObjectName",0x00000000,"LocalSystem" @@ -2002,8 +2002,8 @@ ; WMI Service HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","DependOnService",0x00010000,"RPCSS" -HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","DisplayName",0x00000000,"ReactOS Management Infrastructure" -HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","Description",0x00000000,"Provides interface to system management information" +HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","DisplayName",0x00000000,"%WINMGMT_SERVICE%" +HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","Description",0x00000000,"%WINMGMT_SERVICE_DESCRIPTION%" HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","Group",0x00000000,"WMI" HKLM,"SYSTEM\CurrentControlSet\Services\winmgmt","ImagePath",0x00020000,"%SystemRoot%\system32\svchost.exe -k netsvcs" @@ -2105,4 +2105,53 @@ HKLM,"SYSTEM\CurrentControlSet\Services\fastfat","Start",0x00010001,0x00000003 +[Strings] +AUDIO_SERVICE="Audio Service" +AUDIO_SERVICE_DESCRIPTION="Provides audio facilities to applications" + +BITS_SERVICE="Background Intelligent Transfer Service" +BITS_SERVICE_DESCRIPTION="Transfers files in the background using idle network bandwidth." + +EVENTLOG_SERVICE="Event Logger" +EVENTLOG_SERVICE_DESCRIPTION="Logs events or messages sent by the operating system in a database accessible via the event log viewer." + +MSISERVER_SERVICE="ReactOS Installer" +MSISERVER_SERVICE_DESCRIPTION="Controls installation, maintenance, and removal of software packaged as an MSI (Windows Installer)." + +NETLOGON_SERVICE="Net Logon" +NETLOGON_SERVICE_DESCRIPTION="Sets up a secure channel to a domain controller for domain authentication." + +PLUGPLAY_SERVICE="Plug and Play" +PLUGPLAY_SERVICE_DESCRIPTION="Detects hardware changes and installs needed software if possible." + +RPCSS_SERVICE="Remote Procedure Call" +RPCSS_SERVICE_DESCRIPTION="RPC subsystem which is responsible for Remote Procedure Calls on the local machine." + +SCHEDULE_SERVICE="Scheduler service" +SCHEDULE_SERVICE_DESCRIPTION="Allows starting of programs at specific times." + +SERVER_SERVICE="Server" +SERVER_SERVICE_DESCRIPTION="Supports sharing for file, printers and resources on the network." + +SPOOLER_SERVICE="Printer Spooler" +SPOOLER_SERVICE_DESCRIPTION="Loads files to memory for later printing." + +TCPSVCS_SERVICE="Simple TCP/IP Services" +TCPSVCS_SERVICE_DECRIPTION="Supports the following TCP/IP services: Chargen, Daytime, Discard, Echo, QOTD." + +TELNETD_SERVICE="ReactOS Telnet Service" +TELNETD_SERVICE_DESCRIPTION="ReactOS Telnet Service" + +THEMES_SERVICE="Themes" +THEMES_SERVICE_DESCRIPTION="Themes support" + +WINMGMT_SERVICE="ReactOS Management Infrastructure" +WINMGMT_SERVICE_DESCRIPTION="Provides interface to system management information." + +WLANSVC_SERVICE="WLAN Service" +WLANSVC_SERVICE_DESCRIPTION="WLAN Service" + +WORKSTATION_SERVICE="Workstation" +WORKSTATION_SERVICE_DESCRIPTION="Responsible for creating and maintaining network connections to servers." + ; EOF
7 years, 7 months
1
0
0
0
[pschweitzer] 74430: [CDFS] Fix returned data handling on directory enumeration. Patch by Giannis Adamopoulos CORE-13143
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Fri Apr 28 19:32:44 2017 New Revision: 74430 URL:
http://svn.reactos.org/svn/reactos?rev=74430&view=rev
Log: [CDFS] Fix returned data handling on directory enumeration. Patch by Giannis Adamopoulos CORE-13143 Modified: trunk/reactos/drivers/filesystems/cdfs/dirctl.c Modified: trunk/reactos/drivers/filesystems/cdfs/dirctl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/d…
============================================================================== --- trunk/reactos/drivers/filesystems/cdfs/dirctl.c [iso-8859-1] (original) +++ trunk/reactos/drivers/filesystems/cdfs/dirctl.c [iso-8859-1] Fri Apr 28 19:32:44 2017 @@ -689,20 +689,11 @@ if (Status == STATUS_BUFFER_OVERFLOW) { - if (Buffer0) - { - Buffer0->NextEntryOffset = 0; - } break; } } else { - if (Buffer0) - { - Buffer0->NextEntryOffset = 0; - } - if (First) { Status = STATUS_NO_SUCH_FILE; @@ -717,12 +708,13 @@ Buffer0 = (PFILE_NAMES_INFORMATION)Buffer; Buffer0->FileIndex = FileIndex++; Ccb->Entry++; + BufferLength -= Buffer0->NextEntryOffset; if (Stack->Flags & SL_RETURN_SINGLE_ENTRY) { break; } - BufferLength -= Buffer0->NextEntryOffset; + Buffer += Buffer0->NextEntryOffset; } @@ -734,6 +726,7 @@ if (FileIndex > 0) { Status = STATUS_SUCCESS; + Irp->IoStatus.Information = Stack->Parameters.QueryDirectory.Length - BufferLength; } return(Status); @@ -793,6 +786,8 @@ Irp = IrpContext->Irp; DeviceObject = IrpContext->DeviceObject; + Irp->IoStatus.Information = 0; + switch (IrpContext->MinorFunction) { case IRP_MN_QUERY_DIRECTORY: @@ -811,11 +806,6 @@ break; } - if (Status != STATUS_PENDING) - { - Irp->IoStatus.Information = 0; - } - return(Status); }
7 years, 8 months
1
0
0
0
[gadamopoulos] 74429: [COMCTL32] -Add v5 and v6 manifests in livecd.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Apr 28 17:11:46 2017 New Revision: 74429 URL:
http://svn.reactos.org/svn/reactos?rev=74429&view=rev
Log: [COMCTL32] -Add v5 and v6 manifests in livecd. Modified: trunk/reactos/dll/win32/comctl32/CMakeLists.txt Modified: trunk/reactos/dll/win32/comctl32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/comctl32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/CMakeLists.txt [iso-8859-1] Fri Apr 28 17:11:46 2017 @@ -63,3 +63,5 @@ add_importlibs(comctl32 user32 gdi32 advapi32 msvcrt kernel32 ntdll) add_pch(comctl32 comctl32.h SOURCE) add_cd_file(TARGET comctl32 DESTINATION reactos/system32 FOR all) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/comctl32v5.manifest DESTINATION reactos/winsxs/manifests NAME_ON_CD x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.2600.2982_none_deadbeef.manifest FOR livecd) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/comctl32.manifest DESTINATION reactos/winsxs/manifests NAME_ON_CD x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef.manifest FOR livecd)
7 years, 8 months
1
0
0
0
[tfaber] 74428: [0.4.5] - Enable wallpaper by default
by tfaber@svn.reactos.org
Author: tfaber Date: Fri Apr 28 10:56:12 2017 New Revision: 74428 URL:
http://svn.reactos.org/svn/reactos?rev=74428&view=rev
Log: [0.4.5] - Enable wallpaper by default Added: branches/ros-branch-0_4_5/wallpapers/Angelus_02_ROSWP.bmp (with props) Modified: branches/ros-branch-0_4_5/reactos/boot/bootdata/hivedef.inf branches/ros-branch-0_4_5/wallpapers/CMakeLists.txt Modified: branches/ros-branch-0_4_5/reactos/boot/bootdata/hivedef.inf URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/reactos/boot/b…
============================================================================== --- branches/ros-branch-0_4_5/reactos/boot/bootdata/hivedef.inf [iso-8859-1] (original) +++ branches/ros-branch-0_4_5/reactos/boot/bootdata/hivedef.inf [iso-8859-1] Fri Apr 28 10:56:12 2017 @@ -64,7 +64,7 @@ HKCU,"Control Panel\Desktop","ScreenSaveTimeOut",0,"600" HKCU,"Control Panel\Desktop","WaitToKillAppTimeout",2,"20000" HKCU,"Control Panel\Desktop","Pattern",2,"(None)" -HKCU,"Control Panel\Desktop","Wallpaper",0x00000000,"" +HKCU,"Control Panel\Desktop","Wallpaper",0x00000000,"%SystemRoot%\Angelus_02_ROSWP.bmp" HKCU,"Control Panel\Desktop","TileWallpaper",2,"0" HKCU,"Control Panel\Desktop","WallpaperStyle",2,"2" HKCU,"Control Panel\Desktop","FontSmoothing",0,"1" Added: branches/ros-branch-0_4_5/wallpapers/Angelus_02_ROSWP.bmp URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/wallpapers/Ang…
============================================================================== Binary file - no diff available. Propchange: branches/ros-branch-0_4_5/wallpapers/Angelus_02_ROSWP.bmp ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: branches/ros-branch-0_4_5/wallpapers/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/wallpapers/CMa…
============================================================================== --- branches/ros-branch-0_4_5/wallpapers/CMakeLists.txt [iso-8859-1] (original) +++ branches/ros-branch-0_4_5/wallpapers/CMakeLists.txt [iso-8859-1] Fri Apr 28 10:56:12 2017 @@ -1,2 +1,2 @@ -add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/Angelus_02_ROSWP_4-3_1024x768.jpg DESTINATION reactos/Web/Wallpaper FOR all) +add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/Angelus_02_ROSWP.bmp DESTINATION reactos FOR all)
7 years, 8 months
1
0
0
0
[tfaber] 74427: [0.4.5] - Apply the WordPad icon hack by Jared Smudde CORE-5823
by tfaber@svn.reactos.org
Author: tfaber Date: Fri Apr 28 07:32:39 2017 New Revision: 74427 URL:
http://svn.reactos.org/svn/reactos?rev=74427&view=rev
Log: [0.4.5] - Apply the WordPad icon hack by Jared Smudde CORE-5823 Modified: branches/ros-branch-0_4_5/reactos/base/applications/wordpad/res/formatbar.bmp branches/ros-branch-0_4_5/reactos/base/applications/wordpad/res/toolbar.bmp Modified: branches/ros-branch-0_4_5/reactos/base/applications/wordpad/res/formatbar.bmp URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/reactos/base/a…
============================================================================== Binary files - no diff available. Modified: branches/ros-branch-0_4_5/reactos/base/applications/wordpad/res/toolbar.bmp URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_5/reactos/base/a…
============================================================================== Binary files - no diff available.
7 years, 8 months
1
0
0
0
← Newer
1
2
3
4
...
18
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Results per page:
10
25
50
100
200