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
August 2018
----- 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
32 participants
304 discussions
Start a n
N
ew thread
01/01: [SYSTEMINFO] Fix various bugs and add SMBIOS support
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a91df2330848ad794534c…
commit a91df2330848ad794534ca864ce1c04078b33f80 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Tue Jul 31 18:57:58 2018 +0300 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Aug 12 21:18:31 2018 +0200 [SYSTEMINFO] Fix various bugs and add SMBIOS support --- .../sysutils/systeminfo/CMakeLists.txt | 5 ++ .../applications/sysutils/systeminfo/systeminfo.c | 66 +++++++++++++++++----- 2 files changed, 57 insertions(+), 14 deletions(-) diff --git a/modules/rosapps/applications/sysutils/systeminfo/CMakeLists.txt b/modules/rosapps/applications/sysutils/systeminfo/CMakeLists.txt index 4d6413e342..69f1690297 100644 --- a/modules/rosapps/applications/sysutils/systeminfo/CMakeLists.txt +++ b/modules/rosapps/applications/sysutils/systeminfo/CMakeLists.txt @@ -1,5 +1,10 @@ +include_directories( + ${REACTOS_SOURCE_DIR}/sdk/lib/udmihelp + ${REACTOS_SOURCE_DIR}/sdk/lib/dmilib) + add_executable(systeminfo systeminfo.c systeminfo.rc) set_module_type(systeminfo win32cui) +target_link_libraries(systeminfo udmihelp) add_importlibs(systeminfo user32 advapi32 netapi32 shlwapi iphlpapi ws2_32 msvcrt kernel32 ntdll) add_cd_file(TARGET systeminfo DESTINATION reactos/system32 FOR all) diff --git a/modules/rosapps/applications/sysutils/systeminfo/systeminfo.c b/modules/rosapps/applications/sysutils/systeminfo/systeminfo.c index 12818ecc5e..e0adc2d5a7 100644 --- a/modules/rosapps/applications/sysutils/systeminfo/systeminfo.c +++ b/modules/rosapps/applications/sysutils/systeminfo/systeminfo.c @@ -27,6 +27,8 @@ #include <shlwapi.h> #include <iphlpapi.h> #include <winsock2.h> +#include <udmihelp.h> +#include <dmilib.h> #include "resource.h" @@ -62,7 +64,7 @@ RegGetSZ(HKEY hKey, LPCWSTR lpSubKey, LPCWSTR lpValueName, LPWSTR lpBuf, DWORD c wprintf(L"Warning! Cannot query %s. Last error: %lu, type: %lu.\n", lpValueName, GetLastError(), dwType); dwBytes = 0; } - else + else if (dwBytes == 0) { wcscpy(lpBuf, L"N/A"); dwBytes = 6; @@ -173,7 +175,7 @@ FormatDateTime(time_t Time, LPWSTR lpBuf) /* Copy time now */ i += swprintf(lpBuf + i, L", "); - i += 2; + GetTimeFormatW(LOCALE_SYSTEM_DEFAULT, 0, &SysTime, NULL, lpBuf + i, BUFFER_SIZE - i); } @@ -236,6 +238,8 @@ AllSysInfo(VOID) HKEY hKey; PIP_ADAPTER_ADDRESSES pAdapters; ULONG cbAdapters; + PVOID SMBiosBuf; + PCHAR DmiStrings[ID_STRINGS_MAX] = { 0 }; if (!GetSystemDirectoryW(szSystemDir, sizeof(szSystemDir)/sizeof(szSystemDir[0]))) { @@ -319,23 +323,34 @@ AllSysInfo(VOID) swprintf(Buf, Tmp, cSeconds / (60*60*24), (cSeconds / (60*60)) % 24, (cSeconds / 60) % 60, cSeconds % 60); PrintRow(IDS_UP_TIME, FALSE, L"%s", Buf); + // prepare SMBIOS data + SMBiosBuf = LoadSMBiosData(DmiStrings); + //getting System Manufacturer; HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation\Manufacturer for Win >= 6.0 swprintf(Tmp, L"%s\\oeminfo.ini", szSystemDir); GetPrivateProfileStringW(L"General", L"Manufacturer", - L"To Be Filled By O.E.M.", + L"", Buf, sizeof(Buf)/sizeof(Buf[0]), Tmp); + if (wcslen(Buf) == 0 && SMBiosBuf) + { + GetSMBiosStringW(DmiStrings[SYS_VENDOR], Buf, _countof(Buf), FALSE); + } PrintRow(IDS_SYS_MANUFACTURER, FALSE, L"%s", Buf); //getting System Model; HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation\Model for Win >= 6.0 GetPrivateProfileStringW(L"General", L"Model", - L"To Be Filled By O.E.M.", + L"", Buf, sizeof(Buf)/sizeof(Buf[0]), Tmp); + if (wcslen(Buf) == 0 && SMBiosBuf) + { + GetSMBiosStringW(DmiStrings[SYS_PRODUCT], Buf, _countof(Buf), FALSE); + } PrintRow(IDS_SYS_MODEL, FALSE, L"%s", Buf); //getting System type @@ -375,21 +390,44 @@ AllSysInfo(VOID) } //getting BIOS Version - RegGetSZ(HKEY_LOCAL_MACHINE, - L"HARDWARE\\DESCRIPTION\\System", - L"SystemBiosVersion", - Buf, - BUFFER_SIZE); + if (SMBiosBuf) + { + j = GetSMBiosStringW(DmiStrings[BIOS_VENDOR], Buf, BUFFER_SIZE, TRUE); + if (j + 1 < BUFFER_SIZE) + { + Buf[j++] = L' '; + Buf[j] = L'\0'; + } + GetSMBiosStringW(DmiStrings[BIOS_VERSION], Buf + j, BUFFER_SIZE - j, TRUE); + } + else + { + RegGetSZ(HKEY_LOCAL_MACHINE, + L"HARDWARE\\DESCRIPTION\\System", + L"SystemBiosVersion", + Buf, + BUFFER_SIZE); + } PrintRow(IDS_BIOS_VERSION, FALSE, L"%s", Buf); //gettings BIOS date - RegGetSZ(HKEY_LOCAL_MACHINE, - L"HARDWARE\\DESCRIPTION\\System", - L"SystemBiosDate", - Buf, - BUFFER_SIZE); + if (SMBiosBuf) + { + GetSMBiosStringW(DmiStrings[BIOS_DATE], Buf, BUFFER_SIZE, TRUE); + } + else + { + RegGetSZ(HKEY_LOCAL_MACHINE, + L"HARDWARE\\DESCRIPTION\\System", + L"SystemBiosDate", + Buf, + BUFFER_SIZE); + } PrintRow(IDS_BIOS_DATE, FALSE, L"%s", Buf); + // clean SMBIOS data + FreeSMBiosData(SMBiosBuf); + //getting ReactOS Directory if (!GetWindowsDirectoryW(Buf, BUFFER_SIZE)) wprintf(L"Error! GetWindowsDirectory failed.");
6 years, 4 months
1
0
0
0
01/01: [WIN32SS][FONT] Fix font metrics (#713)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=35f62fc5ba0b69e7335ff…
commit 35f62fc5ba0b69e7335ff41400cb3b45660f4557 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Aug 12 22:12:13 2018 +0900 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Aug 12 15:12:13 2018 +0200 [WIN32SS][FONT] Fix font metrics (#713) Fix vertical alignment and Aspect penalty; improve font penalty system; fixes for Wine tests. This is an update of #706. See CORE-11536 for more details. The display of the following programs is fixed: - Total Commander 8.52 setup: font displayed too large - CORE-11620. - Effective File Search 6.8.1 german localization text rendering issues - CORE-14378. - Font garbage in register splash screen in Foxit Reader 7.1.5 - CORE-9767. - Calipers-1 is not displayed correctly - CORE-14302. - Some MSI-installers draw their dialogs too large (example: Click-N-Type Virtual Keyboard 3.03.0412) - CORE-13161. - Irfanview 4.50: font in zoom combobox displayed too large - CORE-14396. - Rufus: The window and controls are displayed larger than necessary - CORE-14461. --- base/shell/explorer/trayclock.cpp | 2 +- win32ss/gdi/eng/engobjects.h | 4 + win32ss/gdi/ntgdi/freetype.c | 245 ++++++++++++++++++++++++++++++-------- win32ss/gdi/ntgdi/text.c | 4 +- win32ss/user/ntuser/draw.c | 1 + win32ss/user/ntuser/painting.c | 2 +- win32ss/user/rtl/text.c | 4 +- 7 files changed, 208 insertions(+), 54 deletions(-) diff --git a/base/shell/explorer/trayclock.cpp b/base/shell/explorer/trayclock.cpp index 9575783639..b4e85d951c 100644 --- a/base/shell/explorer/trayclock.cpp +++ b/base/shell/explorer/trayclock.cpp @@ -534,7 +534,7 @@ LRESULT CTrayClockWnd::OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bH hPrevFont = (HFONT) SelectObject(hDC, hFont); - rcClient.top = (rcClient.bottom / 2) - (CurrentSize.cy / 2); + rcClient.top = (rcClient.bottom - CurrentSize.cy) / 2; rcClient.bottom = rcClient.top + CurrentSize.cy; for (i = 0, line = 0; diff --git a/win32ss/gdi/eng/engobjects.h b/win32ss/gdi/eng/engobjects.h index c79832aff9..dc579664e6 100644 --- a/win32ss/gdi/eng/engobjects.h +++ b/win32ss/gdi/eng/engobjects.h @@ -160,8 +160,12 @@ typedef struct _FONTGDI { LONG tmDescent; LONG tmInternalLeading; LONG EmHeight; + LONG Magic; } FONTGDI, *PFONTGDI; +/* The initialized 'Magic' value in FONTGDI */ +#define FONTGDI_MAGIC 0x20110311 + typedef struct _PATHGDI { PATHOBJ PathObj; } PATHGDI; diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c index 9d380c0566..31d68a1615 100644 --- a/win32ss/gdi/ntgdi/freetype.c +++ b/win32ss/gdi/ntgdi/freetype.c @@ -805,6 +805,9 @@ WeightFromStyle(const char *style_name) return FW_NORMAL; } +static FT_Error +IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight); + static INT FASTCALL IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, PSHARED_FACE SharedFace, FT_Long FontIndex, INT CharSetIndex) @@ -1024,6 +1027,10 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont, DPRINT("Num glyphs: %d\n", Face->num_glyphs); DPRINT("CharSet: %d\n", FontGDI->CharSet); + IntLockFreeType(); + IntRequestFontSize(NULL, FontGDI, 0, 0); + IntUnLockFreeType(); + /* Add this font resource to the font table */ Entry->Font = FontGDI; Entry->NotEnum = (Characteristics & FR_NOT_ENUM); @@ -1535,7 +1542,6 @@ static BOOL face_has_symbol_charmap(FT_Face ft_face) return FALSE; } - static void FASTCALL FillTMEx(TEXTMETRICW *TM, PFONTGDI FontGDI, TT_OS2 *pOS2, TT_HoriHeader *pHori, @@ -1595,16 +1601,14 @@ FillTMEx(TEXTMETRICW *TM, PFONTGDI FontGDI, Descent = pOS2->usWinDescent; } -#if 0 /* This (Wine) code doesn't seem to work correctly for us, cmd issue */ - TM->tmAscent = (FT_MulFix(Ascent, YScale) + 32) >> 6; - TM->tmDescent = (FT_MulFix(Descent, YScale) + 32) >> 6; -#else /* This (ros) code was previously affected by a FreeType bug, but it works now */ - TM->tmAscent = (Face->size->metrics.ascender + 32) >> 6; /* Units above baseline */ - TM->tmDescent = (32 - Face->size->metrics.descender) >> 6; /* Units below baseline */ -#endif - TM->tmInternalLeading = (FT_MulFix(Ascent + Descent - Face->units_per_EM, YScale) + 32) >> 6; - + if (FontGDI->Magic != FONTGDI_MAGIC) + { + IntRequestFontSize(NULL, FontGDI, 0, 0); + } + TM->tmAscent = FontGDI->tmAscent; + TM->tmDescent = FontGDI->tmDescent; TM->tmHeight = TM->tmAscent + TM->tmDescent; + TM->tmInternalLeading = FontGDI->tmInternalLeading; /* MSDN says: * el = MAX(0, LineGap - ((WinAscent + WinDescent) - (Ascender - Descender))) @@ -3023,39 +3027,104 @@ static unsigned int get_bezier_glyph_outline(FT_Outline *outline, unsigned int b return needed; } -static INT -IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG Width, LONG Height) +static FT_Error +IntRequestFontSize(PDC dc, PFONTGDI FontGDI, LONG lfWidth, LONG lfHeight) { + FT_Error error; FT_Size_RequestRec req; FT_Face face = FontGDI->SharedFace->Face; + TT_OS2 *pOS2; + TT_HoriHeader *pHori; + FT_WinFNT_HeaderRec WinFNT; + LONG Ascent, Descent, Sum, EmHeight64; + + lfWidth = abs(lfWidth); + if (lfHeight == 0) + { + if (lfWidth == 0) + { + DPRINT("lfHeight and lfWidth are zero.\n"); + lfHeight = -16; + } + else + { + lfHeight = lfWidth; + } + } - if (Width < 0) - Width = -Width; + if (lfHeight == -1) + lfHeight = -2; + + ASSERT_FREETYPE_LOCK_HELD(); + pOS2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, FT_SFNT_OS2); + pHori = (TT_HoriHeader *)FT_Get_Sfnt_Table(face, FT_SFNT_HHEA); - if (Height < 0) + if (!pOS2 || !pHori) { - Height = -Height; + error = FT_Get_WinFNT_Header(face, &WinFNT); + if (error) + return error; + + FontGDI->tmHeight = WinFNT.pixel_height; + FontGDI->tmAscent = WinFNT.ascent; + FontGDI->tmDescent = FontGDI->tmHeight - FontGDI->tmAscent; + FontGDI->tmInternalLeading = WinFNT.internal_leading; + FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading; + FontGDI->EmHeight = max(FontGDI->EmHeight, 1); + FontGDI->EmHeight = min(FontGDI->EmHeight, USHORT_MAX); + FontGDI->Magic = FONTGDI_MAGIC; + + req.type = FT_SIZE_REQUEST_TYPE_NOMINAL; + req.width = 0; + req.height = (FT_Long)(FontGDI->EmHeight << 6); + req.horiResolution = 0; + req.vertResolution = 0; + return FT_Request_Size(face, &req); } - if (Height == 0) + + if (lfHeight > 0) { - Height = dc->ppdev->devinfo.lfDefaultFont.lfHeight; + /* case (A): lfHeight is positive */ + Sum = pOS2->usWinAscent + pOS2->usWinDescent; + if (Sum == 0) + { + Ascent = pHori->Ascender; + Descent = -pHori->Descender; + Sum = Ascent + Descent; + } + else + { + Ascent = pOS2->usWinAscent; + Descent = pOS2->usWinDescent; + } + + FontGDI->tmAscent = FT_MulDiv(lfHeight, Ascent, Sum); + FontGDI->tmDescent = FT_MulDiv(lfHeight, Descent, Sum); + FontGDI->tmHeight = FontGDI->tmAscent + FontGDI->tmDescent; + FontGDI->tmInternalLeading = FontGDI->tmHeight - FT_MulDiv(lfHeight, face->units_per_EM, Sum); } - if (Height == 0) + else if (lfHeight < 0) { - Height = Width; + /* case (B): lfHeight is negative */ + FontGDI->tmAscent = FT_MulDiv(-lfHeight, pOS2->usWinAscent, face->units_per_EM); + FontGDI->tmDescent = FT_MulDiv(-lfHeight, pOS2->usWinDescent, face->units_per_EM); + FontGDI->tmHeight = FontGDI->tmAscent + FontGDI->tmDescent; + FontGDI->tmInternalLeading = FontGDI->tmHeight + lfHeight; } - if (Height < 1) - Height = 1; + FontGDI->EmHeight = FontGDI->tmHeight - FontGDI->tmInternalLeading; + FontGDI->EmHeight = max(FontGDI->EmHeight, 1); + FontGDI->EmHeight = min(FontGDI->EmHeight, USHORT_MAX); + FontGDI->Magic = FONTGDI_MAGIC; - if (Width > 0xFFFFU) - Width = 0xFFFFU; - if (Height > 0xFFFFU) - Height = 0xFFFFU; + if (lfHeight > 0) + EmHeight64 = (FontGDI->EmHeight << 6) + 31; + else + EmHeight64 = (FontGDI->EmHeight << 6); req.type = FT_SIZE_REQUEST_TYPE_NOMINAL; - req.width = (FT_Long)(Width << 6); - req.height = (FT_Long)(Height << 6); + req.width = 0; + req.height = EmHeight64; req.horiResolution = 0; req.vertResolution = 0; return FT_Request_Size(face, &req); @@ -3255,13 +3324,23 @@ ftGdiGetGlyphOutline( IntLockFreeType(); - /* Scaling transform */ - /*if (aveWidth)*/ + /* Width scaling transform */ + if (widthRatio != 1.0) { + FT_Matrix scaleMat; + scaleMat.xx = FT_FixedFromFloat(widthRatio); + scaleMat.xy = 0; + scaleMat.yx = 0; + scaleMat.yy = FT_FixedFromFloat(1.0); + + FT_Matrix_Multiply(&scaleMat, &transMat); + needsTransform = TRUE; + } + /* World transform */ + { FT_Matrix ftmatrix; FLOATOBJ efTemp; - PMATRIX pmx = DC_pmxWorldToDevice(dc); /* Create a freetype matrix, by converting to 16.16 fixpoint format */ @@ -3281,8 +3360,11 @@ ftGdiGetGlyphOutline( FLOATOBJ_MulLong(&efTemp, 0x00010000); ftmatrix.yy = FLOATOBJ_GetLong(&efTemp); - FT_Matrix_Multiply(&ftmatrix, &transMat); - needsTransform = TRUE; + if (memcmp(&ftmatrix, &identityMat, sizeof(identityMat)) != 0) + { + FT_Matrix_Multiply(&ftmatrix, &transMat); + needsTransform = TRUE; + } } /* Rotation transform */ @@ -3719,8 +3801,9 @@ TextIntGetTextExtentPoint(PDC dc, previous = glyph_index; String++; } - ascender = (face->size->metrics.ascender + 32) >> 6; /* Units above baseline */ - descender = (32 - face->size->metrics.descender) >> 6; /* Units below baseline */ + ASSERT(FontGDI->Magic == FONTGDI_MAGIC); + ascender = FontGDI->tmAscent; /* Units above baseline */ + descender = FontGDI->tmDescent; /* Units below baseline */ IntUnLockFreeType(); Size->cx = (TotalWidth + 32) >> 6; @@ -3947,10 +4030,12 @@ ftGdiGetTextMetricsW( FontGDI = ObjToGDI(TextObj->Font, FONT); Face = FontGDI->SharedFace->Face; + IntLockFreeType(); Error = IntRequestFontSize(dc, FontGDI, plf->lfWidth, plf->lfHeight); FtSetCoordinateTransform(Face, DC_pmxWorldToDevice(dc)); IntUnLockFreeType(); + if (0 != Error) { DPRINT1("Error in setting pixel sizes: %u\n", Error); @@ -4061,7 +4146,6 @@ GetFontPenalty(const LOGFONTW * LogFont, ASSERT(Otm); ASSERT(LogFont); - /* FIXME: Aspect Penalty 30 */ /* FIXME: IntSizeSynth Penalty 20 */ /* FIXME: SmallPenalty Penalty 1 */ /* FIXME: FaceNameSubst Penalty 500 */ @@ -4132,7 +4216,7 @@ GetFontPenalty(const LOGFONTW * LogFont, Byte = (LogFont->lfPitchAndFamily & 0x0F); if (Byte == DEFAULT_PITCH) Byte = VARIABLE_PITCH; - if (Byte == FIXED_PITCH) + if ((Byte & FIXED_PITCH) || (Byte & MONO_FONT)) { if (TM->tmPitchAndFamily & _TMPF_VARIABLE_PITCH) { @@ -4142,7 +4226,7 @@ GetFontPenalty(const LOGFONTW * LogFont, Penalty += 15000; } } - if (Byte == VARIABLE_PITCH) + if (Byte & VARIABLE_PITCH) { if (!(TM->tmPitchAndFamily & _TMPF_VARIABLE_PITCH)) { @@ -4193,12 +4277,37 @@ GetFontPenalty(const LOGFONTW * LogFont, Byte = (LogFont->lfPitchAndFamily & 0xF0); if (Byte != FF_DONTCARE) { - if (Byte != (TM->tmPitchAndFamily & 0xF0)) + if (Byte & FF_MODERN) + { + if (TM->tmPitchAndFamily & _TMPF_VARIABLE_PITCH) + { + /* FixedPitch Penalty 15000 */ + /* Requested a fixed pitch font, but the candidate is a + variable pitch font. */ + Penalty += 15000; + } + } + + if ((Byte & FF_ROMAN) || (Byte & FF_SWISS)) + { + if (!(TM->tmPitchAndFamily & _TMPF_VARIABLE_PITCH)) + { + /* PitchVariable Penalty 350 */ + /* Requested a variable pitch font, but the candidate is not a + variable pitch font. */ + Penalty += 350; + } + } + +#define FF_MASK (FF_DECORATIVE | FF_SCRIPT | FF_SWISS) + if ((Byte & FF_MASK) != (TM->tmPitchAndFamily & FF_MASK)) { /* Family Penalty 9000 */ /* Requested a family, but the candidate's family is different. */ Penalty += 9000; } +#undef FF_MASK + if ((TM->tmPitchAndFamily & 0xF0) == FF_DONTCARE) { /* FamilyUnknown Penalty 8000 */ @@ -4373,6 +4482,22 @@ GetFontPenalty(const LOGFONTW * LogFont, Penalty += 2; } + if (TM->tmAveCharWidth >= 5 && TM->tmHeight >= 5) + { + if (TM->tmAveCharWidth / TM->tmHeight >= 3) + { + /* Aspect Penalty 30 */ + /* The aspect rate is >= 3. It seems like a bad font. */ + Penalty += ((TM->tmAveCharWidth / TM->tmHeight) - 2) * 30; + } + else if (TM->tmHeight / TM->tmAveCharWidth >= 3) + { + /* Aspect Penalty 30 */ + /* The aspect rate is >= 3. It seems like a bad font. */ + Penalty += ((TM->tmHeight / TM->tmAveCharWidth) - 2) * 30; + } + } + if (Penalty < 200) { DPRINT("WARNING: Penalty:%ld < 200: RequestedNameW:%ls, " @@ -4431,6 +4556,10 @@ FindBestFontFromList(FONTOBJ **FontObj, ULONG *MatchPenalty, /* update FontObj if lowest penalty */ if (Otm) { + IntLockFreeType(); + IntRequestFontSize(NULL, FontGDI, LogFont->lfWidth, LogFont->lfHeight); + IntUnLockFreeType(); + OtmSize = IntGetOutlineTextMetrics(FontGDI, OtmSize, Otm); if (!OtmSize) continue; @@ -4546,7 +4675,23 @@ TextIntRealizeFont(HFONT FontHandle, PTEXTOBJ pTextObj) } else { + UNICODE_STRING FaceName; PFONTGDI FontGdi = ObjToGDI(TextObj->Font, FONT); + + IntLockFreeType(); + IntRequestFontSize(NULL, FontGdi, pLogFont->lfWidth, pLogFont->lfHeight); + IntUnLockFreeType(); + + RtlInitUnicodeString(&FaceName, NULL); + IntGetFontLocalizedName(&FaceName, FontGdi->SharedFace, TT_NAME_ID_FONT_FAMILY, gusLanguageID); + + /* truncated copy */ + FaceName.Length = (USHORT)min(FaceName.Length, (LF_FACESIZE - 1) * sizeof(WCHAR)); + FaceName.MaximumLength = (USHORT)(FaceName.Length + sizeof(UNICODE_NULL)); + RtlCopyMemory(TextObj->FaceName, FaceName.Buffer, FaceName.MaximumLength); + + RtlFreeUnicodeString(&FaceName); + // Need hdev, when freetype is loaded need to create DEVOBJ for // Consumer and Producer. TextObj->Font->iUniq = 1; // Now it can be cached. @@ -5298,33 +5443,35 @@ GreExtTextOutW( goto Cleanup; } + /* NOTE: Don't trust face->size->metrics.ascender and descender values. */ if (dc->pdcattr->iGraphicsMode == GM_ADVANCED) { pmxWorldToDevice = DC_pmxWorldToDevice(dc); FtSetCoordinateTransform(face, pmxWorldToDevice); - fixAscender = ScaleLong(face->size->metrics.ascender, &pmxWorldToDevice->efM22); - fixDescender = ScaleLong(face->size->metrics.descender, &pmxWorldToDevice->efM22); + fixAscender = ScaleLong(FontGDI->tmAscent, &pmxWorldToDevice->efM22) << 6; + fixDescender = ScaleLong(FontGDI->tmDescent, &pmxWorldToDevice->efM22) << 6; } else { pmxWorldToDevice = (PMATRIX)&gmxWorldToDeviceDefault; FtSetCoordinateTransform(face, pmxWorldToDevice); - fixAscender = face->size->metrics.ascender; - fixDescender = face->size->metrics.descender; + fixAscender = FontGDI->tmAscent << 6; + fixDescender = FontGDI->tmDescent << 6; } /* * Process the vertical alignment and determine the yoff. */ - - if (pdcattr->lTextAlign & TA_BASELINE) +#define VALIGN_MASK (TA_TOP | TA_BASELINE | TA_BOTTOM) + if ((pdcattr->lTextAlign & VALIGN_MASK) == TA_BASELINE) yoff = 0; - else if (pdcattr->lTextAlign & TA_BOTTOM) - yoff = -fixDescender >> 6; + else if ((pdcattr->lTextAlign & VALIGN_MASK) == TA_BOTTOM) + yoff = -(fixDescender >> 6); else /* TA_TOP */ yoff = fixAscender >> 6; +#undef VALIGN_MASK use_kerning = FT_HAS_KERNING(face); previous = 0; @@ -5501,7 +5648,7 @@ GreExtTextOutW( DestRect.left = BackgroundLeft; DestRect.right = (TextLeft + (realglyph->root.advance.x >> 10) + 32) >> 6; DestRect.top = TextTop + yoff - ((fixAscender + 32) >> 6); - DestRect.bottom = TextTop + yoff + ((32 - fixDescender) >> 6); + DestRect.bottom = DestRect.top + ((fixAscender + fixDescender) >> 6); MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom); if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR)) { @@ -5641,7 +5788,7 @@ GreExtTextOutW( DestRect.left = BackgroundLeft; DestRect.right = (TextLeft + (realglyph->root.advance.x >> 10) + 32) >> 6; DestRect.top = TextTop + yoff - ((fixAscender + 32) >> 6); - DestRect.bottom = TextTop + yoff + ((32 - fixDescender) >> 6); + DestRect.bottom = DestRect.top + ((fixAscender + fixDescender) >> 6); if (dc->dctype == DCTYPE_DIRECT) MouseSafetyOnDrawStart(dc->ppdev, DestRect.left, DestRect.top, DestRect.right, DestRect.bottom); diff --git a/win32ss/gdi/ntgdi/text.c b/win32ss/gdi/ntgdi/text.c index 5c7e3664f2..ec0503fa46 100644 --- a/win32ss/gdi/ntgdi/text.c +++ b/win32ss/gdi/ntgdi/text.c @@ -513,12 +513,12 @@ NtGdiGetTextFaceW( TextObj = RealizeFontInit(hFont); ASSERT(TextObj != NULL); - fLen = wcslen(TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfFaceName) + 1; + fLen = wcslen(TextObj->FaceName) + 1; if (FaceName != NULL) { Count = min(Count, fLen); - Status = MmCopyToCaller(FaceName, TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfFaceName, Count * sizeof(WCHAR)); + Status = MmCopyToCaller(FaceName, TextObj->FaceName, Count * sizeof(WCHAR)); if (!NT_SUCCESS(Status)) { TEXTOBJ_UnlockText(TextObj); diff --git a/win32ss/user/ntuser/draw.c b/win32ss/user/ntuser/draw.c index 7046453f93..f648287c55 100644 --- a/win32ss/user/ntuser/draw.c +++ b/win32ss/user/ntuser/draw.c @@ -814,6 +814,7 @@ BOOL FASTCALL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags) lf.lfWidth = 0; lf.lfWeight = FW_NORMAL; lf.lfCharSet = DEFAULT_CHARSET; + lf.lfQuality = NONANTIALIASED_QUALITY; RtlCopyMemory(lf.lfFaceName, L"Marlett", sizeof(L"Marlett")); hFont = GreCreateFontIndirectW(&lf); /* save font and text color */ diff --git a/win32ss/user/ntuser/painting.c b/win32ss/user/ntuser/painting.c index 6a8b2a9bf7..4ffcdab989 100644 --- a/win32ss/user/ntuser/painting.c +++ b/win32ss/user/ntuser/painting.c @@ -2147,7 +2147,7 @@ UserDrawCaptionText( { // Faster while in setup. GreExtTextOutW( hDc, lpRc->left, - lpRc->top + (lpRc->bottom - lpRc->top) / 2 - Size.cy / 2, // DT_SINGLELINE && DT_VCENTER + lpRc->top + (lpRc->bottom - lpRc->top - Size.cy) / 2, // DT_SINGLELINE && DT_VCENTER ETO_CLIPPED, (RECTL *)lpRc, Text->Buffer, diff --git a/win32ss/user/rtl/text.c b/win32ss/user/rtl/text.c index f1ed9d714d..9ab726c80a 100644 --- a/win32ss/user/rtl/text.c +++ b/win32ss/user/rtl/text.c @@ -1157,8 +1157,10 @@ INT WINAPI DrawTextExWorker( HDC hdc, } else { -#endif + y = rect->top + (rect->bottom - rect->top + (invert_y ? size.cy : -size.cy)) / 2; +#else y = rect->top + (rect->bottom - rect->top) / 2 + (invert_y ? (size.cy / 2) : (-size.cy / 2)); +#endif #ifdef __REACTOS__ } }
6 years, 4 months
1
0
0
0
01/01: [NETAPI32] Add DFS RPC interface and some DFS stubs
by Eric Kohl
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=956086d369727a2c15604…
commit 956086d369727a2c15604a997277a1838736ba8a Author: Eric Kohl <eric.kohl(a)reactos.org> AuthorDate: Sun Aug 12 14:13:26 2018 +0200 Commit: Eric Kohl <eric.kohl(a)reactos.org> CommitDate: Sun Aug 12 14:31:07 2018 +0200 [NETAPI32] Add DFS RPC interface and some DFS stubs --- dll/win32/netapi32/CMakeLists.txt | 3 + dll/win32/netapi32/dfs.c | 128 ++++++++ dll/win32/netapi32/netapi32.spec | 14 +- sdk/include/reactos/idl/netdfs.idl | 581 +++++++++++++++++++++++++++++++++++++ 4 files changed, 719 insertions(+), 7 deletions(-) diff --git a/dll/win32/netapi32/CMakeLists.txt b/dll/win32/netapi32/CMakeLists.txt index 0339f76604..c5066c09e4 100644 --- a/dll/win32/netapi32/CMakeLists.txt +++ b/dll/win32/netapi32/CMakeLists.txt @@ -9,6 +9,7 @@ add_rpc_files(client ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/atsvc.idl ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/browser.idl ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/dssetup.idl + ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/netdfs.idl ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/netlogon.idl ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/srvsvc.idl ${REACTOS_SOURCE_DIR}/sdk/include/reactos/idl/wkssvc.idl) @@ -16,6 +17,7 @@ add_rpc_files(client list(APPEND SOURCE apibuf.c browser.c + dfs.c display.c dssetup.c group.c @@ -38,6 +40,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/atsvc_c.c ${CMAKE_CURRENT_BINARY_DIR}/browser_c.c ${CMAKE_CURRENT_BINARY_DIR}/dssetup_c.c + ${CMAKE_CURRENT_BINARY_DIR}/netdfs_c.c ${CMAKE_CURRENT_BINARY_DIR}/netlogon_c.c ${CMAKE_CURRENT_BINARY_DIR}/srvsvc_c.c ${CMAKE_CURRENT_BINARY_DIR}/wkssvc_c.c) diff --git a/dll/win32/netapi32/dfs.c b/dll/win32/netapi32/dfs.c new file mode 100644 index 0000000000..af4bcddaf5 --- /dev/null +++ b/dll/win32/netapi32/dfs.c @@ -0,0 +1,128 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: NetAPI DLL + * FILE: reactos/dll/win32/netapi32/dfs.c + * PURPOSE: Distributed File System Service interface code + * PROGRAMMERS: Eric Kohl + */ + +/* INCLUDES ******************************************************************/ + +#include "netapi32.h" + +#include <rpc.h> +#include "netdfs_c.h" + +WINE_DEFAULT_DEBUG_CHANNEL(netapi32); + +/* FUNCTIONS *****************************************************************/ + +NET_API_STATUS +WINAPI +NetDfsAdd( + _In_ LPWSTR DfsEntryPath, + _In_ LPWSTR ServerName, + _In_ LPWSTR PathName, + _In_opt_ LPWSTR Comment, + _In_ DWORD Flags) +{ +#if 0 + NET_API_STATUS + __stdcall + status = NetrDfsAdd(DfsEntryPath, + ServerName, + PathName, + Comment, + Flags); +#endif + UNIMPLEMENTED; + return 0; +} + + +NET_API_STATUS +WINAPI +NetDfsAddFtRoot( + _In_ LPWSTR ServerName, + _In_ LPWSTR RootShare, + _In_ LPWSTR FtDfsName, + _In_opt_ LPWSTR Comment, + _In_ DWORD Flags) +{ + UNIMPLEMENTED; + return 0; +} + + +NET_API_STATUS +WINAPI +NetDfsAddStdRoot( + _In_ LPWSTR ServerName, + _In_ LPWSTR RootShare, + _In_opt_ LPWSTR Comment, + _In_ DWORD Flags) +{ + UNIMPLEMENTED; + return 0; +} + + +NET_API_STATUS +WINAPI +NetDfsAddStdRootForced( + _In_ LPWSTR ServerName, + _In_ LPWSTR RootShare, + _In_opt_ LPWSTR Comment, + _In_ LPWSTR Store) +{ + UNIMPLEMENTED; + return 0; +} + + +NET_API_STATUS +WINAPI +NetDfsEnum( + _In_ LPWSTR DfsName, + _In_ DWORD Level, + _In_ DWORD PrefMaxLen, + _Out_ LPBYTE *Buffer, + _Out_ LPDWORD EntriesRead, + _Out_ LPDWORD ResumeHandle) +{ + UNIMPLEMENTED; + return 0; +} + + +NET_API_STATUS +WINAPI +NetDfsGetClientInfo( + _In_ LPWSTR DfsEntryPath, + _In_ LPWSTR ServerName, + _In_ LPWSTR ShareName, + _In_ DWORD Level, + _Out_ LPBYTE *Buffer) +{ + UNIMPLEMENTED; + return 0; +} + + +/* NetDfsGetDcAddress */ + + +NET_API_STATUS +WINAPI +NetDfsGetFtContainerSecurity( + _In_ LPWSTR DomainName, + _In_ SECURITY_INFORMATION SecurityInformation, + _Out_ PSECURITY_DESCRIPTOR *ppSecurityDescriptor, + _Out_ LPDWORD lpcbSecurityDescriptor) +{ + UNIMPLEMENTED; + return 0; +} + + +/* EOF */ diff --git a/dll/win32/netapi32/netapi32.spec b/dll/win32/netapi32/netapi32.spec index 333d1405b2..d00d2f4162 100644 --- a/dll/win32/netapi32/netapi32.spec +++ b/dll/win32/netapi32/netapi32.spec @@ -114,14 +114,14 @@ @ stdcall NetConfigGetAll(wstr wstr ptr) @ stdcall NetConfigSet(wstr wstr wstr long long ptr long) @ stdcall NetConnectionEnum(wstr wstr long ptr long ptr ptr ptr) -@ stub NetDfsAdd -@ stub NetDfsAddFtRoot -@ stub NetDfsAddStdRoot -@ stub NetDfsAddStdRootForced -@ stub NetDfsEnum -@ stub NetDfsGetClientInfo +@ stdcall NetDfsAdd(wstr wstr wstr wstr long) +@ stdcall NetDfsAddFtRoot(wstr wstr wstr wstr long) +@ stdcall NetDfsAddStdRoot(wstr wstr wstr long) +@ stdcall NetDfsAddStdRootForced(wstr wstr wstr wstr) +@ stdcall NetDfsEnum(wstr long long ptr ptr ptr) +@ stdcall NetDfsGetClientInfo(wstr wstr wstr long ptr) @ stub NetDfsGetDcAddress -@ stub NetDfsGetFtContainerSecurity +@ stdcall NetDfsGetFtContainerSecurity(wstr long ptr ptr); @ stub NetDfsGetInfo @ stub NetDfsGetSecurity @ stub NetDfsGetStdContainerSecurity diff --git a/sdk/include/reactos/idl/netdfs.idl b/sdk/include/reactos/idl/netdfs.idl new file mode 100644 index 0000000000..bd4ca88ce0 --- /dev/null +++ b/sdk/include/reactos/idl/netdfs.idl @@ -0,0 +1,581 @@ +/* + * Distributed File System service interface definition + */ + +#include <ms-dtyp.idl> + +typedef DWORD NET_API_STATUS; + +typedef WCHAR *NETDFS_SERVER_OR_DOMAIN_HANDLE; + +typedef [v1_enum] enum _DFS_TARGET_PRIORITY_CLASS +{ + DfsInvalidPriorityClass = -1, + DfsSiteCostNormalPriorityClass = 0, + DfsGlobalHighPriorityClass = 1, + DfsSiteCostHighPriorityClass = 2, + DfsSiteCostLowPriorityClass = 3, + DfsGlobalLowPriorityClass = 4 +} DFS_TARGET_PRIORITY_CLASS; + +typedef struct _DFS_TARGET_PRIORITY +{ + DFS_TARGET_PRIORITY_CLASS TargetPriorityClass; + unsigned short TargetPriorityRank; + unsigned short Reserved; +} DFS_TARGET_PRIORITY; + +typedef struct _DFS_STORAGE_INFO +{ + unsigned long State; + [string] WCHAR *ServerName; + [string] WCHAR *ShareName; +} DFS_STORAGE_INFO; + +typedef struct _DFS_STORAGE_INFO_1 +{ + unsigned long State; + [string] WCHAR *ServerName; + [string] WCHAR * ShareName; + DFS_TARGET_PRIORITY TargetPriority; +} DFS_STORAGE_INFO_1, *PDFS_STORAGE_INFO_1, *LPDFS_STORAGE_INFO_1; + +typedef struct _DFSM_ROOT_LIST_ENTRY +{ + [string, unique] WCHAR *ServerShare; +} DFSM_ROOT_LIST_ENTRY; + +typedef struct _DFSM_ROOT_LIST +{ + DWORD cEntries; + [size_is(cEntries)] DFSM_ROOT_LIST_ENTRY Entry[]; +} DFSM_ROOT_LIST; + +typedef enum +{ + DFS_NAMESPACE_VERSION_ORIGIN_COMBINED = 0, + DFS_NAMESPACE_VERSION_ORIGIN_SERVER, + DFS_NAMESPACE_VERSION_ORIGIN_DOMAIN +} DFS_NAMESPACE_VERSION_ORIGIN; + +typedef struct _DFS_SUPPORTED_NAMESPACE_VERSION_INFO +{ + unsigned long DomainDfsMajorVersion; + unsigned long DomainDfsMinorVersion; + ULONGLONG DomainDfsCapabilities; + unsigned long StandaloneDfsMajorVersion; + unsigned long StandaloneDfsMinorVersion; + ULONGLONG StandaloneDfsCapabilities; +} DFS_SUPPORTED_NAMESPACE_VERSION_INFO, *PDFS_SUPPORTED_NAMESPACE_VERSION_INFO; + +typedef struct _DFS_INFO_1 +{ + [string] WCHAR *EntryPath; +} DFS_INFO_1; + +typedef struct _DFS_INFO_2 +{ + [string] WCHAR *EntryPath; + [string] WCHAR *Comment; + DWORD State; + DWORD NumberOfStorages; +} DFS_INFO_2; + +typedef struct _DFS_INFO_3 +{ + [string] WCHAR *EntryPath; + [string] WCHAR *Comment; + DWORD State; + DWORD NumberOfStorages; + [size_is(NumberOfStorages)] DFS_STORAGE_INFO *Storage; +} DFS_INFO_3; + +typedef struct _DFS_INFO_4 +{ + [string] WCHAR *EntryPath; + [string] WCHAR *Comment; + DWORD State; + unsigned long Timeout; + GUID Guid; + DWORD NumberOfStorages; + [size_is(NumberOfStorages)] DFS_STORAGE_INFO *Storage; +} DFS_INFO_4; + +typedef struct _DFS_INFO_5 +{ + [string] WCHAR *EntryPath; + [string] WCHAR *Comment; + DWORD State; + unsigned long Timeout; + GUID Guid; + unsigned long PropertyFlags; + unsigned long MetadataSize; + DWORD NumberOfStorages; +} DFS_INFO_5; + +typedef struct _DFS_INFO_6 +{ + [string] WCHAR *EntryPath; + [string] WCHAR *Comment; + DWORD State; + unsigned long Timeout; + GUID Guid; + unsigned long PropertyFlags; + unsigned long MetadataSize; + DWORD NumberOfStorages; + [size_is(NumberOfStorages)] DFS_STORAGE_INFO_1 *Storage; +} DFS_INFO_6; + +typedef struct _DFS_INFO_7 +{ + GUID GenerationGuid; +} DFS_INFO_7; + +typedef struct _DFS_INFO_8 +{ + [string] WCHAR *EntryPath; + [string] WCHAR *Comment; + DWORD State; + unsigned long Timeout; GUID Guid; + unsigned long PropertyFlags; + unsigned long MetadataSize; + ULONG SecurityDescriptorLength; + [size_is(SecurityDescriptorLength)] PUCHAR pSecurityDescriptor; + DWORD NumberOfStorages; +} DFS_INFO_8, *LPDFS_INFO_8; + +typedef struct _DFS_INFO_9 +{ + [string] WCHAR *EntryPath; + [string] WCHAR *Comment; + DWORD State; + unsigned long Timeout; + GUID Guid; + unsigned long PropertyFlags; + unsigned long MetadataSize; + ULONG SecurityDescriptorLength; + [size_is(SecurityDescriptorLength)] PUCHAR pSecurityDescriptor; + DWORD NumberOfStorages; + [size_is(NumberOfStorages)] LPDFS_STORAGE_INFO_1 Storage; +} DFS_INFO_9, *LPDFS_INFO_9; + +typedef struct _DFS_INFO_50 +{ + unsigned long NamespaceMajorVersion; + unsigned long NamespaceMinorVersion; + unsigned __int64 NamespaceCapabilities; +} DFS_INFO_50; + +typedef struct _DFS_INFO_100 +{ + [string] WCHAR *Comment; +} DFS_INFO_100; + +typedef struct _DFS_INFO_101 +{ + unsigned long State; +} DFS_INFO_101; + +typedef struct _DFS_INFO_102 +{ + unsigned long Timeout; +} DFS_INFO_102; + +typedef struct _DFS_INFO_103 +{ + unsigned long PropertyFlagMask; + unsigned long PropertyFlags; +} DFS_INFO_103; + +typedef struct _DFS_INFO_104 +{ + DFS_TARGET_PRIORITY TargetPriority; +} DFS_INFO_104; + +typedef struct _DFS_INFO_105 +{ + [string] WCHAR *Comment; + DWORD State; + unsigned long Timeout; + unsigned long PropertyFlagMask; + unsigned long PropertyFlags; +} DFS_INFO_105; + +typedef struct _DFS_INFO_106 +{ + DWORD State; + DFS_TARGET_PRIORITY TargetPriority; +} DFS_INFO_106; + +typedef struct _DFS_INFO_107 +{ + [string] WCHAR *Comment; + DWORD State; + unsigned long Timeout; + unsigned long PropertyFlagMask; + unsigned long PropertyFlags; + ULONG SecurityDescriptorLength; + [size_is(SecurityDescriptorLength)] PUCHAR pSecurityDescriptor; +} DFS_INFO_107; + +typedef struct _DFS_INFO_150 +{ + ULONG SecurityDescriptorLength; + [size_is(SecurityDescriptorLength)] PUCHAR pSecurityDescriptor; +} DFS_INFO_150; + +typedef struct _DFS_INFO_200 +{ + [string] WCHAR *FtDfsName; +} DFS_INFO_200; + +typedef struct _DFS_INFO_300 +{ + DWORD Flags; + [string] WCHAR *DfsName; +} DFS_INFO_300; + +typedef [switch_type(unsigned long)] union _DFS_INFO_STRUCT +{ + [case(1)] DFS_INFO_1 *DfsInfo1; + [case(2)] DFS_INFO_2 *DfsInfo2; + [case(3)] DFS_INFO_3 *DfsInfo3; + [case(4)] DFS_INFO_4 *DfsInfo4; + [case(5)] DFS_INFO_5 *DfsInfo5; + [case(6)] DFS_INFO_6 *DfsInfo6; + [case(7)] DFS_INFO_7 *DfsInfo7; + [case(8)] DFS_INFO_8 *DfsInfo8; + [case(9)] DFS_INFO_9 *DfsInfo9; + [case(50)] DFS_INFO_50 *DfsInfo50; + [case(100)] DFS_INFO_100 *DfsInfo100; + [case(101)] DFS_INFO_101 *DfsInfo101; + [case(102)] DFS_INFO_102 *DfsInfo102; + [case(103)] DFS_INFO_103 *DfsInfo103; + [case(104)] DFS_INFO_104 *DfsInfo104; + [case(105)] DFS_INFO_105 *DfsInfo105; + [case(106)] DFS_INFO_106 *DfsInfo106; + [case(107)] DFS_INFO_107 *DfsInfo107; + [case(150)] DFS_INFO_150 *DfsInfo150; + [default]; +} DFS_INFO_STRUCT; + +typedef struct _DFS_INFO_1_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] DFS_INFO_1 *Buffer; +} DFS_INFO_1_CONTAINER; + +typedef struct _DFS_INFO_2_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] DFS_INFO_2 *Buffer; +} DFS_INFO_2_CONTAINER; + +typedef struct _DFS_INFO_3_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] DFS_INFO_3 *Buffer; +} DFS_INFO_3_CONTAINER; + +typedef struct _DFS_INFO_4_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] DFS_INFO_4 *Buffer; +} DFS_INFO_4_CONTAINER; + +typedef struct _DFS_INFO_5_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] DFS_INFO_5 *Buffer; +} DFS_INFO_5_CONTAINER; + +typedef struct _DFS_INFO_6_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] DFS_INFO_6 *Buffer; +} DFS_INFO_6_CONTAINER; + +typedef struct _DFS_INFO_8_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] LPDFS_INFO_8 Buffer; +} DFS_INFO_8_CONTAINER, *LPDFS_INFO_8_CONTAINER; + +typedef struct _DFS_INFO_9_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] LPDFS_INFO_9 Buffer; +} DFS_INFO_9_CONTAINER, *LPDFS_INFO_9_CONTAINER; + +typedef struct _DFS_INFO_200_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] DFS_INFO_200 *Buffer; +} DFS_INFO_200_CONTAINER; + +typedef struct _DFS_INFO_300_CONTAINER +{ + DWORD EntriesRead; + [size_is(EntriesRead)] DFS_INFO_300 *Buffer; +} DFS_INFO_300_CONTAINER; + +typedef struct _DFS_INFO_ENUM_STRUCT +{ + DWORD Level; + [switch_is(Level)] union + { + [case(1)] DFS_INFO_1_CONTAINER *DfsInfo1Container; + [case(2)] DFS_INFO_2_CONTAINER *DfsInfo2Container; + [case(3)] DFS_INFO_3_CONTAINER *DfsInfo3Container; + [case(4)] DFS_INFO_4_CONTAINER *DfsInfo4Container; + [case(5)] DFS_INFO_5_CONTAINER *DfsInfo5Container; + [case(6)] DFS_INFO_6_CONTAINER *DfsInfo6Container; + [case(8)] DFS_INFO_8_CONTAINER *DfsInfo8Container; + [case(9)] DFS_INFO_9_CONTAINER *DfsInfo9Container; + [case(200)] DFS_INFO_200_CONTAINER *DfsInfo200Container; + [case(300)] DFS_INFO_300_CONTAINER *DfsInfo300Container; + } DfsInfoContainer; +} DFS_INFO_ENUM_STRUCT; + +[ + uuid(4fc742e0-4a10-11cf-8273-00aa004ae673), + version(3.0), + pointer_default(unique), +#ifdef __midl + ms_union, +#endif + endpoint("ncacn_np:[\\pipe\\netdfs]") +#ifndef __midl + ,implicit_handle(handle_t hBinding) +#endif +] +interface netdfs +{ + /* Function 0 */ + DWORD + __stdcall + NetrDfsManagerGetVersion(); + + /* Function 1 */ + NET_API_STATUS + __stdcall + NetrDfsAdd( + [in, string] WCHAR *DfsEntryPath, + [in, string] WCHAR *ServerName, + [in, unique, string] WCHAR *ShareName, + [in, unique, string] WCHAR *Comment, + [in] DWORD Flags); + + /* Function 2 */ + NET_API_STATUS + __stdcall + NetrDfsRemove( + [in, string] WCHAR *DfsEntryPath, + [in, unique, string] WCHAR *ServerName, + [in, unique, string] WCHAR *ShareName); + + /* Function 3 */ + NET_API_STATUS + __stdcall + NetrDfsSetInfo( + [in, string] WCHAR * DfsEntryPath, + [in, unique, string] WCHAR *ServerName, + [in, unique, string] WCHAR *ShareName, + [in] DWORD Level, + [in, switch_is(Level)] DFS_INFO_STRUCT *DfsInfo); + + /* Function 4 */ + NET_API_STATUS + __stdcall + NetrDfsGetInfo( + [in, string] WCHAR *DfsEntryPath, + [in, unique, string] WCHAR *ServerName, + [in, unique, string] WCHAR *ShareName, + [in] DWORD Level, + [out, switch_is(Level)] DFS_INFO_STRUCT *DfsInfo); + + /* Function 5 */ + NET_API_STATUS + __stdcall + NetrDfsEnum( + [in] DWORD Level, + [in] DWORD PrefMaxLen, + [in, out, unique] DFS_INFO_ENUM_STRUCT *DfsEnum, + [in, out, unique] DWORD *ResumeHandle); + + /* Function 6 */ + NET_API_STATUS + __stdcall + NetrDfsRename( + [in, string] WCHAR *DfsEntryPath, + [in, string] WCHAR *NewDfsEntryPath, + [in] unsigned long Flags); + + /* Function 7 - Not used on wire */ + void + __stdcall + NetrDfsMove(void); + + /* Function 8 - Not used on wire */ + void + __stdcall + NetrDfsManagerGetConfigInfo(void); + + /* Function 9 - Not used on wire */ + void + __stdcall + NetrDfsManagerSendSiteInfo(void); + + /* Function 10 */ + NET_API_STATUS + __stdcall + NetrDfsAddFtRoot( + [in, string] WCHAR *ServerName, + [in, string] WCHAR *DcName, + [in, string] WCHAR *RootShare, + [in, string] WCHAR *FtDfsName, + [in, string] WCHAR *Comment, + [in, string] WCHAR *ConfigDN, + [in] BOOLEAN NewFtDfs, + [in] DWORD ApiFlags, + [in, out, unique] DFSM_ROOT_LIST **ppRootList); + + /* Function 11 */ + NET_API_STATUS + __stdcall + NetrDfsRemoveFtRoot( + [in, string] WCHAR *ServerName, + [in, string] WCHAR *DcName, + [in, string] WCHAR *RootShare, + [in, string] WCHAR *FtDfsName, + [in] DWORD ApiFlags, + [in, out, unique] DFSM_ROOT_LIST **ppRootList); + + /* Function 12 */ + NET_API_STATUS + __stdcall + NetrDfsAddStdRoot( + [in, string] WCHAR *ServerName, + [in, string] WCHAR *RootShare, + [in, string] WCHAR *Comment, + [in] DWORD ApiFlags); + + /* Function 13 */ + NET_API_STATUS + __stdcall + NetrDfsRemoveStdRoot( + [in, string] WCHAR *ServerName, + [in, string] WCHAR *RootShare, + [in] DWORD ApiFlags); + + /* Function 14 */ + NET_API_STATUS + __stdcall + NetrDfsManagerInitialize( + [in, string] WCHAR *ServerName, + [in] DWORD Flags); + + /* Function 15 */ + NET_API_STATUS + __stdcall + NetrDfsAddStdRootForced( + [in, string] WCHAR *ServerName, + [in, string] WCHAR *RootShare, + [in, string] WCHAR *Comment, + [in, string] WCHAR *Share); + + /* Function 16 */ + NET_API_STATUS + __stdcall + NetrDfsGetDcAddress( + [in, string] WCHAR *ServerName, + [in, out, string] WCHAR **DcName, + [in, out] BOOLEAN *IsRoot, + [in, out] unsigned long *Timeout); + + /* Function 17 */ + NET_API_STATUS + __stdcall + NetrDfsSetDcAddress( + [in, string] WCHAR *ServerName, + [in, string] WCHAR *DcName, + [in] DWORD Timeout, + [in] DWORD Flags); + + /* Function 18 */ + NET_API_STATUS + __stdcall + NetrDfsFlushFtTable( + [in, string] WCHAR *DcName, + [in, string] WCHAR *wszFtDfsName); + + /* Function 19 */ + NET_API_STATUS + __stdcall + NetrDfsAdd2( + [in, string] WCHAR *DfsEntryPath, + [in, string] WCHAR *DcName, + [in, string] WCHAR *ServerName, + [in, unique, string] WCHAR *ShareName, + [in, unique, string] WCHAR *Comment, + [in] DWORD Flags, + [in, out, unique] DFSM_ROOT_LIST **ppRootList); + + /* Function 20 */ + NET_API_STATUS + __stdcall + NetrDfsRemove2( + [in, string] WCHAR *DfsEntryPath, + [in, string] WCHAR *DcName, + [in, unique, string] WCHAR *ServerName, + [in, unique, string] WCHAR *ShareName, + [in, out, unique] DFSM_ROOT_LIST **ppRootList); + + /* Function 21 */ + NET_API_STATUS + __stdcall + NetrDfsEnumEx( + [in, string] WCHAR *DfsEntryPath, + [in] DWORD Level, + [in] DWORD PrefMaxLen, + [in, out, unique] DFS_INFO_ENUM_STRUCT *DfsEnum, + [in, out, unique] DWORD *ResumeHandle); + + /* Function 22 */ + NET_API_STATUS + __stdcall + NetrDfsSetInfo2( + [in, string] WCHAR *DfsEntryPath, + [in, string] WCHAR *DcName, + [in, unique, string] WCHAR *ServerName, + [in, unique, string] WCHAR *ShareName, + [in] DWORD Level, + [in, switch_is(Level)] DFS_INFO_STRUCT *pDfsInfo, + [in, out, unique] DFSM_ROOT_LIST **ppRootList); + + /* Function 23 */ + NET_API_STATUS + __stdcall + NetrDfsAddRootTarget( + [in, unique, string] LPWSTR pDfsPath, + [in, unique, string] LPWSTR pTargetPath, + [in] ULONG MajorVersion, + [in, unique, string] LPWSTR pComment, + [in] BOOLEAN NewNamespace, [in] ULONG Flags); + + /* Function 24 */ + NET_API_STATUS + __stdcall + NetrDfsRemoveRootTarget( + [in, unique, string] LPWSTR pDfsPath, + [in, unique, string] LPWSTR pTargetPath, + [in] ULONG Flags); + + /* Function 25 */ + NET_API_STATUS + __stdcall + NetrDfsGetSupportedNamespaceVersion( + [in] DFS_NAMESPACE_VERSION_ORIGIN Origin, + [in, unique, string] NETDFS_SERVER_OR_DOMAIN_HANDLE pName, + [out] PDFS_SUPPORTED_NAMESPACE_VERSION_INFO pVersionInfo); +}
6 years, 4 months
1
0
0
0
04/04: [DXDIAG] Fix wrapped controls in russian translation
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6ac04ad787a0b420ddb89…
commit 6ac04ad787a0b420ddb89d6eb846b44e55387e29 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Sun Aug 12 12:11:39 2018 +0300 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Aug 12 14:21:56 2018 +0200 [DXDIAG] Fix wrapped controls in russian translation --- base/applications/dxdiag/lang/ru-RU.rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/applications/dxdiag/lang/ru-RU.rc b/base/applications/dxdiag/lang/ru-RU.rc index bb858353ca..4b1bcf9a1e 100644 --- a/base/applications/dxdiag/lang/ru-RU.rc +++ b/base/applications/dxdiag/lang/ru-RU.rc @@ -22,9 +22,9 @@ BEGIN GROUPBOX "Сведения о системе", IDC_STATIC, 5, 35, 452, 150, SS_RIGHT LTEXT "Текущие время и дата:", IDC_STATIC, 70, 50, 80, 10, SS_RIGHT LTEXT "Имя компьютера:", IDC_STATIC, 70, 60, 80, 10, SS_RIGHT - LTEXT "Операционная система:", IDC_STATIC, 70, 70, 80, 10, SS_RIGHT + LTEXT "Операционная система:", IDC_STATIC, 60, 70, 90, 10, SS_RIGHT LTEXT "Язык:", IDC_STATIC, 70, 80, 80, 10, SS_RIGHT - LTEXT "Изготовитель компьютера:", IDC_STATIC, 70, 90, 80, 10, SS_RIGHT + LTEXT "Изготовитель компьютера:", IDC_STATIC, 50, 90, 100, 10, SS_RIGHT LTEXT "Модель компьютера:", IDC_STATIC, 70, 100, 80, 10, SS_RIGHT LTEXT "BIOS:", IDC_STATIC, 70, 110, 80, 10, SS_RIGHT LTEXT "Процессор:", IDC_STATIC, 70, 120, 80, 10, SS_RIGHT
6 years, 4 months
1
0
0
0
03/04: [DXDIAG] Minor code style fixes
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a03d1860f219d388f3abb…
commit a03d1860f219d388f3abb34c78bafad3767111d4 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Sat Aug 4 00:22:49 2018 +0300 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Aug 12 14:21:56 2018 +0200 [DXDIAG] Minor code style fixes --- base/applications/dxdiag/system.c | 50 +++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/base/applications/dxdiag/system.c b/base/applications/dxdiag/system.c index 849a7a5d4e..c10df851e4 100644 --- a/base/applications/dxdiag/system.c +++ b/base/applications/dxdiag/system.c @@ -199,26 +199,26 @@ InitializeSystemPage(HWND hwndDlg) /* set date/time */ szTime[0] = L'\0'; - Length = GetDateFormat(LOCALE_SYSTEM_DEFAULT, DATE_LONGDATE, NULL, NULL, szTime, sizeof(szTime) / sizeof(WCHAR)); + Length = GetDateFormat(LOCALE_SYSTEM_DEFAULT, DATE_LONGDATE, NULL, NULL, szTime, _countof(szTime)); if (Length) { szTime[Length-1] = L','; szTime[Length++] = L' '; } - Length = GetTimeFormatW(LOCALE_SYSTEM_DEFAULT, TIME_FORCE24HOURFORMAT|LOCALE_NOUSEROVERRIDE, NULL, NULL, &szTime[Length], (sizeof(szTime) / sizeof(WCHAR))); - szTime[199] = L'\0'; + Length = GetTimeFormatW(LOCALE_SYSTEM_DEFAULT, TIME_FORCE24HOURFORMAT|LOCALE_NOUSEROVERRIDE, NULL, NULL, szTime + Length, _countof(szTime)); + szTime[_countof(szTime)-1] = L'\0'; SendDlgItemMessageW(hwndDlg, IDC_STATIC_TIME, WM_SETTEXT, 0, (LPARAM)szTime); /* set computer name */ szTime[0] = L'\0'; - Length = sizeof(szTime) / sizeof(WCHAR); + Length = _countof(szTime); if (GetComputerNameW(szTime, &Length)) SendDlgItemMessageW(hwndDlg, IDC_STATIC_COMPUTER, WM_SETTEXT, 0, (LPARAM)szTime); /* set product name */ if (GetRegValue(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", L"ProductName", REG_SZ, szOSName, sizeof(szOSName))) { - if (LoadStringW(hInst, IDS_OS_VERSION, szFormat, sizeof(szFormat) / sizeof(WCHAR))) + if (LoadStringW(hInst, IDS_OS_VERSION, szFormat, _countof(szFormat))) { WCHAR szCpuName[50]; @@ -229,14 +229,14 @@ InitializeSystemPage(HWND hwndDlg) if (GetVersionEx(&VersionInfo)) { - szTime[(sizeof(szTime) / sizeof(WCHAR))-1] = L'\0'; + szTime[_countof(szTime)-1] = L'\0'; wsprintfW(szTime, szFormat, szOSName, szCpuName, VersionInfo.dwMajorVersion, VersionInfo.dwMinorVersion, VersionInfo.dwBuildNumber); SendDlgItemMessageW(hwndDlg, IDC_STATIC_OS, WM_SETTEXT, 0, (LPARAM)szTime); } else { /* If the version of the OS cannot be retrieved for some reason, then just give the OS Name and Architecture */ - szTime[(sizeof(szTime) / sizeof(WCHAR))-1] = L'\0'; + szTime[_countof(szTime)-1] = L'\0'; wsprintfW(szTime, L"%s %s", szOSName, szCpuName); SendDlgItemMessageW(hwndDlg, IDC_STATIC_OS, WM_SETTEXT, 0, (LPARAM)szTime); } @@ -244,15 +244,15 @@ InitializeSystemPage(HWND hwndDlg) } else { - if (LoadStringW(hInst, IDS_VERSION_UNKNOWN, szTime, sizeof(szTime) / sizeof(WCHAR))) + if (LoadStringW(hInst, IDS_VERSION_UNKNOWN, szTime, _countof(szTime))) { - szTime[(sizeof(szTime) / sizeof(WCHAR))-1] = L'\0'; + szTime[_countof(szTime)-1] = L'\0'; SendDlgItemMessage(hwndDlg, IDC_STATIC_VERSION, WM_SETTEXT, 0, (LPARAM)szTime); } } /* FIXME set product language/local language */ - if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,LOCALE_SLANGUAGE , szTime, sizeof(szTime) / sizeof(WCHAR))) + if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_SLANGUAGE, szTime, _countof(szTime))) SendDlgItemMessageW(hwndDlg, IDC_STATIC_LANG, WM_SETTEXT, 0, (LPARAM)szTime); /* prepare SMBIOS data */ @@ -266,7 +266,7 @@ InitializeSystemPage(HWND hwndDlg) szTime, _countof(szTime), FALSE); if (Length > 0) { - szTime[199] = L'\0'; + szTime[_countof(szTime)-1] = L'\0'; SendDlgItemMessageW(hwndDlg, IDC_STATIC_MANU, WM_SETTEXT, 0, (LPARAM)szTime); } @@ -306,13 +306,13 @@ InitializeSystemPage(HWND hwndDlg) szTime + Index, StrLength, TRUE); if (Length > 0) { - if (Index + StrLength > (sizeof(szTime)/sizeof(WCHAR))- 15) + if (Index + StrLength > _countof(szTime) - 15) { //FIXME retrieve BiosMajorRelease, BiosMinorRelease - //StrLength = wcslen(&szTime[Index]); + //StrLength = wcslen(szTime + Index); //szTime[Index+StrLength] = L' '; - //wcscpy(&szTime[Index+StrLength], L"Ver: "); //FIXME NON-NLS - //szTime[(sizeof(szTime)/sizeof(WCHAR))-1] = L'\0'; + //wcscpy(szTime + Index + StrLength, L"Ver: "); //FIXME NON-NLS + //szTime[_countof(szTime)-1] = L'\0'; } SendDlgItemMessageW(hwndDlg, IDC_STATIC_BIOS, WM_SETTEXT, 0, (LPARAM)szTime); } @@ -329,11 +329,11 @@ InitializeSystemPage(HWND hwndDlg) szFormat[0] = L'\0'; GetSystemInfo(&SysInfo); if (SysInfo.dwNumberOfProcessors > 1) - LoadStringW(hInst, IDS_FORMAT_MPPROC, szFormat, sizeof(szFormat) / sizeof(WCHAR)); + LoadStringW(hInst, IDS_FORMAT_MPPROC, szFormat, _countof(szFormat)); else - LoadStringW(hInst, IDS_FORMAT_UNIPROC, szFormat, sizeof(szFormat) / sizeof(WCHAR)); + LoadStringW(hInst, IDS_FORMAT_UNIPROC, szFormat, _countof(szFormat)); - szFormat[(sizeof(szFormat)/sizeof(WCHAR))-1] = L'\0'; + szFormat[_countof(szFormat)-1] = L'\0'; wsprintfW(szTime, szFormat, szDesc, SysInfo.dwNumberOfProcessors); SendDlgItemMessageW(hwndDlg, IDC_STATIC_PROC, WM_SETTEXT, 0, (LPARAM)szTime); } @@ -343,36 +343,36 @@ InitializeSystemPage(HWND hwndDlg) mem.dwLength = sizeof(mem); if (GlobalMemoryStatusEx(&mem)) { - if (LoadStringW(hInst, IDS_FORMAT_MB, szFormat, sizeof(szFormat) / sizeof(WCHAR))) + if (LoadStringW(hInst, IDS_FORMAT_MB, szFormat, _countof(szFormat))) { /* set total mem string */ - szFormat[(sizeof(szFormat) / sizeof(WCHAR))-1] = L'\0'; + szFormat[_countof(szFormat)-1] = L'\0'; wsprintfW(szTime, szFormat, (mem.ullTotalPhys/1048576)); SendDlgItemMessageW(hwndDlg, IDC_STATIC_MEM, WM_SETTEXT, 0, (LPARAM)szTime); } - if (LoadStringW(hInst, IDS_FORMAT_SWAP, szFormat, sizeof(szFormat) / sizeof(WCHAR))) + if (LoadStringW(hInst, IDS_FORMAT_SWAP, szFormat, _countof(szFormat))) { /* set swap string */ AvailableBytes = (mem.ullTotalPageFile-mem.ullTotalPhys)/1048576; UsedBytes = (mem.ullTotalPageFile-mem.ullAvailPageFile)/1048576; - szFormat[(sizeof(szFormat) / sizeof(WCHAR))-1] = L'\0'; + szFormat[_countof(szFormat)-1] = L'\0'; wsprintfW(szTime, szFormat, (UsedBytes), (AvailableBytes)); SendDlgItemMessageW(hwndDlg, IDC_STATIC_SWAP, WM_SETTEXT, 0, (LPARAM)szTime); } } /* set directx version string */ wcscpy(szTime, L"ReactX "); - if (GetDirectXVersion(&szTime[7])) + if (GetDirectXVersion(szTime + 7)) { SendDlgItemMessage(hwndDlg, IDC_STATIC_VERSION, WM_SETTEXT, 0, (LPARAM)szTime); } else { - if (LoadStringW(hInst, IDS_VERSION_UNKNOWN, szTime, sizeof(szTime) / sizeof(WCHAR))) + if (LoadStringW(hInst, IDS_VERSION_UNKNOWN, szTime, _countof(szTime))) { - szTime[(sizeof(szTime) / sizeof(WCHAR))-1] = L'\0'; + szTime[_countof(szTime)-1] = L'\0'; SendDlgItemMessage(hwndDlg, IDC_STATIC_VERSION, WM_SETTEXT, 0, (LPARAM)szTime); } }
6 years, 4 months
1
0
0
0
02/04: [DXDIAG] Fix blank system and BIOS values
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=50b0332438d11104e3f7c…
commit 50b0332438d11104e3f7c0436734614f7ef4b675 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Tue Jul 31 18:52:09 2018 +0300 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Aug 12 14:21:56 2018 +0200 [DXDIAG] Fix blank system and BIOS values CORE-5961 #resolve --- base/applications/dxdiag/CMakeLists.txt | 6 ++- base/applications/dxdiag/precomp.h | 2 + base/applications/dxdiag/system.c | 71 ++++++++++++++++++++++++++++++--- 3 files changed, 72 insertions(+), 7 deletions(-) diff --git a/base/applications/dxdiag/CMakeLists.txt b/base/applications/dxdiag/CMakeLists.txt index fbcaff538e..a299f85160 100644 --- a/base/applications/dxdiag/CMakeLists.txt +++ b/base/applications/dxdiag/CMakeLists.txt @@ -1,4 +1,8 @@ +include_directories( + ${REACTOS_SOURCE_DIR}/sdk/lib/udmihelp + ${REACTOS_SOURCE_DIR}/sdk/lib/dmilib) + list(APPEND SOURCE system.c display.c @@ -18,7 +22,7 @@ list(APPEND SOURCE add_rc_deps(dxdiag.rc ${CMAKE_CURRENT_SOURCE_DIR}/res/dxdiag.ico) add_executable(dxdiag ${SOURCE} dxdiag.rc) set_module_type(dxdiag win32gui UNICODE) -target_link_libraries(dxdiag dxguid) +target_link_libraries(dxdiag dxguid udmihelp) add_importlibs(dxdiag user32 advapi32 comctl32 dinput8 setupapi dsound ddraw version gdi32 winmm d3d9 msvcrt kernel32 ntdll) add_pch(dxdiag precomp.h SOURCE) add_cd_file(TARGET dxdiag DESTINATION reactos/system32 FOR all) diff --git a/base/applications/dxdiag/precomp.h b/base/applications/dxdiag/precomp.h index 5ad492584f..4e16e04db4 100644 --- a/base/applications/dxdiag/precomp.h +++ b/base/applications/dxdiag/precomp.h @@ -22,6 +22,8 @@ #include <initguid.h> #include <devguid.h> #include <strsafe.h> +#include <udmihelp.h> +#include <dmilib.h> #include "resource.h" diff --git a/base/applications/dxdiag/system.c b/base/applications/dxdiag/system.c index b6686a515d..849a7a5d4e 100644 --- a/base/applications/dxdiag/system.c +++ b/base/applications/dxdiag/system.c @@ -153,6 +153,34 @@ VOID GetSystemCPU(WCHAR *szBuffer) } } +static +SIZE_T +GetBIOSValue( + BOOL UseSMBios, + PCHAR DmiString, + LPWSTR RegValue, + PVOID pBuf, + DWORD cchBuf, + BOOL bTrim) +{ + SIZE_T Length = 0; + BOOL Result; + + if (UseSMBios) + { + Length = GetSMBiosStringW(DmiString, pBuf, cchBuf, bTrim); + } + if (Length == 0) + { + Result = GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", RegValue, REG_SZ, pBuf, cchBuf * sizeof(WCHAR)); + if (Result) + { + Length = wcslen(pBuf); + } + } + return Length; +} + static VOID InitializeSystemPage(HWND hwndDlg) @@ -162,10 +190,12 @@ InitializeSystemPage(HWND hwndDlg) DWORD Length; DWORDLONG AvailableBytes, UsedBytes; MEMORYSTATUSEX mem; - WCHAR szFormat[40]; + WCHAR szFormat[50]; WCHAR szDesc[50]; SYSTEM_INFO SysInfo; OSVERSIONINFO VersionInfo; + PVOID SMBiosBuf; + PCHAR DmiStrings[ID_STRINGS_MAX] = { 0 }; /* set date/time */ szTime[0] = L'\0'; @@ -225,9 +255,16 @@ InitializeSystemPage(HWND hwndDlg) if (GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,LOCALE_SLANGUAGE , szTime, sizeof(szTime) / sizeof(WCHAR))) SendDlgItemMessageW(hwndDlg, IDC_STATIC_LANG, WM_SETTEXT, 0, (LPARAM)szTime); + /* prepare SMBIOS data */ + SMBiosBuf = LoadSMBiosData(DmiStrings); + /* set system manufacturer */ szTime[0] = L'\0'; - if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemManufacturer", REG_SZ, szTime, sizeof(szTime))) + Length = GetBIOSValue(SMBiosBuf != NULL, + DmiStrings[SYS_VENDOR], + L"SystemManufacturer", + szTime, _countof(szTime), FALSE); + if (Length > 0) { szTime[199] = L'\0'; SendDlgItemMessageW(hwndDlg, IDC_STATIC_MANU, WM_SETTEXT, 0, (LPARAM)szTime); @@ -235,22 +272,39 @@ InitializeSystemPage(HWND hwndDlg) /* set motherboard model */ szTime[0] = L'\0'; - if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"SystemProductName", REG_SZ, szTime, sizeof(szTime))) + Length = GetBIOSValue(SMBiosBuf != NULL, + DmiStrings[SYS_PRODUCT], + L"SystemProductName", + szTime, _countof(szTime), FALSE); + if (Length > 0) { SendDlgItemMessageW(hwndDlg, IDC_STATIC_MODEL, WM_SETTEXT, 0, (LPARAM)szTime); } /* set bios model */ szTime[0] = L'\0'; - if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"BIOSVendor", REG_SZ, szTime, sizeof(szTime))) + Length = GetBIOSValue(SMBiosBuf != NULL, + DmiStrings[BIOS_VENDOR], + L"BIOSVendor", + szTime, _countof(szTime), TRUE); + if (Length > 0) { DWORD Index; - DWORD StrLength = (sizeof(szTime) / sizeof(WCHAR)); + DWORD StrLength = _countof(szTime); Index = wcslen(szTime); + if (Index + 1 < _countof(szTime)) + { + szTime[Index++] = L' '; + szTime[Index] = L'\0'; + } StrLength -= Index; - if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\BIOS", L"BIOSReleaseDate", REG_SZ, &szTime[Index], StrLength)) + Length = GetBIOSValue(SMBiosBuf != NULL, + DmiStrings[BIOS_DATE], + L"BIOSReleaseDate", + szTime + Index, StrLength, TRUE); + if (Length > 0) { if (Index + StrLength > (sizeof(szTime)/sizeof(WCHAR))- 15) { @@ -263,9 +317,14 @@ InitializeSystemPage(HWND hwndDlg) SendDlgItemMessageW(hwndDlg, IDC_STATIC_BIOS, WM_SETTEXT, 0, (LPARAM)szTime); } } + + /* clean SMBIOS data */ + FreeSMBiosData(SMBiosBuf); + /* set processor string */ if (GetRegValue(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\CentralProcessor\\0", L"ProcessorNameString", REG_SZ, szDesc, sizeof(szDesc))) { + TrimDmiStringW(szDesc); /* FIXME retrieve current speed */ szFormat[0] = L'\0'; GetSystemInfo(&SysInfo);
6 years, 4 months
1
0
0
0
01/04: [SDK] Add user-mode DMI/SMBIOS helper library
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4259aab7b0546ef0dc7a1…
commit 4259aab7b0546ef0dc7a1c60cda87dc81978b3ef Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Tue Jul 31 18:48:32 2018 +0300 Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org> CommitDate: Sun Aug 12 14:21:56 2018 +0200 [SDK] Add user-mode DMI/SMBIOS helper library CORE-5961 --- sdk/lib/CMakeLists.txt | 1 + sdk/lib/udmihelp/CMakeLists.txt | 12 +++ sdk/lib/udmihelp/precomp.h | 8 ++ sdk/lib/udmihelp/udmihelp.c | 178 ++++++++++++++++++++++++++++++++++++++++ sdk/lib/udmihelp/udmihelp.h | 27 ++++++ 5 files changed, 226 insertions(+) diff --git a/sdk/lib/CMakeLists.txt b/sdk/lib/CMakeLists.txt index 99c68493aa..e5d2d92453 100644 --- a/sdk/lib/CMakeLists.txt +++ b/sdk/lib/CMakeLists.txt @@ -47,6 +47,7 @@ add_subdirectory(skiplist) add_subdirectory(strmiids) add_subdirectory(smlib) add_subdirectory(tdilib) +add_subdirectory(udmihelp) add_subdirectory(uuid) add_subdirectory(wdmguid) diff --git a/sdk/lib/udmihelp/CMakeLists.txt b/sdk/lib/udmihelp/CMakeLists.txt new file mode 100644 index 0000000000..270c234a44 --- /dev/null +++ b/sdk/lib/udmihelp/CMakeLists.txt @@ -0,0 +1,12 @@ + +include_directories( + ${REACTOS_SOURCE_DIR}/sdk/lib/dmilib) + +list(APPEND SOURCE + udmihelp.c + precomp.h) + +add_library(udmihelp ${SOURCE}) +target_link_libraries(udmihelp dmilib) +add_pch(udmihelp precomp.h SOURCE) +add_dependencies(udmihelp psdk) diff --git a/sdk/lib/udmihelp/precomp.h b/sdk/lib/udmihelp/precomp.h new file mode 100644 index 0000000000..ee1c7a55c6 --- /dev/null +++ b/sdk/lib/udmihelp/precomp.h @@ -0,0 +1,8 @@ +#ifndef _UDMIHELP_PCH_ +#define _UDMIHELP_PCH_ + +#include <windows.h> +#include <dmilib.h> +#include "udmihelp.h" + +#endif /* _UDMIHELP_PCH_ */ diff --git a/sdk/lib/udmihelp/udmihelp.c b/sdk/lib/udmihelp/udmihelp.c new file mode 100644 index 0000000000..a7070eb33d --- /dev/null +++ b/sdk/lib/udmihelp/udmihelp.c @@ -0,0 +1,178 @@ +/* + * PROJECT: ReactOS User-mode DMI/SMBIOS Helper Functions + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: SMBIOS table parsing functions + * COPYRIGHT: Copyright 2018 Stanislav Motylkov + */ + +#include "precomp.h" + +static UINT (WINAPI * pGetSystemFirmwareTable)(DWORD, DWORD, PVOID, DWORD); +static BOOL bInitAPI = FALSE; + +static +VOID +InitializeAPI() +{ + HANDLE hKernel; + + pGetSystemFirmwareTable = NULL; + + hKernel = GetModuleHandleW(L"kernel32.dll"); + if (!hKernel) + return; + + pGetSystemFirmwareTable = (void *)GetProcAddress(hKernel, "GetSystemFirmwareTable"); +} + +/* Load SMBIOS Data */ +PVOID +LoadSMBiosData( + _Inout_updates_(ID_STRINGS_MAX) PCHAR * Strings) +{ + PVOID pBuffer = NULL; + HKEY hKey; + DWORD dwType, dwCheck, dwBytes = 0; + + if (!bInitAPI) + { + InitializeAPI(); + bInitAPI = TRUE; + } + + /* Try using GetSystemFirmwareTable (works on NT 5.2 and higher) */ + if (pGetSystemFirmwareTable) + { + dwBytes = pGetSystemFirmwareTable('RSMB', 0, NULL, 0); + if (dwBytes > 0) + { + pBuffer = HeapAlloc(GetProcessHeap(), 0, dwBytes); + if (!pBuffer) + { + return NULL; + } + dwCheck = pGetSystemFirmwareTable('RSMB', 0, pBuffer, dwBytes); + if (dwCheck != dwBytes) + { + HeapFree(GetProcessHeap(), 0, pBuffer); + return NULL; + } + } + } + if (dwBytes == 0) + { + /* Try using registry (works on NT 5.1) */ + if (RegOpenKeyW(HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Services\\mssmbios\\Data", + &hKey) != ERROR_SUCCESS) + { + return NULL; + } + + if (RegQueryValueExW(hKey, + L"SMBiosData", + NULL, + &dwType, + NULL, + &dwBytes) != ERROR_SUCCESS || dwType != REG_BINARY) + { + RegCloseKey(hKey); + return NULL; + } + + pBuffer = HeapAlloc(GetProcessHeap(), 0, dwBytes); + if (!pBuffer) + { + RegCloseKey(hKey); + return NULL; + } + + if (RegQueryValueExW(hKey, + L"SMBiosData", + NULL, + &dwType, + pBuffer, + &dwBytes) != ERROR_SUCCESS || dwType != REG_BINARY) + { + HeapFree(GetProcessHeap(), 0, pBuffer); + RegCloseKey(hKey); + return NULL; + } + + RegCloseKey(hKey); + } + ParseSMBiosTables(pBuffer, dwBytes, Strings); + return pBuffer; +} + +/* Trim converted DMI string */ +VOID +TrimDmiStringW( + _Inout_ PWSTR pStr) +{ + SIZE_T Length; + UINT i = 0; + + if (!pStr) + return; + + Length = wcslen(pStr); + if (Length == 0) + return; + + /* Trim leading spaces */ + while (i < Length && pStr[i] <= L' ') + { + i++; + } + + if (i > 0) + { + Length -= i; + memmove(pStr, pStr + i, (Length + 1) * sizeof(WCHAR)); + } + + /* Trim trailing spaces */ + while (Length && pStr[Length-1] <= L' ') + { + pStr[Length-1] = L'\0'; + --Length; + } +} + +/* Convert string from SMBIOS */ +SIZE_T +GetSMBiosStringW( + _In_ PCSTR DmiString, + _Out_ PWSTR pBuf, + _In_ DWORD cchBuf, + _In_ BOOL bTrim) +{ + SIZE_T cChars; + + if (!DmiString) + return 0; + + cChars = MultiByteToWideChar(CP_OEMCP, 0, DmiString, -1, pBuf, cchBuf); + + /* NULL-terminate string */ + pBuf[min(cchBuf-1, cChars)] = L'\0'; + + if (bTrim) + { + TrimDmiStringW(pBuf); + } + + return wcslen(pBuf); +} + +/* Free SMBIOS Data */ +VOID +FreeSMBiosData( + _In_ PVOID Buffer) +{ + if (!Buffer) + return; + + HeapFree(GetProcessHeap(), 0, Buffer); +} diff --git a/sdk/lib/udmihelp/udmihelp.h b/sdk/lib/udmihelp/udmihelp.h new file mode 100644 index 0000000000..8ed59d9f3c --- /dev/null +++ b/sdk/lib/udmihelp/udmihelp.h @@ -0,0 +1,27 @@ +/* + * PROJECT: ReactOS User-mode DMI/SMBIOS Helper Functions + * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+
) + * PURPOSE: SMBIOS table parsing functions + * COPYRIGHT: Copyright 2018 Stanislav Motylkov + */ + +#pragma once + +PVOID +LoadSMBiosData( + _Inout_updates_(ID_STRINGS_MAX) PCHAR * Strings); + +VOID +TrimDmiStringW( + _Inout_ PWSTR pStr); + +SIZE_T +GetSMBiosStringW( + _In_ PCSTR DmiString, + _Out_ PWSTR pBuf, + _In_ DWORD cchBuf, + _In_ BOOL bTrim); + +VOID +FreeSMBiosData( + _In_ PVOID Buffer);
6 years, 4 months
1
0
0
0
01/01: [MSPAINT] Fix interpretation of command line (#707)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=22e86add33775c9a1a2a6…
commit 22e86add33775c9a1a2a61b9e23b46acfb5a4580 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Aug 12 18:23:16 2018 +0900 Commit: Benedikt Freisen <b.freisen(a)gmx.net> CommitDate: Sun Aug 12 11:23:16 2018 +0200 [MSPAINT] Fix interpretation of command line (#707) --- base/applications/mspaint/main.cpp | 70 ++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/base/applications/mspaint/main.cpp b/base/applications/mspaint/main.cpp index 8b0bfe7bf8..8abe4ffa41 100644 --- a/base/applications/mspaint/main.cpp +++ b/base/applications/mspaint/main.cpp @@ -261,24 +261,66 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument if (__argc >= 2) { - HBITMAP bmNew = NULL; - LoadDIBFromFile(&bmNew, __targv[1], &fileTime, &fileSize, &fileHPPM, &fileVPPM); - if (bmNew != NULL) + WIN32_FIND_DATAW find; + HANDLE hFind = FindFirstFileW(__targv[1], &find); + if (hFind != INVALID_HANDLE_VALUE) { - TCHAR *temp; - imageModel.Insert(bmNew); - GetFullPathName(__targv[1], SIZEOF(filepathname), filepathname, &temp); - CPath pathFileName(filepathname); - pathFileName.StripPath(); - CString strTitle; - strTitle.Format(IDS_WINDOWTITLE, (LPCTSTR)pathFileName); - mainWindow.SetWindowText(strTitle); - imageModel.ClearHistory(); - isAFile = TRUE; + FindClose(hFind); + + // check the file size + if (find.nFileSizeHigh || find.nFileSizeLow) + { + // load it now + HBITMAP bmNew = NULL; + LoadDIBFromFile(&bmNew, __targv[1], &fileTime, &fileSize, &fileHPPM, &fileVPPM); + if (bmNew) + { + // valid bitmap file + GetFullPathName(__targv[1], SIZEOF(filepathname), filepathname, NULL); + imageModel.Insert(bmNew); + CPath pathFileName(filepathname); + pathFileName.StripPath(); + + CString strTitle; + strTitle.Format(IDS_WINDOWTITLE, (LPCTSTR)pathFileName); + mainWindow.SetWindowText(strTitle); + + imageModel.ClearHistory(); + + isAFile = TRUE; + registrySettings.SetMostRecentFile(filepathname); + } + else + { + // cannot open and not empty + CStringW strText; + strText.Format(IDS_LOADERRORTEXT, __targv[1]); + MessageBoxW(NULL, strText, NULL, MB_ICONERROR); + } + } + else + { + // open the empty file + GetFullPathName(__targv[1], SIZEOF(filepathname), filepathname, NULL); + CPath pathFileName(filepathname); + pathFileName.StripPath(); + + CString strTitle; + strTitle.Format(IDS_WINDOWTITLE, (LPCTSTR)pathFileName); + mainWindow.SetWindowText(strTitle); + + imageModel.ClearHistory(); + + isAFile = TRUE; + registrySettings.SetMostRecentFile(filepathname); + } } else { - exit(0); + // does not exist + CStringW strText; + strText.Format(IDS_LOADERRORTEXT, __targv[1]); + MessageBoxW(NULL, strText, NULL, MB_ICONERROR); } }
6 years, 4 months
1
0
0
0
01/01: [KMTESTS:MM] Properly clean up files
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c79e5dc476a7041b018eb…
commit c79e5dc476a7041b018eba6eaf532f75d00be4f6 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sun Aug 12 10:05:25 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sun Aug 12 10:05:25 2018 +0200 [KMTESTS:MM] Properly clean up files This fixes driver unloading on Windows. ROSTESTS-266 --- modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c b/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c index 45f20b5e85..a547207f21 100644 --- a/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c +++ b/modules/rostests/kmtests/ntos_mm/NtCreateSection_drv.c @@ -413,13 +413,16 @@ TestIrpHandler( { Fcb = IoStack->FileObject->FsContext; ok(Fcb != NULL, "Null pointer!\n"); - if (IoStack->FileObject->SectionObjectPointer != NULL && - IoStack->FileObject->SectionObjectPointer->SharedCacheMap != NULL) + if (IoStack->FileObject->SectionObjectPointer != NULL) { LARGE_INTEGER Zero = RTL_CONSTANT_LARGE_INTEGER(0LL); - CcFlushCache(&Fcb->SectionObjectPointers, NULL, 0, NULL); - CcPurgeCacheSection(&Fcb->SectionObjectPointers, NULL, 0, FALSE); + if (CcIsFileCached(IoStack->FileObject)) + { + CcFlushCache(&Fcb->SectionObjectPointers, NULL, 0, NULL); + CcPurgeCacheSection(&Fcb->SectionObjectPointers, NULL, 0, FALSE); + } + KeInitializeEvent(&CacheUninitEvent.Event, NotificationEvent, FALSE); CcUninitializeCacheMap(IoStack->FileObject, &Zero, &CacheUninitEvent); KeWaitForSingleObject(&CacheUninitEvent.Event, Executive, KernelMode, FALSE, NULL);
6 years, 4 months
1
0
0
0
01/01: [NTOSKRNL] Misc fixes: - Rename page file struct to MMPAGING_FILE - Increment page files count after current page file was put in the list
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=02b0ca08e40c40601a72a…
commit 02b0ca08e40c40601a72aea0b10876d60810a942 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Aug 11 23:34:08 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Aug 11 23:34:08 2018 +0200 [NTOSKRNL] Misc fixes: - Rename page file struct to MMPAGING_FILE - Increment page files count after current page file was put in the list --- ntoskrnl/mm/pagefile.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ntoskrnl/mm/pagefile.c b/ntoskrnl/mm/pagefile.c index cbc7c9a854..347ffec4a5 100644 --- a/ntoskrnl/mm/pagefile.c +++ b/ntoskrnl/mm/pagefile.c @@ -21,6 +21,7 @@ * FILE: ntoskrnl/mm/pagefile.c * PURPOSE: Paging file functions * PROGRAMMER: David Welch (welch(a)mcmail.com) + * Pierre Schweitzer * UPDATE HISTORY: * Created 22/05/98 */ @@ -38,7 +39,7 @@ /* TYPES *********************************************************************/ -typedef struct _PAGINGFILE +typedef struct _MMPAGING_FILE { PFILE_OBJECT FileObject; HANDLE FileHandle; @@ -49,7 +50,7 @@ typedef struct _PAGINGFILE PRTL_BITMAP AllocMap; KSPIN_LOCK AllocMapLock; } -PAGINGFILE, *PPAGINGFILE; +MMPAGING_FILE, *PMMPAGING_FILE; /* GLOBALS *******************************************************************/ @@ -58,7 +59,7 @@ PAGINGFILE, *PPAGINGFILE; #define MAX_PAGING_FILES (16) /* List of paging files, both used and free */ -static PPAGINGFILE MmPagingFile[MAX_PAGING_FILES]; +static PMMPAGING_FILE MmPagingFile[MAX_PAGING_FILES]; /* Lock for examining the list of paging files */ static KSPIN_LOCK PagingFileListLock; @@ -224,7 +225,7 @@ MiReadPageFile( KEVENT Event; UCHAR MdlBase[sizeof(MDL) + sizeof(ULONG)]; PMDL Mdl = (PMDL)MdlBase; - PPAGINGFILE PagingFile; + PMMPAGING_FILE PagingFile; DPRINT("MiReadSwapFile\n"); @@ -289,7 +290,7 @@ MmInitPagingFile(VOID) } static ULONG -MiAllocPageFromPagingFile(PPAGINGFILE PagingFile) +MiAllocPageFromPagingFile(PMMPAGING_FILE PagingFile) { KIRQL oldIrql; ULONG off; @@ -308,7 +309,7 @@ MmFreeSwapPage(SWAPENTRY Entry) ULONG i; ULONG_PTR off; KIRQL oldIrql; - PPAGINGFILE PagingFile; + PMMPAGING_FILE PagingFile; i = FILE_FROM_ENTRY(Entry); off = OFFSET_FROM_ENTRY(Entry) - 1; @@ -388,7 +389,7 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, HANDLE FileHandle; IO_STATUS_BLOCK IoStatus; PFILE_OBJECT FileObject; - PPAGINGFILE PagingFile; + PMMPAGING_FILE PagingFile; KIRQL oldIrql; ULONG AllocMapSize; ULONG Count; @@ -662,8 +663,9 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName, RtlClearAllBits(PagingFile->AllocMap); KeAcquireSpinLock(&PagingFileListLock, &oldIrql); - MmNumberOfPagingFiles++; + ASSERT(MmPagingFile[MmNumberOfPagingFiles] == NULL); MmPagingFile[MmNumberOfPagingFiles] = PagingFile; + MmNumberOfPagingFiles++; MiFreeSwapPages = MiFreeSwapPages + PagingFile->FreePages; KeReleaseSpinLock(&PagingFileListLock, oldIrql);
6 years, 4 months
1
0
0
0
← Newer
1
...
20
21
22
23
24
25
26
...
31
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Results per page:
10
25
50
100
200