Author: fireball Date: Sat Oct 24 15:20:16 2009 New Revision: 43713
URL: http://svn.reactos.org/svn/reactos?rev=43713&view=rev Log: - Update arwinss to Wine-1.1.32. - 16 bit code is well isolated by Wine team now, so amount of differences is substantially smaller. Also more compatibility due to rewritten user32/resource.c.
Modified: branches/arwinss/reactos/dll/win32/gdi32/ (props changed) branches/arwinss/reactos/dll/win32/gdi32/dib.c branches/arwinss/reactos/dll/win32/gdi32/font.c branches/arwinss/reactos/dll/win32/user32/ (props changed) branches/arwinss/reactos/dll/win32/user32/button.c branches/arwinss/reactos/dll/win32/user32/cursoricon.c branches/arwinss/reactos/dll/win32/user32/driver.c branches/arwinss/reactos/dll/win32/user32/edit.c branches/arwinss/reactos/dll/win32/user32/input.c branches/arwinss/reactos/dll/win32/user32/menu.c branches/arwinss/reactos/dll/win32/user32/message.c branches/arwinss/reactos/dll/win32/user32/nonclient.c branches/arwinss/reactos/dll/win32/user32/resource.c branches/arwinss/reactos/dll/win32/user32/resources/version.rc branches/arwinss/reactos/dll/win32/user32/static.c branches/arwinss/reactos/dll/win32/user32/uitools.c branches/arwinss/reactos/dll/win32/user32/user_main.c branches/arwinss/reactos/dll/win32/user32/user_private.h branches/arwinss/reactos/dll/win32/user32/win.c branches/arwinss/reactos/dll/win32/user32/win.h branches/arwinss/reactos/dll/win32/user32/winpos.c branches/arwinss/reactos/dll/win32/winex11.drv/ (props changed) branches/arwinss/reactos/dll/win32/winex11.drv/event.c branches/arwinss/reactos/dll/win32/winex11.drv/graphics.c branches/arwinss/reactos/dll/win32/winex11.drv/keyboard.c branches/arwinss/reactos/dll/win32/winex11.drv/opengl.c branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h branches/arwinss/reactos/dll/win32/winex11.drv/xrender.c branches/arwinss/reactos/include/reactos/wine/config.h branches/arwinss/reactos/include/reactos/wine/server_protocol.h branches/arwinss/reactos/subsystems/win32/win32k/include/request.h (contents, props changed) branches/arwinss/reactos/subsystems/win32/win32k/include/user.h (contents, props changed) branches/arwinss/reactos/subsystems/win32/win32k/main/monitor.c branches/arwinss/reactos/subsystems/win32/win32k/wine/ (props changed) branches/arwinss/reactos/subsystems/win32/win32k/wine/user.c
Propchange: branches/arwinss/reactos/dll/win32/gdi32/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Oct 24 15:20:16 2009 @@ -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-43670 -/vendor/wine/dlls/gdi32/current:43136,43149,43398 +/vendor/wine/dlls/gdi32/current:43136,43149,43398,43708
Modified: branches/arwinss/reactos/dll/win32/gdi32/dib.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/... ============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/dib.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/gdi32/dib.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -336,17 +336,17 @@ BITMAPOBJ *bitmap; INT result = 0;
+ if (coloruse == DIB_RGB_COLORS) hdc = CreateCompatibleDC(0); + if (!(dc = get_dc_ptr( hdc ))) - { - if (coloruse == DIB_RGB_COLORS) FIXME( "shouldn't require a DC for DIB_RGB_COLORS\n" ); return 0; - }
update_dc( dc );
if (!(bitmap = GDI_GetObjPtr( hbitmap, OBJ_BITMAP ))) { release_dc_ptr( dc ); + if (coloruse == DIB_RGB_COLORS) DeleteDC(hdc); return 0; }
@@ -365,6 +365,7 @@ done: GDI_ReleaseObj( hbitmap ); release_dc_ptr( dc ); + if (coloruse == DIB_RGB_COLORS) DeleteDC(hdc); return result; }
Modified: branches/arwinss/reactos/dll/win32/gdi32/font.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/... ============================================================================== --- branches/arwinss/reactos/dll/win32/gdi32/font.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/gdi32/font.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -2596,13 +2596,13 @@ int index = 0; switch (flags) { case TCI_SRCFONTSIG: - while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++; + while (index < MAXTCIINDEX && !(*lpSrc>>index & 0x0001)) index++; break; case TCI_SRCCODEPAGE: - while (PtrToUlong(lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++; + while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciACP) index++; break; case TCI_SRCCHARSET: - while (PtrToUlong(lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++; + while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciCharset) index++; break; default: return FALSE;
Propchange: branches/arwinss/reactos/dll/win32/user32/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Oct 24 15:20:16 2009 @@ -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-43670 -/vendor/wine/dlls/user32/current:43136,43149,43398 +/vendor/wine/dlls/user32/current:43136,43149,43398,43708
Modified: branches/arwinss/reactos/dll/win32/user32/button.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/button.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/button.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -836,14 +836,17 @@ hOldBrush = SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE)); oldBkMode = SetBkMode(hDC, TRANSPARENT);
+ if (get_button_type(style) == BS_DEFPUSHBUTTON) + { + if (action != ODA_FOCUS) + Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); + InflateRect( &rc, -1, -1 ); + } + + focus_rect = rc; + /* completely skip the drawing if only focus has changed */ if (action == ODA_FOCUS) goto draw_focus; - - if (get_button_type(style) == BS_DEFPUSHBUTTON) - { - Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom); - InflateRect( &rc, -1, -1 ); - }
uState = DFCS_BUTTONPUSH | DFCS_ADJUSTRECT;
@@ -861,8 +864,6 @@ uState |= DFCS_CHECKED;
DrawFrameControl( hDC, &rc, DFC_BUTTON, uState ); - - focus_rect = rc;
/* draw button label */ r = rc;
Modified: branches/arwinss/reactos/dll/win32/user32/cursoricon.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/cursoricon.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/cursoricon.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -474,6 +474,20 @@ LeaveCriticalSection( &IconCrst ); } #endif +/********************************************************************** + * get_icon_size + */ +BOOL get_icon_size( HICON handle, SIZE *size ) +{ + CURSORICONINFO *info; + + if (!(info = GlobalLock( handle ))) return FALSE; + size->cx = info->nWidth; + size->cy = info->nHeight; + GlobalUnlock( handle ); + return TRUE; +} + /* * The following macro functions account for the irregularities of * accessing cursor and icon resources in files and resource entries. @@ -954,7 +968,7 @@ || (chunk_type && *(DWORD *)ptr == chunk_type && *((DWORD *)ptr + 2) == chunk_id )) { ptr += sizeof(DWORD); - chunk->data_size = *(DWORD *)ptr; + chunk->data_size = (*(DWORD *)ptr + 1) & ~1; ptr += sizeof(DWORD); if (chunk_type == ANI_LIST_ID || chunk_type == ANI_RIFF_ID) ptr += sizeof(DWORD); chunk->data = ptr; @@ -963,7 +977,7 @@ }
ptr += sizeof(DWORD); - ptr += *(DWORD *)ptr; + ptr += (*(DWORD *)ptr + 1) & ~1; ptr += sizeof(DWORD); } } @@ -1809,7 +1823,7 @@ * RETURNS * A handle to the previous cursor shape. */ -HCURSOR WINAPI SetCursor( HCURSOR hCursor /* [in] Handle of cursor to show */ ) +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; @@ -1830,7 +1844,7 @@ /*********************************************************************** * ShowCursor (USER32.@) */ -INT WINAPI ShowCursor( BOOL bShow ) +INT WINAPI DECLSPEC_HOTPATCH ShowCursor( BOOL bShow ) { struct user_thread_info *thread_info = get_user_thread_info();
@@ -1864,7 +1878,7 @@ /*********************************************************************** * ClipCursor (USER32.@) */ -BOOL WINAPI ClipCursor( const RECT *rect ) +BOOL WINAPI DECLSPEC_HOTPATCH ClipCursor( const RECT *rect ) { RECT virt;
@@ -1887,7 +1901,7 @@ /*********************************************************************** * GetClipCursor (USER32.@) */ -BOOL WINAPI GetClipCursor( RECT *rect ) +BOOL WINAPI DECLSPEC_HOTPATCH GetClipCursor( RECT *rect ) { /* If this is first time - initialize the rect */ if (IsRectEmpty( &CURSOR_ClipRect )) ClipCursor( NULL );
Modified: branches/arwinss/reactos/dll/win32/user32/driver.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/driver.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/driver.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -327,8 +327,10 @@ static BOOL CDECL nulldrv_CreateWindow( HWND hwnd ) { static int warned; - if (warned++) - return FALSE; + + /* HWND_MESSAGE windows don't need a graphics driver */ + if (GetAncestor( hwnd, GA_PARENT ) == get_user_thread_info()->msg_window) return TRUE; + if (warned++) return FALSE;
MESSAGE( "Application tried to create a window, but no driver could be loaded.\n"); switch (driver_load_error)
Modified: branches/arwinss/reactos/dll/win32/user32/edit.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/edit.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/edit.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -4537,16 +4537,16 @@
alloc_size = ROUND_TO_GROW((es->buffer_size + 1) * sizeof(WCHAR)); if(!(es->hloc32W = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, alloc_size))) - return FALSE; + goto cleanup; es->buffer_size = LocalSize(es->hloc32W)/sizeof(WCHAR) - 1;
if (!(es->undo_text = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (es->buffer_size + 1) * sizeof(WCHAR)))) - return FALSE; + goto cleanup; es->undo_buffer_size = es->buffer_size;
if (es->style & ES_MULTILINE) if (!(es->first_line_def = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LINEDEF)))) - return FALSE; + goto cleanup; es->line_count = 1;
/* @@ -4566,6 +4566,14 @@ SetWindowLongW(hwnd, GWL_STYLE, es->style & ~WS_BORDER);
return TRUE; + +cleanup: + SetWindowLongPtrW(es->hwndSelf, 0, 0); + HeapFree(GetProcessHeap(), 0, es->first_line_def); + HeapFree(GetProcessHeap(), 0, es->undo_text); + if (es->hloc32W) LocalFree(es->hloc32W); + HeapFree(GetProcessHeap(), 0, es); + return FALSE; }
@@ -4653,7 +4661,8 @@ pc = pp; }
- SetWindowLongPtrW( es->hwndSelf, 0, 0 ); + SetWindowLongPtrW( es->hwndSelf, 0, 0 ); + HeapFree(GetProcessHeap(), 0, es->undo_text); HeapFree(GetProcessHeap(), 0, es);
return 0; @@ -5255,7 +5264,11 @@ CS_DBLCLKS | CS_PARENTDC, /* style */ EditWndProcA, /* procA */ EditWndProcW, /* procW */ +#ifdef _WIN64 sizeof(EDITSTATE *), /* extra */ +#else + sizeof(EDITSTATE *) + sizeof(HANDLE16), /* extra */ +#endif IDC_IBEAM, /* cursor */ 0 /* brush */ };
Modified: branches/arwinss/reactos/dll/win32/user32/input.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/input.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/input.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -192,7 +192,7 @@ /*********************************************************************** * GetCursorPos (USER32.@) */ -BOOL WINAPI GetCursorPos( POINT *pt ) +BOOL WINAPI DECLSPEC_HOTPATCH GetCursorPos( POINT *pt ) { if (!pt) return FALSE; return USER_Driver->pGetCursorPos( pt ); @@ -215,7 +215,7 @@ /*********************************************************************** * SetCursorPos (USER32.@) */ -BOOL WINAPI SetCursorPos( INT x, INT y ) +BOOL WINAPI DECLSPEC_HOTPATCH SetCursorPos( INT x, INT y ) { return USER_Driver->pSetCursorPos( x, y ); } @@ -224,7 +224,7 @@ /********************************************************************** * SetCapture (USER32.@) */ -HWND WINAPI SetCapture( HWND hwnd ) +HWND WINAPI DECLSPEC_HOTPATCH SetCapture( HWND hwnd ) { HWND previous;
@@ -236,7 +236,7 @@ /********************************************************************** * ReleaseCapture (USER32.@) */ -BOOL WINAPI ReleaseCapture(void) +BOOL WINAPI DECLSPEC_HOTPATCH ReleaseCapture(void) { BOOL ret = set_capture_window( 0, 0, NULL );
@@ -271,7 +271,7 @@ * bit set to 1 if currently pressed, low-order bit set to 1 if key has * been pressed. */ -SHORT WINAPI GetAsyncKeyState(INT nKey) +SHORT WINAPI DECLSPEC_HOTPATCH GetAsyncKeyState(INT nKey) { if (nKey < 0 || nKey > 256) return 0; @@ -370,7 +370,7 @@ /****************************************************************** * RegisterRawInputDevices (USER32.@) */ -BOOL WINAPI RegisterRawInputDevices(PRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, UINT cbSize) +BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(PRAWINPUTDEVICE pRawInputDevices, UINT uiNumDevices, UINT cbSize) { FIXME("(pRawInputDevices=%p, uiNumDevices=%d, cbSize=%d) stub!\n", pRawInputDevices, uiNumDevices, cbSize);
@@ -393,7 +393,7 @@ /****************************************************************** * GetRawInputBuffer (USER32.@) */ -UINT WINAPI GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader) +UINT WINAPI DECLSPEC_HOTPATCH GetRawInputBuffer(PRAWINPUT pData, PUINT pcbSize, UINT cbSizeHeader) { FIXME("(pData=%p, pcbSize=%p, cbSizeHeader=%d) stub!\n", pData, pcbSize, cbSizeHeader);
@@ -474,7 +474,7 @@ * keyboard-input message. This function retrieves the state of the key * at the time the input message was generated. */ -SHORT WINAPI GetKeyState(INT vkey) +SHORT WINAPI DECLSPEC_HOTPATCH GetKeyState(INT vkey) { SHORT retval = 0;
@@ -493,7 +493,7 @@ /********************************************************************** * GetKeyboardState (USER32.@) */ -BOOL WINAPI GetKeyboardState( LPBYTE state ) +BOOL WINAPI DECLSPEC_HOTPATCH GetKeyboardState( LPBYTE state ) { BOOL ret;
Modified: branches/arwinss/reactos/dll/win32/user32/menu.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/menu.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/menu.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -93,8 +93,8 @@
/* Popup menu structure */ typedef struct { + struct user_object obj; WORD wFlags; /* Menu flags (MF_POPUP, MF_SYSMENU) */ - WORD wMagic; /* Magic number */ WORD Width; /* Width of the whole menu */ WORD Height; /* Height of the whole menu */ UINT nItems; /* Number of items in the menu */ @@ -300,12 +300,15 @@ */ static POPUPMENU *MENU_GetMenu(HMENU hMenu) { - POPUPMENU *menu = USER_HEAP_LIN_ADDR(hMenu); - if (!menu || menu->wMagic != MENU_MAGIC) - { - WARN("invalid menu handle=%p, ptr=%p, magic=%x\n", hMenu, menu, menu? menu->wMagic:0); - menu = NULL; - } + POPUPMENU *menu = get_user_handle_ptr( hMenu, USER_MENU ); + + if (menu == OBJ_OTHER_PROCESS) + { + WARN( "other process menu %p?\n", hMenu); + return NULL; + } + if (menu) release_user_handle_ptr( menu ); /* FIXME! */ + else WARN("invalid menu handle=%p\n", hMenu); return menu; }
@@ -3507,6 +3510,7 @@ break;
case MM_GETMENUHANDLE: + case MN_GETHMENU: return GetWindowLongPtrW( hwnd, 0 );
default: @@ -4029,14 +4033,13 @@ { HMENU hMenu; LPPOPUPMENU menu; - if (!(hMenu = USER_HEAP_ALLOC( sizeof(POPUPMENU) ))) return 0; - menu = USER_HEAP_LIN_ADDR(hMenu); - - ZeroMemory(menu, sizeof(POPUPMENU)); - menu->wMagic = MENU_MAGIC; + + if (!(menu = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*menu) ))) return 0; menu->FocusedItem = NO_SELECTED_ITEM; menu->bTimeToHide = FALSE;
+ if (!(hMenu = alloc_user_handle( &menu->obj, USER_MENU ))) HeapFree( GetProcessHeap(), 0, menu ); + TRACE("return %p\n", hMenu );
return hMenu; @@ -4048,14 +4051,12 @@ */ BOOL WINAPI DestroyMenu( HMENU hMenu ) { - LPPOPUPMENU lppop = MENU_GetMenu(hMenu); + LPPOPUPMENU lppop;
TRACE("(%p)\n", hMenu);
- - if (!lppop) return FALSE; - - lppop->wMagic = 0; /* Mark it as destroyed */ + if (!(lppop = free_user_handle( hMenu, USER_MENU ))) return FALSE; + if (lppop == OBJ_OTHER_PROCESS) return FALSE;
/* DestroyMenu should not destroy system menu popup owner */ if ((lppop->wFlags & (MF_POPUP | MF_SYSMENU)) == MF_POPUP && lppop->hWnd) @@ -4075,7 +4076,7 @@ } HeapFree( GetProcessHeap(), 0, lppop->items ); } - USER_HEAP_FREE( hMenu ); + HeapFree( GetProcessHeap(), 0, lppop ); return TRUE; }
@@ -5349,92 +5350,59 @@ */ INT WINAPI TranslateAcceleratorA( HWND hWnd, HACCEL hAccel, LPMSG msg ) { - /* YES, Accel16! */ - LPACCEL lpAccelTbl; - int i; - WPARAM wParam; - - if (!hWnd || !msg) return 0; - - if (!hAccel || !(lpAccelTbl = (LPACCEL) LockResource(hAccel))) - { - WARN_(accel)("invalid accel handle=%p\n", hAccel); - return 0; - } - - wParam = msg->wParam; - switch (msg->message) { case WM_KEYDOWN: case WM_SYSKEYDOWN: - break; + return TranslateAcceleratorW( hWnd, hAccel, msg );
case WM_CHAR: case WM_SYSCHAR: { - char ch = LOWORD(wParam); + MSG msgW = *msg; + char ch = LOWORD(msg->wParam); WCHAR wch; MultiByteToWideChar(CP_ACP, 0, &ch, 1, &wch, 1); - wParam = MAKEWPARAM(wch, HIWORD(wParam)); - } - break; + msgW.wParam = MAKEWPARAM(wch, HIWORD(msg->wParam)); + return TranslateAcceleratorW( hWnd, hAccel, &msgW ); + }
default: return 0; } +} + +/********************************************************************** + * TranslateAcceleratorW (USER32.@) + */ +INT WINAPI TranslateAcceleratorW( HWND hWnd, HACCEL hAccel, LPMSG msg ) +{ + ACCEL data[32], *ptr = data; + int i, count; + + if (!hWnd) return 0; + + if (msg->message != WM_KEYDOWN && + msg->message != WM_SYSKEYDOWN && + msg->message != WM_CHAR && + msg->message != WM_SYSCHAR) + return 0;
TRACE_(accel)("hAccel %p, hWnd %p, msg->hwnd %p, msg->message %04x, wParam %08lx, lParam %08lx\n", hAccel,hWnd,msg->hwnd,msg->message,msg->wParam,msg->lParam); - i = 0; - do - { - if (translate_accelerator( hWnd, msg->message, wParam, msg->lParam, - lpAccelTbl[i].fVirt, lpAccelTbl[i].key, lpAccelTbl[i].cmd)) - return 1; - } while ((lpAccelTbl[i++].fVirt & 0x80) == 0); - - return 0; -} - -/********************************************************************** - * TranslateAcceleratorW (USER32.@) - */ -INT WINAPI TranslateAcceleratorW( HWND hWnd, HACCEL hAccel, LPMSG msg ) -{ - /* YES, Accel16! */ - LPACCEL lpAccelTbl; - int i; - - if (!hWnd || !msg) return 0; - - if (!hAccel || !(lpAccelTbl = LockResource(hAccel))) - { - WARN_(accel)("invalid accel handle=%p\n", hAccel); - return 0; - } - - switch (msg->message) - { - case WM_KEYDOWN: - case WM_SYSKEYDOWN: - case WM_CHAR: - case WM_SYSCHAR: - break; - - default: - return 0; - } - - TRACE_(accel)("hAccel %p, hWnd %p, msg->hwnd %p, msg->message %04x, wParam %08lx, lParam %08lx\n", - hAccel,hWnd,msg->hwnd,msg->message,msg->wParam,msg->lParam); - i = 0; - do + + if (!(count = CopyAcceleratorTableW( hAccel, NULL, 0 ))) return 0; + if (count > sizeof(data)/sizeof(data[0])) + { + if (!(ptr = HeapAlloc( GetProcessHeap(), 0, count * sizeof(*ptr) ))) return 0; + } + count = CopyAcceleratorTableW( hAccel, ptr, count ); + for (i = 0; i < count; i++) { if (translate_accelerator( hWnd, msg->message, msg->wParam, msg->lParam, - lpAccelTbl[i].fVirt, lpAccelTbl[i].key, lpAccelTbl[i].cmd)) - return 1; - } while ((lpAccelTbl[i++].fVirt & 0x80) == 0); - - return 0; -} + ptr[i].fVirt, ptr[i].key, ptr[i].cmd)) + break; + } + if (ptr != data) HeapFree( GetProcessHeap(), 0, ptr ); + return (i < count); +}
Modified: branches/arwinss/reactos/dll/win32/user32/message.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/message.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/message.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -3061,7 +3061,7 @@ * * See DispatchMessageW. */ -LRESULT WINAPI DispatchMessageA( const MSG* msg ) +LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageA( const MSG* msg ) { LRESULT retval;
@@ -3132,7 +3132,7 @@ * ECMA-234, Win32 * */ -LRESULT WINAPI DispatchMessageW( const MSG* msg ) +LRESULT WINAPI DECLSPEC_HOTPATCH DispatchMessageW( const MSG* msg ) { LRESULT retval;
Modified: branches/arwinss/reactos/dll/win32/user32/nonclient.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/nonclient.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/nonclient.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -533,17 +533,17 @@ RECT rect, rcClient; POINT ptClient;
- TRACE("hwnd=%p pt=%d,%d\n", wndPtr->hwndSelf, pt.x, pt.y ); - - GetWindowRect(wndPtr->hwndSelf, &rect ); + TRACE("hwnd=%p pt=%d,%d\n", wndPtr->obj.handle, pt.x, pt.y ); + + GetWindowRect(wndPtr->obj.handle, &rect ); if (!PtInRect( &rect, pt )) return HTNOWHERE;
if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION;
/* Check client area */ ptClient = pt; - ScreenToClient( wndPtr->hwndSelf, &ptClient ); - GetClientRect( wndPtr->hwndSelf, &rcClient ); + ScreenToClient( wndPtr->obj.handle, &ptClient ); + GetClientRect( wndPtr->obj.handle, &rcClient ); if (PtInRect( &rcClient, ptClient )) return HTCLIENT;
/* Check borders */ @@ -606,7 +606,7 @@ /* Check system menu */ if ((wndPtr->dwStyle & WS_SYSMENU) && !(wndPtr->dwExStyle & WS_EX_TOOLWINDOW)) { - if (NC_IconForWindow(wndPtr->hwndSelf)) + if (NC_IconForWindow(wndPtr->obj.handle)) rect.left += GetSystemMetrics(SM_CYCAPTION) - 1; } if (pt.x < rect.left) return HTSYSMENU;
Modified: branches/arwinss/reactos/dll/win32/user32/resource.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/resource.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/resource.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -2,7 +2,7 @@ * USER resource functions * * Copyright 1993 Robert J. Amstadt - * Copyright 1995 Alexandre Julliard + * Copyright 1995, 2009 Alexandre Julliard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,10 +26,8 @@ #include "winerror.h" #include "winternl.h" #include "winnls.h" -#include "wine/winbase16.h" -#include "wine/winuser16.h" -#include "wownt32.h" #include "wine/debug.h" +#include "user_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(resource); WINE_DECLARE_DEBUG_CHANNEL(accel); @@ -41,73 +39,39 @@ WORD key; WORD cmd; WORD pad; -} PE_ACCEL, *LPPE_ACCEL; - -/********************************************************************** - * LoadAccelerators [USER.177] - */ -#ifndef __REACTOS__ -HACCEL16 WINAPI LoadAccelerators16(HINSTANCE16 instance, LPCSTR lpTableName) -{ - HRSRC16 hRsrc; - - TRACE_(accel)("%04x %s\n", instance, debugstr_a(lpTableName) ); - - if (!(hRsrc = FindResource16( instance, lpTableName, (LPSTR)RT_ACCELERATOR ))) { - WARN_(accel)("couldn't find accelerator table resource\n"); - return 0; - } - - TRACE_(accel)("returning HACCEL 0x%x\n", hRsrc); - return LoadResource16(instance,hRsrc); -} -#endif +} PE_ACCEL; + +/* the accelerator user object */ +struct accelerator +{ + struct user_object obj; + unsigned int count; + PE_ACCEL table[1]; +}; + /********************************************************************** * LoadAcceleratorsW (USER32.@) - * The image layout seems to look like this (not 100% sure): - * 00: WORD type type of accelerator - * 02: WORD event - * 04: WORD IDval - * 06: WORD pad (to DWORD boundary) - */ -HACCEL WINAPI LoadAcceleratorsW(HINSTANCE instance,LPCWSTR lpTableName) -{ - HRSRC hRsrc; - HACCEL hMem; - HACCEL hRetval=0; - DWORD size; - - if (HIWORD(lpTableName)) - TRACE_(accel)("%p '%s'\n", instance, (const char *)( lpTableName ) ); - else - TRACE_(accel)("%p 0x%04x\n", instance, LOWORD(lpTableName) ); - - if (!(hRsrc = FindResourceW( instance, lpTableName, (LPWSTR)RT_ACCELERATOR ))) - { - WARN_(accel)("couldn't find accelerator table resource\n"); - } else { - hMem = LoadResource( instance, hRsrc ); - size = SizeofResource( instance, hRsrc ); - if(size>=sizeof(PE_ACCEL)) - { - LPPE_ACCEL accel_table = (LPPE_ACCEL) hMem; - LPACCEL accel16; - int i,nrofaccells = size/sizeof(PE_ACCEL); - - hRetval = GlobalAlloc(0,sizeof(ACCEL)*nrofaccells); - accel16 = (LPACCEL)GlobalLock(hRetval); - for (i=0;i<nrofaccells;i++) { - accel16[i].fVirt = accel_table[i].fVirt & 0x7f; - accel16[i].key = accel_table[i].key; - if( !(accel16[i].fVirt & FVIRTKEY) ) - accel16[i].key &= 0x00ff; - accel16[i].cmd = accel_table[i].cmd; - } - accel16[i-1].fVirt |= 0x80; - } - } - TRACE_(accel)("returning HACCEL %p\n", hRsrc); - return hRetval; + */ +HACCEL WINAPI LoadAcceleratorsW(HINSTANCE instance, LPCWSTR name) +{ + struct accelerator *accel; + const PE_ACCEL *table; + HRSRC rsrc; + HACCEL handle; + DWORD count; + + if (!(rsrc = FindResourceW( instance, name, (LPWSTR)RT_ACCELERATOR ))) return 0; + table = LoadResource( instance, rsrc ); + count = SizeofResource( instance, rsrc ) / sizeof(*table); + if (!count) return 0; + accel = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( struct accelerator, table[count] )); + if (!accel) return 0; + accel->count = count; + memcpy( accel->table, table, count * sizeof(*table) ); + if (!(handle = alloc_user_handle( &accel->obj, USER_ACCEL ))) + HeapFree( GetProcessHeap(), 0, accel ); + TRACE_(accel)("%p %s returning %p\n", instance, debugstr_w(name), handle ); + return handle; }
/*********************************************************************** @@ -134,165 +98,119 @@ /********************************************************************** * CopyAcceleratorTableA (USER32.@) */ -INT WINAPI CopyAcceleratorTableA(HACCEL src, LPACCEL dst, INT entries) -{ - return CopyAcceleratorTableW(src, dst, entries); +INT WINAPI CopyAcceleratorTableA(HACCEL src, LPACCEL dst, INT count) +{ + char ch; + int i, ret = CopyAcceleratorTableW( src, dst, count ); + + if (ret && dst) + { + for (i = 0; i < ret; i++) + { + if (dst[i].fVirt & FVIRTKEY) continue; + WideCharToMultiByte( CP_ACP, 0, &dst[i].key, 1, &ch, 1, NULL, NULL ); + dst[i].key = ch; + } + } + return ret; }
/********************************************************************** * CopyAcceleratorTableW (USER32.@) - * - * By mortene@pvv.org 980321 - */ -INT WINAPI CopyAcceleratorTableW(HACCEL src, LPACCEL dst, - INT entries) -{ - int i,xsize; - LPACCEL accel = (LPACCEL)GlobalLock(src); - BOOL done = FALSE; - - /* Do parameter checking to avoid the explosions and the screaming - as far as possible. */ - if((dst && (entries < 1)) || (src == NULL) || !accel) { - WARN_(accel)("Application sent invalid parameters (%p %p %d).\n", - src, dst, entries); - return 0; - } - xsize = GlobalSize(src)/sizeof(ACCEL); - if (xsize<entries) entries=xsize; - - i=0; - while(!done) { - /* Spit out some debugging information. */ - TRACE_(accel)("accel %d: type 0x%02x, event '%c', IDval 0x%04x.\n", - i, accel[i].fVirt, accel[i].key, accel[i].cmd); - - /* Copy data to the destination structure array (if dst == NULL, - we're just supposed to count the number of entries). */ - if(dst) { - dst[i].fVirt = accel[i].fVirt&0x7f; - dst[i].key = accel[i].key; - dst[i].cmd = accel[i].cmd; - - /* Check if we've reached the end of the application supplied - accelerator table. */ - if(i+1 == entries) - done = TRUE; - } - - /* The highest order bit seems to mark the end of the accelerator - resource table, but not always. Use GlobalSize() check too. */ - if((accel[i].fVirt & 0x80) != 0) done = TRUE; - - i++; - } - - return i; + */ +INT WINAPI CopyAcceleratorTableW(HACCEL src, LPACCEL dst, INT count) +{ + struct accelerator *accel; + int i; + + if (!(accel = get_user_handle_ptr( src, USER_ACCEL ))) return 0; + if (accel == OBJ_OTHER_PROCESS) + { + FIXME( "other process handle %p?\n", src ); + return 0; + } + if (dst) + { + if (count > accel->count) count = accel->count; + for (i = 0; i < count; i++) + { + dst[i].fVirt = accel->table[i].fVirt & 0x7f; + dst[i].key = accel->table[i].key; + dst[i].cmd = accel->table[i].cmd; + } + } + else count = accel->count; + release_user_handle_ptr( accel ); + return count; }
/********************************************************************* * CreateAcceleratorTableA (USER32.@) - * - * By mortene@pvv.org 980321 - */ -HACCEL WINAPI CreateAcceleratorTableA(LPACCEL lpaccel, INT cEntries) -{ - HACCEL hAccel; - LPACCEL accel; - int i; - - /* Do parameter checking just in case someone's trying to be - funny. */ - if(cEntries < 1) { - WARN_(accel)("Application sent invalid parameters (%p %d).\n", - lpaccel, cEntries); - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Allocate memory and copy the table. */ - hAccel = GlobalAlloc(0,cEntries*sizeof(ACCEL)); - - TRACE_(accel)("handle %p\n", hAccel); - if(!hAccel) { - ERR_(accel)("Out of memory.\n"); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - accel = GlobalLock(hAccel); - for (i=0;i<cEntries;i++) { - accel[i].fVirt = lpaccel[i].fVirt&0x7f; - accel[i].key = lpaccel[i].key; - if( !(accel[i].fVirt & FVIRTKEY) ) - accel[i].key &= 0x00ff; - accel[i].cmd = lpaccel[i].cmd; - } - /* Set the end-of-table terminator. */ - accel[cEntries-1].fVirt |= 0x80; - - TRACE_(accel)("Allocated accelerator handle %p with %d entries\n", hAccel,cEntries); - return hAccel; + */ +HACCEL WINAPI CreateAcceleratorTableA(LPACCEL lpaccel, INT count) +{ + struct accelerator *accel; + HACCEL handle; + int i; + + if (count < 1) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return 0; + } + accel = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( struct accelerator, table[count] )); + if (!accel) return 0; + accel->count = count; + for (i = 0; i < count; i++) + { + accel->table[i].fVirt = lpaccel[i].fVirt; + accel->table[i].cmd = lpaccel[i].cmd; + if (!(lpaccel[i].fVirt & FVIRTKEY)) + { + char ch = lpaccel[i].key; + MultiByteToWideChar( CP_ACP, 0, &ch, 1, &accel->table[i].key, 1 ); + } + else accel->table[i].key = lpaccel[i].key; + } + if (!(handle = alloc_user_handle( &accel->obj, USER_ACCEL ))) + HeapFree( GetProcessHeap(), 0, accel ); + TRACE_(accel)("returning %p\n", handle ); + return handle; }
/********************************************************************* * CreateAcceleratorTableW (USER32.@) - * - * - */ -HACCEL WINAPI CreateAcceleratorTableW(LPACCEL lpaccel, INT cEntries) -{ - HACCEL hAccel; - LPACCEL accel; - int i; - char ckey; - - /* Do parameter checking just in case someone's trying to be - funny. */ - if(cEntries < 1) { - WARN_(accel)("Application sent invalid parameters (%p %d).\n", - lpaccel, cEntries); - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Allocate memory and copy the table. */ - hAccel = GlobalAlloc(0,cEntries*sizeof(ACCEL)); - - TRACE_(accel)("handle %p\n", hAccel); - if(!hAccel) { - ERR_(accel)("Out of memory.\n"); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - accel = GlobalLock(hAccel); - - - for (i=0;i<cEntries;i++) { - accel[i].fVirt = lpaccel[i].fVirt&0x7f; - if( !(accel[i].fVirt & FVIRTKEY) ) { - ckey = (char) lpaccel[i].key; - if(!MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, &ckey, 1, &accel[i].key, 1)) - WARN_(accel)("Error converting ASCII accelerator table to Unicode\n"); - } - else - accel[i].key = lpaccel[i].key; - accel[i].cmd = lpaccel[i].cmd; - } - - /* Set the end-of-table terminator. */ - accel[cEntries-1].fVirt |= 0x80; - - TRACE_(accel)("Allocated accelerator handle %p\n", hAccel); - return hAccel; + */ +HACCEL WINAPI CreateAcceleratorTableW(LPACCEL lpaccel, INT count) +{ + struct accelerator *accel; + HACCEL handle; + int i; + + if (count < 1) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return 0; + } + accel = HeapAlloc( GetProcessHeap(), 0, FIELD_OFFSET( struct accelerator, table[count] )); + if (!accel) return 0; + accel->count = count; + for (i = 0; i < count; i++) + { + accel->table[i].fVirt = lpaccel[i].fVirt; + accel->table[i].key = lpaccel[i].key; + accel->table[i].cmd = lpaccel[i].cmd; + } + if (!(handle = alloc_user_handle( &accel->obj, USER_ACCEL ))) + HeapFree( GetProcessHeap(), 0, accel ); + TRACE_(accel)("returning %p\n", handle ); + return handle; }
/****************************************************************************** * DestroyAcceleratorTable [USER32.@] * Destroys an accelerator table * - * NOTES - * By mortene@pvv.org 980321 - * * PARAMS * handle [I] Handle to accelerator table * @@ -302,57 +220,16 @@ */ BOOL WINAPI DestroyAcceleratorTable( HACCEL handle ) { - if( !handle ) + struct accelerator *accel; + + if (!(accel = free_user_handle( handle, USER_ACCEL ))) return FALSE; + if (accel == OBJ_OTHER_PROCESS) + { + FIXME( "other process handle %p?\n", accel ); return FALSE; - return !GlobalFree(handle); -} - -/********************************************************************** - * LoadString (USER.176) - */ -#ifndef __REACTOS__ -INT16 WINAPI LoadString16( HINSTANCE16 instance, UINT16 resource_id, - LPSTR buffer, INT16 buflen ) -{ - HGLOBAL16 hmem; - HRSRC16 hrsrc; - unsigned char *p; - int string_num; - int i; - - TRACE("inst=%04x id=%04x buff=%p len=%d\n", - instance, resource_id, buffer, buflen); - - hrsrc = FindResource16( instance, MAKEINTRESOURCEA((resource_id>>4)+1), (LPSTR)RT_STRING ); - if (!hrsrc) return 0; - hmem = LoadResource16( instance, hrsrc ); - if (!hmem) return 0; - - p = LockResource16(hmem); - string_num = resource_id & 0x000f; - for (i = 0; i < string_num; i++) - p += *p + 1; - - TRACE("strlen = %d\n", (int)*p ); - - if (buffer == NULL) return *p; - i = min(buflen - 1, *p); - if (i > 0) { - memcpy(buffer, p + 1, i); - buffer[i] = '\0'; - } else { - if (buflen > 1) { - buffer[0] = '\0'; - return 0; - } - WARN("Don't know why caller gave buflen=%d *p=%d trying to obtain string '%s'\n", buflen, *p, p + 1); - } - FreeResource16( hmem ); - - TRACE("'%s' loaded !\n", buffer); - return i; -} -#endif + } + return HeapFree( GetProcessHeap(), 0, accel ); +}
/********************************************************************** * LoadStringW (USER32.@)
Modified: branches/arwinss/reactos/dll/win32/user32/resources/version.rc URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/resources/version.rc [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/resources/version.rc [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -20,8 +20,13 @@
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#define WINE_FILEVERSION_STR "1.0" #define WINE_FILEDESCRIPTION_STR "Wine core dll" #define WINE_FILENAME_STR "user32.dll"
+/* these values come from Windows XP SP2 */ +#define WINE_FILEVERSION 5,1,2600,2180 +#define WINE_FILEVERSION_STR "5.01.2600.2180" +#define WINE_PRODUCTVERSION 5,1,2600,2180 +#define WINE_PRODUCTVERSION_STR "5.01.2600.2180" + #include "wine/wine_common_ver.rc"
Modified: branches/arwinss/reactos/dll/win32/user32/static.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/static.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/static.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -148,12 +148,12 @@ static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style ) { HICON prevIcon; - CURSORICONINFO * info; + SIZE size;
if ((style & SS_TYPEMASK) != SS_ICON) return 0; - info = hicon ? GlobalLock(hicon) : NULL; - if (hicon && !info) { - WARN("hicon != 0, but info == 0\n"); + if (hicon && !get_icon_size( hicon, &size )) + { + WARN("hicon != 0, but invalid\n"); return 0; } prevIcon = (HICON)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hicon ); @@ -170,11 +170,9 @@ } else */ { - SetWindowPos( hwnd, 0, 0, 0, info->nWidth, info->nHeight, - SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER ); - } - } - if (info) GlobalUnlock(hicon); + SetWindowPos( hwnd, 0, 0, 0, size.cx, size.cy, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER ); + } + } return prevIcon; }
@@ -573,7 +571,9 @@
case STM_GETIMAGE: return (LRESULT)STATIC_GetImage( hwnd, wParam, full_style ); - + + return HICON_16(STATIC_GetImage( hwnd, IMAGE_ICON, full_style )); + case STM_GETICON: return (LRESULT)STATIC_GetImage( hwnd, IMAGE_ICON, full_style );
@@ -596,6 +596,8 @@ STATIC_TryPaintFcn( hwnd, full_style ); break;
+ wParam = (WPARAM)HICON_32( (HICON16)wParam ); + /* fall through */ case STM_SETICON: lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)wParam, full_style ); STATIC_TryPaintFcn( hwnd, full_style ); @@ -798,13 +800,12 @@ RECT rc, iconRect; HBRUSH hbrush; HICON hIcon; - CURSORICONINFO * info; + SIZE size;
GetClientRect( hwnd, &rc ); hbrush = STATIC_SendWmCtlColorStatic(hwnd, hdc); hIcon = (HICON)GetWindowLongPtrW( hwnd, HICON_GWL_OFFSET ); - info = hIcon ? GlobalLock(hIcon) : NULL; - if (!hIcon || !info) + if (!hIcon || !get_icon_size( hIcon, &size )) { FillRect(hdc, &rc, hbrush); } @@ -812,10 +813,10 @@ { if (style & SS_CENTERIMAGE) { - iconRect.left = (rc.right - rc.left) / 2 - info->nWidth / 2; - iconRect.top = (rc.bottom - rc.top) / 2 - info->nHeight / 2; - iconRect.right = iconRect.left + info->nWidth; - iconRect.bottom = iconRect.top + info->nHeight; + iconRect.left = (rc.right - rc.left) / 2 - size.cx / 2; + iconRect.top = (rc.bottom - rc.top) / 2 - size.cy / 2; + iconRect.right = iconRect.left + size.cx; + iconRect.bottom = iconRect.top + size.cy; } else iconRect = rc; @@ -823,7 +824,6 @@ DrawIconEx( hdc, iconRect.left, iconRect.top, hIcon, iconRect.right - iconRect.left, iconRect.bottom - iconRect.top, 0, NULL, DI_NORMAL ); } - if (info) GlobalUnlock(hIcon); }
static void STATIC_PaintBitmapfn(HWND hwnd, HDC hdc, DWORD style )
Modified: branches/arwinss/reactos/dll/win32/user32/uitools.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/uitools.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/uitools.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -22,8 +22,8 @@ #include <stdarg.h>
#include "windef.h" +#include "winbase.h" #include "wingdi.h" -#include "wine/winuser16.h" #include "winuser.h" #include "user_private.h" #include "wine/unicode.h" @@ -1597,7 +1597,6 @@ if(!cx || !cy) { SIZE s; - CURSORICONINFO *ici; BITMAP bm;
switch(opcode) @@ -1612,11 +1611,7 @@ break;
case DST_ICON: - ici = GlobalLock((HGLOBAL)lp); - if(!ici) return FALSE; - s.cx = ici->nWidth; - s.cy = ici->nHeight; - GlobalUnlock((HGLOBAL)lp); + if (!get_icon_size( (HICON)lp, &s )) return FALSE; break;
case DST_BITMAP:
Modified: branches/arwinss/reactos/dll/win32/user32/user_main.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/user_main.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/user_main.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -36,7 +36,6 @@
#define DESKTOP_ALL_ACCESS 0x01ff
-WORD USER_HeapSel = 0; /* USER heap selector */ HMODULE user32_module = 0;
static CRITICAL_SECTION USER_SysCrit; @@ -271,15 +270,7 @@ static BOOL process_attach(void) { #ifndef __REACTOS__ - HINSTANCE16 instance; - - /* Create USER heap */ - if ((instance = LoadLibrary16( "USER.EXE" )) >= 32) USER_HeapSel = instance | 7; - else - { - USER_HeapSel = GlobalAlloc16( GMEM_FIXED, 65536 ); - LocalInit16( USER_HeapSel, 32, 65534 ); - } + LoadLibrary16( "user.exe" );
/* some Win9x dlls expect keyboard to be loaded */ if (GetVersion() & 0x80000000) LoadLibrary16( "keyboard.drv" );
Modified: branches/arwinss/reactos/dll/win32/user32/user_private.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- 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] Sat Oct 24 15:20:16 2009 @@ -29,18 +29,8 @@ #include "winreg.h" #include "winternl.h" #include "wine/windef16.h" -#include "wine/winbase16.h"
extern WORD USER_HeapSel DECLSPEC_HIDDEN; - -#define USER_HEAP_ALLOC(size) \ - ((HANDLE)HeapAlloc( GetProcessHeap(), 0, (size) )) -#define USER_HEAP_REALLOC(handle,size) \ - ((HANDLE)HeapReAlloc( GetProcessHeap(), 0, (handle), (size) )) -#define USER_HEAP_FREE(handle) \ - HeapFree( GetProcessHeap(), 0, handle ) -#define USER_HEAP_LIN_ADDR(handle) \ - (handle)
#define GET_WORD(ptr) (*(const WORD *)(ptr)) #define GET_DWORD(ptr) (*(const DWORD *)(ptr)) @@ -136,6 +126,27 @@ struct received_message_info; struct hook16_queue_info;
+enum user_obj_type +{ + USER_WINDOW = 1, /* window */ + USER_MENU, /* menu */ + USER_ACCEL, /* accelerator */ + USER_DWP /* DeferWindowPos structure */ +}; + +struct user_object +{ + HANDLE handle; + enum user_obj_type type; +}; + +#define OBJ_OTHER_PROCESS ((void *)1) /* returned by get_user_handle_ptr on unknown handles */ + +HANDLE alloc_user_handle( struct user_object *ptr, enum user_obj_type type ) DECLSPEC_HIDDEN; +void *get_user_handle_ptr( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN; +void release_user_handle_ptr( void *ptr ) DECLSPEC_HIDDEN; +void *free_user_handle( HANDLE handle, enum user_obj_type type ) DECLSPEC_HIDDEN; + /* type of message-sending functions that need special WM_CHAR handling */ enum wm_char_mapping { @@ -319,6 +330,7 @@ #include "poppack.h"
extern void CURSORICON_FreeModuleIcons( HMODULE16 hModule ) DECLSPEC_HIDDEN; +extern BOOL get_icon_size( HICON handle, SIZE *size ) DECLSPEC_HIDDEN;
NTSYSAPI VOID
Modified: branches/arwinss/reactos/dll/win32/user32/win.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -92,6 +92,89 @@ static void *user_handles[NB_USER_HANDLES];
/*********************************************************************** + * alloc_user_handle + */ +HANDLE alloc_user_handle( struct user_object *ptr, enum user_obj_type type ) +{ + HANDLE handle = 0; + + SERVER_START_REQ( alloc_user_handle ) + { + if (!wine_server_call_err( req )) handle = wine_server_ptr_handle( reply->handle ); + } + SERVER_END_REQ; + + if (handle) + { + UINT index = USER_HANDLE_TO_INDEX( handle ); + + assert( index < NB_USER_HANDLES ); + ptr->handle = handle; + ptr->type = type; + user_handles[index] = ptr; + } + return handle; +} + + +/*********************************************************************** + * get_user_handle_ptr + */ +void *get_user_handle_ptr( HANDLE handle, enum user_obj_type type ) +{ + struct user_object *ptr; + WORD index = USER_HANDLE_TO_INDEX( handle ); + + if (index >= NB_USER_HANDLES) return NULL; + + USER_Lock(); + if ((ptr = user_handles[index])) + { + if (ptr->type == type && + ((UINT)(UINT_PTR)ptr->handle == (UINT)(UINT_PTR)handle || + !HIWORD(handle) || HIWORD(handle) == 0xffff)) + return ptr; + ptr = NULL; + } + else ptr = OBJ_OTHER_PROCESS; + USER_Unlock(); + return ptr; +} + + +/*********************************************************************** + * release_user_handle_ptr + */ +void release_user_handle_ptr( void *ptr ) +{ + USER_Unlock(); +} + + +/*********************************************************************** + * free_user_handle + */ +void *free_user_handle( HANDLE handle, enum user_obj_type type ) +{ + struct user_object *ptr; + WORD index = USER_HANDLE_TO_INDEX( handle ); + + if ((ptr = get_user_handle_ptr( handle, type )) && ptr != OBJ_OTHER_PROCESS) + { + SERVER_START_REQ( free_user_handle ) + { + req->handle = wine_server_user_handle( handle ); + if (!wine_server_call( req )) user_handles[index] = NULL; + else ptr = NULL; + } + SERVER_END_REQ; + release_user_handle_ptr( ptr ); + } + return ptr; +} + + +/*********************************************************************** * create_window_handle * * Create a window handle with the server. @@ -164,12 +247,12 @@ index = USER_HANDLE_TO_INDEX(handle); assert( index < NB_USER_HANDLES ); user_handles[index] = win; - win->hwndSelf = handle; + win->obj.handle = handle; + win->obj.type = USER_WINDOW; win->parent = full_parent; win->owner = full_owner; win->class = class; win->winproc = get_class_winproc( class ); - win->dwMagic = WND_MAGIC; win->cbWndExtra = extra_bytes; if (WINPROC_IsUnicode( win->winproc, unicode )) win->flags |= WIN_ISUNICODE; return win; @@ -181,31 +264,23 @@ * * Free a window handle. */ -static WND *free_window_handle( HWND hwnd ) -{ - WND *ptr; +static void free_window_handle( HWND hwnd ) +{ + struct user_object *ptr; WORD index = USER_HANDLE_TO_INDEX(hwnd);
- if (index >= NB_USER_HANDLES) return NULL; - USER_Lock(); - if ((ptr = user_handles[index])) + if ((ptr = get_user_handle_ptr( hwnd, USER_WINDOW )) && ptr != OBJ_OTHER_PROCESS) { SERVER_START_REQ( destroy_window ) { req->handle = wine_server_user_handle( hwnd ); - if (!wine_server_call_err( req )) - { - user_handles[index] = NULL; - ptr->dwMagic = 0; - } - else - ptr = NULL; + if (!wine_server_call_err( req )) user_handles[index] = NULL; + else ptr = NULL; } SERVER_END_REQ; - } - USER_Unlock(); - HeapFree( GetProcessHeap(), 0, ptr ); - return ptr; + release_user_handle_ptr( ptr ); + HeapFree( GetProcessHeap(), 0, ptr ); + } }
@@ -408,22 +483,12 @@ */ WND *WIN_GetPtr( HWND hwnd ) { - WND * ptr; - WORD index = USER_HANDLE_TO_INDEX(hwnd); - - if (index >= NB_USER_HANDLES) return NULL; - - USER_Lock(); - if ((ptr = user_handles[index])) - { - if (ptr->dwMagic == WND_MAGIC && - (hwnd == ptr->hwndSelf || !HIWORD(hwnd) || HIWORD(hwnd) == 0xffff)) - return ptr; - ptr = NULL; - } - else if (is_desktop_window( hwnd )) ptr = WND_DESKTOP; - else ptr = WND_OTHER_PROCESS; - USER_Unlock(); + WND *ptr; + + if ((ptr = get_user_handle_ptr( hwnd, USER_WINDOW )) == WND_OTHER_PROCESS) + { + if (is_desktop_window( hwnd )) ptr = WND_DESKTOP; + } return ptr; }
@@ -439,7 +504,7 @@ HWND ret;
if (!(ptr = WIN_GetPtr( hwnd )) || ptr == WND_OTHER_PROCESS || ptr == WND_DESKTOP) return 0; - ret = ptr->hwndSelf; + ret = ptr->obj.handle; WIN_ReleasePtr( ptr ); return ret; } @@ -456,7 +521,7 @@ HWND ret = 0;
if (!(ptr = WIN_GetPtr( hwnd )) || ptr == WND_OTHER_PROCESS || ptr == WND_DESKTOP) return 0; - if (ptr->tid == GetCurrentThreadId()) ret = ptr->hwndSelf; + if (ptr->tid == GetCurrentThreadId()) ret = ptr->obj.handle; WIN_ReleasePtr( ptr ); return ret; } @@ -486,7 +551,7 @@
if (ptr != WND_OTHER_PROCESS) { - hwnd = ptr->hwndSelf; + hwnd = ptr->obj.handle; WIN_ReleasePtr( ptr ); } else /* may belong to another process */ @@ -593,7 +658,11 @@ WND *win = WIN_GetPtr( hwnd ); BOOL ret = TRUE;
- if (!win) return FALSE; + if (!win) + { + SetLastError( ERROR_INVALID_WINDOW_HANDLE ); + return FALSE; + } if (win == WND_DESKTOP) { RECT rect; @@ -616,7 +685,7 @@ SERVER_START_REQ( get_window_rectangles ) { req->handle = wine_server_user_handle( hwnd ); - if ((ret = !wine_server_call( req ))) + if ((ret = !wine_server_call_err( req ))) { if (rectWindow) { @@ -697,6 +766,8 @@ free_dce( wndPtr->dce, hwnd ); wndPtr->dce = NULL; icon_title = wndPtr->icon_title; + HeapFree(GetProcessHeap(), 0, wndPtr->pScroll); + wndPtr->pScroll = NULL; WIN_ReleasePtr( wndPtr );
if (icon_title) DestroyWindow( icon_title ); @@ -746,7 +817,6 @@ sys_menu = wndPtr->hSysMenu; free_dce( wndPtr->dce, hwnd ); user_handles[index] = NULL; - wndPtr->dwMagic = 0; } USER_Unlock();
@@ -1133,7 +1203,7 @@
if (!(wndPtr = create_window_handle( parent, owner, className, cs->hInstance, unicode ))) return 0; - hwnd = wndPtr->hwndSelf; + hwnd = wndPtr->obj.handle;
/* Fill the window structure */
@@ -3080,6 +3150,7 @@ { HWND *list; int i; + BOOL ret = TRUE;
USER_CheckNotLock();
@@ -3088,9 +3159,9 @@ /* Now call the callback function for every window */
for (i = 0; list[i]; i++) - if (!func( list[i], lParam )) break; + if (!(ret = func( list[i], lParam ))) break; HeapFree( GetProcessHeap(), 0, list ); - return TRUE; + return ret; }
@@ -3221,7 +3292,7 @@
wndPtr = WIN_GetPtr(hWnd); if (!wndPtr || wndPtr == WND_OTHER_PROCESS || wndPtr == WND_DESKTOP) return FALSE; - hWnd = wndPtr->hwndSelf; /* make it a full handle */ + hWnd = wndPtr->obj.handle; /* make it a full handle */
if (bInvert) wparam = !(wndPtr->flags & WIN_NCACTIVATED); else wparam = (hWnd == GetForegroundWindow());
Modified: branches/arwinss/reactos/dll/win32/user32/win.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/win.h [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/win.h [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -28,20 +28,19 @@ #include <winuser.h> #include <wine/windef16.h>
-#define WND_MAGIC 0x444e4957 /* 'WIND' */ +#include "user_private.h"
struct tagCLASS; struct tagDIALOGINFO;
typedef struct tagWND { - HWND hwndSelf; /* Handle of this window */ + struct user_object obj; /* object header */ HWND parent; /* Window parent */ HWND owner; /* Window owner */ struct tagCLASS *class; /* Window class */ struct dce *dce; /* DCE pointer */ WNDPROC winproc; /* Window procedure */ - DWORD dwMagic; /* Magic number (must be WND_MAGIC) */ DWORD tid; /* Owner thread id */ HINSTANCE hInstance; /* Window hInstance (from CreateWindow) */ RECT rectClient; /* Client area rel. to parent client area */
Modified: branches/arwinss/reactos/dll/win32/user32/winpos.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/winpos.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/winpos.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -69,17 +69,13 @@ #define PLACE_MAX 0x0002 #define PLACE_RECT 0x0004
- -#define DWP_MAGIC ((INT)('W' | ('P' << 8) | ('O' << 16) | ('S' << 24))) - typedef struct { + struct user_object obj; INT actualCount; INT suggestedCount; - BOOL valid; - INT wMagic; HWND hwndParent; - WINDOWPOS winPos[1]; + WINDOWPOS *winPos; } DWP;
@@ -1795,7 +1791,7 @@ SetLastError( ERROR_INVALID_WINDOW_HANDLE ); return FALSE; } - winpos->hwnd = wndPtr->hwndSelf; /* make it a full handle */ + winpos->hwnd = wndPtr->obj.handle; /* make it a full handle */
/* Finally make sure that all coordinates are valid */ if (winpos->x < -32768) winpos->x = -32768; @@ -2074,7 +2070,7 @@ */ HDWP WINAPI BeginDeferWindowPos( INT count ) { - HDWP handle; + HDWP handle = 0; DWP *pDWP;
TRACE("%d\n", count); @@ -2087,14 +2083,18 @@ /* Windows allows zero count, in which case it allocates context for 8 moves */ if (count == 0) count = 8;
- handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) ); - if (!handle) return 0; - pDWP = USER_HEAP_LIN_ADDR( handle ); + if (!(pDWP = HeapAlloc( GetProcessHeap(), 0, sizeof(DWP)))) return 0; + pDWP->actualCount = 0; pDWP->suggestedCount = count; - pDWP->valid = TRUE; - pDWP->wMagic = DWP_MAGIC; pDWP->hwndParent = 0; + + if (!(pDWP->winPos = HeapAlloc( GetProcessHeap(), 0, count * sizeof(WINDOWPOS) )) || + !(handle = alloc_user_handle( &pDWP->obj, USER_DWP ))) + { + HeapFree( GetProcessHeap(), 0, pDWP->winPos ); + HeapFree( GetProcessHeap(), 0, pDWP ); + }
TRACE("returning hdwp %p\n", handle); return handle; @@ -2110,7 +2110,7 @@ { DWP *pDWP; int i; - HDWP newhdwp = hdwp,retvalue; + HDWP retvalue = hdwp;
TRACE("hdwp %p, hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n", hdwp, hwnd, hwndAfter, x, y, cx, cy, flags); @@ -2118,9 +2118,12 @@ hwnd = WIN_GetFullHandle( hwnd ); if (is_desktop_window( hwnd )) return 0;
- if (!(pDWP = USER_HEAP_LIN_ADDR( hdwp ))) return 0; - - USER_Lock(); + if (!(pDWP = get_user_handle_ptr( hdwp, USER_DWP ))) return 0; + if (pDWP == OBJ_OTHER_PROCESS) + { + FIXME( "other process handle %p?\n", hdwp ); + return 0; + }
for (i = 0; i < pDWP->actualCount; i++) { @@ -2147,21 +2150,20 @@ SWP_NOOWNERZORDER); pDWP->winPos[i].flags |= flags & (SWP_SHOWWINDOW | SWP_HIDEWINDOW | SWP_FRAMECHANGED); - retvalue = hdwp; goto END; } } if (pDWP->actualCount >= pDWP->suggestedCount) { - newhdwp = USER_HEAP_REALLOC( hdwp, - sizeof(DWP) + pDWP->suggestedCount*sizeof(WINDOWPOS) ); - if (!newhdwp) + WINDOWPOS *newpos = HeapReAlloc( GetProcessHeap(), 0, pDWP->winPos, + pDWP->suggestedCount * 2 * sizeof(WINDOWPOS) ); + if (!newpos) { retvalue = 0; goto END; } - pDWP = USER_HEAP_LIN_ADDR( newhdwp ); - pDWP->suggestedCount++; + pDWP->suggestedCount *= 2; + pDWP->winPos = newpos; } pDWP->winPos[pDWP->actualCount].hwnd = hwnd; pDWP->winPos[pDWP->actualCount].hwndInsertAfter = hwndAfter; @@ -2171,9 +2173,8 @@ pDWP->winPos[pDWP->actualCount].cy = cy; pDWP->winPos[pDWP->actualCount].flags = flags; pDWP->actualCount++; - retvalue = newhdwp; END: - USER_Unlock(); + release_user_handle_ptr( pDWP ); return retvalue; }
@@ -2190,8 +2191,13 @@
TRACE("%p\n", hdwp);
- pDWP = USER_HEAP_LIN_ADDR( hdwp ); - if (!pDWP) return FALSE; + if (!(pDWP = free_user_handle( hdwp, USER_DWP ))) return FALSE; + if (pDWP == OBJ_OTHER_PROCESS) + { + FIXME( "other process handle %p?\n", hdwp ); + return FALSE; + } + for (i = 0, winpos = pDWP->winPos; res && i < pDWP->actualCount; i++, winpos++) { TRACE("hwnd %p, after %p, %d,%d (%dx%d), flags %08x\n", @@ -2203,7 +2209,8 @@ else res = SendMessageW( winpos->hwnd, WM_WINE_SETWINDOWPOS, 0, (LPARAM)winpos ); } - USER_HEAP_FREE( hdwp ); + HeapFree( GetProcessHeap(), 0, pDWP->winPos ); + HeapFree( GetProcessHeap(), 0, pDWP ); return res; }
Propchange: branches/arwinss/reactos/dll/win32/winex11.drv/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Oct 24 15:20:16 2009 @@ -1,3 +1,3 @@ /branches/ros-amd64-bringup/reactos/dll/win32/winex11.drv:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080 /trunk/reactos/dll/win32/winex11.drv:42000-43670 -/vendor/wine/dlls/winex11.drv/current:43149,43398 +/vendor/wine/dlls/winex11.drv/current:43149,43398,43708
Modified: branches/arwinss/reactos/dll/win32/winex11.drv/event.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex1... ============================================================================== --- branches/arwinss/reactos/dll/win32/winex11.drv/event.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winex11.drv/event.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -464,6 +464,7 @@ if (!(style & WS_VISIBLE)) return FALSE; if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE; if (style & WS_MINIMIZE) return FALSE; + if (GetWindowLongW( hwnd, GWL_EXSTYLE ) & WS_EX_NOACTIVATE) return FALSE; if (hwnd == GetDesktopWindow()) return FALSE; return !(style & WS_DISABLED); }
Modified: branches/arwinss/reactos/dll/win32/winex11.drv/graphics.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex1... ============================================================================== --- branches/arwinss/reactos/dll/win32/winex11.drv/graphics.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winex11.drv/graphics.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -166,6 +166,9 @@ XSetClipRectangles( gdi_display, physDev->gc, physDev->dc_rect.left, physDev->dc_rect.top, (XRectangle *)data->Buffer, data->rdh.nCount, YXBanded ); wine_tsx11_unlock(); + + if (physDev->xrender) X11DRV_XRender_SetDeviceClipping(physDev, data); + HeapFree( GetProcessHeap(), 0, data ); }
Modified: branches/arwinss/reactos/dll/win32/winex11.drv/keyboard.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex1... ============================================================================== --- branches/arwinss/reactos/dll/win32/winex11.drv/keyboard.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winex11.drv/keyboard.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -1198,9 +1198,10 @@ if (event_flags & KEYEVENTF_KEYUP) { message = WM_KEYUP; - if ((key_state_table[VK_MENU] & 0x80) && - ((wVkStripped == VK_MENU) || (wVkStripped == VK_CONTROL) - || !(key_state_table[VK_CONTROL] & 0x80))) + if (((key_state_table[VK_MENU] & 0x80) && + ((wVkStripped == VK_MENU) || (wVkStripped == VK_CONTROL) + || !(key_state_table[VK_CONTROL] & 0x80))) + || (wVkStripped == VK_F10)) { if( TrackSysKey == VK_MENU || /* <ALT>-down/<ALT>-up sequence */ (wVkStripped != VK_MENU)) /* <ALT>-down...<something else>-up */ @@ -1212,8 +1213,9 @@ else { message = WM_KEYDOWN; - if ((key_state_table[VK_MENU] & 0x80 || wVkStripped == VK_MENU) && - !(key_state_table[VK_CONTROL] & 0x80 || wVkStripped == VK_CONTROL)) + if (((key_state_table[VK_MENU] & 0x80 || wVkStripped == VK_MENU) && + !(key_state_table[VK_CONTROL] & 0x80 || wVkStripped == VK_CONTROL)) || + (wVkStripped == VK_F10)) { message = WM_SYSKEYDOWN; TrackSysKey = wVkStripped;
Modified: branches/arwinss/reactos/dll/win32/winex11.drv/opengl.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex1... ============================================================================== --- branches/arwinss/reactos/dll/win32/winex11.drv/opengl.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winex11.drv/opengl.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -906,7 +906,10 @@ * with a depth of 32 in addition to the default 24 bit. In order to prevent BadMatch errors we only * list formats with the same depth. */ if(visinfo->depth != screen_depth) + { + XFree(visinfo); continue; + }
TRACE("Found onscreen format FBCONFIG_ID 0x%x corresponding to iPixelFormat %d at GLX index %d\n", fmt_id, size+1, i); list[size].iPixelFormat = size+1; /* The index starts at 1 */ @@ -931,8 +934,6 @@ size++; onscreen_size++; } - - XFree(visinfo); } else if(run && !visinfo) { TRACE("Found offscreen format FBCONFIG_ID 0x%x corresponding to iPixelFormat %d at GLX index %d\n", fmt_id, size+1, i); list[size].iPixelFormat = size+1; /* The index starts at 1 */ @@ -943,6 +944,8 @@ list[size].dwFlags = 0; size++; } + + if (visinfo) XFree(visinfo); } }
Modified: branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex1... ============================================================================== --- branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -281,6 +281,7 @@ extern void X11DRV_XRender_Init(void); extern void X11DRV_XRender_Finalize(void); extern BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE*, HFONT); +extern void X11DRV_XRender_SetDeviceClipping(X11DRV_PDEVICE *physDev, const RGNDATA *data); extern void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE*); extern void X11DRV_XRender_CopyBrush(X11DRV_PDEVICE *physDev, X_PHYSBITMAP *physBitmap, int width, int height); extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
Modified: branches/arwinss/reactos/dll/win32/winex11.drv/xrender.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex1... ============================================================================== --- branches/arwinss/reactos/dll/win32/winex11.drv/xrender.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winex11.drv/xrender.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -124,7 +124,7 @@ typedef struct { GlyphSet glyphset; - WineXRenderFormat *font_format; + const WineXRenderFormat *font_format; int nrealized; BOOL *realized; void **bitmaps; @@ -144,8 +144,9 @@ { int cache_index; Picture pict; + Picture pict_src; + const WineXRenderFormat *format; }; -
static gsCacheEntry *glyphsetCache = NULL; static DWORD glyphsetCacheSize = 0; @@ -206,23 +207,6 @@ #define get_be_word(x) RtlUshortByteSwap(x) #define NATIVE_BYTE_ORDER LSBFirst #endif - -static struct xrender_info *get_xrender_info(X11DRV_PDEVICE *physDev) -{ - if(!physDev->xrender) - { - physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev->xrender)); - - if(!physDev->xrender) - { - ERR("Unable to allocate XRENDERINFO!\n"); - return NULL; - } - physDev->xrender->cache_index = -1; - } - - return physDev->xrender; -}
static BOOL get_xrender_template(const WineXRenderFormatTemplate *fmt, XRenderPictFormat *templ, unsigned long *mask) { @@ -409,7 +393,7 @@ }
/* Helper function to convert from a color packed in a 32-bit integer to a XRenderColor */ -static void get_xrender_color(WineXRenderFormat *wxr_format, int src_color, XRenderColor *dst_color) +static void get_xrender_color(const WineXRenderFormat *wxr_format, int src_color, XRenderColor *dst_color) { XRenderPictFormat *pf = wxr_format->pict_format;
@@ -431,7 +415,7 @@ dst_color->alpha = 0xffff; }
-static WineXRenderFormat *get_xrender_format(WXRFormat format) +static const WineXRenderFormat *get_xrender_format(WXRFormat format) { int i; for(i=0; i<WineXRenderFormatsListSize; i++) @@ -445,7 +429,7 @@ return NULL; }
-static WineXRenderFormat *get_xrender_format_from_color_shifts(int depth, ColorShifts *shifts) +static const WineXRenderFormat *get_xrender_format_from_color_shifts(int depth, ColorShifts *shifts) { int redMask, greenMask, blueMask; unsigned int i; @@ -480,6 +464,86 @@ /* This should not happen because when we reach 'shifts' must have been set and we only allows shifts which are backed by X */ ERR("No XRender format found!\n"); return NULL; +} + +/* Set the x/y scaling and x/y offsets in the transformation matrix of the source picture */ +static void set_xrender_transformation(Picture src_pict, float xscale, float yscale, int xoffset, int yoffset) +{ +#ifdef HAVE_XRENDERSETPICTURETRANSFORM + XTransform xform = {{ + { XDoubleToFixed(xscale), XDoubleToFixed(0), XDoubleToFixed(xoffset) }, + { XDoubleToFixed(0), XDoubleToFixed(yscale), XDoubleToFixed(yoffset) }, + { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(1) } + }}; + + pXRenderSetPictureTransform(gdi_display, src_pict, &xform); +#endif +} + +static struct xrender_info *get_xrender_info(X11DRV_PDEVICE *physDev) +{ + if(!physDev->xrender) + { + physDev->xrender = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev->xrender)); + + if(!physDev->xrender) + { + ERR("Unable to allocate XRENDERINFO!\n"); + return NULL; + } + physDev->xrender->cache_index = -1; + } + if (!physDev->xrender->format) + physDev->xrender->format = get_xrender_format_from_color_shifts(physDev->depth, physDev->color_shifts); + + return physDev->xrender; +} + +static Picture get_xrender_picture(X11DRV_PDEVICE *physDev) +{ + struct xrender_info *info = get_xrender_info(physDev); + if (!info) return 0; + + if (!info->pict && info->format) + { + XRenderPictureAttributes pa; + RGNDATA *clip = X11DRV_GetRegionData( physDev->region, 0 ); + + wine_tsx11_lock(); + pa.subwindow_mode = IncludeInferiors; + info->pict = pXRenderCreatePicture(gdi_display, physDev->drawable, info->format->pict_format, + CPSubwindowMode, &pa); + if (info->pict && clip) + pXRenderSetPictureClipRectangles( gdi_display, info->pict, + physDev->dc_rect.left, physDev->dc_rect.top, + (XRectangle *)clip->Buffer, clip->rdh.nCount ); + wine_tsx11_unlock(); + TRACE("Allocing pict=%lx dc=%p drawable=%08lx\n", info->pict, physDev->hdc, physDev->drawable); + HeapFree( GetProcessHeap(), 0, clip ); + } + + return info->pict; +} + +static Picture get_xrender_picture_source(X11DRV_PDEVICE *physDev) +{ + struct xrender_info *info = get_xrender_info(physDev); + if (!info) return 0; + + if (!info->pict_src && info->format) + { + XRenderPictureAttributes pa; + + wine_tsx11_lock(); + pa.subwindow_mode = IncludeInferiors; + info->pict_src = pXRenderCreatePicture(gdi_display, physDev->drawable, info->format->pict_format, + CPSubwindowMode, &pa); + wine_tsx11_unlock(); + + TRACE("Allocing pict_src=%lx dc=%p drawable=%08lx\n", info->pict_src, physDev->hdc, physDev->drawable); + } + + return info->pict_src; }
static BOOL fontcmp(LFANDSIZE *p1, LFANDSIZE *p2) @@ -836,6 +900,21 @@ }
/*********************************************************************** +* X11DRV_XRender_SetDeviceClipping +*/ +void X11DRV_XRender_SetDeviceClipping(X11DRV_PDEVICE *physDev, const RGNDATA *data) +{ + if (physDev->xrender->pict) + { + wine_tsx11_lock(); + pXRenderSetPictureClipRectangles( gdi_display, physDev->xrender->pict, + physDev->dc_rect.left, physDev->dc_rect.top, + (XRectangle *)data->Buffer, data->rdh.nCount ); + wine_tsx11_unlock(); + } +} + +/*********************************************************************** * X11DRV_XRender_DeleteDC */ void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE *physDev) @@ -854,7 +933,7 @@
BOOL X11DRV_XRender_SetPhysBitmapDepth(X_PHYSBITMAP *physBitmap, const DIBSECTION *dib) { - WineXRenderFormat *fmt; + const WineXRenderFormat *fmt; ColorShifts shifts;
/* When XRender is not around we can only use the screen_depth and when needed we perform depth conversion @@ -886,18 +965,28 @@ */ void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev) { - wine_tsx11_lock(); - - if(physDev->xrender->pict) - { - TRACE("freeing pict = %lx dc = %p\n", physDev->xrender->pict, physDev->hdc); - XFlush(gdi_display); - pXRenderFreePicture(gdi_display, physDev->xrender->pict); - physDev->xrender->pict = 0; - } - wine_tsx11_unlock(); - - return; + struct xrender_info *info = physDev->xrender; + + if (info->pict || info->pict_src) + { + wine_tsx11_lock(); + XFlush( gdi_display ); + if (info->pict) + { + TRACE("freeing pict = %lx dc = %p\n", info->pict, physDev->hdc); + pXRenderFreePicture(gdi_display, info->pict); + info->pict = 0; + } + if(info->pict_src) + { + TRACE("freeing pict = %lx dc = %p\n", info->pict_src, physDev->hdc); + pXRenderFreePicture(gdi_display, info->pict_src); + info->pict_src = 0; + } + wine_tsx11_unlock(); + } + + info->format = NULL; }
/************************************************************************ @@ -1369,7 +1458,7 @@ * Returns an appropriate Picture for tiling the text colour. * Call and use result within the xrender_cs */ -static Picture get_tile_pict(WineXRenderFormat *wxr_format, int text_pixel) +static Picture get_tile_pict(const WineXRenderFormat *wxr_format, int text_pixel) { static struct { @@ -1429,12 +1518,10 @@ const RECT *lprect, LPCWSTR wstr, UINT count, const INT *lpDx ) { - RGNDATA *data; XGCValues xgcval; gsCacheEntry *entry; gsCacheEntryFormat *formatEntry; BOOL retv = FALSE; - HDC hdc = physDev->hdc; int textPixel, backgroundPixel; HRGN saved_region = 0; BOOL disable_antialias = FALSE; @@ -1443,7 +1530,7 @@ unsigned int idx; double cosEsc, sinEsc; LOGFONTW lf; - WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDev->depth, physDev->color_shifts); + const WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDev->depth, physDev->color_shifts); Picture tile_pict = 0;
/* Do we need to disable antialiasing because of palette mode? */ @@ -1515,35 +1602,6 @@ DeleteObject( clip_region ); }
- if(X11DRV_XRender_Installed) { - if(!physDev->xrender->pict) { - XRenderPictureAttributes pa; - pa.subwindow_mode = IncludeInferiors; - - wine_tsx11_lock(); - physDev->xrender->pict = pXRenderCreatePicture(gdi_display, - physDev->drawable, dst_format->pict_format, - CPSubwindowMode, &pa); - wine_tsx11_unlock(); - - TRACE("allocing pict = %lx dc = %p drawable = %08lx\n", - physDev->xrender->pict, hdc, physDev->drawable); - } else { - TRACE("using existing pict = %lx dc = %p drawable = %08lx\n", - physDev->xrender->pict, hdc, physDev->drawable); - } - - if ((data = X11DRV_GetRegionData( physDev->region, 0 ))) - { - wine_tsx11_lock(); - pXRenderSetPictureClipRectangles( gdi_display, physDev->xrender->pict, - physDev->dc_rect.left, physDev->dc_rect.top, - (XRectangle *)data->Buffer, data->rdh.nCount ); - wine_tsx11_unlock(); - HeapFree( GetProcessHeap(), 0, data ); - } - } - EnterCriticalSection(&xrender_cs);
entry = glyphsetCache + physDev->xrender->cache_index; @@ -1578,6 +1636,7 @@ INT offset = 0; POINT desired, current; int render_op = PictOpOver; + Picture pict = get_xrender_picture(physDev);
/* There's a bug in XRenderCompositeText that ignores the xDst and yDst parameters. So we pass zeros to the function and move to our starting position using the first @@ -1618,9 +1677,11 @@ } } wine_tsx11_lock(); + /* Make sure we don't have any transforms set from a previous call */ + set_xrender_transformation(pict, 1, 1, 0, 0); pXRenderCompositeText16(gdi_display, render_op, tile_pict, - physDev->xrender->pict, + pict, formatEntry->font_format->pict_format, 0, 0, 0, 0, elts, count); wine_tsx11_unlock(); @@ -1781,20 +1842,6 @@ return retv; }
-/* Set the x/y scaling and x/y offsets in the transformation matrix of the source picture */ -static void set_xrender_transformation(Picture src_pict, float xscale, float yscale, int xoffset, int yoffset) -{ -#ifdef HAVE_XRENDERSETPICTURETRANSFORM - XTransform xform = {{ - { XDoubleToFixed(xscale), XDoubleToFixed(0), XDoubleToFixed(xoffset) }, - { XDoubleToFixed(0), XDoubleToFixed(yscale), XDoubleToFixed(yoffset) }, - { XDoubleToFixed(0), XDoubleToFixed(0), XDoubleToFixed(1) } - }}; - - pXRenderSetPictureTransform(gdi_display, src_pict, &xform); -#endif -} - /* Helper function for (stretched) blitting using xrender */ static void xrender_blit(Picture src_pict, Picture mask_pict, Picture dst_pict, int x_src, int y_src, float xscale, float yscale, int width, int height) { @@ -1848,9 +1895,7 @@ int y, y2; POINT pts[2]; BOOL top_down = FALSE; - RGNDATA *rgndata; - WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(devDst->depth, devDst->color_shifts); - WineXRenderFormat *src_format; + const WineXRenderFormat *src_format; int repeat_src;
if(!X11DRV_XRender_Installed) { @@ -1961,7 +2006,7 @@
}
- rgndata = X11DRV_GetRegionData( devDst->region, 0 ); + dst_pict = get_xrender_picture(devDst);
wine_tsx11_lock(); image = XCreateImage(gdi_display, visual, 32, ZPixmap, 0, @@ -1975,15 +2020,6 @@ return FALSE; }
- pa.subwindow_mode = IncludeInferiors; - pa.repeat = repeat_src ? RepeatNormal : RepeatNone; - - /* FIXME use devDst->xrender->pict ? */ - dst_pict = pXRenderCreatePicture(gdi_display, - devDst->drawable, - dst_format->pict_format, - CPSubwindowMode, &pa); - TRACE("dst_pict %08lx\n", dst_pict); TRACE("src_drawable = %08lx\n", devSrc->drawable); xpm = XCreatePixmap(gdi_display, root_window, @@ -1993,19 +2029,12 @@ TRACE("xpm = %08lx\n", xpm); XPutImage(gdi_display, xpm, gc, image, 0, 0, 0, 0, widthSrc, heightSrc);
+ pa.subwindow_mode = IncludeInferiors; + pa.repeat = repeat_src ? RepeatNormal : RepeatNone; src_pict = pXRenderCreatePicture(gdi_display, xpm, src_format->pict_format, CPSubwindowMode|CPRepeat, &pa); TRACE("src_pict %08lx\n", src_pict); - - if (rgndata) - { - pXRenderSetPictureClipRectangles( gdi_display, dst_pict, - devDst->dc_rect.left, devDst->dc_rect.top, - (XRectangle *)rgndata->Buffer, - rgndata->rdh.nCount ); - HeapFree( GetProcessHeap(), 0, rgndata ); - }
/* Make sure we ALWAYS set the transformation matrix even if we don't need to scale. The reason is * that later on we want to reuse pictures (it can bring a lot of extra performance) and each time @@ -2022,7 +2051,6 @@ pXRenderFreePicture(gdi_display, src_pict); XFreePixmap(gdi_display, xpm); XFreeGC(gdi_display, gc); - pXRenderFreePicture(gdi_display, dst_pict); image->data = NULL; XDestroyImage(image);
@@ -2047,8 +2075,8 @@ } else /* We meed depth conversion */ { - WineXRenderFormat *src_format = get_xrender_format_from_color_shifts(physBitmap->pixmap_depth, &physBitmap->pixmap_color_shifts); - WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDev->depth, physDev->color_shifts); + const WineXRenderFormat *src_format = get_xrender_format_from_color_shifts(physBitmap->pixmap_depth, &physBitmap->pixmap_color_shifts); + const WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDev->depth, physDev->color_shifts);
Picture src_pict, dst_pict; XRenderPictureAttributes pa; @@ -2076,8 +2104,7 @@ int height = visRectDst->bottom - visRectDst->top; int x_src = physDevSrc->dc_rect.left + visRectSrc->left; int y_src = physDevSrc->dc_rect.top + visRectSrc->top; - WineXRenderFormat *src_format = get_xrender_format_from_color_shifts(physDevSrc->depth, physDevSrc->color_shifts); - WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDevDst->depth, physDevDst->color_shifts); + const WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDevDst->depth, physDevDst->color_shifts); Picture src_pict=0, dst_pict=0, mask_pict=0;
double xscale = widthSrc/(double)widthDst; @@ -2121,36 +2148,34 @@ get_xrender_color(dst_format, physDevDst->textPixel, &col);
/* We use the source drawable as a mask */ + mask_pict = get_xrender_picture_source(physDevSrc); + + /* Use backgroundPixel as the foreground color */ + EnterCriticalSection( &xrender_cs ); + src_pict = get_tile_pict(dst_format, physDevDst->backgroundPixel); + + /* Create a destination picture and fill it with textPixel color as the background color */ wine_tsx11_lock(); - mask_pict = pXRenderCreatePicture(gdi_display, physDevSrc->drawable, src_format->pict_format, CPSubwindowMode|CPRepeat, &pa); - - /* Use backgroundPixel as the foreground color */ - src_pict = get_tile_pict(dst_format, physDevDst->backgroundPixel); - - /* Create a destination picture and fill it with textPixel color as the background color */ dst_pict = pXRenderCreatePicture(gdi_display, pixmap, dst_format->pict_format, CPSubwindowMode|CPRepeat, &pa); pXRenderFillRectangle(gdi_display, PictOpSrc, dst_pict, &col, 0, 0, width, height);
xrender_blit(src_pict, mask_pict, dst_pict, x_src, y_src, xscale, yscale, width, height);
if(dst_pict) pXRenderFreePicture(gdi_display, dst_pict); - if(mask_pict) pXRenderFreePicture(gdi_display, mask_pict); wine_tsx11_unlock(); + LeaveCriticalSection( &xrender_cs ); } else /* color -> color but with different depths */ { + src_pict = get_xrender_picture_source(physDevSrc); + wine_tsx11_lock(); - src_pict = pXRenderCreatePicture(gdi_display, - physDevSrc->drawable, src_format->pict_format, - CPSubwindowMode|CPRepeat, &pa); - dst_pict = pXRenderCreatePicture(gdi_display, pixmap, dst_format->pict_format, CPSubwindowMode|CPRepeat, &pa);
xrender_blit(src_pict, 0, dst_pict, x_src, y_src, xscale, yscale, width, height);
- if(src_pict) pXRenderFreePicture(gdi_display, src_pict); if(dst_pict) pXRenderFreePicture(gdi_display, dst_pict); wine_tsx11_unlock(); } @@ -2179,6 +2204,12 @@ { assert(0); return; +} + +void X11DRV_XRender_SetDeviceClipping(X11DRV_PDEVICE *physDev, const RGNDATA *data) +{ + assert(0); + return; }
BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
Modified: branches/arwinss/reactos/include/reactos/wine/config.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/reactos/... ============================================================================== --- branches/arwinss/reactos/include/reactos/wine/config.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/reactos/wine/config.h [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -4,6 +4,9 @@ #include "reactos/buildno.h"
#define __WINE_CONFIG_H + +/* Define to a function attribute for Microsoft hotpatch assembly prefix. */ +#define DECLSPEC_HOTPATCH
/* Specifies the compiler flag that forces a short wchar_t */ #define CC_FLAG_SHORT_WCHAR "-fshort-wchar"
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] Sat Oct 24 15:20:16 2009 @@ -112,8 +112,8 @@ struct { int code; + data_size_t length; client_ptr_t string; - data_size_t length; } output_string; struct { @@ -4606,6 +4606,31 @@ char __pad_28[4]; }; struct set_window_layered_info_reply +{ + struct reply_header __header; +}; + + + +struct alloc_user_handle_request +{ + struct request_header __header; +}; +struct alloc_user_handle_reply +{ + struct reply_header __header; + user_handle_t handle; + char __pad_12[4]; +}; + + + +struct free_user_handle_request +{ + struct request_header __header; + user_handle_t handle; +}; +struct free_user_handle_reply { struct reply_header __header; }; @@ -4851,6 +4876,8 @@ REQ_add_fd_completion, REQ_get_window_layered_info, REQ_set_window_layered_info, + REQ_alloc_user_handle, + REQ_free_user_handle, REQ_NB_REQUESTS };
@@ -5096,6 +5123,8 @@ struct add_fd_completion_request add_fd_completion_request; struct get_window_layered_info_request get_window_layered_info_request; 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; }; union generic_reply { @@ -5339,8 +5368,10 @@ struct add_fd_completion_reply add_fd_completion_reply; struct get_window_layered_info_reply get_window_layered_info_reply; struct set_window_layered_info_reply set_window_layered_info_reply; -}; - -#define SERVER_PROTOCOL_VERSION 391 + struct alloc_user_handle_reply alloc_user_handle_reply; + struct free_user_handle_reply free_user_handle_reply; +}; + +#define SERVER_PROTOCOL_VERSION 392
#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/win32... ============================================================================== --- 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] Sat Oct 24 15:20:16 2009 @@ -310,6 +310,8 @@ DECL_HANDLER(add_fd_completion); DECL_HANDLER(get_window_layered_info); DECL_HANDLER(set_window_layered_info); +DECL_HANDLER(alloc_user_handle); +DECL_HANDLER(free_user_handle);
#ifdef WANT_REQUEST_HANDLERS
@@ -554,6 +556,8 @@ (req_handler)req_add_fd_completion, (req_handler)req_get_window_layered_info, (req_handler)req_set_window_layered_info, + (req_handler)req_alloc_user_handle, + (req_handler)req_free_user_handle, };
#if 0 @@ -1854,6 +1858,10 @@ C_ASSERT( FIELD_OFFSET(struct set_window_layered_info_request, alpha) == 20 ); C_ASSERT( FIELD_OFFSET(struct set_window_layered_info_request, flags) == 24 ); C_ASSERT( sizeof(struct set_window_layered_info_request) == 32 ); +C_ASSERT( FIELD_OFFSET(struct alloc_user_handle_reply, handle) == 8 ); +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 ); #endif #endif /* WANT_REQUEST_HANDLERS */
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/include/request.h ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Oct 24 15:20:16 2009 @@ -1,3 +1,3 @@ /branches/ros-amd64-bringup/reactos/subsystems/win32/win32k/include/request.h: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/include/request.h:42000-43670 -/vendor/wine/server/current/request.h:43136,43398 +/vendor/wine/server/current/request.h:43136,43398,43708
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/user.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/user.h [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -36,7 +36,7 @@ { USER_WINDOW = 1, USER_HOOK, - USER_MONITOR + USER_CLIENT /* arbitrary client handle */ };
#define DESKTOP_ATOM ((atom_t)32769) @@ -72,6 +72,7 @@ extern user_handle_t get_user_full_handle( user_handle_t handle ); extern void *free_user_handle( user_handle_t handle ); extern void *next_user_handle( user_handle_t *handle, enum user_object type ); +extern void free_process_user_handles( PPROCESSINFO process );
/* clipboard functions */
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/include/user.h ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Sat Oct 24 15:20:16 2009 @@ -1,0 +1,3 @@ +/branches/ros-amd64-bringup/reactos/subsystems/win32/win32k/include/user.h: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/include/user.h:42000-43126 +/vendor/wine/server/current/user.h:43708
Modified: branches/arwinss/reactos/subsystems/win32/win32k/main/monitor.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/main/monitor.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/main/monitor.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -61,7 +61,7 @@ }
RtlZeroMemory(Monitor, sizeof (MONITOR)); - Monitor->Handle = (HANDLE)alloc_user_handle(Monitor, USER_MONITOR); + Monitor->Handle = (HANDLE)alloc_user_handle(Monitor, USER_CLIENT);
ExInitializeFastMutex(&Monitor->Lock);
@@ -99,7 +99,7 @@ return NULL; }
- Monitor = (PMONITOR)get_user_object((user_handle_t)hMonitor, USER_MONITOR); + Monitor = (PMONITOR)get_user_object((user_handle_t)hMonitor, USER_CLIENT); if (!Monitor) { SetLastWin32Error(ERROR_INVALID_MONITOR_HANDLE);
Propchange: branches/arwinss/reactos/subsystems/win32/win32k/wine/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Sat Oct 24 15:20:16 2009 @@ -1,0 +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 +/vendor/wine/server/current:43708
Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/user.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/wine/user.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/wine/user.c [iso-8859-1] Sat Oct 24 15:20:16 2009 @@ -26,6 +26,7 @@ #include "request.h" #include "handle.h" #include "user.h" +#include "request.h"
#define NDEBUG #include <debug.h> @@ -173,3 +174,31 @@ } return NULL; } + +/* free client-side user handles managed by the process */ +void free_process_user_handles( PPROCESSINFO process ) +{ + unsigned int i; + + for (i = 0; i < nb_handles; i++) + if (handles[i].type == USER_CLIENT && handles[i].ptr == process) + free_user_entry( &handles[i] ); +} + +/* allocate an arbitrary user handle */ +DECL_HANDLER(alloc_user_handle) +{ + reply->handle = alloc_user_handle( PsGetCurrentProcessWin32Process(), USER_CLIENT ); +} + + +/* free an arbitrary user handle */ +DECL_HANDLER(free_user_handle) +{ + struct user_handle *entry; + + if ((entry = handle_to_entry( req->handle )) && entry->type == USER_CLIENT) + free_user_entry( entry ); + else + set_error( STATUS_INVALID_HANDLE ); +}