Author: fireball
Date: Sun Apr 4 15:19:10 2010
New Revision: 46715
URL:
http://svn.reactos.org/svn/reactos?rev=46715&view=rev
Log:
- Sync up to Wine-1.1.42.
Modified:
branches/arwinss/reactos/dll/win32/gdi32/ (props changed)
branches/arwinss/reactos/dll/win32/gdi32/driver.c
branches/arwinss/reactos/dll/win32/gdi32/enhmetafile.c
branches/arwinss/reactos/dll/win32/gdi32/freetype.c
branches/arwinss/reactos/dll/win32/gdi32/region.c
branches/arwinss/reactos/dll/win32/user32/ (props changed)
branches/arwinss/reactos/dll/win32/user32/cursoricon.c
branches/arwinss/reactos/dll/win32/user32/menu.c
branches/arwinss/reactos/dll/win32/user32/message.c
branches/arwinss/reactos/dll/win32/user32/scroll.c
branches/arwinss/reactos/dll/win32/user32/user_private.h
branches/arwinss/reactos/dll/win32/user32/win.c
branches/arwinss/reactos/include/reactos/wine/server_protocol.h
branches/arwinss/reactos/subsystems/win32/win32k/include/request.h
branches/arwinss/reactos/subsystems/win32/win32k/wine/ (props changed)
branches/arwinss/reactos/subsystems/win32/win32k/wine/handle.c
branches/arwinss/reactos/subsystems/win32/win32k/wine/queue.c
branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c
Propchange: branches/arwinss/reactos/dll/win32/gdi32/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Apr 4 15:19:10 2010
@@ -1,3 +1,3 @@
/branches/ros-amd64-bringup/reactos/dll/win32/gdi32:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
/trunk/reactos/dll/win32/gdi32:42000-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688
-/vendor/wine/dlls/gdi32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314
+/vendor/wine/dlls/gdi32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46696
Modified: branches/arwinss/reactos/dll/win32/gdi32/driver.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/driver.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/driver.c [iso-8859-1] Sun Apr 4 15:19:10
2010
@@ -757,6 +757,9 @@
*/
ULONG WINAPI DdQueryDisplaySettingsUniqueness(VOID)
{
- FIXME("stub\n");
+ static int warn_once;
+
+ if (!warn_once++)
+ FIXME("stub\n");
return 0;
}
Modified: branches/arwinss/reactos/dll/win32/gdi32/enhmetafile.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/enhmetafile.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/enhmetafile.c [iso-8859-1] Sun Apr 4
15:19:10 2010
@@ -1077,7 +1077,7 @@
/* NB POINTS array doesn't start at pPolyPoly->apts it's actually
pPolyPoly->aPolyCounts + pPolyPoly->nPolys */
- POINTS *pts = (POINTS *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys);
+ const POINTS *pts = (const POINTS *)(pPolyPoly->aPolyCounts +
pPolyPoly->nPolys);
POINT *pt = HeapAlloc( GetProcessHeap(), 0, pPolyPoly->cpts * sizeof(POINT)
);
DWORD i;
for(i = 0; i < pPolyPoly->cpts; i++)
@@ -1085,7 +1085,7 @@
pt[i].x = pts[i].x;
pt[i].y = pts[i].y;
}
- PolyPolygon(hdc, pt, (INT*)pPolyPoly->aPolyCounts, pPolyPoly->nPolys);
+ PolyPolygon(hdc, pt, (const INT*)pPolyPoly->aPolyCounts, pPolyPoly->nPolys);
HeapFree( GetProcessHeap(), 0, pt );
break;
}
@@ -1095,7 +1095,7 @@
/* NB POINTS array doesn't start at pPolyPoly->apts it's actually
pPolyPoly->aPolyCounts + pPolyPoly->nPolys */
- POINTS *pts = (POINTS *)(pPolyPoly->aPolyCounts + pPolyPoly->nPolys);
+ const POINTS *pts = (const POINTS *)(pPolyPoly->aPolyCounts +
pPolyPoly->nPolys);
POINT *pt = HeapAlloc( GetProcessHeap(), 0, pPolyPoly->cpts * sizeof(POINT)
);
DWORD i;
for(i = 0; i < pPolyPoly->cpts; i++)
@@ -1218,7 +1218,7 @@
HRGN hRgn = 0;
if (mr->nSize >= sizeof(*lpRgn) + sizeof(RGNDATAHEADER))
- hRgn = ExtCreateRegion( &info->init_transform, 0, (RGNDATA
*)lpRgn->RgnData );
+ hRgn = ExtCreateRegion( &info->init_transform, 0, (const RGNDATA
*)lpRgn->RgnData );
ExtSelectClipRgn(hdc, hRgn, (INT)(lpRgn->iMode));
/* ExtSelectClipRgn created a copy of the region */
@@ -1281,7 +1281,7 @@
const EMRPOLYPOLYLINE *pPolyPolyline = (const EMRPOLYPOLYLINE *)mr;
/* NB Points at pPolyPolyline->aPolyCounts + pPolyPolyline->nPolys */
- PolyPolyline(hdc, (LPPOINT)(pPolyPolyline->aPolyCounts +
+ PolyPolyline(hdc, (const POINT*)(pPolyPolyline->aPolyCounts +
pPolyPolyline->nPolys),
pPolyPolyline->aPolyCounts,
pPolyPolyline->nPolys );
@@ -1295,9 +1295,9 @@
/* NB Points at pPolyPolygon->aPolyCounts + pPolyPolygon->nPolys */
- PolyPolygon(hdc, (LPPOINT)(pPolyPolygon->aPolyCounts +
+ PolyPolygon(hdc, (const POINT*)(pPolyPolygon->aPolyCounts +
pPolyPolygon->nPolys),
- (INT*)pPolyPolygon->aPolyCounts, pPolyPolygon->nPolys );
+ (const INT*)pPolyPolygon->aPolyCounts, pPolyPolygon->nPolys );
break;
}
@@ -2113,7 +2113,7 @@
case EMR_FILLRGN:
{
const EMRFILLRGN *pFillRgn = (const EMRFILLRGN *)mr;
- HRGN hRgn = ExtCreateRegion(NULL, pFillRgn->cbRgnData, (RGNDATA
*)pFillRgn->RgnData);
+ HRGN hRgn = ExtCreateRegion(NULL, pFillRgn->cbRgnData, (const RGNDATA
*)pFillRgn->RgnData);
FillRgn(hdc,
hRgn,
(handletable->objectHandle)[pFillRgn->ihBrush]);
@@ -2124,7 +2124,7 @@
case EMR_FRAMERGN:
{
const EMRFRAMERGN *pFrameRgn = (const EMRFRAMERGN *)mr;
- HRGN hRgn = ExtCreateRegion(NULL, pFrameRgn->cbRgnData, (RGNDATA
*)pFrameRgn->RgnData);
+ HRGN hRgn = ExtCreateRegion(NULL, pFrameRgn->cbRgnData, (const RGNDATA
*)pFrameRgn->RgnData);
FrameRgn(hdc,
hRgn,
(handletable->objectHandle)[pFrameRgn->ihBrush],
@@ -2137,7 +2137,7 @@
case EMR_INVERTRGN:
{
const EMRINVERTRGN *pInvertRgn = (const EMRINVERTRGN *)mr;
- HRGN hRgn = ExtCreateRegion(NULL, pInvertRgn->cbRgnData, (RGNDATA
*)pInvertRgn->RgnData);
+ HRGN hRgn = ExtCreateRegion(NULL, pInvertRgn->cbRgnData, (const RGNDATA
*)pInvertRgn->RgnData);
InvertRgn(hdc, hRgn);
DeleteObject(hRgn);
break;
@@ -2146,7 +2146,7 @@
case EMR_PAINTRGN:
{
const EMRPAINTRGN *pPaintRgn = (const EMRPAINTRGN *)mr;
- HRGN hRgn = ExtCreateRegion(NULL, pPaintRgn->cbRgnData, (RGNDATA
*)pPaintRgn->RgnData);
+ HRGN hRgn = ExtCreateRegion(NULL, pPaintRgn->cbRgnData, (const RGNDATA
*)pPaintRgn->RgnData);
PaintRgn(hdc, hRgn);
DeleteObject(hRgn);
break;
Modified: branches/arwinss/reactos/dll/win32/gdi32/freetype.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/freetype.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/freetype.c [iso-8859-1] Sun Apr 4 15:19:10
2010
@@ -4330,7 +4330,7 @@
const GSUB_CoverageFormat2* cf2;
int i;
int count;
- cf2 = (GSUB_CoverageFormat2*)cf1;
+ cf2 = (const GSUB_CoverageFormat2*)cf1;
count = GET_BE_WORD(cf2->RangeCount);
TRACE("Coverage Format 2, %i ranges\n",count);
@@ -4358,7 +4358,7 @@
const GSUB_ScriptList *script;
const GSUB_Script *deflt = NULL;
int i;
- script = (GSUB_ScriptList*)((LPBYTE)header + GET_BE_WORD(header->ScriptList));
+ script = (const GSUB_ScriptList*)((const BYTE*)header +
GET_BE_WORD(header->ScriptList));
TRACE("%i scripts in this font\n",GET_BE_WORD(script->ScriptCount));
for (i = 0; i < GET_BE_WORD(script->ScriptCount); i++)
@@ -4367,7 +4367,7 @@
int offset;
offset = GET_BE_WORD(script->ScriptRecord[i].Script);
- scr = (GSUB_Script*)((LPBYTE)script + offset);
+ scr = (const GSUB_Script*)((const BYTE*)script + offset);
if (strncmp(script->ScriptRecord[i].ScriptTag, tag,4)==0)
return scr;
@@ -4388,7 +4388,7 @@
for (i = 0; i < GET_BE_WORD(script->LangSysCount) ; i++)
{
offset = GET_BE_WORD(script->LangSysRecord[i].LangSys);
- Lang = (GSUB_LangSys*)((LPBYTE)script + offset);
+ Lang = (const GSUB_LangSys*)((const BYTE*)script + offset);
if ( strncmp(script->LangSysRecord[i].LangSysTag,tag,4)==0)
return Lang;
@@ -4396,7 +4396,7 @@
offset = GET_BE_WORD(script->DefaultLangSys);
if (offset)
{
- Lang = (GSUB_LangSys*)((LPBYTE)script + offset);
+ Lang = (const GSUB_LangSys*)((const BYTE*)script + offset);
return Lang;
}
return NULL;
@@ -4406,7 +4406,7 @@
{
int i;
const GSUB_FeatureList *feature;
- feature = (GSUB_FeatureList*)((LPBYTE)header + GET_BE_WORD(header->FeatureList));
+ feature = (const GSUB_FeatureList*)((const BYTE*)header +
GET_BE_WORD(header->FeatureList));
TRACE("%i features\n",GET_BE_WORD(lang->FeatureCount));
for (i = 0; i < GET_BE_WORD(lang->FeatureCount); i++)
@@ -4415,7 +4415,7 @@
if (strncmp(feature->FeatureRecord[index].FeatureTag,tag,4)==0)
{
const GSUB_Feature *feat;
- feat = (GSUB_Feature*)((LPBYTE)feature +
GET_BE_WORD(feature->FeatureRecord[index].Feature));
+ feat = (const GSUB_Feature*)((const BYTE*)feature +
GET_BE_WORD(feature->FeatureRecord[index].Feature));
return feat;
}
}
@@ -4427,14 +4427,14 @@
int i;
int offset;
const GSUB_LookupList *lookup;
- lookup = (GSUB_LookupList*)((LPBYTE)header + GET_BE_WORD(header->LookupList));
+ lookup = (const GSUB_LookupList*)((const BYTE*)header +
GET_BE_WORD(header->LookupList));
TRACE("%i lookups\n", GET_BE_WORD(feature->LookupCount));
for (i = 0; i < GET_BE_WORD(feature->LookupCount); i++)
{
const GSUB_LookupTable *look;
offset =
GET_BE_WORD(lookup->Lookup[GET_BE_WORD(feature->LookupListIndex[i])]);
- look = (GSUB_LookupTable*)((LPBYTE)lookup + offset);
+ look = (const GSUB_LookupTable*)((const BYTE*)lookup + offset);
TRACE("type %i, flag %x, subtables
%i\n",GET_BE_WORD(look->LookupType),GET_BE_WORD(look->LookupFlag),GET_BE_WORD(look->SubTableCount));
if (GET_BE_WORD(look->LookupType) != 1)
FIXME("We only handle SubType 1\n");
@@ -4446,12 +4446,12 @@
{
const GSUB_SingleSubstFormat1 *ssf1;
offset = GET_BE_WORD(look->SubTable[j]);
- ssf1 = (GSUB_SingleSubstFormat1*)((LPBYTE)look+offset);
+ ssf1 = (const GSUB_SingleSubstFormat1*)((const BYTE*)look+offset);
if (GET_BE_WORD(ssf1->SubstFormat) == 1)
{
int offset = GET_BE_WORD(ssf1->Coverage);
TRACE(" subtype 1, delta %i\n",
GET_BE_WORD(ssf1->DeltaGlyphID));
- if (GSUB_is_glyph_covered((LPBYTE)ssf1+offset, glyph) != -1)
+ if (GSUB_is_glyph_covered((const BYTE*)ssf1+offset, glyph) != -1)
{
TRACE(" Glyph 0x%x ->",glyph);
glyph += GET_BE_WORD(ssf1->DeltaGlyphID);
@@ -4464,10 +4464,10 @@
INT index;
INT offset;
- ssf2 = (GSUB_SingleSubstFormat2 *)ssf1;
+ ssf2 = (const GSUB_SingleSubstFormat2 *)ssf1;
offset = GET_BE_WORD(ssf1->Coverage);
TRACE(" subtype 2, glyph count %i\n",
GET_BE_WORD(ssf2->GlyphCount));
- index = GSUB_is_glyph_covered((LPBYTE)ssf2+offset, glyph);
+ index = GSUB_is_glyph_covered((const BYTE*)ssf2+offset, glyph);
TRACE(" Coverage index %i\n",index);
if (index != -1)
{
Modified: branches/arwinss/reactos/dll/win32/gdi32/region.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32…
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/region.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/region.c [iso-8859-1] Sun Apr 4 15:19:10
2010
@@ -1031,12 +1031,12 @@
if (lpXform)
{
- RECT *pCurRect, *pEndRect;
+ const RECT *pCurRect, *pEndRect;
hrgn = CreateRectRgn( 0, 0, 0, 0 );
- pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount;
- for (pCurRect = (RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++)
+ pEndRect = (const RECT *)rgndata->Buffer + rgndata->rdh.nCount;
+ for (pCurRect = (const RECT *)rgndata->Buffer; pCurRect < pEndRect;
pCurRect++)
{
static const INT count = 4;
HRGN poly_hrgn;
@@ -1063,10 +1063,10 @@
if (init_region( &obj->rgn, rgndata->rdh.nCount ))
{
- RECT *pCurRect, *pEndRect;
-
- pEndRect = (RECT *)rgndata->Buffer + rgndata->rdh.nCount;
- for(pCurRect = (RECT *)rgndata->Buffer; pCurRect < pEndRect; pCurRect++)
+ const RECT *pCurRect, *pEndRect;
+
+ pEndRect = (const RECT *)rgndata->Buffer + rgndata->rdh.nCount;
+ for(pCurRect = (const RECT *)rgndata->Buffer; pCurRect < pEndRect;
pCurRect++)
{
if (pCurRect->left < pCurRect->right && pCurRect->top
< pCurRect->bottom)
{
Propchange: branches/arwinss/reactos/dll/win32/user32/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Apr 4 15:19:10 2010
@@ -1,3 +1,3 @@
/branches/ros-amd64-bringup/reactos/dll/win32/user32:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
/trunk/reactos/dll/win32/user32:42000-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688
-/vendor/wine/dlls/user32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314
+/vendor/wine/dlls/user32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46696
Modified: branches/arwinss/reactos/dll/win32/user32/cursoricon.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/cursoricon.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/cursoricon.c [iso-8859-1] Sun Apr 4
15:19:10 2010
@@ -54,9 +54,10 @@
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "wine/exception.h"
-#include "wine/debug.h"
#include "controls.h"
#include "user_private.h"
+#include "wine/server.h"
+#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(cursor);
WINE_DECLARE_DEBUG_CHANNEL(icon);
@@ -1037,11 +1038,11 @@
while (ptr < end)
{
- if ((!chunk_type && *(DWORD *)ptr == chunk_id )
- || (chunk_type && *(DWORD *)ptr == chunk_type && *((DWORD
*)ptr + 2) == chunk_id ))
+ if ((!chunk_type && *(const DWORD *)ptr == chunk_id )
+ || (chunk_type && *(const DWORD *)ptr == chunk_type &&
*((const DWORD *)ptr + 2) == chunk_id ))
{
ptr += sizeof(DWORD);
- chunk->data_size = (*(DWORD *)ptr + 1) & ~1;
+ chunk->data_size = (*(const DWORD *)ptr + 1) & ~1;
ptr += sizeof(DWORD);
if (chunk_type == ANI_LIST_ID || chunk_type == ANI_RIFF_ID) ptr +=
sizeof(DWORD);
chunk->data = ptr;
@@ -1050,7 +1051,7 @@
}
ptr += sizeof(DWORD);
- ptr += (*(DWORD *)ptr + 1) & ~1;
+ ptr += (*(const DWORD *)ptr + 1) & ~1;
ptr += sizeof(DWORD);
}
}
@@ -1587,7 +1588,7 @@
*/
BOOL WINAPI DestroyCursor( HCURSOR hCursor )
{
- if (get_user_thread_info()->cursor == hCursor)
+ if (GetCursor() == hCursor)
{
WARN_(cursor)("Destroying active cursor!\n" );
return FALSE;
@@ -1762,15 +1763,28 @@
*/
HCURSOR WINAPI DECLSPEC_HOTPATCH SetCursor( HCURSOR hCursor /* [in] Handle of cursor to
show */ )
{
- struct user_thread_info *thread_info = get_user_thread_info();
HCURSOR hOldCursor;
-
- if (hCursor == thread_info->cursor) return hCursor; /* No change */
+ int show_count;
+ BOOL ret;
+
TRACE("%p\n", hCursor);
- hOldCursor = thread_info->cursor;
- thread_info->cursor = hCursor;
+
+ SERVER_START_REQ( set_cursor )
+ {
+ req->flags = SET_CURSOR_HANDLE;
+ req->handle = wine_server_user_handle( hCursor );
+ if ((ret = !wine_server_call_err( req )))
+ {
+ hOldCursor = wine_server_ptr_handle( reply->prev_handle );
+ show_count = reply->prev_count;
+ }
+ }
+ SERVER_END_REQ;
+
+ if (!ret) return 0;
+
/* Change the cursor shape only if it is visible */
- if (thread_info->cursor_count >= 0)
+ if (show_count >= 0)
{
CURSORICONINFO *info = get_icon_ptr( hCursor );
/* release before calling driver (FIXME) */
@@ -1785,26 +1799,34 @@
*/
INT WINAPI DECLSPEC_HOTPATCH ShowCursor( BOOL bShow )
{
- struct user_thread_info *thread_info = get_user_thread_info();
-
- TRACE("%d, count=%d\n", bShow, thread_info->cursor_count );
-
- if (bShow)
- {
- if (++thread_info->cursor_count == 0) /* Show it */
- {
- CURSORICONINFO *info = get_icon_ptr( thread_info->cursor );
+ HCURSOR cursor;
+ int increment = bShow ? 1 : -1;
+ int prev_count;
+
+ SERVER_START_REQ( set_cursor )
+ {
+ req->flags = SET_CURSOR_COUNT;
+ req->show_count = increment;
+ wine_server_call( req );
+ cursor = wine_server_ptr_handle( reply->prev_handle );
+ prev_count = reply->prev_count;
+ }
+ SERVER_END_REQ;
+
+ TRACE("%d, count=%d\n", bShow, prev_count + increment );
+
+ if (!prev_count)
+ {
+ if (bShow)
+ {
+ CURSORICONINFO *info = get_icon_ptr( cursor );
/* release before calling driver (FIXME) */
- if (info) release_icon_ptr( thread_info->cursor, info );
+ if (info) release_icon_ptr( cursor, info );
USER_Driver->pSetCursor( info );
}
- }
- else
- {
- if (--thread_info->cursor_count == -1) /* Hide it */
- USER_Driver->pSetCursor( NULL );
- }
- return thread_info->cursor_count;
+ else USER_Driver->pSetCursor( NULL );
+ }
+ return prev_count + increment;
}
/***********************************************************************
@@ -1812,7 +1834,16 @@
*/
HCURSOR WINAPI GetCursor(void)
{
- return get_user_thread_info()->cursor;
+ HCURSOR ret;
+
+ SERVER_START_REQ( set_cursor )
+ {
+ req->flags = 0;
+ wine_server_call( req );
+ ret = wine_server_ptr_handle( reply->prev_handle );
+ }
+ SERVER_END_REQ;
+ return ret;
}
Modified: branches/arwinss/reactos/dll/win32/user32/menu.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/menu.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/menu.c [iso-8859-1] Sun Apr 4 15:19:10
2010
@@ -4729,7 +4729,7 @@
TRACE("hmenu %p, item %u, by pos %d, info %p\n", hmenu, item, bypos,
lpmii);
- if (!MENU_NormalizeMenuItemInfoStruct( (MENUITEMINFOW *)lpmii, &mii )) return
FALSE;
+ if (!MENU_NormalizeMenuItemInfoStruct( (const MENUITEMINFOW *)lpmii, &mii ))
return FALSE;
return SetMenuItemInfo_common(MENU_FindItem(&hmenu, &item, bypos?
MF_BYPOSITION : 0),
&mii, FALSE);
@@ -4852,7 +4852,7 @@
TRACE("hmenu %p, item %04x, by pos %d, info %p\n", hMenu, uItem, bypos,
lpmii);
- if (!MENU_NormalizeMenuItemInfoStruct( (MENUITEMINFOW *)lpmii, &mii )) return
FALSE;
+ if (!MENU_NormalizeMenuItemInfoStruct( (const MENUITEMINFOW *)lpmii, &mii ))
return FALSE;
item = MENU_InsertItem(hMenu, uItem, bypos ? MF_BYPOSITION : 0 );
return SetMenuItemInfo_common(item, &mii, FALSE);
Modified: branches/arwinss/reactos/dll/win32/user32/message.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/message.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/message.c [iso-8859-1] Sun Apr 4 15:19:10
2010
@@ -57,12 +57,204 @@
#define SYS_TIMER_RATE 55 /* min. timer rate in ms (actually 54.925)*/
+/* the various structures that can be sent in messages, in platform-independent layout
*/
+struct packed_CREATESTRUCTW
+{
+ ULONGLONG lpCreateParams;
+ ULONGLONG hInstance;
+ user_handle_t hMenu;
+ DWORD __pad1;
+ user_handle_t hwndParent;
+ DWORD __pad2;
+ INT cy;
+ INT cx;
+ INT y;
+ INT x;
+ LONG style;
+ ULONGLONG lpszName;
+ ULONGLONG lpszClass;
+ DWORD dwExStyle;
+ DWORD __pad3;
+};
+
+struct packed_DRAWITEMSTRUCT
+{
+ UINT CtlType;
+ UINT CtlID;
+ UINT itemID;
+ UINT itemAction;
+ UINT itemState;
+ user_handle_t hwndItem;
+ DWORD __pad1;
+ user_handle_t hDC;
+ DWORD __pad2;
+ RECT rcItem;
+ ULONGLONG itemData;
+};
+
+struct packed_MEASUREITEMSTRUCT
+{
+ UINT CtlType;
+ UINT CtlID;
+ UINT itemID;
+ UINT itemWidth;
+ UINT itemHeight;
+ ULONGLONG itemData;
+};
+
+struct packed_DELETEITEMSTRUCT
+{
+ UINT CtlType;
+ UINT CtlID;
+ UINT itemID;
+ user_handle_t hwndItem;
+ DWORD __pad;
+ ULONGLONG itemData;
+};
+
+struct packed_COMPAREITEMSTRUCT
+{
+ UINT CtlType;
+ UINT CtlID;
+ user_handle_t hwndItem;
+ DWORD __pad1;
+ UINT itemID1;
+ ULONGLONG itemData1;
+ UINT itemID2;
+ ULONGLONG itemData2;
+ DWORD dwLocaleId;
+ DWORD __pad2;
+};
+
+struct packed_WINDOWPOS
+{
+ user_handle_t hwnd;
+ DWORD __pad1;
+ user_handle_t hwndInsertAfter;
+ DWORD __pad2;
+ INT x;
+ INT y;
+ INT cx;
+ INT cy;
+ UINT flags;
+ DWORD __pad3;
+};
+
+struct packed_COPYDATASTRUCT
+{
+ ULONGLONG dwData;
+ DWORD cbData;
+ ULONGLONG lpData;
+};
+
+struct packed_HELPINFO
+{
+ UINT cbSize;
+ INT iContextType;
+ INT iCtrlId;
+ user_handle_t hItemHandle;
+ DWORD __pad;
+ ULONGLONG dwContextId;
+ POINT MousePos;
+};
+
+struct packed_NCCALCSIZE_PARAMS
+{
+ RECT rgrc[3];
+ ULONGLONG __pad1;
+ user_handle_t hwnd;
+ DWORD __pad2;
+ user_handle_t hwndInsertAfter;
+ DWORD __pad3;
+ INT x;
+ INT y;
+ INT cx;
+ INT cy;
+ UINT flags;
+ DWORD __pad4;
+};
+
+struct packed_MSG
+{
+ user_handle_t hwnd;
+ DWORD __pad1;
+ UINT message;
+ ULONGLONG wParam;
+ ULONGLONG lParam;
+ DWORD time;
+ POINT pt;
+ DWORD __pad2;
+};
+
+struct packed_MDINEXTMENU
+{
+ user_handle_t hmenuIn;
+ DWORD __pad1;
+ user_handle_t hmenuNext;
+ DWORD __pad2;
+ user_handle_t hwndNext;
+ DWORD __pad3;
+};
+
+struct packed_MDICREATESTRUCTW
+{
+ ULONGLONG szClass;
+ ULONGLONG szTitle;
+ ULONGLONG hOwner;
+ INT x;
+ INT y;
+ INT cx;
+ INT cy;
+ DWORD style;
+ ULONGLONG lParam;
+};
+
+struct packed_hook_extra_info
+{
+ user_handle_t handle;
+ DWORD __pad;
+ ULONGLONG lparam;
+};
+
+/* the structures are unpacked on top of the packed ones, so make sure they fit */
+C_ASSERT( sizeof(struct packed_CREATESTRUCTW) >= sizeof(CREATESTRUCTW) );
+C_ASSERT( sizeof(struct packed_DRAWITEMSTRUCT) >= sizeof(DRAWITEMSTRUCT) );
+C_ASSERT( sizeof(struct packed_MEASUREITEMSTRUCT) >= sizeof(MEASUREITEMSTRUCT) );
+C_ASSERT( sizeof(struct packed_DELETEITEMSTRUCT) >= sizeof(DELETEITEMSTRUCT) );
+C_ASSERT( sizeof(struct packed_COMPAREITEMSTRUCT) >= sizeof(COMPAREITEMSTRUCT) );
+C_ASSERT( sizeof(struct packed_WINDOWPOS) >= sizeof(WINDOWPOS) );
+C_ASSERT( sizeof(struct packed_COPYDATASTRUCT) >= sizeof(COPYDATASTRUCT) );
+C_ASSERT( sizeof(struct packed_HELPINFO) >= sizeof(HELPINFO) );
+C_ASSERT( sizeof(struct packed_NCCALCSIZE_PARAMS) >= sizeof(NCCALCSIZE_PARAMS) +
sizeof(WINDOWPOS) );
+C_ASSERT( sizeof(struct packed_MSG) >= sizeof(MSG) );
+C_ASSERT( sizeof(struct packed_MDINEXTMENU) >= sizeof(MDINEXTMENU) );
+C_ASSERT( sizeof(struct packed_MDICREATESTRUCTW) >= sizeof(MDICREATESTRUCTW) );
+C_ASSERT( sizeof(struct packed_hook_extra_info) >= sizeof(struct hook_extra_info) );
+
+union packed_structs
+{
+ struct packed_CREATESTRUCTW cs;
+ struct packed_DRAWITEMSTRUCT dis;
+ struct packed_MEASUREITEMSTRUCT mis;
+ struct packed_DELETEITEMSTRUCT dls;
+ struct packed_COMPAREITEMSTRUCT cis;
+ struct packed_WINDOWPOS wp;
+ struct packed_COPYDATASTRUCT cds;
+ struct packed_HELPINFO hi;
+ struct packed_NCCALCSIZE_PARAMS ncp;
+ struct packed_MSG msg;
+ struct packed_MDINEXTMENU mnm;
+ struct packed_MDICREATESTRUCTW mcs;
+ struct packed_hook_extra_info hook;
+};
+
/* description of the data fields that need to be packed along with a sent message */
struct packed_message
{
- int count;
- const void *data[MAX_PACK_COUNT];
- size_t size[MAX_PACK_COUNT];
+ union packed_structs ps;
+ int count;
+ const void *data[MAX_PACK_COUNT];
+ size_t size[MAX_PACK_COUNT];
};
/* info about the message currently being received by the current thread */
@@ -268,6 +460,19 @@
return FALSE;
}
+/* pack a pointer into a 32/64 portable format */
+static inline ULONGLONG pack_ptr( const void *ptr )
+{
+ return (ULONG_PTR)ptr;
+}
+
+/* unpack a potentially 64-bit pointer, returning 0 when truncated */
+static inline void *unpack_ptr( ULONGLONG ptr64 )
+{
+ if ((ULONG_PTR)ptr64 != ptr64) return 0;
+ return (void *)(ULONG_PTR)ptr64;
+}
+
/* make sure that there is space for 'size' bytes in buffer, growing it if needed
*/
static inline void *get_buffer_space( void **buffer, size_t size )
{
@@ -545,10 +750,22 @@
case WM_CREATE:
{
CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam;
- push_data( data, cs, sizeof(*cs) );
+ data->ps.cs.lpCreateParams = pack_ptr( cs->lpCreateParams );
+ data->ps.cs.hInstance = pack_ptr( cs->hInstance );
+ data->ps.cs.hMenu = wine_server_user_handle( cs->hMenu );
+ data->ps.cs.hwndParent = wine_server_user_handle( cs->hwndParent );
+ data->ps.cs.cy = cs->cy;
+ data->ps.cs.cx = cs->cx;
+ data->ps.cs.y = cs->y;
+ data->ps.cs.x = cs->x;
+ data->ps.cs.style = cs->style;
+ data->ps.cs.dwExStyle = cs->dwExStyle;
+ data->ps.cs.lpszName = pack_ptr( cs->lpszName );
+ data->ps.cs.lpszClass = pack_ptr( cs->lpszClass );
+ push_data( data, &data->ps.cs, sizeof(data->ps.cs) );
if (!IS_INTRESOURCE(cs->lpszName)) push_string( data, cs->lpszName );
if (!IS_INTRESOURCE(cs->lpszClass)) push_string( data, cs->lpszClass );
- return sizeof(*cs);
+ return sizeof(data->ps.cs);
}
case WM_GETTEXT:
case WM_ASKCBFORMATNAME:
@@ -568,26 +785,79 @@
push_data( data, (MINMAXINFO *)lparam, sizeof(MINMAXINFO) );
return sizeof(MINMAXINFO);
case WM_DRAWITEM:
- push_data( data, (DRAWITEMSTRUCT *)lparam, sizeof(DRAWITEMSTRUCT) );
+ {
+ DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lparam;
+ data->ps.dis.CtlType = dis->CtlType;
+ data->ps.dis.CtlID = dis->CtlID;
+ data->ps.dis.itemID = dis->itemID;
+ data->ps.dis.itemAction = dis->itemAction;
+ data->ps.dis.itemState = dis->itemState;
+ data->ps.dis.hwndItem = wine_server_user_handle( dis->hwndItem );
+ data->ps.dis.hDC = wine_server_user_handle( dis->hDC ); /* FIXME
*/
+ data->ps.dis.rcItem = dis->rcItem;
+ data->ps.dis.itemData = dis->itemData;
+ push_data( data, &data->ps.dis, sizeof(data->ps.dis) );
return 0;
+ }
case WM_MEASUREITEM:
- push_data( data, (MEASUREITEMSTRUCT *)lparam, sizeof(MEASUREITEMSTRUCT) );
- return sizeof(MEASUREITEMSTRUCT);
+ {
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lparam;
+ data->ps.mis.CtlType = mis->CtlType;
+ data->ps.mis.CtlID = mis->CtlID;
+ data->ps.mis.itemID = mis->itemID;
+ data->ps.mis.itemWidth = mis->itemWidth;
+ data->ps.mis.itemHeight = mis->itemHeight;
+ data->ps.mis.itemData = mis->itemData;
+ push_data( data, &data->ps.mis, sizeof(data->ps.mis) );
+ return sizeof(data->ps.mis);
+ }
case WM_DELETEITEM:
- push_data( data, (DELETEITEMSTRUCT *)lparam, sizeof(DELETEITEMSTRUCT) );
+ {
+ DELETEITEMSTRUCT *dls = (DELETEITEMSTRUCT *)lparam;
+ data->ps.dls.CtlType = dls->CtlType;
+ data->ps.dls.CtlID = dls->CtlID;
+ data->ps.dls.itemID = dls->itemID;
+ data->ps.dls.hwndItem = wine_server_user_handle( dls->hwndItem );
+ data->ps.dls.itemData = dls->itemData;
+ push_data( data, &data->ps.dls, sizeof(data->ps.dls) );
return 0;
+ }
case WM_COMPAREITEM:
- push_data( data, (COMPAREITEMSTRUCT *)lparam, sizeof(COMPAREITEMSTRUCT) );
+ {
+ COMPAREITEMSTRUCT *cis = (COMPAREITEMSTRUCT *)lparam;
+ data->ps.cis.CtlType = cis->CtlType;
+ data->ps.cis.CtlID = cis->CtlID;
+ data->ps.cis.hwndItem = wine_server_user_handle( cis->hwndItem );
+ data->ps.cis.itemID1 = cis->itemID1;
+ data->ps.cis.itemData1 = cis->itemData1;
+ data->ps.cis.itemID2 = cis->itemID2;
+ data->ps.cis.itemData2 = cis->itemData2;
+ data->ps.cis.dwLocaleId = cis->dwLocaleId;
+ push_data( data, &data->ps.cis, sizeof(data->ps.cis) );
return 0;
+ }
case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED:
- push_data( data, (WINDOWPOS *)lparam, sizeof(WINDOWPOS) );
- return sizeof(WINDOWPOS);
+ {
+ WINDOWPOS *wp = (WINDOWPOS *)lparam;
+ data->ps.wp.hwnd = wine_server_user_handle( wp->hwnd );
+ data->ps.wp.hwndInsertAfter = wine_server_user_handle( wp->hwndInsertAfter
);
+ data->ps.wp.x = wp->x;
+ data->ps.wp.y = wp->y;
+ data->ps.wp.cx = wp->cx;
+ data->ps.wp.cy = wp->cy;
+ data->ps.wp.flags = wp->flags;
+ push_data( data, &data->ps.wp, sizeof(data->ps.wp) );
+ return sizeof(data->ps.wp);
+ }
case WM_COPYDATA:
{
- COPYDATASTRUCT *cp = (COPYDATASTRUCT *)lparam;
- push_data( data, cp, sizeof(*cp) );
- if (cp->lpData) push_data( data, cp->lpData, cp->cbData );
+ COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lparam;
+ data->ps.cds.cbData = cds->cbData;
+ data->ps.cds.dwData = cds->dwData;
+ data->ps.cds.lpData = pack_ptr( cds->lpData );
+ push_data( data, &data->ps.cds, sizeof(data->ps.cds) );
+ if (cds->lpData) push_data( data, cds->lpData, cds->cbData );
return 0;
}
case WM_NOTIFY:
@@ -595,8 +865,16 @@
data->count = -1;
return 0;
case WM_HELP:
- push_data( data, (HELPINFO *)lparam, sizeof(HELPINFO) );
+ {
+ HELPINFO *hi = (HELPINFO *)lparam;
+ data->ps.hi.iContextType = hi->iContextType;
+ data->ps.hi.iCtrlId = hi->iCtrlId;
+ data->ps.hi.hItemHandle = wine_server_user_handle( hi->hItemHandle );
+ data->ps.hi.dwContextId = hi->dwContextId;
+ data->ps.hi.MousePos = hi->MousePos;
+ push_data( data, &data->ps.hi, sizeof(data->ps.hi) );
return 0;
+ }
case WM_STYLECHANGING:
case WM_STYLECHANGED:
push_data( data, (STYLESTRUCT *)lparam, sizeof(STYLESTRUCT) );
@@ -609,14 +887,34 @@
}
else
{
- NCCALCSIZE_PARAMS *nc = (NCCALCSIZE_PARAMS *)lparam;
- push_data( data, nc, sizeof(*nc) );
- push_data( data, nc->lppos, sizeof(*nc->lppos) );
- return sizeof(*nc) + sizeof(*nc->lppos);
+ NCCALCSIZE_PARAMS *ncp = (NCCALCSIZE_PARAMS *)lparam;
+ data->ps.ncp.rgrc[0] = ncp->rgrc[0];
+ data->ps.ncp.rgrc[1] = ncp->rgrc[1];
+ data->ps.ncp.rgrc[2] = ncp->rgrc[2];
+ data->ps.ncp.hwnd = wine_server_user_handle(
ncp->lppos->hwnd );
+ data->ps.ncp.hwndInsertAfter = wine_server_user_handle(
ncp->lppos->hwndInsertAfter );
+ data->ps.ncp.x = ncp->lppos->x;
+ data->ps.ncp.y = ncp->lppos->y;
+ data->ps.ncp.cx = ncp->lppos->cx;
+ data->ps.ncp.cy = ncp->lppos->cy;
+ data->ps.ncp.flags = ncp->lppos->flags;
+ push_data( data, &data->ps.ncp, sizeof(data->ps.ncp) );
+ return sizeof(data->ps.ncp);
}
case WM_GETDLGCODE:
- if (lparam) push_data( data, (MSG *)lparam, sizeof(MSG) );
- return sizeof(MSG);
+ if (lparam)
+ {
+ MSG *msg = (MSG *)lparam;
+ data->ps.msg.hwnd = wine_server_user_handle( msg->hwnd );
+ data->ps.msg.message = msg->message;
+ data->ps.msg.wParam = msg->wParam;
+ data->ps.msg.lParam = msg->lParam;
+ data->ps.msg.time = msg->time;
+ data->ps.msg.pt = msg->pt;
+ push_data( data, &data->ps.msg, sizeof(data->ps.msg) );
+ return sizeof(data->ps.msg);
+ }
+ return 0;
case SBM_SETSCROLLINFO:
push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) );
return 0;
@@ -680,19 +978,34 @@
case LB_GETSELITEMS:
return wparam * sizeof(UINT);
case WM_NEXTMENU:
- push_data( data, (MDINEXTMENU *)lparam, sizeof(MDINEXTMENU) );
- return sizeof(MDINEXTMENU);
+ {
+ MDINEXTMENU *mnm = (MDINEXTMENU *)lparam;
+ data->ps.mnm.hmenuIn = wine_server_user_handle( mnm->hmenuIn );
+ data->ps.mnm.hmenuNext = wine_server_user_handle( mnm->hmenuNext );
+ data->ps.mnm.hwndNext = wine_server_user_handle( mnm->hwndNext );
+ push_data( data, &data->ps.mnm, sizeof(data->ps.mnm) );
+ return sizeof(data->ps.mnm);
+ }
case WM_SIZING:
case WM_MOVING:
push_data( data, (RECT *)lparam, sizeof(RECT) );
return sizeof(RECT);
case WM_MDICREATE:
{
- MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)lparam;
- push_data( data, cs, sizeof(*cs) );
- if (!IS_INTRESOURCE(cs->szTitle)) push_string( data, cs->szTitle );
- if (!IS_INTRESOURCE(cs->szClass)) push_string( data, cs->szClass );
- return sizeof(*cs);
+ MDICREATESTRUCTW *mcs = (MDICREATESTRUCTW *)lparam;
+ data->ps.mcs.szClass = pack_ptr( mcs->szClass );
+ data->ps.mcs.szTitle = pack_ptr( mcs->szTitle );
+ data->ps.mcs.hOwner = pack_ptr( mcs->hOwner );
+ data->ps.mcs.x = mcs->x;
+ data->ps.mcs.y = mcs->y;
+ data->ps.mcs.cx = mcs->cx;
+ data->ps.mcs.cy = mcs->cy;
+ data->ps.mcs.style = mcs->style;
+ data->ps.mcs.lParam = mcs->lParam;
+ push_data( data, &data->ps.mcs, sizeof(data->ps.mcs) );
+ if (!IS_INTRESOURCE(mcs->szClass)) push_string( data, mcs->szClass );
+ if (!IS_INTRESOURCE(mcs->szTitle)) push_string( data, mcs->szTitle );
+ return sizeof(data->ps.mcs);
}
case WM_MDIGETACTIVE:
if (lparam) return sizeof(BOOL);
@@ -709,14 +1022,16 @@
case WM_WINE_KEYBOARD_LL_HOOK:
{
struct hook_extra_info *h_extra = (struct hook_extra_info *)lparam;
- push_data( data, h_extra, sizeof(*h_extra) );
+ data->ps.hook.handle = wine_server_user_handle( h_extra->handle );
+ push_data( data, &data->ps.hook, sizeof(data->ps.hook) );
push_data( data, (LPVOID)h_extra->lparam, sizeof(KBDLLHOOKSTRUCT) );
return 0;
}
case WM_WINE_MOUSE_LL_HOOK:
{
struct hook_extra_info *h_extra = (struct hook_extra_info *)lparam;
- push_data( data, h_extra, sizeof(*h_extra) );
+ data->ps.hook.handle = wine_server_user_handle( h_extra->handle );
+ push_data( data, &data->ps.hook, sizeof(data->ps.hook) );
push_data( data, (LPVOID)h_extra->lparam, sizeof(MSLLHOOKSTRUCT) );
return 0;
}
@@ -775,28 +1090,42 @@
void **buffer, size_t size )
{
size_t minsize = 0;
+ union packed_structs *ps = *buffer;
switch(message)
{
case WM_NCCREATE:
case WM_CREATE:
{
- CREATESTRUCTW *cs = *buffer;
- WCHAR *str = (WCHAR *)(cs + 1);
- if (size < sizeof(*cs)) return FALSE;
- size -= sizeof(*cs);
- if (!IS_INTRESOURCE(cs->lpszName))
+ CREATESTRUCTW cs;
+ WCHAR *str = (WCHAR *)(&ps->cs + 1);
+ if (size < sizeof(ps->cs)) return FALSE;
+ size -= sizeof(ps->cs);
+ cs.lpCreateParams = unpack_ptr( ps->cs.lpCreateParams );
+ cs.hInstance = unpack_ptr( ps->cs.hInstance );
+ cs.hMenu = wine_server_ptr_handle( ps->cs.hMenu );
+ cs.hwndParent = wine_server_ptr_handle( ps->cs.hwndParent );
+ cs.cy = ps->cs.cy;
+ cs.cx = ps->cs.cx;
+ cs.y = ps->cs.y;
+ cs.x = ps->cs.x;
+ cs.style = ps->cs.style;
+ cs.dwExStyle = ps->cs.dwExStyle;
+ cs.lpszName = unpack_ptr( ps->cs.lpszName );
+ cs.lpszClass = unpack_ptr( ps->cs.lpszClass );
+ if (ps->cs.lpszName >> 16)
{
if (!check_string( str, size )) return FALSE;
- cs->lpszName = str;
+ cs.lpszName = str;
size -= (strlenW(str) + 1) * sizeof(WCHAR);
str += strlenW(str) + 1;
}
- if (!IS_INTRESOURCE(cs->lpszClass))
+ if (ps->cs.lpszClass >> 16)
{
if (!check_string( str, size )) return FALSE;
- cs->lpszClass = str;
- }
+ cs.lpszClass = str;
+ }
+ memcpy( &ps->cs, &cs, sizeof(cs) );
break;
}
case WM_GETTEXT:
@@ -818,39 +1147,112 @@
minsize = sizeof(MINMAXINFO);
break;
case WM_DRAWITEM:
- minsize = sizeof(DRAWITEMSTRUCT);
- break;
+ {
+ DRAWITEMSTRUCT dis;
+ if (size < sizeof(ps->dis)) return FALSE;
+ dis.CtlType = ps->dis.CtlType;
+ dis.CtlID = ps->dis.CtlID;
+ dis.itemID = ps->dis.itemID;
+ dis.itemAction = ps->dis.itemAction;
+ dis.itemState = ps->dis.itemState;
+ dis.hwndItem = wine_server_ptr_handle( ps->dis.hwndItem );
+ dis.hDC = wine_server_ptr_handle( ps->dis.hDC );
+ dis.rcItem = ps->dis.rcItem;
+ dis.itemData = (ULONG_PTR)unpack_ptr( ps->dis.itemData );
+ memcpy( &ps->dis, &dis, sizeof(dis) );
+ break;
+ }
case WM_MEASUREITEM:
- minsize = sizeof(MEASUREITEMSTRUCT);
- break;
+ {
+ MEASUREITEMSTRUCT mis;
+ if (size < sizeof(ps->mis)) return FALSE;
+ mis.CtlType = ps->mis.CtlType;
+ mis.CtlID = ps->mis.CtlID;
+ mis.itemID = ps->mis.itemID;
+ mis.itemWidth = ps->mis.itemWidth;
+ mis.itemHeight = ps->mis.itemHeight;
+ mis.itemData = (ULONG_PTR)unpack_ptr( ps->mis.itemData );
+ memcpy( &ps->mis, &mis, sizeof(mis) );
+ break;
+ }
case WM_DELETEITEM:
- minsize = sizeof(DELETEITEMSTRUCT);
- break;
+ {
+ DELETEITEMSTRUCT dls;
+ if (size < sizeof(ps->dls)) return FALSE;
+ dls.CtlType = ps->dls.CtlType;
+ dls.CtlID = ps->dls.CtlID;
+ dls.itemID = ps->dls.itemID;
+ dls.hwndItem = wine_server_ptr_handle( ps->dls.hwndItem );
+ dls.itemData = (ULONG_PTR)unpack_ptr( ps->dls.itemData );
+ memcpy( &ps->dls, &dls, sizeof(dls) );
+ break;
+ }
case WM_COMPAREITEM:
- minsize = sizeof(COMPAREITEMSTRUCT);
- break;
+ {
+ COMPAREITEMSTRUCT cis;
+ if (size < sizeof(ps->cis)) return FALSE;
+ cis.CtlType = ps->cis.CtlType;
+ cis.CtlID = ps->cis.CtlID;
+ cis.hwndItem = wine_server_ptr_handle( ps->cis.hwndItem );
+ cis.itemID1 = ps->cis.itemID1;
+ cis.itemData1 = (ULONG_PTR)unpack_ptr( ps->cis.itemData1 );
+ cis.itemID2 = ps->cis.itemID2;
+ cis.itemData2 = (ULONG_PTR)unpack_ptr( ps->cis.itemData2 );
+ cis.dwLocaleId = ps->cis.dwLocaleId;
+ memcpy( &ps->cis, &cis, sizeof(cis) );
+ break;
+ }
case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED:
case WM_WINE_SETWINDOWPOS:
- minsize = sizeof(WINDOWPOS);
- break;
+ {
+ WINDOWPOS wp;
+ if (size < sizeof(ps->wp)) return FALSE;
+ wp.hwnd = wine_server_ptr_handle( ps->wp.hwnd );
+ wp.hwndInsertAfter = wine_server_ptr_handle( ps->wp.hwndInsertAfter );
+ wp.x = ps->wp.x;
+ wp.y = ps->wp.y;
+ wp.cx = ps->wp.cx;
+ wp.cy = ps->wp.cy;
+ wp.flags = ps->wp.flags;
+ memcpy( &ps->wp, &wp, sizeof(wp) );
+ break;
+ }
case WM_COPYDATA:
{
- COPYDATASTRUCT *cp = *buffer;
- if (size < sizeof(*cp)) return FALSE;
- if (cp->lpData)
- {
- minsize = sizeof(*cp) + cp->cbData;
- cp->lpData = cp + 1;
- }
+ COPYDATASTRUCT cds;
+ if (size < sizeof(ps->cds)) return FALSE;
+ cds.dwData = (ULONG_PTR)unpack_ptr( ps->cds.dwData );
+ if (ps->cds.lpData)
+ {
+ cds.cbData = ps->cds.cbData;
+ cds.lpData = &ps->cds + 1;
+ minsize = sizeof(ps->cds) + cds.cbData;
+ }
+ else
+ {
+ cds.cbData = 0;
+ cds.lpData = 0;
+ }
+ memcpy( &ps->cds, &cds, sizeof(cds) );
break;
}
case WM_NOTIFY:
/* WM_NOTIFY cannot be sent across processes (MSDN) */
return FALSE;
case WM_HELP:
- minsize = sizeof(HELPINFO);
- break;
+ {
+ HELPINFO hi;
+ if (size < sizeof(ps->hi)) return FALSE;
+ hi.cbSize = sizeof(hi);
+ hi.iContextType = ps->hi.iContextType;
+ hi.iCtrlId = ps->hi.iCtrlId;
+ hi.hItemHandle = wine_server_ptr_handle( ps->hi.hItemHandle );
+ hi.dwContextId = (ULONG_PTR)unpack_ptr( ps->hi.dwContextId );
+ hi.MousePos = ps->hi.MousePos;
+ memcpy( &ps->hi, &hi, sizeof(hi) );
+ break;
+ }
case WM_STYLECHANGING:
case WM_STYLECHANGED:
minsize = sizeof(STYLESTRUCT);
@@ -859,15 +1261,39 @@
if (!*wparam) minsize = sizeof(RECT);
else
{
- NCCALCSIZE_PARAMS *nc = *buffer;
- if (size < sizeof(*nc) + sizeof(*nc->lppos)) return FALSE;
- nc->lppos = (WINDOWPOS *)(nc + 1);
+ NCCALCSIZE_PARAMS ncp;
+ WINDOWPOS wp;
+ if (size < sizeof(ps->ncp)) return FALSE;
+ ncp.rgrc[0] = ps->ncp.rgrc[0];
+ ncp.rgrc[1] = ps->ncp.rgrc[1];
+ ncp.rgrc[2] = ps->ncp.rgrc[2];
+ wp.hwnd = wine_server_ptr_handle( ps->ncp.hwnd );
+ wp.hwndInsertAfter = wine_server_ptr_handle( ps->ncp.hwndInsertAfter );
+ wp.x = ps->ncp.x;
+ wp.y = ps->ncp.y;
+ wp.cx = ps->ncp.cx;
+ wp.cy = ps->ncp.cy;
+ wp.flags = ps->ncp.flags;
+ ncp.lppos = (WINDOWPOS *)((NCCALCSIZE_PARAMS *)&ps->ncp + 1);
+ memcpy( &ps->ncp, &ncp, sizeof(ncp) );
+ *ncp.lppos = wp;
}
break;
case WM_GETDLGCODE:
- if (!*lparam) return TRUE;
- minsize = sizeof(MSG);
- break;
+ if (*lparam)
+ {
+ MSG msg;
+ if (size < sizeof(ps->msg)) return FALSE;
+ msg.hwnd = wine_server_ptr_handle( ps->msg.hwnd );
+ msg.message = ps->msg.message;
+ msg.wParam = (ULONG_PTR)unpack_ptr( ps->msg.wParam );
+ msg.lParam = (ULONG_PTR)unpack_ptr( ps->msg.lParam );
+ msg.time = ps->msg.time;
+ msg.pt = ps->msg.pt;
+ memcpy( &ps->msg, &msg, sizeof(msg) );
+ break;
+ }
+ return TRUE;
case SBM_SETSCROLLINFO:
minsize = sizeof(SCROLLINFO);
break;
@@ -943,9 +1369,15 @@
if (!get_buffer_space( buffer, *wparam * sizeof(UINT) )) return FALSE;
break;
case WM_NEXTMENU:
- minsize = sizeof(MDINEXTMENU);
- if (!get_buffer_space( buffer, sizeof(MDINEXTMENU) )) return FALSE;
- break;
+ {
+ MDINEXTMENU mnm;
+ if (size < sizeof(ps->mnm)) return FALSE;
+ mnm.hmenuIn = wine_server_ptr_handle( ps->mnm.hmenuIn );
+ mnm.hmenuNext = wine_server_ptr_handle( ps->mnm.hmenuNext );
+ mnm.hwndNext = wine_server_ptr_handle( ps->mnm.hwndNext );
+ memcpy( &ps->mnm, &mnm, sizeof(mnm) );
+ break;
+ }
case WM_SIZING:
case WM_MOVING:
minsize = sizeof(RECT);
@@ -953,22 +1385,33 @@
break;
case WM_MDICREATE:
{
- MDICREATESTRUCTW *cs = *buffer;
- WCHAR *str = (WCHAR *)(cs + 1);
- if (size < sizeof(*cs)) return FALSE;
- size -= sizeof(*cs);
- if (!IS_INTRESOURCE(cs->szTitle))
+ MDICREATESTRUCTW mcs;
+ WCHAR *str = (WCHAR *)(&ps->mcs + 1);
+ if (size < sizeof(ps->mcs)) return FALSE;
+ size -= sizeof(ps->mcs);
+
+ mcs.szClass = unpack_ptr( ps->mcs.szClass );
+ mcs.szTitle = unpack_ptr( ps->mcs.szTitle );
+ mcs.hOwner = unpack_ptr( ps->mcs.hOwner );
+ mcs.x = ps->mcs.x;
+ mcs.y = ps->mcs.y;
+ mcs.cx = ps->mcs.cx;
+ mcs.cy = ps->mcs.cy;
+ mcs.style = ps->mcs.style;
+ mcs.lParam = (LPARAM)unpack_ptr( ps->mcs.lParam );
+ if (ps->mcs.szClass >> 16)
{
if (!check_string( str, size )) return FALSE;
- cs->szTitle = str;
+ mcs.szClass = str;
size -= (strlenW(str) + 1) * sizeof(WCHAR);
str += strlenW(str) + 1;
}
- if (!IS_INTRESOURCE(cs->szClass))
+ if (ps->mcs.szTitle >> 16)
{
if (!check_string( str, size )) return FALSE;
- cs->szClass = str;
- }
+ mcs.szTitle = str;
+ }
+ memcpy( &ps->mcs, &mcs, sizeof(mcs) );
break;
}
case WM_MDIGETACTIVE:
@@ -981,13 +1424,14 @@
case WM_WINE_KEYBOARD_LL_HOOK:
case WM_WINE_MOUSE_LL_HOOK:
{
- struct hook_extra_info *h_extra = *buffer;
-
- minsize = sizeof(struct hook_extra_info) +
+ struct hook_extra_info h_extra;
+ minsize = sizeof(ps->hook) +
(message == WM_WINE_KEYBOARD_LL_HOOK ? sizeof(KBDLLHOOKSTRUCT)
: sizeof(MSLLHOOKSTRUCT));
if (size < minsize) return FALSE;
- h_extra->lparam = (LPARAM)(h_extra + 1);
+ h_extra.handle = wine_server_ptr_handle( ps->hook.handle );
+ h_extra.lparam = (LPARAM)(&ps->hook + 1);
+ memcpy( &ps->hook, &h_extra, sizeof(h_extra) );
break;
}
case WM_NCPAINT:
@@ -1054,8 +1498,23 @@
{
case WM_NCCREATE:
case WM_CREATE:
- push_data( data, (CREATESTRUCTW *)lparam, sizeof(CREATESTRUCTW) );
- break;
+ {
+ CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam;
+ data->ps.cs.lpCreateParams = (ULONG_PTR)cs->lpCreateParams;
+ data->ps.cs.hInstance = (ULONG_PTR)cs->hInstance;
+ data->ps.cs.hMenu = wine_server_user_handle( cs->hMenu );
+ data->ps.cs.hwndParent = wine_server_user_handle( cs->hwndParent );
+ data->ps.cs.cy = cs->cy;
+ data->ps.cs.cx = cs->cx;
+ data->ps.cs.y = cs->y;
+ data->ps.cs.x = cs->x;
+ data->ps.cs.style = cs->style;
+ data->ps.cs.dwExStyle = cs->dwExStyle;
+ data->ps.cs.lpszName = (ULONG_PTR)cs->lpszName;
+ data->ps.cs.lpszClass = (ULONG_PTR)cs->lpszClass;
+ push_data( data, &data->ps.cs, sizeof(data->ps.cs) );
+ break;
+ }
case WM_GETTEXT:
case CB_GETLBTEXT:
case LB_GETTEXT:
@@ -1065,14 +1524,43 @@
push_data( data, (MINMAXINFO *)lparam, sizeof(MINMAXINFO) );
break;
case WM_MEASUREITEM:
- push_data( data, (MEASUREITEMSTRUCT *)lparam, sizeof(MEASUREITEMSTRUCT) );
- break;
+ {
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lparam;
+ data->ps.mis.CtlType = mis->CtlType;
+ data->ps.mis.CtlID = mis->CtlID;
+ data->ps.mis.itemID = mis->itemID;
+ data->ps.mis.itemWidth = mis->itemWidth;
+ data->ps.mis.itemHeight = mis->itemHeight;
+ data->ps.mis.itemData = mis->itemData;
+ push_data( data, &data->ps.mis, sizeof(data->ps.mis) );
+ break;
+ }
case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED:
- push_data( data, (WINDOWPOS *)lparam, sizeof(WINDOWPOS) );
- break;
+ {
+ WINDOWPOS *wp = (WINDOWPOS *)lparam;
+ data->ps.wp.hwnd = wine_server_user_handle( wp->hwnd );
+ data->ps.wp.hwndInsertAfter = wine_server_user_handle( wp->hwndInsertAfter
);
+ data->ps.wp.x = wp->x;
+ data->ps.wp.y = wp->y;
+ data->ps.wp.cx = wp->cx;
+ data->ps.wp.cy = wp->cy;
+ data->ps.wp.flags = wp->flags;
+ push_data( data, &data->ps.wp, sizeof(data->ps.wp) );
+ break;
+ }
case WM_GETDLGCODE:
- if (lparam) push_data( data, (MSG *)lparam, sizeof(MSG) );
+ if (lparam)
+ {
+ MSG *msg = (MSG *)lparam;
+ data->ps.msg.hwnd = wine_server_user_handle( msg->hwnd );
+ data->ps.msg.message = msg->message;
+ data->ps.msg.wParam = msg->wParam;
+ data->ps.msg.lParam = msg->lParam;
+ data->ps.msg.time = msg->time;
+ data->ps.msg.pt = msg->pt;
+ push_data( data, &data->ps.msg, sizeof(data->ps.msg) );
+ }
break;
case SBM_GETSCROLLINFO:
push_data( data, (SCROLLINFO *)lparam, sizeof(SCROLLINFO) );
@@ -1101,9 +1589,18 @@
push_data( data, (RECT *)lparam, sizeof(RECT) );
else
{
- NCCALCSIZE_PARAMS *nc = (NCCALCSIZE_PARAMS *)lparam;
- push_data( data, nc, sizeof(*nc) );
- push_data( data, nc->lppos, sizeof(*nc->lppos) );
+ NCCALCSIZE_PARAMS *ncp = (NCCALCSIZE_PARAMS *)lparam;
+ data->ps.ncp.rgrc[0] = ncp->rgrc[0];
+ data->ps.ncp.rgrc[1] = ncp->rgrc[1];
+ data->ps.ncp.rgrc[2] = ncp->rgrc[2];
+ data->ps.ncp.hwnd = wine_server_user_handle(
ncp->lppos->hwnd );
+ data->ps.ncp.hwndInsertAfter = wine_server_user_handle(
ncp->lppos->hwndInsertAfter );
+ data->ps.ncp.x = ncp->lppos->x;
+ data->ps.ncp.y = ncp->lppos->y;
+ data->ps.ncp.cx = ncp->lppos->cx;
+ data->ps.ncp.cy = ncp->lppos->cy;
+ data->ps.ncp.flags = ncp->lppos->flags;
+ push_data( data, &data->ps.ncp, sizeof(data->ps.ncp) );
}
break;
case EM_GETSEL:
@@ -1113,11 +1610,29 @@
if (lparam) push_data( data, (DWORD *)lparam, sizeof(DWORD) );
break;
case WM_NEXTMENU:
- push_data( data, (MDINEXTMENU *)lparam, sizeof(MDINEXTMENU) );
- break;
+ {
+ MDINEXTMENU *mnm = (MDINEXTMENU *)lparam;
+ data->ps.mnm.hmenuIn = wine_server_user_handle( mnm->hmenuIn );
+ data->ps.mnm.hmenuNext = wine_server_user_handle( mnm->hmenuNext );
+ data->ps.mnm.hwndNext = wine_server_user_handle( mnm->hwndNext );
+ push_data( data, &data->ps.mnm, sizeof(data->ps.mnm) );
+ break;
+ }
case WM_MDICREATE:
- push_data( data, (MDICREATESTRUCTW *)lparam, sizeof(MDICREATESTRUCTW) );
- break;
+ {
+ MDICREATESTRUCTW *mcs = (MDICREATESTRUCTW *)lparam;
+ data->ps.mcs.szClass = pack_ptr( mcs->szClass );
+ data->ps.mcs.szTitle = pack_ptr( mcs->szTitle );
+ data->ps.mcs.hOwner = pack_ptr( mcs->hOwner );
+ data->ps.mcs.x = mcs->x;
+ data->ps.mcs.y = mcs->y;
+ data->ps.mcs.cx = mcs->cx;
+ data->ps.mcs.cy = mcs->cy;
+ data->ps.mcs.style = mcs->style;
+ data->ps.mcs.lParam = mcs->lParam;
+ push_data( data, &data->ps.mcs, sizeof(data->ps.mcs) );
+ break;
+ }
case WM_ASKCBFORMATNAME:
push_data( data, (WCHAR *)lparam, (strlenW((WCHAR *)lparam) + 1) * sizeof(WCHAR)
);
break;
@@ -1133,18 +1648,28 @@
static void unpack_reply( HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam,
void *buffer, size_t size )
{
+ union packed_structs *ps = buffer;
+
switch(message)
{
case WM_NCCREATE:
case WM_CREATE:
- {
- CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam;
- LPCWSTR name = cs->lpszName, class = cs->lpszClass;
- memcpy( cs, buffer, min( sizeof(*cs), size ));
- cs->lpszName = name; /* restore the original pointers */
- cs->lpszClass = class;
- break;
- }
+ if (size >= sizeof(ps->cs))
+ {
+ CREATESTRUCTW *cs = (CREATESTRUCTW *)lparam;
+ cs->lpCreateParams = unpack_ptr( ps->cs.lpCreateParams );
+ cs->hInstance = unpack_ptr( ps->cs.hInstance );
+ cs->hMenu = wine_server_ptr_handle( ps->cs.hMenu );
+ cs->hwndParent = wine_server_ptr_handle( ps->cs.hwndParent );
+ cs->cy = ps->cs.cy;
+ cs->cx = ps->cs.cx;
+ cs->y = ps->cs.y;
+ cs->x = ps->cs.x;
+ cs->style = ps->cs.style;
+ cs->dwExStyle = ps->cs.dwExStyle;
+ /* don't allow changing name and class pointers */
+ }
+ break;
case WM_GETTEXT:
case WM_ASKCBFORMATNAME:
memcpy( (WCHAR *)lparam, buffer, min( wparam*sizeof(WCHAR), size ));
@@ -1153,14 +1678,42 @@
memcpy( (MINMAXINFO *)lparam, buffer, min( sizeof(MINMAXINFO), size ));
break;
case WM_MEASUREITEM:
- memcpy( (MEASUREITEMSTRUCT *)lparam, buffer, min( sizeof(MEASUREITEMSTRUCT), size
));
+ if (size >= sizeof(ps->mis))
+ {
+ MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lparam;
+ mis->CtlType = ps->mis.CtlType;
+ mis->CtlID = ps->mis.CtlID;
+ mis->itemID = ps->mis.itemID;
+ mis->itemWidth = ps->mis.itemWidth;
+ mis->itemHeight = ps->mis.itemHeight;
+ mis->itemData = (ULONG_PTR)unpack_ptr( ps->mis.itemData );
+ }
break;
case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED:
- memcpy( (WINDOWPOS *)lparam, buffer, min( sizeof(WINDOWPOS), size ));
+ if (size >= sizeof(ps->wp))
+ {
+ WINDOWPOS *wp = (WINDOWPOS *)lparam;
+ wp->hwnd = wine_server_ptr_handle( ps->wp.hwnd );
+ wp->hwndInsertAfter = wine_server_ptr_handle( ps->wp.hwndInsertAfter
);
+ wp->x = ps->wp.x;
+ wp->y = ps->wp.y;
+ wp->cx = ps->wp.cx;
+ wp->cy = ps->wp.cy;
+ wp->flags = ps->wp.flags;
+ }
break;
case WM_GETDLGCODE:
- if (lparam) memcpy( (MSG *)lparam, buffer, min( sizeof(MSG), size ));
+ if (lparam && size >= sizeof(ps->msg))
+ {
+ MSG *msg = (MSG *)lparam;
+ msg->hwnd = wine_server_ptr_handle( ps->msg.hwnd );
+ msg->message = ps->msg.message;
+ msg->wParam = (ULONG_PTR)unpack_ptr( ps->msg.wParam );
+ msg->lParam = (ULONG_PTR)unpack_ptr( ps->msg.lParam );
+ msg->time = ps->msg.time;
+ msg->pt = ps->msg.pt;
+ }
break;
case SBM_GETSCROLLINFO:
memcpy( (SCROLLINFO *)lparam, buffer, min( sizeof(SCROLLINFO), size ));
@@ -1187,7 +1740,13 @@
memcpy( (WCHAR *)lparam, buffer, size );
break;
case WM_NEXTMENU:
- memcpy( (MDINEXTMENU *)lparam, buffer, min( sizeof(MDINEXTMENU), size ));
+ if (size >= sizeof(ps->mnm))
+ {
+ MDINEXTMENU *mnm = (MDINEXTMENU *)lparam;
+ mnm->hmenuIn = wine_server_ptr_handle( ps->mnm.hmenuIn );
+ mnm->hmenuNext = wine_server_ptr_handle( ps->mnm.hmenuNext );
+ mnm->hwndNext = wine_server_ptr_handle( ps->mnm.hwndNext );
+ }
break;
case WM_MDIGETACTIVE:
if (lparam) memcpy( (BOOL *)lparam, buffer, min( sizeof(BOOL), size ));
@@ -1195,17 +1754,19 @@
case WM_NCCALCSIZE:
if (!wparam)
memcpy( (RECT *)lparam, buffer, min( sizeof(RECT), size ));
- else
- {
- NCCALCSIZE_PARAMS *nc = (NCCALCSIZE_PARAMS *)lparam;
- WINDOWPOS *wp = nc->lppos;
- memcpy( nc, buffer, min( sizeof(*nc), size ));
- if (size > sizeof(*nc))
- {
- size -= sizeof(*nc);
- memcpy( wp, (NCCALCSIZE_PARAMS*)buffer + 1, min( sizeof(*wp), size ));
- }
- nc->lppos = wp; /* restore the original pointer */
+ else if (size >= sizeof(ps->ncp))
+ {
+ NCCALCSIZE_PARAMS *ncp = (NCCALCSIZE_PARAMS *)lparam;
+ ncp->rgrc[0] = ps->ncp.rgrc[0];
+ ncp->rgrc[1] = ps->ncp.rgrc[1];
+ ncp->rgrc[2] = ps->ncp.rgrc[2];
+ ncp->lppos->hwnd = wine_server_ptr_handle( ps->ncp.hwnd
);
+ ncp->lppos->hwndInsertAfter = wine_server_ptr_handle(
ps->ncp.hwndInsertAfter );
+ ncp->lppos->x = ps->ncp.x;
+ ncp->lppos->y = ps->ncp.y;
+ ncp->lppos->cx = ps->ncp.cx;
+ ncp->lppos->cy = ps->ncp.cy;
+ ncp->lppos->flags = ps->ncp.flags;
}
break;
case EM_GETSEL:
@@ -1221,14 +1782,19 @@
if (lparam) memcpy( (DWORD *)lparam, buffer, min( sizeof(DWORD), size ));
break;
case WM_MDICREATE:
- {
- MDICREATESTRUCTW *cs = (MDICREATESTRUCTW *)lparam;
- LPCWSTR title = cs->szTitle, class = cs->szClass;
- memcpy( cs, buffer, min( sizeof(*cs), size ));
- cs->szTitle = title; /* restore the original pointers */
- cs->szClass = class;
- break;
- }
+ if (size >= sizeof(ps->mcs))
+ {
+ MDICREATESTRUCTW *mcs = (MDICREATESTRUCTW *)lparam;
+ mcs->hOwner = unpack_ptr( ps->mcs.hOwner );
+ mcs->x = ps->mcs.x;
+ mcs->y = ps->mcs.y;
+ mcs->cx = ps->mcs.cx;
+ mcs->cy = ps->mcs.cy;
+ mcs->style = ps->mcs.style;
+ mcs->lParam = (LPARAM)unpack_ptr( ps->mcs.lParam );
+ /* don't allow changing class and title pointers */
+ }
+ break;
default:
ERR( "should not happen: unexpected message %x\n", message );
break;
@@ -1249,7 +1815,7 @@
if (info->flags & ISMEX_NOTIFY) return; /* notify messages don't get
replies */
if (!remove && replied) return; /* replied already */
- data.count = 0;
+ memset( &data, 0, sizeof(data) );
info->flags |= ISMEX_REPLIED;
if (info->type == MSG_OTHER_PROCESS && !replied)
@@ -1435,8 +2001,9 @@
HGLOBAL h = dde_get_pair( (HANDLE)uiHi );
if (h)
{
+ ULONGLONG hpack = pack_ptr( h );
/* send back the value of h on the other side */
- push_data( data, &h, sizeof(HGLOBAL) );
+ push_data( data, &hpack, sizeof(hpack) );
lp = uiLo;
TRACE( "send dde-ack %lx %08lx => %p\n", uiLo, uiHi, h );
}
@@ -1537,11 +2104,13 @@
case WM_DDE_ACK:
if (size)
{
+ ULONGLONG hpack;
/* hMem is being passed */
- if (size != sizeof(HGLOBAL)) return FALSE;
+ if (size != sizeof(hpack)) return FALSE;
if (!buffer || !*buffer) return FALSE;
uiLo = *lparam;
- memcpy( &hMem, *buffer, size );
+ memcpy( &hpack, *buffer, size );
+ hMem = unpack_ptr( hpack );
uiHi = (UINT_PTR)hMem;
TRACE("recv dde-ack %lx mem=%lx[%lx]\n", uiLo, uiHi, GlobalSize(
hMem ));
}
@@ -2316,7 +2885,7 @@
timeout = (timeout_t)max( 0, (int)info->timeout ) * -10000;
}
- data.count = 0;
+ memset( &data, 0, sizeof(data) );
if (info->type == MSG_OTHER_PROCESS)
{
*reply_size = pack_message( info->hwnd, info->msg, info->wparam,
info->lparam, &data );
Modified: branches/arwinss/reactos/dll/win32/user32/scroll.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/scroll.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/scroll.c [iso-8859-1] Sun Apr 4 15:19:10
2010
@@ -1129,7 +1129,7 @@
ReleaseCapture();
break;
}
- } while (msg.message != WM_LBUTTONUP);
+ } while (msg.message != WM_LBUTTONUP && GetCapture() == hwnd);
}
Modified: branches/arwinss/reactos/dll/win32/user32/user_private.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/user_private.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/user_private.h [iso-8859-1] Sun Apr 4
15:19:10 2010
@@ -177,13 +177,11 @@
DWORD GetMessageTimeVal; /* Value for GetMessageTime */
DWORD GetMessagePosVal; /* Value for GetMessagePos */
ULONG_PTR GetMessageExtraInfoVal; /* Value for
GetMessageExtraInfo */
- HCURSOR cursor; /* Current cursor */
- INT cursor_count; /* Cursor show count */
UINT active_hooks; /* Bitmap of active hooks */
HWND top_window; /* Desktop window */
HWND msg_window; /* HWND_MESSAGE parent window
*/
- ULONG pad[9]; /* Available for more data */
+ ULONG pad[11]; /* Available for more data */
};
struct hook_extra_info
Modified: branches/arwinss/reactos/dll/win32/user32/win.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user3…
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] Sun Apr 4 15:19:10 2010
@@ -1786,6 +1786,7 @@
WCHAR windir[MAX_PATH];
WCHAR app[MAX_PATH + sizeof(explorer)/sizeof(WCHAR)];
WCHAR cmdline[MAX_PATH + (sizeof(explorer) + sizeof(args))/sizeof(WCHAR)];
+ void *redir;
memset( &si, 0, sizeof(si) );
si.cb = sizeof(si);
@@ -1794,11 +1795,13 @@
si.hStdOutput = 0;
si.hStdError = GetStdHandle( STD_ERROR_HANDLE );
- GetWindowsDirectoryW( windir, MAX_PATH );
+ GetSystemDirectoryW( windir, MAX_PATH );
strcpyW( app, windir );
strcatW( app, explorer );
strcpyW( cmdline, app );
strcatW( cmdline, args );
+
+ Wow64DisableWow64FsRedirection( &redir );
if (CreateProcessW( app, cmdline, NULL, NULL, FALSE, DETACHED_PROCESS,
NULL, windir, &si, &pi ))
{
@@ -1808,6 +1811,7 @@
CloseHandle( pi.hProcess );
}
else WARN( "failed to start explorer, err %d\n", GetLastError() );
+ Wow64RevertWow64FsRedirection( redir );
}
else TRACE( "not starting explorer since winstation is not visible\n"
);
Modified: branches/arwinss/reactos/include/reactos/wine/server_protocol.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos…
==============================================================================
--- branches/arwinss/reactos/include/reactos/wine/server_protocol.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/include/reactos/wine/server_protocol.h [iso-8859-1] Sun Apr
4 15:19:10 2010
@@ -139,10 +139,10 @@
{
struct { unsigned int eip, ebp, esp, eflags, cs, ss; } i386_regs;
struct { unsigned __int64 rip, rbp, rsp;
- unsigned int cs, ss, flags; } x86_64_regs;
+ unsigned int cs, ss, flags, __pad; } x86_64_regs;
struct { unsigned __int64 fir;
- unsigned int psr; } alpha_regs;
- struct { unsigned int iar, msr, ctr, lr, dar, dsisr, trap; } powerpc_regs;
+ unsigned int psr, __pad; } alpha_regs;
+ struct { unsigned int iar, msr, ctr, lr, dar, dsisr, trap, __pad; }
powerpc_regs;
struct { unsigned int psr, pc, npc, y, wim, tbr; } sparc_regs;
} ctl;
union
@@ -722,7 +722,7 @@
int exit_code;
int priority;
cpu_type_t cpu;
- char __pad_60[4];
+ int debugger_present;
};
@@ -4653,6 +4653,24 @@
{
struct reply_header __header;
};
+
+
+
+struct set_cursor_request
+{
+ struct request_header __header;
+ unsigned int flags;
+ user_handle_t handle;
+ int show_count;
+};
+struct set_cursor_reply
+{
+ struct reply_header __header;
+ user_handle_t prev_handle;
+ int prev_count;
+};
+#define SET_CURSOR_HANDLE 0x01
+#define SET_CURSOR_COUNT 0x02
enum request
@@ -4898,6 +4916,7 @@
REQ_set_window_layered_info,
REQ_alloc_user_handle,
REQ_free_user_handle,
+ REQ_set_cursor,
REQ_NB_REQUESTS
};
@@ -5146,6 +5165,7 @@
struct set_window_layered_info_request set_window_layered_info_request;
struct alloc_user_handle_request alloc_user_handle_request;
struct free_user_handle_request free_user_handle_request;
+ struct set_cursor_request set_cursor_request;
};
union generic_reply
{
@@ -5392,8 +5412,9 @@
struct set_window_layered_info_reply set_window_layered_info_reply;
struct alloc_user_handle_reply alloc_user_handle_reply;
struct free_user_handle_reply free_user_handle_reply;
-};
-
-#define SERVER_PROTOCOL_VERSION 395
+ struct set_cursor_reply set_cursor_reply;
+};
+
+#define SERVER_PROTOCOL_VERSION 398
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/request.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/request.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/request.h [iso-8859-1] Sun
Apr 4 15:19:10 2010
@@ -33,7 +33,7 @@
extern PVOID RequestData;
/* get the request vararg data */
-static inline const void *get_req_data()
+static inline const void *get_req_data(void)
{
return RequestData;
}
@@ -313,6 +313,7 @@
DECL_HANDLER(set_window_layered_info);
DECL_HANDLER(alloc_user_handle);
DECL_HANDLER(free_user_handle);
+DECL_HANDLER(set_cursor);
#ifdef WANT_REQUEST_HANDLERS
@@ -560,6 +561,7 @@
(req_handler)req_set_window_layered_info,
(req_handler)req_alloc_user_handle,
(req_handler)req_free_user_handle,
+ (req_handler)req_set_cursor,
};
#if 0
@@ -659,6 +661,7 @@
C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, exit_code) == 48 );
C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, priority) == 52 );
C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, cpu) == 56 );
+C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, debugger_present) == 60 );
C_ASSERT( sizeof(struct get_process_info_reply) == 64 );
C_ASSERT( FIELD_OFFSET(struct set_process_info_request, handle) == 12 );
C_ASSERT( FIELD_OFFSET(struct set_process_info_request, mask) == 16 );
@@ -1869,6 +1872,12 @@
C_ASSERT( sizeof(struct alloc_user_handle_reply) == 16 );
C_ASSERT( FIELD_OFFSET(struct free_user_handle_request, handle) == 12 );
C_ASSERT( sizeof(struct free_user_handle_request) == 16 );
+C_ASSERT( FIELD_OFFSET(struct set_cursor_request, flags) == 12 );
+C_ASSERT( FIELD_OFFSET(struct set_cursor_request, handle) == 16 );
+C_ASSERT( FIELD_OFFSET(struct set_cursor_request, show_count) == 20 );
+C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_handle) == 8 );
+C_ASSERT( FIELD_OFFSET(struct set_cursor_reply, prev_count) == 12 );
+C_ASSERT( sizeof(struct set_cursor_reply) == 16 );
#endif
#endif /* WANT_REQUEST_HANDLERS */
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/wine/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Apr 4 15:19:10 2010
@@ -1,3 +1,3 @@
/branches/ros-amd64-bringup/reactos/subsystems/win32/win32k/wine:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
/trunk/reactos/subsystems/win32/win32k/wine:42000-43126,43669-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688
-/vendor/wine/server/current:43708,44715,45044,45206,45646,45910,46314
+/vendor/wine/server/current:43708,44715,45044,45206,45646,45910,46314,46696
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/handle.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/handle.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/handle.c [iso-8859-1] Sun Apr 4
15:19:10 2010
@@ -609,7 +609,7 @@
DECL_HANDLER(set_security_object)
{
data_size_t sd_size = get_req_data_size((void*)req);
- const struct security_descriptor *sd = get_req_data((void*)req);
+ const struct security_descriptor *sd = get_req_data();
struct object *obj;
unsigned int access = 0;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/queue.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/queue.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/queue.c [iso-8859-1] Sun Apr 4
15:19:10 2010
@@ -92,6 +92,8 @@
rectangle_t caret_rect; /* caret rectangle */
int caret_hide; /* caret hide count */
int caret_state; /* caret on/off state */
+ user_handle_t cursor; /* current cursor */
+ int cursor_count; /* cursor show count */
struct list msg_list; /* list of hardware messages */
unsigned char keystate[256]; /* state of each key */
};
@@ -109,6 +111,7 @@
int paint_count; /* pending paint messages count */
int quit_message; /* is there a pending quit message? */
int exit_code; /* exit code of pending quit message */
+ int cursor_count; /* per-queue cursor show count */
struct list msg_list[NB_MSG_KINDS]; /* lists of messages */
struct list send_result; /* stack of sent messages waiting for result
*/
struct list callback_result; /* list of callback messages waiting for
result */
@@ -215,11 +218,13 @@
if ((input = alloc_object( &thread_input_ops )))
{
- input->focus = 0;
- input->capture = 0;
- input->active = 0;
- input->menu_owner = 0;
- input->move_size = 0;
+ input->focus = 0;
+ input->capture = 0;
+ input->active = 0;
+ input->menu_owner = 0;
+ input->move_size = 0;
+ input->cursor = 0;
+ input->cursor_count = 0;
list_init( &input->msg_list );
set_caret_window( input, 0 );
memset( input->keystate, 0, sizeof(input->keystate) );
@@ -233,23 +238,19 @@
return input;
}
-/* release the thread input data of a given thread */
-static inline void release_thread_input( PTHREADINFO thread )
-{
- struct thread_input *input = thread->queue->input;
-
- if (!input) return;
- release_object( input );
- thread->queue->input = NULL;
-}
-
/* create a message queue object */
static struct msg_queue *create_msg_queue( PTHREADINFO thread, struct thread_input *input
)
{
+ struct thread_input *new_input = NULL;
struct msg_queue *queue;
int i;
- if (!input && !(input = create_thread_input( thread ))) return NULL;
+ if (!input)
+ {
+ if (!(new_input = create_thread_input( thread ))) return NULL;
+ input = new_input;
+ }
+
if ((queue = alloc_object( &msg_queue_ops )))
{
queue->fd = NULL;
@@ -267,6 +268,7 @@
queue->changed_mask = 0;
queue->paint_count = 0;
queue->quit_message = 0;
+ queue->cursor_count = 0;
queue->recv_result = NULL;
queue->next_timer_id = 0x7fff;
queue->timeout = NULL;
@@ -281,7 +283,7 @@
thread->queue = queue;
}
- release_object( input );
+ if (new_input) release_object( new_input );
return queue;
}
@@ -292,6 +294,26 @@
if (!thread->queue) return;
release_object( thread->queue );
thread->queue = NULL;
+}
+
+/* change the thread input data of a given thread */
+static int assign_thread_input( PTHREADINFO thread, struct thread_input *new_input )
+{
+ struct msg_queue *queue = thread->queue;
+
+ if (!queue)
+ {
+ thread->queue = create_msg_queue( thread, new_input );
+ return thread->queue != NULL;
+ }
+ if (queue->input)
+ {
+ queue->input->cursor_count -= queue->cursor_count;
+ release_object( queue->input );
+ }
+ queue->input = (struct thread_input *)grab_object( new_input );
+ new_input->cursor_count += queue->cursor_count;
+ return 1;
}
/* get the hook table for a given thread */
@@ -874,7 +896,11 @@
ExFreePool( timer );
}
if (queue->timeout) remove_timeout_user( queue->timeout );
- if (queue->input) release_object( queue->input );
+ if (queue->input)
+ {
+ queue->input->cursor_count -= queue->cursor_count;
+ release_object( queue->input );
+ }
if (queue->hooks) release_object( queue->hooks );
if (queue->fd) release_object( queue->fd );
}
@@ -949,6 +975,7 @@
{
struct desktop *desktop;
struct thread_input *input;
+ int ret;
if (!thread_to->queue && !(thread_to->queue = create_msg_queue(
thread_to, NULL ))) return 0;
if (!(desktop = get_thread_desktop( thread_from, 0 ))) return 0;
@@ -962,17 +989,10 @@
}
release_object( desktop );
- if (thread_from->queue)
- {
- release_thread_input( thread_from );
- thread_from->queue->input = input;
- }
- else
- {
- if (!(thread_from->queue = create_msg_queue( thread_from, input ))) return 0;
- }
- memset( input->keystate, 0, sizeof(input->keystate) );
- return 1;
+ ret = assign_thread_input( thread_from, input );
+ if (ret) memset( input->keystate, 0, sizeof(input->keystate) );
+ release_object( input );
+ return ret;
}
/* detach two thread input data structures */
@@ -982,8 +1002,8 @@
if ((input = create_thread_input( thread_from )))
{
- release_thread_input( thread_from );
- thread_from->queue->input = input;
+ assign_thread_input( thread_from, input );
+ release_object( input );
}
}
@@ -1723,7 +1743,7 @@
msg->data = NULL;
msg->data_size = get_req_data_size((void*)req);
- if (msg->data_size && !(msg->data = memdup(
get_req_data((void*)req), msg->data_size )))
+ if (msg->data_size && !(msg->data = memdup( get_req_data(),
msg->data_size )))
{
ExFreePool( msg );
ObDereferenceObject(thread->peThread);
@@ -1926,7 +1946,7 @@
if (!current->queue) set_error( STATUS_ACCESS_DENIED );
else if (current->queue->recv_result)
reply_message( current->queue, req->result, 0, req->remove,
- get_req_data((void*)req), get_req_data_size((void*)req) );
+ get_req_data(), get_req_data_size((void*)req) );
}
@@ -2217,7 +2237,7 @@
if (input)
{
data_size_t size = min( sizeof(input->keystate), get_req_data_size((void*)req)
);
- if (size) memcpy( input->keystate, get_req_data((void*)req), size );
+ if (size) memcpy( input->keystate, get_req_data(), size );
}
ObDereferenceObject(thread->peThread);
}
@@ -2366,3 +2386,32 @@
{
reply->time = last_input_time;
}
+
+/* set/get the current cursor */
+DECL_HANDLER(set_cursor)
+{
+ struct msg_queue *queue = get_current_queue();
+ struct thread_input *input;
+
+ if (!queue) return;
+ input = queue->input;
+
+ reply->prev_handle = input->cursor;
+ reply->prev_count = input->cursor_count;
+
+ if (req->flags & SET_CURSOR_HANDLE)
+ {
+ if (req->handle && !get_user_object( req->handle, USER_CLIENT ))
+ {
+ set_win32_error( ERROR_INVALID_CURSOR_HANDLE );
+ return;
+ }
+ input->cursor = req->handle;
+ }
+
+ if (req->flags & SET_CURSOR_COUNT)
+ {
+ queue->cursor_count += req->show_count;
+ input->cursor_count += req->show_count;
+ }
+}
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c [iso-8859-1] Sun Apr 4
15:19:10 2010
@@ -2086,7 +2086,7 @@
return;
}
- if (get_req_data_size((void*)req) >= sizeof(rectangle_t)) visible_rect =
get_req_data((void*)req);
+ if (get_req_data_size((void*)req) >= sizeof(rectangle_t)) visible_rect =
get_req_data();
if (get_req_data_size((void*)req) >= 3 * sizeof(rectangle_t)) valid_rects =
visible_rect + 1;
if (!visible_rect) visible_rect = &req->window;
@@ -2136,7 +2136,7 @@
if (len)
{
if (!(text = mem_alloc( (len+1) * sizeof(WCHAR) ))) return;
- memcpy( text, get_req_data((void*)req), len * sizeof(WCHAR) );
+ memcpy( text, get_req_data(), len * sizeof(WCHAR) );
text[len] = 0;
}
if (win->text) ExFreePool( win->text );
@@ -2234,7 +2234,7 @@
if (get_req_data_size((void*)req)) /* no data means remove the region completely */
{
- if (!(region = create_region_from_req_data( get_req_data((void*)req),
get_req_data_size((void*)req) )))
+ if (!(region = create_region_from_req_data( get_req_data(),
get_req_data_size((void*)req) )))
return;
}
set_window_region( win, region, req->redraw );
@@ -2354,7 +2354,7 @@
{
if (get_req_data_size((void*)req)) /* no data means whole rectangle */
{
- if (!(region = create_region_from_req_data( get_req_data((void*)req),
get_req_data_size((void*)req) )))
+ if (!(region = create_region_from_req_data( get_req_data(),
get_req_data_size((void*)req) )))
return;
}
}