Sync with trunk r47129

svn path=/branches/reactos-yarotows/; revision=47133
This commit is contained in:
Jérôme Gardou 2010-05-08 17:23:51 +00:00
commit 3d533cb7a2
22 changed files with 5174 additions and 4807 deletions

View file

@ -2,7 +2,8 @@
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> <!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<module name="wordpad" type="win32gui" installbase="system32" installname="wordpad.exe" allowwarnings="true"> <module name="wordpad" type="win32gui" installbase="system32" installname="wordpad.exe" allowwarnings="true">
<include base="wordpad">.</include> <include base="wordpad">.</include>
<define name="__ROS_LONG64__" /> <include base="ReactOS">include/reactos/wine</include>
<define name="__ROS_LONG64__" />
<library>comdlg32</library> <library>comdlg32</library>
<library>shell32</library> <library>shell32</library>
<library>user32</library> <library>user32</library>

View file

@ -1282,14 +1282,17 @@ HWND ClockWindow::Create(HWND hwndParent)
ClientRect clnt(hwndParent); ClientRect clnt(hwndParent);
WindowCanvas canvas(hwndParent); WindowCanvas canvas(hwndParent);
FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT)); FontSelection font(canvas, GetStockFont(ANSI_VAR_FONT));
RECT rect = {0, 0, 0, 0}; RECT rect = {0, 0, 0, 0};
TCHAR buffer[8]; TCHAR buffer[16];
// Arbitrary high time so that the created clock window is big enough
SYSTEMTIME st = { 1601, 1, 0, 1, 23, 59, 59, 999 };
if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, buffer, sizeof(buffer)/sizeof(TCHAR))) if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, buffer, sizeof(buffer)/sizeof(TCHAR)))
_tcscpy(buffer, TEXT("00:00")); _tcscpy(buffer, TEXT("00:00"));
// Calculate the rectangle needed to draw the time (without actually drawing it)
DrawText(canvas, buffer, -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT); DrawText(canvas, buffer, -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT);
int clockwindowWidth = rect.right-rect.left + 4; int clockwindowWidth = rect.right-rect.left + 4;

View file

@ -0,0 +1,129 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Winlogon
* FILE: base/system/winlogon/environment.c
* PURPOSE: User environment routines
* PROGRAMMERS: Thomas Weidenmueller (w3seek@users.sourceforge.net)
* Hervé Poussineau (hpoussin@reactos.org)
* Eric Kohl
*/
/* INCLUDES *****************************************************************/
#include "winlogon.h"
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(winlogon);
/* GLOBALS ******************************************************************/
/* FUNCTIONS ****************************************************************/
BOOL
CreateUserEnvironment(IN PWLSESSION Session,
IN LPVOID *lpEnvironment,
IN LPWSTR *lpFullEnv)
{
LPCWSTR wstr;
SIZE_T EnvBlockSize = 0, ProfileSize = 0;
LPVOID lpEnviron = NULL;
LPWSTR lpFullEnviron = NULL;
HKEY hKey;
DWORD dwDisp;
LONG lError;
HKEY hKeyCurrentUser;
TRACE("WL: CreateUserEnvironment called\n");
/* Create environment block for the user */
if (!CreateEnvironmentBlock(&lpEnviron,
Session->UserToken,
TRUE))
{
WARN("WL: CreateEnvironmentBlock() failed\n");
return FALSE;
}
if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 && Session->Profile->pszEnvironment)
{
/* Count required size for full environment */
wstr = (LPCWSTR)lpEnviron;
while (*wstr != UNICODE_NULL)
{
SIZE_T size = wcslen(wstr) + 1;
wstr += size;
EnvBlockSize += size;
}
wstr = Session->Profile->pszEnvironment;
while (*wstr != UNICODE_NULL)
{
SIZE_T size = wcslen(wstr) + 1;
wstr += size;
ProfileSize += size;
}
/* Allocate enough memory */
lpFullEnviron = HeapAlloc(GetProcessHeap, 0, (EnvBlockSize + ProfileSize + 1) * sizeof(WCHAR));
if (!lpFullEnviron)
{
TRACE("HeapAlloc() failed\n");
return FALSE;
}
/* Fill user environment block */
CopyMemory(lpFullEnviron,
lpEnviron,
EnvBlockSize * sizeof(WCHAR));
CopyMemory(&lpFullEnviron[EnvBlockSize],
Session->Profile->pszEnvironment,
ProfileSize * sizeof(WCHAR));
lpFullEnviron[EnvBlockSize + ProfileSize] = UNICODE_NULL;
}
else
{
lpFullEnviron = (LPWSTR)lpEnviron;
}
/* Impersonate the new user */
ImpersonateLoggedOnUser(Session->UserToken);
/* Open the new users HKCU key */
lError = RegOpenCurrentUser(KEY_CREATE_SUB_KEY,
&hKeyCurrentUser);
if (lError == ERROR_SUCCESS)
{
/* Create the 'Volatile Environment' key */
lError = RegCreateKeyExW(hKeyCurrentUser,
L"Volatile Environment",
0,
NULL,
REG_OPTION_VOLATILE,
KEY_WRITE,
NULL,
&hKey,
&dwDisp);
if (lError == ERROR_SUCCESS)
{
RegCloseKey(hKey);
}
else
{
WARN("WL: RegCreateKeyExW() failed (Error: %ld)\n", lError);
}
RegCloseKey(hKeyCurrentUser);
}
/* Revert the impersonation */
RevertToSelf();
*lpEnvironment = lpEnviron;
*lpFullEnv = lpFullEnviron;
TRACE("WL: CreateUserEnvironment done\n");
return TRUE;
}

View file

@ -171,8 +171,6 @@ HandleLogon(
PROFILEINFOW ProfileInfo; PROFILEINFOW ProfileInfo;
LPVOID lpEnvironment = NULL; LPVOID lpEnvironment = NULL;
LPWSTR lpFullEnv = NULL; LPWSTR lpFullEnv = NULL;
LPCWSTR wstr;
SIZE_T EnvBlockSize = 0, ProfileSize = 0;
BOOLEAN Old; BOOLEAN Old;
BOOL ret = FALSE; BOOL ret = FALSE;
@ -210,57 +208,12 @@ HandleLogon(
} }
/* Create environment block for the user */ /* Create environment block for the user */
if (!CreateEnvironmentBlock( if (!CreateUserEnvironment(Session, &lpEnvironment, &lpFullEnv))
&lpEnvironment,
Session->UserToken,
TRUE))
{ {
WARN("WL: CreateEnvironmentBlock() failed\n"); WARN("WL: SetUserEnvironment() failed\n");
goto cleanup; goto cleanup;
} }
if (Session->Profile->dwType == WLX_PROFILE_TYPE_V2_0 && Session->Profile->pszEnvironment)
{
/* Count required size for full environment */
wstr = (LPCWSTR)lpEnvironment;
while (*wstr != UNICODE_NULL)
{
SIZE_T size = wcslen(wstr) + 1;
wstr += size;
EnvBlockSize += size;
}
wstr = Session->Profile->pszEnvironment;
while (*wstr != UNICODE_NULL)
{
SIZE_T size = wcslen(wstr) + 1;
wstr += size;
ProfileSize += size;
}
/* Allocate enough memory */
lpFullEnv = HeapAlloc(GetProcessHeap, 0, (EnvBlockSize + ProfileSize + 1) * sizeof(WCHAR));
if (!lpFullEnv)
{
TRACE("HeapAlloc() failed\n");
goto cleanup;
}
/* Fill user environment block */
CopyMemory(
lpFullEnv,
lpEnvironment,
EnvBlockSize * sizeof(WCHAR));
CopyMemory(
&lpFullEnv[EnvBlockSize],
Session->Profile->pszEnvironment,
ProfileSize * sizeof(WCHAR));
lpFullEnv[EnvBlockSize + ProfileSize] = UNICODE_NULL;
}
else
{
lpFullEnv = (LPWSTR)lpEnvironment;
}
DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS); DisplayStatusMessage(Session, Session->WinlogonDesktop, IDS_APPLYINGYOURPERSONALSETTINGS);
UpdatePerUserSystemParameters(0, TRUE); UpdatePerUserSystemParameters(0, TRUE);

