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
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 2017
----- 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
13 participants
353 discussions
Start a n
N
ew thread
[gadamopoulos] 73806: [WIN32k] -Fix a couple of cases where we use the versioned class atom instead of the non versioned one. [USER32] - Add support for versioned classes in RegisterClassExWOWW, Ge...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Feb 17 11:07:14 2017 New Revision: 73806 URL:
http://svn.reactos.org/svn/reactos?rev=73806&view=rev
Log: [WIN32k] -Fix a couple of cases where we use the versioned class atom instead of the non versioned one. [USER32] - Add support for versioned classes in RegisterClassExWOWW, GetClassInfoExW, GetClassInfoExA, UnregisterClassA, UnregisterClassW, and User32CreateWindowEx - Make ClassNameToVersion return the name of the versioned class and the library name that implements it while preserving a hack that lets user32 know which classes are registered by comctl32 (this is needed because the default activation context doesn't contain the non versioned classes yet). - Make VersionRegisterClass to load the specified library and make it register its classes which is used when the class is not registered yet but its manifest is active. Modified: trunk/reactos/win32ss/user/ntuser/class.c trunk/reactos/win32ss/user/ntuser/window.c trunk/reactos/win32ss/user/user32/windows/class.c trunk/reactos/win32ss/user/user32/windows/window.c Modified: trunk/reactos/win32ss/user/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/class.…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/class.c [iso-8859-1] Fri Feb 17 11:07:14 2017 @@ -2743,6 +2743,7 @@ NULL); if (ClassAtom != (RTL_ATOM)0) { + ClassAtom = Class->atomNVClassName; Ret = UserGetClassInfo(Class, &Safewcexw, bAnsi, hInstance); } else Modified: trunk/reactos/win32ss/user/ntuser/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window…
============================================================================== --- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Fri Feb 17 11:07:14 2017 @@ -2807,7 +2807,7 @@ /* Do not send WM_GETTEXT messages in the kernel mode version! The user mode version however calls GetWindowText() which will send WM_GETTEXT messages to windows belonging to its processes */ - if (!ClassAtom || Child->pcls->atomClassName == ClassAtom) + if (!ClassAtom || Child->pcls->atomNVClassName == ClassAtom) { // FIXME: LARGE_STRING truncated CurrentWindowName.Buffer = Child->strName.Buffer; @@ -2999,7 +2999,7 @@ (TopLevelWindow->strName.Length < 0xFFFF && !RtlCompareUnicodeString(&WindowName, &ustr, TRUE)); ClassMatches = (ClassAtom == (RTL_ATOM)0) || - ClassAtom == TopLevelWindow->pcls->atomClassName; + ClassAtom == TopLevelWindow->pcls->atomNVClassName; if (WindowMatches && ClassMatches) { Modified: trunk/reactos/win32ss/user/user32/windows/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
============================================================================== --- trunk/reactos/win32ss/user/user32/windows/class.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/class.c [iso-8859-1] Fri Feb 17 11:07:14 2017 @@ -13,177 +13,38 @@ #include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(user32); +#define USE_VERSIONED_CLASSES + /* From rtl/actctx.c and must match! */ -struct entity -{ - DWORD kind; // Activation context type - WCHAR *name; // Class name - WCHAR *clsid; // Not supported yet but needed for menu name. +struct strsection_header +{ + DWORD magic; + ULONG size; + DWORD unk1[3]; + ULONG count; + ULONG index_offset; + DWORD unk2[2]; + ULONG global_offset; + ULONG global_len; }; -struct dll_redirect -{ - WCHAR *name; // Dll name - WCHAR *hash; - DWORD Data; // Junk +struct wndclass_redirect_data +{ + ULONG size; + DWORD res; + ULONG name_len; + ULONG name_offset; /* versioned name offset */ + ULONG module_len; + ULONG module_offset;/* container name offset */ }; -LPCWSTR -FASTCALL -ClassNameToVersion( - LPCTSTR lpszClass, - LPCWSTR lpszMenuName, - LPCWSTR *plpLibFileName, - HANDLE *pContext, - BOOL bAnsi) -{ - NTSTATUS Status; - UNICODE_STRING SectionName; - WCHAR SeactionNameBuf[MAX_PATH] = {0}; - ACTCTX_SECTION_KEYED_DATA KeyedData = { sizeof(KeyedData) }; - - if (IS_ATOM(lpszClass)) - { - SectionName.Buffer = (LPWSTR)&SeactionNameBuf; - SectionName.MaximumLength = sizeof(SeactionNameBuf); - if(!NtUserGetAtomName(LOWORD((DWORD_PTR)lpszClass), &SectionName)) - { - return NULL; - } - } - else - { - if (bAnsi) - { - RtlCreateUnicodeStringFromAsciiz(&SectionName, (LPSTR)lpszClass); - } - else - { - RtlInitUnicodeString(&SectionName, lpszClass); - } - } - Status = RtlFindActivationContextSectionString( FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, - NULL, - ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, - &SectionName, - &KeyedData ); - - if (NT_SUCCESS(Status) && KeyedData.ulDataFormatVersion == 1) - { - struct dll_redirect *dll = KeyedData.lpSectionBase; - - if (plpLibFileName) *plpLibFileName = dll->name; - - if (lpszMenuName) - { - WCHAR * mnubuf; - LPWSTR mnuNameW; - LPSTR mnuNameA; - int len = 0; - struct entity *entity = KeyedData.lpData; - - FIXME("actctx: Needs to support menu name from redirected class!"); - - if (entity->clsid) - { - mnubuf = entity->clsid; - if (bAnsi) - { - mnuNameA = (LPSTR)lpszMenuName; - RtlUnicodeToMultiByteN( mnuNameA, 255, (PULONG)&len, mnubuf, strlenW(mnubuf) * sizeof(WCHAR) ); - mnuNameA[len] = 0; - } - else - { - mnuNameW = (LPWSTR)lpszMenuName; - len = strlenW(mnubuf) * sizeof(WCHAR); - RtlCopyMemory((void *)mnuNameW, mnubuf, len); - mnuNameW[len] = 0; - } - } - } - if (pContext) *pContext = KeyedData.hActCtx; - } - - if (!IS_ATOM(lpszClass) && bAnsi) - RtlFreeUnicodeString(&SectionName); - if (KeyedData.hActCtx) - RtlReleaseActivationContext(KeyedData.hActCtx); - - return lpszClass; -} - // -// Ref:
http://yvs-it.blogspot.com/2010/04/initcommoncontrolsex.html
-// -BOOL -FASTCALL -Real_VersionRegisterClass( - PCWSTR pszClass, - LPCWSTR lpLibFileName, - HANDLE Contex, - HMODULE * phLibModule) -{ - BOOL Ret; - HMODULE hLibModule; - PREGISTERCLASSNAMEW pRegisterClassNameW; - UNICODE_STRING ClassName; - WCHAR ClassNameBuf[MAX_PATH] = {0}; - RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame = { sizeof(Frame), 1 }; - - RtlActivateActivationContextUnsafeFast(&Frame, Contex); - - Ret = FALSE; - hLibModule = NULL; - - _SEH2_TRY - { - hLibModule = LoadLibraryW(lpLibFileName); - if ( hLibModule ) - { - if ((pRegisterClassNameW = (void*) GetProcAddress(hLibModule, "RegisterClassNameW"))) - { - if (IS_ATOM(pszClass)) - { - ClassName.Buffer = (LPWSTR)&ClassNameBuf; - ClassName.MaximumLength = sizeof(ClassNameBuf); - if (!NtUserGetAtomName(LOWORD((DWORD_PTR)pszClass), &ClassName)) - { - _SEH2_YIELD(goto Error_Exit); - } - pszClass = (PCWSTR)&ClassNameBuf; - } - Ret = pRegisterClassNameW(pszClass); - } - } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - } - _SEH2_END - -Error_Exit: - if ( Ret || !hLibModule ) - { - if ( phLibModule ) *phLibModule = hLibModule; - } - else - { - DWORD save_error = GetLastError(); - FreeLibrary(hLibModule); - SetLastError(save_error); - } - - return Ret; -} - -// -// Use wine hack to process extened context classes. +// Use wine hack to process extended context classes. // /*********************************************************************** * is_comctl32_class */ -static BOOL is_comctl32_class( const WCHAR *name ) +LPCWSTR is_comctl32_class( const WCHAR *name ) { static const WCHAR classesW[][20] = { @@ -213,13 +74,121 @@ while (min <= max) { int res, pos = (min + max) / 2; - if (!(res = strcmpiW( name, classesW[pos] ))) return TRUE; + if (!(res = strcmpiW( name, classesW[pos] ))) return classesW[pos]; if (res < 0) max = pos - 1; else min = pos + 1; } - return FALSE; -} - + return NULL; +} + +LPCWSTR +FASTCALL +ClassNameToVersion( + const void* lpszClass, + LPCWSTR lpszMenuName, + LPCWSTR *plpLibFileName, + HANDLE *pContext, + BOOL bAnsi) +{ + LPCWSTR VersionedClass = NULL; + NTSTATUS Status; + UNICODE_STRING SectionName; + WCHAR SectionNameBuf[MAX_PATH] = {0}; + ACTCTX_SECTION_KEYED_DATA KeyedData = { sizeof(KeyedData) }; + + if(!lpszClass) + { + ERR("Null class given !\n"); + return NULL; + } + + if (IS_ATOM(lpszClass)) + { + RtlInitEmptyUnicodeString(&SectionName, SectionNameBuf, sizeof(SectionNameBuf)); + if(!NtUserGetAtomName(LOWORD((DWORD_PTR)lpszClass), &SectionName)) + { + ERR("Couldn't get atom name for atom %x !\n", LOWORD((DWORD_PTR)lpszClass)); + return NULL; + } + SectionName.Length = wcslen(SectionNameBuf) * sizeof(WCHAR); + TRACE("ClassNameToVersion got name %wZ from atom\n", &SectionName); + } + else + { + if (bAnsi) + { + ANSI_STRING AnsiString; + RtlInitAnsiString(&AnsiString, lpszClass); + RtlInitEmptyUnicodeString(&SectionName, SectionNameBuf, sizeof(SectionNameBuf)); + RtlAnsiStringToUnicodeString(&SectionName, &AnsiString, FALSE); + } + else + { + RtlInitUnicodeString(&SectionName, lpszClass); + } + } + Status = RtlFindActivationContextSectionString( FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, + NULL, + ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, + &SectionName, + &KeyedData ); + +#ifdef USE_VERSIONED_CLASSES + if (NT_SUCCESS(Status) && KeyedData.ulDataFormatVersion == 1) + { + struct strsection_header *SectionHeader = KeyedData.lpSectionBase; + + /* Find activation context */ + if(SectionHeader && SectionHeader->count > 0) + { + struct wndclass_redirect_data *WindowRedirectionData = KeyedData.lpData; + if(WindowRedirectionData && WindowRedirectionData->module_len) + { + LPCWSTR lpLibFileName; + + VersionedClass = (WCHAR*)((BYTE*)WindowRedirectionData + WindowRedirectionData->name_offset); + lpLibFileName = (WCHAR*)((BYTE*)KeyedData.lpSectionBase + WindowRedirectionData->module_offset); + TRACE("Returning VersionedClass=%S, plpLibFileName=%S for class %S\n", VersionedClass, lpLibFileName, SectionName.Buffer); + + if (pContext) *pContext = KeyedData.hActCtx; + if (plpLibFileName) *plpLibFileName = lpLibFileName; + + } + } + } + + if (KeyedData.hActCtx) + RtlReleaseActivationContext(KeyedData.hActCtx); +#endif + +#ifndef DEFAULT_ACTIVATION_CONTEXTS_SUPPORTED + /* This block is a hack! */ + if (!VersionedClass) + { + /* + * In windows the default activation context always contains comctl32v5 + * In reactos we don't have a default activation context so we + * mimic wine here. + */ + VersionedClass = is_comctl32_class(SectionName.Buffer); + if (VersionedClass) + { + if (pContext) *pContext = 0; + if (plpLibFileName) *plpLibFileName = L"comctl32"; + } + } +#endif + + /* + * The returned strings are pointers in the activation context and + * will get freed when the activation context gets freed + */ + return VersionedClass; +} + +// +// Ref:
http://yvs-it.blogspot.com/2010/04/initcommoncontrolsex.html
+// BOOL FASTCALL VersionRegisterClass( @@ -228,64 +197,61 @@ HANDLE Contex, HMODULE * phLibModule) { - // Should be lpLibFileName..... - static const WCHAR comctl32W[] = {'c','o','m','c','t','l','3','2','.','d','l','l',0}; - // + BOOL Ret = FALSE; + HMODULE hLibModule = NULL; PREGISTERCLASSNAMEW pRegisterClassNameW; UNICODE_STRING ClassName; WCHAR ClassNameBuf[MAX_PATH] = {0}; - BOOL Ret = FALSE; - HMODULE hLibModule = NULL; - - if (!IS_ATOM(pszClass) && is_comctl32_class( pszClass )) - { - _SEH2_TRY - { - hLibModule = LoadLibraryW(comctl32W); - if ( hLibModule ) + RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame = { sizeof(Frame), 1 }; + + RtlActivateActivationContextUnsafeFast(&Frame, Contex); + + _SEH2_TRY + { + hLibModule = LoadLibraryW(lpLibFileName); + if ( hLibModule ) + { + if ((pRegisterClassNameW = (void*) GetProcAddress(hLibModule, "RegisterClassNameW"))) { - if ((pRegisterClassNameW = (void*) GetProcAddress(hLibModule, "RegisterClassNameW"))) + if (IS_ATOM(pszClass)) { - if (IS_ATOM(pszClass)) + ClassName.Buffer = ClassNameBuf; + ClassName.MaximumLength = sizeof(ClassNameBuf); + if (!NtUserGetAtomName(LOWORD((DWORD_PTR)pszClass), &ClassName)) { - ClassName.Buffer = (LPWSTR)&ClassNameBuf; - ClassName.MaximumLength = sizeof(ClassNameBuf); - if (!NtUserGetAtomName(LOWORD((DWORD_PTR)pszClass), &ClassName)) - { - ERR("Error while verifying ATOM\n"); - _SEH2_YIELD(goto Error_Exit); - } - pszClass = (PCWSTR)&ClassNameBuf; + ERR("Error while verifying ATOM\n"); + _SEH2_YIELD(goto Error_Exit); } - Ret = pRegisterClassNameW(pszClass); + pszClass = ClassName.Buffer; } + Ret = pRegisterClassNameW(pszClass); } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - } - _SEH2_END + else + { + WARN("No RegisterClassNameW PROC\n"); + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + } + _SEH2_END Error_Exit: - if ( Ret || !hLibModule ) - { - if ( phLibModule ) *phLibModule = hLibModule; - } - else - { - DWORD save_error = GetLastError(); - FreeLibrary(hLibModule); - SetLastError(save_error); - } - TRACE( "%s retrying after loading comctl32\n", debugstr_w(pszClass) ); - return Ret; - } - TRACE("NO ComCtl32 Class %S!\n",pszClass); - return FALSE; -} -// -// -// + if ( Ret || !hLibModule ) + { + if ( phLibModule ) *phLibModule = hLibModule; + } + else + { + DWORD save_error = GetLastError(); + FreeLibrary(hLibModule); + SetLastError(save_error); + } + + RtlDeactivateActivationContextUnsafeFast(&Frame); + return Ret; +} /* * @implemented @@ -301,7 +267,10 @@ LPCSTR pszMenuName; HMODULE hLibModule = NULL; DWORD save_error; - BOOL Ret, ClassFound = FALSE; + BOOL Ret, ClassFound = FALSE, ConvertedString = FALSE; + LPCWSTR lpszClsVersion; + HANDLE pCtx = NULL; + LPCWSTR lpLibFileName = NULL; TRACE("%p class/atom: %s/%04x %p\n", hInstance, IS_ATOM(lpszClass) ? NULL : lpszClass, @@ -325,14 +294,19 @@ return FALSE; } - if (IS_ATOM(lpszClass)) + lpszClsVersion = ClassNameToVersion(lpszClass, NULL, &lpLibFileName, &pCtx, TRUE); + if (lpszClsVersion) + { + RtlInitUnicodeString(&ClassName, lpszClsVersion); + } + else if (IS_ATOM(lpszClass)) { ClassName.Buffer = (PWSTR)((ULONG_PTR)lpszClass); } else { - if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, - lpszClass)) + ConvertedString = TRUE; + if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, lpszClass)) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; @@ -353,13 +327,14 @@ (LPWSTR *)&pszMenuName, TRUE); if (Ret) break; + if (!lpLibFileName) break; if (!ClassFound) { save_error = GetLastError(); if ( save_error == ERROR_CANNOT_FIND_WND_CLASS || save_error == ERROR_CLASS_DOES_NOT_EXIST ) { - ClassFound = VersionRegisterClass(ClassName.Buffer, NULL, NULL, &hLibModule); + ClassFound = VersionRegisterClass(ClassName.Buffer, lpLibFileName, pCtx, &hLibModule); if (ClassFound) continue; } } @@ -379,7 +354,7 @@ // lpwcx->lpszMenuName = pszMenuName; } - if (!IS_ATOM(lpszClass)) + if (ConvertedString) { RtlFreeUnicodeString(&ClassName); } @@ -403,6 +378,9 @@ HMODULE hLibModule = NULL; DWORD save_error; BOOL Ret, ClassFound = FALSE; + LPCWSTR lpszClsVersion; + HANDLE pCtx = NULL; + LPCWSTR lpLibFileName = NULL; TRACE("%p class/atom: %S/%04x %p\n", hInstance, IS_ATOM(lpszClass) ? NULL : lpszClass, @@ -429,14 +407,18 @@ return FALSE; } - if (IS_ATOM(lpszClass)) + lpszClsVersion = ClassNameToVersion(lpszClass, NULL, &lpLibFileName, &pCtx, FALSE); + if (lpszClsVersion) + { + RtlInitUnicodeString(&ClassName, lpszClsVersion); + } + else if (IS_ATOM(lpszClass)) { ClassName.Buffer = (PWSTR)((ULONG_PTR)lpszClass); } else { - RtlInitUnicodeString(&ClassName, - lpszClass); + RtlInitUnicodeString(&ClassName, lpszClass); } if (!RegisterDefaultClasses) @@ -453,13 +435,14 @@ &pszMenuName, FALSE); if (Ret) break; + if (!lpLibFileName) break; if (!ClassFound) { save_error = GetLastError(); if ( save_error == ERROR_CANNOT_FIND_WND_CLASS || save_error == ERROR_CLASS_DOES_NOT_EXIST ) { - ClassFound = VersionRegisterClass(ClassName.Buffer, NULL, NULL, &hLibModule); + ClassFound = VersionRegisterClass(ClassName.Buffer, lpLibFileName, pCtx, &hLibModule); if (ClassFound) continue; } } @@ -1419,12 +1402,11 @@ ATOM Atom; WNDCLASSEXW WndClass; UNICODE_STRING ClassName; + UNICODE_STRING ClassVersion; UNICODE_STRING MenuName = {0}; CLSMENUNAME clsMenuName; ANSI_STRING AnsiMenuName; - HMODULE hLibModule = NULL; - DWORD save_error; - BOOL ClassFound = FALSE; + LPCWSTR lpszClsVersion; if (lpwcx == NULL || lpwcx->cbSize != sizeof(WNDCLASSEXW) || lpwcx->cbClsExtra < 0 || lpwcx->cbWndExtra < 0 || @@ -1495,40 +1477,27 @@ RtlInitUnicodeString(&ClassName, WndClass.lpszClassName); } + ClassVersion = ClassName; + if (fnID == 0) + { + lpszClsVersion = ClassNameToVersion(lpwcx->lpszClassName, NULL, NULL, NULL, FALSE); + if (lpszClsVersion) + { + RtlInitUnicodeString(&ClassVersion, lpszClsVersion); + } + } + clsMenuName.pszClientAnsiMenuName = AnsiMenuName.Buffer; clsMenuName.pwszClientUnicodeMenuName = MenuName.Buffer; clsMenuName.pusMenuName = &MenuName; - for(;;) - { - Atom = NtUserRegisterClassExWOW( &WndClass, - &ClassName, - &ClassName, //PUNICODE_STRING ClsNVersion, - &clsMenuName, - fnID, - dwFlags, - pdwWowData); - - if (Atom) break; - if (!ClassFound) - { - save_error = GetLastError(); - if ( save_error == ERROR_CANNOT_FIND_WND_CLASS || - save_error == ERROR_CLASS_DOES_NOT_EXIST ) - { - ClassFound = VersionRegisterClass(ClassName.Buffer, NULL, NULL, &hLibModule); - if (ClassFound) continue; - } - } - if (hLibModule) - { - save_error = GetLastError(); - FreeLibrary(hLibModule); - SetLastError(save_error); - hLibModule = 0; - } - break; - } + Atom = NtUserRegisterClassExWOW( &WndClass, + &ClassName, + &ClassVersion, + &clsMenuName, + fnID, + dwFlags, + pdwWowData); TRACE("atom=%04x wndproc=%p hinst=%p bg=%p style=%08x clsExt=%d winExt=%d class=%p\n", Atom, lpwcx->lpfnWndProc, lpwcx->hInstance, lpwcx->hbrBackground, @@ -1886,16 +1855,23 @@ { UNICODE_STRING ClassName = {0}; BOOL Ret; + LPCWSTR lpszClsVersion; + BOOL ConvertedString = FALSE; TRACE("class/atom: %s/%04x %p\n", IS_ATOM(lpClassName) ? NULL : lpClassName, IS_ATOM(lpClassName) ? lpClassName : 0, hInstance); - if (!IS_ATOM(lpClassName)) - { - if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, - lpClassName)) + lpszClsVersion = ClassNameToVersion(lpClassName, NULL, NULL, NULL, TRUE); + if (lpszClsVersion) + { + RtlInitUnicodeString(&ClassName, lpszClsVersion); + } + else if (!IS_ATOM(lpClassName)) + { + ConvertedString = TRUE; + if (!RtlCreateUnicodeStringFromAsciiz(&ClassName, lpClassName)) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); return 0; @@ -1904,11 +1880,9 @@ else ClassName.Buffer = (PWSTR)((ULONG_PTR)lpClassName); - Ret = NtUserUnregisterClass(&ClassName, - hInstance, - 0); - - if (!IS_ATOM(lpClassName)) + Ret = NtUserUnregisterClass(&ClassName, hInstance, 0); + + if (ConvertedString) RtlFreeUnicodeString(&ClassName); return Ret; @@ -1925,23 +1899,28 @@ HINSTANCE hInstance) { UNICODE_STRING ClassName = {0}; + LPCWSTR lpszClsVersion; TRACE("class/atom: %S/%04x %p\n", IS_ATOM(lpClassName) ? NULL : lpClassName, IS_ATOM(lpClassName) ? lpClassName : 0, hInstance); - if (!IS_ATOM(lpClassName)) - { - RtlInitUnicodeString(&ClassName, - lpClassName); + lpszClsVersion = ClassNameToVersion(lpClassName, NULL, NULL, NULL, FALSE); + if (lpszClsVersion) + { + RtlInitUnicodeString(&ClassName, lpszClsVersion); + } + else if (!IS_ATOM(lpClassName)) + { + RtlInitUnicodeString(&ClassName, lpClassName); } else + { ClassName.Buffer = (PWSTR)((ULONG_PTR)lpClassName); - - return NtUserUnregisterClass(&ClassName, - hInstance, - 0); + } + + return NtUserUnregisterClass(&ClassName, hInstance, 0); } /* EOF */ Modified: trunk/reactos/win32ss/user/user32/windows/window.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
============================================================================== --- trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/window.c [iso-8859-1] Fri Feb 17 11:07:14 2017 @@ -16,6 +16,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(user32); void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id ); +extern LPCWSTR FASTCALL ClassNameToVersion(const void *lpszClass, LPCWSTR lpszMenuName, LPCWSTR *plpLibFileName, HANDLE *pContext, BOOL bAnsi); /* FUNCTIONS *****************************************************************/ @@ -165,13 +166,18 @@ { LARGE_STRING WindowName; LARGE_STRING lstrClassName, *plstrClassName; + LARGE_STRING lstrClassVersion, *plstrClassVersion; UNICODE_STRING ClassName; + UNICODE_STRING ClassVersion; WNDCLASSEXA wceA; WNDCLASSEXW wceW; HMODULE hLibModule = NULL; DWORD save_error; BOOL Unicode, ClassFound = FALSE; HWND Handle = NULL; + LPCWSTR lpszClsVersion; + HANDLE pCtx; + LPCWSTR lpLibFileName; #if 0 DbgPrint("[window] User32CreateWindowEx style %d, exstyle %d, parent %d\n", dwStyle, dwExStyle, hWndParent); @@ -263,11 +269,25 @@ if (!Unicode) dwExStyle |= WS_EX_SETANSICREATOR; + lpszClsVersion = ClassNameToVersion(lpClassName, NULL, &lpLibFileName, &pCtx, !Unicode); + if (!lpszClsVersion) + { + plstrClassVersion = plstrClassName; + } + else + { + RtlInitUnicodeString(&ClassVersion, lpszClsVersion); + lstrClassVersion.Buffer = ClassVersion.Buffer; + lstrClassVersion.Length = ClassVersion.Length; + lstrClassVersion.MaximumLength = ClassVersion.MaximumLength; + plstrClassVersion = &lstrClassVersion; + } + for(;;) { Handle = NtUserCreateWindowEx(dwExStyle, plstrClassName, - plstrClassName, + plstrClassVersion, &WindowName, dwStyle, x, @@ -281,12 +301,13 @@ dwFlags, NULL); if (Handle) break; + if (!lpLibFileName) break; if (!ClassFound) { save_error = GetLastError(); if ( save_error == ERROR_CANNOT_FIND_WND_CLASS ) { - ClassFound = VersionRegisterClass(ClassName.Buffer, NULL, NULL, &hLibModule); + ClassFound = VersionRegisterClass(ClassName.Buffer, lpLibFileName, pCtx, &hLibModule); if (ClassFound) continue; } }
7 years, 8 months
1
0
0
0
[tfaber] 73805: [LIBJPEG] - Update to version 9b CORE-12775
by tfaber@svn.reactos.org
Author: tfaber Date: Fri Feb 17 11:05:50 2017 New Revision: 73805 URL:
http://svn.reactos.org/svn/reactos?rev=73805&view=rev
Log: [LIBJPEG] - Update to version 9b CORE-12775 Modified: trunk/reactos/dll/3rdparty/libjpeg/README trunk/reactos/dll/3rdparty/libjpeg/change.log trunk/reactos/dll/3rdparty/libjpeg/djpeg.c trunk/reactos/dll/3rdparty/libjpeg/jdarith.c trunk/reactos/dll/3rdparty/libjpeg/jdatasrc.c trunk/reactos/dll/3rdparty/libjpeg/jdcolor.c trunk/reactos/dll/3rdparty/libjpeg/jdmaster.c trunk/reactos/dll/3rdparty/libjpeg/jdmerge.c trunk/reactos/dll/3rdparty/libjpeg/jdsample.c trunk/reactos/dll/3rdparty/libjpeg/jerror.c trunk/reactos/dll/3rdparty/libjpeg/jfdctflt.c trunk/reactos/dll/3rdparty/libjpeg/jfdctfst.c trunk/reactos/dll/3rdparty/libjpeg/jfdctint.c trunk/reactos/dll/3rdparty/libjpeg/jidctflt.c trunk/reactos/dll/3rdparty/libjpeg/jidctfst.c trunk/reactos/dll/3rdparty/libjpeg/jidctint.c trunk/reactos/dll/3rdparty/libjpeg/rdswitch.c trunk/reactos/dll/3rdparty/libjpeg/wrgif.c trunk/reactos/dll/3rdparty/libjpeg/wrjpgcom.c trunk/reactos/dll/3rdparty/libjpeg/wrtarga.c trunk/reactos/sdk/include/reactos/libs/libjpeg/jconfig.h trunk/reactos/sdk/include/reactos/libs/libjpeg/jdct.h trunk/reactos/sdk/include/reactos/libs/libjpeg/jpeglib.h trunk/reactos/sdk/include/reactos/libs/libjpeg/jversion.h Modified: trunk/reactos/dll/3rdparty/libjpeg/README URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/READM…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/README [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/README [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -1,7 +1,7 @@ The Independent JPEG Group's JPEG software ========================================== -README for release 9a of 19-Jan-2014 +README for release 9b of 17-Jan-2016 ==================================== This distribution contains the ninth public release of the Independent JPEG @@ -60,7 +60,7 @@ This package contains C software to implement JPEG image encoding, decoding, and transcoding. JPEG (pronounced "jay-peg") is a standardized compression -method for full-color and gray-scale images. +method for full-color and grayscale images. This software implements JPEG baseline, extended-sequential, and progressive compression processes. Provision is made for supporting all variants of these @@ -115,7 +115,7 @@ fitness for a particular purpose. This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy. -This software is copyright (C) 1991-2014, Thomas G. Lane, Guido Vollbeding. +This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding. All Rights Reserved except as specified below. Permission is hereby granted to use, copy, modify, and distribute this @@ -159,11 +159,6 @@ algorithm; the resulting GIF files are larger than usual, but are readable by all standard GIF decoders. -We are required to state that - "The Graphics Interchange Format(c) is the Copyright property of - CompuServe Incorporated. GIF(sm) is a Service Mark property of - CompuServe Incorporated." - REFERENCES ========== @@ -176,8 +171,8 @@ Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. (Adjacent articles in that issue discuss MPEG motion picture compression, applications of JPEG, and related topics.) If you don't have the CACM issue -handy, a PostScript file containing a revised version of Wallace's article is -available at
http://www.ijg.org/files/wallace.ps.gz
. The file (actually +handy, a PDF file containing a revised version of Wallace's article is +available at
http://www.ijg.org/files/Wallace.JPEG.pdf
. The file (actually a preprint for an article that appeared in IEEE Trans. Consumer Electronics) omits the sample images that appeared in CACM, but it includes corrections and some added material. Note: the Wallace article is copyright ACM and IEEE, @@ -225,14 +220,13 @@ France. The JPEG standard does not specify all details of an interchangeable file -format. For the omitted details we follow the "JFIF" conventions, revision -1.02. JFIF 1.02 has been adopted as an Ecma International Technical Report -and thus received a formal publication status. It is available as a free -download in PDF format from -http://www.ecma-international.org/publications/techreports/E-TR-098.htm. -A PostScript version of the JFIF document is available at -http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at -http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures. +format. For the omitted details we follow the "JFIF" conventions, version 2. +JFIF version 1 has been adopted as Recommendation ITU-T T.871 (05/2011) : +Information technology - Digital compression and coding of continuous-tone +still images: JPEG File Interchange Format (JFIF). It is available as a +free download in PDF file format from
http://www.itu.int/rec/T-REC-T.871
. +A PDF file of the older JFIF document is available at +http://www.w3.org/Graphics/JPEG/jfif3.pdf. The TIFF 6.0 file format specification can be obtained by FTP from
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz
. The JPEG incorporation scheme @@ -252,8 +246,8 @@ The "official" archive site for this software is
www.ijg.org
. The most recent released version can always be found there in directory "files". This particular version will be archived as -http://www.ijg.org/files/jpegsrc.v9a.tar.gz, and in Windows-compatible -"zip" archive format as
http://www.ijg.org/files/jpegsr9a.zip
. +http://www.ijg.org/files/jpegsrc.v9b.tar.gz, and in Windows-compatible +"zip" archive format as
http://www.ijg.org/files/jpegsr9b.zip
. The JPEG FAQ (Frequently Asked Questions) article is a source of some general information about JPEG. Modified: trunk/reactos/dll/3rdparty/libjpeg/change.log URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/chang…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/change.log [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/change.log [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -1,4 +1,27 @@ CHANGE LOG for Independent JPEG Group's JPEG software + + +Version 9b 17-Jan-2016 +----------------------- + +Improvements and optimizations in DCT and color calculations. +Normalize range limit array composition and access pattern. +Thank to Sia Furler and Maddie Ziegler for inspiration. + +Use merged upsample with scaled DCT sizes larger than 8. +Thank to Taylor Hatala for inspiration. + +Check for excessive comment lengths in argument parsing in wrjpgcom.c. +Thank to Julian Cohen for hint. + +Add makefile.b32 for use with Borland C++ 32-bit (bcc32). +Thank to Joe Slater for contribution. + +Document 'f' specifier for jpegtran -crop specification. +Thank to Michele Martone for suggestion. + +Use defined value from header instead of hardwired number in rdswitch.c. +Thank to Robert Sprowson for hint. Version 9a 19-Jan-2014 Modified: trunk/reactos/dll/3rdparty/libjpeg/djpeg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/djpeg…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/djpeg.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/djpeg.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * djpeg.c * * Copyright (C) 1991-1997, Thomas G. Lane. - * Modified 2009-2013 by Guido Vollbeding. + * Modified 2009-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -102,6 +102,7 @@ fprintf(stderr, " -colors N Reduce image to no more than N colors\n"); fprintf(stderr, " -fast Fast, low-quality processing\n"); fprintf(stderr, " -grayscale Force grayscale output\n"); + fprintf(stderr, " -rgb Force RGB output\n"); #ifdef IDCT_SCALING_SUPPORTED fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n"); #endif @@ -263,6 +264,10 @@ } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { /* Force monochrome output. */ cinfo->out_color_space = JCS_GRAYSCALE; + + } else if (keymatch(arg, "rgb", 3)) { + /* Force RGB output. */ + cinfo->out_color_space = JCS_RGB; } else if (keymatch(arg, "map", 3)) { /* Quantize to a color map taken from an input file. */ Modified: trunk/reactos/dll/3rdparty/libjpeg/jdarith.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jdari…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jdarith.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jdarith.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -1,7 +1,7 @@ /* * jdarith.c * - * Developed 1997-2013 by Guido Vollbeding. + * Developed 1997-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -94,7 +94,7 @@ * (instead of fixed) with the bit shift counter CT. * Thus, we also need only one (variable instead of * fixed size) shift for the LPS/MPS decision, and - * we can get away with any renormalization update + * we can do away with any renormalization update * of C (except for new data insertion, of course). * * I've also introduced a new scheme for accessing Modified: trunk/reactos/dll/3rdparty/libjpeg/jdatasrc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jdata…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jdatasrc.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jdatasrc.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jdatasrc.c * * Copyright (C) 1994-1996, Thomas G. Lane. - * Modified 2009-2011 by Guido Vollbeding. + * Modified 2009-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -247,7 +247,7 @@ GLOBAL(void) jpeg_mem_src (j_decompress_ptr cinfo, - unsigned char * inbuffer, unsigned long insize) + const unsigned char * inbuffer, unsigned long insize) { struct jpeg_source_mgr * src; @@ -271,5 +271,5 @@ src->resync_to_restart = jpeg_resync_to_restart; /* use default method */ src->term_source = term_source; src->bytes_in_buffer = (size_t) insize; - src->next_input_byte = (JOCTET *) inbuffer; -} + src->next_input_byte = (const JOCTET *) inbuffer; +} Modified: trunk/reactos/dll/3rdparty/libjpeg/jdcolor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jdcol…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jdcolor.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jdcolor.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jdcolor.c * * Copyright (C) 1991-1997, Thomas G. Lane. - * Modified 2011-2013 by Guido Vollbeding. + * Modified 2011-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -24,9 +24,6 @@ int * Cb_b_tab; /* => table for Cb to B conversion */ INT32 * Cr_g_tab; /* => table for Cr to G conversion */ INT32 * Cb_g_tab; /* => table for Cb to G conversion */ - - JSAMPLE * range_limit; /* pointer to normal sample range limit table, */ - /* or extended sample range limit table for BG_YCC */ /* Private state for RGB->Y conversion */ INT32 * rgb_y_tab; /* => table for RGB to Y conversion */ @@ -133,8 +130,6 @@ cconvert->Cb_g_tab = (INT32 *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32)); - - cconvert->range_limit = cinfo->sample_range_limit; for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ @@ -176,10 +171,6 @@ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32)); - cconvert->range_limit = (JSAMPLE *) - (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - 5 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); - for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ @@ -195,20 +186,6 @@ /* We also add in ONE_HALF so that need not do it in inner loop */ cconvert->Cb_g_tab[i] = (- FIX(0.688272572)) * x + ONE_HALF; } - - /* Cb and Cr portions can extend to double range in wide gamut case, - * so we prepare an appropriate extended range limit table. - */ - - /* First segment of range limit table: limit[x] = 0 for x < 0 */ - MEMZERO(cconvert->range_limit, 2 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); - cconvert->range_limit += 2 * (MAXJSAMPLE+1); - /* Main part of range limit table: limit[x] = x */ - for (i = 0; i <= MAXJSAMPLE; i++) - cconvert->range_limit[i] = (JSAMPLE) i; - /* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */ - for (; i < 3 * (MAXJSAMPLE+1); i++) - cconvert->range_limit[i] = MAXJSAMPLE; } @@ -235,7 +212,7 @@ register JDIMENSION col; JDIMENSION num_cols = cinfo->output_width; /* copy these pointers into registers if possible */ - register JSAMPLE * range_limit = cconvert->range_limit; + register JSAMPLE * range_limit = cinfo->sample_range_limit; register int * Crrtab = cconvert->Cr_r_tab; register int * Cbbtab = cconvert->Cb_b_tab; register INT32 * Crgtab = cconvert->Cr_g_tab; Modified: trunk/reactos/dll/3rdparty/libjpeg/jdmaster.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jdmas…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jdmaster.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jdmaster.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jdmaster.c * * Copyright (C) 1991-1997, Thomas G. Lane. - * Modified 2002-2013 by Guido Vollbeding. + * Modified 2002-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -45,11 +45,23 @@ use_merged_upsample (j_decompress_ptr cinfo) { #ifdef UPSAMPLE_MERGING_SUPPORTED - /* Merging is the equivalent of plain box-filter upsampling */ - if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling) + /* Merging is the equivalent of plain box-filter upsampling. */ + /* The following condition is only needed if fancy shall select + * a different upsampling method. In our current implementation + * fancy only affects the DCT scaling, thus we can use fancy + * upsampling and merged upsample simultaneously, in particular + * with scaled DCT sizes larger than the default DCTSIZE. + */ +#if 0 + if (cinfo->do_fancy_upsampling) + return FALSE; +#endif + if (cinfo->CCIR601_sampling) return FALSE; /* jdmerge.c only supports YCC=>RGB color conversion */ - if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 || + if ((cinfo->jpeg_color_space != JCS_YCbCr && + cinfo->jpeg_color_space != JCS_BG_YCC) || + cinfo->num_components != 3 || cinfo->out_color_space != JCS_RGB || cinfo->out_color_components != RGB_PIXELSIZE || cinfo->color_transform) @@ -199,30 +211,20 @@ * These processes all use a common table prepared by the routine below. * * For most steps we can mathematically guarantee that the initial value - * of x is within MAXJSAMPLE+1 of the legal range, so a table running from - * -(MAXJSAMPLE+1) to 2*MAXJSAMPLE+1 is sufficient. But for the initial - * limiting step (just after the IDCT), a wildly out-of-range value is - * possible if the input data is corrupt. To avoid any chance of indexing + * of x is within 2*(MAXJSAMPLE+1) of the legal range, so a table running + * from -2*(MAXJSAMPLE+1) to 3*MAXJSAMPLE+2 is sufficient. But for the + * initial limiting step (just after the IDCT), a wildly out-of-range value + * is possible if the input data is corrupt. To avoid any chance of indexing * off the end of memory and getting a bad-pointer trap, we perform the * post-IDCT limiting thus: - * x = range_limit[x & MASK]; + * x = (sample_range_limit - SUBSET)[(x + CENTER) & MASK]; * where MASK is 2 bits wider than legal sample data, ie 10 bits for 8-bit * samples. Under normal circumstances this is more than enough range and * a correct output will be generated; with bogus input data the mask will * cause wraparound, and we will safely generate a bogus-but-in-range output. * For the post-IDCT step, we want to convert the data from signed to unsigned * representation by adding CENTERJSAMPLE at the same time that we limit it. - * So the post-IDCT limiting table ends up looking like this: - * CENTERJSAMPLE,CENTERJSAMPLE+1,...,MAXJSAMPLE, - * MAXJSAMPLE (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times), - * 0 (repeat 2*(MAXJSAMPLE+1)-CENTERJSAMPLE times), - * 0,1,...,CENTERJSAMPLE-1 - * Negative inputs select values from the upper half of the table after - * masking. - * - * We can save some space by overlapping the start of the post-IDCT table - * with the simpler range limiting table. The post-IDCT table begins at - * sample_range_limit + CENTERJSAMPLE. + * This is accomplished with SUBSET = CENTER - CENTERJSAMPLE. * * Note that the table is allocated in near data space on PCs; it's small * enough and used often enough to justify this. @@ -237,23 +239,17 @@ table = (JSAMPLE *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, - (5 * (MAXJSAMPLE+1) + CENTERJSAMPLE) * SIZEOF(JSAMPLE)); - table += (MAXJSAMPLE+1); /* allow negative subscripts of simple table */ + 5 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); + /* First segment of range limit table: limit[x] = 0 for x < 0 */ + MEMZERO(table, 2 * (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); + table += 2 * (MAXJSAMPLE+1); /* allow negative subscripts of table */ cinfo->sample_range_limit = table; - /* First segment of "simple" table: limit[x] = 0 for x < 0 */ - MEMZERO(table - (MAXJSAMPLE+1), (MAXJSAMPLE+1) * SIZEOF(JSAMPLE)); - /* Main part of "simple" table: limit[x] = x */ + /* Main part of range limit table: limit[x] = x */ for (i = 0; i <= MAXJSAMPLE; i++) table[i] = (JSAMPLE) i; - table += CENTERJSAMPLE; /* Point to where post-IDCT table starts */ - /* End of simple table, rest of first half of post-IDCT table */ - for (i = CENTERJSAMPLE; i < 2*(MAXJSAMPLE+1); i++) + /* End of range limit table: limit[x] = MAXJSAMPLE for x > MAXJSAMPLE */ + for (; i < 3 * (MAXJSAMPLE+1); i++) table[i] = MAXJSAMPLE; - /* Second half of post-IDCT table */ - MEMZERO(table + (2 * (MAXJSAMPLE+1)), - (2 * (MAXJSAMPLE+1) - CENTERJSAMPLE) * SIZEOF(JSAMPLE)); - MEMCOPY(table + (4 * (MAXJSAMPLE+1) - CENTERJSAMPLE), - cinfo->sample_range_limit, CENTERJSAMPLE * SIZEOF(JSAMPLE)); } Modified: trunk/reactos/dll/3rdparty/libjpeg/jdmerge.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jdmer…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jdmerge.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jdmerge.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jdmerge.c * * Copyright (C) 1994-1996, Thomas G. Lane. - * Modified 2013 by Guido Vollbeding. + * Modified 2013-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -24,7 +24,7 @@ * multiplications needed for color conversion. * * This file currently provides implementations for the following cases: - * YCbCr => RGB color conversion only. + * YCC => RGB color conversion only (YCbCr or BG_YCC). * Sampling ratios of 2h1v or 2h2v. * No scaling needed at upsample time. * Corner-aligned (non-CCIR601) sampling alignment. @@ -76,12 +76,13 @@ /* - * Initialize tables for YCC->RGB colorspace conversion. + * Initialize tables for YCbCr->RGB and BG_YCC->RGB colorspace conversion. * This is taken directly from jdcolor.c; see that file for more info. */ LOCAL(void) build_ycc_rgb_table (j_decompress_ptr cinfo) +/* Normal case, sYCC */ { my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; int i; @@ -115,6 +116,46 @@ /* Cb=>G value is scaled-up -0.344136286 * x */ /* We also add in ONE_HALF so that need not do it in inner loop */ upsample->Cb_g_tab[i] = (- FIX(0.344136286)) * x + ONE_HALF; + } +} + + +LOCAL(void) +build_bg_ycc_rgb_table (j_decompress_ptr cinfo) +/* Wide gamut case, bg-sYCC */ +{ + my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; + int i; + INT32 x; + SHIFT_TEMPS + + upsample->Cr_r_tab = (int *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(int)); + upsample->Cb_b_tab = (int *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(int)); + upsample->Cr_g_tab = (INT32 *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(INT32)); + upsample->Cb_g_tab = (INT32 *) + (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, + (MAXJSAMPLE+1) * SIZEOF(INT32)); + + for (i = 0, x = -CENTERJSAMPLE; i <= MAXJSAMPLE; i++, x++) { + /* i is the actual input pixel value, in the range 0..MAXJSAMPLE */ + /* The Cb or Cr value we are thinking of is x = i - CENTERJSAMPLE */ + /* Cr=>R value is nearest int to 2.804 * x */ + upsample->Cr_r_tab[i] = (int) + RIGHT_SHIFT(FIX(2.804) * x + ONE_HALF, SCALEBITS); + /* Cb=>B value is nearest int to 3.544 * x */ + upsample->Cb_b_tab[i] = (int) + RIGHT_SHIFT(FIX(3.544) * x + ONE_HALF, SCALEBITS); + /* Cr=>G value is scaled-up -1.428272572 * x */ + upsample->Cr_g_tab[i] = (- FIX(1.428272572)) * x; + /* Cb=>G value is scaled-up -0.688272572 * x */ + /* We also add in ONE_HALF so that need not do it in inner loop */ + upsample->Cb_g_tab[i] = (- FIX(0.688272572)) * x + ONE_HALF; } } @@ -251,32 +292,32 @@ /* Do the chroma part of the calculation */ cb = GETJSAMPLE(*inptr1++); cr = GETJSAMPLE(*inptr2++); - cred = Crrtab[cr]; + cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; + cblue = Cbbtab[cb]; /* Fetch 2 Y values and emit 2 pixels */ y = GETJSAMPLE(*inptr0++); - outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; + outptr[RGB_BLUE] = range_limit[y + cblue]; outptr += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr0++); - outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; + outptr[RGB_BLUE] = range_limit[y + cblue]; outptr += RGB_PIXELSIZE; } /* If image width is odd, do the last output column separately */ if (cinfo->output_width & 1) { cb = GETJSAMPLE(*inptr1); cr = GETJSAMPLE(*inptr2); - cred = Crrtab[cr]; + cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; + cblue = Cbbtab[cb]; y = GETJSAMPLE(*inptr0); - outptr[RGB_RED] = range_limit[y + cred]; + outptr[RGB_RED] = range_limit[y + cred]; outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; + outptr[RGB_BLUE] = range_limit[y + cblue]; } } @@ -315,46 +356,46 @@ /* Do the chroma part of the calculation */ cb = GETJSAMPLE(*inptr1++); cr = GETJSAMPLE(*inptr2++); - cred = Crrtab[cr]; + cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; + cblue = Cbbtab[cb]; /* Fetch 4 Y values and emit 4 pixels */ y = GETJSAMPLE(*inptr00++); - outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_GREEN] = range_limit[y + cgreen]; - outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0 += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr00++); - outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_GREEN] = range_limit[y + cgreen]; - outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; outptr0 += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr01++); - outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_GREEN] = range_limit[y + cgreen]; - outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1 += RGB_PIXELSIZE; y = GETJSAMPLE(*inptr01++); - outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_GREEN] = range_limit[y + cgreen]; - outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; outptr1 += RGB_PIXELSIZE; } /* If image width is odd, do the last output column separately */ if (cinfo->output_width & 1) { cb = GETJSAMPLE(*inptr1); cr = GETJSAMPLE(*inptr2); - cred = Crrtab[cr]; + cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; + cblue = Cbbtab[cb]; y = GETJSAMPLE(*inptr00); - outptr0[RGB_RED] = range_limit[y + cred]; + outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_GREEN] = range_limit[y + cgreen]; - outptr0[RGB_BLUE] = range_limit[y + cblue]; + outptr0[RGB_BLUE] = range_limit[y + cblue]; y = GETJSAMPLE(*inptr01); - outptr1[RGB_RED] = range_limit[y + cred]; + outptr1[RGB_RED] = range_limit[y + cred]; outptr1[RGB_GREEN] = range_limit[y + cgreen]; - outptr1[RGB_BLUE] = range_limit[y + cblue]; + outptr1[RGB_BLUE] = range_limit[y + cblue]; } } @@ -375,7 +416,7 @@ upsample = (my_upsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_upsampler)); - cinfo->upsample = (struct jpeg_upsampler *) upsample; + cinfo->upsample = &upsample->pub; upsample->pub.start_pass = start_pass_merged_upsample; upsample->pub.need_context_rows = FALSE; @@ -395,7 +436,10 @@ upsample->spare_row = NULL; } - build_ycc_rgb_table(cinfo); + if (cinfo->jpeg_color_space == JCS_BG_YCC) + build_bg_ycc_rgb_table(cinfo); + else + build_ycc_rgb_table(cinfo); } #endif /* UPSAMPLE_MERGING_SUPPORTED */ Modified: trunk/reactos/dll/3rdparty/libjpeg/jdsample.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jdsam…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jdsample.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jdsample.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jdsample.c * * Copyright (C) 1991-1996, Thomas G. Lane. - * Modified 2002-2008 by Guido Vollbeding. + * Modified 2002-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -296,13 +296,12 @@ my_upsample_ptr upsample; int ci; jpeg_component_info * compptr; - boolean need_buffer; int h_in_group, v_in_group, h_out_group, v_out_group; upsample = (my_upsample_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_upsampler)); - cinfo->upsample = (struct jpeg_upsampler *) upsample; + cinfo->upsample = &upsample->pub; upsample->pub.start_pass = start_pass_upsample; upsample->pub.upsample = sep_upsample; upsample->pub.need_context_rows = FALSE; /* until we find out differently */ @@ -325,17 +324,17 @@ h_out_group = cinfo->max_h_samp_factor; v_out_group = cinfo->max_v_samp_factor; upsample->rowgroup_height[ci] = v_in_group; /* save for use later */ - need_buffer = TRUE; if (! compptr->component_needed) { /* Don't bother to upsample an uninteresting component. */ upsample->methods[ci] = noop_upsample; - need_buffer = FALSE; - } else if (h_in_group == h_out_group && v_in_group == v_out_group) { + continue; /* don't need to allocate buffer */ + } + if (h_in_group == h_out_group && v_in_group == v_out_group) { /* Fullsize components can be processed without any work. */ upsample->methods[ci] = fullsize_upsample; - need_buffer = FALSE; - } else if (h_in_group * 2 == h_out_group && - v_in_group == v_out_group) { + continue; /* don't need to allocate buffer */ + } + if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) { /* Special case for 2h1v upsampling */ upsample->methods[ci] = h2v1_upsample; } else if (h_in_group * 2 == h_out_group && @@ -350,12 +349,10 @@ upsample->v_expand[ci] = (UINT8) (v_out_group / v_in_group); } else ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL); - if (need_buffer) { - upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray) - ((j_common_ptr) cinfo, JPOOL_IMAGE, - (JDIMENSION) jround_up((long) cinfo->output_width, - (long) cinfo->max_h_samp_factor), - (JDIMENSION) cinfo->max_v_samp_factor); - } - } -} + upsample->color_buf[ci] = (*cinfo->mem->alloc_sarray) + ((j_common_ptr) cinfo, JPOOL_IMAGE, + (JDIMENSION) jround_up((long) cinfo->output_width, + (long) cinfo->max_h_samp_factor), + (JDIMENSION) cinfo->max_v_samp_factor); + } +} Modified: trunk/reactos/dll/3rdparty/libjpeg/jerror.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jerro…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jerror.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jerror.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jerror.c * * Copyright (C) 1991-1998, Thomas G. Lane. - * Modified 2012 by Guido Vollbeding. + * Modified 2012-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -18,16 +18,16 @@ * * These routines are used by both the compression and decompression code. */ + +#ifdef USE_WINDOWS_MESSAGEBOX +#include <windows.h> +#endif /* this is not a core library module, so it doesn't define JPEG_INTERNALS */ #include "jinclude.h" #include "jpeglib.h" #include "jversion.h" #include "jerror.h" - -#ifdef USE_WINDOWS_MESSAGEBOX -#include <windows.h> -#endif #ifndef EXIT_FAILURE /* define exit() codes if not provided */ #define EXIT_FAILURE 1 Modified: trunk/reactos/dll/3rdparty/libjpeg/jfdctflt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jfdct…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jfdctflt.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jfdctflt.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jfdctflt.c * * Copyright (C) 1994-1996, Thomas G. Lane. - * Modified 2003-2009 by Guido Vollbeding. + * Modified 2003-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -54,6 +54,8 @@ /* * Perform the forward DCT on one block of samples. + * + * cK represents cos(K*pi/16). */ GLOBAL(void) @@ -89,7 +91,7 @@ tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */ dataptr[4] = tmp10 - tmp11; Modified: trunk/reactos/dll/3rdparty/libjpeg/jfdctfst.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jfdct…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jfdctfst.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jfdctfst.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jfdctfst.c * * Copyright (C) 1994-1996, Thomas G. Lane. - * Modified 2003-2009 by Guido Vollbeding. + * Modified 2003-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -109,6 +109,8 @@ /* * Perform the forward DCT on one block of samples. + * + * cK represents cos(K*pi/16). */ GLOBAL(void) @@ -145,7 +147,7 @@ tmp11 = tmp1 + tmp2; tmp12 = tmp1 - tmp2; - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = tmp10 + tmp11 - 8 * CENTERJSAMPLE; /* phase 3 */ dataptr[4] = tmp10 - tmp11; Modified: trunk/reactos/dll/3rdparty/libjpeg/jfdctint.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jfdct…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jfdctint.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jfdctint.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jfdctint.c * * Copyright (C) 1991-1996, Thomas G. Lane. - * Modification developed 2003-2013 by Guido Vollbeding. + * Modification developed 2003-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -194,7 +194,7 @@ tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[5]); tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[4]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 - 8 * CENTERJSAMPLE) << PASS1_BITS); dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); @@ -367,7 +367,7 @@ tmp12 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[4]); z1 = tmp0 + tmp2; - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((z1 + tmp1 + tmp3 - 7 * CENTERJSAMPLE) << PASS1_BITS); tmp3 += tmp3; @@ -503,7 +503,7 @@ tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[4]); tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[3]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 - 6 * CENTERJSAMPLE) << PASS1_BITS); dataptr[2] = (DCTELEM) @@ -618,7 +618,7 @@ tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[4]); tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[3]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp2 - 5 * CENTERJSAMPLE) << (PASS1_BITS+1)); tmp11 = MULTIPLY(tmp11, FIX(0.790569415)); /* (c2+c4)/2 */ @@ -724,7 +724,7 @@ tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[3]); tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[2]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp0 + tmp1 - 4 * CENTERJSAMPLE) << (PASS1_BITS+2)); dataptr[2] = (DCTELEM) ((tmp0 - tmp1) << (PASS1_BITS+2)); @@ -818,7 +818,7 @@ tmp2 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[2]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp0 + tmp1 - 3 * CENTERJSAMPLE) << (PASS1_BITS+2)); dataptr[2] = (DCTELEM) @@ -876,7 +876,7 @@ GLOBAL(void) jpeg_fdct_2x2 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) { - INT32 tmp0, tmp1, tmp2, tmp3; + DCTELEM tmp0, tmp1, tmp2, tmp3; JSAMPROW elemptr; /* Pre-zero output coefficient block. */ @@ -904,13 +904,13 @@ */ /* Column 0 */ - /* Apply unsigned->signed conversion */ - data[DCTSIZE*0] = (DCTELEM) ((tmp0 + tmp2 - 4 * CENTERJSAMPLE) << 4); - data[DCTSIZE*1] = (DCTELEM) ((tmp0 - tmp2) << 4); + /* Apply unsigned->signed conversion. */ + data[DCTSIZE*0] = (tmp0 + tmp2 - 4 * CENTERJSAMPLE) << 4; + data[DCTSIZE*1] = (tmp0 - tmp2) << 4; /* Column 1 */ - data[DCTSIZE*0+1] = (DCTELEM) ((tmp1 + tmp3) << 4); - data[DCTSIZE*1+1] = (DCTELEM) ((tmp1 - tmp3) << 4); + data[DCTSIZE*0+1] = (tmp1 + tmp3) << 4; + data[DCTSIZE*1+1] = (tmp1 - tmp3) << 4; } @@ -921,14 +921,17 @@ GLOBAL(void) jpeg_fdct_1x1 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) { + DCTELEM dcval; + /* Pre-zero output coefficient block. */ MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); + dcval = GETJSAMPLE(sample_data[0][start_col]); + /* We leave the result scaled up by an overall factor of 8. */ /* We must also scale the output by (8/1)**2 = 2**6. */ - /* Apply unsigned->signed conversion */ - data[0] = (DCTELEM) - ((GETJSAMPLE(sample_data[0][start_col]) - CENTERJSAMPLE) << 6); + /* Apply unsigned->signed conversion. */ + data[0] = (dcval - CENTERJSAMPLE) << 6; } @@ -976,7 +979,7 @@ z1 = tmp0 + tmp2 + tmp3; z2 = tmp1 + tmp4; - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((z1 + z2 - 9 * CENTERJSAMPLE) << 1); dataptr[6] = (DCTELEM) DESCALE(MULTIPLY(z1 - z2 - z2, FIX(0.707106781)), /* c6 */ @@ -1130,7 +1133,7 @@ tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[6]); tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[5]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 + tmp12 - 10 * CENTERJSAMPLE) << 1); tmp12 += tmp12; @@ -1291,7 +1294,7 @@ tmp13 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[7]); tmp14 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[6]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp0 + tmp1 + tmp2 + tmp3 + tmp4 + tmp5 - 11 * CENTERJSAMPLE) << 1); tmp5 += tmp5; @@ -1480,7 +1483,7 @@ tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[7]); tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[6]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) (tmp10 + tmp11 + tmp12 - 12 * CENTERJSAMPLE); dataptr[6] = (DCTELEM) (tmp13 - tmp14 - tmp15); dataptr[4] = (DCTELEM) @@ -1641,7 +1644,7 @@ tmp14 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[8]); tmp15 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[7]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) (tmp0 + tmp1 + tmp2 + tmp3 + tmp4 + tmp5 + tmp6 - 13 * CENTERJSAMPLE); tmp6 += tmp6; @@ -1848,7 +1851,7 @@ tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[8]); tmp6 = GETJSAMPLE(elemptr[6]) - GETJSAMPLE(elemptr[7]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) (tmp10 + tmp11 + tmp12 + tmp13 - 14 * CENTERJSAMPLE); tmp13 += tmp13; @@ -2047,7 +2050,7 @@ z1 = tmp0 + tmp4 + tmp5; z2 = tmp1 + tmp3 + tmp6; z3 = tmp2 + tmp7; - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) (z1 + z2 + z3 - 15 * CENTERJSAMPLE); z3 += z3; dataptr[6] = (DCTELEM) @@ -2234,7 +2237,7 @@ tmp6 = GETJSAMPLE(elemptr[6]) - GETJSAMPLE(elemptr[9]); tmp7 = GETJSAMPLE(elemptr[7]) - GETJSAMPLE(elemptr[8]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 + tmp12 + tmp13 - 16 * CENTERJSAMPLE) << PASS1_BITS); dataptr[4] = (DCTELEM) @@ -2443,7 +2446,7 @@ tmp6 = GETJSAMPLE(elemptr[6]) - GETJSAMPLE(elemptr[9]); tmp7 = GETJSAMPLE(elemptr[7]) - GETJSAMPLE(elemptr[8]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 + tmp12 + tmp13 - 16 * CENTERJSAMPLE) << PASS1_BITS); dataptr[4] = (DCTELEM) @@ -2624,7 +2627,7 @@ tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[8]); tmp6 = GETJSAMPLE(elemptr[6]) - GETJSAMPLE(elemptr[7]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 + tmp12 + tmp13 - 14 * CENTERJSAMPLE) << PASS1_BITS); tmp13 += tmp13; @@ -2786,7 +2789,7 @@ tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[7]); tmp5 = GETJSAMPLE(elemptr[5]) - GETJSAMPLE(elemptr[6]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 + tmp12 - 12 * CENTERJSAMPLE) << PASS1_BITS); dataptr[6] = (DCTELEM) ((tmp13 - tmp14 - tmp15) << PASS1_BITS); @@ -2922,7 +2925,7 @@ tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[6]); tmp4 = GETJSAMPLE(elemptr[4]) - GETJSAMPLE(elemptr[5]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 + tmp12 - 10 * CENTERJSAMPLE) << PASS1_BITS); tmp12 += tmp12; @@ -3057,7 +3060,7 @@ tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[5]); tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[4]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 - 8 * CENTERJSAMPLE) << (PASS1_BITS+1)); dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << (PASS1_BITS+1)); @@ -3192,7 +3195,7 @@ tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[4]); tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[3]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 - 6 * CENTERJSAMPLE) << (PASS1_BITS+1)); dataptr[2] = (DCTELEM) @@ -3288,7 +3291,7 @@ tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[3]); tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[2]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp0 + tmp1 - 4 * CENTERJSAMPLE) << (PASS1_BITS+3)); dataptr[2] = (DCTELEM) ((tmp0 - tmp1) << (PASS1_BITS+3)); @@ -3342,7 +3345,7 @@ GLOBAL(void) jpeg_fdct_2x1 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) { - INT32 tmp0, tmp1; + DCTELEM tmp0, tmp1; JSAMPROW elemptr; /* Pre-zero output coefficient block. */ @@ -3359,12 +3362,12 @@ /* Even part */ - /* Apply unsigned->signed conversion */ - data[0] = (DCTELEM) ((tmp0 + tmp1 - 2 * CENTERJSAMPLE) << 5); + /* Apply unsigned->signed conversion. */ + data[0] = (tmp0 + tmp1 - 2 * CENTERJSAMPLE) << 5; /* Odd part */ - data[1] = (DCTELEM) ((tmp0 - tmp1) << 5); + data[1] = (tmp0 - tmp1) << 5; } @@ -3417,7 +3420,7 @@ tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[5]); tmp3 = GETJSAMPLE(elemptr[3]) - GETJSAMPLE(elemptr[4]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 - 8 * CENTERJSAMPLE) << PASS1_BITS); dataptr[4] = (DCTELEM) ((tmp10 - tmp11) << PASS1_BITS); @@ -3607,7 +3610,7 @@ tmp12 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[4]); z1 = tmp0 + tmp2; - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((z1 + tmp1 + tmp3 - 7 * CENTERJSAMPLE) << PASS1_BITS); tmp3 += tmp3; @@ -3789,7 +3792,7 @@ tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[4]); tmp2 = GETJSAMPLE(elemptr[2]) - GETJSAMPLE(elemptr[3]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp11 - 6 * CENTERJSAMPLE) << PASS1_BITS); dataptr[2] = (DCTELEM) @@ -3938,7 +3941,7 @@ tmp0 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[4]); tmp1 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[3]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp10 + tmp2 - 5 * CENTERJSAMPLE) << PASS1_BITS); tmp11 = MULTIPLY(tmp11, FIX(0.790569415)); /* (c2+c4)/2 */ @@ -4081,7 +4084,7 @@ tmp10 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[3]); tmp11 = GETJSAMPLE(elemptr[1]) - GETJSAMPLE(elemptr[2]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp0 + tmp1 - 4 * CENTERJSAMPLE) << (PASS1_BITS+1)); dataptr[2] = (DCTELEM) ((tmp0 - tmp1) << (PASS1_BITS+1)); @@ -4220,7 +4223,7 @@ tmp2 = GETJSAMPLE(elemptr[0]) - GETJSAMPLE(elemptr[2]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp0 + tmp1 - 3 * CENTERJSAMPLE) << (PASS1_BITS+1)); dataptr[2] = (DCTELEM) @@ -4321,7 +4324,7 @@ tmp0 = GETJSAMPLE(elemptr[0]); tmp1 = GETJSAMPLE(elemptr[1]); - /* Apply unsigned->signed conversion */ + /* Apply unsigned->signed conversion. */ dataptr[0] = (DCTELEM) ((tmp0 + tmp1 - 2 * CENTERJSAMPLE) << 3); /* Odd part */ @@ -4377,7 +4380,7 @@ GLOBAL(void) jpeg_fdct_1x2 (DCTELEM * data, JSAMPARRAY sample_data, JDIMENSION start_col) { - INT32 tmp0, tmp1; + DCTELEM tmp0, tmp1; /* Pre-zero output coefficient block. */ MEMZERO(data, SIZEOF(DCTELEM) * DCTSIZE2); @@ -4394,12 +4397,12 @@ tmp0 = GETJSAMPLE(sample_data[0][start_col]); tmp1 = GETJSAMPLE(sample_data[1][start_col]); - /* Apply unsigned->signed conversion */ - data[DCTSIZE*0] = (DCTELEM) ((tmp0 + tmp1 - 2 * CENTERJSAMPLE) << 5); + /* Apply unsigned->signed conversion. */ + data[DCTSIZE*0] = (tmp0 + tmp1 - 2 * CENTERJSAMPLE) << 5; /* Odd part */ - data[DCTSIZE*1] = (DCTELEM) ((tmp0 - tmp1) << 5); + data[DCTSIZE*1] = (tmp0 - tmp1) << 5; } #endif /* DCT_SCALING_SUPPORTED */ Modified: trunk/reactos/dll/3rdparty/libjpeg/jidctflt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jidct…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jidctflt.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jidctflt.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jidctflt.c * * Copyright (C) 1994-1998, Thomas G. Lane. - * Modified 2010 by Guido Vollbeding. + * Modified 2010-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -63,6 +63,8 @@ /* * Perform dequantization and inverse DCT on one block of coefficients. + * + * cK represents cos(K*pi/16). */ GLOBAL(void) @@ -77,7 +79,7 @@ FLOAT_MULT_TYPE * quantptr; FAST_FLOAT * wsptr; JSAMPROW outptr; - JSAMPLE *range_limit = cinfo->sample_range_limit; + JSAMPLE *range_limit = IDCT_range_limit(cinfo); int ctr; FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */ @@ -95,14 +97,14 @@ * With typical images and quantization tables, half or more of the * column DCT calculations can be simplified this way. */ - + if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 && inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 && inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 && inptr[DCTSIZE*7] == 0) { /* AC terms all zero */ FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); - + wsptr[DCTSIZE*0] = dcval; wsptr[DCTSIZE*1] = dcval; wsptr[DCTSIZE*2] = dcval; @@ -111,13 +113,13 @@ wsptr[DCTSIZE*5] = dcval; wsptr[DCTSIZE*6] = dcval; wsptr[DCTSIZE*7] = dcval; - + inptr++; /* advance pointers to next column */ quantptr++; wsptr++; continue; } - + /* Even part */ tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); @@ -135,7 +137,7 @@ tmp3 = tmp10 - tmp13; tmp1 = tmp11 + tmp12; tmp2 = tmp11 - tmp12; - + /* Odd part */ tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]); @@ -172,7 +174,7 @@ quantptr++; wsptr++; } - + /* Pass 2: process rows from work array, store into output array. */ wsptr = workspace; @@ -183,16 +185,17 @@ * the simplification applies less often (typically 5% to 10% of the time). * And testing floats for zero is relatively expensive, so we don't bother. */ - + /* Even part */ - /* Apply signed->unsigned and prepare float->int conversion */ - z5 = wsptr[0] + ((FAST_FLOAT) CENTERJSAMPLE + (FAST_FLOAT) 0.5); + /* Prepare range-limit and float->int conversion */ + z5 = wsptr[0] + (((FAST_FLOAT) RANGE_CENTER) + ((FAST_FLOAT) 0.5)); tmp10 = z5 + wsptr[4]; tmp11 = z5 - wsptr[4]; tmp13 = wsptr[2] + wsptr[6]; - tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13; + tmp12 = (wsptr[2] - wsptr[6]) * + ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */ tmp0 = tmp10 + tmp13; tmp3 = tmp10 - tmp13; @@ -206,28 +209,28 @@ z11 = wsptr[1] + wsptr[7]; z12 = wsptr[1] - wsptr[7]; - tmp7 = z11 + z13; - tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); + tmp7 = z11 + z13; /* phase 5 */ + tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */ z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */ tmp10 = z5 - z12 * ((FAST_FLOAT) 1.082392200); /* 2*(c2-c6) */ tmp12 = z5 - z10 * ((FAST_FLOAT) 2.613125930); /* 2*(c2+c6) */ - tmp6 = tmp12 - tmp7; + tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; tmp4 = tmp10 - tmp5; /* Final output stage: float->int conversion and range-limit */ - outptr[0] = range_limit[((int) (tmp0 + tmp7)) & RANGE_MASK]; - outptr[7] = range_limit[((int) (tmp0 - tmp7)) & RANGE_MASK]; - outptr[1] = range_limit[((int) (tmp1 + tmp6)) & RANGE_MASK]; - outptr[6] = range_limit[((int) (tmp1 - tmp6)) & RANGE_MASK]; - outptr[2] = range_limit[((int) (tmp2 + tmp5)) & RANGE_MASK]; - outptr[5] = range_limit[((int) (tmp2 - tmp5)) & RANGE_MASK]; - outptr[3] = range_limit[((int) (tmp3 + tmp4)) & RANGE_MASK]; - outptr[4] = range_limit[((int) (tmp3 - tmp4)) & RANGE_MASK]; - + outptr[0] = range_limit[(int) (tmp0 + tmp7) & RANGE_MASK]; + outptr[7] = range_limit[(int) (tmp0 - tmp7) & RANGE_MASK]; + outptr[1] = range_limit[(int) (tmp1 + tmp6) & RANGE_MASK]; + outptr[6] = range_limit[(int) (tmp1 - tmp6) & RANGE_MASK]; + outptr[2] = range_limit[(int) (tmp2 + tmp5) & RANGE_MASK]; + outptr[5] = range_limit[(int) (tmp2 - tmp5) & RANGE_MASK]; + outptr[3] = range_limit[(int) (tmp3 + tmp4) & RANGE_MASK]; + outptr[4] = range_limit[(int) (tmp3 - tmp4) & RANGE_MASK]; + wsptr += DCTSIZE; /* advance pointer to next row */ } } Modified: trunk/reactos/dll/3rdparty/libjpeg/jidctfst.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jidct…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jidctfst.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jidctfst.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,6 +2,7 @@ * jidctfst.c * * Copyright (C) 1994-1998, Thomas G. Lane. + * Modified 2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -133,35 +134,10 @@ #endif -/* Like DESCALE, but applies to a DCTELEM and produces an int. - * We assume that int right shift is unsigned if INT32 right shift is. - */ - -#ifdef RIGHT_SHIFT_IS_UNSIGNED -#define ISHIFT_TEMPS DCTELEM ishift_temp; -#if BITS_IN_JSAMPLE == 8 -#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */ -#else -#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */ -#endif -#define IRIGHT_SHIFT(x,shft) \ - ((ishift_temp = (x)) < 0 ? \ - (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \ - (ishift_temp >> (shft))) -#else -#define ISHIFT_TEMPS -#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) -#endif - -#ifdef USE_ACCURATE_ROUNDING -#define IDESCALE(x,n) ((int) IRIGHT_SHIFT((x) + (1 << ((n)-1)), n)) -#else -#define IDESCALE(x,n) ((int) IRIGHT_SHIFT(x, n)) -#endif - - /* * Perform dequantization and inverse DCT on one block of coefficients. + * + * cK represents cos(K*pi/16). */ GLOBAL(void) @@ -180,7 +156,7 @@ int ctr; int workspace[DCTSIZE2]; /* buffers data between passes */ SHIFT_TEMPS /* for DESCALE */ - ISHIFT_TEMPS /* for IDESCALE */ + ISHIFT_TEMPS /* for IRIGHT_SHIFT */ /* Pass 1: process columns from input, store into work array. */ @@ -253,12 +229,12 @@ tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ - tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ - tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ + tmp10 = z5 - MULTIPLY(z12, FIX_1_082392200); /* 2*(c2-c6) */ + tmp12 = z5 - MULTIPLY(z10, FIX_2_613125930); /* 2*(c2+c6) */ tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; + tmp4 = tmp10 - tmp5; wsptr[DCTSIZE*0] = (int) (tmp0 + tmp7); wsptr[DCTSIZE*7] = (int) (tmp0 - tmp7); @@ -266,21 +242,28 @@ wsptr[DCTSIZE*6] = (int) (tmp1 - tmp6); wsptr[DCTSIZE*2] = (int) (tmp2 + tmp5); wsptr[DCTSIZE*5] = (int) (tmp2 - tmp5); - wsptr[DCTSIZE*4] = (int) (tmp3 + tmp4); - wsptr[DCTSIZE*3] = (int) (tmp3 - tmp4); + wsptr[DCTSIZE*3] = (int) (tmp3 + tmp4); + wsptr[DCTSIZE*4] = (int) (tmp3 - tmp4); inptr++; /* advance pointers to next column */ quantptr++; wsptr++; } - /* Pass 2: process rows from work array, store into output array. */ - /* Note that we must descale the results by a factor of 8 == 2**3, */ - /* and also undo the PASS1_BITS scaling. */ + /* Pass 2: process rows from work array, store into output array. + * Note that we must descale the results by a factor of 8 == 2**3, + * and also undo the PASS1_BITS scaling. + */ wsptr = workspace; for (ctr = 0; ctr < DCTSIZE; ctr++) { outptr = output_buf[ctr] + output_col; + + /* Add range center and fudge factor for final descale and range-limit. */ + z5 = (DCTELEM) wsptr[0] + + ((((DCTELEM) RANGE_CENTER) << (PASS1_BITS+3)) + + (1 << (PASS1_BITS+2))); + /* Rows of zeroes can be exploited in the same way as we did with columns. * However, the column calculation has created many nonzero AC terms, so * the simplification applies less often (typically 5% to 10% of the time). @@ -293,7 +276,7 @@ if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ - JSAMPLE dcval = range_limit[IDESCALE(wsptr[0], PASS1_BITS+3) + JSAMPLE dcval = range_limit[(int) IRIGHT_SHIFT(z5, PASS1_BITS+3) & RANGE_MASK]; outptr[0] = dcval; @@ -312,12 +295,12 @@ /* Even part */ - tmp10 = ((DCTELEM) wsptr[0] + (DCTELEM) wsptr[4]); - tmp11 = ((DCTELEM) wsptr[0] - (DCTELEM) wsptr[4]); - - tmp13 = ((DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]); - tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], FIX_1_414213562) - - tmp13; + tmp10 = z5 + (DCTELEM) wsptr[4]; + tmp11 = z5 - (DCTELEM) wsptr[4]; + + tmp13 = (DCTELEM) wsptr[2] + (DCTELEM) wsptr[6]; + tmp12 = MULTIPLY((DCTELEM) wsptr[2] - (DCTELEM) wsptr[6], + FIX_1_414213562) - tmp13; /* 2*c4 */ tmp0 = tmp10 + tmp13; tmp3 = tmp10 - tmp13; @@ -335,30 +318,30 @@ tmp11 = MULTIPLY(z11 - z13, FIX_1_414213562); /* 2*c4 */ z5 = MULTIPLY(z10 + z12, FIX_1_847759065); /* 2*c2 */ - tmp10 = MULTIPLY(z12, FIX_1_082392200) - z5; /* 2*(c2-c6) */ - tmp12 = MULTIPLY(z10, - FIX_2_613125930) + z5; /* -2*(c2+c6) */ + tmp10 = z5 - MULTIPLY(z12, FIX_1_082392200); /* 2*(c2-c6) */ + tmp12 = z5 - MULTIPLY(z10, FIX_2_613125930); /* 2*(c2+c6) */ tmp6 = tmp12 - tmp7; /* phase 2 */ tmp5 = tmp11 - tmp6; - tmp4 = tmp10 + tmp5; + tmp4 = tmp10 - tmp5; /* Final output stage: scale down by a factor of 8 and range-limit */ - outptr[0] = range_limit[IDESCALE(tmp0 + tmp7, PASS1_BITS+3) - & RANGE_MASK]; - outptr[7] = range_limit[IDESCALE(tmp0 - tmp7, PASS1_BITS+3) - & RANGE_MASK]; - outptr[1] = range_limit[IDESCALE(tmp1 + tmp6, PASS1_BITS+3) - & RANGE_MASK]; - outptr[6] = range_limit[IDESCALE(tmp1 - tmp6, PASS1_BITS+3) - & RANGE_MASK]; - outptr[2] = range_limit[IDESCALE(tmp2 + tmp5, PASS1_BITS+3) - & RANGE_MASK]; - outptr[5] = range_limit[IDESCALE(tmp2 - tmp5, PASS1_BITS+3) - & RANGE_MASK]; - outptr[4] = range_limit[IDESCALE(tmp3 + tmp4, PASS1_BITS+3) - & RANGE_MASK]; - outptr[3] = range_limit[IDESCALE(tmp3 - tmp4, PASS1_BITS+3) + outptr[0] = range_limit[(int) IRIGHT_SHIFT(tmp0 + tmp7, PASS1_BITS+3) + & RANGE_MASK]; + outptr[7] = range_limit[(int) IRIGHT_SHIFT(tmp0 - tmp7, PASS1_BITS+3) + & RANGE_MASK]; + outptr[1] = range_limit[(int) IRIGHT_SHIFT(tmp1 + tmp6, PASS1_BITS+3) + & RANGE_MASK]; + outptr[6] = range_limit[(int) IRIGHT_SHIFT(tmp1 - tmp6, PASS1_BITS+3) + & RANGE_MASK]; + outptr[2] = range_limit[(int) IRIGHT_SHIFT(tmp2 + tmp5, PASS1_BITS+3) + & RANGE_MASK]; + outptr[5] = range_limit[(int) IRIGHT_SHIFT(tmp2 - tmp5, PASS1_BITS+3) + & RANGE_MASK]; + outptr[3] = range_limit[(int) IRIGHT_SHIFT(tmp3 + tmp4, PASS1_BITS+3) + & RANGE_MASK]; + outptr[4] = range_limit[(int) IRIGHT_SHIFT(tmp3 - tmp4, PASS1_BITS+3) & RANGE_MASK]; wsptr += DCTSIZE; /* advance pointer to next row */ Modified: trunk/reactos/dll/3rdparty/libjpeg/jidctint.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/jidct…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/jidctint.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/jidctint.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jidctint.c * * Copyright (C) 1991-1998, Thomas G. Lane. - * Modification developed 2002-2013 by Guido Vollbeding. + * Modification developed 2002-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -230,13 +230,6 @@ * The rotator is c(-6). */ - z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); - z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); - - z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ - tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */ - tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */ - z2 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]); z3 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]); z2 <<= CONST_BITS; @@ -246,6 +239,13 @@ tmp0 = z2 + z3; tmp1 = z2 - z3; + + z2 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]); + z3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]); + + z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ + tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */ + tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */ tmp10 = tmp0 + tmp2; tmp13 = tmp0 - tmp2; @@ -306,6 +306,12 @@ wsptr = workspace; for (ctr = 0; ctr < DCTSIZE; ctr++) { outptr = output_buf[ctr] + output_col; + + /* Add range center and fudge factor for final descale and range-limit. */ + z2 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); + /* Rows of zeroes can be exploited in the same way as we did with columns. * However, the column calculation has created many nonzero AC terms, so * the simplification applies less often (typically 5% to 10% of the time). @@ -318,7 +324,7 @@ if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 && wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) { /* AC terms all zero */ - JSAMPLE dcval = range_limit[(int) DESCALE((INT32) wsptr[0], PASS1_BITS+3) + JSAMPLE dcval = range_limit[(int) RIGHT_SHIFT(z2, PASS1_BITS+3) & RANGE_MASK]; outptr[0] = dcval; @@ -339,19 +345,17 @@ * The rotator is c(-6). */ + z3 = (INT32) wsptr[4]; + + tmp0 = (z2 + z3) << CONST_BITS; + tmp1 = (z2 - z3) << CONST_BITS; + z2 = (INT32) wsptr[2]; z3 = (INT32) wsptr[6]; z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */ tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */ - - /* Add fudge factor here for final descale. */ - z2 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); - z3 = (INT32) wsptr[4]; - - tmp0 = (z2 + z3) << CONST_BITS; - tmp1 = (z2 - z3) << CONST_BITS; tmp10 = tmp0 + tmp2; tmp13 = tmp0 - tmp2; @@ -508,8 +512,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp13 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp13 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp13 <<= CONST_BITS; z1 = (INT32) wsptr[2]; @@ -644,8 +650,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp0 <<= CONST_BITS; tmp2 = (INT32) wsptr[4]; tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ @@ -763,8 +771,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp12 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp12 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp12 <<= CONST_BITS; tmp0 = (INT32) wsptr[2]; tmp1 = (INT32) wsptr[4]; @@ -875,8 +885,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp2 = (INT32) wsptr[2]; tmp10 = (tmp0 + tmp2) << CONST_BITS; @@ -972,8 +984,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp0 <<= CONST_BITS; tmp2 = (INT32) wsptr[2]; tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ @@ -1014,11 +1028,11 @@ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - INT32 tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; + DCTELEM tmp0, tmp1, tmp2, tmp3, tmp4, tmp5; ISLOW_MULT_TYPE * quantptr; JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); - SHIFT_TEMPS + ISHIFT_TEMPS /* Pass 1: process columns from input. */ @@ -1027,8 +1041,8 @@ /* Column 0 */ tmp4 = DEQUANTIZE(coef_block[DCTSIZE*0], quantptr[DCTSIZE*0]); tmp5 = DEQUANTIZE(coef_block[DCTSIZE*1], quantptr[DCTSIZE*1]); - /* Add fudge factor here for final descale. */ - tmp4 += ONE << 2; + /* Add range center and fudge factor for final descale and range-limit. */ + tmp4 += (((DCTELEM) RANGE_CENTER) << 3) + (1 << 2); tmp0 = tmp4 + tmp5; tmp2 = tmp4 - tmp5; @@ -1045,14 +1059,14 @@ /* Row 0 */ outptr = output_buf[0] + output_col; - outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp0 + tmp1, 3) & RANGE_MASK]; - outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp0 - tmp1, 3) & RANGE_MASK]; + outptr[0] = range_limit[(int) IRIGHT_SHIFT(tmp0 + tmp1, 3) & RANGE_MASK]; + outptr[1] = range_limit[(int) IRIGHT_SHIFT(tmp0 - tmp1, 3) & RANGE_MASK]; /* Row 1 */ outptr = output_buf[1] + output_col; - outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp2 + tmp3, 3) & RANGE_MASK]; - outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp2 - tmp3, 3) & RANGE_MASK]; + outptr[0] = range_limit[(int) IRIGHT_SHIFT(tmp2 + tmp3, 3) & RANGE_MASK]; + outptr[1] = range_limit[(int) IRIGHT_SHIFT(tmp2 - tmp3, 3) & RANGE_MASK]; } @@ -1069,17 +1083,21 @@ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - int dcval; + DCTELEM dcval; ISLOW_MULT_TYPE * quantptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); - SHIFT_TEMPS + ISHIFT_TEMPS /* 1x1 is trivial: just take the DC coefficient divided by 8. */ + quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; + dcval = DEQUANTIZE(coef_block[0], quantptr[0]); - dcval = (int) DESCALE((INT32) dcval, 3); - - output_buf[0][output_col] = range_limit[dcval & RANGE_MASK]; + /* Add range center and fudge factor for descale and range-limit. */ + dcval += (((DCTELEM) RANGE_CENTER) << 3) + (1 << 2); + + output_buf[0][output_col] = + range_limit[(int) IRIGHT_SHIFT(dcval, 3) & RANGE_MASK]; } @@ -1178,8 +1196,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp0 <<= CONST_BITS; z1 = (INT32) wsptr[2]; @@ -1361,8 +1381,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + z3 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); z3 <<= CONST_BITS; z4 = (INT32) wsptr[4]; z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ @@ -1554,8 +1576,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp10 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp10 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp10 <<= CONST_BITS; z1 = (INT32) wsptr[2]; @@ -1758,8 +1782,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + z3 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); z3 <<= CONST_BITS; z4 = (INT32) wsptr[4]; @@ -1979,8 +2005,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + z1 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); z1 <<= CONST_BITS; z2 = (INT32) wsptr[2]; @@ -2206,8 +2234,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + z1 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); z1 <<= CONST_BITS; z4 = (INT32) wsptr[4]; z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ @@ -2438,8 +2468,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + z1 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); z1 <<= CONST_BITS; z2 = (INT32) wsptr[2]; @@ -2689,8 +2721,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp0 <<= CONST_BITS; z1 = (INT32) wsptr[4]; @@ -2964,8 +2998,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp0 <<= CONST_BITS; z1 = (INT32) wsptr[4]; @@ -3182,8 +3218,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - z1 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + z1 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); z1 <<= CONST_BITS; z4 = (INT32) wsptr[4]; z2 = MULTIPLY(z4, FIX(1.274162392)); /* c4 */ @@ -3366,8 +3404,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + z3 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); z3 <<= CONST_BITS; z4 = (INT32) wsptr[4]; @@ -3542,8 +3582,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - z3 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + z3 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); z3 <<= CONST_BITS; z4 = (INT32) wsptr[4]; z1 = MULTIPLY(z4, FIX(1.144122806)); /* c4 */ @@ -3707,19 +3749,21 @@ * The rotator is c(-6). */ + /* Add range center and fudge factor for final descale and range-limit. */ + z2 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); + z3 = (INT32) wsptr[4]; + + tmp0 = (z2 + z3) << CONST_BITS; + tmp1 = (z2 - z3) << CONST_BITS; + z2 = (INT32) wsptr[2]; z3 = (INT32) wsptr[6]; z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */ tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */ - - /* Add fudge factor here for final descale. */ - z2 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); - z3 = (INT32) wsptr[4]; - - tmp0 = (z2 + z3) << CONST_BITS; - tmp1 = (z2 - z3) << CONST_BITS; tmp10 = tmp0 + tmp2; tmp13 = tmp0 - tmp2; @@ -3852,8 +3896,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp0 <<= CONST_BITS; tmp2 = (INT32) wsptr[4]; tmp10 = MULTIPLY(tmp2, FIX(0.707106781)); /* c4 */ @@ -3954,8 +4000,8 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = wsptr[0] + (ONE << 2); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = wsptr[0] + ((((INT32) RANGE_CENTER) << 3) + (ONE << 2)); tmp2 = wsptr[2]; tmp10 = (tmp0 + tmp2) << CONST_BITS; @@ -4003,11 +4049,11 @@ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - INT32 tmp0, tmp1; + DCTELEM tmp0, tmp1; ISLOW_MULT_TYPE * quantptr; JSAMPROW outptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); - SHIFT_TEMPS + ISHIFT_TEMPS /* Pass 1: empty. */ @@ -4019,8 +4065,8 @@ /* Even part */ tmp0 = DEQUANTIZE(coef_block[0], quantptr[0]); - /* Add fudge factor here for final descale. */ - tmp0 += ONE << 2; + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 += (((DCTELEM) RANGE_CENTER) << 3) + (1 << 2); /* Odd part */ @@ -4028,8 +4074,8 @@ /* Final output stage */ - outptr[0] = range_limit[(int) RIGHT_SHIFT(tmp0 + tmp1, 3) & RANGE_MASK]; - outptr[1] = range_limit[(int) RIGHT_SHIFT(tmp0 - tmp1, 3) & RANGE_MASK]; + outptr[0] = range_limit[(int) IRIGHT_SHIFT(tmp0 + tmp1, 3) & RANGE_MASK]; + outptr[1] = range_limit[(int) IRIGHT_SHIFT(tmp0 - tmp1, 3) & RANGE_MASK]; } @@ -4174,19 +4220,21 @@ * The rotator is c(-6). */ + /* Add range center and fudge factor for final descale and range-limit. */ + z2 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); + z3 = (INT32) wsptr[4]; + + tmp0 = (z2 + z3) << CONST_BITS; + tmp1 = (z2 - z3) << CONST_BITS; + z2 = (INT32) wsptr[2]; z3 = (INT32) wsptr[6]; z1 = MULTIPLY(z2 + z3, FIX_0_541196100); /* c6 */ tmp2 = z1 + MULTIPLY(z2, FIX_0_765366865); /* c2-c6 */ tmp3 = z1 - MULTIPLY(z3, FIX_1_847759065); /* c2+c6 */ - - /* Add fudge factor here for final descale. */ - z2 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); - z3 = (INT32) wsptr[4]; - - tmp0 = (z2 + z3) << CONST_BITS; - tmp1 = (z2 - z3) << CONST_BITS; tmp10 = tmp0 + tmp2; tmp13 = tmp0 - tmp2; @@ -4377,8 +4425,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp23 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp23 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp23 <<= CONST_BITS; z1 = (INT32) wsptr[2]; @@ -4558,8 +4608,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp10 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp10 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp10 <<= CONST_BITS; tmp12 = (INT32) wsptr[4]; tmp20 = MULTIPLY(tmp12, FIX(0.707106781)); /* c4 */ @@ -4716,8 +4768,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp12 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp12 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp12 <<= CONST_BITS; tmp13 = (INT32) wsptr[2]; tmp14 = (INT32) wsptr[4]; @@ -4908,8 +4962,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp2 = (INT32) wsptr[2]; tmp10 = (tmp0 + tmp2) << CONST_BITS; @@ -5021,8 +5077,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp0 = (INT32) wsptr[0] + (ONE << (PASS1_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 = (INT32) wsptr[0] + + ((((INT32) RANGE_CENTER) << (PASS1_BITS+3)) + + (ONE << (PASS1_BITS+2))); tmp0 <<= CONST_BITS; tmp2 = (INT32) wsptr[2]; tmp12 = MULTIPLY(tmp2, FIX(0.707106781)); /* c2 */ @@ -5117,8 +5175,10 @@ /* Even part */ - /* Add fudge factor here for final descale. */ - tmp10 = wsptr[0] + (ONE << (CONST_BITS+2)); + /* Add range center and fudge factor for final descale and range-limit. */ + tmp10 = wsptr[0] + + ((((INT32) RANGE_CENTER) << (CONST_BITS+3)) + + (ONE << (CONST_BITS+2))); /* Odd part */ @@ -5148,20 +5208,20 @@ JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col) { - INT32 tmp0, tmp1; + DCTELEM tmp0, tmp1; ISLOW_MULT_TYPE * quantptr; JSAMPLE *range_limit = IDCT_range_limit(cinfo); - SHIFT_TEMPS + ISHIFT_TEMPS /* Process 1 column from input, store into output array. */ quantptr = (ISLOW_MULT_TYPE *) compptr->dct_table; /* Even part */ - + tmp0 = DEQUANTIZE(coef_block[DCTSIZE*0], quantptr[DCTSIZE*0]); - /* Add fudge factor here for final descale. */ - tmp0 += ONE << 2; + /* Add range center and fudge factor for final descale and range-limit. */ + tmp0 += (((DCTELEM) RANGE_CENTER) << 3) + (1 << 2); /* Odd part */ @@ -5169,10 +5229,10 @@ /* Final output stage */ - output_buf[0][output_col] = range_limit[(int) RIGHT_SHIFT(tmp0 + tmp1, 3) - & RANGE_MASK]; - output_buf[1][output_col] = range_limit[(int) RIGHT_SHIFT(tmp0 - tmp1, 3) - & RANGE_MASK]; + output_buf[0][output_col] = + range_limit[(int) IRIGHT_SHIFT(tmp0 + tmp1, 3) & RANGE_MASK]; + output_buf[1][output_col] = + range_limit[(int) IRIGHT_SHIFT(tmp0 - tmp1, 3) & RANGE_MASK]; } #endif /* IDCT_SCALING_SUPPORTED */ Modified: trunk/reactos/dll/3rdparty/libjpeg/rdswitch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/rdswi…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/rdswitch.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/rdswitch.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,6 +2,7 @@ * rdswitch.c * * Copyright (C) 1991-1996, Thomas G. Lane. + * Modified 2003-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -347,8 +348,9 @@ return FALSE; if ((ch1 != 'x' && ch1 != 'X') || ch2 != ',') /* syntax check */ return FALSE; - if (val1 <= 0 || val1 > 4 || val2 <= 0 || val2 > 4) { - fprintf(stderr, "JPEG sampling factors must be 1..4\n"); + if (val1 <= 0 || val1 > MAX_SAMP_FACTOR || + val2 <= 0 || val2 > MAX_SAMP_FACTOR) { + fprintf(stderr, "JPEG sampling factors must be 1..%d\n", MAX_SAMP_FACTOR); return FALSE; } cinfo->comp_info[ci].h_samp_factor = val1; Modified: trunk/reactos/dll/3rdparty/libjpeg/wrgif.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/wrgif…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/wrgif.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/wrgif.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,6 +2,7 @@ * wrgif.c * * Copyright (C) 1991-1997, Thomas G. Lane. + * Modified 2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -218,7 +219,7 @@ LOCAL(void) emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap) /* Output the GIF file header, including color map */ -/* If colormap==NULL, synthesize a gray-scale colormap */ +/* If colormap==NULL, synthesize a grayscale colormap */ { int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte; int cshift = dinfo->cinfo->data_precision - 8; @@ -270,7 +271,7 @@ put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift); } } else { - /* Create a gray-scale map of num_colors values, range 0..255 */ + /* Create a grayscale map of num_colors values, range 0..255 */ put_3bytes(dinfo, (i * 255 + (num_colors-1)/2) / (num_colors-1)); } } else { @@ -393,7 +394,7 @@ ((j_common_ptr) cinfo, JPOOL_IMAGE, cinfo->output_width, (JDIMENSION) 1); dest->pub.buffer_height = 1; - return (djpeg_dest_ptr) dest; + return &dest->pub; } #endif /* GIF_SUPPORTED */ Modified: trunk/reactos/dll/3rdparty/libjpeg/wrjpgcom.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/wrjpg…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/wrjpgcom.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/wrjpgcom.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,6 +2,7 @@ * wrjpgcom.c * * Copyright (C) 1994-1997, Thomas G. Lane. + * Modified 2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -453,6 +454,11 @@ comment_arg = (char *) malloc((size_t) MAX_COM_LENGTH); if (comment_arg == NULL) ERREXIT("Insufficient memory"); + if (strlen(argv[argn]+1) >= (size_t) MAX_COM_LENGTH) { + fprintf(stderr, "Comment text may not exceed %u bytes\n", + (unsigned int) MAX_COM_LENGTH); + exit(EXIT_FAILURE); + } strcpy(comment_arg, argv[argn]+1); for (;;) { comment_length = (unsigned int) strlen(comment_arg); @@ -462,9 +468,19 @@ } if (++argn >= argc) ERREXIT("Missing ending quote mark"); + if (strlen(comment_arg) + 1 + strlen(argv[argn]) >= + (size_t) MAX_COM_LENGTH) { + fprintf(stderr, "Comment text may not exceed %u bytes\n", + (unsigned int) MAX_COM_LENGTH); + exit(EXIT_FAILURE); + } strcat(comment_arg, " "); strcat(comment_arg, argv[argn]); } + } else if (strlen(comment_arg) >= (size_t) MAX_COM_LENGTH) { + fprintf(stderr, "Comment text may not exceed %u bytes\n", + (unsigned int) MAX_COM_LENGTH); + exit(EXIT_FAILURE); } comment_length = (unsigned int) strlen(comment_arg); } else Modified: trunk/reactos/dll/3rdparty/libjpeg/wrtarga.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libjpeg/wrtar…
============================================================================== --- trunk/reactos/dll/3rdparty/libjpeg/wrtarga.c [iso-8859-1] (original) +++ trunk/reactos/dll/3rdparty/libjpeg/wrtarga.c [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,6 +2,7 @@ * wrtarga.c * * Copyright (C) 1991-1996, Thomas G. Lane. + * Modified 2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -73,7 +74,7 @@ targaheader[17] = 0x20; /* Top-down, non-interlaced */ if (cinfo->out_color_space == JCS_GRAYSCALE) { - targaheader[2] = 3; /* image type = uncompressed gray-scale */ + targaheader[2] = 3; /* image type = uncompressed grayscale */ targaheader[16] = 8; /* bits per pixel */ } else { /* must be RGB */ if (num_colors > 0) { @@ -247,7 +248,7 @@ ((j_common_ptr) cinfo, JPOOL_IMAGE, dest->buffer_width, (JDIMENSION) 1); dest->pub.buffer_height = 1; - return (djpeg_dest_ptr) dest; + return &dest->pub; } #endif /* TARGA_SUPPORTED */ Modified: trunk/reactos/sdk/include/reactos/libs/libjpeg/jconfig.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/libs/l…
============================================================================== --- trunk/reactos/sdk/include/reactos/libs/libjpeg/jconfig.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/reactos/libs/libjpeg/jconfig.h [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -1,9 +1,16 @@ #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT - +/* #define void char */ +/* #define const */ +#undef CHAR_IS_UNSIGNED #define HAVE_STDDEF_H #define HAVE_STDLIB_H +#undef NEED_BSD_STRINGS +#undef NEED_SYS_TYPES_H +#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ +#undef NEED_SHORT_EXTERNAL_NAMES +#undef INCOMPLETE_TYPES_BROKEN /* Define "boolean" as unsigned char, not enum, per Windows custom */ #ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */ @@ -17,8 +24,9 @@ #endif #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ -#undef NEED_BSD_STRINGS -#undef NEED_SYS_TYPES_H -#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */ -#undef NEED_SHORT_EXTERNAL_NAMES -#undef INCOMPLETE_TYPES_BROKEN + +#ifdef JPEG_INTERNALS + +#undef RIGHT_SHIFT_IS_UNSIGNED + +#endif /* JPEG_INTERNALS */ Modified: trunk/reactos/sdk/include/reactos/libs/libjpeg/jdct.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/libs/l…
============================================================================== --- trunk/reactos/sdk/include/reactos/libs/libjpeg/jdct.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/reactos/libs/libjpeg/jdct.h [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,6 +2,7 @@ * jdct.h * * Copyright (C) 1994-1996, Thomas G. Lane. + * Modified 2002-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -78,13 +79,16 @@ * converting them to unsigned form (0..MAXJSAMPLE). The raw outputs could * be quite far out of range if the input data is corrupt, so a bulletproof * range-limiting step is required. We use a mask-and-table-lookup method - * to do the combined operations quickly. See the comments with - * prepare_range_limit_table (in jdmaster.c) for more info. - */ - -#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit + CENTERJSAMPLE) + * to do the combined operations quickly, assuming that MAXJSAMPLE+1 + * is a power of 2. See the comments with prepare_range_limit_table + * (in jdmaster.c) for more info. + */ #define RANGE_MASK (MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */ +#define RANGE_CENTER (MAXJSAMPLE * 2 + 2) +#define RANGE_SUBSET (RANGE_CENTER - CENTERJSAMPLE) + +#define IDCT_range_limit(cinfo) ((cinfo)->sample_range_limit - RANGE_SUBSET) /* Short forms of external names for systems with brain-damaged linkers. */ @@ -391,3 +395,23 @@ #ifndef MULTIPLY16V16 /* default definition */ #define MULTIPLY16V16(var1,var2) ((var1) * (var2)) #endif + +/* Like RIGHT_SHIFT, but applies to a DCTELEM. + * We assume that int right shift is unsigned if INT32 right shift is. + */ + +#ifdef RIGHT_SHIFT_IS_UNSIGNED +#define ISHIFT_TEMPS DCTELEM ishift_temp; +#if BITS_IN_JSAMPLE == 8 +#define DCTELEMBITS 16 /* DCTELEM may be 16 or 32 bits */ +#else +#define DCTELEMBITS 32 /* DCTELEM must be 32 bits */ +#endif +#define IRIGHT_SHIFT(x,shft) \ + ((ishift_temp = (x)) < 0 ? \ + (ishift_temp >> (shft)) | ((~((DCTELEM) 0)) << (DCTELEMBITS-(shft))) : \ + (ishift_temp >> (shft))) +#else +#define ISHIFT_TEMPS +#define IRIGHT_SHIFT(x,shft) ((x) >> (shft)) +#endif Modified: trunk/reactos/sdk/include/reactos/libs/libjpeg/jpeglib.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/libs/l…
============================================================================== --- trunk/reactos/sdk/include/reactos/libs/libjpeg/jpeglib.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/reactos/libs/libjpeg/jpeglib.h [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -2,7 +2,7 @@ * jpeglib.h * * Copyright (C) 1991-1998, Thomas G. Lane. - * Modified 2002-2013 by Guido Vollbeding. + * Modified 2002-2015 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -39,7 +39,7 @@ #define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */ #define JPEG_LIB_VERSION_MAJOR 9 -#define JPEG_LIB_VERSION_MINOR 1 +#define JPEG_LIB_VERSION_MINOR 2 /* Various constants determining the sizes of things. @@ -979,7 +979,7 @@ unsigned char ** outbuffer, unsigned long * outsize)); EXTERN(void) jpeg_mem_src JPP((j_decompress_ptr cinfo, - unsigned char * inbuffer, + const unsigned char * inbuffer, unsigned long insize)); /* Default parameter setup for compression */ Modified: trunk/reactos/sdk/include/reactos/libs/libjpeg/jversion.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/libs/l…
============================================================================== --- trunk/reactos/sdk/include/reactos/libs/libjpeg/jversion.h [iso-8859-1] (original) +++ trunk/reactos/sdk/include/reactos/libs/libjpeg/jversion.h [iso-8859-1] Fri Feb 17 11:05:50 2017 @@ -1,7 +1,7 @@ /* * jversion.h * - * Copyright (C) 1991-2014, Thomas G. Lane, Guido Vollbeding. + * Copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -9,6 +9,6 @@ */ -#define JVERSION "9a 19-Jan-2014" +#define JVERSION "9b 17-Jan-2016" -#define JCOPYRIGHT "Copyright (C) 2014, Thomas G. Lane, Guido Vollbeding" +#define JCOPYRIGHT "Copyright (C) 2016, Thomas G. Lane, Guido Vollbeding"
7 years, 8 months
1
0
0
0
[tfaber] 73804: [LIBPNG] - Update to version 1.6.28 CORE-12775
by tfaber@svn.reactos.org
Author: tfaber Date: Fri Feb 17 10:42:03 2017 New Revision: 73804 URL:
http://svn.reactos.org/svn/reactos?rev=73804&view=rev
Log: [LIBPNG] - Update to version 1.6.28 CORE-12775 Modified: trunk/reactos/dll/3rdparty/libpng/docs/ANNOUNCE trunk/reactos/dll/3rdparty/libpng/docs/CHANGES trunk/reactos/dll/3rdparty/libpng/docs/INSTALL trunk/reactos/dll/3rdparty/libpng/docs/LICENSE trunk/reactos/dll/3rdparty/libpng/docs/README trunk/reactos/dll/3rdparty/libpng/docs/TODO trunk/reactos/dll/3rdparty/libpng/docs/example.c trunk/reactos/dll/3rdparty/libpng/docs/libpng-manual.txt trunk/reactos/dll/3rdparty/libpng/png.c trunk/reactos/dll/3rdparty/libpng/pngerror.c trunk/reactos/dll/3rdparty/libpng/pngget.c trunk/reactos/dll/3rdparty/libpng/pngmem.c trunk/reactos/dll/3rdparty/libpng/pngpread.c trunk/reactos/dll/3rdparty/libpng/pngpriv.h trunk/reactos/dll/3rdparty/libpng/pngread.c trunk/reactos/dll/3rdparty/libpng/pngrio.c trunk/reactos/dll/3rdparty/libpng/pngrtran.c trunk/reactos/dll/3rdparty/libpng/pngrutil.c trunk/reactos/dll/3rdparty/libpng/pngset.c trunk/reactos/dll/3rdparty/libpng/pngstruct.h trunk/reactos/dll/3rdparty/libpng/pngtrans.c trunk/reactos/dll/3rdparty/libpng/pngwio.c trunk/reactos/dll/3rdparty/libpng/pngwrite.c trunk/reactos/dll/3rdparty/libpng/pngwtran.c trunk/reactos/dll/3rdparty/libpng/pngwutil.c trunk/reactos/sdk/include/reactos/libs/libpng/png.h trunk/reactos/sdk/include/reactos/libs/libpng/pngconf.h trunk/reactos/sdk/include/reactos/libs/libpng/pnglibconf.h [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/3rdparty/libpng/docs/ANNOUNCE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/docs/A…
Modified: trunk/reactos/dll/3rdparty/libpng/docs/CHANGES URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/docs/C…
Modified: trunk/reactos/dll/3rdparty/libpng/docs/INSTALL URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/docs/I…
Modified: trunk/reactos/dll/3rdparty/libpng/docs/LICENSE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/docs/L…
Modified: trunk/reactos/dll/3rdparty/libpng/docs/README URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/docs/R…
Modified: trunk/reactos/dll/3rdparty/libpng/docs/TODO URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/docs/T…
Modified: trunk/reactos/dll/3rdparty/libpng/docs/example.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/docs/e…
Modified: trunk/reactos/dll/3rdparty/libpng/docs/libpng-manual.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/docs/l…
Modified: trunk/reactos/dll/3rdparty/libpng/png.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/png.c?…
Modified: trunk/reactos/dll/3rdparty/libpng/pngerror.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngerr…
Modified: trunk/reactos/dll/3rdparty/libpng/pngget.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngget…
Modified: trunk/reactos/dll/3rdparty/libpng/pngmem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngmem…
Modified: trunk/reactos/dll/3rdparty/libpng/pngpread.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngpre…
Modified: trunk/reactos/dll/3rdparty/libpng/pngpriv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngpri…
Modified: trunk/reactos/dll/3rdparty/libpng/pngread.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngrea…
Modified: trunk/reactos/dll/3rdparty/libpng/pngrio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngrio…
Modified: trunk/reactos/dll/3rdparty/libpng/pngrtran.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngrtr…
Modified: trunk/reactos/dll/3rdparty/libpng/pngrutil.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngrut…
Modified: trunk/reactos/dll/3rdparty/libpng/pngset.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngset…
Modified: trunk/reactos/dll/3rdparty/libpng/pngstruct.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngstr…
Modified: trunk/reactos/dll/3rdparty/libpng/pngtrans.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngtra…
Modified: trunk/reactos/dll/3rdparty/libpng/pngwio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngwio…
Modified: trunk/reactos/dll/3rdparty/libpng/pngwrite.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngwri…
Modified: trunk/reactos/dll/3rdparty/libpng/pngwtran.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngwtr…
Modified: trunk/reactos/dll/3rdparty/libpng/pngwutil.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/3rdparty/libpng/pngwut…
Modified: trunk/reactos/sdk/include/reactos/libs/libpng/png.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/libs/l…
Modified: trunk/reactos/sdk/include/reactos/libs/libpng/pngconf.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/libs/l…
Modified: trunk/reactos/sdk/include/reactos/libs/libpng/pnglibconf.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/sdk/include/reactos/libs/l…
7 years, 8 months
1
0
0
0
[gadamopoulos] 73803: [COMCTL32] - Add and install a manifest for comctl32 version 5.82. - Since our comctl32 tries to imitate both version 5 and version 6, register its classes twice, once while h...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Fri Feb 17 10:04:24 2017 New Revision: 73803 URL:
http://svn.reactos.org/svn/reactos?rev=73803&view=rev
Log: [COMCTL32] - Add and install a manifest for comctl32 version 5.82. - Since our comctl32 tries to imitate both version 5 and version 6, register its classes twice, once while having the version 6 manifest active and once when having the version 5 active. - Register the themed versions of the built in controls while having the version 6 manifest active (and register them as global classes). This breaks theming of built in controls until versioned classes get implemented. - Do not try to subclass the dialog class. This is incorrect and can lead to problems like in CORE-8534, CORE-12727, CORE-8387. This removes the background texture of the themed tabs which will be implemented in the future in uxtheme using api hooks. This breaks a great deal of theming but keep in mind that it is in the middle of a transition to have them implemented correctly without the terrible side effects (broken ansi conversion, not always using themes for built in controls. However comctl32 is now ready for versioned classes to be enabled. CORE-12285 Added: trunk/reactos/dll/win32/comctl32/comctl32v5.manifest (with props) Modified: trunk/reactos/dll/win32/comctl32/comctl32.h trunk/reactos/dll/win32/comctl32/comctl32.manifest trunk/reactos/dll/win32/comctl32/commctrl.c trunk/reactos/dll/win32/comctl32/rsrc.rc trunk/reactos/dll/win32/comctl32/theming.c Modified: trunk/reactos/dll/win32/comctl32/comctl32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl3…
============================================================================== --- trunk/reactos/dll/win32/comctl32/comctl32.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/comctl32.h [iso-8859-1] Fri Feb 17 10:04:24 2017 @@ -165,7 +165,7 @@ int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace) DECLSPEC_HIDDEN; LONG MONTHCAL_CompareSystemTime(const SYSTEMTIME *first, const SYSTEMTIME *second) DECLSPEC_HIDDEN; -extern void THEMING_Initialize(void) DECLSPEC_HIDDEN; +extern void THEMING_Initialize(HANDLE hActCtx5, HANDLE hActCtx6) DECLSPEC_HIDDEN; extern void THEMING_Uninitialize(void) DECLSPEC_HIDDEN; extern LRESULT THEMING_CallOriginalClass(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN; extern void THEMING_SetSubclassData(HWND, ULONG_PTR) DECLSPEC_HIDDEN; Modified: trunk/reactos/dll/win32/comctl32/comctl32.manifest URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl3…
============================================================================== --- trunk/reactos/dll/win32/comctl32/comctl32.manifest [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/comctl32.manifest [iso-8859-1] Fri Feb 17 10:04:24 2017 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> - <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.2600.2982" processorArchitecture="" publicKeyToken="6595b64144ccf1df"/> + <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.2600.2982" publicKeyToken="6595b64144ccf1df"/> <file name="comctl32.dll"> <windowClass>Button</windowClass> <windowClass>ButtonListBox</windowClass> @@ -12,7 +12,6 @@ <windowClass>NativeFontCtl</windowClass> <windowClass>ReBarWindow32</windowClass> <windowClass>ScrollBar</windowClass> - <windowClass>Static</windowClass> <windowClass>SysAnimate32</windowClass> <windowClass>SysDateTimePick32</windowClass> <windowClass>SysHeader32</windowClass> Added: trunk/reactos/dll/win32/comctl32/comctl32v5.manifest URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/comctl3…
============================================================================== --- trunk/reactos/dll/win32/comctl32/comctl32v5.manifest (added) +++ trunk/reactos/dll/win32/comctl32/comctl32v5.manifest [iso-8859-1] Fri Feb 17 10:04:24 2017 @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> + <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="5.82.2600.2982" publicKeyToken="6595b64144ccf1df"/> + <file name="comctl32.dll"> + <windowClass versioned="no">Button</windowClass> + <windowClass versioned="no">ButtonListBox</windowClass> + <windowClass versioned="no">ComboBoxEx32</windowClass> + <windowClass versioned="no">ComboLBox</windowClass> + <windowClass versioned="no">Combobox</windowClass> + <windowClass versioned="no">Edit</windowClass> + <windowClass versioned="no">Listbox</windowClass> + <windowClass versioned="no">NativeFontCtl</windowClass> + <windowClass versioned="no">ReBarWindow32</windowClass> + <windowClass versioned="no">ScrollBar</windowClass> + <windowClass versioned="no">SysAnimate32</windowClass> + <windowClass versioned="no">SysDateTimePick32</windowClass> + <windowClass versioned="no">SysHeader32</windowClass> + <windowClass versioned="no">SysIPAddress32</windowClass> + <windowClass versioned="no">SysLink</windowClass> + <windowClass versioned="no">SysListView32</windowClass> + <windowClass versioned="no">SysMonthCal32</windowClass> + <windowClass versioned="no">SysPager</windowClass> + <windowClass versioned="no">SysTabControl32</windowClass> + <windowClass versioned="no">SysTreeView32</windowClass> + <windowClass versioned="no">ToolbarWindow32</windowClass> + <windowClass versioned="no">msctls_hotkey32</windowClass> + <windowClass versioned="no">msctls_progress32</windowClass> + <windowClass versioned="no">msctls_statusbar32</windowClass> + <windowClass versioned="no">msctls_trackbar32</windowClass> + <windowClass versioned="no">msctls_updown32</windowClass> + <windowClass versioned="no">tooltips_class32</windowClass> + </file> +</assembly> Propchange: trunk/reactos/dll/win32/comctl32/comctl32v5.manifest ------------------------------------------------------------------------------ svn:eol-style = CRLF Modified: trunk/reactos/dll/win32/comctl32/commctrl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/commctr…
============================================================================== --- trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] Fri Feb 17 10:04:24 2017 @@ -60,7 +60,32 @@ WINE_DEFAULT_DEBUG_CHANNEL(commctrl); +static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + +static LPWSTR COMCTL32_wSubclass = NULL; +HMODULE COMCTL32_hModule = 0; +static LANGID COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); +HBRUSH COMCTL32_hPattern55AABrush = NULL; +COMCTL32_SysColor comctl32_color; + +static HBITMAP COMCTL32_hPattern55AABitmap = NULL; + +static const WORD wPattern55AA[] = +{ + 0x5555, 0xaaaa, 0x5555, 0xaaaa, + 0x5555, 0xaaaa, 0x5555, 0xaaaa +}; + +static const WCHAR strCC32SubclassInfo[] = { + 'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0 +}; + +#ifdef __REACTOS__ + +#include <strsafe.h> + #define NAME L"microsoft.windows.common-controls" +#define VERSION_V5 L"5.82.2600.2982" #define VERSION L"6.0.2600.2982" #define PUBLIC_KEY L"6595b64144ccf1df" @@ -73,38 +98,51 @@ #endif static const WCHAR manifest_filename[] = ARCH L"_" NAME L"_" PUBLIC_KEY L"_" VERSION L"_none_deadbeef.manifest"; - -static LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - -static LPWSTR COMCTL32_wSubclass = NULL; -HMODULE COMCTL32_hModule = 0; -static LANGID COMCTL32_uiLang = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); -HBRUSH COMCTL32_hPattern55AABrush = NULL; -COMCTL32_SysColor comctl32_color; - -static HBITMAP COMCTL32_hPattern55AABitmap = NULL; - -static const WORD wPattern55AA[] = -{ - 0x5555, 0xaaaa, 0x5555, 0xaaaa, - 0x5555, 0xaaaa, 0x5555, 0xaaaa -}; - -static const WCHAR strCC32SubclassInfo[] = { - 'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0 -}; - -static BOOL create_manifest(BOOL install) +static const WCHAR manifest_filename_v5[] = ARCH L"_" NAME L"_" PUBLIC_KEY L"_" VERSION_V5 L"_none_deadbeef.manifest"; + +static WCHAR* GetManifestPath(BOOL create, BOOL bV6) +{ + WCHAR *pwszBuf; + HRESULT hres; + + pwszBuf = HeapAlloc(GetProcessHeap(), 0, MAX_PATH * sizeof(WCHAR)); + if (!pwszBuf) + return NULL; + + GetWindowsDirectoryW(pwszBuf, MAX_PATH); + hres = StringCchCatW(pwszBuf, MAX_PATH, L"\\winsxs"); + if (FAILED(hres)) + return NULL; + if (create) + CreateDirectoryW(pwszBuf, NULL); + hres = StringCchCatW(pwszBuf, MAX_PATH, L"\\manifests\\"); + if (FAILED(hres)) + return NULL; + if (create) + CreateDirectoryW(pwszBuf, NULL); + + hres = StringCchCatW(pwszBuf, MAX_PATH, bV6 ? manifest_filename : manifest_filename_v5); + if (FAILED(hres)) + return NULL; + + return pwszBuf; +} + +static BOOL create_manifest(BOOL install, BOOL bV6) { WCHAR *pwszBuf; HRSRC hResInfo; HGLOBAL hResData; PVOID pManifest; - DWORD cchBuf, cbManifest, cbWritten; + DWORD cbManifest, cbWritten; HANDLE hFile; BOOL bRet = FALSE; - hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFEST", (LPWSTR)RT_MANIFEST); + if (bV6) + hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFEST", (LPWSTR)RT_MANIFEST); + else + hResInfo = FindResourceW(COMCTL32_hModule, L"WINE_MANIFESTV5", (LPWSTR)RT_MANIFEST); + if (!hResInfo) return FALSE; @@ -120,17 +158,10 @@ if (!pManifest) return FALSE; - cchBuf = GetWindowsDirectoryW(NULL, 0) * sizeof(WCHAR) + sizeof(L"\\winsxs\\manifests\\") + sizeof(manifest_filename); - pwszBuf = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, cchBuf * sizeof(WCHAR)); + pwszBuf = GetManifestPath(TRUE, bV6); if (!pwszBuf) return FALSE; - GetWindowsDirectoryW(pwszBuf, cchBuf); - lstrcatW(pwszBuf, L"\\winsxs"); - CreateDirectoryW(pwszBuf, NULL); - lstrcatW(pwszBuf, L"\\manifests\\"); - CreateDirectoryW(pwszBuf, NULL); - lstrcatW(pwszBuf, manifest_filename); if (install) { hFile = CreateFileW(pwszBuf, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); @@ -155,6 +186,134 @@ return bRet; } +static HANDLE CreateComctl32ActCtx(BOOL bV6) +{ + HANDLE ret; + WCHAR* pwstrSource; + ACTCTXW ActCtx = {sizeof(ACTCTX)}; + + pwstrSource = GetManifestPath(FALSE, bV6); + if (!pwstrSource) + { + ERR("GetManifestPath failed! bV6=%d\n", bV6); + return INVALID_HANDLE_VALUE; + } + ActCtx.lpSource = pwstrSource; + ret = CreateActCtxW(&ActCtx); + HeapFree(GetProcessHeap(), 0, pwstrSource); + if (ret == INVALID_HANDLE_VALUE) + ERR("CreateActCtxW failed! bV6=%d\n", bV6); + return ret; +} + +static void RegisterControls() +{ + ANIMATE_Register (); + COMBOEX_Register (); + DATETIME_Register (); + FLATSB_Register (); + HEADER_Register (); + HOTKEY_Register (); + IPADDRESS_Register (); + LISTVIEW_Register (); + MONTHCAL_Register (); + NATIVEFONT_Register (); + PAGER_Register (); + PROGRESS_Register (); + REBAR_Register (); + STATUS_Register (); + SYSLINK_Register (); + TAB_Register (); + TOOLBAR_Register (); + TOOLTIPS_Register (); + TRACKBAR_Register (); + TREEVIEW_Register (); + UPDOWN_Register (); +} + +static void UnregisterControls() +{ + ANIMATE_Unregister (); + COMBOEX_Unregister (); + DATETIME_Unregister (); + FLATSB_Unregister (); + HEADER_Unregister (); + HOTKEY_Unregister (); + IPADDRESS_Unregister (); + LISTVIEW_Unregister (); + MONTHCAL_Unregister (); + NATIVEFONT_Unregister (); + PAGER_Unregister (); + PROGRESS_Unregister (); + REBAR_Unregister (); + STATUS_Unregister (); + SYSLINK_Unregister (); + TAB_Unregister (); + TOOLBAR_Unregister (); + TOOLTIPS_Unregister (); + TRACKBAR_Unregister (); + TREEVIEW_Unregister (); + UPDOWN_Unregister (); +} + +static void InitializeClasses() +{ + HANDLE hActCtx5, hActCtx6; + BOOL activated; + ULONG_PTR ulCookie; + + /* like comctl32 5.82+ register all the common control classes */ + /* Register the classes once no matter what */ + hActCtx5 = CreateComctl32ActCtx(FALSE); + activated = (hActCtx5 != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx5, &ulCookie) : FALSE); + RegisterControls(); /* Register the classes pretending to be v5 */ + if (activated) DeactivateActCtx(0, ulCookie); + + hActCtx6 = CreateComctl32ActCtx(TRUE); + if (hActCtx6 != INVALID_HANDLE_VALUE) + { + activated = ActivateActCtx(hActCtx6, &ulCookie); + RegisterControls(); /* Register the classes pretending to be v6 */ + if (activated) DeactivateActCtx(0, ulCookie); + + /* Initialize the themed controls only when the v6 manifest is present */ + THEMING_Initialize (hActCtx5, hActCtx6); + } +} + +static void UninitializeClasses() +{ + HANDLE hActCtx5, hActCtx6; + BOOL activated; + ULONG_PTR ulCookie; + + hActCtx5 = CreateComctl32ActCtx(FALSE); + activated = (hActCtx5 != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx5, &ulCookie) : FALSE); + UnregisterControls(); + if (activated) DeactivateActCtx(0, ulCookie); + + hActCtx6 = CreateComctl32ActCtx(TRUE); + if (hActCtx6 != INVALID_HANDLE_VALUE) + { + activated = ActivateActCtx(hActCtx6, &ulCookie); + THEMING_Uninitialize(); + UnregisterControls(); + if (activated) DeactivateActCtx(0, ulCookie); + } +} + +/*********************************************************************** + * RegisterClassNameW [COMCTL32.@] + * + * Register window class again while using as SxS module. + */ +BOOLEAN WINAPI RegisterClassNameW(LPCWSTR className) +{ + InitializeClasses(); + return TRUE; +} + +#endif /*********************************************************************** * DllMain [Internal] @@ -192,6 +351,7 @@ /* Get all the colors at DLL load */ COMCTL32_RefreshSysColors(); +#ifndef __REACTOS__ /* like comctl32 5.82+ register all the common control classes */ ANIMATE_Register (); COMBOEX_Register (); @@ -217,10 +377,15 @@ /* subclass user32 controls */ THEMING_Initialize (); +#else + InitializeClasses(); +#endif + break; case DLL_PROCESS_DETACH: if (lpvReserved) break; +#ifndef __REACTOS__ /* clean up subclassing */ THEMING_Uninitialize(); @@ -246,7 +411,9 @@ TRACKBAR_Unregister (); TREEVIEW_Unregister (); UPDOWN_Unregister (); - +#else + UninitializeClasses(); +#endif /* delete local pattern brush */ DeleteObject (COMCTL32_hPattern55AABrush); DeleteObject (COMCTL32_hPattern55AABitmap); @@ -991,11 +1158,21 @@ HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline) { TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline)); - if (!create_manifest(bInstall)) + +#ifdef __REACTOS__ + + if (!create_manifest(bInstall, TRUE)) { - ERR("create_manifest failed!\n"); + ERR("Failed to install comctl32 v6 manifest!\n"); return HRESULT_FROM_WIN32(GetLastError()); } + + if (!create_manifest(bInstall, FALSE)) + { + ERR("Failed to install comctl32 v5 manifest!\n"); + return HRESULT_FROM_WIN32(GetLastError()); + } +#endif return S_OK; } @@ -1856,15 +2033,3 @@ return LoadIconWithScaleDown(hinst, name, cx, cy, icon); } - -/*********************************************************************** - * RegisterClassNameW [COMCTL32.@] - * - * Register window class again while using as SxS module. - */ -BOOLEAN WINAPI RegisterClassNameW(LPCWSTR className) -{ - /* FIXME: actually register redirected user32 class, - comctl32 classes are registered by this module anyway */ - return TRUE; -} Modified: trunk/reactos/dll/win32/comctl32/rsrc.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/rsrc.rc…
============================================================================== --- trunk/reactos/dll/win32/comctl32/rsrc.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/rsrc.rc [iso-8859-1] Fri Feb 17 10:04:24 2017 @@ -38,6 +38,7 @@ /* @makedep: comctl32.manifest */ WINE_MANIFEST RT_MANIFEST comctl32.manifest +WINE_MANIFESTV5 RT_MANIFEST comctl32v5.manifest /* @makedep: idt_check.bmp */ IDT_CHECK BITMAP idt_check.bmp Modified: trunk/reactos/dll/win32/comctl32/theming.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theming…
============================================================================== --- trunk/reactos/dll/win32/comctl32/theming.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/theming.c [iso-8859-1] Fri Feb 17 10:04:24 2017 @@ -30,8 +30,6 @@ ULONG_PTR) DECLSPEC_HIDDEN; extern LRESULT CALLBACK THEMING_ComboSubclassProc (HWND, UINT, WPARAM, LPARAM, ULONG_PTR) DECLSPEC_HIDDEN; -extern LRESULT CALLBACK THEMING_DialogSubclassProc (HWND, UINT, WPARAM, LPARAM, - ULONG_PTR) DECLSPEC_HIDDEN; extern LRESULT CALLBACK THEMING_EditSubclassProc (HWND, UINT, WPARAM, LPARAM, ULONG_PTR) DECLSPEC_HIDDEN; extern LRESULT CALLBACK THEMING_ListBoxSubclassProc (HWND, UINT, WPARAM, LPARAM, @@ -48,7 +46,6 @@ THEMING_SUBCLASSPROC subclassProc; } subclasses[] = { /* Note: list must be sorted by class name */ - {dialogClass, THEMING_DialogSubclassProc}, {WC_BUTTONW, THEMING_ButtonSubclassProc}, {WC_COMBOBOXW, THEMING_ComboSubclassProc}, {comboLboxClass, THEMING_ListBoxSubclassProc}, @@ -90,7 +87,6 @@ MAKE_SUBCLASS_PROC(3) MAKE_SUBCLASS_PROC(4) MAKE_SUBCLASS_PROC(5) -MAKE_SUBCLASS_PROC(6) static const WNDPROC subclassProcs[NUM_SUBCLASSES] = { subclass_proc0, @@ -98,8 +94,7 @@ subclass_proc2, subclass_proc3, subclass_proc4, - subclass_proc5, - subclass_proc6 + subclass_proc5 }; /*********************************************************************** @@ -108,15 +103,15 @@ * Register classes for standard controls that will shadow the system * classes. */ -void THEMING_Initialize (void) +void THEMING_Initialize (HANDLE hActCtx5, HANDLE hActCtx6) { unsigned int i; static const WCHAR subclassPropName[] = { 'C','C','3','2','T','h','e','m','i','n','g','S','u','b','C','l',0 }; static const WCHAR refDataPropName[] = { 'C','C','3','2','T','h','e','m','i','n','g','D','a','t','a',0 }; - - if (!IsThemeActive()) return; + ULONG_PTR ulCookie; + BOOL ret, bActivated; atSubclassProp = GlobalAddAtomW (subclassPropName); atRefDataProp = GlobalAddAtomW (refDataPropName); @@ -126,7 +121,13 @@ WNDCLASSEXW class; class.cbSize = sizeof(class); - if (!GetClassInfoExW (NULL, subclasses[i].className, &class)) + + bActivated = ActivateActCtx(hActCtx5, &ulCookie); + ret = GetClassInfoExW (NULL, subclasses[i].className, &class); + if (bActivated) + DeactivateActCtx(0, ulCookie); + + if (!ret) { ERR("Could not retrieve information for class %s\n", debugstr_w (subclasses[i].className)); @@ -134,7 +135,9 @@ } originalProcs[i] = class.lpfnWndProc; class.lpfnWndProc = subclassProcs[i]; - + class.style |= CS_GLOBALCLASS; + class.hInstance = COMCTL32_hModule; + if (!class.lpfnWndProc) { ERR("Missing proc for class %s\n", @@ -142,9 +145,11 @@ continue; } + bActivated = ActivateActCtx(hActCtx6, &ulCookie); + if (!RegisterClassExW (&class)) { - ERR("Could not re-register class %s: %x\n", + WARN("Could not re-register class %s: %x\n", debugstr_w (subclasses[i].className), GetLastError ()); } else @@ -152,6 +157,9 @@ TRACE("Re-registered class %s\n", debugstr_w (subclasses[i].className)); } + + if (bActivated) + DeactivateActCtx(0, ulCookie); } }
7 years, 8 months
1
0
0
0
[khornicek] 73802: [SPIDER] - Make the formatting a bit more consistent. [EVENTVWR] - Remove an useless cast.
by khornicek@svn.reactos.org
Author: khornicek Date: Wed Feb 15 10:53:41 2017 New Revision: 73802 URL:
http://svn.reactos.org/svn/reactos?rev=73802&view=rev
Log: [SPIDER] - Make the formatting a bit more consistent. [EVENTVWR] - Remove an useless cast. Modified: trunk/reactos/base/applications/games/spider/spider.cpp trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c Modified: trunk/reactos/base/applications/games/spider/spider.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/games/sp…
============================================================================== --- trunk/reactos/base/applications/games/spider/spider.cpp [iso-8859-1] (original) +++ trunk/reactos/base/applications/games/spider/spider.cpp [iso-8859-1] Wed Feb 15 10:53:41 2017 @@ -57,21 +57,21 @@ case WM_COMMAND: switch(LOWORD(wParam)) { - case IDOK: - if (IsDlgButtonChecked(hDlg, IDC_DIF_ONECOLOR) == BST_CHECKED) - dwDifficulty = IDC_DIF_ONECOLOR; - else if (IsDlgButtonChecked(hDlg, IDC_DIF_TWOCOLORS) == BST_CHECKED) - dwDifficulty = IDC_DIF_TWOCOLORS; - else if (IsDlgButtonChecked(hDlg, IDC_DIF_FOURCOLORS) == BST_CHECKED) - dwDifficulty = IDC_DIF_FOURCOLORS; - - NewGame(); - EndDialog(hDlg, TRUE); - return TRUE; - - case IDCANCEL: - EndDialog(hDlg, FALSE); - return TRUE; + case IDOK: + if (IsDlgButtonChecked(hDlg, IDC_DIF_ONECOLOR) == BST_CHECKED) + dwDifficulty = IDC_DIF_ONECOLOR; + else if (IsDlgButtonChecked(hDlg, IDC_DIF_TWOCOLORS) == BST_CHECKED) + dwDifficulty = IDC_DIF_TWOCOLORS; + else if (IsDlgButtonChecked(hDlg, IDC_DIF_FOURCOLORS) == BST_CHECKED) + dwDifficulty = IDC_DIF_FOURCOLORS; + + NewGame(); + EndDialog(hDlg, TRUE); + return TRUE; + + case IDCANCEL: + EndDialog(hDlg, FALSE); + return TRUE; } break; } @@ -122,16 +122,16 @@ MakePath(szHelpPath, MAX_PATH, _T(".hlp")); hwnd = CreateWindow(szAppName, - szAppName, - WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, - CW_USEDEFAULT, - 0, /*The real size will be computed in WndProc through WM_GETMINMAXINFO */ - 0, /* The real size will be computed in WndProc through WM_GETMINMAXINFO */ - NULL, - NULL, - hInst, - NULL); + szAppName, + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + 0, /*The real size will be computed in WndProc through WM_GETMINMAXINFO */ + 0, /* The real size will be computed in WndProc through WM_GETMINMAXINFO */ + NULL, + NULL, + hInst, + NULL); hwndMain = hwnd; @@ -142,9 +142,9 @@ DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIFFICULTY), hwnd, DifficultyDlgProc); - while(GetMessage(&msg, NULL,0,0)) - { - if(!TranslateAccelerator(hwnd, hAccelTable, &msg)) + while (GetMessage(&msg, NULL,0,0)) + { + if (!TranslateAccelerator(hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); @@ -153,17 +153,12 @@ return msg.wParam; } -LRESULT CALLBACK -CardImageWndProc(HWND hwnd, - UINT msg, - WPARAM wParam, - LPARAM lParam) -{ - PCARDBACK pCardBack = (PCARDBACK)GetWindowLongPtr(hwnd, - GWL_USERDATA); +LRESULT CALLBACK CardImageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + PCARDBACK pCardBack = (PCARDBACK)GetWindowLongPtr(hwnd, GWL_USERDATA); static WNDPROC hOldProc = NULL; - if(!pCardBack) + if (!pCardBack) return FALSE; if (!hOldProc) @@ -171,55 +166,51 @@ switch (msg) { - case WM_PAINT: - { - HDC hdc; - PAINTSTRUCT ps; - HPEN hPen, hOldPen; - HBRUSH hBrush, hOldBrush; - RECT rc; - - hdc = BeginPaint(hwnd, &ps); - - if (pCardBack->bSelected) - { - hPen = CreatePen(PS_SOLID, 2, RGB(0,0,0)); - } - else - { - DWORD Face = GetSysColor(COLOR_3DFACE); - hPen = CreatePen(PS_SOLID, 2, Face); - } - - GetClientRect(hwnd, &rc); - hBrush = (HBRUSH)GetStockObject(NULL_BRUSH); - hOldPen = (HPEN)SelectObject(hdc, hPen); - hOldBrush = (HBRUSH)SelectObject(hdc, hBrush); - - Rectangle(hdc, - rc.left+1, - rc.top+1, - rc.right, - rc.bottom); - - StretchBlt(hdc, - 2, - 2, - CARDBACK_OPTIONS_WIDTH, - CARDBACK_OPTIONS_HEIGHT, - __hdcCardBitmaps, - pCardBack->hdcNum * __cardwidth, - 0, - __cardwidth, - __cardheight, - SRCCOPY); - - SelectObject(hdc, hOldPen); - SelectObject(hdc, hOldBrush); - - EndPaint(hwnd, &ps); - - break; + case WM_PAINT: + { + HDC hdc; + PAINTSTRUCT ps; + HPEN hPen, hOldPen; + HBRUSH hBrush, hOldBrush; + RECT rc; + + hdc = BeginPaint(hwnd, &ps); + + if (pCardBack->bSelected) + { + hPen = CreatePen(PS_SOLID, 2, RGB(0,0,0)); + } + else + { + DWORD Face = GetSysColor(COLOR_3DFACE); + hPen = CreatePen(PS_SOLID, 2, Face); + } + + GetClientRect(hwnd, &rc); + hBrush = (HBRUSH)GetStockObject(NULL_BRUSH); + hOldPen = (HPEN)SelectObject(hdc, hPen); + hOldBrush = (HBRUSH)SelectObject(hdc, hBrush); + + Rectangle(hdc, rc.left+1, rc.top+1, rc.right, rc.bottom); + + StretchBlt(hdc, + 2, + 2, + CARDBACK_OPTIONS_WIDTH, + CARDBACK_OPTIONS_HEIGHT, + __hdcCardBitmaps, + pCardBack->hdcNum * __cardwidth, + 0, + __cardwidth, + __cardheight, + SRCCOPY); + + SelectObject(hdc, hOldPen); + SelectObject(hdc, hOldBrush); + + EndPaint(hwnd, &ps); + + break; } case WM_LBUTTONDOWN: @@ -227,87 +218,73 @@ break; } - return CallWindowProc(hOldProc, - hwnd, - msg, - wParam, - lParam); -} - - -INT_PTR CALLBACK CardBackDlgProc(HWND hDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) + return CallWindowProc(hOldProc, hwnd, msg, wParam, lParam); +} + + +INT_PTR CALLBACK CardBackDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static PCARDBACK pCardBacks = NULL; switch (uMsg) { - case WM_INITDIALOG: - { - INT i, c; - SIZE_T size = sizeof(CARDBACK) * NUM_CARDBACKS; - - pCardBacks = (PCARDBACK)HeapAlloc(GetProcessHeap(), 0, size); - - if(!pCardBacks) - return FALSE; - - for (i = 0, c = CARDBACK_START; c <= CARDBACK_END; i++, c++) - { - pCardBacks[i].hSelf = GetDlgItem(hDlg, c); - pCardBacks[i].bSelected = FALSE; - pCardBacks[i].hdcNum = CARDBACK_RES_START + i; - pCardBacks[i].imgNum = i + 1; - pCardBacks[i].hOldProc = (WNDPROC)SetWindowLongPtr(pCardBacks[i].hSelf, - GWLP_WNDPROC, - (LONG_PTR)CardImageWndProc); - - SetWindowLongPtr(pCardBacks[i].hSelf, - GWL_USERDATA, - (LONG_PTR)&pCardBacks[i]); - } - - return TRUE; - } - - case WM_COMMAND: - if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) - { - INT i, num = 0; - for (i = 0; i < NUM_CARDBACKS; i++) - { - if (pCardBacks[i].bSelected) + case WM_INITDIALOG: + { + INT i, c; + SIZE_T size = sizeof(CARDBACK) * NUM_CARDBACKS; + + pCardBacks = (PCARDBACK)HeapAlloc(GetProcessHeap(), 0, size); + + if (!pCardBacks) + return FALSE; + + for (i = 0, c = CARDBACK_START; c <= CARDBACK_END; i++, c++) + { + pCardBacks[i].hSelf = GetDlgItem(hDlg, c); + pCardBacks[i].bSelected = FALSE; + pCardBacks[i].hdcNum = CARDBACK_RES_START + i; + pCardBacks[i].imgNum = i + 1; + pCardBacks[i].hOldProc = (WNDPROC)SetWindowLongPtr(pCardBacks[i].hSelf, + GWLP_WNDPROC, + (LONG_PTR)CardImageWndProc); + + SetWindowLongPtr(pCardBacks[i].hSelf, GWL_USERDATA, (LONG_PTR)&pCardBacks[i]); + } + + return TRUE; + } + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + INT i, num = 0; + for (i = 0; i < NUM_CARDBACKS; i++) { - num = pCardBacks[i].imgNum; + if (pCardBacks[i].bSelected) + { + num = pCardBacks[i].imgNum; + } } - } - - EndDialog(hDlg, LOWORD(wParam) == IDOK ? num : FALSE); - HeapFree(GetProcessHeap(), 0, pCardBacks); - return TRUE; - } - - if (HIWORD(wParam) == STN_CLICKED) - { - INT i; - RECT rc; - for (i = 0; i < NUM_CARDBACKS; i++) - { - if (pCardBacks[i].hSelf == (HWND)lParam) + + EndDialog(hDlg, LOWORD(wParam) == IDOK ? num : FALSE); + HeapFree(GetProcessHeap(), 0, pCardBacks); + return TRUE; + } + + if (HIWORD(wParam) == STN_CLICKED) + { + INT i; + RECT rc; + for (i = 0; i < NUM_CARDBACKS; i++) { - pCardBacks[i].bSelected = TRUE; + pCardBacks[i].bSelected = pCardBacks[i].hSelf == (HWND)lParam; + + GetClientRect(pCardBacks[i].hSelf, &rc); + InvalidateRect(pCardBacks[i].hSelf, &rc, TRUE); } - else - pCardBacks[i].bSelected = FALSE; - - GetClientRect(pCardBacks[i].hSelf, &rc); - InvalidateRect(pCardBacks[i].hSelf, &rc, TRUE); - } - - break; - } + + break; + } } return FALSE; @@ -318,10 +295,7 @@ { INT cardBack; - if ((cardBack = DialogBox(hInstance, - MAKEINTRESOURCE(IDD_CARDBACK), - hwnd, - CardBackDlgProc))) + if ((cardBack = DialogBox(hInstance, MAKEINTRESOURCE(IDD_CARDBACK), hwnd, CardBackDlgProc))) { SpiderWnd.SetBackCardIdx(CARDBACK_RES_START + (cardBack - 1)); SpiderWnd.Redraw(); @@ -332,7 +306,7 @@ { static int nWidth, nHeight; - switch(iMsg) + switch (iMsg) { case WM_CREATE: { @@ -373,27 +347,27 @@ } case WM_COMMAND: - switch(LOWORD(wParam)) - { - case IDM_GAME_NEW: - NewGame(); - return 0; - - case IDM_GAME_DECK: - ShowDeckOptionsDlg(hwnd); - return 0; - - case IDM_HELP_CONTENTS: - WinHelp(hwnd, szHelpPath, HELP_CONTENTS, 0);//HELP_KEY, (DWORD)"How to play"); - return 0; - - case IDM_HELP_ABOUT: - MessageBox(hwnd, MsgAbout, szAppName, MB_OK|MB_ICONINFORMATION); - return 0; - - case IDM_GAME_EXIT: - PostMessage(hwnd, WM_CLOSE, 0, 0); - return 0; + switch (LOWORD(wParam)) + { + case IDM_GAME_NEW: + NewGame(); + return 0; + + case IDM_GAME_DECK: + ShowDeckOptionsDlg(hwnd); + return 0; + + case IDM_HELP_CONTENTS: + WinHelp(hwnd, szHelpPath, HELP_CONTENTS, 0);//HELP_KEY, (DWORD)"How to play"); + return 0; + + case IDM_HELP_ABOUT: + MessageBox(hwnd, MsgAbout, szAppName, MB_OK|MB_ICONINFORMATION); + return 0; + + case IDM_GAME_EXIT: + PostMessage(hwnd, WM_CLOSE, 0, 0); + return 0; } return 0; Modified: trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
============================================================================== --- trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c [iso-8859-1] Wed Feb 15 10:53:41 2017 @@ -1594,7 +1594,7 @@ goto SkipEvent; /* Get the computer name and filter it */ - lpszComputerName = (LPWSTR)((LPBYTE)pEvlrBuffer + sizeof(EVENTLOGRECORD) + (wcslen(lpszSourceName) + 1) * sizeof(WCHAR)); + lpszComputerName = (LPWSTR)(pEvlrBuffer + sizeof(EVENTLOGRECORD) + (wcslen(lpszSourceName) + 1) * sizeof(WCHAR)); if (!FilterByString(EventLogFilter->ComputerNames, lpszComputerName)) goto SkipEvent;
7 years, 8 months
1
0
0
0
[ion] 73801: [BOOTLIB]: Fix assembly file containing Archx86TransferTo32BitApplicationAsm to use assume:nothing, otherwise we end up with SS segment overrides everywhere. [BOOTLIB]: Correctly bias ...
by ion@svn.reactos.org
Author: ion Date: Wed Feb 15 00:53:15 2017 New Revision: 73801 URL:
http://svn.reactos.org/svn/reactos?rev=73801&view=rev
Log: [BOOTLIB]: Fix assembly file containing Archx86TransferTo32BitApplicationAsm to use assume:nothing, otherwise we end up with SS segment overrides everywhere. [BOOTLIB]: Correctly bias access to GDT/IDT registers by 2 bytes since this is a 48-bit instruction. The loaded GDT/IDT was previously invalid and causing random GPFs. [BOOTLIB]: Fix EfiStall in protected mode. It was previously not stalling. [BOOTLIB]: Fix calculation in MmMapPhysicalAddress [BOOTLIB]: Fix missing goto in MmSelectMappingAddress which broke the function in real mode. [BOOTLIB]: Fix incorrect ranges in MmSelectMappingAddress. [BOOTLIB]: Fix incorrect offset calculation in MmSelectMappingAddress. Now hitting (as expected), unimplemented virtual code path in BlMmMapPhysicalAddressEx. Modified: trunk/reactos/boot/environ/include/bl.h trunk/reactos/boot/environ/lib/arch/i386/transfer.s trunk/reactos/boot/environ/lib/firmware/efi/firmware.c trunk/reactos/boot/environ/lib/io/display/display.c trunk/reactos/boot/environ/lib/mm/descriptor.c trunk/reactos/boot/environ/lib/mm/i386/mmx86.c trunk/reactos/boot/environ/lib/mm/mm.c trunk/reactos/boot/environ/lib/mm/pagealloc.c Modified: trunk/reactos/boot/environ/include/bl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
============================================================================== --- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original) +++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Wed Feb 15 00:53:15 2017 @@ -2014,6 +2014,11 @@ /* MEMORY DESCRIPTOR ROUTINES ************************************************/ +VOID +MmMdDbgDumpList ( + _In_ PBL_MEMORY_DESCRIPTOR_LIST DescriptorList +); + VOID MmMdInitializeList ( _In_ PBL_MEMORY_DESCRIPTOR_LIST DescriptorList, Modified: trunk/reactos/boot/environ/lib/arch/i386/transfer.s URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/arch/i386…
============================================================================== --- trunk/reactos/boot/environ/lib/arch/i386/transfer.s [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/arch/i386/transfer.s [iso-8859-1] Wed Feb 15 00:53:15 2017 @@ -21,6 +21,7 @@ /* FUNCTIONS ****************************************************************/ .code +ASSUME nothing PUBLIC _Archx86TransferTo32BitApplicationAsm _Archx86TransferTo32BitApplicationAsm: @@ -39,10 +40,10 @@ mov ebx, esp /* Save current GDT/IDT, then load new one */ - sgdt _GdtRegister - sidt _IdtRegister - lgdt _BootAppGdtRegister - lidt _BootAppIdtRegister + sgdt _GdtRegister+2 + sidt _IdtRegister+2 + lgdt _BootAppGdtRegister+2 + lidt _BootAppIdtRegister+2 /* Load the new stack */ xor ebp, ebp @@ -62,8 +63,8 @@ mov esp, ebx /* Restore old GDT/IDT */ - lgdt _GdtRegister - lidt _IdtRegister + lgdt _GdtRegister+2 + lidt _IdtRegister+2 /* Retore old segments */ pop ds Modified: trunk/reactos/boot/environ/lib/firmware/efi/firmware.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/firmware/…
============================================================================== --- trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/firmware/efi/firmware.c [iso-8859-1] Wed Feb 15 00:53:15 2017 @@ -646,8 +646,8 @@ OldMode = CurrentExecutionContext->Mode; if (OldMode != BlRealMode) { - /* FIXME: Not yet implemented */ - return STATUS_NOT_IMPLEMENTED; + /* Switch to real mode */ + BlpArchSwitchContext(BlProtectedMode); } /* Make the EFI call */ @@ -1406,6 +1406,7 @@ /* Initialize EFI memory map attributes */ EfiMemoryMapSize = MapKey = DescriptorSize = DescriptorVersion = 0; + LibraryBuffer = NULL; /* Increment the nesting depth */ MmDescriptorCallTreeCount++; Modified: trunk/reactos/boot/environ/lib/io/display/display.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/io/displa…
============================================================================== --- trunk/reactos/boot/environ/lib/io/display/display.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/io/display/display.c [iso-8859-1] Wed Feb 15 00:53:15 2017 @@ -460,7 +460,6 @@ !(GraphicsConsole) || !(((PBL_GRAPHICS_CONSOLE_VTABLE)GraphicsConsole->TextConsole.Callbacks)->IsEnabled(GraphicsConsole))) { - EfiPrintf(L"Nothing to do for re-init\r\n"); return Status; } Modified: trunk/reactos/boot/environ/lib/mm/descriptor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/descri…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] Wed Feb 15 00:53:15 2017 @@ -149,8 +149,8 @@ _In_ ULONG Count ) { - EfiPrintf(L"dynamic switch NOT SUPPORTED!!!\r\n"); - while (1); + EfiPrintf(L"Dynamic switch NOT SUPPORTED!!!\r\n"); + EfiStall(10000000); } NTSTATUS @@ -173,7 +173,8 @@ else { /* It's a dynamic descriptor, so free it */ - EfiPrintf(L"Dynamic descriptors not yet supported\r\n"); + EfiPrintf(L"Freeing dynamic descriptors not yet supported\r\n"); + EfiStall(10000000); Status = STATUS_NOT_IMPLEMENTED; } @@ -1043,7 +1044,6 @@ /* Check for start overflow */ if (BaseMin > BaseMax) { - EfiPrintf(L"Descriptor overflow\r\n"); return FALSE; } @@ -1145,7 +1145,7 @@ /* Loop every current global descriptor */ while (Index < MmGlobalMemoryDescriptorsUsed) { - /* Does it have any valid pageS? */ + /* Does it have any valid pages? */ OldDescriptor = &MmGlobalMemoryDescriptors[Index]; if (OldDescriptor->PageCount) { Modified: trunk/reactos/boot/environ/lib/mm/i386/mmx86.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/i386/m…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/i386/mmx86.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/i386/mmx86.c [iso-8859-1] Wed Feb 15 00:53:15 2017 @@ -497,7 +497,7 @@ _In_ ULONG CacheAttributes ) { - ULONGLONG Size, TotalSize; + ULONGLONG Size; ULONGLONG PhysicalAddress; PVOID VirtualAddress; PHYSICAL_ADDRESS TranslatedAddress; @@ -541,13 +541,13 @@ VirtualAddress = (PVOID)PAGE_ROUND_DOWN(VirtualAddress); /* Round up the size */ - TotalSize = ROUND_TO_PAGES(PhysicalAddressPtr->QuadPart - - PhysicalAddress + - Size); + Size = ROUND_TO_PAGES(PhysicalAddressPtr->QuadPart - + PhysicalAddress + + Size); /* Loop every virtual page */ CurrentAddress = (ULONG_PTR)VirtualAddress; - VirtualAddressEnd = CurrentAddress + TotalSize - 1; + VirtualAddressEnd = CurrentAddress + Size - 1; while (CurrentAddress < VirtualAddressEnd) { /* Get the physical page of this virtual page */ @@ -564,6 +564,7 @@ EfiPrintf(L"Existing mapping exists: %lx vs %lx\r\n", TranslatedAddress.QuadPart, PhysicalAddress + (CurrentAddress - (ULONG_PTR)VirtualAddress)); + EfiStall(10000000); return STATUS_INVALID_PARAMETER; } } @@ -636,6 +637,44 @@ /* Return back to caller */ return Status; +} + +VOID +MmMdDbgDumpList ( + _In_ PBL_MEMORY_DESCRIPTOR_LIST DescriptorList + ) +{ + ULONGLONG EndPage, VirtualEndPage; + PBL_MEMORY_DESCRIPTOR MemoryDescriptor; + PLIST_ENTRY NextEntry; + + NextEntry = DescriptorList->First->Flink; + while (NextEntry != DescriptorList->First) + { + MemoryDescriptor = CONTAINING_RECORD(NextEntry, + BL_MEMORY_DESCRIPTOR, + ListEntry); + + EndPage = MemoryDescriptor->BasePage + MemoryDescriptor->PageCount; + if (MemoryDescriptor->VirtualPage != 0) + { + VirtualEndPage = MemoryDescriptor->VirtualPage + MemoryDescriptor->PageCount; + } + else + { + VirtualEndPage = 0; + } + + EfiPrintf(L"%p - [%08llx-%08llx @ %08llx-%08llx]:%x\r\n", + MemoryDescriptor, + MemoryDescriptor->BasePage << PAGE_SHIFT, + (EndPage << PAGE_SHIFT) - 1, + MemoryDescriptor->VirtualPage << PAGE_SHIFT, + VirtualEndPage ? (VirtualEndPage << PAGE_SHIFT) - 1 : 0, + (ULONG)MemoryDescriptor->Type); + + NextEntry = NextEntry->Flink; + } } NTSTATUS @@ -1126,7 +1165,7 @@ MmArchKsegAddressRange.Maximum = (ULONGLONG)~0; /* Set the boot application top maximum */ - MmArchTopOfApplicationAddressSpace = 0x70000000; + MmArchTopOfApplicationAddressSpace = 0x70000000 - 1; // Windows bug /* Initialize virtual address space translation */ Status = MmDefInitializeTranslation(MemoryData, TranslationType); Modified: trunk/reactos/boot/environ/lib/mm/mm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/mm.c?r…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/mm.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/mm.c [iso-8859-1] Wed Feb 15 00:53:15 2017 @@ -196,7 +196,6 @@ MapSize = Size; CacheAttributes = ((Flags & BlMemoryValidCacheAttributeMask) != 0x20) ? (Flags & BlMemoryValidCacheAttributeMask) : 0; - EfiPrintf(L"Selected address: %p for %lx\r\n", MappingAddress, MappedAddress.LowPart); Status = MmMapPhysicalAddress(&MappedAddress, &MappingAddress, &MapSize, @@ -215,7 +214,7 @@ if (MmTranslationType != BlNone) { /* We don't support virtual memory yet @TODO */ - EfiPrintf(L"not yet implemented in %S\r\n", __FUNCTION__); + EfiPrintf(L"not yet implemented in BlMmMapPhysicalAddressEx\r\n"); EfiStall(1000000); Status = STATUS_NOT_IMPLEMENTED; goto Quickie; Modified: trunk/reactos/boot/environ/lib/mm/pagealloc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/pageal…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/pagealloc.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/pagealloc.c [iso-8859-1] Wed Feb 15 00:53:15 2017 @@ -126,8 +126,8 @@ FoundDescriptor = CONTAINING_RECORD(NextEntry, BL_MEMORY_DESCRIPTOR, ListEntry); - - /* See if it matches the request */ + + /* See if it matches the request */ if (MmMdFindSatisfyingRegion(FoundDescriptor, &LocalDescriptor, Request->Pages, @@ -1082,7 +1082,7 @@ /* Handle virtual memory scenario */ if (MmTranslationType != BlNone) { - EfiPrintf(L"Unimplemented virtual path\r\n"); + EfiPrintf(L"Unimplemented free virtual path\r\n"); return STATUS_SUCCESS; } @@ -1519,6 +1519,7 @@ { /* Just return the physical address as the mapping address */ PreferredAddress = (PVOID)PhysicalAddress.LowPart; + goto Success; } /* If no physical address, or caller wants a fixed address... */ @@ -1532,14 +1533,15 @@ if (AllocationAttributes & BlMemoryKernelRange) { /* Use kernel range */ - Request.BaseRange = MmArchKsegAddressRange; + Request.BaseRange.Minimum = MmArchKsegAddressRange.Minimum >> PAGE_SHIFT; + Request.BaseRange.Maximum = MmArchKsegAddressRange.Maximum >> PAGE_SHIFT; Request.Type = BL_MM_REQUEST_DEFAULT_TYPE; } else { /* User user/application range */ - Request.BaseRange.Minimum = 0; - Request.BaseRange.Maximum = MmArchTopOfApplicationAddressSpace; + Request.BaseRange.Minimum = 0 >> PAGE_SHIFT; + Request.BaseRange.Maximum = MmArchTopOfApplicationAddressSpace >> PAGE_SHIFT; Request.Type = BL_MM_REQUEST_TOP_DOWN_TYPE; } @@ -1569,8 +1571,7 @@ { /* Add the offset to the returned virtual address */ PreferredAddress = (PVOID)((ULONG_PTR)PreferredAddress + - PhysicalAddress.LowPart - - BYTE_OFFSET(PhysicalAddress.LowPart)); + BYTE_OFFSET(PhysicalAddress.QuadPart)); } Success:
7 years, 8 months
1
0
0
0
[akhaldi] 73800: [0.4.4] Update the release type.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Feb 14 11:08:16 2017 New Revision: 73800 URL:
http://svn.reactos.org/svn/reactos?rev=73800&view=rev
Log: [0.4.4] Update the release type. Modified: branches/ros-branch-0_4_4/reactos/sdk/include/reactos/version.cmake Modified: branches/ros-branch-0_4_4/reactos/sdk/include/reactos/version.cmake URL:
http://svn.reactos.org/svn/reactos/branches/ros-branch-0_4_4/reactos/sdk/in…
============================================================================== --- branches/ros-branch-0_4_4/reactos/sdk/include/reactos/version.cmake [iso-8859-1] (original) +++ branches/ros-branch-0_4_4/reactos/sdk/include/reactos/version.cmake [iso-8859-1] Tue Feb 14 11:08:16 2017 @@ -25,7 +25,7 @@ set(KERNEL_VERSION_BUILD_TYPE "") # KERNEL_VERSION_RELEASE_TYPE is "RC1", "RC2" or "" (for the final one) -set(KERNEL_VERSION_RELEASE_TYPE "RC1") +set(KERNEL_VERSION_RELEASE_TYPE "") set(KERNEL_VERSION "${KERNEL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}") if(KERNEL_VERSION_PATCH_LEVEL)
7 years, 8 months
1
0
0
0
[gadamopoulos] 73799: [RUNDLL32] -Load and activate the manifest of the hosted dll before loading the library.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Tue Feb 14 09:47:13 2017 New Revision: 73799 URL:
http://svn.reactos.org/svn/reactos?rev=73799&view=rev
Log: [RUNDLL32] -Load and activate the manifest of the hosted dll before loading the library. Modified: trunk/reactos/base/system/rundll32/rundll32.c Modified: trunk/reactos/base/system/rundll32/rundll32.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/rundll32/rundl…
============================================================================== --- trunk/reactos/base/system/rundll32/rundll32.c [iso-8859-1] (original) +++ trunk/reactos/base/system/rundll32/rundll32.c [iso-8859-1] Tue Feb 14 09:47:13 2017 @@ -346,6 +346,11 @@ int i; size_t nStrLen; + ACTCTXW ActCtx = {sizeof(ACTCTX), ACTCTX_FLAG_RESOURCE_NAME_VALID}; + HANDLE hActCtx; + ULONG_PTR cookie; + BOOL bActivated; + // Get command-line in argc-argv format argv = CommandLineToArgv(GetCommandLine(),&argc); @@ -380,6 +385,11 @@ lptCmdLine = argv[i]; else lptCmdLine = _T(""); + + ActCtx.lpSource = lptDllName; + ActCtx.lpResourceName = (LPCWSTR)123; + hActCtx = CreateActCtx(&ActCtx); + bActivated = (hActCtx != INVALID_HANDLE_VALUE ? ActivateActCtx(hActCtx, &cookie) : FALSE); // Everything is all setup, so load the dll now hDll = LoadLibrary(lptDllName); @@ -429,6 +439,8 @@ if (!RegisterBlankClass(hInstance, hPrevInstance)) { FreeLibrary(hDll); + if (bActivated) + DeactivateActCtx(0, cookie); return 0; } // Create a window so we can pass a window handle to @@ -476,6 +488,9 @@ free(lptMsgBuffer); } + if (bActivated) + DeactivateActCtx(0, cookie); + if (argv) free(argv); return 0; /* rundll32 always returns 0! */ }
7 years, 8 months
1
0
0
0
[gadamopoulos] 73798: [NEWDEV] -Use manifest_hosted.rc.
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Tue Feb 14 09:41:38 2017 New Revision: 73798 URL:
http://svn.reactos.org/svn/reactos?rev=73798&view=rev
Log: [NEWDEV] -Use manifest_hosted.rc. Modified: trunk/reactos/dll/win32/newdev/newdev.rc Modified: trunk/reactos/dll/win32/newdev/newdev.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/newdev/newdev.rc…
============================================================================== --- trunk/reactos/dll/win32/newdev/newdev.rc [iso-8859-1] (original) +++ trunk/reactos/dll/win32/newdev/newdev.rc [iso-8859-1] Tue Feb 14 09:41:38 2017 @@ -6,7 +6,7 @@ IDB_WATERMARK BITMAP "resources/watermark.bmp" IDB_HEADER BITMAP "resources/header.bmp" -#include <reactos/manifest_dll.rc> +#include <reactos/manifest_hosted.rc> LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
7 years, 8 months
1
0
0
0
[ion] 73797: [BOOTLIB]: Clarify some attributes now that their meaning is clearer. [BOOTLIB]: Implement MmSelectMappingAddress and fix its prototype. [BOOTLIB]: Implement MmPapPageAllocatorExtend a...
by ion@svn.reactos.org
Author: ion Date: Mon Feb 13 23:47:06 2017 New Revision: 73797 URL:
http://svn.reactos.org/svn/reactos?rev=73797&view=rev
Log: [BOOTLIB]: Clarify some attributes now that their meaning is clearer. [BOOTLIB]: Implement MmSelectMappingAddress and fix its prototype. [BOOTLIB]: Implement MmPapPageAllocatorExtend and fix MmPapAllocatePagesInRange to use it. We are trying to choose VA 0 for PA 0x8000 and currently fail due to conflicts. TBD. Modified: trunk/reactos/boot/environ/include/bl.h trunk/reactos/boot/environ/lib/mm/descriptor.c trunk/reactos/boot/environ/lib/mm/i386/mmx86.c trunk/reactos/boot/environ/lib/mm/mm.c trunk/reactos/boot/environ/lib/mm/pagealloc.c Modified: trunk/reactos/boot/environ/include/bl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/include/bl.h?…
============================================================================== --- trunk/reactos/boot/environ/include/bl.h [iso-8859-1] (original) +++ trunk/reactos/boot/environ/include/bl.h [iso-8859-1] Mon Feb 13 23:47:06 2017 @@ -362,11 +362,11 @@ // // Memory Allocation Attributes // - BlMemoryUnknown = 0x00010000, - BlMemoryNonFixed = 0x00020000, + BlMemoryLargePages = 0x00010000, + BlMemoryKernelRange = 0x00020000, BlMemoryFixed = 0x00040000, BlMemoryBelow1MB = 0x00080000, - BlMemoryValidAllocationAttributes = BlMemoryNonFixed | BlMemoryFixed | BlMemoryBelow1MB | BlMemoryUnknown, + BlMemoryValidAllocationAttributes = BlMemoryKernelRange | BlMemoryFixed | BlMemoryBelow1MB | BlMemoryLargePages, BlMemoryValidAllocationAttributeMask = 0x00FF0000, // @@ -2194,6 +2194,7 @@ NTSTATUS MmSelectMappingAddress ( _Out_ PVOID* MappingAddress, + _In_ PVOID PreferredAddress, _In_ ULONGLONG Size, _In_ ULONG AllocationAttributes, _In_ ULONG Flags, @@ -2721,5 +2722,7 @@ extern BL_MEMORY_DESCRIPTOR_LIST MmMdlMappingTrackers; extern ULONGLONG BlpTimePerformanceFrequency; extern LIST_ENTRY RegisteredFileSystems; +extern BL_ADDRESS_RANGE MmArchKsegAddressRange; +extern ULONG_PTR MmArchTopOfApplicationAddressSpace; #endif Modified: trunk/reactos/boot/environ/lib/mm/descriptor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/descri…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/descriptor.c [iso-8859-1] Mon Feb 13 23:47:06 2017 @@ -1104,7 +1104,7 @@ } /* Bail out if the allocation flags don't match */ - if (((Flags ^ Descriptor->Flags) & (BlMemoryRuntime | BlMemoryBelow1MB | BlMemoryUnknown))) + if (((Flags ^ Descriptor->Flags) & (BlMemoryRuntime | BlMemoryBelow1MB | BlMemoryLargePages))) { //EfiPrintf(L"Incorrect memory allocation flags\r\n"); return FALSE; Modified: trunk/reactos/boot/environ/lib/mm/i386/mmx86.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/i386/m…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/i386/mmx86.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/i386/mmx86.c [iso-8859-1] Mon Feb 13 23:47:06 2017 @@ -490,29 +490,6 @@ } NTSTATUS -MmSelectMappingAddress ( - _Out_ PVOID* MappingAddress, - _In_ ULONGLONG Size, - _In_ ULONG AllocationAttributes, - _In_ ULONG Flags, - _In_ PHYSICAL_ADDRESS PhysicalAddress - ) -{ - /* Are we in physical mode? */ - if (MmTranslationType == BlNone) - { - /* Just return the physical address as the mapping address */ - *MappingAddress = (PVOID)PhysicalAddress.LowPart; - return STATUS_SUCCESS; - } - - /* We don't support virtual memory yet @TODO */ - EfiPrintf(L"not yet implemented in %S\r\n", __FUNCTION__); - EfiStall(1000000); - return STATUS_NOT_IMPLEMENTED; -} - -NTSTATUS MmMapPhysicalAddress ( _Inout_ PPHYSICAL_ADDRESS PhysicalAddressPtr, _Inout_ PVOID* VirtualAddressPtr, Modified: trunk/reactos/boot/environ/lib/mm/mm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/mm.c?r…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/mm.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/mm.c [iso-8859-1] Mon Feb 13 23:47:06 2017 @@ -164,7 +164,7 @@ /* Check for invalid requirement flag, if one is present */ if (((Flags & BlMemoryValidAllocationAttributes) != BlMemoryFixed) && - ((Flags & BlMemoryValidAllocationAttributes) != BlMemoryNonFixed) && + ((Flags & BlMemoryValidAllocationAttributes) != BlMemoryKernelRange) && (Flags & BlMemoryValidAllocationAttributes)) { Status = STATUS_INVALID_PARAMETER; @@ -181,6 +181,7 @@ /* Select an address to map this at */ Status = MmSelectMappingAddress(&MappingAddress, + *VirtualAddress, Size, Flags & BlMemoryValidAllocationAttributes, Flags, @@ -195,6 +196,7 @@ MapSize = Size; CacheAttributes = ((Flags & BlMemoryValidCacheAttributeMask) != 0x20) ? (Flags & BlMemoryValidCacheAttributeMask) : 0; + EfiPrintf(L"Selected address: %p for %lx\r\n", MappingAddress, MappedAddress.LowPart); Status = MmMapPhysicalAddress(&MappedAddress, &MappingAddress, &MapSize, Modified: trunk/reactos/boot/environ/lib/mm/pagealloc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/environ/lib/mm/pageal…
============================================================================== --- trunk/reactos/boot/environ/lib/mm/pagealloc.c [iso-8859-1] (original) +++ trunk/reactos/boot/environ/lib/mm/pagealloc.c [iso-8859-1] Mon Feb 13 23:47:06 2017 @@ -23,6 +23,8 @@ } BL_PA_REQUEST, *PBL_PA_REQUEST; /* DATA VARIABLES ************************************************************/ + +extern ULONG MmArchLargePageSize; ULONGLONG PapMaximumPhysicalPage, PapMinimumPhysicalPage; @@ -419,6 +421,168 @@ } NTSTATUS +MmPapPageAllocatorExtend ( + _In_ ULONG Attributes, + _In_ ULONG Alignment, + _In_ ULONGLONG PageCount, + _In_ ULONGLONG VirtualPage, + _In_opt_ PBL_ADDRESS_RANGE Range, + _In_opt_ ULONG Type + ) +{ + BL_PA_REQUEST Request; + ULONGLONG PageRange; + BL_MEMORY_DESCRIPTOR NewDescriptor; + ULONG AllocationFlags, CacheAttributes, AddFlags; + NTSTATUS Status; + PBL_MEMORY_DESCRIPTOR_LIST MdList; + PBL_MEMORY_DESCRIPTOR Descriptor; + PVOID VirtualAddress; + PHYSICAL_ADDRESS PhysicalAddress; + + /* Is the caller requesting less pages than allowed? */ + if (!(Attributes & BlMemoryFixed) && + !(Range) && + (PageCount < PapMinimumAllocationCount)) + { + /* Unless this is a fixed request, then adjust the original requirements */ + PageCount = PapMinimumAllocationCount; + Alignment = PapMinimumAllocationCount; + } + + /* Extract only the allocation attributes */ + AllocationFlags = Attributes & BlMemoryValidAllocationAttributeMask; + + /* Check if the caller wants large pages */ + if ((AllocationFlags & BlMemoryLargePages) && (MmArchLargePageSize != 1)) + { + EfiPrintf(L"Large pages not supported!\r\n"); + EfiStall(10000000); + return STATUS_NOT_IMPLEMENTED; + } + + /* Set an emty virtual range */ + Request.VirtualRange.Minimum = 0; + Request.VirtualRange.Maximum = 0; + + /* Check if the caller requested a range */ + if (Range) + { + /* Calculate it size in pages, minus a page as this is a 0-based range */ + PageRange = ((Range->Maximum - Range->Minimum) >> PAGE_SHIFT) - 1; + + /* Set the minimum and maximum, in pages */ + Request.BaseRange.Minimum = Range->Minimum >> PAGE_SHIFT; + Request.BaseRange.Maximum = Request.BaseRange.Minimum + PageRange; + } + else + { + /* Initialize a range from the smallest page to the biggest */ + Request.BaseRange.Minimum = PapMinimumPhysicalPage; + Request.BaseRange.Maximum = 0xFFFFFFFF / PAGE_SIZE; + } + + /* Get the cache attributes */ + CacheAttributes = Attributes & BlMemoryValidCacheAttributeMask; + + /* Check if the caller requested a valid allocation type */ + if ((Type) && !(Type & ~(BL_MM_REQUEST_DEFAULT_TYPE | + BL_MM_REQUEST_TOP_DOWN_TYPE))) + { + /* Use what the caller wanted */ + Request.Type = Type; + } + else + { + /* Use the default bottom-up type */ + Request.Type = BL_MM_REQUEST_DEFAULT_TYPE; + } + + /* Use the original protection and type, but ignore other attributes */ + Request.Flags = Attributes & ~(BlMemoryValidAllocationAttributeMask | + BlMemoryValidCacheAttributeMask); + Request.Alignment = Alignment; + Request.Pages = PageCount; + + /* Allocate some free pages */ + Status = MmPaAllocatePages(NULL, + &NewDescriptor, + &MmMdlUnmappedUnallocated, + &Request, + BlConventionalMemory); + if (!NT_SUCCESS(Status)) + { + EfiPrintf(L"Failed to get unmapped,unallocated memory!\r\n"); + EfiStall(10000000); + return Status; + } + + /* Initialize a descriptor for these pages, adding in the allocation flags */ + Descriptor = MmMdInitByteGranularDescriptor(AllocationFlags | + NewDescriptor.Flags, + BlConventionalMemory, + NewDescriptor.BasePage, + NewDescriptor.VirtualPage, + NewDescriptor.PageCount); + + /* Now map a virtual address for these physical pages */ + VirtualAddress = (PVOID)((ULONG_PTR)VirtualPage << PAGE_SHIFT); + PhysicalAddress.QuadPart = NewDescriptor.BasePage << PAGE_SHIFT; + Status = BlMmMapPhysicalAddressEx(&VirtualAddress, + AllocationFlags | CacheAttributes, + NewDescriptor.PageCount << PAGE_SHIFT, + PhysicalAddress); + EfiPrintf(L"MAP status: %lx\r\n", Status); + if (Status == STATUS_SUCCESS) + { + /* Add the cache attributes now that the mapping worked */ + Descriptor->Flags |= CacheAttributes; + + /* Update the virtual page now that we mapped it */ + Descriptor->VirtualPage = (ULONG_PTR)VirtualAddress >> PAGE_SHIFT; + + /* Add this as a mapped region */ + Status = MmMdAddDescriptorToList(&MmMdlMappedUnallocated, + Descriptor, + BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG); + + /* Make new descriptor that we'll add in firmware allocation tracker */ + MdList = &MmMdlFwAllocationTracker; + Descriptor = MmMdInitByteGranularDescriptor(0, + BlConventionalMemory, + NewDescriptor.BasePage, + 0, + NewDescriptor.PageCount); + + /* Do not coalesce */ + AddFlags = 0; + } + else + { + /* We failed, free the physical pages */ + Status = MmFwFreePages(NewDescriptor.BasePage, NewDescriptor.PageCount); + if (!NT_SUCCESS(Status)) + { + /* We failed to free the pages, so this is still around */ + MdList = &MmMdlUnmappedAllocated; + } + else + { + /* This is now back to unmapped/unallocated memory */ + Descriptor->Flags = 0; + MdList = &MmMdlUnmappedUnallocated; + } + + /* Coalesce the free descriptor */ + AddFlags = BL_MM_ADD_DESCRIPTOR_COALESCE_FLAG; + } + + /* Either add to firmware list, or to unmapped list, then return result */ + MmMdAddDescriptorToList(MdList, Descriptor, AddFlags); + return Status; +} + +NTSTATUS MmPapAllocatePagesInRange ( _Inout_ PVOID* PhysicalAddress, _In_ BL_MEMORY_TYPE MemoryType, @@ -470,8 +634,9 @@ } else { + /* Use the entire range that's possible */ Request.BaseRange.Minimum = PapMinimumPhysicalPage; - Request.BaseRange.Maximum = (4 * 1024 * 1024) >> PAGE_SHIFT; + Request.BaseRange.Maximum = 0xFFFFFFFF >> PAGE_SHIFT; } /* Check if a fixed allocation was requested */ @@ -486,7 +651,7 @@ else { /* Check if non-fixed was specifically requested */ - if (Attributes & BlMemoryNonFixed) + if (Attributes & BlMemoryKernelRange) { /* We don't support virtual memory yet @TODO */ EfiPrintf(L"not yet implemented in %S\r\n", __FUNCTION__); @@ -497,20 +662,15 @@ /* Set the virtual address range */ Request.VirtualRange.Minimum = 0; - Request.VirtualRange.Maximum = (4 * 1024 * 1024) >> PAGE_SHIFT; + Request.VirtualRange.Maximum = 0xFFFFFFFF >> PAGE_SHIFT; } /* Check what type of allocation was requested */ - if (Type) - { - /* Save it */ + if ((Type) && !(Type & ~(BL_MM_REQUEST_DEFAULT_TYPE | + BL_MM_REQUEST_TOP_DOWN_TYPE))) + { + /* Save it if it was valid */ Request.Type = Type; - - /* If it was invalid, set the default */ - if (Type & ~(BL_MM_REQUEST_DEFAULT_TYPE | BL_MM_REQUEST_TOP_DOWN_TYPE)) - { - Request.Type = BL_MM_REQUEST_DEFAULT_TYPE; - } } else { @@ -531,11 +691,34 @@ MemoryType); if (!NT_SUCCESS(Status)) { - /* We don't support virtual memory yet @TODO */ - EfiPrintf(L"Need to extend PA allocator\r\n"); - EfiStall(1000000); - Status = STATUS_NOT_IMPLEMENTED; - goto Exit; + /* Extend the physical allocator */ + Status = MmPapPageAllocatorExtend(Attributes, + Alignment, + Pages, + ((ULONG_PTR)*PhysicalAddress) >> + PAGE_SHIFT, + Range, + Type); + if (!NT_SUCCESS(Status)) + { + /* Fail since we're out of memory */ + EfiPrintf(L"OUT OF MEMORY: %lx\r\n", Status); + Status = STATUS_NO_MEMORY; + goto Exit; + } + + /* Try the allocation again now */ + Status = MmPaAllocatePages(&MmMdlMappedAllocated, + &Descriptor, + &MmMdlMappedUnallocated, + &Request, + MemoryType); + if (!NT_SUCCESS(Status)) + { + /* Fail since we're out of memory */ + EfiPrintf(L"OUT OF MEMORY: %lx\r\n", Status); + goto Exit; + } } /* Return the allocated address */ @@ -544,7 +727,8 @@ else { /* Check if this is a fixed allocation */ - BaseAddress.QuadPart = (Attributes & BlMemoryFixed) ? (ULONG_PTR)*PhysicalAddress : 0; + BaseAddress.QuadPart = (Attributes & BlMemoryFixed) ? + (ULONG_PTR)*PhysicalAddress : 0; /* Allocate the pages */ Status = MmPapAllocatePhysicalPagesInRange(&BaseAddress, @@ -1316,3 +1500,81 @@ return Status; } +NTSTATUS +MmSelectMappingAddress ( + _Out_ PVOID* MappingAddress, + _In_ PVOID PreferredAddress, + _In_ ULONGLONG Size, + _In_ ULONG AllocationAttributes, + _In_ ULONG Flags, + _In_ PHYSICAL_ADDRESS PhysicalAddress + ) +{ + BL_PA_REQUEST Request; + NTSTATUS Status; + BL_MEMORY_DESCRIPTOR NewDescriptor; + + /* Are we in physical mode? */ + if (MmTranslationType == BlNone) + { + /* Just return the physical address as the mapping address */ + PreferredAddress = (PVOID)PhysicalAddress.LowPart; + } + + /* If no physical address, or caller wants a fixed address... */ + if ((PhysicalAddress.QuadPart == -1) || (Flags & BlMemoryFixed)) + { + /* Then just return the preferred address */ + goto Success; + } + + /* Check which range of virtual memory should be used */ + if (AllocationAttributes & BlMemoryKernelRange) + { + /* Use kernel range */ + Request.BaseRange = MmArchKsegAddressRange; + Request.Type = BL_MM_REQUEST_DEFAULT_TYPE; + } + else + { + /* User user/application range */ + Request.BaseRange.Minimum = 0; + Request.BaseRange.Maximum = MmArchTopOfApplicationAddressSpace; + Request.Type = BL_MM_REQUEST_TOP_DOWN_TYPE; + } + + /* Build a request */ + Request.VirtualRange.Minimum = 0; + Request.VirtualRange.Maximum = 0; + Request.Flags = AllocationAttributes & BlMemoryLargePages; + Request.Alignment = 1; + Request.Pages = ADDRESS_AND_SIZE_TO_SPAN_PAGES(PhysicalAddress.LowPart, Size); + + /* Allocate the physical pages */ + Status = MmPaAllocatePages(NULL, + &NewDescriptor, + &MmMdlFreeVirtual, + &Request, + BlConventionalMemory); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + /* Return the address we got back */ + PreferredAddress = (PVOID)((ULONG_PTR)NewDescriptor.BasePage << PAGE_SHIFT); + + /* Check if the existing physical address was not aligned */ + if (PhysicalAddress.QuadPart != -1) + { + /* Add the offset to the returned virtual address */ + PreferredAddress = (PVOID)((ULONG_PTR)PreferredAddress + + PhysicalAddress.LowPart - + BYTE_OFFSET(PhysicalAddress.LowPart)); + } + +Success: + /* Return the mapping address and success */ + *MappingAddress = PreferredAddress; + return STATUS_SUCCESS; +}
7 years, 8 months
1
0
0
0
← Newer
1
...
18
19
20
21
22
23
24
...
36
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
32
33
34
35
36
Results per page:
10
25
50
100
200