ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
September 2011
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
399 discussions
Start a n
N
ew thread
[gadamopoulos] 53750: [uxtheme] - Fix a warning
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Mon Sep 19 13:07:03 2011 New Revision: 53750 URL:
http://svn.reactos.org/svn/reactos?rev=53750&view=rev
Log: [uxtheme] - Fix a warning Modified: trunk/reactos/dll/win32/uxtheme/draw.c Modified: trunk/reactos/dll/win32/uxtheme/draw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/draw.c?r…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/draw.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/draw.c [iso-8859-1] Mon Sep 19 13:07:03 2011 @@ -1735,12 +1735,13 @@ static HBITMAP UXTHEME_DrawThemePartToDib(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pRect) { HDC hdcMem; - BITMAPINFO bmi = {0}; + BITMAPINFO bmi; HBITMAP hbmp, hbmpOld; HBRUSH hbrBack; hdcMem = CreateCompatibleDC(0); + memset(&bmi, 0, sizeof(bmi)); bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); bmi.bmiHeader.biWidth = pRect->right; bmi.bmiHeader.biHeight = -pRect->bottom;
13 years, 3 months
1
0
0
0
[gadamopoulos] 53749: [uxtheme] - Try to fix build on linux
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Mon Sep 19 12:58:24 2011 New Revision: 53749 URL:
http://svn.reactos.org/svn/reactos?rev=53749&view=rev
Log: [uxtheme] - Try to fix build on linux Modified: trunk/reactos/dll/win32/uxtheme/ncscrollbar.c Modified: trunk/reactos/dll/win32/uxtheme/ncscrollbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/ncscroll…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/ncscrollbar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/ncscrollbar.c [iso-8859-1] Mon Sep 19 12:58:24 2011 @@ -14,7 +14,7 @@ #include "vfwmsgs.h" #include "uxtheme.h" #include <tmschema.h> -#include <Windowsx.h> +#include <windowsx.h> #include "ncthm.h" #include <assert.h> #include "wine/debug.h"
13 years, 3 months
1
0
0
0
[gadamopoulos] 53748: [uxtheme] - Merge from the themes branch
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Mon Sep 19 12:51:42 2011 New Revision: 53748 URL:
http://svn.reactos.org/svn/reactos?rev=53748&view=rev
Log: [uxtheme] - Merge from the themes branch Added: trunk/reactos/dll/win32/uxtheme/ncscrollbar.c - copied unchanged from r53732, branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/ncscrollbar.c trunk/reactos/dll/win32/uxtheme/ncthm.h - copied unchanged from r53732, branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/ncthm.h trunk/reactos/dll/win32/uxtheme/nonclient.c - copied unchanged from r53732, branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/nonclient.c trunk/reactos/dll/win32/uxtheme/themehooks.c - copied unchanged from r53732, branches/GSoC_2011/ThemesSupport/dll/win32/uxtheme/themehooks.c Modified: trunk/reactos/dll/win32/uxtheme/CMakeLists.txt trunk/reactos/dll/win32/uxtheme/draw.c trunk/reactos/dll/win32/uxtheme/msstyles.c trunk/reactos/dll/win32/uxtheme/system.c trunk/reactos/dll/win32/uxtheme/uxtheme.rbuild trunk/reactos/dll/win32/uxtheme/uxtheme.spec trunk/reactos/dll/win32/uxtheme/uxthemedll.h Modified: trunk/reactos/dll/win32/uxtheme/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/CMakeLis…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/CMakeLists.txt [iso-8859-1] Mon Sep 19 12:51:42 2011 @@ -11,9 +11,12 @@ main.c metric.c msstyles.c + ncscrollbar.c + nonclient.c property.c stylemap.c system.c + themehooks.c uxini.c version.rc ${CMAKE_CURRENT_BINARY_DIR}/uxtheme_stubs.c Modified: trunk/reactos/dll/win32/uxtheme/draw.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/draw.c?r…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/draw.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/draw.c [iso-8859-1] Mon Sep 19 12:51:42 2011 @@ -1731,6 +1731,166 @@ return S_OK; } + +static HBITMAP UXTHEME_DrawThemePartToDib(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pRect) +{ + HDC hdcMem; + BITMAPINFO bmi = {0}; + HBITMAP hbmp, hbmpOld; + HBRUSH hbrBack; + + hdcMem = CreateCompatibleDC(0); + + bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); + bmi.bmiHeader.biWidth = pRect->right; + bmi.bmiHeader.biHeight = -pRect->bottom; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + hbmp = CreateDIBSection(hdcMem, &bmi, DIB_RGB_COLORS , NULL, 0, 0); + + hbmpOld = (HBITMAP)SelectObject(hdcMem, hbmp); + + /* FIXME: use an internal function that doesn't do transparent blt */ + hbrBack = CreateSolidBrush(RGB(255,0,255)); + + FillRect(hdcMem, pRect, hbrBack); + + DrawThemeBackground(hTheme, hdcMem, iPartId, iStateId, pRect, NULL); + + DeleteObject(hbrBack); + SelectObject(hdcMem, hbmpOld); + DeleteObject(hdcMem); + + return hbmp; +} + +#define PT_IN_RECT(lprc,x,y) ( x >= lprc->left && x < lprc->right && \ + y >= lprc->top && y < lprc->bottom) + +static HRGN UXTHEME_RegionFromDibBits(RGBQUAD* pBuffer, RGBQUAD* pclrTransparent, LPCRECT pRect) +{ + int x, y, xstart; + int cMaxRgnRects, cRgnDataSize, cRgnRects; +#ifdef EXTCREATEREGION_WORKS + RECT* prcCurrent; + PRGNDATA prgnData; +#else + HRGN hrgnTemp; +#endif + ULONG clrTransparent, *pclrCurrent; + HRGN hrgnRet; + + pclrCurrent = (PULONG)pBuffer; + clrTransparent = *(PULONG)pclrTransparent; + + /* Create a region and pre-allocate memory enough for 3 spaces in one row*/ + cRgnRects = 0; + cMaxRgnRects = 4* (pRect->bottom-pRect->top); + cRgnDataSize = sizeof(RGNDATA) + cMaxRgnRects * sizeof(RECT); + +#ifdef EXTCREATEREGION_WORKS + /* Allocate the region data */ + prgnData = (PRGNDATA)HeapAlloc(GetProcessHeap(), 0, cRgnDataSize); + + prcCurrent = (PRECT)prgnData->Buffer; +#else + hrgnRet = CreateRectRgn(0,0,0,0); +#endif + + /* Calculate the region rects */ + y=0; + /* Scan each line of the bitmap */ + while(y<pRect->bottom) + { + x=0; + /* Scan each pixel */ + while (x<pRect->right) + { + /* Check if the pixel is not transparent and it is in the requested rect */ + if(*pclrCurrent != clrTransparent && PT_IN_RECT(pRect,x,y)) + { + xstart = x; + /* Find the end of the opaque row of pixels */ + while (x<pRect->right) + { + if(*pclrCurrent == clrTransparent || !PT_IN_RECT(pRect,x,y)) + break; + x++; + pclrCurrent++; + } + +#ifdef EXTCREATEREGION_WORKS + /* Add the scaned line to the region */ + SetRect(prcCurrent, xstart, y,x,y+1); + prcCurrent++; + cRgnRects++; + + /* Increase the size of the buffer if it is full */ + if(cRgnRects == cMaxRgnRects) + { + cMaxRgnRects *=2; + cRgnDataSize = sizeof(RGNDATA) + cMaxRgnRects * sizeof(RECT); + prgnData = (PRGNDATA)HeapReAlloc(GetProcessHeap(), + 0, + prgnData, + cRgnDataSize); + prcCurrent = (RECT*)prgnData->Buffer + cRgnRects; + } +#else + hrgnTemp = CreateRectRgn(xstart, y,x,y+1); + CombineRgn(hrgnRet, hrgnRet, hrgnTemp, RGN_OR ); + DeleteObject(hrgnTemp); +#endif + } + else + { + x++; + pclrCurrent++; + } + } + y++; + } + +#ifdef EXTCREATEREGION_WORKS + /* Fill the region data header */ + prgnData->rdh.dwSize = sizeof(prgnData->rdh); + prgnData->rdh.iType = RDH_RECTANGLES; + prgnData->rdh.nCount = cRgnRects; + prgnData->rdh.nRgnSize = cRgnDataSize; + prgnData->rdh.rcBound = *pRect; + + /* Create the region*/ + hrgnRet = ExtCreateRegion (NULL, cRgnDataSize, prgnData); + + /* Free the region data*/ + HeapFree(GetProcessHeap(),0,prgnData); +#endif + + /* return the region*/ + return hrgnRet; +} + +HRESULT UXTHEME_GetImageBackBackgroundRegion(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pRect, HRGN *pRegion) +{ + HBITMAP hbmp; + DIBSECTION dib; + RGBQUAD clrTransparent = {0xFF,0x0, 0xFF,0x0}; + + /* Draw the theme part to a dib */ + hbmp = UXTHEME_DrawThemePartToDib(hTheme, hdc, iPartId, iStateId, pRect); + + /* Retrieve the info of the dib section */ + GetObject(hbmp, sizeof (DIBSECTION), &dib); + + /* Convert the bits of the dib section to a region */ + *pRegion = UXTHEME_RegionFromDibBits((RGBQUAD*)dib.dsBm.bmBits, &clrTransparent, pRect); + + /* Free the temp bitmap */ + DeleteObject(hbmp); + + return S_OK; +} + /*********************************************************************** * GetThemeBackgroundRegion (UXTHEME.@) * @@ -1752,8 +1912,7 @@ GetThemeEnumValue(hTheme, iPartId, iStateId, TMT_BGTYPE, &bgtype); if(bgtype == BT_IMAGEFILE) { - FIXME("Images not handled yet\n"); - hr = ERROR_CALL_NOT_IMPLEMENTED; + hr = UXTHEME_GetImageBackBackgroundRegion(hTheme, hdc, iPartId, iStateId, pRect, pRegion); } else if(bgtype == BT_BORDERFILL) { *pRegion = CreateRectRgn(pRect->left, pRect->top, pRect->right, pRect->bottom); Modified: trunk/reactos/dll/win32/uxtheme/msstyles.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/msstyles…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/msstyles.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/msstyles.c [iso-8859-1] Mon Sep 19 12:51:42 2011 @@ -1257,6 +1257,13 @@ *lpValEnd = lpCur; return E_PROP_ID_UNSUPPORTED; } + if(pointSize > 0) + { + HDC hdc = GetDC(0); + pointSize = -MulDiv(pointSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); + ReleaseDC(0, hdc); + } + pFont->lfHeight = pointSize; pFont->lfWeight = FW_REGULAR; pFont->lfCharSet = DEFAULT_CHARSET; @@ -1278,8 +1285,6 @@ ZeroMemory(pFont, sizeof(LOGFONTW)); hr = MSSTYLES_GetFont (lpCur, lpEnd, &lpCur, pFont); - if (SUCCEEDED (hr)) - pFont->lfHeight = -MulDiv(pFont->lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72); return hr; } Modified: trunk/reactos/dll/win32/uxtheme/system.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/system.c…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/system.c [iso-8859-1] Mon Sep 19 12:51:42 2011 @@ -31,9 +31,11 @@ #include "vfwmsgs.h" #include "uxtheme.h" #include "tmschema.h" +#include "uxundoc.h" #include "uxthemedll.h" #include "msstyles.h" +#include "ncthm.h" #include "wine/debug.h" @@ -61,9 +63,10 @@ ATOM atDialogThemeEnabled; static DWORD dwThemeAppProperties = STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS; -static ATOM atWindowTheme; +ATOM atWindowTheme; static ATOM atSubAppName; static ATOM atSubIdList; +ATOM atWndContrext; static BOOL bThemeActive = FALSE; static WCHAR szCurrentTheme[MAX_PATH]; @@ -79,7 +82,7 @@ } /* Broadcast a message to *all* windows, including children */ -static BOOL CALLBACK UXTHEME_broadcast_msg (HWND hWnd, LPARAM msg) +BOOL CALLBACK UXTHEME_broadcast_msg (HWND hWnd, LPARAM msg) { if (hWnd == NULL) { @@ -140,7 +143,6 @@ } } - RegCloseKey(hKey); return dwRet; } @@ -149,7 +151,7 @@ * * Set the current active theme from the registry */ -static void UXTHEME_LoadTheme(void) +void UXTHEME_LoadTheme(BOOL bLoad) { HKEY hKey; DWORD buffsize; @@ -157,29 +159,36 @@ WCHAR tmp[10]; PTHEME_FILE pt; - /* Get current theme configuration */ - if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) { - TRACE("Loading theme config\n"); - buffsize = sizeof(tmp)/sizeof(tmp[0]); - if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) { - bThemeActive = (tmp[0] != '0'); + if(bLoad == TRUE) + { + /* Get current theme configuration */ + if(!RegOpenKeyW(HKEY_CURRENT_USER, szThemeManager, &hKey)) { + TRACE("Loading theme config\n"); + buffsize = sizeof(tmp)/sizeof(tmp[0]); + if(!RegQueryValueExW(hKey, szThemeActive, NULL, NULL, (LPBYTE)tmp, &buffsize)) { + bThemeActive = (tmp[0] != '0'); + } + else { + bThemeActive = FALSE; + TRACE("Failed to get ThemeActive: %d\n", GetLastError()); + } + buffsize = sizeof(szCurrentColor)/sizeof(szCurrentColor[0]); + if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize)) + szCurrentColor[0] = '\0'; + buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]); + if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize)) + szCurrentSize[0] = '\0'; + if (query_reg_path (hKey, szDllName, szCurrentTheme)) + szCurrentTheme[0] = '\0'; + RegCloseKey(hKey); } - else { - bThemeActive = FALSE; - TRACE("Failed to get ThemeActive: %d\n", GetLastError()); - } - buffsize = sizeof(szCurrentColor)/sizeof(szCurrentColor[0]); - if(RegQueryValueExW(hKey, szColorName, NULL, NULL, (LPBYTE)szCurrentColor, &buffsize)) - szCurrentColor[0] = '\0'; - buffsize = sizeof(szCurrentSize)/sizeof(szCurrentSize[0]); - if(RegQueryValueExW(hKey, szSizeName, NULL, NULL, (LPBYTE)szCurrentSize, &buffsize)) - szCurrentSize[0] = '\0'; - if (query_reg_path (hKey, szDllName, szCurrentTheme)) - szCurrentTheme[0] = '\0'; - RegCloseKey(hKey); + else + TRACE("Failed to open theme registry key\n"); } else - TRACE("Failed to open theme registry key\n"); + { + bThemeActive = FALSE; + } if(bThemeActive) { /* Make sure the theme requested is actually valid */ @@ -543,8 +552,7 @@ atSubAppName = GlobalAddAtomW(szSubAppName); atSubIdList = GlobalAddAtomW(szSubIdList); atDialogThemeEnabled = GlobalAddAtomW(szDialogThemeEnabled); - - UXTHEME_LoadTheme(); + atWndContrext = GlobalAddAtomW(L"ux_WndContext"); } /*********************************************************************** @@ -973,7 +981,7 @@ * Success: S_OK * Failure: HRESULT error-code */ -HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback, +HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, ENUMTHEMEPROC callback, LPVOID lpData) { WCHAR szDir[MAX_PATH]; @@ -1171,7 +1179,7 @@ * any other purpose */ HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown, - ParseThemeIniFileProc callback, LPVOID lpData) + PARSETHEMEINIFILEPROC callback, LPVOID lpData) { FIXME("%s %s: stub\n", debugstr_w(pszIniFileName), debugstr_w(pszUnknown)); return ERROR_CALL_NOT_IMPLEMENTED; Modified: trunk/reactos/dll/win32/uxtheme/uxtheme.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/uxtheme.…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/uxtheme.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/uxtheme.rbuild [iso-8859-1] Mon Sep 19 12:51:42 2011 @@ -11,9 +11,12 @@ <file>main.c</file> <file>metric.c</file> <file>msstyles.c</file> + <file>ncscrollbar.c</file> + <file>nonclient.c</file> <file>property.c</file> <file>stylemap.c</file> <file>system.c</file> + <file>themehooks.c</file> <file>uxini.c</file> <file>version.rc</file> <library>wine</library> Modified: trunk/reactos/dll/win32/uxtheme/uxtheme.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/uxtheme.…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/uxtheme.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/uxtheme.spec [iso-8859-1] Mon Sep 19 12:51:42 2011 @@ -29,8 +29,8 @@ 31 stub -noname InitUserTheme 32 stub -noname InitUserRegistry 33 stub -noname ReestablishServerConnection -34 stub -noname ThemeHooksInstall -35 stub -noname ThemeHooksRemove +34 stdcall -noname ThemeHooksInstall() +35 stdcall -noname ThemeHooksRemove() 36 stub -noname RefreshThemeForTS 43 stub -noname ClassicGetSystemMetrics 44 stub -noname ClassicSystemParametersInfoA @@ -95,3 +95,4 @@ @ stdcall OpenThemeData(ptr wstr) @ stdcall SetThemeAppProperties(long) @ stdcall SetWindowTheme(ptr wstr wstr) +@ stdcall ThemeInitApiHook(long ptr) Modified: trunk/reactos/dll/win32/uxtheme/uxthemedll.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/uxtheme/uxthemed…
============================================================================== --- trunk/reactos/dll/win32/uxtheme/uxthemedll.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/uxtheme/uxthemedll.h [iso-8859-1] Mon Sep 19 12:51:42 2011 @@ -21,80 +21,9 @@ #ifndef __WINE_UXTHEMEDLL_H #define __WINE_UXTHEMEDLL_H -typedef HANDLE HTHEMEFILE; - -/********************************************************************** - * EnumThemeProc - * - * Callback function for EnumThemes. - * - * RETURNS - * TRUE to continue enumeration, FALSE to stop - * - * PARAMS - * lpReserved Always 0 - * pszThemeFileName Full path to theme msstyles file - * pszThemeName Display name for theme - * pszToolTip Tooltip name for theme - * lpReserved2 Always 0 - * lpData Value passed through lpData from EnumThemes - */ -typedef BOOL (CALLBACK *EnumThemeProc)(LPVOID lpReserved, LPCWSTR pszThemeFileName, - LPCWSTR pszThemeName, LPCWSTR pszToolTip, LPVOID lpReserved2, - LPVOID lpData); - -/********************************************************************** - * ParseThemeIniFileProc - * - * Callback function for ParseThemeIniFile. - * - * RETURNS - * TRUE to continue enumeration, FALSE to stop - * - * PARAMS - * dwType Entry type - * pszParam1 Use defined by entry type - * pszParam2 Use defined by entry type - * pszParam3 Use defined by entry type - * dwParam Use defined by entry type - * lpData Value passed through lpData from ParseThemeIniFile - * - * NOTES - * I don't know what the valid entry types are - */ -typedef BOOL (CALLBACK*ParseThemeIniFileProc)(DWORD dwType, LPWSTR pszParam1, - LPWSTR pszParam2, LPWSTR pszParam3, - DWORD dwParam, LPVOID lpData); - -/* Structure filled in by EnumThemeColors() and EnumeThemeSizes() with the - * various strings for a theme color or size. */ -typedef struct tagTHEMENAMES -{ - WCHAR szName[MAX_PATH+1]; - WCHAR szDisplayName[MAX_PATH+1]; - WCHAR szTooltip[MAX_PATH+1]; -} THEMENAMES, *PTHEMENAMES; - -/* Declarations for undocumented functions for use internally */ -DWORD WINAPI QueryThemeServices(void); -HRESULT WINAPI OpenThemeFile(LPCWSTR pszThemeFileName, LPCWSTR pszColorName, - LPCWSTR pszSizeName, HTHEMEFILE *hThemeFile, - DWORD unknown); -HRESULT WINAPI CloseThemeFile(HTHEMEFILE hThemeFile); -HRESULT WINAPI ApplyTheme(HTHEMEFILE hThemeFile, char *unknown, HWND hWnd); -HRESULT WINAPI GetThemeDefaults(LPCWSTR pszThemeFileName, LPWSTR pszColorName, - DWORD dwColorNameLen, LPWSTR pszSizeName, - DWORD dwSizeNameLen); -HRESULT WINAPI EnumThemes(LPCWSTR pszThemePath, EnumThemeProc callback, - LPVOID lpData); -HRESULT WINAPI EnumThemeColors(LPWSTR pszThemeFileName, LPWSTR pszSizeName, - DWORD dwColorNum, PTHEMENAMES pszColorNames); -HRESULT WINAPI EnumThemeSizes(LPWSTR pszThemeFileName, LPWSTR pszColorName, - DWORD dwSizeNum, PTHEMENAMES pszColorNames); -HRESULT WINAPI ParseThemeIniFile(LPCWSTR pszIniFileName, LPWSTR pszUnknown, - ParseThemeIniFileProc callback, LPVOID lpData); - extern void UXTHEME_InitSystem(HINSTANCE hInst); +extern void UXTHEME_LoadTheme(BOOL bLoad); +extern BOOL CALLBACK UXTHEME_broadcast_msg (HWND hWnd, LPARAM msg); /* No alpha blending */ #define ALPHABLEND_NONE 0
13 years, 3 months
1
0
0
0
[gadamopoulos] 53747: [user32] - Merge from the themes branch
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Mon Sep 19 12:43:44 2011 New Revision: 53747 URL:
http://svn.reactos.org/svn/reactos?rev=53747&view=rev
Log: [user32] - Merge from the themes branch Modified: trunk/reactos/dll/win32/user32/include/user32p.h trunk/reactos/dll/win32/user32/misc/dllmain.c trunk/reactos/dll/win32/user32/misc/usrapihk.c trunk/reactos/dll/win32/user32/windows/defwnd.c trunk/reactos/dll/win32/user32/windows/hook.c Modified: trunk/reactos/dll/win32/user32/include/user32p.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/include/u…
============================================================================== --- trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/include/user32p.h [iso-8859-1] Mon Sep 19 12:43:44 2011 @@ -23,11 +23,14 @@ extern PPROCESSINFO g_ppi; extern ULONG_PTR g_ulSharedDelta; extern PSERVERINFO gpsi; -extern BOOL gfServerProcess; +extern BOOLEAN gfServerProcess; extern PUSER_HANDLE_TABLE gHandleTable; extern PUSER_HANDLE_ENTRY gHandleEntries; extern CRITICAL_SECTION U32AccelCacheLock; extern HINSTANCE hImmInstance; +extern RTL_CRITICAL_SECTION gcsUserApiHook; +extern USERAPIHOOK guah; +extern HINSTANCE ghmodUserApiHook; #define IS_ATOM(x) \ (((ULONG_PTR)(x) > 0x0) && ((ULONG_PTR)(x) < 0x10000)) @@ -51,13 +54,13 @@ extern int SPY_Init(void); /* definitions for usrapihk.c */ -extern RTL_CRITICAL_SECTION gcsUserApiHook; -extern USERAPIHOOK guah; BOOL FASTCALL BeginIfHookedUserApiHook(VOID); BOOL FASTCALL EndUserApiHook(VOID); BOOL FASTCALL IsInsideUserApiHook(VOID); VOID FASTCALL ResetUserApiHook(PUSERAPIHOOK); BOOL FASTCALL IsMsgOverride(UINT,PUAHOWP); +BOOL WINAPI InitUserApiHook(HINSTANCE hInstance, USERAPIHOOKPROC pfn); +BOOL WINAPI ClearUserApiHook(HINSTANCE hInstance); /* definitions for message.c */ BOOL FASTCALL MessageInit(VOID); Modified: trunk/reactos/dll/win32/user32/misc/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/dllm…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/dllmain.c [iso-8859-1] Mon Sep 19 12:43:44 2011 @@ -13,7 +13,7 @@ PUSER_HANDLE_ENTRY gHandleEntries = NULL; PSERVERINFO gpsi = NULL; ULONG_PTR g_ulSharedDelta; -BOOL gfServerProcess = FALSE; +BOOLEAN gfServerProcess = FALSE; WCHAR szAppInit[KEY_LENGTH]; @@ -198,7 +198,7 @@ { USERCONNECT UserCon; PVOID *KernelCallbackTable; - + /* Set up the kernel callbacks. */ KernelCallbackTable = NtCurrentPeb()->KernelCallbackTable; KernelCallbackTable[USER32_CALLBACK_WINDOWPROC] = @@ -217,6 +217,8 @@ (PVOID)User32CallLoadMenuFromKernel; KernelCallbackTable[USER32_CALLBACK_CLIENTTHREADSTARTUP] = (PVOID)User32CallClientThreadSetupFromKernel; + KernelCallbackTable[USER32_CALLBACK_CLIENTLOADLIBRARY] = + (PVOID)User32CallClientLoadLibraryFromKernel; NtUserProcessConnect( NtCurrentProcess(), &UserCon, @@ -229,8 +231,9 @@ gHandleEntries = SharedPtrToUser(gHandleTable->handles); RtlInitializeCriticalSection(&gcsUserApiHook); - gfServerProcess = TRUE; // FIXME HAX! Used in CsrClientConnectToServer(,,,,&gfServerProcess); - + gfServerProcess = FALSE; // FIXME HAX! Used in CsrClientConnectToServer(,,,,&gfServerProcess); + + //CsrClientConnectToServer(L"\\Windows", 0, NULL, 0, &gfServerProcess); //ERR("1 SI 0x%x : HT 0x%x : D 0x%x\n", UserCon.siClient.psi, UserCon.siClient.aheList, g_ulSharedDelta); /* Allocate an index for user32 thread local data. */ Modified: trunk/reactos/dll/win32/user32/misc/usrapihk.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/misc/usra…
============================================================================== --- trunk/reactos/dll/win32/user32/misc/usrapihk.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/misc/usrapihk.c [iso-8859-1] Mon Sep 19 12:43:44 2011 @@ -200,7 +200,7 @@ if ( ghmodUserApiHook == hInstance ) { pfn1 = gpfnInitUserApi; - if ( --gcLoadUserApiHook == 1 ) + if ( --gcLoadUserApiHook == 0 ) { gfUserApiHook = 0; ResetUserApiHook(&guah); @@ -228,7 +228,7 @@ RtlEnterCriticalSection(&gcsUserApiHook); pfn1 = gpfnInitUserApi; - if ( --gcLoadUserApiHook == 1 ) + if ( --gcLoadUserApiHook == 0 ) { if ( gcCallUserApiHook ) { @@ -392,7 +392,5 @@ */ BOOL WINAPI UnregisterUserApiHook(VOID) { - // Direct call to Win32k! Here only as a prototype..... - UNIMPLEMENTED; - return FALSE; -} + return NtUserUnregisterUserApiHook(); +} Modified: trunk/reactos/dll/win32/user32/windows/defwnd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/defwnd.c [iso-8859-1] Mon Sep 19 12:43:44 2011 @@ -2200,7 +2200,13 @@ Hook = BeginIfHookedUserApiHook(); if (Hook) + { msgOverride = IsMsgOverride(Msg, &guah.DefWndProcArray); + if(msgOverride == FALSE) + { + EndUserApiHook(); + } + } /* Bypass SEH and go direct. */ if (!Hook || !msgOverride) @@ -2233,7 +2239,13 @@ Hook = BeginIfHookedUserApiHook(); if (Hook) + { msgOverride = IsMsgOverride(Msg, &guah.DefWndProcArray); + if(msgOverride == FALSE) + { + EndUserApiHook(); + } + } /* Bypass SEH and go direct. */ if (!Hook || !msgOverride) Modified: trunk/reactos/dll/win32/user32/windows/hook.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/h…
============================================================================== --- trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/hook.c [iso-8859-1] Mon Sep 19 12:43:44 2011 @@ -425,6 +425,126 @@ DWORD dwThreadId) { return IntSetWindowsHook(idHook, lpfn, hMod, dwThreadId, FALSE); +} + +HINSTANCE ClientLoadLibrary(PUNICODE_STRING pstrLibName, + PUNICODE_STRING pstrInitFunc, + BOOL Unload, + BOOL ApiHook) +{ + HINSTANCE hLibrary; + PVOID pInitFunction; + NTSTATUS Status; + ANSI_STRING InitFuncName; + BOOL Result = FALSE; + + TRACE("ClientLoadLibrary: pid: %d, strLibraryName: %S, " + "strInitFuncName: %S, Unload: %d, ApiHook:%d\n", + GetCurrentProcessId(), + pstrLibName->Buffer, + pstrInitFunc->Buffer, + Unload, + ApiHook); + + /* Check if we have to load the module */ + if(Unload == FALSE) + { + ASSERT(pstrLibName->Buffer != NULL); + + /* Load it */ + hLibrary = LoadLibrary(pstrLibName->Buffer); + if(hLibrary == 0) + { + return hLibrary; + } + + if(ApiHook == FALSE) + { + /* There is nothing more to do for a global hook*/ + return hLibrary; + } + + /* Initialize the user api hook */ + ASSERT(pstrInitFunc->Buffer); + + Status = RtlUnicodeStringToAnsiString(&InitFuncName, + pstrInitFunc, + TRUE); + + /* Get the address of the initialization routine */ + pInitFunction = GetProcAddress(hLibrary, InitFuncName.Buffer); + if(pInitFunction) + { + /* Call the initialization routine */ + Result = InitUserApiHook(hLibrary, (USERAPIHOOKPROC)pInitFunction); + } + RtlFreeAnsiString(&InitFuncName); + + /* In case of error unload the library */ + if(Result == FALSE) + { + FreeLibrary(hLibrary); + hLibrary = 0; + } + } + else + { + /* Cleanup user api hook before unloading */ + if(ApiHook == TRUE) + { + hLibrary = ghmodUserApiHook; + Result = ClearUserApiHook(ghmodUserApiHook); + /* Check if we can we unload it now */ + if(Result == FALSE) + { + /* Return success because we are going to free + the library in EndUserApiHook*/ + return hLibrary; + } + } + else + { + hLibrary = GetModuleHandle(pstrLibName->Buffer); + Result = (hLibrary != 0); + } + + if(Result == TRUE) + { + Result = FreeLibrary(hLibrary); + if(Result == FALSE) + { + hLibrary = 0; + } + } + } + + return hLibrary; +} + +NTSTATUS WINAPI +User32CallClientLoadLibraryFromKernel(PVOID Arguments, ULONG ArgumentLength) +{ + HINSTANCE Result; + PCLIENT_LOAD_LIBRARY_ARGUMENTS Argument; + + /* Retireve the callback parameters */ + Argument = (PCLIENT_LOAD_LIBRARY_ARGUMENTS)Arguments; + if(Argument->strLibraryName.Buffer != NULL) + { + Argument->strLibraryName.Buffer = (PWCHAR)((ULONG_PTR)Argument->strLibraryName.Buffer + (ULONG_PTR)Argument); + } + if(Argument->strInitFuncName.Buffer != NULL) + { + Argument->strInitFuncName.Buffer = (PWCHAR)((ULONG_PTR)Argument->strInitFuncName.Buffer + (ULONG_PTR)Argument); + } + + /* Call the implementation of the callback */ + Result = ClientLoadLibrary(&Argument->strLibraryName, + &Argument->strInitFuncName, + Argument->Unload, + Argument->ApiHook); + + return ZwCallbackReturn(&Result, sizeof(HINSTANCE), STATUS_SUCCESS); } NTSTATUS WINAPI
13 years, 3 months
1
0
0
0
[tkreuzer] 53746: [RTL] - Fix a number of MSVC/amd64 warnings/problems - Remove code duplication in RtlCharToInteger and RtlUnicodeStringToInteger - Fixup too large string length in RtlInitAnsiStri...
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Mon Sep 19 11:09:09 2011 New Revision: 53746 URL:
http://svn.reactos.org/svn/reactos?rev=53746&view=rev
Log: [RTL] - Fix a number of MSVC/amd64 warnings/problems - Remove code duplication in RtlCharToInteger and RtlUnicodeStringToInteger - Fixup too large string length in RtlInitAnsiString, RtlInitUnicodeString - Use symbolic constants instead of hardcoded values - Fix overflow check in RtlInitUnicodeStringEx Modified: trunk/reactos/include/ndk/rtlfuncs.h trunk/reactos/lib/rtl/acl.c trunk/reactos/lib/rtl/actctx.c trunk/reactos/lib/rtl/amd64/unwind.c trunk/reactos/lib/rtl/image.c trunk/reactos/lib/rtl/ppb.c trunk/reactos/lib/rtl/unicode.c Modified: trunk/reactos/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Mon Sep 19 11:09:09 2011 @@ -1118,7 +1118,7 @@ IN ULONG Revision, IN ULONG Flags, IN ULONG MandatoryFlags, - IN ULONG AceType, + IN UCHAR AceType, IN PSID LabelSid); NTSYSAPI @@ -1993,7 +1993,7 @@ NTAPI RtlFillMemoryUlong( IN PVOID Destination, - IN ULONG Length, + IN SIZE_T Length, IN ULONG Fill ); Modified: trunk/reactos/lib/rtl/acl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/acl.c?rev=53746&r1…
============================================================================== --- trunk/reactos/lib/rtl/acl.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/acl.c [iso-8859-1] Mon Sep 19 11:09:09 2011 @@ -110,7 +110,7 @@ GUID *ObjectTypeGuid OPTIONAL, GUID *InheritedObjectTypeGuid OPTIONAL, PSID Sid, - ULONG Type) + UCHAR Type) { PACE Ace; PSID SidStart; @@ -223,7 +223,7 @@ } /* initialize the header and common fields */ - Ace->Header.AceFlags = Flags; + Ace->Header.AceFlags = (BYTE)Flags; Ace->Header.AceType = Type; Ace->Header.AceSize = (WORD)AceSize; Ace->AccessMask = AccessMask; @@ -253,7 +253,7 @@ /* copy the SID */ RtlCopySid(RtlLengthSid(Sid), SidStart, Sid); Acl->AceCount++; - Acl->AclRevision = Revision; + Acl->AclRevision = (BYTE)Revision; return STATUS_SUCCESS; } @@ -322,7 +322,7 @@ IN GUID *InheritedObjectTypeGuid OPTIONAL, IN PSID Sid) { - ULONG Type; + UCHAR Type; PAGED_CODE_RTL(); /* make sure we call RtlpAddKnownAce correctly */ @@ -405,7 +405,7 @@ IN GUID *InheritedObjectTypeGuid OPTIONAL, IN PSID Sid) { - ULONG Type; + UCHAR Type; PAGED_CODE_RTL(); /* make sure we call RtlpAddKnownAce correctly */ @@ -465,6 +465,7 @@ ULONG Index; PAGED_CODE_RTL(); + /* Make sure, the ACL is valid */ if (Acl->AclRevision < MIN_ACL_REVISION || Acl->AclRevision > MAX_ACL_REVISION || !RtlFirstFreeAce(Acl, &Ace)) @@ -472,8 +473,10 @@ return STATUS_INVALID_PARAMETER; } + /* Check if the ACL revision is smaller than the given one */ if (Acl->AclRevision <= AclRevision) { + /* Update the revision to the given one */ AclRevision = Acl->AclRevision; } @@ -510,6 +513,7 @@ AceListLength, Current, (ULONG)((ULONG_PTR)Ace - (ULONG_PTR)Current)); + Acl->AceCount = Acl->AceCount + NewAceCount; Acl->AclRevision = AclRevision; @@ -591,7 +595,7 @@ BOOLEAN Success, BOOLEAN Failure) { - ULONG Type; + UCHAR Type; if (Success) { @@ -630,7 +634,7 @@ IN ULONG Revision, IN ULONG Flags, IN ULONG MandatoryFlags, - IN ULONG AceType, + IN UCHAR AceType, IN PSID LabelSid) { if (MandatoryFlags & ~SYSTEM_MANDATORY_LABEL_VALID_MASK) Modified: trunk/reactos/lib/rtl/actctx.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/actctx.c?rev=53746…
============================================================================== --- trunk/reactos/lib/rtl/actctx.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/actctx.c [iso-8859-1] Mon Sep 19 11:09:09 2011 @@ -3,7 +3,7 @@ * PROJECT: ReactOS Runtime Library * PURPOSE: Activation Context Support * FILE: lib/rtl/actctx.c - * PROGRAMERS: + * PROGRAMERS: * Jon Griffiths * Eric Pouech * Jacek Caban for CodeWeavers @@ -241,7 +241,7 @@ UNICODE_STRING res; res.Buffer = (PWSTR)xmlstr->ptr; - res.Length = res.MaximumLength = xmlstr->len * sizeof(WCHAR); + res.Length = res.MaximumLength = (USHORT)xmlstr->len * sizeof(WCHAR); return res; } @@ -647,7 +647,7 @@ if (ptr == xmlbuf->end || *ptr != '=') return FALSE; name->ptr = xmlbuf->ptr; - name->len = ptr-xmlbuf->ptr; + name->len = (ULONG)(ptr - xmlbuf->ptr); xmlbuf->ptr = ptr; ptr++; @@ -663,7 +663,7 @@ return FALSE; } - value->len = ptr - value->ptr; + value->len = (ULONG)(ptr - value->ptr); xmlbuf->ptr = ptr + 1; if (xmlbuf->ptr == xmlbuf->end) return FALSE; @@ -705,7 +705,7 @@ ptr++; elem->ptr = xmlbuf->ptr; - elem->len = ptr - xmlbuf->ptr; + elem->len = (ULONG)(ptr - xmlbuf->ptr); xmlbuf->ptr = ptr; return xmlbuf->ptr != xmlbuf->end; } @@ -733,7 +733,7 @@ if (!ptr) return FALSE; content->ptr = xmlbuf->ptr; - content->len = ptr - xmlbuf->ptr; + content->len = (ULONG)(ptr - xmlbuf->ptr); xmlbuf->ptr = ptr; return TRUE; @@ -1555,7 +1555,7 @@ : ACTIVATION_CONTEXT_PATH_TYPE_NONE; unicode_tests = IS_TEXT_UNICODE_SIGNATURE | IS_TEXT_UNICODE_REVERSE_SIGNATURE; - if (RtlIsTextUnicode( (PVOID) buffer, size, &unicode_tests )) + if (RtlIsTextUnicode((PVOID)buffer, (ULONG)size, &unicode_tests )) { xmlbuf.ptr = buffer; xmlbuf.end = xmlbuf.ptr + size / sizeof(WCHAR); @@ -1579,12 +1579,12 @@ else { /* let's assume utf-8 for now */ - int len; + size_t len; WCHAR *new_buff; _SEH2_TRY { - len = mbstowcs( NULL, buffer, size); + len = mbstowcs(NULL, buffer, size); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -1628,7 +1628,7 @@ return NtOpenFile( handle, GENERIC_READ, &attr, &io, FILE_SHARE_READ, FILE_SYNCHRONOUS_IO_ALERT ); } -static NTSTATUS get_module_filename( HMODULE module, UNICODE_STRING *str, unsigned int extra_len ) +static NTSTATUS get_module_filename( HMODULE module, UNICODE_STRING *str, USHORT extra_len ) { NTSTATUS status; ULONG magic; @@ -1881,7 +1881,7 @@ WCHAR *tmp; ULONG build, revision; - data_len = io.Information; + data_len = (ULONG)io.Information; for (;;) { @@ -1890,7 +1890,7 @@ NtQueryDirectoryFile( dir, 0, NULL, NULL, &io, buffer, sizeof(buffer), FileBothDirectoryInformation, FALSE, &lookup_us, FALSE ); if (io.Status != STATUS_SUCCESS) break; - data_len = io.Information; + data_len = (ULONG)io.Information; data_pos = 0; } dir_info = (FILE_BOTH_DIR_INFORMATION*)(buffer + data_pos); @@ -1905,8 +1905,8 @@ revision = atoiW(tmp); if (build == ai->version.build && revision < ai->version.revision) continue; - ai->version.build = build; - ai->version.revision = revision; + ai->version.build = (USHORT)build; + ai->version.revision = (USHORT)revision; if ((ret = RtlAllocateHeap( RtlGetProcessHeap(), 0, dir_info->FileNameLength * sizeof(WCHAR) ))) { @@ -1935,7 +1935,7 @@ if (!ai->arch || !ai->name || !ai->public_key) return STATUS_NO_SUCH_FILE; - if (!(path = RtlAllocateHeap( RtlGetProcessHeap(), 0, + if (!(path = RtlAllocateHeap( RtlGetProcessHeap(), 0, ((strlenW(SharedUserData->NtSystemRoot) + 1) *sizeof(WCHAR)) + sizeof(manifest_dirW) ))) return STATUS_NO_MEMORY; @@ -2373,17 +2373,17 @@ NTAPI RtlActivateActivationContextEx( ULONG flags, PTEB tebAddress, HANDLE handle, PULONG_PTR cookie ) { RTL_ACTIVATION_CONTEXT_STACK_FRAME *frame; - + if (!(frame = RtlAllocateHeap( RtlGetProcessHeap(), 0, sizeof(*frame) ))) return STATUS_NO_MEMORY; - + frame->Previous = tebAddress->ActivationContextStackPointer->ActiveFrame; frame->ActivationContext = handle; frame->Flags = 0; - + tebAddress->ActivationContextStackPointer->ActiveFrame = frame; RtlAddRefActivationContext( handle ); - + *cookie = (ULONG_PTR)frame; DPRINT( "%p cookie=%lx\n", handle, *cookie ); return STATUS_SUCCESS; @@ -2525,11 +2525,11 @@ acdi->ulFormatVersion = assembly ? 1 : 0; /* FIXME */ acdi->ulAssemblyCount = actctx->num_assemblies; acdi->ulRootManifestPathType = assembly ? assembly->manifest.type : 0 /* FIXME */; - acdi->ulRootManifestPathChars = assembly && assembly->manifest.info ? manifest_len - 1 : 0; + acdi->ulRootManifestPathChars = assembly && assembly->manifest.info ? (DWORD)manifest_len - 1 : 0; acdi->ulRootConfigurationPathType = actctx->config.type; - acdi->ulRootConfigurationPathChars = actctx->config.info ? config_len - 1 : 0; + acdi->ulRootConfigurationPathChars = actctx->config.info ? (DWORD)config_len - 1 : 0; acdi->ulAppDirPathType = actctx->appdir.type; - acdi->ulAppDirPathChars = actctx->appdir.info ? appdir_len - 1 : 0; + acdi->ulAppDirPathChars = actctx->appdir.info ? (DWORD)appdir_len - 1 : 0; ptr = (LPWSTR)(acdi + 1); if (manifest_len) { @@ -2589,9 +2589,9 @@ } afdi->ulFlags = 0; /* FIXME */ - afdi->ulEncodedAssemblyIdentityLength = (id_len - 1) * sizeof(WCHAR); + afdi->ulEncodedAssemblyIdentityLength = (DWORD)(id_len - 1) * sizeof(WCHAR); afdi->ulManifestPathType = assembly->manifest.type; - afdi->ulManifestPathLength = assembly->manifest.info ? (path_len - 1) * sizeof(WCHAR) : 0; + afdi->ulManifestPathLength = assembly->manifest.info ? (DWORD)(path_len - 1) * sizeof(WCHAR) : 0; /* FIXME afdi->liManifestLastWriteTime = 0; */ afdi->ulPolicyPathType = ACTIVATION_CONTEXT_PATH_TYPE_NONE; /* FIXME */ afdi->ulPolicyPathLength = 0; @@ -2601,7 +2601,7 @@ afdi->ulManifestVersionMinor = 0; afdi->ulPolicyVersionMajor = 0; /* FIXME */ afdi->ulPolicyVersionMinor = 0; /* FIXME */ - afdi->ulAssemblyDirectoryNameLength = ad_len ? (ad_len - 1) * sizeof(WCHAR) : 0; + afdi->ulAssemblyDirectoryNameLength = ad_len ? (DWORD)(ad_len - 1) * sizeof(WCHAR) : 0; ptr = (LPWSTR)(afdi + 1); afdi->lpAssemblyEncodedAssemblyIdentity = ptr; memcpy( ptr, assembly_id, id_len * sizeof(WCHAR) ); @@ -2654,7 +2654,7 @@ } if (retlen) *retlen = 0; /* yes that's what native does !! */ afdi->ulFlags = ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION; - afdi->ulFilenameLength = dll_len ? (dll_len - 1) * sizeof(WCHAR) : 0; + afdi->ulFilenameLength = dll_len ? (DWORD)(dll_len - 1) * sizeof(WCHAR) : 0; afdi->ulPathLength = 0; /* FIXME */ ptr = (LPWSTR)(afdi + 1); if (dll_len) Modified: trunk/reactos/lib/rtl/amd64/unwind.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/amd64/unwind.c?rev…
============================================================================== --- trunk/reactos/lib/rtl/amd64/unwind.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/amd64/unwind.c [iso-8859-1] Mon Sep 19 11:09:09 2011 @@ -59,7 +59,7 @@ OPTIONAL ULONG ExceptionHandler; OPTIONAL ULONG FunctionEntry; }; - OPTIONAL ULONG ExceptionData[]; + OPTIONAL ULONG ExceptionData[]; */ } UNWIND_INFO, *PUNWIND_INFO; @@ -69,7 +69,7 @@ * \brief Locates the table of RUNTIME_FUNCTION entries for a code address. * \param ControlPc * Address of the code, for which the table should be searched. - * \param ImageBase + * \param ImageBase * Pointer to a DWORD64 that receives the base address of the * corresponding executable image. * \param Length @@ -354,7 +354,7 @@ IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers) { PUNWIND_INFO UnwindInfo; - ULONG CodeOffset; + ULONG_PTR CodeOffset; ULONG i; UNWIND_CODE UnwindCode; BYTE Reg; @@ -524,7 +524,7 @@ ULONG64 ControlPc, ImageBase, EstablisherFrame; ULONG64 StackLow, StackHigh; PVOID HandlerData; - INT i; + ULONG i; PRUNTIME_FUNCTION FunctionEntry; DPRINT("Enter RtlWalkFrameChain\n"); Modified: trunk/reactos/lib/rtl/image.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/image.c?rev=53746&…
============================================================================== --- trunk/reactos/lib/rtl/image.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/image.c [iso-8859-1] Mon Sep 19 11:09:09 2011 @@ -43,7 +43,7 @@ NTAPI LdrVerifyMappedImageMatchesChecksum( IN PVOID BaseAddress, - IN ULONG ImageSize, + IN SIZE_T ImageSize, IN ULONG FileLength) { #if 0 @@ -192,7 +192,7 @@ DPRINT1("e_lfanew is larger than PE file\n"); return STATUS_INVALID_IMAGE_FORMAT; } - + /* It shouldn't be past 4GB either */ if (DosHeader->e_lfanew >= (MAXULONG - sizeof(IMAGE_DOS_SIGNATURE) - sizeof(IMAGE_FILE_HEADER))) @@ -201,7 +201,7 @@ DPRINT1("e_lfanew is larger than 4GB\n"); return STATUS_INVALID_IMAGE_FORMAT; } - + /* And the whole file shouldn't overflow past 4GB */ if ((DosHeader->e_lfanew + sizeof(IMAGE_DOS_SIGNATURE) - sizeof(IMAGE_FILE_HEADER)) >= Size) @@ -211,7 +211,7 @@ return STATUS_INVALID_IMAGE_FORMAT; } } - + /* The offset also can't be larger than 256MB, as a hard-coded check */ if (DosHeader->e_lfanew >= (256 * 1024 * 1024)) { @@ -235,7 +235,7 @@ *OutHeaders = NtHeaders; return STATUS_SUCCESS; } - + /* * @implemented */ Modified: trunk/reactos/lib/rtl/ppb.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/ppb.c?rev=53746&r1…
============================================================================== --- trunk/reactos/lib/rtl/ppb.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/ppb.c [iso-8859-1] Mon Sep 19 11:09:09 2011 @@ -26,7 +26,7 @@ RtlpCopyParameterString(PWCHAR *Ptr, PUNICODE_STRING Destination, PUNICODE_STRING Source, - ULONG Size) + USHORT Size) { Destination->Length = Source->Length; Destination->MaximumLength = Size ? Size : Source->MaximumLength; Modified: trunk/reactos/lib/rtl/unicode.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/unicode.c?rev=5374…
============================================================================== --- trunk/reactos/lib/rtl/unicode.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/unicode.c [iso-8859-1] Mon Sep 19 11:09:09 2011 @@ -99,7 +99,7 @@ if (AllocateDestinationString) { UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR); - UniDest->MaximumLength = Length; + UniDest->MaximumLength = (USHORT)Length; if (!UniDest->Buffer) return STATUS_NO_MEMORY; } else if (UniDest->Length >= UniDest->MaximumLength) @@ -320,17 +320,13 @@ digit = -1; } - if (digit < 0 || digit >= (int)base) - { - *value = bMinus ? -RunningTotal : RunningTotal; - return STATUS_SUCCESS; - } + if (digit < 0 || digit >= (int)base) break; RunningTotal = RunningTotal * base + digit; str++; } - *value = bMinus ? -RunningTotal : RunningTotal; + *value = bMinus ? (0 - RunningTotal) : RunningTotal; return STATUS_SUCCESS; } @@ -518,13 +514,14 @@ RtlInitAnsiString(IN OUT PANSI_STRING DestinationString, IN PCSZ SourceString) { - ULONG DestSize; - - if(SourceString) - { - DestSize = strlen(SourceString); - DestinationString->Length = (USHORT)DestSize; - DestinationString->MaximumLength = (USHORT)DestSize + sizeof(CHAR); + SIZE_T Size; + + if (SourceString) + { + Size = strlen(SourceString); + if (Size > (MAXUSHORT - sizeof(CHAR))) Size = MAXUSHORT - sizeof(CHAR); + DestinationString->Length = (USHORT)Size; + DestinationString->MaximumLength = (USHORT)Size + sizeof(CHAR); } else { @@ -540,14 +537,14 @@ RtlInitAnsiStringEx(IN OUT PANSI_STRING DestinationString, IN PCSZ SourceString) { - ULONG DestSize; - - if(SourceString) - { - DestSize = strlen(SourceString); - if (DestSize >= 0xFFFF) return STATUS_NAME_TOO_LONG; - DestinationString->Length = (USHORT)DestSize; - DestinationString->MaximumLength = (USHORT)DestSize + sizeof(CHAR); + SIZE_T Size; + + if (SourceString) + { + Size = strlen(SourceString); + if (Size > (MAXUSHORT - sizeof(CHAR))) return STATUS_NAME_TOO_LONG; + DestinationString->Length = (USHORT)Size; + DestinationString->MaximumLength = (USHORT)Size + sizeof(CHAR); } else { @@ -582,16 +579,18 @@ */ VOID NTAPI -RtlInitUnicodeString(IN OUT PUNICODE_STRING DestinationString, - IN PCWSTR SourceString) -{ - ULONG DestSize; - - if(SourceString) - { - DestSize = wcslen(SourceString) * sizeof(WCHAR); - DestinationString->Length = (USHORT)DestSize; - DestinationString->MaximumLength = (USHORT)DestSize + sizeof(WCHAR); +RtlInitUnicodeString( + IN OUT PUNICODE_STRING DestinationString, + IN PCWSTR SourceString) +{ + SIZE_T Size; + + if (SourceString) + { + Size = wcslen(SourceString) * sizeof(WCHAR); + if (Size > (MAXUSHORT - sizeof(WCHAR))) Size = MAXUSHORT - sizeof(WCHAR); + DestinationString->Length = (USHORT)Size; + DestinationString->MaximumLength = (USHORT)Size + sizeof(WCHAR); } else { @@ -607,17 +606,18 @@ */ NTSTATUS NTAPI -RtlInitUnicodeStringEx(OUT PUNICODE_STRING DestinationString, - IN PCWSTR SourceString) -{ - ULONG DestSize; - - if(SourceString) - { - DestSize = wcslen(SourceString) * sizeof(WCHAR); - if (DestSize >= 0xFFFC) return STATUS_NAME_TOO_LONG; - DestinationString->Length = (USHORT)DestSize; - DestinationString->MaximumLength = (USHORT)DestSize + sizeof(WCHAR); +RtlInitUnicodeStringEx( + OUT PUNICODE_STRING DestinationString, + IN PCWSTR SourceString) +{ + SIZE_T Size; + + if (SourceString) + { + Size = wcslen(SourceString) * sizeof(WCHAR); + if (Size > (MAXUSHORT - sizeof(WCHAR))) return STATUS_NAME_TOO_LONG; + DestinationString->Length = (USHORT)Size; + DestinationString->MaximumLength = (USHORT)Size + sizeof(WCHAR); } else { @@ -646,7 +646,7 @@ CHAR buffer[33]; PCHAR pos; CHAR digit; - ULONG len; + SIZE_T len; if (base == 0) { @@ -663,7 +663,7 @@ do { pos--; - digit = value % base; + digit = (CHAR)(value % base); value = value / base; if (digit < 10) @@ -734,8 +734,8 @@ i = v % Radix; v = v / Radix; - if (i < 10) *tp = i + L'0'; - else *tp = i + L'a' - 10; + if (i < 10) *tp = (WCHAR)(i + L'0'); + else *tp = (WCHAR)(i + L'a' - 10); tp++; } @@ -1003,18 +1003,14 @@ digit = -1; } - if (digit < 0 || digit >= base) - { - *value = bMinus ? -RunningTotal : RunningTotal; - return STATUS_SUCCESS; - } + if (digit < 0 || (ULONG)digit >= base) break; RunningTotal = RunningTotal * base + digit; lpwstr++; CharsRemaining--; } - *value = bMinus ? -RunningTotal : RunningTotal; + *value = bMinus ? (0 - RunningTotal) : RunningTotal; return STATUS_SUCCESS; } @@ -1078,7 +1074,7 @@ if (AllocateDestinationString) { AnsiDest->Buffer = RtlpAllocateStringMemory(Length, TAG_ASTR); - AnsiDest->MaximumLength = Length; + AnsiDest->MaximumLength = (USHORT)Length; if (!AnsiDest->Buffer) return STATUS_NO_MEMORY; } @@ -1135,7 +1131,7 @@ if (AllocateDestinationString) { UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR); - UniDest->MaximumLength = Length; + UniDest->MaximumLength = (USHORT)Length; if (!UniDest->Buffer) return STATUS_NO_MEMORY; } @@ -1189,7 +1185,7 @@ if (AllocateDestinationString) { OemDest->Buffer = RtlpAllocateStringMemory(Length, TAG_OSTR); - OemDest->MaximumLength = Length; + OemDest->MaximumLength = (USHORT)Length; if (!OemDest->Buffer) return STATUS_NO_MEMORY; } @@ -1378,7 +1374,7 @@ if (AllocateDestinationString) { UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR); - UniDest->MaximumLength = Length; + UniDest->MaximumLength = (USHORT)Length; if (!UniDest->Buffer) return STATUS_NO_MEMORY; } @@ -1455,8 +1451,7 @@ NTAPI RtlEqualDomainName ( IN PUNICODE_STRING DomainName1, - IN PUNICODE_STRING DomainName2 -) + IN PUNICODE_STRING DomainName2) { return RtlEqualComputerName(DomainName1, DomainName2); } @@ -1483,8 +1478,7 @@ NTAPI RtlGUIDFromString( IN UNICODE_STRING *str, - OUT GUID* guid -) + OUT GUID* guid) { int i = 0; const WCHAR *lpszCLSID = str->Buffer; @@ -1697,7 +1691,7 @@ if (AllocateDestinationString) { OemDest->Buffer = RtlpAllocateStringMemory(Length, TAG_OSTR); - OemDest->MaximumLength = Length; + OemDest->MaximumLength = (USHORT)Length; if (!OemDest->Buffer) return STATUS_NO_MEMORY; } else if (OemDest->Length > OemDest->MaximumLength) @@ -1742,13 +1736,12 @@ NTSTATUS Status = STATUS_SUCCESS; CHAR Buffer[65]; CHAR Digit; - ULONG Len; + SIZE_T Len; PCHAR Pos; if (Base == 0) Base = 10; - if ((Base != 2) && (Base != 8) && - (Base != 10) && (Base != 16)) + if ((Base != 2) && (Base != 8) && (Base != 10) && (Base != 16)) { return STATUS_INVALID_PARAMETER; } @@ -1759,7 +1752,7 @@ do { Pos--; - Digit = Val % Base; + Digit = (CHAR)(Val % Base); Val = Val / Base; if (Digit < 10) @@ -1873,7 +1866,7 @@ if (AllocateDestinationString) { AnsiDest->Buffer = RtlpAllocateStringMemory(Length, TAG_ASTR); - AnsiDest->MaximumLength = Length; + AnsiDest->MaximumLength = (USHORT)Length; if (!AnsiDest->Buffer) return STATUS_NO_MEMORY; } else if (AnsiDest->Length >= AnsiDest->MaximumLength) @@ -1931,7 +1924,7 @@ if (AllocateDestinationString) { OemDest->Buffer = RtlpAllocateStringMemory(Length, TAG_OSTR); - OemDest->MaximumLength = Length; + OemDest->MaximumLength = (USHORT)Length; if (!OemDest->Buffer) return STATUS_NO_MEMORY; } else if (OemDest->Length > OemDest->MaximumLength) @@ -1985,7 +1978,7 @@ if (AllocateDestinationString) { OemDest->Buffer = RtlpAllocateStringMemory(Length, TAG_OSTR); - OemDest->MaximumLength = Length; + OemDest->MaximumLength = (USHORT)Length; if (!OemDest->Buffer) return STATUS_NO_MEMORY; } else if (OemDest->Length >= OemDest->MaximumLength) @@ -2208,19 +2201,19 @@ IN OUT PUNICODE_STRING UniDest, IN PCWSTR Source) { - ULONG Length; + SIZE_T Size; PAGED_CODE_RTL(); - Length = (wcslen(Source) + 1) * sizeof(WCHAR); - if (Length > 0xFFFE) return FALSE; - - UniDest->Buffer = RtlpAllocateStringMemory(Length, TAG_USTR); + Size = (wcslen(Source) + 1) * sizeof(WCHAR); + if (Size > MAXUSHORT) return FALSE; + + UniDest->Buffer = RtlpAllocateStringMemory((ULONG)Size, TAG_USTR); if (UniDest->Buffer == NULL) return FALSE; - RtlCopyMemory(UniDest->Buffer, Source, Length); - UniDest->MaximumLength = (USHORT)Length; - UniDest->Length = Length - sizeof (WCHAR); + RtlCopyMemory(UniDest->Buffer, Source, Size); + UniDest->MaximumLength = (USHORT)Size; + UniDest->Length = (USHORT)Size - sizeof (WCHAR); return TRUE; } @@ -2353,19 +2346,19 @@ IN OUT PSTRING Destination, IN PCSZ Source) { - ULONG Length; + SIZE_T Size; if (Source) { - Length = (USHORT)strlen(Source); - - if (Destination->Length + Length > Destination->MaximumLength) + Size = strlen(Source); + + if (Destination->Length + Size > Destination->MaximumLength) { return STATUS_BUFFER_TOO_SMALL; } - RtlMoveMemory(&Destination->Buffer[Destination->Length], Source, Length); - Destination->Length += Length; + RtlMoveMemory(&Destination->Buffer[Destination->Length], Source, Size); + Destination->Length += (USHORT)Size; } return STATUS_SUCCESS; @@ -2379,7 +2372,7 @@ RtlUpperString(PSTRING DestinationString, PSTRING SourceString) { - ULONG Length; + USHORT Length; PCHAR Src, Dest; Length = min(SourceString->Length, @@ -2502,20 +2495,20 @@ IN PCUNICODE_STRING MatchString, OUT PUSHORT Position) { - int main_idx; - unsigned int search_idx; + SHORT i; + USHORT j; switch (Flags) { case 0: { - for (main_idx = 0; main_idx < SearchString->Length / sizeof(WCHAR); main_idx++) + for (i = 0; i < SearchString->Length / sizeof(WCHAR); i++) { - for (search_idx = 0; search_idx < MatchString->Length / sizeof(WCHAR); search_idx++) + for (j = 0; j < MatchString->Length / sizeof(WCHAR); j++) { - if (SearchString->Buffer[main_idx] == MatchString->Buffer[search_idx]) + if (SearchString->Buffer[i] == MatchString->Buffer[j]) { - *Position = (main_idx + 1) * sizeof(WCHAR); + *Position = (i + 1) * sizeof(WCHAR); return STATUS_SUCCESS; } } @@ -2527,13 +2520,13 @@ case 1: { - for (main_idx = SearchString->Length / sizeof(WCHAR) - 1; main_idx >= 0; main_idx--) + for (i = SearchString->Length / sizeof(WCHAR) - 1; i >= 0; i--) { - for (search_idx = 0; search_idx < MatchString->Length / sizeof(WCHAR); search_idx++) + for (j = 0; j < MatchString->Length / sizeof(WCHAR); j++) { - if (SearchString->Buffer[main_idx] == MatchString->Buffer[search_idx]) + if (SearchString->Buffer[i] == MatchString->Buffer[j]) { - *Position = main_idx * sizeof(WCHAR); + *Position = i * sizeof(WCHAR); return STATUS_SUCCESS; } } @@ -2545,19 +2538,19 @@ case 2: { - for (main_idx = 0; main_idx < SearchString->Length / sizeof(WCHAR); main_idx++) + for (i = 0; i < SearchString->Length / sizeof(WCHAR); i++) { - search_idx = 0; - - while (search_idx < MatchString->Length / sizeof(WCHAR) && - SearchString->Buffer[main_idx] != MatchString->Buffer[search_idx]) + j = 0; + + while (j < MatchString->Length / sizeof(WCHAR) && + SearchString->Buffer[i] != MatchString->Buffer[j]) { - search_idx++; + j++; } - if (search_idx >= MatchString->Length / sizeof(WCHAR)) + if (j >= MatchString->Length / sizeof(WCHAR)) { - *Position = (main_idx + 1) * sizeof(WCHAR); + *Position = (i + 1) * sizeof(WCHAR); return STATUS_SUCCESS; } } @@ -2568,19 +2561,19 @@ case 3: { - for (main_idx = SearchString->Length / sizeof(WCHAR) - 1; main_idx >= 0; main_idx--) + for (i = SearchString->Length / sizeof(WCHAR) - 1; i >= 0; i--) { - search_idx = 0; - - while (search_idx < MatchString->Length / sizeof(WCHAR) && - SearchString->Buffer[main_idx] != MatchString->Buffer[search_idx]) + j = 0; + + while (j < MatchString->Length / sizeof(WCHAR) && + SearchString->Buffer[i] != MatchString->Buffer[j]) { - search_idx++; + j++; } - if (search_idx >= MatchString->Length / sizeof(WCHAR)) + if (j >= MatchString->Length / sizeof(WCHAR)) { - *Position = main_idx * sizeof(WCHAR); + *Position = i * sizeof(WCHAR); return STATUS_SUCCESS; } }
13 years, 3 months
1
0
0
0
[gadamopoulos] 53745: [win32k] - Merge changes from the themes branch. These changes will introduce test regressions for class functions and for TrackMouseEvent. The changes in the class functions ...
by gadamopoulos@svn.reactos.org
Author: gadamopoulos Date: Mon Sep 19 08:32:38 2011 New Revision: 53745 URL:
http://svn.reactos.org/svn/reactos?rev=53745&view=rev
Log: [win32k] - Merge changes from the themes branch. These changes will introduce test regressions for class functions and for TrackMouseEvent. The changes in the class functions are needed in order to let comctl32 register its own versions of built in controls. This is a hack and will be removed when we properly support class versions. The second change that causes test regressions is in TrackMouseEvent and it is needed in order to fix WM_MOUSELEAVE messages that were completely broken and not tested at all by wine's test suite. Modified: trunk/reactos/subsystems/win32/win32k/include/callback.h trunk/reactos/subsystems/win32/win32k/include/hook.h trunk/reactos/subsystems/win32/win32k/include/msgqueue.h trunk/reactos/subsystems/win32/win32k/include/win32.h trunk/reactos/subsystems/win32/win32k/main/dllmain.c trunk/reactos/subsystems/win32/win32k/ntuser/callback.c trunk/reactos/subsystems/win32/win32k/ntuser/class.c trunk/reactos/subsystems/win32/win32k/ntuser/hook.c trunk/reactos/subsystems/win32/win32k/ntuser/input.c trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c trunk/reactos/subsystems/win32/win32k/ntuser/timer.c trunk/reactos/subsystems/win32/win32k/objects/bitblt.c Modified: trunk/reactos/subsystems/win32/win32k/include/callback.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/callback.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/callback.h [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -54,3 +54,10 @@ HMENU APIENTRY co_IntCallLoadMenu(HINSTANCE,PUNICODE_STRING); NTSTATUS APIENTRY co_IntClientThreadSetup(VOID); + +HMODULE +co_IntClientLoadLibrary(PUNICODE_STRING strLibName, + PUNICODE_STRING strInitFunc, + BOOL Unload, + BOOL ApiHook); + Modified: trunk/reactos/subsystems/win32/win32k/include/hook.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/hook.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/hook.h [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -4,6 +4,13 @@ #define HOOKID_TO_INDEX(HookId) (HookId - WH_MINHOOK) #define HOOKID_TO_FLAG(HookId) (1 << ((HookId) + 1)) #define ISITHOOKED(HookId) (((PTHREADINFO)PsGetCurrentThreadWin32Thread())->fsHooks & HOOKID_TO_FLAG(HookId)) + +/* NOTE: the following definition is not a real hook but + a pseudo-id that will be used only for + injecting user api hook module to all processes. + It is used internally in win32k */ +#define WH_APIHOOK WH_MAX + 1 + typedef struct tagEVENTHOOK { @@ -43,4 +50,10 @@ LRESULT FASTCALL UserCallNextHookEx( PHOOK pHook, int Code, WPARAM wParam, LPARAM lParam, BOOL Ansi); BOOL FASTCALL IntUnhookWindowsHook(int,HOOKPROC); +BOOL FASTCALL UserLoadApiHook(); +BOOL IntLoadHookModule(int iHookID, HHOOK hHook, BOOL Unload); +BOOL FASTCALL UserUnregisterUserApiHook(); + +extern PPROCESSINFO ppiUahServer; + /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/include/msgqueue.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/msgqueue.h [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -4,6 +4,7 @@ #define MSQ_NORMAL 0 #define MSQ_ISHOOK 1 #define MSQ_ISEVENT 2 +#define MSQ_INJECTMODULE 3 #define QSIDCOUNTS 6 @@ -206,6 +207,16 @@ SENDASYNCPROC CompletionCallback, ULONG_PTR CompletionCallbackContext, ULONG_PTR *uResult); +BOOL FASTCALL +co_MsqSendMessageAsync(PTHREADINFO ptiReceiver, + HWND hwnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam, + SENDASYNCPROC CompletionCallback, + ULONG_PTR CompletionCallbackContext, + BOOL HasPackedLParam, + INT HookMessage); LRESULT FASTCALL IntDispatchMessage(MSG* Msg); BOOL FASTCALL IntTranslateKbdMessage(LPMSG lpMsg, UINT flags); Modified: trunk/reactos/subsystems/win32/win32k/include/win32.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/win32.h [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -30,6 +30,7 @@ #define W32PF_NOWINDOWGHOSTING (0x01000000) #define W32PF_MANUALGUICHECK (0x02000000) #define W32PF_CREATEDWINORDC (0x04000000) +#define W32PF_APIHOOKLOADED (0x08000000) extern BOOL ClientPfnInit; extern HINSTANCE hModClient; Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ma…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -393,6 +393,22 @@ /* Remove it from the list */ *ppti = ptiCurrent->ptiSibling; + /* Decrement thread count and check if its 0 */ + ppiCurrent->cThreads--; + + /* Do now some process cleanup that requires a valid win32 thread */ + if(ptiCurrent->ppi->cThreads == 0) + { + UserSetCursor(NULL, TRUE); + + /* Check if we have registered the user api hook */ + if(ptiCurrent->ppi == ppiUahServer) + { + /* Unregister the api hook without blocking */ + UserUnregisterUserApiHook(); + } + } + DceFreeThreadDCE(ptiCurrent); HOOK_DestroyThreadHooks(Thread); EVENT_DestroyThreadEvents(Thread); @@ -421,14 +437,6 @@ IntSetThreadDesktop(NULL, TRUE); - /* Decrement thread count and check if its 0 */ - ppiCurrent->cThreads--; - if (ppiCurrent->cThreads == 0) - { - /* UGLY: Prevent this function from being called later - when we don't have a THREADINFO anymore. */ - UserSetCursor(NULL, TRUE); - } /* Free the THREADINFO */ PsSetThreadWin32Thread(Thread, NULL); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/callback.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/callback.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -115,6 +115,114 @@ } /* FUNCTIONS *****************************************************************/ + +/* calls ClientLoadLibrary in user32 */ +HMODULE +co_IntClientLoadLibrary(PUNICODE_STRING pstrLibName, + PUNICODE_STRING pstrInitFunc, + BOOL Unload, + BOOL ApiHook) +{ + PVOID ResultPointer; + ULONG ResultLength; + ULONG ArgumentLength; + PCLIENT_LOAD_LIBRARY_ARGUMENTS pArguments; + NTSTATUS Status; + HMODULE Result; + ULONG_PTR pLibNameBuffer = 0, pInitFuncBuffer = 0; + + TRACE("co_IntClientLoadLibrary: %S, %S, %d, %d\n", pstrLibName->Buffer, pstrLibName->Buffer, Unload, ApiHook); + + /* Calculate the size of the argument */ + ArgumentLength = sizeof(CLIENT_LOAD_LIBRARY_ARGUMENTS); + if(pstrLibName) + { + pLibNameBuffer = ArgumentLength; + ArgumentLength += pstrLibName->Length + sizeof(WCHAR); + } + if(pstrInitFunc) + { + pInitFuncBuffer = ArgumentLength; + ArgumentLength += pstrInitFunc->Length + sizeof(WCHAR); + } + + /* Allocate the argument*/ + pArguments = IntCbAllocateMemory(ArgumentLength); + if(pArguments == NULL) + { + return FALSE; + } + + /* Fill the argument */ + pArguments->Unload = Unload; + pArguments->ApiHook = ApiHook; + if(pstrLibName) + { + /* Copy the string to the callback memory */ + pLibNameBuffer += (ULONG_PTR)pArguments; + pArguments->strLibraryName.Buffer = (PWCHAR)pLibNameBuffer; + pArguments->strLibraryName.MaximumLength = pstrLibName->Length + sizeof(WCHAR); + RtlCopyUnicodeString(&pArguments->strLibraryName, pstrLibName); + + /* Fix argument pointer to be relative to the argument */ + pLibNameBuffer -= (ULONG_PTR)pArguments; + pArguments->strLibraryName.Buffer = (PWCHAR)(pLibNameBuffer); + } + else + { + RtlZeroMemory(&pArguments->strLibraryName, sizeof(UNICODE_STRING)); + } + + if(pstrInitFunc) + { + /* Copy the strings to the callback memory */ + pInitFuncBuffer += (ULONG_PTR)pArguments; + pArguments->strInitFuncName.Buffer = (PWCHAR)pInitFuncBuffer; + pArguments->strInitFuncName.MaximumLength = pstrInitFunc->Length + sizeof(WCHAR); + RtlCopyUnicodeString(&pArguments->strInitFuncName, pstrInitFunc); + + /* Fix argument pointers to be relative to the argument */ + pInitFuncBuffer -= (ULONG_PTR)pArguments; + pArguments->strInitFuncName.Buffer = (PWCHAR)(pInitFuncBuffer); + } + else + { + RtlZeroMemory(&pArguments->strInitFuncName, sizeof(UNICODE_STRING)); + } + + /* Do the callback */ + UserLeaveCo(); + + Status = KeUserModeCallback(USER32_CALLBACK_CLIENTLOADLIBRARY, + pArguments, + ArgumentLength, + &ResultPointer, + &ResultLength); + + UserEnterCo(); + + /* Free the argument */ + IntCbFreeMemory(pArguments); + + if(!NT_SUCCESS(Status)) + { + return FALSE; + } + + _SEH2_TRY + { + ProbeForRead(ResultPointer, sizeof(HMODULE), 1); + /* Simulate old behaviour: copy into our local buffer */ + Result = *(HMODULE*)ResultPointer; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Result = 0; + } + _SEH2_END; + + return Result; +} VOID APIENTRY co_IntCallSentMessageCallback(SENDASYNCPROC CompletionCallback, Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -1295,8 +1295,9 @@ if (lpwcx->style & CS_GLOBALCLASS) { + /* HACK: allow global classes to be re-registered*/ Class = IntFindClass( ClassAtom, - NULL, + lpwcx->hInstance, &pi->pclsPublicList, NULL); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hook.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/hook.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -24,7 +24,221 @@ PVOID pHookStructs; } HOOKPACK, *PHOOKPACK; +UNICODE_STRING strUahModule; +UNICODE_STRING strUahInitFunc; +PPROCESSINFO ppiUahServer; + /* PRIVATE FUNCTIONS *********************************************************/ + +/* Calls ClientLoadLibrary in user32 in order to load or unload a module */ +BOOL +IntLoadHookModule(int iHookID, HHOOK hHook, BOOL Unload) +{ + PPROCESSINFO ppi; + HMODULE hmod; + + ppi = PsGetCurrentProcessWin32Process(); + + ERR("IntLoadHookModule. Client PID: %d\n", PsGetProcessId(ppi->peProcess)); + + /* Check if this is the api hook */ + if(iHookID == WH_APIHOOK) + { + if(!Unload && !(ppi->W32PF_flags & W32PF_APIHOOKLOADED)) + { + /* A callback in user mode can trigger UserLoadApiHook to be called and + as a result IntLoadHookModule will be called recursively. + To solve this we set the flag that means that the appliaction has + loaded the api hook before the callback and in case of error we remove it */ + ppi->W32PF_flags |= W32PF_APIHOOKLOADED; + + /* Call ClientLoadLibrary in user32 */ + hmod = co_IntClientLoadLibrary(&strUahModule, &strUahInitFunc, Unload, TRUE); + TRACE("co_IntClientLoadLibrary returned %d\n", hmod ); + if(hmod == 0) + { + /* Remove the flag we set before */ + ppi->W32PF_flags &= ~W32PF_APIHOOKLOADED; + return FALSE; + } + return TRUE; + } + else if(Unload && (ppi->W32PF_flags & W32PF_APIHOOKLOADED)) + { + /* Call ClientLoadLibrary in user32 */ + hmod = co_IntClientLoadLibrary(NULL, NULL, Unload, TRUE); + if(hmod != 0) + { + ppi->W32PF_flags &= ~W32PF_APIHOOKLOADED; + return TRUE; + } + return FALSE; + } + + return TRUE; + } + + STUB; + + return FALSE; +} + +/* +IntHookModuleUnloaded: +Sends a internal message to all threads of the requested desktop +and notifies them that a global hook was destroyed +and an injected module must be unloaded. +As a result, IntLoadHookModule will be called for all the threads that +will receive the special purpose internal message. +*/ +BOOL +IntHookModuleUnloaded(PDESKTOP pdesk, int iHookID, HHOOK hHook) +{ + PTHREADINFO ptiCurrent; + PLIST_ENTRY ListEntry; + PPROCESSINFO ppiCsr; + + ERR("IntHookModuleUnloaded: iHookID=%d\n", iHookID); + + ppiCsr = PsGetProcessWin32Process(CsrProcess); + + ListEntry = pdesk->PtiList.Flink; + while(ListEntry != &pdesk->PtiList) + { + ptiCurrent = CONTAINING_RECORD(ListEntry, THREADINFO, PtiLink); + + /* FIXME: do some more security checks here */ + + /* FIXME: the first check is a reactos specific hack for system threads */ + if(!PsIsSystemProcess(ptiCurrent->ppi->peProcess) && + ptiCurrent->ppi != ppiCsr) + { + if(ptiCurrent->ppi->W32PF_flags & W32PF_APIHOOKLOADED) + { + TRACE("IntHookModuleUnloaded: sending message to PID %d, ppi=0x%x\n", PsGetProcessId(ptiCurrent->ppi->peProcess), ptiCurrent->ppi); + co_MsqSendMessageAsync( ptiCurrent, + 0, + iHookID, + TRUE, + (LPARAM)hHook, + NULL, + 0, + FALSE, + MSQ_INJECTMODULE); + } + } + ListEntry = ListEntry->Flink; + } + + return TRUE; +} + +BOOL +FASTCALL +UserLoadApiHook() +{ + return IntLoadHookModule(WH_APIHOOK, 0, FALSE); +} + +BOOL +FASTCALL +UserRegisterUserApiHook( + PUNICODE_STRING pstrDllName, + PUNICODE_STRING pstrFuncName) +{ + PTHREADINFO pti, ptiCurrent; + HWND *List; + PWND DesktopWindow, pwndCurrent; + ULONG i; + PPROCESSINFO ppiCsr; + + pti = PsGetCurrentThreadWin32Thread(); + ppiCsr = PsGetProcessWin32Process(CsrProcess); + + /* Fail if the api hook is already registered */ + if(gpsi->dwSRVIFlags & SRVINFO_APIHOOK) + { + return FALSE; + } + + ERR("UserRegisterUserApiHook. Server PID: %d\n", PsGetProcessId(pti->ppi->peProcess)); + + /* Register the api hook */ + gpsi->dwSRVIFlags |= SRVINFO_APIHOOK; + + strUahModule = *pstrDllName; + strUahInitFunc = *pstrFuncName; + ppiUahServer = pti->ppi; + + /* Broadcast an internal message to every top level window */ + DesktopWindow = UserGetWindowObject(IntGetDesktopWindow()); + List = IntWinListChildren(DesktopWindow); + + if (List != NULL) + { + for (i = 0; List[i]; i++) + { + pwndCurrent = UserGetWindowObject(List[i]); + if(pwndCurrent == NULL) + { + continue; + } + ptiCurrent = pwndCurrent->head.pti; + + /* FIXME: the first check is a reactos specific hack for system threads */ + if(PsIsSystemProcess(ptiCurrent->ppi->peProcess) || + ptiCurrent->ppi == ppiCsr) + { + continue; + } + + co_MsqSendMessageAsync( ptiCurrent, + 0, + WH_APIHOOK, + FALSE, /* load the module */ + 0, + NULL, + 0, + FALSE, + MSQ_INJECTMODULE); + } + ExFreePoolWithTag(List, USERTAG_WINDOWLIST); + } + + return TRUE; +} + +BOOL +FASTCALL +UserUnregisterUserApiHook() +{ + PTHREADINFO pti; + + pti = PsGetCurrentThreadWin32Thread(); + + /* Fail if the api hook is not registered */ + if(!(gpsi->dwSRVIFlags & SRVINFO_APIHOOK)) + { + return FALSE; + } + + /* Only the process that registered the api hook can uregister it */ + if(ppiUahServer != PsGetCurrentProcessWin32Process()) + { + return FALSE; + } + + ERR("UserUnregisterUserApiHook. Server PID: %d\n", PsGetProcessId(pti->ppi->peProcess)); + + /* Unregister the api hook */ + gpsi->dwSRVIFlags &= ~SRVINFO_APIHOOK; + ppiUahServer = NULL; + ReleaseCapturedUnicodeString(&strUahModule, UserMode); + ReleaseCapturedUnicodeString(&strUahInitFunc, UserMode); + + /* Notify all applications that the api hook module must be unloaded */ + return IntHookModuleUnloaded(pti->rpdesk, WH_APIHOOK, 0); +} static LRESULT @@ -1510,4 +1724,64 @@ END_CLEANUP; } +BOOL +APIENTRY +NtUserRegisterUserApiHook( + PUNICODE_STRING m_dllname1, + PUNICODE_STRING m_funname1, + DWORD dwUnknown3, + DWORD dwUnknown4) +{ + BOOL ret; + UNICODE_STRING strDllNameSafe; + UNICODE_STRING strFuncNameSafe; + NTSTATUS Status; + + /* Probe and capture parameters */ + Status = ProbeAndCaptureUnicodeString(&strDllNameSafe, UserMode, m_dllname1); + if(!NT_SUCCESS(Status)) + { + EngSetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + Status = ProbeAndCaptureUnicodeString(&strFuncNameSafe, UserMode, m_funname1); + if(!NT_SUCCESS(Status)) + { + ReleaseCapturedUnicodeString(&strDllNameSafe, UserMode); + EngSetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + UserEnterExclusive(); + + /* Call internal function */ + ret = UserRegisterUserApiHook(&strDllNameSafe, &strFuncNameSafe); + + UserLeave(); + + /* Cleanup only in case of failure */ + if(ret == FALSE) + { + ReleaseCapturedUnicodeString(&strDllNameSafe, UserMode); + ReleaseCapturedUnicodeString(&strFuncNameSafe, UserMode); + } + + return ret; +} + +BOOL +APIENTRY +NtUserUnregisterUserApiHook(VOID) +{ + BOOL ret; + + UserEnterExclusive(); + ret = UserUnregisterUserApiHook(); + UserLeave(); + + return ret; +} + + /* EOF */ Modified: trunk/reactos/subsystems/win32/win32k/ntuser/input.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/input.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -1611,19 +1611,6 @@ if (!(pWnd = UserGetWindowObject(lpEventTrack->hwndTrack))) return FALSE; - if ( pDesk->spwndTrack != pWnd || - (pDesk->htEx != HTCLIENT) ^ !!(lpEventTrack->dwFlags & TME_NONCLIENT) ) - { - if ( lpEventTrack->dwFlags & TME_LEAVE && !(lpEventTrack->dwFlags & TME_CANCEL) ) - { - UserPostMessage( lpEventTrack->hwndTrack, - lpEventTrack->dwFlags & TME_NONCLIENT ? WM_NCMOUSELEAVE : WM_MOUSELEAVE, - 0, 0); - } - TRACE("IntTrackMouseEvent spwndTrack 0x%x pwnd 0x%x\n", pDesk->spwndTrack, pWnd); - return TRUE; - } - /* Tracking spwndTrack same as pWnd */ if ( lpEventTrack->dwFlags & TME_CANCEL ) // Canceled mode. { @@ -1641,6 +1628,7 @@ } else // Not Canceled. { + pDesk->spwndTrack = pWnd; if ( lpEventTrack->dwFlags & TME_LEAVE ) pDesk->dwDTFlags |= DF_TME_LEAVE; Modified: trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/msgqueue.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -539,22 +539,35 @@ if (pwnd) { - PWND pwndTrack = IntChildrenWindowFromPoint(pwnd, Msg->pt.x, Msg->pt.y); - - if ( pDesk->spwndTrack != pwndTrack && pDesk->dwDTFlags & (DF_TME_LEAVE|DF_TME_HOVER) ) - { - if ( pDesk->dwDTFlags & DF_TME_LEAVE ) - UserPostMessage( UserHMGetHandle(pDesk->spwndTrack), - (pDesk->htEx != HTCLIENT) ? WM_NCMOUSELEAVE : WM_MOUSELEAVE, - 0, 0); - - if ( pDesk->dwDTFlags & DF_TME_HOVER ) - IntKillTimer(UserHMGetHandle(pDesk->spwndTrack), ID_EVENT_SYSTIMER_MOUSEHOVER, TRUE); - - pDesk->dwDTFlags &= ~(DF_TME_LEAVE|DF_TME_HOVER); - } - pDesk->spwndTrack = pwndTrack; - pDesk->htEx = GetNCHitEx(pDesk->spwndTrack, Msg->pt); + /* If we a re tracking the mouse and it moves to another top level window */ + if(pDesk->spwndTrack && + UserGetAncestor(pDesk->spwndTrack, GA_ROOT) != pwnd) + { + /* Generate a WM_MOUSELEAVE message */ + if ( pDesk->dwDTFlags & DF_TME_LEAVE ) + { + MSG msgMouseLeave; + + TRACE("co_MsqInsertMouseMessage: generating WM_MOUSELEAVE\n"); + + msgMouseLeave.hwnd = UserHMGetHandle(pDesk->spwndTrack); + msgMouseLeave.message = WM_MOUSELEAVE; + msgMouseLeave.pt = Msg->pt; + msgMouseLeave.time = Msg->time; + msgMouseLeave.lParam = msgMouseLeave.wParam = 0; + + MsqPostMessage(pwnd->head.pti->MessageQueue, Msg, TRUE, QS_MOUSE); + } + + /* Stop tracking */ + if ( pDesk->dwDTFlags & DF_TME_HOVER ) + { + IntKillTimer(pDesk->spwndTrack, ID_EVENT_SYSTIMER_MOUSEHOVER, TRUE); + } + + pDesk->spwndTrack = NULL; + pDesk->htEx = 0; + } } hdcScreen = IntGetScreenDC(); @@ -811,6 +824,12 @@ Message->Msg.wParam, Message->Msg.lParam); } + else if(Message->HookMessage == MSQ_INJECTMODULE) + { + Result = IntLoadHookModule(Message->Msg.message, + (HHOOK)Message->Msg.lParam, + Message->Msg.wParam); + } else if ((Message->CompletionCallback) && (Message->CallBackSenderQueue == MessageQueue)) { /* Call the callback routine */ @@ -1004,6 +1023,58 @@ CurrentEntry = CurrentEntry->Flink; } } +} + +BOOL FASTCALL +co_MsqSendMessageAsync(PTHREADINFO ptiReceiver, + HWND hwnd, + UINT Msg, + WPARAM wParam, + LPARAM lParam, + SENDASYNCPROC CompletionCallback, + ULONG_PTR CompletionCallbackContext, + BOOL HasPackedLParam, + INT HookMessage) +{ + + PTHREADINFO ptiSender; + PUSER_SENT_MESSAGE Message; + + if(!(Message = ExAllocatePoolWithTag(NonPagedPool, sizeof(USER_SENT_MESSAGE), TAG_USRMSG))) + { + ERR("MsqSendMessage(): Not enough memory to allocate a message"); + return FALSE; + } + + ptiSender = PsGetCurrentThreadWin32Thread(); + + IntReferenceMessageQueue(ptiReceiver->MessageQueue); + /* Take reference on this MessageQueue if its a callback. It will be released + when message is processed or removed from target hwnd MessageQueue */ + if (CompletionCallback) + IntReferenceMessageQueue(ptiSender->MessageQueue); + + Message->Msg.hwnd = hwnd; + Message->Msg.message = Msg; + Message->Msg.wParam = wParam; + Message->Msg.lParam = lParam; + Message->CompletionEvent = NULL; + Message->Result = 0; + Message->lResult = 0; + Message->SenderQueue = NULL; + Message->CallBackSenderQueue = ptiSender->MessageQueue; + Message->DispatchingListEntry.Flink = NULL; + Message->CompletionCallback = CompletionCallback; + Message->CompletionCallbackContext = CompletionCallbackContext; + Message->HookMessage = HookMessage; + Message->HasPackedLParam = HasPackedLParam; + Message->QS_Flags = QS_SENDMESSAGE; + + InsertTailList(&ptiReceiver->MessageQueue->SentMessagesListHead, &Message->ListEntry); + MsqWakeQueue(ptiReceiver->MessageQueue, QS_SENDMESSAGE, TRUE); + IntDereferenceMessageQueue(ptiReceiver->MessageQueue); + + return TRUE; } NTSTATUS FASTCALL @@ -1281,6 +1352,7 @@ PUSER_MESSAGE_QUEUE MessageQueue; PTHREADINFO pti; PSYSTEM_CURSORINFO CurInfo; + PDESKTOP pDesk; DECLARE_RETURN(BOOL); pti = PsGetCurrentThreadWin32Thread(); @@ -1289,6 +1361,7 @@ CurInfo = IntGetSysCursorInfo(); pwndMsg = UserGetWindowObject(msg->hwnd); clk_msg = MessageQueue->msgDblClk; + pDesk = pwndDesktop->head.rpdesk; /* find the window to dispatch this mouse message to */ if (MessageQueue->CaptureWindow) @@ -1308,6 +1381,45 @@ /* Remove and ignore the message */ *RemoveMessages = TRUE; RETURN(FALSE); + } + + /* If we a re tracking the mouse and it moves to another window */ + if(pDesk->spwndTrack && + pDesk->spwndTrack != pwndMsg && + msg->message != WM_MOUSELEAVE) + { + /* Generate a WM_MOUSELEAVE message */ + if ( pDesk->dwDTFlags & DF_TME_LEAVE ) + { + MSG msgMouseLeave; + + TRACE("co_IntProcessMouseMessage: generating WM_MOUSELEAVE\n"); + + msgMouseLeave.hwnd = UserHMGetHandle(pDesk->spwndTrack); + msgMouseLeave.message = WM_MOUSELEAVE; + msgMouseLeave.pt = msg->pt; + msgMouseLeave.time = msg->time; + msgMouseLeave.lParam = msgMouseLeave.wParam = 0; + + MsqPostMessage(pwndMsg->head.pti->MessageQueue, + &msgMouseLeave, + TRUE, + QS_MOUSE); + } + + /* Stop tracking */ + if ( pDesk->dwDTFlags & DF_TME_HOVER ) + { + IntKillTimer(pDesk->spwndTrack, ID_EVENT_SYSTIMER_MOUSEHOVER, TRUE); + } + + pDesk->spwndTrack = NULL; + pDesk->htEx = 0; + } + + if(pDesk->spwndTrack) + { + pDesk->htEx = hittest; } msg->hwnd = UserHMGetHandle(pwndMsg); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/ntstubs.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -818,20 +818,6 @@ BOOL APIENTRY -NtUserRegisterUserApiHook( - PUNICODE_STRING m_dllname1, - PUNICODE_STRING m_funname1, - DWORD dwUnknown3, - DWORD dwUnknown4) -{ - UserEnterExclusive(); - STUB; - UserLeave(); - return 0; -} - -BOOL -APIENTRY NtUserRegisterRawInputDevices( IN PCRAWINPUTDEVICE pRawInputDevices, IN UINT uiNumDevices, @@ -965,14 +951,6 @@ BOOL APIENTRY -NtUserUnregisterUserApiHook(VOID) -{ - STUB; - return 0; -} - -BOOL -APIENTRY NtUserGetLayeredWindowAttributes( HWND hwnd, COLORREF *pcrKey, Modified: trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/simplecall.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -119,6 +119,9 @@ case NOPARAM_ROUTINE_RELEASECAPTURE: RETURN( (DWORD_PTR)IntReleaseCapture()); + + case NOPARAM_ROUTINE_LOADUSERAPIHOOK: + RETURN(UserLoadApiHook()); default: ERR("Calling invalid routine number 0x%x in NtUserCallNoParam\n", Routine); Modified: trunk/reactos/subsystems/win32/win32k/ntuser/timer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/timer.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -324,7 +324,7 @@ if ( pDesk->dwDTFlags & DF_TME_HOVER && pWnd == pDesk->spwndTrack ) { - Point = gpsi->ptCursor; + Point = pWnd->head.pti->MessageQueue->MouseMoveMsg.pt; if ( RECTL_bPointInRect(&pDesk->rcMouseHover, Point.x, Point.y) ) { if (pDesk->htEx == HTCLIENT) // In a client area. @@ -345,9 +345,18 @@ wParam = pDesk->htEx; // Need to support all HTXYZ hits. Msg = WM_NCMOUSEHOVER; } + TRACE("Generating WM_NCMOUSEHOVER\n"); UserPostMessage(hwnd, Msg, wParam, MAKELPARAM(Point.x, Point.y)); pDesk->dwDTFlags &= ~DF_TME_HOVER; break; // Kill this timer. + } + else + { + RECTL_vSetRect(&pDesk->rcMouseHover, + Point.x - gspv.iMouseHoverWidth / 2, + Point.y - gspv.iMouseHoverHeight / 2, + Point.x + gspv.iMouseHoverWidth / 2, + Point.y + gspv.iMouseHoverHeight / 2); } } } Modified: trunk/reactos/subsystems/win32/win32k/objects/bitblt.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/bitblt.c [iso-8859-1] Mon Sep 19 08:32:38 2011 @@ -549,7 +549,7 @@ if (0 == WidthDest || 0 == HeightDest || 0 == WidthSrc || 0 == HeightSrc) { EngSetLastError(ERROR_INVALID_PARAMETER); - return FALSE; + return TRUE; } if (!hDCDest || (UsesSource && !hDCSrc) || (UsesMask && !hDCMask))
13 years, 3 months
1
0
0
0
[pschweitzer] 53744: [ROUTE] Fix memory leaks
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Mon Sep 19 07:55:26 2011 New Revision: 53744 URL:
http://svn.reactos.org/svn/reactos?rev=53744&view=rev
Log: [ROUTE] Fix memory leaks Modified: trunk/reactos/base/applications/network/route/route.c Modified: trunk/reactos/base/applications/network/route/route.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/network/…
============================================================================== --- trunk/reactos/base/applications/network/route/route.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/network/route/route.c [iso-8859-1] Mon Sep 19 07:55:26 2011 @@ -36,7 +36,7 @@ static int PrintRoutes() { PMIB_IPFORWARDTABLE IpForwardTable = NULL; - PIP_ADAPTER_INFO pAdapterInfo; + PIP_ADAPTER_INFO pAdapterInfo = NULL; ULONG Size = 0; DWORD Error = 0; ULONG adaptOutBufLen = sizeof(IP_ADAPTER_INFO); @@ -66,7 +66,6 @@ { if (!(IpForwardTable = malloc( Size ))) { - free(pAdapterInfo); Error = ERROR_NOT_ENOUGH_MEMORY; goto Error; } @@ -148,6 +147,8 @@ else { Error: + if (pAdapterInfo) free(pAdapterInfo); + if (IpForwardTable) free(IpForwardTable); _ftprintf( stderr, _T("Route enumerate failed\n") ); return Error; }
13 years, 3 months
1
0
0
0
[pschweitzer] 53743: [HPP] Fix memory leak
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Mon Sep 19 07:30:02 2011 New Revision: 53743 URL:
http://svn.reactos.org/svn/reactos?rev=53743&view=rev
Log: [HPP] Fix memory leak Modified: trunk/reactos/tools/hpp/hpp.c Modified: trunk/reactos/tools/hpp/hpp.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/hpp/hpp.c?rev=53743&…
============================================================================== --- trunk/reactos/tools/hpp/hpp.c [iso-8859-1] (original) +++ trunk/reactos/tools/hpp/hpp.c [iso-8859-1] Mon Sep 19 07:30:02 2011 @@ -511,7 +511,7 @@ int main(int argc, char* argv[]) { - char *pszInFolder, *pszInFile, *pszOutFile; + char *pszInFile, *pszOutFile; FILE* fileOut; int ret; @@ -523,7 +523,6 @@ pszInFile = convert_path(argv[1]); pszOutFile = convert_path(argv[2]); - pszInFolder = GetFolder(pszInFile); fileOut = fopen(pszOutFile, "wb"); if (fileOut == NULL) @@ -535,6 +534,8 @@ ret = ParseInputFile(pszInFile, fileOut); fclose(fileOut); + free(pszInFile); + free(pszOutFile); return ret; }
13 years, 3 months
1
0
0
0
[pschweitzer] 53742: [SPEC2DEF] Fix resources leak
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Mon Sep 19 07:29:36 2011 New Revision: 53742 URL:
http://svn.reactos.org/svn/reactos?rev=53742&view=rev
Log: [SPEC2DEF] Fix resources leak Modified: trunk/reactos/tools/spec2def/spec2def.c Modified: trunk/reactos/tools/spec2def/spec2def.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/spec2def/spec2def.c?…
============================================================================== --- trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] (original) +++ trunk/reactos/tools/spec2def/spec2def.c [iso-8859-1] Mon Sep 19 07:29:36 2011 @@ -807,7 +807,11 @@ /* Allocate memory buffer */ pszSource = malloc(nFileSize + 1); - if (!pszSource) return -4; + if (!pszSource) + { + fclose(file); + return -4; + } /* Load input file into memory */ nFileSize = fread(pszSource, 1, nFileSize, file);
13 years, 3 months
1
0
0
0
[pschweitzer] 53741: [STUBGEN] Fix resources leak
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Mon Sep 19 07:28:51 2011 New Revision: 53741 URL:
http://svn.reactos.org/svn/reactos?rev=53741&view=rev
Log: [STUBGEN] Fix resources leak Modified: trunk/reactos/tools/stubgen.c Modified: trunk/reactos/tools/stubgen.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/stubgen.c?rev=53741&…
============================================================================== --- trunk/reactos/tools/stubgen.c [iso-8859-1] (original) +++ trunk/reactos/tools/stubgen.c [iso-8859-1] Mon Sep 19 07:28:51 2011 @@ -34,7 +34,11 @@ int i, libstart = argc; FILE *out = fopen("tests/stubs.tst","w"); - if( argc == 1 ) { usage(argv[0]); return 1; } + if( argc == 1 ) { + if( out ) fclose( out ); + usage(argv[0]); + return 1; + } if( !out ) { fprintf( stderr, "Could not write file tests/stubs.tst\n" );
13 years, 3 months
1
0
0
0
← Newer
1
...
14
15
16
17
18
19
20
...
40
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
37
38
39
40
Results per page:
10
25
50
100
200