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
February 2020
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
27 participants
239 discussions
Start a n
N
ew thread
[reactos] 01/01: [OPENGL32] Fix RGB <-> BGR mismatch
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=08f228577aed4a7601de2…
commit 08f228577aed4a7601de2de29a18bc054d9f6cf7 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Feb 5 13:08:04 2020 +0100 Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com> CommitDate: Fri Feb 14 08:55:45 2020 +0100 [OPENGL32] Fix RGB <-> BGR mismatch Fix CORE-16221 --- dll/opengl/opengl32/swimpl.c | 75 +++++++++++--------------------------------- 1 file changed, 18 insertions(+), 57 deletions(-) diff --git a/dll/opengl/opengl32/swimpl.c b/dll/opengl/opengl32/swimpl.c index 70b4ca7abb0..7f2808d1b0e 100644 --- a/dll/opengl/opengl32/swimpl.c +++ b/dll/opengl/opengl32/swimpl.c @@ -616,63 +616,6 @@ static inline ULONG GET_PIXEL_32(ULONG* Buffer) return *Buffer; } -static inline COLORREF MAKE_COLORREF_8(const struct pixel_format *format, BYTE Color) -{ - BYTE R,G,B; - - if (format->iPixelType == PFD_TYPE_COLORINDEX) - return PALETTEINDEX(Color); - - R = (Color & 0x7) << 5; - G = (Color & 0x38) << 2; - B = Color & 0xC; - - return RGB(R, G, B); -} - -static inline COLORREF MAKE_COLORREF_16(const struct pixel_format *format, USHORT Color) -{ - BYTE R,G,B; - - if (format->iPixelType == PFD_TYPE_COLORINDEX) - return PALETTEINDEX(Color); - - R = (Color & 0x7) << 5; - G = (Color & 0x38) << 2; - B = Color & 0xC; - - return RGB(R, G, B); -} - -static inline COLORREF MAKE_COLORREF_24(const struct pixel_format *format, ULONG Color) -{ - BYTE R,G,B; - - if (format->iPixelType == PFD_TYPE_COLORINDEX) - return PALETTEINDEX(Color); - - R = (Color & 0xFF0000) >> 16; - G = (Color & 0x00FF00) >> 8; - B = Color & 0xFF; - - return RGB(R, G, B); -} - -static inline COLORREF MAKE_COLORREF_32(const struct pixel_format *format, ULONG Color) -{ - BYTE R,G,B; - - if (format->iPixelType == PFD_TYPE_COLORINDEX) - return PALETTEINDEX(Color); - - R = (Color & 0xFF0000) >> 16; - G = (Color & 0x00FF00) >> 8; - B = Color & 0xFF; - - return RGB(R, G, B); -} - - static inline BYTE PACK_COLOR_8(GLubyte r, GLubyte g, GLubyte b) { return (r & 0x7) | ((g & 0x7) << 3) | ((b & 0x3) << 6); @@ -769,6 +712,24 @@ static inline void UNPACK_COLORREF_32(COLORREF Color, GLubyte* r, GLubyte* g, GL *b = GetBValue(Color); } +#define MAKE_COLORREF(__bpp, __type) \ +static inline COLORREF MAKE_COLORREF_##__bpp(const struct pixel_format *format, __type Color) \ +{ \ + GLubyte r,g,b; \ + \ + if (format->iPixelType == PFD_TYPE_COLORINDEX) \ + return PALETTEINDEX(Color); \ + \ + UNPACK_COLOR_##__bpp(Color, &r, &g, &b); \ + \ + return PACK_COLORREF_##__bpp(r, g, b); \ +} +MAKE_COLORREF(8, BYTE) +MAKE_COLORREF(16, USHORT) +MAKE_COLORREF(24, ULONG) +MAKE_COLORREF(32, ULONG) +#undef MAKE_COLORREF + /* * Set the color index used to clear the color buffer. */
4 years, 10 months
1
0
0
0
[reactos] 01/01: [SHELL32] Rewrite SHAddToRecentDocs (#2333)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=358f947975f9d185558ba…
commit 358f947975f9d185558bab496b614e5ed4ced289 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Feb 14 11:05:21 2020 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Fri Feb 14 11:05:21 2020 +0900 [SHELL32] Rewrite SHAddToRecentDocs (#2333) Rewrite shell32!SHAddToRecentDocs and use it in some applications. Wine's SHAddToRecentDocs was not Unicode supported and unusable. I will dare to rewrite. CORE-3588 --- base/applications/mspaint/registry.cpp | 7 +- base/applications/notepad/main.c | 5 + base/applications/wordpad/wordpad.c | 7 + dll/win32/shell32/wine/shellord.c | 343 ++++++++++++++++++++++++++++++--- dll/win32/shimgvw/CMakeLists.txt | 2 +- dll/win32/shimgvw/shimgvw.c | 5 + 6 files changed, 342 insertions(+), 27 deletions(-) diff --git a/base/applications/mspaint/registry.cpp b/base/applications/mspaint/registry.cpp index cd1250b2397..369d8eaf45c 100644 --- a/base/applications/mspaint/registry.cpp +++ b/base/applications/mspaint/registry.cpp @@ -4,13 +4,15 @@ * FILE: base/applications/mspaint/registry.cpp * PURPOSE: Offering functions dealing with registry values * PROGRAMMERS: Benedikt Freisen + * Katayama Hirofumi MZ */ /* INCLUDES *********************************************************/ #include "precomp.h" - #include <winreg.h> +#include <wincon.h> +#include <shlobj.h> /* FUNCTIONS ********************************************************/ static DWORD ReadDWORD(CRegKey &key, LPCTSTR lpName, DWORD &dwValue, BOOL bCheckForDef) @@ -143,6 +145,9 @@ void RegistrySettings::Store() void RegistrySettings::SetMostRecentFile(LPCTSTR szPathName) { + if (szPathName && szPathName[0]) + SHAddToRecentDocs(SHARD_PATHW, szPathName); + if (strFile1 == szPathName) { // do nothing diff --git a/base/applications/notepad/main.c b/base/applications/notepad/main.c index c424449a33c..dee27770697 100644 --- a/base/applications/notepad/main.c +++ b/base/applications/notepad/main.c @@ -5,6 +5,7 @@ * Copyright 1997,98 Marcel Baur <mbaur(a)g26.ethz.ch> * Copyright 2002 Sylvain Petreolle <spetreolle(a)yahoo.fr> * Copyright 2002 Andriy Palamarchuk + * Copyright 2020 Katayama Hirofumi MZ * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +25,7 @@ #include "notepad.h" +#include <shlobj.h> #include <strsafe.h> NOTEPAD_GLOBALS Globals; @@ -48,6 +50,9 @@ VOID SetFileName(LPCTSTR szFileName) StringCchCopy(Globals.szFileName, ARRAY_SIZE(Globals.szFileName), szFileName); Globals.szFileTitle[0] = 0; GetFileTitle(szFileName, Globals.szFileTitle, ARRAY_SIZE(Globals.szFileTitle)); + + if (szFileName && szFileName[0]) + SHAddToRecentDocs(SHARD_PATHW, szFileName); } /*********************************************************************** diff --git a/base/applications/wordpad/wordpad.c b/base/applications/wordpad/wordpad.c index acc8aa08b82..ba4cf537889 100644 --- a/base/applications/wordpad/wordpad.c +++ b/base/applications/wordpad/wordpad.c @@ -3,6 +3,7 @@ * * Copyright 2004 by Krzysztof Foltman * Copyright 2007-2008 by Alexander N. Sørnes <alex(a)thehandofagony.com> + * Copyright 2020 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -32,6 +33,7 @@ #include <commctrl.h> #include <commdlg.h> #include <shellapi.h> +#include <shlobj.h> #include <wine/unicode.h> #include "wordpad.h" @@ -811,6 +813,8 @@ static void DoOpenFile(LPCWSTR szOpenFileName) SetFocus(hEditorWnd); set_caption(szOpenFileName); + if (szOpenFileName[0]) + SHAddToRecentDocs(SHARD_PATHW, szOpenFileName); lstrcpyW(wszFileName, szOpenFileName); SendMessageW(hEditorWnd, EM_SETMODIFY, FALSE, 0); @@ -883,6 +887,9 @@ static BOOL DoSaveFile(LPCWSTR wszSaveFileName, WPARAM format) lstrcpyW(wszFileName, wszSaveFileName); set_caption(wszFileName); + if (wszFileName[0]) + SHAddToRecentDocs(SHARD_PATHW, wszFileName); + SendMessageW(hEditorWnd, EM_SETMODIFY, FALSE, 0); set_fileformat(format); diff --git a/dll/win32/shell32/wine/shellord.c b/dll/win32/shell32/wine/shellord.c index 9b4c6ab9eba..f634c33665d 100644 --- a/dll/win32/shell32/wine/shellord.c +++ b/dll/win32/shell32/wine/shellord.c @@ -45,6 +45,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DECLARE_DEBUG_CHANNEL(pidl); +#ifdef __REACTOS__ +#include <comctl32_undoc.h> +#else /* FIXME: !!! move CREATEMRULIST and flags to header file !!! */ /* !!! it is in both here and comctl32undoc.c !!! */ typedef struct tagCREATEMRULIST @@ -67,7 +70,7 @@ extern VOID WINAPI FreeMRUList(HANDLE hMRUList); extern INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData); extern INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum); extern INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize); - +#endif /************************************************************************* * ParseFieldA [internal] @@ -596,9 +599,59 @@ static INT SHADD_get_policy(LPCSTR policy, LPDWORD type, LPVOID buffer, LPDWORD */ static INT CALLBACK SHADD_compare_mru(LPCVOID data1, LPCVOID data2, DWORD cbData) { +#ifdef __REACTOS__ + LPCWSTR psz1, psz2; + INT iCmp = lstrcmpiW(data1, data2); + if (iCmp != 0) + return iCmp; + psz1 = data1; + psz2 = data2; + psz1 += lstrlenW(psz1) + 1; + psz2 += lstrlenW(psz2) + 1; + return lstrcmpiW(psz1, psz2); +#else return lstrcmpiA(data1, data2); +#endif } +#ifdef __REACTOS__ +static BOOL +DoStoreMRUData(LPBYTE pbBuffer, LPDWORD pcbBuffer, + LPCWSTR pszTargetTitle, LPCWSTR pszTargetPath, LPCWSTR pszLinkTitle) +{ + DWORD ib = 0, cb; + INT cchTargetTitle = lstrlenW(pszTargetTitle); + INT cchTargetPath = lstrlenW(pszTargetPath); + INT cchLinkTitle = lstrlenW(pszLinkTitle); + + cb = (cchTargetTitle + 1 + cchTargetPath + 1 + cchLinkTitle + 2) * sizeof(WCHAR); + if (cb > *pcbBuffer) + return FALSE; + + ZeroMemory(pbBuffer, *pcbBuffer); + + cb = (cchTargetTitle + 1) * sizeof(WCHAR); + if (ib + cb > *pcbBuffer) + return FALSE; + CopyMemory(&pbBuffer[ib], pszTargetTitle, cb); + ib += cb; + + cb = (cchTargetPath + 1) * sizeof(WCHAR); + if (ib + cb > *pcbBuffer) + return FALSE; + CopyMemory(&pbBuffer[ib], pszTargetPath, cb); + ib += cb; + + cb = (cchLinkTitle + 1) * sizeof(WCHAR); + if (ib + cb > *pcbBuffer) + return FALSE; + CopyMemory(&pbBuffer[ib], pszLinkTitle, cb); + ib += cb; + + *pcbBuffer = ib; + return TRUE; +} +#else /************************************************************************* * SHADD_create_add_mru_data - helper function for SHAddToRecentDocs * @@ -650,6 +703,7 @@ static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPCSTR doc_name, LPCSTR n */ return AddMRUData(mruhandle, buffer, *len); } +#endif /************************************************************************* * SHAddToRecentDocs [SHELL32.@] @@ -668,6 +722,268 @@ static INT SHADD_create_add_mru_data(HANDLE mruhandle, LPCSTR doc_name, LPCSTR n */ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) { +#ifdef __REACTOS__ + static const WCHAR szExplorerKey[] = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer"; + INT ret; + WCHAR szTargetPath[MAX_PATH], szLinkDir[MAX_PATH], szLinkFile[MAX_PATH], szDescription[80]; + WCHAR szPath[MAX_PATH]; + DWORD cbBuffer, data[64], datalen, type; + HANDLE hFind; + WIN32_FIND_DATAW find; + HKEY hExplorerKey; + LONG error; + LPWSTR pchDotExt, pchTargetTitle, pchLinkTitle; + MRUINFOW mru; + HANDLE hMRUList = NULL; + IShellLinkW *psl = NULL; + IPersistFile *pPf = NULL; + HRESULT hr; + BYTE Buffer[(MAX_PATH + 64) * sizeof(WCHAR)]; + + TRACE("%04x %p\n", uFlags, pv); + + /* check policy */ + ret = SHADD_get_policy("NoRecentDocsHistory", &type, data, &datalen); + if (ret > 0 && ret != ERROR_FILE_NOT_FOUND) + { + ERR("Error %d getting policy \"NoRecentDocsHistory\"\n", ret); + } + else if (ret == ERROR_SUCCESS) + { + if (!(type == REG_DWORD || (type == REG_BINARY && datalen == 4))) + { + ERR("Error policy data for \"NoRecentDocsHistory\" not formatted correctly, type=%d, len=%d\n", + type, datalen); + return; + } + + TRACE("policy value for NoRecentDocsHistory = %08x\n", data[0]); + /* now test the actual policy value */ + if (data[0] != 0) + return; + } + + /* store to szTargetPath */ + szTargetPath[0] = 0; + if (pv) + { + switch (uFlags) + { + case SHARD_PATHA: + MultiByteToWideChar(CP_ACP, 0, pv, -1, szLinkDir, ARRAYSIZE(szLinkDir)); + GetFullPathNameW(szLinkDir, ARRAYSIZE(szTargetPath), szTargetPath, NULL); + break; + + case SHARD_PATHW: + GetFullPathNameW(pv, ARRAYSIZE(szTargetPath), szTargetPath, NULL); + break; + + case SHARD_PIDL: + SHGetPathFromIDListW(pv, szLinkDir); + GetFullPathNameW(szLinkDir, ARRAYSIZE(szTargetPath), szTargetPath, NULL); + break; + + default: + FIXME("Unsupported flags: %u\n", uFlags); + return; + } + } + + /* get recent folder */ + if (!SHGetSpecialFolderPathW(NULL, szLinkDir, CSIDL_RECENT, FALSE)) + { + ERR("serious issues 1\n"); + return; + } + TRACE("Users Recent dir %S\n", szLinkDir); + + /* open Explorer key */ + error = RegCreateKeyExW(HKEY_CURRENT_USER, szExplorerKey, 0, NULL, 0, + KEY_READ | KEY_WRITE, NULL, &hExplorerKey, NULL); + if (error) + { + ERR("Failed to RegCreateKeyExW: 0x%08X\n", error); + return; + } + + if (!pv) + { + TRACE("pv is NULL, so delete all shortcut files in %S\n", szLinkDir); + + lstrcpynW(szLinkFile, szLinkDir, ARRAYSIZE(szLinkFile)); + PathAppendW(szLinkFile, L"*.lnk"); + + hFind = FindFirstFileW(szLinkFile, &find); + if (hFind != INVALID_HANDLE_VALUE) + { + do + { + lstrcpynW(szLinkFile, szLinkDir, ARRAYSIZE(szLinkFile)); + PathAppendW(szLinkFile, find.cFileName); + DeleteFileW(szLinkFile); + } while (FindNextFile(hFind, &find)); + FindClose(hFind); + } + + SHDeleteKeyW(hExplorerKey, L"RecentDocs"); + RegCloseKey(hExplorerKey); + return; + } + + if (szTargetPath[0] == 0 || !PathFileExistsW(szTargetPath) || + PathIsDirectoryW(szTargetPath)) + { + /* path is not normal file */ + RegCloseKey(hExplorerKey); + return; + } + + hr = CoInitialize(NULL); + if (FAILED(hr)) + { + ERR("CoInitialize: %08X\n", hr); + RegCloseKey(hExplorerKey); + return; + } + + /* check if file is a shortcut */ + ret = 0; + pchDotExt = PathFindExtensionW(szTargetPath); + while (lstrcmpiW(pchDotExt, L".lnk") == 0) + { + hr = IShellLink_ConstructFromPath(szTargetPath, &IID_IShellLinkW, (LPVOID*)&psl); + if (FAILED(hr)) + { + ERR("IShellLink_ConstructFromPath: 0x%08X\n", hr); + goto Quit; + } + + IShellLinkW_GetPath(psl, szPath, ARRAYSIZE(szPath), NULL, 0); + IShellLinkW_Release(psl); + psl = NULL; + + lstrcpynW(szTargetPath, szPath, ARRAYSIZE(szTargetPath)); + pchDotExt = PathFindExtensionW(szTargetPath); + + if (++ret >= 8) + { + ERR("Link loop?\n"); + goto Quit; + } + } + if (!lstrcmpiW(pchDotExt, L".exe")) + { + /* executables are not added */ + goto Quit; + } + + /* *** JOB 0: Build strings *** */ + + pchTargetTitle = PathFindFileNameW(szTargetPath); + + lstrcpyW(szDescription, L"Shortcut to "); + StrCatBuffW(szDescription, pchTargetTitle, ARRAYSIZE(szDescription)); + + lstrcpynW(szLinkFile, szLinkDir, ARRAYSIZE(szLinkFile)); + PathAppendW(szLinkFile, pchTargetTitle); + StrCatBuffW(szLinkFile, L".lnk", ARRAYSIZE(szLinkFile)); + pchLinkTitle = PathFindFileNameW(szLinkFile); + + /* *** JOB 1: Update registry for ...\Explorer\RecentDocs list *** */ + + /* store MRU data */ + cbBuffer = sizeof(Buffer); + ret = DoStoreMRUData(Buffer, &cbBuffer, pchTargetTitle, szTargetPath, pchLinkTitle); + if (!ret) + { + ERR("DoStoreMRUData failed: %d\n", ret); + goto Quit; + } + + /* create MRU list */ + mru.cbSize = sizeof(mru); + mru.uMax = 16; + mru.fFlags = MRU_BINARY | MRU_CACHEWRITE; + mru.hKey = hExplorerKey; + mru.lpszSubKey = L"RecentDocs"; + mru.lpfnCompare = (MRUCMPPROCW)SHADD_compare_mru; + hMRUList = CreateMRUListW(&mru); + if (!hMRUList) + { + ERR("CreateMRUListW failed\n"); + goto Quit; + } + + /* already exists? */ + ret = FindMRUData(hMRUList, Buffer, cbBuffer, NULL); + if (ret >= 0) + { + /* Just touch for speed */ + HANDLE hFile; + hFile = CreateFileW(szLinkFile, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (hFile != INVALID_HANDLE_VALUE) + { + TRACE("Just touch file '%S'.\n", szLinkFile); + CloseHandle(hFile); + goto Quit; + } + } + + /* add MRU data */ + ret = AddMRUData(hMRUList, Buffer, cbBuffer); + if (ret < 0) + { + ERR("AddMRUData failed: %d\n", ret); + goto Quit; + } + + /* *** JOB 2: Create shortcut in user's "Recent" directory *** */ + + hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, + &IID_IShellLinkW, (LPVOID *)&psl); + if (FAILED(hr)) + { + ERR("CoInitialize for IID_IShellLinkW: %08X\n", hr); + goto Quit; + } + + hr = IShellLinkW_QueryInterface(psl, &IID_IPersistFile, (LPVOID *)&pPf); + if (FAILED(hr)) + { + ERR("IShellLinkW_QueryInterface: %08X\n", hr); + goto Quit; + } + + if (uFlags == SHARD_PIDL) + hr = IShellLinkW_SetIDList(psl, pv); + else + hr = IShellLinkW_SetPath(psl, pv); + + IShellLinkW_SetDescription(psl, szDescription); + + hr = IPersistFile_Save(pPf, szLinkFile, TRUE); + if (FAILED(hr)) + { + ERR("IPersistFile_Save: 0x%08X\n", hr); + } + + hr = IPersistFile_SaveCompleted(pPf, szLinkFile); + if (FAILED(hr)) + { + ERR("IPersistFile_SaveCompleted: 0x%08X\n", hr); + } + +Quit: + if (hMRUList) + FreeMRUList(hMRUList); + if (pPf) + IPersistFile_Release(pPf); + if (psl) + IShellLinkW_Release(psl); + CoUninitialize(); + RegCloseKey(hExplorerKey); +#else /* If list is a string list lpfnCompare has the following prototype * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2) * for binary lists the prototype is @@ -822,30 +1138,6 @@ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) TRACE("full document name %s\n", debugstr_a(doc_name)); -#ifdef __REACTOS__ - /* check if file is a shortcut */ - ext = strrchr(doc_name, '.'); - if (!lstrcmpiA(ext, ".lnk")) - { - WCHAR doc_nameW[MAX_PATH]; - IShellLinkA* ShellLink; - int nLength = MultiByteToWideChar(CP_ACP, 0, doc_name, -1, doc_nameW, MAX_PATH); - if (nLength == 0) - return; - - IShellLink_ConstructFromPath(doc_nameW, &IID_IShellLinkA, (LPVOID*)&ShellLink); - IShellLinkA_GetPath(ShellLink, doc_name, MAX_PATH, NULL, 0); - IShellLinkA_Release(ShellLink); - } - - ext = strrchr(doc_name, '.'); - if (!lstrcmpiA(ext, ".exe")) - { - /* executables are not added */ - return; - } -#endif - PathStripPathA(doc_name); TRACE("stripped document name %s\n", debugstr_a(doc_name)); @@ -1032,6 +1324,7 @@ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) /* all done */ RegCloseKey(HCUbasekey); return; +#endif } /************************************************************************* diff --git a/dll/win32/shimgvw/CMakeLists.txt b/dll/win32/shimgvw/CMakeLists.txt index e26d54f73be..fefd3d1ca02 100644 --- a/dll/win32/shimgvw/CMakeLists.txt +++ b/dll/win32/shimgvw/CMakeLists.txt @@ -11,5 +11,5 @@ list(APPEND SOURCE add_library(shimgvw MODULE ${SOURCE}) set_module_type(shimgvw win32dll) target_link_libraries(shimgvw wine) -add_importlibs(shimgvw advapi32 comctl32 user32 gdi32 gdiplus comdlg32 shlwapi msvcrt kernel32 ntdll) +add_importlibs(shimgvw advapi32 comctl32 user32 gdi32 shell32 gdiplus comdlg32 shlwapi msvcrt kernel32 ntdll) add_cd_file(TARGET shimgvw DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/shimgvw/shimgvw.c b/dll/win32/shimgvw/shimgvw.c index 7f2d0393a71..de8dc0e0238 100644 --- a/dll/win32/shimgvw/shimgvw.c +++ b/dll/win32/shimgvw/shimgvw.c @@ -18,12 +18,14 @@ #include <winnls.h> #include <winreg.h> #include <wingdi.h> +#include <wincon.h> #include <windowsx.h> #include <objbase.h> #include <commctrl.h> #include <commdlg.h> #include <gdiplus.h> #include <tchar.h> +#include <shlobj.h> #include <strsafe.h> #include <shlwapi.h> @@ -304,6 +306,9 @@ static void pLoadImage(LPWSTR szOpenFileName) } Anime_LoadInfo(); + if (szOpenFileName && szOpenFileName[0]) + SHAddToRecentDocs(SHARD_PATHW, szOpenFileName); + /* reset zoom */ ResetZoom();
4 years, 10 months
1
0
0
0
[reactos] 01/01: [USETUP][BOOTDATA] Include optional CJK standard fonts (#2336)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b539dd1c5a9b5f83a82e5…
commit b539dd1c5a9b5f83a82e57d9af4d3110e1e4eed8 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Feb 14 10:47:20 2020 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Fri Feb 14 10:47:20 2020 +0900 [USETUP][BOOTDATA] Include optional CJK standard fonts (#2336) This PR enables the developers to include the CJK standard fonts into ReactOS by adding them in Folder modules/optional. This feature is for test purpose only. You may not use the fonts illegally. The embeddable font files are: mingliu.ttc, simsun.ttc, mssong.ttf, msgothic.ttc, msmincho.ttc, gulim.ttc and batang.ttc. CORE-9619 --- base/setup/lib/mui.c | 81 +++++++++++++++++++++++++++---- base/setup/lib/muifonts.h | 91 +++++++++++++++++++++++++++++++++++ base/setup/lib/setuplib.c | 11 ++++- base/setup/lib/setuplib.h | 5 +- base/setup/lib/substset.h | 15 ++++++ base/setup/usetup/usetup.c | 59 ++++++++++++++++++++++- boot/bootdata/packages/reactos.dff.in | 7 +++ 7 files changed, 256 insertions(+), 13 deletions(-) diff --git a/base/setup/lib/mui.c b/base/setup/lib/mui.c index 27b85b46b99..8b511cfa56a 100644 --- a/base/setup/lib/mui.c +++ b/base/setup/lib/mui.c @@ -31,6 +31,7 @@ #include "muifonts.h" #include "muilanguages.h" #include "registry.h" +#include "substset.h" #define NDEBUG #include <debug.h> @@ -498,17 +499,28 @@ AddFontsSettingsToRegistry( while (MuiSubFonts[uIndex].FontName != NULL) { RtlInitUnicodeString(&ValueName, MuiSubFonts[uIndex].FontName); - Status = NtSetValueKey(KeyHandle, - &ValueName, - 0, - REG_SZ, - (PVOID)MuiSubFonts[uIndex].SubFontName, - (wcslen(MuiSubFonts[uIndex].SubFontName)+1) * sizeof(WCHAR)); - if (!NT_SUCCESS(Status)) + if (MuiSubFonts[uIndex].SubFontName) { - DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex); - NtClose(KeyHandle); - return FALSE; + Status = NtSetValueKey(KeyHandle, + &ValueName, + 0, + REG_SZ, + (PVOID)MuiSubFonts[uIndex].SubFontName, + (wcslen(MuiSubFonts[uIndex].SubFontName)+1) * sizeof(WCHAR)); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtSetValueKey() failed (Status = %lx, uIndex = %d)\n", Status, uIndex); + NtClose(KeyHandle); + return FALSE; + } + } + else + { + Status = NtDeleteValueKey(KeyHandle, &ValueName); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtDeleteValueKey failed, Status = %lx\n", Status); + } } uIndex++; @@ -548,4 +560,53 @@ AddCodePage( return FALSE; } +#ifdef __REACTOS__ /* HACK */ +BOOL +DoRegistryFontFixup(PFONTSUBSTSETTINGS pSettings, LANGID LangID) +{ + if (pSettings->bFoundFontMINGLIU) + AddFontsSettingsToRegistry(FontFixupMINGLIU); + if (pSettings->bFoundFontSIMSUN) + AddFontsSettingsToRegistry(FontFixupSIMSUN); + if (pSettings->bFoundFontMSSONG) + AddFontsSettingsToRegistry(FontFixupMSSONG); + if (pSettings->bFoundFontMSGOTHIC) + AddFontsSettingsToRegistry(FontFixupMSGOTHIC); + if (pSettings->bFoundFontMSMINCHO) + AddFontsSettingsToRegistry(FontFixupMSMINCHO); + if (pSettings->bFoundFontGULIM) + AddFontsSettingsToRegistry(FontFixupGULIM); + if (pSettings->bFoundFontBATANG) + AddFontsSettingsToRegistry(FontFixupBATANG); + + switch (PRIMARYLANGID(LangID)) + { + case LANG_CHINESE: + if (SUBLANGID(LangID) == SUBLANG_CHINESE_SIMPLIFIED) + { + if (pSettings->bFoundFontSIMSUN) + AddFontsSettingsToRegistry(SimplifiedChineseFontFixup); + } + else + { + if (pSettings->bFoundFontMINGLIU) + AddFontsSettingsToRegistry(TraditionalChineseFontFixup); + } + break; + + case LANG_JAPANESE: + if (pSettings->bFoundFontMSGOTHIC) + AddFontsSettingsToRegistry(JapaneseFontFixup); + break; + + case LANG_KOREAN: + if (pSettings->bFoundFontBATANG) + AddFontsSettingsToRegistry(KoreanFontFixup); + break; + } + + return TRUE; +} +#endif /* HACK */ + /* EOF */ diff --git a/base/setup/lib/muifonts.h b/base/setup/lib/muifonts.h index 45cca3f03eb..258cae7e1b5 100644 --- a/base/setup/lib/muifonts.h +++ b/base/setup/lib/muifonts.h @@ -407,3 +407,94 @@ MUI_SUBFONT HindiFonts[] = { L"Tms Rmn", L"Times New Roman" }, { NULL, NULL } }; + +MUI_SUBFONT SimplifiedChineseFontFixup[] = +{ + { L"MS Shell Dlg", L"SimSun" }, + { L"Tahoma", L"SimSun" }, + { NULL, NULL } +}; + +MUI_SUBFONT TraditionalChineseFontFixup[] = +{ + { L"MS Shell Dlg", L"PMingLiU" }, + { L"Tahoma", L"PMingLiU" }, + { NULL, NULL } +}; + +MUI_SUBFONT JapaneseFontFixup[] = +{ + { L"MS Shell Dlg", L"MS UI Gothic" }, + { L"Tahoma", L"MS UI Gothic" }, + { NULL, NULL } +}; + +MUI_SUBFONT KoreanFontFixup[] = +{ + { L"MS Shell Dlg", L"Batang" }, + { L"Tahoma", L"Batang" }, + { NULL, NULL } +}; + +MUI_SUBFONT FontFixupMINGLIU[] = +{ + { L"MingLiU", NULL }, + { L"PMingLiU", NULL }, + { CTF_LocalName0, NULL }, + { CTF_LocalName1, NULL }, + { NULL, NULL } +}; + +MUI_SUBFONT FontFixupSIMSUN[] = +{ + { L"NSimSun", NULL }, + { L"SimSun", NULL }, + { CSF_LocalName0, NULL }, + { CSF_LocalName1, NULL }, + { CSF_LocalName2, NULL }, + { NULL, NULL } +}; + +MUI_SUBFONT FontFixupMSSONG[] = +{ + { L"MS Song", NULL }, + { CSF_LocalName4, NULL }, + { NULL, NULL } +}; + +MUI_SUBFONT FontFixupMSGOTHIC[] = +{ + { L"MS Gothic", NULL }, + { L"MS PGothic", NULL }, + { L"MS UI Gothic", NULL }, + { JF_LocalName2, NULL }, + { JF_LocalName3, NULL }, + { NULL, NULL } +}; + +MUI_SUBFONT FontFixupMSMINCHO[] = +{ + { L"MS Mincho", NULL }, + { L"MS PMincho", NULL }, + { JF_LocalName0, NULL }, + { JF_LocalName1, NULL }, + { NULL, NULL } +}; + +MUI_SUBFONT FontFixupGULIM[] = +{ + { L"Gulim", NULL }, + { L"GulimChe", NULL }, + { KF_LocalName4, NULL }, + { KF_LocalName5, NULL }, + { NULL, NULL } +}; + +MUI_SUBFONT FontFixupBATANG[] = +{ + { L"Batang", NULL}, + { L"BatangChe", NULL}, + { KF_LocalName0, NULL}, + { KF_LocalName1, NULL}, + { NULL, NULL } +}; diff --git a/base/setup/lib/setuplib.c b/base/setup/lib/setuplib.c index be71e8191c0..0c3590e38e4 100644 --- a/base/setup/lib/setuplib.c +++ b/base/setup/lib/setuplib.c @@ -917,7 +917,8 @@ UpdateRegistry( /**/IN PPARTLIST PartitionList, /* HACK HACK! */ /**/IN WCHAR DestinationDriveLetter, /* HACK HACK! */ /**/IN PCWSTR SelectedLanguageId, /* HACK HACK! */ - IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL) + IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL, + IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL) { ERROR_NUMBER ErrorNumber; NTSTATUS Status; @@ -1113,6 +1114,14 @@ DoUpdate: SetMountedDeviceValues(PartitionList); } +#ifdef __REACTOS__ + if (SubstSettings) + { + /* HACK */ + DoRegistryFontFixup(SubstSettings, wcstoul(SelectedLanguageId, NULL, 16)); + } +#endif + Cleanup: // // TODO: Unload all the registry stuff, perform cleanup, diff --git a/base/setup/lib/setuplib.h b/base/setup/lib/setuplib.h index 97eac01236f..7149d1ffb31 100644 --- a/base/setup/lib/setuplib.h +++ b/base/setup/lib/setuplib.h @@ -137,6 +137,8 @@ extern BOOLEAN IsUnattendedSetup; /* FUNCTIONS ****************************************************************/ +#include "substset.h" + VOID CheckUnattendedSetup( IN OUT PUSETUP_DATA pSetupData); @@ -194,6 +196,7 @@ UpdateRegistry( /**/IN PPARTLIST PartitionList, /* HACK HACK! */ /**/IN WCHAR DestinationDriveLetter, /* HACK HACK! */ /**/IN PCWSTR SelectedLanguageId, /* HACK HACK! */ - IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL); + IN PREGISTRY_STATUS_ROUTINE StatusRoutine OPTIONAL, + IN PFONTSUBSTSETTINGS SubstSettings OPTIONAL); /* EOF */ diff --git a/base/setup/lib/substset.h b/base/setup/lib/substset.h new file mode 100644 index 00000000000..4dbf385fa90 --- /dev/null +++ b/base/setup/lib/substset.h @@ -0,0 +1,15 @@ +#pragma once + +typedef struct _FONTSUBSTSETTINGS +{ + BOOL bFoundFontMINGLIU; + BOOL bFoundFontSIMSUN; + BOOL bFoundFontMSSONG; + BOOL bFoundFontMSGOTHIC; + BOOL bFoundFontMSMINCHO; + BOOL bFoundFontGULIM; + BOOL bFoundFontBATANG; +} FONTSUBSTSETTINGS, *PFONTSUBSTSETTINGS; + +BOOL +DoRegistryFontFixup(PFONTSUBSTSETTINGS pSettings, LANGID LangID); diff --git a/base/setup/usetup/usetup.c b/base/setup/usetup/usetup.c index 7ff48936626..cdd6a3e4f74 100644 --- a/base/setup/usetup/usetup.c +++ b/base/setup/usetup/usetup.c @@ -87,6 +87,59 @@ static FORMATMACHINESTATE FormatState = Start; static PNTOS_INSTALLATION CurrentInstallation = NULL; static PGENERIC_LIST NtOsInstallsList = NULL; +#ifdef __REACTOS__ /* HACK */ + +/* FONT SUBSTITUTION WORKAROUND *************************************************/ + +/* For font file check */ +FONTSUBSTSETTINGS s_SubstSettings = { FALSE }; + +static void +DoWatchDestFileName(LPCWSTR FileName) +{ + if (FileName[0] == 'm' || FileName[0] == 'M') + { + if (wcsicmp(FileName, L"mingliu.ttc") == 0) + { + DPRINT("mingliu.ttc found\n"); + s_SubstSettings.bFoundFontMINGLIU = TRUE; + } + else if (wcsicmp(FileName, L"msgothic.ttc") == 0) + { + DPRINT("msgothic.ttc found\n"); + s_SubstSettings.bFoundFontMSGOTHIC = TRUE; + } + else if (wcsicmp(FileName, L"msmincho.ttc") == 0) + { + DPRINT("msmincho.ttc found\n"); + s_SubstSettings.bFoundFontMSMINCHO = TRUE; + } + else if (wcsicmp(FileName, L"mssong.ttf") == 0) + { + DPRINT("mssong.ttf found\n"); + s_SubstSettings.bFoundFontMSSONG = TRUE; + } + } + else + { + if (wcsicmp(FileName, L"simsun.ttc") == 0) + { + DPRINT("simsun.ttc found\n"); + s_SubstSettings.bFoundFontSIMSUN = TRUE; + } + else if (wcsicmp(FileName, L"gulim.ttc") == 0) + { + DPRINT("gulim.ttc found\n"); + s_SubstSettings.bFoundFontGULIM = TRUE; + } + else if (wcsicmp(FileName, L"batang.ttc") == 0) + { + DPRINT("batang.ttc found\n"); + s_SubstSettings.bFoundFontBATANG = TRUE; + } + } +} +#endif /* HACK */ /* FUNCTIONS ****************************************************************/ @@ -4060,6 +4113,9 @@ FileCopyCallback(PVOID Context, CONSOLE_SetStatusText(MUIGetString(STRING_COPYING), DstFileName); +#ifdef __REACTOS__ /* HACK */ + DoWatchDestFileName(DstFileName); +#endif } SetupUpdateMemoryInfo(CopyContext, FALSE); @@ -4237,7 +4293,8 @@ RegistryPage(PINPUT_RECORD Ir) PartitionList, InstallPartition->DriveLetter, SelectedLanguageId, - RegistryStatus); + RegistryStatus, + &s_SubstSettings); if (Error != ERROR_SUCCESS) { MUIDisplayError(Error, Ir, POPUP_WAIT_ENTER); diff --git a/boot/bootdata/packages/reactos.dff.in b/boot/bootdata/packages/reactos.dff.in index 9fef574ae77..349953553fa 100644 --- a/boot/bootdata/packages/reactos.dff.in +++ b/boot/bootdata/packages/reactos.dff.in @@ -94,6 +94,13 @@ Signature = "$Windows NT$" ; Optional/proprietary files "modules/optional/DroidSansFallback.ttf" 4 optional +"modules/optional/mingliu.ttc" 4 optional +"modules/optional/simsun.ttc" 4 optional +"modules/optional/mssong.ttf" 4 optional +"modules/optional/msgothic.ttc" 4 optional +"modules/optional/msmincho.ttc" 4 optional +"modules/optional/gulim.ttc" 4 optional +"modules/optional/batang.ttc" 4 optional "modules/optional/NOTICE_for_Droid_Font.txt" 1 optional "modules/optional/netkvm.inf" 6 optional "modules/optional/netkvm.cat" 6 optional
4 years, 10 months
1
0
0
0
[reactos] 01/01: [GDI32] Use Gdi Flush for SetViewportOrgEx.
by jimtabor
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c89e111c6a29bd59df1ff…
commit c89e111c6a29bd59df1ffebba6d4a1b878b8e433 Author: jimtabor <james.tabor(a)reactos.org> AuthorDate: Thu Feb 13 17:05:38 2020 -0600 Commit: jimtabor <james.tabor(a)reactos.org> CommitDate: Thu Feb 13 17:05:38 2020 -0600 [GDI32] Use Gdi Flush for SetViewportOrgEx. Fixes offset in combo texts and menu highlights. See CORE-16644 & CORE-16656. --- win32ss/gdi/gdi32/objects/coord.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/win32ss/gdi/gdi32/objects/coord.c b/win32ss/gdi/gdi32/objects/coord.c index dd40889ea04..b27711ca1e3 100644 --- a/win32ss/gdi/gdi32/objects/coord.c +++ b/win32ss/gdi/gdi32/objects/coord.c @@ -458,7 +458,7 @@ GetWindowOrgEx( } /* - * @unimplemented + * @implemented */ BOOL WINAPI @@ -525,7 +525,7 @@ SetViewportExtEx( } /* - * @unimplemented + * @implemented */ BOOL WINAPI @@ -577,7 +577,7 @@ SetWindowOrgEx( } /* - * @unimplemented + * @implemented */ BOOL WINAPI @@ -648,7 +648,7 @@ SetWindowExtEx( } /* - * @unimplemented + * @implemented */ BOOL WINAPI @@ -669,7 +669,16 @@ SetViewportOrgEx( /* Do not set LastError here! */ return FALSE; } - + //// HACK : XP+ doesn't do this. See CORE-16656 & CORE-16644. + if (NtCurrentTeb()->GdiTebBatch.HDC == hdc) + { + if (pdcattr->ulDirty_ & DC_MODE_DIRTY) + { + NtGdiFlush(); + pdcattr->ulDirty_ &= ~DC_MODE_DIRTY; + } + } + //// if (lpPoint) { lpPoint->x = pdcattr->ptlViewportOrg.x;
4 years, 10 months
1
0
0
0
[reactos] 02/02: [FREELDR] Fix IDE driver failures on real hardware. (#2255)
by Dmitry Borisov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a55bab8d1d13eab9afe30…
commit a55bab8d1d13eab9afe30e29203164e50cf653cd Author: Dmitry Borisov <di.sean(a)protonmail.com> AuthorDate: Fri Jan 17 19:39:28 2020 +0600 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Thu Feb 13 18:10:02 2020 +0100 [FREELDR] Fix IDE driver failures on real hardware. (#2255) - Changes in device detection code: * Properly check device signature. * Сorrectly reset the IDE controller. * Remove check for device type code. - Fix CD-ROM sector read issue: * Changed ATAPI packet opcode to be more universal (Some devices may not have READ12 support). * Always use 2048 bytes as sector size when reading the data from a disc. * Modify WaitForFlags() to stop polling if the error bit was set. * Changed timeout to 31 seconds (ATA default value). - Add more informational messages in DEBUG mode. - Fix invalid IDE register value. - Fix registers names. Tested by Stanislav Motylkov and Daniel Reimer on XQEMU and on real hardware MS Xbox revision 1.3 with Philips DVD drive. It has also been tested manually on PC with a SONY DVD drive. CORE-16628 CORE-16216 --- boot/freeldr/freeldr/arch/drivers/hwide.c | 335 ++++++++++++++++++++---------- boot/freeldr/freeldr/include/hwide.h | 10 +- 2 files changed, 231 insertions(+), 114 deletions(-) diff --git a/boot/freeldr/freeldr/arch/drivers/hwide.c b/boot/freeldr/freeldr/arch/drivers/hwide.c index c1f8f666769..9eb92ada048 100644 --- a/boot/freeldr/freeldr/arch/drivers/hwide.c +++ b/boot/freeldr/freeldr/arch/drivers/hwide.c @@ -1,8 +1,8 @@ /* * PROJECT: FreeLoader * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) - * PURPOSE: ATA/ATAPI polled I/O driver. - * COPYRIGHT: Copyright 2019 Dmitry Borisov (di.sean(a)protonmail.com) + * PURPOSE: ATA/ATAPI programmed I/O driver. + * COPYRIGHT: Copyright 2019-2020 Dmitry Borisov (di.sean(a)protonmail.com) */ /* INCLUDES *******************************************************************/ @@ -21,10 +21,7 @@ DBG_DEFAULT_CHANNEL(DISK); #define TAG_ATA_DEVICE 'DatA' #define ATAPI_PACKET_SIZE(IdentifyData) (IdentifyData.AtapiCmdSize ? 16 : 12) - -/* Used in WaitForFlags() and should be 31 seconds (31e5), but it's too much for polled I/O */ -#define ATA_STATUS_TIMEOUT 36000 -#define ATA_READ_TIMEOUT 4e5 +#define ATA_STATUS_TIMEOUT 31e5 #define AtaWritePort(Channel, Port, Data) \ WRITE_PORT_UCHAR(UlongToPtr(BaseArray[(Channel)] + (Port)), (Data)) @@ -70,6 +67,22 @@ WaitForFlags( static BOOLEAN +WaitForFlagsOr( + IN UCHAR Channel, + IN UCHAR FirstValue, + IN UCHAR SecondValue, + IN ULONG Timeout +); + +static +BOOLEAN +WaitForBusy( + IN UCHAR Channel, + IN ULONG Timeout +); + +static +VOID SelectDevice( IN UCHAR Channel, IN UCHAR DeviceNumber @@ -83,6 +96,19 @@ IdentifyDevice( OUT PDEVICE_UNIT *DeviceUnit ); +static +BOOLEAN +AtapiRequestSense( + IN PDEVICE_UNIT DeviceUnit, + OUT PSENSE_DATA SenseData +); + +static +VOID +AtapiPrintSenseData( + IN PDEVICE_UNIT DeviceUnit +); + static BOOLEAN AtapiReadyCheck( @@ -274,21 +300,23 @@ AtaReadLogicalSectorsLBA( } /* Select the drive */ - if (!SelectDevice(DeviceUnit->Channel, DeviceUnit->DeviceNumber)) + SelectDevice(DeviceUnit->Channel, DeviceUnit->DeviceNumber); + if (!WaitForBusy(DeviceUnit->Channel, ATA_STATUS_TIMEOUT)) + { + ERR("AtaReadLogicalSectorsLBA() failed. Device is busy.\n"); return FALSE; + } /* Disable interrupts */ -#ifndef SARCH_PC98 - AtaWritePort(DeviceUnit->Channel, IDX_IO2_o_AltStatus, IDE_DC_DISABLE_INTERRUPTS); + AtaWritePort(DeviceUnit->Channel, IDX_IO2_o_Control, IDE_DC_DISABLE_INTERRUPTS); StallExecutionProcessor(1); -#endif if (UseLBA48) { /* FIFO */ AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Feature, 0); AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Feature, ATA_PIO); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockCount, (BlockCount & 0xFF) >> 8); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockCount, (BlockCount >> 8) & 0xFF); AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockCount, BlockCount & 0xFF); AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockNumber, (Lba >> 24) & 0xFF); AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockNumber, Lba & 0xFF); @@ -321,8 +349,8 @@ AtaReadLogicalSectorsLBA( for (RemainingBlockCount = BlockCount; RemainingBlockCount > 0; --RemainingBlockCount) { /* Wait for ready to transfer data block */ - if (!WaitForFlags(DeviceUnit->Channel, (IDE_STATUS_BUSY | IDE_STATUS_DRQ | IDE_STATUS_ERROR), - IDE_STATUS_DRQ, ATA_READ_TIMEOUT)) + if (!WaitForFlags(DeviceUnit->Channel, IDE_STATUS_DRQ, + IDE_STATUS_DRQ, ATA_STATUS_TIMEOUT)) { ERR("AtaReadLogicalSectorsLBA() failed. Status: 0x%02x, Error: 0x%02x\n", AtaReadPort(DeviceUnit->Channel, IDX_IO1_i_Status), @@ -351,9 +379,15 @@ AtaSendAtapiPacket( IN UCHAR PacketSize, IN USHORT ByteCount) { - /* No DRQ for TEST UNIT READY */ - BOOLEAN NoData = (AtapiPacket[0] == SCSIOP_TEST_UNIT_READY); - UCHAR ExpectedFlags = NoData ? IDE_STATUS_DRDY : (IDE_STATUS_DRQ | IDE_STATUS_DRDY); + /* + * REQUEST SENSE is used by driver to clear the ATAPI 'Bus reset' indication. + * TEST UNIT READY doesn't require space for returned data. + */ + UCHAR ExpectedFlagsMask = (AtapiPacket[0] == SCSIOP_REQUEST_SENSE) ? + IDE_STATUS_DRDY : (IDE_STATUS_DRQ | IDE_STATUS_DRDY); + UCHAR ExpectedFlags = ((AtapiPacket[0] == SCSIOP_TEST_UNIT_READY) || + (AtapiPacket[0] == SCSIOP_REQUEST_SENSE)) ? + IDE_STATUS_DRDY : (IDE_STATUS_DRQ | IDE_STATUS_DRDY); /* PIO mode */ AtaWritePort(Channel, IDX_ATAPI_IO1_o_Feature, ATA_PIO); @@ -365,8 +399,7 @@ AtaSendAtapiPacket( /* Prepare to transfer a device command via a command packet */ AtaWritePort(Channel, IDX_ATAPI_IO1_o_Command, IDE_COMMAND_ATAPI_PACKET); StallExecutionProcessor(50); - if (!WaitForFlags(Channel, (IDE_STATUS_BUSY | IDE_STATUS_DRQ | IDE_STATUS_ERROR), - IDE_STATUS_DRQ, NoData ? ATA_STATUS_TIMEOUT : ATA_READ_TIMEOUT)) + if (!WaitForFlagsOr(Channel, IDE_STATUS_DRQ, IDE_STATUS_DRDY, ATA_STATUS_TIMEOUT)) { ERR("AtaSendAtapiPacket(0x%x) failed. A device error occurred Status: 0x%02x, Error: 0x%02x\n", AtapiPacket[0], AtaReadPort(Channel, IDX_ATAPI_IO1_i_Status), AtaReadPort(Channel, IDX_ATAPI_IO1_i_Error)); @@ -375,8 +408,7 @@ AtaSendAtapiPacket( /* Command packet transfer */ AtaWriteBuffer(Channel, AtapiPacket, PacketSize); - if (!WaitForFlags(Channel, (IDE_STATUS_BUSY | IDE_STATUS_DRQ | IDE_STATUS_DRDY | IDE_STATUS_ERROR), - ExpectedFlags, NoData ? ATA_STATUS_TIMEOUT : ATA_READ_TIMEOUT)) + if (!WaitForFlags(Channel, ExpectedFlagsMask, ExpectedFlags, ATA_STATUS_TIMEOUT)) { TRACE("AtaSendAtapiPacket(0x%x) failed. An execution error occurred Status: 0x%02x, Error: 0x%02x\n", AtapiPacket[0], AtaReadPort(Channel, IDX_ATAPI_IO1_i_Status), AtaReadPort(Channel, IDX_ATAPI_IO1_i_Error)); @@ -398,28 +430,25 @@ AtapiReadLogicalSectorLBA( BOOLEAN Success; /* Select the drive */ - if (!SelectDevice(DeviceUnit->Channel, DeviceUnit->DeviceNumber)) + SelectDevice(DeviceUnit->Channel, DeviceUnit->DeviceNumber); + if (!WaitForBusy(DeviceUnit->Channel, ATA_STATUS_TIMEOUT)) + { + ERR("AtapiReadLogicalSectorLBA() failed. Device is busy!\n"); return FALSE; + } /* Disable interrupts */ - AtaWritePort(DeviceUnit->Channel, IDX_IO2_o_AltStatus, IDE_DC_DISABLE_INTERRUPTS); + AtaWritePort(DeviceUnit->Channel, IDX_IO2_o_Control, IDE_DC_DISABLE_INTERRUPTS); StallExecutionProcessor(1); /* Send the SCSI READ command */ RtlZeroMemory(&AtapiPacket, sizeof(AtapiPacket)); -#if defined(SARCH_PC98) AtapiPacket[0] = SCSIOP_READ; - AtapiPacket[8] = 1; - AtapiPacket[9] = 0; -#else - AtapiPacket[0] = SCSIOP_READ12; - AtapiPacket[8] = 0; - AtapiPacket[9] = 1; -#endif AtapiPacket[2] = (SectorNumber >> 24) & 0xFF; AtapiPacket[3] = (SectorNumber >> 16) & 0xFF; AtapiPacket[4] = (SectorNumber >> 8) & 0xFF; AtapiPacket[5] = SectorNumber & 0xFF; + AtapiPacket[8] = 1; Success = AtaSendAtapiPacket(DeviceUnit->Channel, AtapiPacket, ATAPI_PACKET_SIZE(DeviceUnit->IdentifyData), @@ -427,6 +456,7 @@ AtapiReadLogicalSectorLBA( if (!Success) { ERR("AtapiReadLogicalSectorLBA() failed. A read error occurred.\n"); + AtapiPrintSenseData(DeviceUnit); return FALSE; } @@ -461,11 +491,61 @@ AtapiCapacityDetect( *SectorSize = (AtapiCapacity[4] << 24) | (AtapiCapacity[5] << 16) | (AtapiCapacity[6] << 8) | AtapiCapacity[7]; + + /* If device reports a non-zero block length, reset to defaults (we use READ command instead of READ CD) */ + if (*SectorSize != 0) + *SectorSize = 2048; } else { *TotalSectors = 0; *SectorSize = 0; + + AtapiPrintSenseData(DeviceUnit); + } +} + +static +BOOLEAN +AtapiRequestSense( + IN PDEVICE_UNIT DeviceUnit, + OUT PSENSE_DATA SenseData) +{ + UCHAR AtapiPacket[16]; + BOOLEAN Success; + + RtlZeroMemory(&AtapiPacket, sizeof(AtapiPacket)); + RtlZeroMemory(SenseData, sizeof(SENSE_DATA)); + AtapiPacket[0] = SCSIOP_REQUEST_SENSE; + AtapiPacket[4] = SENSE_BUFFER_SIZE; + Success = AtaSendAtapiPacket(DeviceUnit->Channel, + AtapiPacket, + ATAPI_PACKET_SIZE(DeviceUnit->IdentifyData), + SENSE_BUFFER_SIZE); + if (Success) + { + AtaReadBuffer(DeviceUnit->Channel, SenseData, SENSE_BUFFER_SIZE); + return TRUE; + } + else + { + ERR("Cannot read the sense data.\n"); + return FALSE; + } +} + +static +VOID +AtapiPrintSenseData(IN PDEVICE_UNIT DeviceUnit) +{ + SENSE_DATA SenseData; + + if (AtapiRequestSense(DeviceUnit, &SenseData)) + { + ERR("SK 0x%x, ASC 0x%x, ASCQ 0x%x\n", + SenseData.SenseKey, + SenseData.AdditionalSenseCode, + SenseData.AdditionalSenseCodeQualifier); } } @@ -479,7 +559,8 @@ AtapiReadyCheck(IN OUT PDEVICE_UNIT DeviceUnit) BOOLEAN Success; /* Select the drive */ - if (!SelectDevice(DeviceUnit->Channel, DeviceUnit->DeviceNumber)) + SelectDevice(DeviceUnit->Channel, DeviceUnit->DeviceNumber); + if (!WaitForBusy(DeviceUnit->Channel, ATA_STATUS_TIMEOUT)) return FALSE; /* Send the SCSI TEST UNIT READY command */ @@ -490,16 +571,7 @@ AtapiReadyCheck(IN OUT PDEVICE_UNIT DeviceUnit) ATAPI_PACKET_SIZE(DeviceUnit->IdentifyData), 0); - /* Send the SCSI REQUEST SENSE command */ - RtlZeroMemory(&AtapiPacket, sizeof(AtapiPacket)); - RtlZeroMemory(&SenseData, SENSE_BUFFER_SIZE); - AtapiPacket[0] = SCSIOP_REQUEST_SENSE; - AtapiPacket[4] = SENSE_BUFFER_SIZE; - Success = AtaSendAtapiPacket(DeviceUnit->Channel, - AtapiPacket, - ATAPI_PACKET_SIZE(DeviceUnit->IdentifyData), - SENSE_BUFFER_SIZE); - if (!Success) + if (!AtapiRequestSense(DeviceUnit, &SenseData)) return FALSE; AtaReadBuffer(DeviceUnit->Channel, &SenseData, SENSE_BUFFER_SIZE); @@ -531,7 +603,10 @@ AtapiReadyCheck(IN OUT PDEVICE_UNIT DeviceUnit) ATAPI_PACKET_SIZE(DeviceUnit->IdentifyData), MAXIMUM_CDROM_SIZE); if (!Success) + { + AtapiPrintSenseData(DeviceUnit); return FALSE; + } AtaReadBuffer(DeviceUnit->Channel, &DummyData, MAXIMUM_CDROM_SIZE); /* fall through */ @@ -578,14 +653,66 @@ WaitForFlags( IN UCHAR ExpectedValue, IN ULONG Timeout) { + UCHAR Status; + ASSERT(Timeout != 0); + WaitForBusy(Channel, ATA_STATUS_TIMEOUT); + while (Timeout--) { - if ((AtaReadPort(Channel, IDX_IO1_i_Status) & Flags) == ExpectedValue) + StallExecutionProcessor(10); + + Status = AtaReadPort(Channel, IDX_IO1_i_Status); + if (Status & IDE_STATUS_ERROR) + return FALSE; + else if ((Status & Flags) == ExpectedValue) + return TRUE; + } + return FALSE; +} + +static +BOOLEAN +WaitForFlagsOr( + IN UCHAR Channel, + IN UCHAR FirstValue, + IN UCHAR SecondValue, + IN ULONG Timeout) +{ + UCHAR Status; + + ASSERT(Timeout != 0); + + WaitForBusy(Channel, ATA_STATUS_TIMEOUT); + + while (Timeout--) + { + StallExecutionProcessor(10); + + Status = AtaReadPort(Channel, IDX_IO1_i_Status); + if (Status & IDE_STATUS_ERROR) + return FALSE; + else if ((Status & FirstValue) || (Status & SecondValue)) + return TRUE; + } + return FALSE; +} + +static +BOOLEAN +WaitForBusy( + IN UCHAR Channel, + IN ULONG Timeout) +{ + ASSERT(Timeout != 0); + + while (Timeout--) + { + StallExecutionProcessor(10); + + if ((AtaReadPort(Channel, IDX_IO1_i_Status) & IDE_STATUS_BUSY) == 0) return TRUE; - else - StallExecutionProcessor(10); } return FALSE; } @@ -597,31 +724,25 @@ AtaHardReset(IN UCHAR Channel) TRACE("AtaHardReset(Controller %d)\n", Channel); AtaWritePort(Channel, IDX_IO2_o_Control, IDE_DC_RESET_CONTROLLER); - StallExecutionProcessor(200000); + StallExecutionProcessor(100000); AtaWritePort(Channel, IDX_IO2_o_Control, IDE_DC_REENABLE_CONTROLLER); - StallExecutionProcessor(1); + StallExecutionProcessor(5); + WaitForBusy(Channel, ATA_STATUS_TIMEOUT); } static -BOOLEAN +VOID SelectDevice(IN UCHAR Channel, IN UCHAR DeviceNumber) { #if defined(SARCH_PC98) /* Select IDE Channel */ WRITE_PORT_UCHAR((PUCHAR)IDE_IO_o_BankSelect, Channel); - StallExecutionProcessor(1); + StallExecutionProcessor(5); #endif AtaWritePort(Channel, IDX_IO1_o_DriveSelect, DeviceNumber ? IDE_DRIVE_SELECT_2 : IDE_DRIVE_SELECT_1); - StallExecutionProcessor(500); - if (!WaitForFlags(Channel, (IDE_STATUS_BUSY | IDE_STATUS_DRQ), 0, ATA_STATUS_TIMEOUT)) - { - TRACE("SelectDevice() failed. Device(%d:%d) is busy.\n", Channel, DeviceNumber); - return FALSE; - } - - return TRUE; + StallExecutionProcessor(5); } static @@ -631,11 +752,10 @@ IdentifyDevice( IN UCHAR DeviceNumber, OUT PDEVICE_UNIT *DeviceUnit) { - UCHAR SignatureLow, SignatureHigh; + UCHAR SignatureLow, SignatureHigh, SignatureCount, SignatureNumber; + UCHAR Command; IDENTIFY_DATA Id; - INQUIRYDATA AtapiInquiry; - BOOLEAN Success; - UCHAR AtapiPacket[16]; + SENSE_DATA SenseData; ULONG i; ULONG SectorSize; ULONGLONG TotalSectors; @@ -644,50 +764,61 @@ IdentifyDevice( TRACE("IdentifyDevice() Channel = %x, Device = %x, BaseIoAddress = 0x%x\n", Channel, DeviceNumber, BaseArray[Channel]); + /* Look at controller */ + SelectDevice(Channel, DeviceNumber); + StallExecutionProcessor(5); + AtaWritePort(Channel, IDX_IO1_o_BlockNumber, 0x55); + AtaWritePort(Channel, IDX_IO1_o_BlockNumber, 0x55); + StallExecutionProcessor(5); + if (AtaReadPort(Channel, IDX_IO1_i_BlockNumber) != 0x55) + goto Failure; + /* Reset the controller */ AtaHardReset(Channel); /* Select the drive */ - if (!SelectDevice(Channel, DeviceNumber)) + SelectDevice(Channel, DeviceNumber); + if (!WaitForBusy(Channel, ATA_STATUS_TIMEOUT)) goto Failure; - /* Send the IDENTIFY DEVICE command */ - AtaWritePort(Channel, IDX_IO1_o_Command, IDE_COMMAND_IDENTIFY); - StallExecutionProcessor(50); - if (WaitForFlags(Channel, (IDE_STATUS_BUSY | IDE_STATUS_DRQ | IDE_STATUS_ERROR), - IDE_STATUS_DRQ, ATA_STATUS_TIMEOUT)) - { - SignatureLow = AtaReadPort(Channel, IDX_IO1_i_CylinderLow); - SignatureHigh = AtaReadPort(Channel, IDX_IO1_i_CylinderHigh); - TRACE("IdentifyDevice(): SignatureLow = 0x%x, SignatureHigh = 0x%x\n", SignatureLow, SignatureHigh); - if (SignatureLow == 0x00 && SignatureHigh == 0x00) - { - /* This is PATA */ - TRACE("IdentifyDevice(): Found PATA device at %d:%d\n", Channel, DeviceNumber); - goto Identify; - } - } - - /* If not PATA, ATAPI maybe? Send the IDENTIFY PACKET DEVICE command */ - AtaWritePort(Channel, IDX_ATAPI_IO1_o_Command, IDE_COMMAND_ATAPI_IDENTIFY); - StallExecutionProcessor(500); + /* Signature check */ SignatureLow = AtaReadPort(Channel, IDX_IO1_i_CylinderLow); SignatureHigh = AtaReadPort(Channel, IDX_IO1_i_CylinderHigh); - TRACE("IdentifyDevice(): SignatureLow = 0x%x, SignatureHigh = 0x%x\n", SignatureLow, SignatureHigh); - /* Check for devices that implements the PACKET Command feature */ - if (SignatureLow == ATAPI_MAGIC_LSB && SignatureHigh == ATAPI_MAGIC_MSB) + SignatureCount = AtaReadPort(Channel, IDX_IO1_i_BlockCount); + SignatureNumber = AtaReadPort(Channel, IDX_IO1_i_BlockNumber); + TRACE("IdentifyDevice(): SL = 0x%x, SH = 0x%x, SC = 0x%x, SN = 0x%x\n", + SignatureLow, SignatureHigh, SignatureCount, SignatureNumber); + if (SignatureLow == 0x00 && SignatureHigh == 0x00 && + SignatureCount == 0x01 && SignatureNumber == 0x01) + { + TRACE("IdentifyDevice(): Found PATA device at %d:%d\n", Channel, DeviceNumber); + Command = IDE_COMMAND_IDENTIFY; + } + else if (SignatureLow == ATAPI_MAGIC_LSB && + SignatureHigh == ATAPI_MAGIC_MSB) { - /* This is ATAPI */ - Flags |= ATA_DEVICE_ATAPI | ATA_DEVICE_LBA | ATA_DEVICE_NOT_READY; TRACE("IdentifyDevice(): Found ATAPI device at %d:%d\n", Channel, DeviceNumber); - goto Identify; + Flags |= ATA_DEVICE_ATAPI | ATA_DEVICE_LBA | ATA_DEVICE_NOT_READY; + Command = IDE_COMMAND_ATAPI_IDENTIFY; } else { goto Failure; } -Identify: + /* Disable interrupts */ + AtaWritePort(Channel, IDX_IO2_o_Control, IDE_DC_DISABLE_INTERRUPTS); + StallExecutionProcessor(5); + + /* Send the identify command */ + AtaWritePort(Channel, IDX_IO1_o_Command, Command); + StallExecutionProcessor(50); + if (!WaitForFlags(Channel, IDE_STATUS_DRQ, IDE_STATUS_DRQ, ATA_STATUS_TIMEOUT)) + { + ERR("IdentifyDevice(): Identify command failed.\n"); + goto Failure; + } + /* Receive parameter information from the device */ AtaReadBuffer(Channel, &Id, IDENTIFY_DATA_SIZE); @@ -705,25 +836,6 @@ Identify: TRACE("FR %.*s\n", sizeof(Id.FirmwareRevision), Id.FirmwareRevision); TRACE("MN %.*s\n", sizeof(Id.ModelNumber), Id.ModelNumber); - /* Detect the type of device */ - if (Flags & ATA_DEVICE_ATAPI) - { - /* Send the SCSI INQUIRY command */ - RtlZeroMemory(&AtapiPacket, sizeof(AtapiPacket)); - AtapiPacket[0] = SCSIOP_INQUIRY; - AtapiPacket[4] = INQUIRYDATABUFFERSIZE; - Success = AtaSendAtapiPacket(Channel, AtapiPacket, ATAPI_PACKET_SIZE(Id), INQUIRYDATABUFFERSIZE); - if (!Success) - goto Failure; - - AtaReadBuffer(Channel, &AtapiInquiry, INQUIRYDATABUFFERSIZE); - if (AtapiInquiry.DeviceType != READ_ONLY_DIRECT_ACCESS_DEVICE) - { - TRACE("IdentifyDevice(): Unsupported device type 0x%x!\n", AtapiInquiry.DeviceType); - goto Failure; - } - } - /* Allocate a new device unit structure */ *DeviceUnit = FrLdrTempAlloc(sizeof(DEVICE_UNIT), TAG_ATA_DEVICE); if (*DeviceUnit == NULL) @@ -737,9 +849,16 @@ Identify: (*DeviceUnit)->DeviceNumber = DeviceNumber; (*DeviceUnit)->IdentifyData = Id; - /* Detect a medium's capacity */ if (Flags & ATA_DEVICE_ATAPI) { + /* Clear the ATAPI 'Bus reset' indication */ + for (i = 0; i < 10; ++i) + { + AtapiRequestSense(*DeviceUnit, &SenseData); + StallExecutionProcessor(10); + } + + /* Detect a medium's capacity */ AtapiCapacityDetect(*DeviceUnit, &TotalSectors, &SectorSize); if (SectorSize == 0 || TotalSectors == 0) { diff --git a/boot/freeldr/freeldr/include/hwide.h b/boot/freeldr/freeldr/include/hwide.h index 04f9f2d51ae..23f7fd94ad0 100644 --- a/boot/freeldr/freeldr/include/hwide.h +++ b/boot/freeldr/freeldr/include/hwide.h @@ -1,8 +1,8 @@ /* * PROJECT: FreeLoader * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) - * PURPOSE: ATA/ATAPI polled I/O driver header file. - * COPYRIGHT: Copyright 2019 Dmitry Borisov (di.sean(a)protonmail.com) + * PURPOSE: ATA/ATAPI programmed I/O driver header file. + * COPYRIGHT: Copyright 2019-2020 Dmitry Borisov (di.sean(a)protonmail.com) */ /* GLOBALS ********************************************************************/ @@ -35,8 +35,7 @@ #define IDX_IO1_o_DriveSelect 0x0C #define IDX_IO1_o_Command 0x0E -#define IDX_IO2_o_AltStatus 0x10C -#define IDX_IO2_o_Control 0x10E +#define IDX_IO2_o_Control 0x10C #define IDE_IO_o_BankSelect 0x432 #else /* SARCH_PC98 */ #define IDX_IO1_i_Data 0x00 @@ -60,8 +59,7 @@ #define IDX_IO1_o_DriveSelect 0x06 #define IDX_IO1_o_Command 0x07 -#define IDX_IO2_o_AltStatus 0x206 -#define IDX_IO2_o_Control 0x207 +#define IDX_IO2_o_Control 0x206 #endif /*
4 years, 10 months
1
0
0
0
[reactos] 01/02: [FREELDR] Fix indentation. No code changes
by Dmitry Borisov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dc81ecf84b40703fbe975…
commit dc81ecf84b40703fbe975f82185c977d37541639 Author: Dmitry Borisov <di.sean(a)protonmail.com> AuthorDate: Tue Jan 14 04:45:22 2020 +0600 Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org> CommitDate: Thu Feb 13 18:10:01 2020 +0100 [FREELDR] Fix indentation. No code changes --- boot/freeldr/freeldr/arch/drivers/hwide.c | 154 +++++++++++++++--------------- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/boot/freeldr/freeldr/arch/drivers/hwide.c b/boot/freeldr/freeldr/arch/drivers/hwide.c index 51f59857823..c1f8f666769 100644 --- a/boot/freeldr/freeldr/arch/drivers/hwide.c +++ b/boot/freeldr/freeldr/arch/drivers/hwide.c @@ -244,100 +244,100 @@ AtaReadLogicalSectorsLBA( while (SectorCount > 0) { - /* Prevent sector count overflow, divide it into maximum possible chunks and loop each one */ - if (UseLBA48) - BlockCount = min(SectorCount, USHRT_MAX); - else - BlockCount = min(SectorCount, UCHAR_MAX); + /* Prevent sector count overflow, divide it into maximum possible chunks and loop each one */ + if (UseLBA48) + BlockCount = min(SectorCount, USHRT_MAX); + else + BlockCount = min(SectorCount, UCHAR_MAX); - /* Convert LBA into a format CHS if needed */ - if (DeviceUnit->Flags & ATA_DEVICE_CHS) - { - ChsTemp = DeviceUnit->IdentifyData.SectorsPerTrack * DeviceUnit->IdentifyData.NumberOfHeads; - if (ChsTemp) + /* Convert LBA into a format CHS if needed */ + if (DeviceUnit->Flags & ATA_DEVICE_CHS) { - Cylinder = SectorNumber / ChsTemp; - Head = (SectorNumber % ChsTemp) / DeviceUnit->IdentifyData.SectorsPerTrack; - Sector = (SectorNumber % DeviceUnit->IdentifyData.SectorsPerTrack) + 1; + ChsTemp = DeviceUnit->IdentifyData.SectorsPerTrack * DeviceUnit->IdentifyData.NumberOfHeads; + if (ChsTemp) + { + Cylinder = SectorNumber / ChsTemp; + Head = (SectorNumber % ChsTemp) / DeviceUnit->IdentifyData.SectorsPerTrack; + Sector = (SectorNumber % DeviceUnit->IdentifyData.SectorsPerTrack) + 1; + } + else + { + Cylinder = 0; + Head = 0; + Sector = 1; + } + Lba = (Sector & 0xFF) | ((Cylinder & 0xFFFFF) << 8) | ((Head & 0x0F) << 24); } else { - Cylinder = 0; - Head = 0; - Sector = 1; + Lba = SectorNumber; } - Lba = (Sector & 0xFF) | ((Cylinder & 0xFFFFF) << 8) | ((Head & 0x0F) << 24); - } - else - { - Lba = SectorNumber; - } - /* Select the drive */ - if (!SelectDevice(DeviceUnit->Channel, DeviceUnit->DeviceNumber)) - return FALSE; + /* Select the drive */ + if (!SelectDevice(DeviceUnit->Channel, DeviceUnit->DeviceNumber)) + return FALSE; - /* Disable interrupts */ + /* Disable interrupts */ #ifndef SARCH_PC98 - AtaWritePort(DeviceUnit->Channel, IDX_IO2_o_AltStatus, IDE_DC_DISABLE_INTERRUPTS); - StallExecutionProcessor(1); + AtaWritePort(DeviceUnit->Channel, IDX_IO2_o_AltStatus, IDE_DC_DISABLE_INTERRUPTS); + StallExecutionProcessor(1); #endif - if (UseLBA48) - { - /* FIFO */ - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Feature, 0); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Feature, ATA_PIO); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockCount, (BlockCount & 0xFF) >> 8); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockCount, BlockCount & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockNumber, (Lba >> 24) & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockNumber, Lba & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderLow, (Lba >> 32) & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderLow, (Lba >> 8) & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderHigh, (Lba >> 40) & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderHigh, (Lba >> 16) & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_DriveSelect, - IDE_USE_LBA | (DeviceUnit->DeviceNumber ? IDE_DRIVE_2 : IDE_DRIVE_1)); - Command = IDE_COMMAND_READ_EXT; - } - else - { - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Feature, ATA_PIO); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockCount, BlockCount & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockNumber, Lba & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderLow, (Lba >> 8) & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderHigh, (Lba >> 16) & 0xFF); - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_DriveSelect, - ((Lba >> 24) & 0x0F) | - (DeviceUnit->Flags & ATA_DEVICE_CHS ? 0x00 : IDE_USE_LBA) | - (DeviceUnit->DeviceNumber ? IDE_DRIVE_SELECT_2 : IDE_DRIVE_SELECT_1)); - Command = IDE_COMMAND_READ; - } + if (UseLBA48) + { + /* FIFO */ + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Feature, 0); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Feature, ATA_PIO); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockCount, (BlockCount & 0xFF) >> 8); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockCount, BlockCount & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockNumber, (Lba >> 24) & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockNumber, Lba & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderLow, (Lba >> 32) & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderLow, (Lba >> 8) & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderHigh, (Lba >> 40) & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderHigh, (Lba >> 16) & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_DriveSelect, + IDE_USE_LBA | (DeviceUnit->DeviceNumber ? IDE_DRIVE_2 : IDE_DRIVE_1)); + Command = IDE_COMMAND_READ_EXT; + } + else + { + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Feature, ATA_PIO); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockCount, BlockCount & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_BlockNumber, Lba & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderLow, (Lba >> 8) & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_CylinderHigh, (Lba >> 16) & 0xFF); + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_DriveSelect, + ((Lba >> 24) & 0x0F) | + (DeviceUnit->Flags & ATA_DEVICE_CHS ? 0x00 : IDE_USE_LBA) | + (DeviceUnit->DeviceNumber ? IDE_DRIVE_SELECT_2 : IDE_DRIVE_SELECT_1)); + Command = IDE_COMMAND_READ; + } - /* Send read command */ - AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Command, Command); - StallExecutionProcessor(5); + /* Send read command */ + AtaWritePort(DeviceUnit->Channel, IDX_IO1_o_Command, Command); + StallExecutionProcessor(5); - for (RemainingBlockCount = BlockCount; RemainingBlockCount > 0; --RemainingBlockCount) - { - /* Wait for ready to transfer data block */ - if (!WaitForFlags(DeviceUnit->Channel, (IDE_STATUS_BUSY | IDE_STATUS_DRQ | IDE_STATUS_ERROR), - IDE_STATUS_DRQ, ATA_READ_TIMEOUT)) + for (RemainingBlockCount = BlockCount; RemainingBlockCount > 0; --RemainingBlockCount) { - ERR("AtaReadLogicalSectorsLBA() failed. Status: 0x%02x, Error: 0x%02x\n", - AtaReadPort(DeviceUnit->Channel, IDX_IO1_i_Status), - AtaReadPort(DeviceUnit->Channel, IDX_IO1_i_Error)); - return FALSE; - } + /* Wait for ready to transfer data block */ + if (!WaitForFlags(DeviceUnit->Channel, (IDE_STATUS_BUSY | IDE_STATUS_DRQ | IDE_STATUS_ERROR), + IDE_STATUS_DRQ, ATA_READ_TIMEOUT)) + { + ERR("AtaReadLogicalSectorsLBA() failed. Status: 0x%02x, Error: 0x%02x\n", + AtaReadPort(DeviceUnit->Channel, IDX_IO1_i_Status), + AtaReadPort(DeviceUnit->Channel, IDX_IO1_i_Error)); + return FALSE; + } - /* Transfer the data block */ - AtaReadBuffer(DeviceUnit->Channel, Buffer, DeviceUnit->SectorSize); + /* Transfer the data block */ + AtaReadBuffer(DeviceUnit->Channel, Buffer, DeviceUnit->SectorSize); - Buffer = (PVOID)((ULONG_PTR)Buffer + DeviceUnit->SectorSize); - } + Buffer = (PVOID)((ULONG_PTR)Buffer + DeviceUnit->SectorSize); + } - SectorNumber += BlockCount; - SectorCount -= BlockCount; + SectorNumber += BlockCount; + SectorCount -= BlockCount; } return TRUE;
4 years, 10 months
1
0
0
0
[reactos] 01/01: [NFSD][TELNETD][LIBTIRPC][MAN] Don't hardcode C:\ReactOS (#2334)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=214a9cb660b375c4629b1…
commit 214a9cb660b375c4629b1e6816686308f34dd6f5 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Fri Feb 14 02:03:35 2020 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Feb 13 18:03:35 2020 +0100 [NFSD][TELNETD][LIBTIRPC][MAN] Don't hardcode C:\ReactOS (#2334) CORE-14747 --- base/services/nfsd/idmap.c | 4 +++- base/services/nfsd/nfs41_daemon.c | 3 ++- base/services/telnetd/telnetd.c | 2 +- dll/3rdparty/libtirpc/src/wintirpc.c | 9 +++++++++ dll/3rdparty/libtirpc/tirpc/netconfig.h | 5 +++++ modules/rosapps/applications/sysutils/man/man.cmd | 2 +- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/base/services/nfsd/idmap.c b/base/services/nfsd/idmap.c index 18f44b94278..838d4cfc95b 100644 --- a/base/services/nfsd/idmap.c +++ b/base/services/nfsd/idmap.c @@ -381,7 +381,9 @@ static int config_init( } else { - StringCchCopyA(config_path, ARRAYSIZE(config_path), "C:\\ReactOS\\system32\\drivers\\etc\\ms-nfs41-idmap.conf"); + status = GetLastError(); + eprintf("GetSystemDirectoryA failed with %ld\n", GetLastError()); + goto out; } #endif diff --git a/base/services/nfsd/nfs41_daemon.c b/base/services/nfsd/nfs41_daemon.c index 1a8f2dfbbe2..73b54d31d59 100644 --- a/base/services/nfsd/nfs41_daemon.c +++ b/base/services/nfsd/nfs41_daemon.c @@ -177,7 +177,8 @@ static bool_t check_for_files() } else { - StringCchCopyA(config_path, ARRAYSIZE(config_path), "C:\\ReactOS\\system32\\drivers\\etc\\netconfig"); + eprintf("GetSystemDirectoryA failed with error %ld\n", GetLastError()); + return FALSE; } fd = fopen(config_path, "r"); diff --git a/base/services/telnetd/telnetd.c b/base/services/telnetd/telnetd.c index 927d2862ade..180cce5dce4 100644 --- a/base/services/telnetd/telnetd.c +++ b/base/services/telnetd/telnetd.c @@ -377,7 +377,7 @@ static void RunShell(client_t *client) } else { - StringCchCopyA(cmd_path, ARRAYSIZE(cmd_path), "C:\\ReactOS\\system32\\cmd.exe"); + ErrorExit("GetSystemDirectoryA failed\n"); } } diff --git a/dll/3rdparty/libtirpc/src/wintirpc.c b/dll/3rdparty/libtirpc/src/wintirpc.c index 98d327f461e..a7845fa1d55 100644 --- a/dll/3rdparty/libtirpc/src/wintirpc.c +++ b/dll/3rdparty/libtirpc/src/wintirpc.c @@ -93,6 +93,9 @@ BOOL winsock_fini(void) return TRUE; } +#ifdef __REACTOS__ +char NETCONFIG[MAX_PATH] = ""; +#endif BOOL WINAPI DllMain/*tirpc_main*/(HINSTANCE hinstDLL, // DLL module handle DWORD fdwReason, // reason called LPVOID lpvReserved) // reserved @@ -109,6 +112,12 @@ BOOL WINAPI DllMain/*tirpc_main*/(HINSTANCE hinstDLL, // DLL module handle // The DLL is loading due to process // initialization or a call to LoadLibrary. case DLL_PROCESS_ATTACH: +#ifdef __REACTOS__ + if (!GetSystemDirectoryA(NETCONFIG, ARRAYSIZE(NETCONFIG))) + return FALSE; + + lstrcatA(NETCONFIG, "\\drivers\\etc\\netconfig"); +#endif // Initialize socket library if (winsock_init() == FALSE) diff --git a/dll/3rdparty/libtirpc/tirpc/netconfig.h b/dll/3rdparty/libtirpc/tirpc/netconfig.h index 8461a6b0621..21f2820ae29 100644 --- a/dll/3rdparty/libtirpc/tirpc/netconfig.h +++ b/dll/3rdparty/libtirpc/tirpc/netconfig.h @@ -3,8 +3,13 @@ //#include <features.h> +#ifdef __REACTOS__ + #undef NETCONFIG + extern char NETCONFIG[]; +#else // XXX Should be in, or come from, the registry!!! #define NETCONFIG "C:\\ReactOS\\System32\\drivers\\etc\\netconfig" +#endif #define NETPATH "NETPATH" struct netconfig { diff --git a/modules/rosapps/applications/sysutils/man/man.cmd b/modules/rosapps/applications/sysutils/man/man.cmd index 1533a49d32d..5790656e9aa 100755 --- a/modules/rosapps/applications/sysutils/man/man.cmd +++ b/modules/rosapps/applications/sysutils/man/man.cmd @@ -13,7 +13,7 @@ rem []------------------------------------[] rem []==[Config area]==[] set MANED=edit set MANMORE=cat -set MAN=c:\ReactOS\man +set MAN=%WINDIR%\man rem []==[End of config area]==[] goto chk_param
4 years, 10 months
1
0
0
0
[reactos] 01/01: [HALXBOX][BOOTDATA][INF] Give the Xbox HAL its own personality (#2338)
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=35710b51afb22539dd631…
commit 35710b51afb22539dd631fb52c2ff18403ca299c Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Thu Feb 13 16:02:11 2020 +0300 Commit: GitHub <noreply(a)github.com> CommitDate: Thu Feb 13 14:02:11 2020 +0100 [HALXBOX][BOOTDATA][INF] Give the Xbox HAL its own personality (#2338) CORE-16216 --- boot/bootdata/txtsetup.sif | 2 +- hal/halx86/legacy/halpcat.c | 5 +++++ media/inf/hal.inf | 18 +++++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/boot/bootdata/txtsetup.sif b/boot/bootdata/txtsetup.sif index 82247b5a154..02116f3e039 100644 --- a/boot/bootdata/txtsetup.sif +++ b/boot/bootdata/txtsetup.sif @@ -225,7 +225,7 @@ pci_up = "Standard PC Uniprocessor" ;pci_mp = "Standard PC Multiprocessor" acpi_up = "ACPI PC Uniprocessor" ;acpi_mp = "ACPI PC Multiprocessor" -xbox = "Original Xbox" +xbox = "Original Xbox (x86 based)" [Computer.NTamd64] x64_up = "Standard x64 Uniprocessor" diff --git a/hal/halx86/legacy/halpcat.c b/hal/halx86/legacy/halpcat.c index d097ca7c729..c660296d8e8 100644 --- a/hal/halx86/legacy/halpcat.c +++ b/hal/halx86/legacy/halpcat.c @@ -25,8 +25,13 @@ /* This determines the HAL type */ BOOLEAN HalDisableFirmwareMapper = FALSE; +#if defined(SARCH_XBOX) +PWCHAR HalHardwareIdString = L"xbox"; +PWCHAR HalName = L"Xbox HAL"; +#else PWCHAR HalHardwareIdString = L"e_isa_up"; PWCHAR HalName = L"PC Compatible Eisa/Isa HAL"; +#endif /* PRIVATE FUNCTIONS **********************************************************/ diff --git a/media/inf/hal.inf b/media/inf/hal.inf index 3c1ce916042..f631cd14dd5 100644 --- a/media/inf/hal.inf +++ b/media/inf/hal.inf @@ -27,6 +27,7 @@ HKR, , Icon, 0, "-27" [GenericMfg] %acpipic_up.DeviceDesc% = NO_DRV,acpipic_up %e_isa_up.DeviceDesc% = NO_DRV,e_isa_up +%xbox.DeviceDesc% = NO_DRV,xbox ;------------------------------ NO DRIVER ----------------------------- @@ -45,34 +46,44 @@ ComputerClassName = "Computer" GenericMfg = "(Generic computers)" acpipic_up.DeviceDesc = "ACPI Uniprocessor PC" e_isa_up.DeviceDesc = "Standard Uniprocessor PC" +xbox.DeviceDesc = "Original Xbox (x86 based)" [Strings.0405] ComputerClassName = "Počítač" GenericMfg = "(Obecné počítače)" acpipic_up.DeviceDesc = "Jednoprocesorové PC s ACPI rozhraním" e_isa_up.DeviceDesc = "Standardní jednoprocesorové PC" +xbox.DeviceDesc = "Original Xbox (x86 based)" [Strings.0a] ReactOS = "Equipo de ReactOS" + ComputerClassName = "Equipo" GenericMfg = "(Equipos genéricos)" acpipic_up.DeviceDesc = "PC con uniprocesador ACPI" e_isa_up.DeviceDesc = "PC con uniprocesador estándar" +xbox.DeviceDesc = "Original Xbox (x86 based)" [Strings.0415] ReactOS = "Zespół ReactOS" + ComputerClassName = "Komputer" + GenericMfg = "(Komputery standardowe)" acpipic_up.DeviceDesc = "Komputer PC z interfejsem ACPI" e_isa_up.DeviceDesc = "Standardowy komputer PC" +xbox.DeviceDesc = "Original Xbox (x86 based)" [Strings.0418] ReactOS = "Echipa ReactOS" + ComputerClassName = "Calculator" + GenericMfg = "(calculatoare generice)" acpipic_up.DeviceDesc = "PC uniprocesor ACPI" e_isa_up.DeviceDesc = "PC uniprocesor standard" +xbox.DeviceDesc = "Original Xbox (x86 based)" [Strings.0419] ReactOS = "Команда ReactOS" @@ -82,7 +93,7 @@ ComputerClassName = "Компьютер" GenericMfg = "(Универсальный компьютер)" acpipic_up.DeviceDesc = "ACPI однопроцессорный ПК" e_isa_up.DeviceDesc = "Стандартный однопроцессорный ПК" - +xbox.DeviceDesc = "Оригинальный Xbox (на базе x86)" [Strings.041f] ReactOS = "ReactOS Takımı" @@ -92,15 +103,20 @@ ComputerClassName = "Bilgisayar" GenericMfg = "(Umûmî Bilgisayarlar)" acpipic_up.DeviceDesc = "ACPI Tek İşlemcili PC" e_isa_up.DeviceDesc = "Ölçünlü Tek İşlemcili PC" +xbox.DeviceDesc = "Original Xbox (x86 based)" [Strings.0422] ReactOS = "Команда ReactOS" + ComputerClassName = "Комп'ютер" + GenericMfg = "(Стандартний комп'ютер)" acpipic_up.DeviceDesc = "ACPI однопроцесорний ПК" e_isa_up.DeviceDesc = "Стандартний однопроцесорний ПК" +xbox.DeviceDesc = "Original Xbox (x86 based)" [Strings.0804] GenericMfg = "(通用计算机)" acpipic_up.DeviceDesc = "ACPI 单处理器 PC" e_isa_up.DeviceDesc = "标准单处理器 PC" +xbox.DeviceDesc = "Original Xbox (x86 based)"
4 years, 10 months
1
0
0
0
[reactos] 01/01: [SDK][INCLUDE] Improve <comctl32_undoc.h> more
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6e18e86ba36d9a8ce51fe…
commit 6e18e86ba36d9a8ce51fec38357966eedc14c31b Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Feb 13 11:26:40 2020 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Thu Feb 13 11:26:40 2020 +0900 [SDK][INCLUDE] Improve <comctl32_undoc.h> more --- sdk/include/reactos/comctl32_undoc.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sdk/include/reactos/comctl32_undoc.h b/sdk/include/reactos/comctl32_undoc.h index 45a4aef6fbe..1a36f4267f8 100644 --- a/sdk/include/reactos/comctl32_undoc.h +++ b/sdk/include/reactos/comctl32_undoc.h @@ -32,8 +32,11 @@ extern "C" { #endif /* defined(__cplusplus) */ +// MRUINFOA.lpfnCompare for MRU_STRING typedef INT (CALLBACK *MRUCMPPROCA)(LPCSTR, LPCSTR); +// MRUINFOW.lpfnCompare for MRU_STRING typedef INT (CALLBACK *MRUCMPPROCW)(LPCWSTR, LPCWSTR); +// MRUINFO.lpfnCompare for MRU_BINARY typedef INT (CALLBACK *MRUBINARYCMPPROC)(LPCVOID, LPCVOID, DWORD); typedef struct _MRUINFOA @@ -135,7 +138,7 @@ typedef INT (WINAPI *FN_FreeMRUList)(HANDLE); #define I_DelMRUString 156 #define I_FreeMRUList 152 -// #define GET_PROC(hComCtl32, fn) fn = (FN_##fn)GetProcAddress((hComCtl32), I_##fn) +// #define GET_PROC(hComCtl32, fn) fn = (FN_##fn)GetProcAddress((hComCtl32), (LPSTR)I_##fn) #ifdef __cplusplus } /* extern "C" */
4 years, 10 months
1
0
0
0
[reactos] 01/01: [SDK][INCLUDE] comctl32_undoc.h: Fix MRUBINARYCMDPROC
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e33287d5d1a2bcbb1d617…
commit e33287d5d1a2bcbb1d617ada46920f912ba98b0f Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Thu Feb 13 10:06:44 2020 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Thu Feb 13 10:06:44 2020 +0900 [SDK][INCLUDE] comctl32_undoc.h: Fix MRUBINARYCMDPROC --- sdk/include/reactos/comctl32_undoc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/include/reactos/comctl32_undoc.h b/sdk/include/reactos/comctl32_undoc.h index 49d68006ab9..45a4aef6fbe 100644 --- a/sdk/include/reactos/comctl32_undoc.h +++ b/sdk/include/reactos/comctl32_undoc.h @@ -34,7 +34,7 @@ extern "C" { typedef INT (CALLBACK *MRUCMPPROCA)(LPCSTR, LPCSTR); typedef INT (CALLBACK *MRUCMPPROCW)(LPCWSTR, LPCWSTR); -typedef INT (CALLBACK *MRUBINARYCMPPROC)(LPCVOID, LPCVOID); +typedef INT (CALLBACK *MRUBINARYCMPPROC)(LPCVOID, LPCVOID, DWORD); typedef struct _MRUINFOA {
4 years, 10 months
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
24
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
Results per page:
10
25
50
100
200