View file

@ -69,7 +69,7 @@ PlayLogonSoundThread(
if (!hService) if (!hService)
{ {
CloseServiceHandle(hSCManager); CloseServiceHandle(hSCManager);
TRACE("WL: failed to open sysaudio Status %x", GetLastError()); TRACE("WL: failed to open sysaudio Status %x\n", GetLastError());
ExitThread(0); ExitThread(0);
} }

View file

@ -180,6 +180,12 @@ BOOL WINAPI
UpdatePerUserSystemParameters(DWORD dwUnknown, UpdatePerUserSystemParameters(DWORD dwUnknown,
DWORD dwReserved); DWORD dwReserved);
/* environment.c */
BOOL
CreateUserEnvironment(IN PWLSESSION Session,
IN LPVOID *lpEnvironment,
IN LPWSTR *lpFullEnv);
/* sas.c */ /* sas.c */
BOOL BOOL
SetDefaultLanguage( SetDefaultLanguage(

View file

@ -8,6 +8,7 @@
<library>advapi32</library> <library>advapi32</library>
<library>userenv</library> <library>userenv</library>
<library>secur32</library> <library>secur32</library>
<file>environment.c</file>
<file>sas.c</file> <file>sas.c</file>
<file>screensaver.c</file> <file>screensaver.c</file>
<file>setup.c</file> <file>setup.c</file>

View file

@ -3,6 +3,7 @@
<module name="usrmgr" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_USRMGR}" installbase="system32" installname="usrmgr.cpl" unicode="yes" crt="msvcrt"> <module name="usrmgr" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_USRMGR}" installbase="system32" installname="usrmgr.cpl" unicode="yes" crt="msvcrt">
<importlibrary definition="usrmgr.spec" /> <importlibrary definition="usrmgr.spec" />
<include base="usrmgr">.</include> <include base="usrmgr">.</include>
<include base="ReactOS">include/reactos/wine</include>
<library>advapi32</library> <library>advapi32</library>
<library>user32</library> <library>user32</library>
<library>gdi32</library> <library>gdi32</library>

View file

@ -8,6 +8,8 @@
<include base="ReactOS">include/reactos/wine</include> <include base="ReactOS">include/reactos/wine</include>
<define name="__WINESRC__" /> <define name="__WINESRC__" />
<define name="_WINE" /> <define name="_WINE" />
<define name="_COMCTL32_" />
<redefine name="_WIN32_WINNT">0x600</redefine>
<file>animate.c</file> <file>animate.c</file>
<file>comboex.c</file> <file>comboex.c</file>
<file>comctl32undoc.c</file> <file>comctl32undoc.c</file>

View file

@ -104,6 +104,7 @@ BOOL
FASTCALL FASTCALL
DeleteRegion( HRGN hRgn ) DeleteRegion( HRGN hRgn )
{ {
#if 0
PRGN_ATTR Rgn_Attr; PRGN_ATTR Rgn_Attr;
if ((GdiGetHandleUserData((HGDIOBJ) hRgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr)) && if ((GdiGetHandleUserData((HGDIOBJ) hRgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr)) &&
@ -118,6 +119,7 @@ DeleteRegion( HRGN hRgn )
return TRUE; return TRUE;
} }
} }
#endif
return NtGdiDeleteObjectApp((HGDIOBJ) hRgn); return NtGdiDeleteObjectApp((HGDIOBJ) hRgn);
} }
@ -199,6 +201,9 @@ CombineRgn(HRGN hDest,
INT Complexity; INT Complexity;
BOOL Ret; BOOL Ret;
// HACK
return NtGdiCombineRgn(hDest, hSrc1, hSrc2, CombineMode);
Ret = GdiGetHandleUserData((HGDIOBJ) hDest, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr_Dest); Ret = GdiGetHandleUserData((HGDIOBJ) hDest, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr_Dest);
Ret = GdiGetHandleUserData((HGDIOBJ) hSrc1, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr_Src1); Ret = GdiGetHandleUserData((HGDIOBJ) hSrc1, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr_Src1);
@ -436,6 +441,11 @@ CreateRectRgn(int x1, int y1, int x2, int y2)
HRGN hrgn; HRGN hrgn;
int tmp; int tmp;
/// <-
//// Remove when Brush/Pen/Rgn Attr is ready!
return NtGdiCreateRectRgn(x1,y1,x2,y2);
////
/* Normalize points */ /* Normalize points */
tmp = x1; tmp = x1;
if ( x1 > x2 ) if ( x1 > x2 )
@ -586,7 +596,7 @@ ExtSelectClipRgn( IN HDC hdc, IN HRGN hrgn, IN INT iMode)
{ {
if (pLDC->iType != LDC_EMFLDC || EMFDRV_ExtSelectClipRgn( hdc, )) if (pLDC->iType != LDC_EMFLDC || EMFDRV_ExtSelectClipRgn( hdc, ))
return NtGdiExtSelectClipRgn(hdc, ); return NtGdiExtSelectClipRgn(hdc, );
} }
else else
SetLastError(ERROR_INVALID_HANDLE); SetLastError(ERROR_INVALID_HANDLE);
return ERROR; return ERROR;
@ -734,7 +744,7 @@ GetRgnBox(HRGN hrgn,
{ {
PRGN_ATTR Rgn_Attr; PRGN_ATTR Rgn_Attr;
if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr)) //if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr))
return NtGdiGetRgnBox(hrgn, prcOut); return NtGdiGetRgnBox(hrgn, prcOut);
if (Rgn_Attr->Flags == NULLREGION) if (Rgn_Attr->Flags == NULLREGION)
@ -845,7 +855,8 @@ OffsetRgn( HRGN hrgn,
PRGN_ATTR pRgn_Attr; PRGN_ATTR pRgn_Attr;
int nLeftRect, nTopRect, nRightRect, nBottomRect; int nLeftRect, nTopRect, nRightRect, nBottomRect;
if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr)) // HACKFIX
// if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr))
return NtGdiOffsetRgn(hrgn,nXOffset,nYOffset); return NtGdiOffsetRgn(hrgn,nXOffset,nYOffset);
if ( pRgn_Attr->Flags == NULLREGION) if ( pRgn_Attr->Flags == NULLREGION)
@ -898,7 +909,8 @@ PtInRegion(IN HRGN hrgn,
{ {
PRGN_ATTR pRgn_Attr; PRGN_ATTR pRgn_Attr;
if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr)) // HACKFIX
//if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr))
return NtGdiPtInRegion(hrgn,x,y); return NtGdiPtInRegion(hrgn,x,y);
if ( pRgn_Attr->Flags == NULLREGION) if ( pRgn_Attr->Flags == NULLREGION)
@ -921,7 +933,8 @@ RectInRegion(HRGN hrgn,
PRGN_ATTR pRgn_Attr; PRGN_ATTR pRgn_Attr;
RECTL rc; RECTL rc;
if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr)) // HACKFIX
//if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &pRgn_Attr))
return NtGdiRectInRegion(hrgn, (LPRECT) prcl); return NtGdiRectInRegion(hrgn, (LPRECT) prcl);
if ( pRgn_Attr->Flags == NULLREGION) if ( pRgn_Attr->Flags == NULLREGION)
@ -984,7 +997,7 @@ SetRectRgn(HRGN hrgn,
{ {
PRGN_ATTR Rgn_Attr; PRGN_ATTR Rgn_Attr;
if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr)) //if (!GdiGetHandleUserData((HGDIOBJ) hrgn, GDI_OBJECT_TYPE_REGION, (PVOID) &Rgn_Attr))
return NtGdiSetRectRgn(hrgn, nLeftRect, nTopRect, nRightRect, nBottomRect); return NtGdiSetRectRgn(hrgn, nLeftRect, nTopRect, nRightRect, nBottomRect);
if ((nLeftRect == nRightRect) || (nTopRect == nBottomRect)) if ((nLeftRect == nRightRect) || (nTopRect == nBottomRect))

View file

@ -1,6 +1,7 @@
<module name="netcfgx" type="win32dll" baseaddress="${BASEADDRESS_NETCFGX}" installbase="system32" installname="netcfgx.dll"> <module name="netcfgx" type="win32dll" baseaddress="${BASEADDRESS_NETCFGX}" installbase="system32" installname="netcfgx.dll">
<importlibrary definition="netcfgx.spec" /> <importlibrary definition="netcfgx.spec" />
<autoregister infsection="OleControlDlls" type="DllRegisterServer" /> <autoregister infsection="OleControlDlls" type="DllRegisterServer" />
<redefine name="_WIN32_WINNT">0x0600</redefine>
<library>ntdll</library> <library>ntdll</library>
<library>rpcrt4</library> <library>rpcrt4</library>
<library>setupapi</library> <library>setupapi</library>

View file

@ -3,6 +3,7 @@
<importlibrary definition="netshell.spec" /> <importlibrary definition="netshell.spec" />
<include base="netshell">.</include> <include base="netshell">.</include>
<define name="_NETSHELL_" /> <define name="_NETSHELL_" />
<redefine name="_WIN32_WINNT">0x600</redefine>
<library>shlwapi</library> <library>shlwapi</library>
<library>shell32</library> <library>shell32</library>
<library>version</library> <library>version</library>

View file

@ -3,6 +3,7 @@
<include base="user32">.</include> <include base="user32">.</include>
<include base="user32">include</include> <include base="user32">include</include>
<include base="ReactOS">include/reactos/subsys</include> <include base="ReactOS">include/reactos/subsys</include>
<include base="ReactOS">include/reactos/wine</include>
<library>wine</library> <library>wine</library>
<library>gdi32</library> <library>gdi32</library>
<library>advapi32</library> <library>advapi32</library>

View file

@ -317,9 +317,13 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment,
BOOL bInherit) BOOL bInherit)
{ {
WCHAR Buffer[MAX_PATH]; WCHAR Buffer[MAX_PATH];
WCHAR szValue[1024];
DWORD Length; DWORD Length;
DWORD dwType;
HKEY hKey;
HKEY hKeyUser; HKEY hKeyUser;
NTSTATUS Status; NTSTATUS Status;
LONG lError;
DPRINT("CreateEnvironmentBlock() called\n"); DPRINT("CreateEnvironmentBlock() called\n");
@ -349,17 +353,6 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment,
FALSE); FALSE);
} }
if (hToken == NULL)
return TRUE;
hKeyUser = GetCurrentUserKey(hToken);
if (hKeyUser == NULL)
{
DPRINT1("GetCurrentUserKey() failed\n");
RtlDestroyEnvironment(*lpEnvironment);
return FALSE;
}
/* Set 'ALLUSERSPROFILE' variable */ /* Set 'ALLUSERSPROFILE' variable */
Length = MAX_PATH; Length = MAX_PATH;
if (GetAllUsersProfileDirectoryW(Buffer, if (GetAllUsersProfileDirectoryW(Buffer,
@ -371,6 +364,57 @@ CreateEnvironmentBlock(LPVOID *lpEnvironment,
FALSE); FALSE);
} }
lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
0,
KEY_READ,
&hKey);
if (lError == ERROR_SUCCESS)
{
Length = 1024 * sizeof(WCHAR);
lError = RegQueryValueExW(hKey,
L"ProgramFilesDir",
NULL,
&dwType,
(LPBYTE)szValue,
&Length);
if (lError == ERROR_SUCCESS)
{
SetUserEnvironmentVariable(lpEnvironment,
L"ProgramFiles",
szValue,
FALSE);
}
Length = 1024 * sizeof(WCHAR);
lError = RegQueryValueExW(hKey,
L"CommonFilesDir",
NULL,
&dwType,
(LPBYTE)szValue,
&Length);
if (lError == ERROR_SUCCESS)
{
SetUserEnvironmentVariable(lpEnvironment,
L"CommonProgramFiles",
szValue,
FALSE);
}
RegCloseKey(hKey);
}
if (hToken == NULL)
return TRUE;
hKeyUser = GetCurrentUserKey(hToken);
if (hKeyUser == NULL)
{
DPRINT1("GetCurrentUserKey() failed\n");
RtlDestroyEnvironment(*lpEnvironment);
return FALSE;
}
/* Set 'USERPROFILE' variable */ /* Set 'USERPROFILE' variable */
Length = MAX_PATH; Length = MAX_PATH;
if (GetUserProfileDirectoryW(hToken, if (GetUserProfileDirectoryW(hToken,

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,72 @@
#ifndef _INC_COMMCTRL_WINE
#define _INC_COMMCTRL_WINE
#define DPA_GetPtr DPA_GetPtr_wine_hack
#define FlatSB_SetScrollProp FlatSB_SetScrollProp_wine_hack
#if (_WIN32_IE < 0x501)
#undef _WIN32_IE
#define _WIN32_IE 0x0501
#endif
#include_next <commctrl.h>
#undef DPA_GetPtr
LPVOID WINAPI DPA_GetPtr(HDPA, INT);
#undef FlatSB_SetScrollProp
BOOL WINAPI FlatSB_SetScrollProp(HWND, UINT, INT, BOOL);
#define DRAGLISTMSGSTRINGA "commctrl_DragListMsg"
#if defined(__GNUC__)
# define DRAGLISTMSGSTRINGW (const WCHAR []){ 'c','o','m','m','c','t','r','l', \
'_','D','r','a','g','L','i','s','t','M','s','g',0 }
#elif defined(_MSC_VER)
# define DRAGLISTMSGSTRINGW L"commctrl_DragListMsg"
#else
static const WCHAR DRAGLISTMSGSTRINGW[] = { 'c','o','m','m','c','t','r','l',
'_','D','r','a','g','L','i','s','t','M','s','g',0 };
#endif
#define FLATSB_CLASSA "flatsb_class32"
#if defined(__GNUC__)
# define FLATSB_CLASSW (const WCHAR []){ 'f','l','a','t','s','b','_', \
'c','l','a','s','s','3','2',0 }
#elif defined(_MSC_VER)
# define FLATSB_CLASSW L"flatsb_class32"
#else
static const WCHAR FLATSB_CLASSW[] = { 'f','l','a','t','s','b','_',
'c','l','a','s','s','3','2',0 };
#endif
typedef TBSAVEPARAMSW *LPTBSAVEPARAMSW;
typedef LVFINDINFOA *LPLVFINDINFOA;
typedef LVFINDINFOW *LPLVFINDINFOW;
#define SB_SETBORDERS (WM_USER+5)
#define TBSTYLE_EX_UNDOC1 0x00000004 /* similar to TBSTYLE_WRAPABLE */
/* these are undocumented and the names are guesses */
typedef struct
{
NMHDR hdr;
HWND hwndDialog;
} NMTBINITCUSTOMIZE;
typedef struct
{
NMHDR hdr;
INT idNew;
INT iDirection; /* left is -1, right is 1 */
DWORD dwReason; /* HICF_* */
} NMTBWRAPHOTITEM;
#define LPNMLVDISPINFO WINELIB_NAME_AW(LPNMLVDISPINFO)
/* undocumented messages in Toolbar */
#define TB_UNKWN45D (WM_USER+93)
#define TB_UNKWN464 (WM_USER+100)
#endif /* _INC_COMMCTRL_WINE */

View file

@ -51,6 +51,9 @@ BltMask(SURFOBJ* psoDest,
ULONG Pattern = 0; ULONG Pattern = 0;
HBITMAP hbmPattern; HBITMAP hbmPattern;
ASSERT(psoSource == NULL);
ASSERT(pptlSource == NULL);
if (psoMask == NULL) if (psoMask == NULL)
{ {
return FALSE; return FALSE;
@ -629,8 +632,8 @@ static BOOLEAN APIENTRY
AlphaBltMask(SURFOBJ* psoDest, AlphaBltMask(SURFOBJ* psoDest,
SURFOBJ* psoSource, // unused SURFOBJ* psoSource, // unused
SURFOBJ* psoMask, SURFOBJ* psoMask,
XLATEOBJ* ColorTranslation, XLATEOBJ* pxloRGB2Dest,
XLATEOBJ* SrcColorTranslation, XLATEOBJ* pxloBrush,
RECTL* prclDest, RECTL* prclDest,
POINTL* pptlSource, // unused POINTL* pptlSource, // unused
POINTL* pptlMask, POINTL* pptlMask,
@ -642,12 +645,15 @@ AlphaBltMask(SURFOBJ* psoDest,
ULONG Background, BrushColor, NewColor; ULONG Background, BrushColor, NewColor;
BYTE *tMask, *lMask; BYTE *tMask, *lMask;
ASSERT(psoSource == NULL);
ASSERT(pptlSource == NULL);
dx = prclDest->right - prclDest->left; dx = prclDest->right - prclDest->left;
dy = prclDest->bottom - prclDest->top; dy = prclDest->bottom - prclDest->top;
if (psoMask != NULL) if (psoMask != NULL)
{ {
BrushColor = XLATEOBJ_iXlate(SrcColorTranslation, pbo ? pbo->iSolidColor : 0); BrushColor = XLATEOBJ_iXlate(pxloBrush, pbo ? pbo->iSolidColor : 0);
r = (int)GetRValue(BrushColor); r = (int)GetRValue(BrushColor);
g = (int)GetGValue(BrushColor); g = (int)GetGValue(BrushColor);
b = (int)GetBValue(BrushColor); b = (int)GetBValue(BrushColor);
@ -668,14 +674,14 @@ AlphaBltMask(SURFOBJ* psoDest,
else else
{ {
Background = DIB_GetSource(psoDest, prclDest->left + i, prclDest->top + j, Background = DIB_GetSource(psoDest, prclDest->left + i, prclDest->top + j,
SrcColorTranslation); pxloBrush);
NewColor = NewColor =
RGB((*lMask * (r - GetRValue(Background)) >> 8) + GetRValue(Background), RGB((*lMask * (r - GetRValue(Background)) >> 8) + GetRValue(Background),
(*lMask * (g - GetGValue(Background)) >> 8) + GetGValue(Background), (*lMask * (g - GetGValue(Background)) >> 8) + GetGValue(Background),
(*lMask * (b - GetBValue(Background)) >> 8) + GetBValue(Background)); (*lMask * (b - GetBValue(Background)) >> 8) + GetBValue(Background));
Background = XLATEOBJ_iXlate(ColorTranslation, NewColor); Background = XLATEOBJ_iXlate(pxloRGB2Dest, NewColor);
DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel( DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_PutPixel(
psoDest, prclDest->left + i, prclDest->top + j, Background); psoDest, prclDest->left + i, prclDest->top + j, Background);
} }
@ -813,10 +819,10 @@ EngMaskBitBlt(SURFOBJ *psoDest,
case DC_TRIVIAL: case DC_TRIVIAL:
if (psoMask->iBitmapFormat == BMF_8BPP) if (psoMask->iBitmapFormat == BMF_8BPP)
Ret = AlphaBltMask(psoOutput, NULL , psoInput, DestColorTranslation, SourceColorTranslation, Ret = AlphaBltMask(psoOutput, NULL , psoInput, DestColorTranslation, SourceColorTranslation,
&OutputRect, &InputPoint, pptlMask, pbo, &AdjustedBrushOrigin); &OutputRect, NULL, &InputPoint, pbo, &AdjustedBrushOrigin);
else else
Ret = BltMask(psoOutput, NULL, psoInput, DestColorTranslation, Ret = BltMask(psoOutput, NULL, psoInput, DestColorTranslation,
&OutputRect, &InputPoint, pptlMask, pbo, &AdjustedBrushOrigin, &OutputRect, NULL, &InputPoint, pbo, &AdjustedBrushOrigin,
R4_MASK); R4_MASK);
break; break;
case DC_RECT: case DC_RECT:
@ -831,13 +837,13 @@ EngMaskBitBlt(SURFOBJ *psoDest,
Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top; Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
if (psoMask->iBitmapFormat == BMF_8BPP) if (psoMask->iBitmapFormat == BMF_8BPP)
{ {
Ret = AlphaBltMask(psoOutput, psoInput, psoMask, DestColorTranslation, SourceColorTranslation, Ret = AlphaBltMask(psoOutput, NULL, psoInput, DestColorTranslation, SourceColorTranslation,
&CombinedRect, &Pt, pptlMask, pbo, &AdjustedBrushOrigin); &CombinedRect, NULL, &Pt, pbo, &AdjustedBrushOrigin);
} }
else else
{ {
Ret = BltMask(psoOutput, psoInput, psoMask, DestColorTranslation, Ret = BltMask(psoOutput, NULL, psoInput, DestColorTranslation,
&CombinedRect, &Pt, pptlMask, pbo, &AdjustedBrushOrigin, R4_MASK); &CombinedRect, NULL, &Pt, pbo, &AdjustedBrushOrigin, R4_MASK);
} }
} }
break; break;
@ -875,17 +881,17 @@ EngMaskBitBlt(SURFOBJ *psoDest,
Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top; Pt.y = InputPoint.y + CombinedRect.top - OutputRect.top;
if (psoMask->iBitmapFormat == BMF_8BPP) if (psoMask->iBitmapFormat == BMF_8BPP)
{ {
Ret = AlphaBltMask(psoOutput, psoInput, psoMask, Ret = AlphaBltMask(psoOutput, NULL, psoInput,
DestColorTranslation, DestColorTranslation,
SourceColorTranslation, SourceColorTranslation,
&CombinedRect, &Pt, pptlMask, pbo, &CombinedRect, NULL, &Pt, pbo,
&AdjustedBrushOrigin) && Ret; &AdjustedBrushOrigin) && Ret;
} }
else else
{ {
Ret = BltMask(psoOutput, psoInput, psoMask, Ret = BltMask(psoOutput, NULL, psoInput,
DestColorTranslation, &CombinedRect, &Pt, DestColorTranslation, &CombinedRect, NULL,
pptlMask, pbo, &AdjustedBrushOrigin, &Pt, pbo, &AdjustedBrushOrigin,
R4_MASK) && Ret; R4_MASK) && Ret;
} }
} }

View file

@ -6,6 +6,7 @@
#define MSQ_NORMAL 0 #define MSQ_NORMAL 0
#define MSQ_ISHOOK 1 #define MSQ_ISHOOK 1
#define MSQ_ISEVENT 2 #define MSQ_ISEVENT 2
#define MSQ_SENTNOWAIT 0x80000000
typedef struct _USER_MESSAGE typedef struct _USER_MESSAGE
{ {
@ -28,6 +29,7 @@ typedef struct _USER_SENT_MESSAGE
/* entry in the dispatching list of the sender's message queue */ /* entry in the dispatching list of the sender's message queue */
LIST_ENTRY DispatchingListEntry; LIST_ENTRY DispatchingListEntry;
INT HookMessage; INT HookMessage;
BOOL HasPackedLParam;
} USER_SENT_MESSAGE, *PUSER_SENT_MESSAGE; } USER_SENT_MESSAGE, *PUSER_SENT_MESSAGE;
typedef struct _USER_SENT_MESSAGE_NOTIFY typedef struct _USER_SENT_MESSAGE_NOTIFY
@ -184,6 +186,20 @@ co_IntSendMessageTimeout(HWND hWnd,
UINT uFlags, UINT uFlags,
UINT uTimeout, UINT uTimeout,
ULONG_PTR *uResult); ULONG_PTR *uResult);
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam);
LRESULT FASTCALL
co_IntSendMessageWithCallBack(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
SENDASYNCPROC CompletionCallback,
ULONG_PTR CompletionCallbackContext,
ULONG_PTR *uResult);
LRESULT FASTCALL LRESULT FASTCALL
IntDispatchMessage(MSG* Msg); IntDispatchMessage(MSG* Msg);
BOOL FASTCALL BOOL FASTCALL

View file

@ -53,8 +53,8 @@ co_IntSendDeactivateMessages(HWND hWndPrev, HWND hWnd)
{ {
if (hWndPrev) if (hWndPrev)
{ {
co_IntPostOrSendMessage(hWndPrev, WM_NCACTIVATE, FALSE, 0); co_IntSendMessageNoWait(hWndPrev, WM_NCACTIVATE, FALSE, 0);
co_IntPostOrSendMessage(hWndPrev, WM_ACTIVATE, co_IntSendMessageNoWait(hWndPrev, WM_ACTIVATE,
MAKEWPARAM(WA_INACTIVE, UserGetWindowLong(hWndPrev, GWL_STYLE, FALSE) & WS_MINIMIZE), MAKEWPARAM(WA_INACTIVE, UserGetWindowLong(hWndPrev, GWL_STYLE, FALSE) & WS_MINIMIZE),
(LPARAM)hWnd); (LPARAM)hWnd);
} }
@ -105,38 +105,19 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
if (Window && WindowPrev) if (Window && WindowPrev)
{ {
PWINDOW_OBJECT cWindow;
HWND *List, *phWnd;
HANDLE OldTID = IntGetWndThreadId(WindowPrev); HANDLE OldTID = IntGetWndThreadId(WindowPrev);
HANDLE NewTID = IntGetWndThreadId(Window); HANDLE NewTID = IntGetWndThreadId(Window);
DPRINT("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID); DPRINT1("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID);
if (Window->Wnd->style & WS_MINIMIZE)
{
DPRINT1("Widow was nminimized\n");
}
if (OldTID != NewTID) if (OldTID != NewTID)
{ {
List = IntWinListChildren(UserGetWindowObject(IntGetDesktopWindow())); co_IntSendMessageNoWait(hWndPrev, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID);
if (List) co_IntSendMessageNoWait(hWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID);
{
for (phWnd = List; *phWnd; ++phWnd)
{
cWindow = UserGetWindowObject(*phWnd);
if (cWindow && (IntGetWndThreadId(cWindow) == OldTID))
{ // FALSE if the window is being deactivated,
// ThreadId that owns the window being activated.
co_IntPostOrSendMessage(*phWnd, WM_ACTIVATEAPP, FALSE, (LPARAM)NewTID);
}
}
for (phWnd = List; *phWnd; ++phWnd)
{
cWindow = UserGetWindowObject(*phWnd);
if (cWindow && (IntGetWndThreadId(cWindow) == NewTID))
{ // TRUE if the window is being activated,
// ThreadId that owns the window being deactivated.
co_IntPostOrSendMessage(*phWnd, WM_ACTIVATEAPP, TRUE, (LPARAM)OldTID);
}
}
ExFreePool(List);
}
} }
UserDerefObjectCo(WindowPrev); // Now allow the previous window to die. UserDerefObjectCo(WindowPrev); // Now allow the previous window to die.
} }
@ -144,10 +125,9 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
UserDerefObjectCo(Window); UserDerefObjectCo(Window);
/* FIXME: IntIsWindow */ /* FIXME: IntIsWindow */
co_IntSendMessageNoWait(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == UserGetForegroundWindow()), 0);
co_IntPostOrSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == UserGetForegroundWindow()), 0);
/* FIXME: WA_CLICKACTIVE */ /* FIXME: WA_CLICKACTIVE */
co_IntPostOrSendMessage(hWnd, WM_ACTIVATE, co_IntSendMessageNoWait(hWnd, WM_ACTIVATE,
MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE, MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE,
UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE), UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE),
(LPARAM)hWndPrev); (LPARAM)hWndPrev);
@ -241,7 +221,9 @@ co_IntSetForegroundAndFocusWindow(PWINDOW_OBJECT Window, PWINDOW_OBJECT FocusWin
co_IntSendDeactivateMessages(hWndPrev, hWnd); co_IntSendDeactivateMessages(hWndPrev, hWnd);
co_IntSendKillFocusMessages(hWndFocusPrev, hWndFocus); co_IntSendKillFocusMessages(hWndFocusPrev, hWndFocus);
IntSetFocusMessageQueue(Window->pti->MessageQueue); IntSetFocusMessageQueue(Window->pti->MessageQueue);
if (Window->pti->MessageQueue) if (Window->pti->MessageQueue)
{ {
Window->pti->MessageQueue->ActiveWindow = hWnd; Window->pti->MessageQueue->ActiveWindow = hWnd;

View file

@ -165,7 +165,7 @@ MsgMemorySize(PMSGMEMORY MsgMemoryEntry, WPARAM wParam, LPARAM lParam)
} }
static NTSTATUS static NTSTATUS
PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolNeeded)
{ {
NCCALCSIZE_PARAMS *UnpackedNcCalcsize; NCCALCSIZE_PARAMS *UnpackedNcCalcsize;
NCCALCSIZE_PARAMS *PackedNcCalcsize; NCCALCSIZE_PARAMS *PackedNcCalcsize;
@ -173,28 +173,34 @@ PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam)
CREATESTRUCTW *PackedCs; CREATESTRUCTW *PackedCs;
PUNICODE_STRING WindowName; PUNICODE_STRING WindowName;
PUNICODE_STRING ClassName; PUNICODE_STRING ClassName;
POOL_TYPE PoolType;
UINT Size; UINT Size;
PCHAR CsData; PCHAR CsData;
*lParamPacked = lParam; *lParamPacked = lParam;
if (NonPagedPoolNeeded)
PoolType = NonPagedPool;
else
PoolType = PagedPool;
if (WM_NCCALCSIZE == Msg && wParam) if (WM_NCCALCSIZE == Msg && wParam)
{ {
UnpackedNcCalcsize = (NCCALCSIZE_PARAMS *) lParam; UnpackedNcCalcsize = (NCCALCSIZE_PARAMS *) lParam;
if (UnpackedNcCalcsize->lppos != (PWINDOWPOS) (UnpackedNcCalcsize + 1)) PackedNcCalcsize = ExAllocatePoolWithTag(PoolType,
sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS),
TAG_MSG);
if (NULL == PackedNcCalcsize)
{ {
PackedNcCalcsize = ExAllocatePoolWithTag(PagedPool, DPRINT1("Not enough memory to pack lParam\n");
sizeof(NCCALCSIZE_PARAMS) + sizeof(WINDOWPOS), return STATUS_NO_MEMORY;
TAG_MSG);
if (NULL == PackedNcCalcsize)
{
DPRINT1("Not enough memory to pack lParam\n");
return STATUS_NO_MEMORY;
}
RtlCopyMemory(PackedNcCalcsize, UnpackedNcCalcsize, sizeof(NCCALCSIZE_PARAMS));
PackedNcCalcsize->lppos = (PWINDOWPOS) (PackedNcCalcsize + 1);
RtlCopyMemory(PackedNcCalcsize->lppos, UnpackedNcCalcsize->lppos, sizeof(WINDOWPOS));
*lParamPacked = (LPARAM) PackedNcCalcsize;
} }
RtlCopyMemory(PackedNcCalcsize, UnpackedNcCalcsize, sizeof(NCCALCSIZE_PARAMS));
PackedNcCalcsize->lppos = (PWINDOWPOS) (PackedNcCalcsize + 1);
RtlCopyMemory(PackedNcCalcsize->lppos, UnpackedNcCalcsize->lppos, sizeof(WINDOWPOS));
*lParamPacked = (LPARAM) PackedNcCalcsize;
} }
else if (WM_CREATE == Msg || WM_NCCREATE == Msg) else if (WM_CREATE == Msg || WM_NCCREATE == Msg)
{ {
@ -210,7 +216,7 @@ PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam)
{ {
Size += sizeof(WCHAR) + ClassName->Length + sizeof(WCHAR); Size += sizeof(WCHAR) + ClassName->Length + sizeof(WCHAR);
} }
PackedCs = ExAllocatePoolWithTag(PagedPool, Size, TAG_MSG); PackedCs = ExAllocatePoolWithTag(PoolType, Size, TAG_MSG);
if (NULL == PackedCs) if (NULL == PackedCs)
{ {
DPRINT1("Not enough memory to pack lParam\n"); DPRINT1("Not enough memory to pack lParam\n");
@ -244,11 +250,28 @@ PackParam(LPARAM *lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam)
*lParamPacked = (LPARAM) PackedCs; *lParamPacked = (LPARAM) PackedCs;
} }
else if (PoolType == NonPagedPool)
{
PMSGMEMORY MsgMemoryEntry;
PVOID PackedData;
MsgMemoryEntry = FindMsgMemory(Msg);
if ((!MsgMemoryEntry) || (MsgMemoryEntry->Size < 0))
{
/* Keep previous behavior */
return STATUS_SUCCESS;
}
PackedData = ExAllocatePoolWithTag(NonPagedPool, MsgMemorySize(MsgMemoryEntry, wParam, lParam), TAG_MSG);
RtlCopyMemory(PackedData, (PVOID)lParam, MsgMemorySize(MsgMemoryEntry, wParam, lParam));
*lParamPacked = (LPARAM)PackedData;
}
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
static NTSTATUS static NTSTATUS
UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam) UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL NonPagedPoolUsed)
{ {
NCCALCSIZE_PARAMS *UnpackedParams; NCCALCSIZE_PARAMS *UnpackedParams;
NCCALCSIZE_PARAMS *PackedParams; NCCALCSIZE_PARAMS *PackedParams;
@ -277,6 +300,23 @@ UnpackParam(LPARAM lParamPacked, UINT Msg, WPARAM wParam, LPARAM lParam)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
else if (NonPagedPoolUsed)
{
PMSGMEMORY MsgMemoryEntry;
MsgMemoryEntry = FindMsgMemory(Msg);
if (MsgMemoryEntry->Size < 0)
{
/* Keep previous behavior */
return STATUS_INVALID_PARAMETER;
}
if (MsgMemory->Flags == MMS_FLAG_READWRITE)
{
//RtlCopyMemory((PVOID)lParam, (PVOID)lParamPacked, MsgMemory->Size);
}
ExFreePool((PVOID) lParamPacked);
return STATUS_SUCCESS;
}
ASSERT(FALSE); ASSERT(FALSE);
@ -394,7 +434,7 @@ IntDispatchMessage(PMSG pMsg)
lParamBufferSize = MsgMemorySize(MsgMemoryEntry, pMsg->wParam, pMsg->lParam); lParamBufferSize = MsgMemorySize(MsgMemoryEntry, pMsg->wParam, pMsg->lParam);
} }
if (! NT_SUCCESS(PackParam(&lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam))) if (! NT_SUCCESS(PackParam(&lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam, FALSE)))
{ {
DPRINT1("Failed to pack message parameters\n"); DPRINT1("Failed to pack message parameters\n");
return 0; return 0;
@ -408,7 +448,7 @@ IntDispatchMessage(PMSG pMsg)
lParamPacked, lParamPacked,
lParamBufferSize); lParamBufferSize);
if (! NT_SUCCESS(UnpackParam(lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam))) if (! NT_SUCCESS(UnpackParam(lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam, FALSE)))
{ {
DPRINT1("Failed to unpack message parameters\n"); DPRINT1("Failed to unpack message parameters\n");
} }
@ -1373,7 +1413,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam); lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
} }
if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam))) if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, FALSE)))
{ {
DPRINT1("Failed to pack message parameters\n"); DPRINT1("Failed to pack message parameters\n");
RETURN( FALSE); RETURN( FALSE);
@ -1393,7 +1433,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult); IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);
if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam))) if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
{ {
DPRINT1("Failed to unpack message parameters\n"); DPRINT1("Failed to unpack message parameters\n");
RETURN( TRUE); RETURN( TRUE);
@ -1503,6 +1543,148 @@ co_IntSendMessageTimeout( HWND hWnd,
return (LRESULT) TRUE; return (LRESULT) TRUE;
} }
LRESULT FASTCALL co_IntSendMessageNoWait(HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
{
ULONG_PTR Result = 0;
co_IntSendMessageWithCallBack(hWnd,
Msg,
wParam,
lParam,
NULL,
0,
&Result);
return Result;
}
LRESULT FASTCALL
co_IntSendMessageWithCallBack( HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam,
SENDASYNCPROC CompletionCallback,
ULONG_PTR CompletionCallbackContext,
ULONG_PTR *uResult)
{
ULONG_PTR Result;
PWINDOW_OBJECT Window = NULL;
PMSGMEMORY MsgMemoryEntry;
INT lParamBufferSize;
LPARAM lParamPacked;
PTHREADINFO Win32Thread;
DECLARE_RETURN(LRESULT);
USER_REFERENCE_ENTRY Ref;
PUSER_SENT_MESSAGE Message;
if (!(Window = UserGetWindowObject(hWnd)))
{
RETURN(FALSE);
}
UserRefObjectCo(Window, &Ref);
if (Window->state & WINDOWSTATUS_DESTROYING)
{
/* FIXME - last error? */
DPRINT1("Attempted to send message to window 0x%x that is being destroyed!\n", hWnd);
RETURN(FALSE);
}
Win32Thread = PsGetCurrentThreadWin32Thread();
IntCallWndProc( Window, hWnd, Msg, wParam, lParam);
if (Win32Thread == NULL)
{
ASSERT(FALSE);
RETURN(FALSE);
}
if (Win32Thread->TIF_flags & TIF_INCLEANUP)
{
/* Never send messages to exiting threads */
RETURN(FALSE);
}
/* See if this message type is present in the table */
MsgMemoryEntry = FindMsgMemory(Msg);
if (NULL == MsgMemoryEntry)
{
lParamBufferSize = -1;
}
else
{
lParamBufferSize = MsgMemorySize(MsgMemoryEntry, wParam, lParam);
}
if (! NT_SUCCESS(PackParam(&lParamPacked, Msg, wParam, lParam, Window->pti->MessageQueue != Win32Thread->MessageQueue)))
{
DPRINT1("Failed to pack message parameters\n");
RETURN( FALSE);
}
/* If this is not a callback and it can be sent now, then send it. */
if ((Window->pti->MessageQueue == Win32Thread->MessageQueue) && (CompletionCallback == NULL))
{
Result = (ULONG_PTR)co_IntCallWindowProc( Window->Wnd->lpfnWndProc,
!Window->Wnd->Unicode,
hWnd,
Msg,
wParam,
lParamPacked,
lParamBufferSize );
if(uResult)
{
*uResult = Result;
}
}
IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);
if (Window->pti->MessageQueue == Win32Thread->MessageQueue)
{
if (! NT_SUCCESS(UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE)))
{
DPRINT1("Failed to unpack message parameters\n");
RETURN(TRUE);
}
RETURN(TRUE);
}
if(!(Message = ExAllocatePoolWithTag(NonPagedPool, sizeof(USER_SENT_MESSAGE), TAG_USRMSG)))
{
DPRINT1("MsqSendMessage(): Not enough memory to allocate a message");
return STATUS_INSUFFICIENT_RESOURCES;
}
Message->Msg.hwnd = hWnd;
Message->Msg.message = Msg;
Message->Msg.wParam = wParam;
Message->Msg.lParam = lParamPacked;
Message->CompletionEvent = NULL;
Message->Result = 0;
Message->SenderQueue = Win32Thread->MessageQueue;
IntReferenceMessageQueue(Message->SenderQueue);
IntReferenceMessageQueue(Window->pti->MessageQueue);
Message->CompletionCallback = CompletionCallback;
Message->CompletionCallbackContext = CompletionCallbackContext;
Message->HookMessage = MSQ_NORMAL | MSQ_SENTNOWAIT;
Message->HasPackedLParam = (lParamBufferSize > 0);
InsertTailList(&Window->pti->MessageQueue->SentMessagesListHead, &Message->ListEntry);
InsertTailList(&Win32Thread->MessageQueue->DispatchingMessagesHead, &Message->DispatchingListEntry);
IntDereferenceMessageQueue(Window->pti->MessageQueue);
IntDereferenceMessageQueue(Message->SenderQueue);
RETURN(TRUE);
CLEANUP:
if (Window) UserDerefObjectCo(Window);
END_CLEANUP;
}
/* This function posts a message if the destination's message queue belongs to /* This function posts a message if the destination's message queue belongs to
another thread, otherwise it sends the message. It does not support broadcast another thread, otherwise it sends the message. It does not support broadcast

View file

@ -969,7 +969,7 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
/* remove the message from the dispatching list, so lock the sender's message queue */ /* remove the message from the dispatching list, so lock the sender's message queue */
SenderReturned = (Message->DispatchingListEntry.Flink == NULL); SenderReturned = (Message->DispatchingListEntry.Flink == NULL);
if(!SenderReturned) if (!SenderReturned)
{ {
/* only remove it from the dispatching list if not already removed by a timeout */ /* only remove it from the dispatching list if not already removed by a timeout */
RemoveEntryList(&Message->DispatchingListEntry); RemoveEntryList(&Message->DispatchingListEntry);
@ -983,6 +983,12 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
*Message->Result = Result; *Message->Result = Result;
} }
if (Message->HasPackedLParam == TRUE)
{
if (Message->Msg.lParam)
ExFreePool((PVOID)Message->Msg.lParam);
}
/* Notify the sender. */ /* Notify the sender. */
if (Message->CompletionEvent != NULL) if (Message->CompletionEvent != NULL)
{ {
@ -1010,9 +1016,12 @@ co_MsqDispatchOneSentMessage(PUSER_MESSAGE_QUEUE MessageQueue)
Notified: Notified:
/* dereference both sender and our queue */ /* Only if it is not a no wait message */
IntDereferenceMessageQueue(MessageQueue); if (!(Message->HookMessage & MSQ_SENTNOWAIT))
IntDereferenceMessageQueue(Message->SenderQueue); {
IntDereferenceMessageQueue(Message->SenderQueue);
IntDereferenceMessageQueue(MessageQueue);
}
/* free the message */ /* free the message */
ExFreePool(Message); ExFreePool(Message);
@ -1147,6 +1156,7 @@ co_MsqSendMessage(PUSER_MESSAGE_QUEUE MessageQueue,
IntReferenceMessageQueue(ThreadQueue); IntReferenceMessageQueue(ThreadQueue);
Message->CompletionCallback = NULL; Message->CompletionCallback = NULL;
Message->HookMessage = HookMessage; Message->HookMessage = HookMessage;
Message->HasPackedLParam = FALSE;
IntReferenceMessageQueue(MessageQueue); IntReferenceMessageQueue(MessageQueue);

View file

@ -69,9 +69,6 @@ IntGetClientOrigin(PWINDOW_OBJECT Window OPTIONAL, LPPOINT Point)
return TRUE; return TRUE;
} }
BOOL FASTCALL BOOL FASTCALL
UserGetClientOrigin(PWINDOW_OBJECT Window, LPPOINT Point) UserGetClientOrigin(PWINDOW_OBJECT Window, LPPOINT Point)
{ {
@ -120,8 +117,13 @@ BOOL FASTCALL can_activate_window( PWINDOW_OBJECT Wnd OPTIONAL)
style = Wnd->Wnd->style; style = Wnd->Wnd->style;
if (!(style & WS_VISIBLE) && if (!(style & WS_VISIBLE) &&
Wnd->pti->pEThread->ThreadsProcess != CsrProcess) return FALSE; Wnd->pti->pEThread->ThreadsProcess != CsrProcess) return FALSE;
if ((style & WS_MINIMIZE) &&
Wnd->pti->pEThread->ThreadsProcess != CsrProcess) return FALSE;
if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE; if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE;
return !(style & WS_DISABLED); return TRUE;
/* FIXME: This window could be disable because the child that closed
was a popup. */
//return !(style & WS_DISABLED);
} }
@ -312,7 +314,7 @@ co_WinPosMinMaximize(PWINDOW_OBJECT Window, UINT ShowFlag, RECT* NewPos)
if (Wnd->style & WS_MINIMIZE) if (Wnd->style & WS_MINIMIZE)
{ {
if (!co_IntSendMessage(Window->hSelf, WM_QUERYOPEN, 0, 0)) if (!co_IntSendMessageNoWait(Window->hSelf, WM_QUERYOPEN, 0, 0))
{ {
return(SWP_NOSIZE | SWP_NOMOVE); return(SWP_NOSIZE | SWP_NOMOVE);
} }
@ -531,7 +533,7 @@ co_WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos,
params.lppos = &winposCopy; params.lppos = &winposCopy;
winposCopy = *WinPos; winposCopy = *WinPos;
wvrFlags = co_IntSendMessage(Window->hSelf, WM_NCCALCSIZE, TRUE, (LPARAM) &params); wvrFlags = co_IntSendMessageNoWait(Window->hSelf, WM_NCCALCSIZE, TRUE, (LPARAM) &params);
/* If the application send back garbage, ignore it */ /* If the application send back garbage, ignore it */
if (params.rgrc[0].left <= params.rgrc[0].right && if (params.rgrc[0].left <= params.rgrc[0].right &&
@ -590,7 +592,7 @@ co_WinPosDoWinPosChanging(PWINDOW_OBJECT Window,
if (!(WinPos->flags & SWP_NOSENDCHANGING)) if (!(WinPos->flags & SWP_NOSENDCHANGING))
{ {
co_IntPostOrSendMessage(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos); co_IntSendMessageNoWait(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos);
} }
*WindowRect = Wnd->rcWindow; *WindowRect = Wnd->rcWindow;
@ -1320,7 +1322,7 @@ co_WinPosSetWindowPos(
{ {
if ((Window->Wnd->style & (WS_CHILD | WS_POPUP)) == WS_CHILD) if ((Window->Wnd->style & (WS_CHILD | WS_POPUP)) == WS_CHILD)
{ {
co_IntSendMessage(WinPos.hwnd, WM_CHILDACTIVATE, 0, 0); co_IntSendMessageNoWait(WinPos.hwnd, WM_CHILDACTIVATE, 0, 0);
} }
else else
{ {
@ -1330,7 +1332,7 @@ co_WinPosSetWindowPos(
} }
if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) if ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE)
co_IntPostOrSendMessage(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos); co_IntSendMessageNoWait(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM) &WinPos);
return TRUE; return TRUE;
} }
@ -1343,7 +1345,7 @@ co_WinPosGetNonClientSize(PWINDOW_OBJECT Window, RECT* WindowRect, RECT* ClientR
ASSERT_REFS_CO(Window); ASSERT_REFS_CO(Window);
*ClientRect = *WindowRect; *ClientRect = *WindowRect;
Result = co_IntSendMessage(Window->hSelf, WM_NCCALCSIZE, FALSE, (LPARAM) ClientRect); Result = co_IntSendMessageNoWait(Window->hSelf, WM_NCCALCSIZE, FALSE, (LPARAM) ClientRect);
FixClientRect(ClientRect, WindowRect); FixClientRect(ClientRect, WindowRect);
@ -1462,7 +1464,7 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
if (ShowFlag != WasVisible) if (ShowFlag != WasVisible)
{ {
co_IntSendMessage(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0); co_IntSendMessageNoWait(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0);
} }
/* We can't activate a child window */ /* We can't activate a child window */
@ -1476,7 +1478,7 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
? HWND_TOPMOST : HWND_TOP, ? HWND_TOPMOST : HWND_TOP,
NewPos.left, NewPos.top, NewPos.right, NewPos.bottom, LOWORD(Swp)); NewPos.left, NewPos.top, NewPos.right, NewPos.bottom, LOWORD(Swp));
if (Cmd == SW_HIDE) if ((Cmd == SW_HIDE) || (Cmd == SW_MINIMIZE))
{ {
PWINDOW_OBJECT ThreadFocusWindow; PWINDOW_OBJECT ThreadFocusWindow;
@ -1520,12 +1522,12 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
wParam = SIZE_MINIMIZED; wParam = SIZE_MINIMIZED;
} }
co_IntSendMessage(Window->hSelf, WM_SIZE, wParam, co_IntSendMessageNoWait(Window->hSelf, WM_SIZE, wParam,
MAKELONG(Wnd->rcClient.right - MAKELONG(Wnd->rcClient.right -
Wnd->rcClient.left, Wnd->rcClient.left,
Wnd->rcClient.bottom - Wnd->rcClient.bottom -
Wnd->rcClient.top)); Wnd->rcClient.top));
co_IntSendMessage(Window->hSelf, WM_MOVE, 0, co_IntSendMessageNoWait(Window->hSelf, WM_MOVE, 0,
MAKELONG(Wnd->rcClient.left, MAKELONG(Wnd->rcClient.left,
Wnd->rcClient.top)); Wnd->rcClient.top));
IntEngWindowChanged(Window, WOC_RGN_CLIENT); IntEngWindowChanged(Window, WOC_RGN_CLIENT);