shell32: Move SHAppBarMessage implementation from shell32 to explorer.
This commit is contained in:
parent
491e44d425
commit
3cce9ad9c6
|
@ -9,6 +9,7 @@ IMPORTS = uuid shlwapi comctl32 user32 gdi32 advapi32 kernel32 ntdll
|
|||
DELAYIMPORTS = ole32 oleaut32
|
||||
|
||||
C_SRCS = \
|
||||
appbar.c \
|
||||
autocomplete.c \
|
||||
brsfolder.c \
|
||||
changenotify.c \
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* SHAppBarMessage implementation
|
||||
*
|
||||
* Copyright 2008 Vincent Povirk for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "shellapi.h"
|
||||
#include "winuser.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(appbar);
|
||||
|
||||
struct appbar_cmd
|
||||
{
|
||||
HANDLE return_map;
|
||||
DWORD return_process;
|
||||
APPBARDATA abd;
|
||||
};
|
||||
|
||||
struct appbar_response
|
||||
{
|
||||
UINT_PTR result;
|
||||
RECT rc;
|
||||
};
|
||||
|
||||
/*************************************************************************
|
||||
* SHAppBarMessage [SHELL32.@]
|
||||
*/
|
||||
UINT_PTR WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
|
||||
{
|
||||
struct appbar_cmd command;
|
||||
struct appbar_response* response;
|
||||
HANDLE return_map;
|
||||
LPVOID return_view;
|
||||
HWND appbarmsg_window;
|
||||
COPYDATASTRUCT cds;
|
||||
DWORD_PTR msg_result;
|
||||
static const WCHAR classname[] = {'W','i','n','e','A','p','p','B','a','r',0};
|
||||
|
||||
UINT_PTR ret = 0;
|
||||
|
||||
TRACE("msg=%d, data={cb=%d, hwnd=%p, callback=%x, edge=%d, rc=%s, lparam=%lx}\n",
|
||||
msg, data->cbSize, data->hWnd, data->uCallbackMessage, data->uEdge,
|
||||
wine_dbgstr_rect(&data->rc), data->lParam);
|
||||
|
||||
if (data->cbSize < sizeof(APPBARDATA))
|
||||
{
|
||||
WARN("data at %p is too small\n", data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
command.abd = *data;
|
||||
|
||||
return_map = CreateFileMappingW(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, sizeof(struct appbar_response), NULL);
|
||||
if (return_map == NULL)
|
||||
{
|
||||
ERR("couldn't create file mapping\n");
|
||||
return 0;
|
||||
}
|
||||
command.return_map = return_map;
|
||||
|
||||
command.return_process = GetCurrentProcessId();
|
||||
|
||||
appbarmsg_window = FindWindowW(classname, NULL);
|
||||
if (appbarmsg_window == NULL)
|
||||
{
|
||||
ERR("couldn't find appbar window\n");
|
||||
CloseHandle(return_map);
|
||||
return 0;
|
||||
}
|
||||
|
||||
cds.dwData = msg;
|
||||
cds.cbData = sizeof(command);
|
||||
cds.lpData = &command;
|
||||
|
||||
SendMessageTimeoutW(appbarmsg_window, WM_COPYDATA, (WPARAM)data->hWnd, (LPARAM)&cds, SMTO_BLOCK, INFINITE, &msg_result);
|
||||
|
||||
return_view = MapViewOfFile(return_map, FILE_MAP_READ, 0, 0, sizeof(struct appbar_response));
|
||||
if (return_view == NULL)
|
||||
{
|
||||
ERR("MapViewOfFile failed\n");
|
||||
CloseHandle(return_map);
|
||||
return 0;
|
||||
}
|
||||
|
||||
response = (struct appbar_response*)return_view;
|
||||
|
||||
ret = response->result;
|
||||
data->rc = response->rc;
|
||||
|
||||
UnmapViewOfFile(return_view);
|
||||
|
||||
CloseHandle(return_map);
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -866,61 +866,6 @@ static void paint_dropline( HDC hdc, HWND hWnd )
|
|||
DrawEdge( hdc, &rect, BDR_SUNKENOUTER, BF_RECT );
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHAppBarMessage [SHELL32.@]
|
||||
*/
|
||||
UINT_PTR WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
|
||||
{
|
||||
int width=data->rc.right - data->rc.left;
|
||||
int height=data->rc.bottom - data->rc.top;
|
||||
RECT rec=data->rc;
|
||||
|
||||
FIXME("msg=%d, data={cb=%d, hwnd=%p, callback=%x, edge=%d, rc=%s, lparam=%lx}: stub\n",
|
||||
msg, data->cbSize, data->hWnd, data->uCallbackMessage, data->uEdge,
|
||||
wine_dbgstr_rect(&data->rc), data->lParam);
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
case ABM_GETSTATE:
|
||||
return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
|
||||
case ABM_GETTASKBARPOS:
|
||||
/* FIXME: This is wrong. It should return the taskbar co-ords and edge from the monitor
|
||||
which contains data->hWnd */
|
||||
GetWindowRect(data->hWnd, &rec);
|
||||
data->rc=rec;
|
||||
return TRUE;
|
||||
case ABM_ACTIVATE:
|
||||
SetActiveWindow(data->hWnd);
|
||||
return TRUE;
|
||||
case ABM_GETAUTOHIDEBAR:
|
||||
return 0; /* pretend there is no autohide bar */
|
||||
case ABM_NEW:
|
||||
/* cbSize, hWnd, and uCallbackMessage are used. All other ignored */
|
||||
SetWindowPos(data->hWnd,HWND_TOP,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE);
|
||||
return TRUE;
|
||||
case ABM_QUERYPOS:
|
||||
GetWindowRect(data->hWnd, &(data->rc));
|
||||
return TRUE;
|
||||
case ABM_REMOVE:
|
||||
FIXME("ABM_REMOVE broken\n");
|
||||
/* FIXME: this is wrong; should it be DestroyWindow instead? */
|
||||
/*CloseHandle(data->hWnd);*/
|
||||
return TRUE;
|
||||
case ABM_SETAUTOHIDEBAR:
|
||||
SetWindowPos(data->hWnd,HWND_TOP,rec.left+1000,rec.top,
|
||||
width,height,SWP_SHOWWINDOW);
|
||||
return TRUE;
|
||||
case ABM_SETPOS:
|
||||
data->uEdge=(ABE_RIGHT | ABE_LEFT);
|
||||
SetWindowPos(data->hWnd,HWND_TOP,data->rc.left,data->rc.top,
|
||||
width,height,SWP_SHOWWINDOW);
|
||||
return TRUE;
|
||||
case ABM_WINDOWPOSCHANGED:
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHHelpShortcuts_RunDLLA [SHELL32.@]
|
||||
*
|
||||
|
|
|
@ -9,6 +9,7 @@ IMPORTS = rpcrt4 user32 gdi32 advapi32 kernel32 ntdll
|
|||
DELAYIMPORTS = comctl32
|
||||
|
||||
C_SRCS = \
|
||||
appbar.c \
|
||||
desktop.c \
|
||||
explorer.c \
|
||||
systray.c
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* SHAppBarMessage implementation
|
||||
*
|
||||
* Copyright 2008 Vincent Povirk for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <wine/debug.h>
|
||||
#include "explorer_private.h"
|
||||
|
||||
#include "wine/list.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(appbar);
|
||||
|
||||
struct appbar_cmd
|
||||
{
|
||||
HANDLE return_map;
|
||||
DWORD return_process;
|
||||
APPBARDATA abd;
|
||||
};
|
||||
|
||||
struct appbar_response
|
||||
{
|
||||
UINT_PTR result;
|
||||
RECT rc;
|
||||
};
|
||||
|
||||
static HWND appbarmsg_window = NULL;
|
||||
|
||||
static UINT_PTR handle_appbarmessage(DWORD msg, PAPPBARDATA abd)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case ABM_NEW:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_NEW, hwnd=%p, callback=%x): stub\n", abd->hWnd, abd->uCallbackMessage);
|
||||
return TRUE;
|
||||
case ABM_REMOVE:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_REMOVE, hwnd=%p): stub\n", abd->hWnd);
|
||||
return TRUE;
|
||||
case ABM_QUERYPOS:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_QUERYPOS, hwnd=%p, edge=%x, rc=%s): stub\n", abd->hWnd, abd->uEdge, wine_dbgstr_rect(&abd->rc));
|
||||
return TRUE;
|
||||
case ABM_SETPOS:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_SETPOS, hwnd=%p, edge=%x, rc=%s): stub\n", abd->hWnd, abd->uEdge, wine_dbgstr_rect(&abd->rc));
|
||||
return TRUE;
|
||||
case ABM_GETSTATE:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_GETSTATE): stub\n");
|
||||
return ABS_ALWAYSONTOP | ABS_AUTOHIDE;
|
||||
case ABM_GETTASKBARPOS:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_GETTASKBARPOS, hwnd=%p): stub\n", abd->hWnd);
|
||||
return FALSE;
|
||||
case ABM_ACTIVATE:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_ACTIVATE, hwnd=%p, lparam=%lx): stub\n", abd->hWnd, abd->lParam);
|
||||
return TRUE;
|
||||
case ABM_GETAUTOHIDEBAR:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_GETAUTOHIDEBAR, hwnd=%p, edge=%x): stub\n", abd->hWnd, abd->uEdge);
|
||||
return 0;
|
||||
case ABM_SETAUTOHIDEBAR:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_SETAUTOHIDEBAR, hwnd=%p, edge=%x, lparam=%lx): stub\n", abd->hWnd, abd->uEdge, abd->lParam);
|
||||
return TRUE;
|
||||
case ABM_WINDOWPOSCHANGED:
|
||||
WINE_FIXME("SHAppBarMessage(ABM_WINDOWPOSCHANGED, hwnd=%p): stub\n", abd->hWnd);
|
||||
return TRUE;
|
||||
default:
|
||||
WINE_FIXME("SHAppBarMessage(%x) unimplemented\n", msg);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK appbar_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch (msg)
|
||||
{
|
||||
case WM_COPYDATA:
|
||||
{
|
||||
COPYDATASTRUCT* cds;
|
||||
struct appbar_cmd cmd;
|
||||
UINT_PTR result;
|
||||
HANDLE return_hproc;
|
||||
HANDLE return_map;
|
||||
LPVOID return_view;
|
||||
struct appbar_response* response;
|
||||
|
||||
cds = (COPYDATASTRUCT*)lparam;
|
||||
if (cds->cbData != sizeof(struct appbar_cmd))
|
||||
return TRUE;
|
||||
CopyMemory(&cmd, cds->lpData, cds->cbData);
|
||||
|
||||
result = handle_appbarmessage(cds->dwData, &cmd.abd);
|
||||
|
||||
return_hproc = OpenProcess(PROCESS_DUP_HANDLE, FALSE, cmd.return_process);
|
||||
if (return_hproc == NULL)
|
||||
{
|
||||
WINE_ERR("couldn't open calling process\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!DuplicateHandle(return_hproc, cmd.return_map, GetCurrentProcess(), &return_map, 0, FALSE, DUPLICATE_SAME_ACCESS))
|
||||
{
|
||||
WINE_ERR("couldn't duplicate handle\n");
|
||||
CloseHandle(return_hproc);
|
||||
return TRUE;
|
||||
}
|
||||
CloseHandle(return_hproc);
|
||||
|
||||
return_view = MapViewOfFile(return_map, FILE_MAP_WRITE, 0, 0, sizeof(struct appbar_response));
|
||||
|
||||
if (return_view)
|
||||
{
|
||||
response = (struct appbar_response*)return_view;
|
||||
response->result = result;
|
||||
response->rc = cmd.abd.rc;
|
||||
|
||||
UnmapViewOfFile(return_view);
|
||||
}
|
||||
else
|
||||
WINE_ERR("couldn't map view of file\n");
|
||||
|
||||
CloseHandle(return_map);
|
||||
return TRUE;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProcW(hwnd, msg, wparam, lparam);
|
||||
}
|
||||
|
||||
void initialize_appbar(void)
|
||||
{
|
||||
WNDCLASSEXW class;
|
||||
static const WCHAR classname[] = {'W','i','n','e','A','p','p','B','a','r',0};
|
||||
|
||||
/* register the appbar window class */
|
||||
ZeroMemory(&class, sizeof(class));
|
||||
class.cbSize = sizeof(class);
|
||||
class.lpfnWndProc = appbar_wndproc;
|
||||
class.hInstance = NULL;
|
||||
class.lpszClassName = classname;
|
||||
|
||||
if (!RegisterClassExW(&class))
|
||||
{
|
||||
WINE_ERR("Could not register appbar message window class\n");
|
||||
return;
|
||||
}
|
||||
|
||||
appbarmsg_window = CreateWindowW(classname, classname, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
|
||||
if (!appbarmsg_window)
|
||||
{
|
||||
WINE_ERR("Could not create appbar message window\n");
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -307,6 +307,7 @@ void manage_desktop( WCHAR *arg )
|
|||
SystemParametersInfoA( SPI_SETDESKPATTERN, -1, NULL, FALSE );
|
||||
SetDeskWallPaper( (LPSTR)-1 );
|
||||
initialize_display_settings( hwnd );
|
||||
initialize_appbar();
|
||||
initialize_systray();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
|
||||
extern void manage_desktop( WCHAR *arg );
|
||||
extern void initialize_systray(void);
|
||||
extern void initialize_appbar(void);
|
||||
|
||||
#endif /* __WINE_EXPLORER_PRIVATE_H */
|
||||
|
|
Loading…
Reference in New Issue