Sync trunk up to r50477.

svn path=/branches/cmake-bringup/; revision=50504
This commit is contained in:
Sylvain Petreolle 2011-01-26 22:19:12 +00:00
commit e2b7eacdd5
162 changed files with 4613 additions and 6228 deletions

View file

@ -31,6 +31,7 @@ add_importlibs(explorer_new
oleaut32
shell32
shlwapi
version
msvcrt
kernel32
ntdll)

View file

@ -26,6 +26,12 @@ HANDLE hProcessHeap;
HKEY hkExplorer = NULL;
DRAWCAPTEMP DrawCapTemp = NULL;
typedef struct _LANGCODEPAGE
{
WORD wLanguage;
WORD wCodePage;
} LANGCODEPAGE, *PLANGCODEPAGE;
/* undoc GUID */
DEFINE_GUID(CLSID_RebarBandSite, 0xECD4FC4D, 0x521C, 0x11D0, 0xB7, 0x92, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1);
@ -270,6 +276,80 @@ SetShellReadyEvent(IN LPCTSTR lpEventName)
return FALSE;
}
BOOL
GetVersionInfoString(IN TCHAR *szFileName,
IN TCHAR *szVersionInfo,
OUT TCHAR *szBuffer,
IN UINT cbBufLen)
{
LPVOID lpData = NULL;
TCHAR szSubBlock[128];
TCHAR *lpszLocalBuf = NULL;
LANGID UserLangId;
PLANGCODEPAGE lpTranslate = NULL;
DWORD dwLen;
DWORD dwHandle;
UINT cbTranslate;
UINT cbLen;
BOOL bRet = FALSE;
unsigned int i;
dwLen = GetFileVersionInfoSize(szFileName,&dwHandle);
if (dwLen > 0)
{
lpData = HeapAlloc(hProcessHeap,0,dwLen);
if (lpData != NULL)
{
if (GetFileVersionInfo(szFileName,
0,
dwLen,
lpData) != 0)
{
UserLangId = GetUserDefaultLangID();
VerQueryValue(lpData,
TEXT("\\VarFileInfo\\Translation"),
(LPVOID *)&lpTranslate,
&cbTranslate);
for (i = 0;i < (cbTranslate / sizeof(LANGCODEPAGE));i++)
{
/* If the bottom eight bits of the language id's
match, use this version information (since this
means that the version information and the users
default language are the same). */
if ((lpTranslate[i].wLanguage & 0xFF) ==
(UserLangId & 0xFF))
{
wnsprintf(szSubBlock,
sizeof(szSubBlock) / sizeof(szSubBlock[0]),
TEXT("\\StringFileInfo\\%04X%04X\\%s"),
lpTranslate[i].wLanguage,
lpTranslate[i].wCodePage,szVersionInfo);
if (VerQueryValue(lpData,
szSubBlock,
(LPVOID *)&lpszLocalBuf,
&cbLen) != 0)
{
wcsncpy(szBuffer,lpszLocalBuf,cbBufLen);
bRet = TRUE;
break;
}
}
}
}
HeapFree(hProcessHeap,0,lpData);
lpData = NULL;
}
}
return bRet;
}
INT WINAPI
_tWinMain(IN HINSTANCE hInstance,
IN HINSTANCE hPrevInstance,

View file

@ -1715,6 +1715,64 @@ TaskSwitchWnd_HandleButtonClick(IN OUT PTASK_SWITCH_WND This,
return FALSE;
}
static VOID
TaskSwitchWnd_HandleTaskItemRightClick(IN OUT PTASK_SWITCH_WND This,
IN OUT PTASK_ITEM TaskItem)
{
HMENU hmenu = GetSystemMenu(TaskItem->hWnd, FALSE);
if (hmenu) {
POINT pt;
GetCursorPos(&pt);
int cmd = TrackPopupMenu(hmenu, TPM_LEFTBUTTON|TPM_RIGHTBUTTON|TPM_RETURNCMD, pt.x, pt.y, 0, This->hWndToolbar, NULL);
if (cmd) {
SetForegroundWindow(TaskItem->hWnd); // reactivate window after the context menu has closed
PostMessage(TaskItem->hWnd, WM_SYSCOMMAND, cmd, 0);
}
}
}
static VOID
TaskSwitchWnd_HandleTaskGroupRightClick(IN OUT PTASK_SWITCH_WND This,
IN OUT PTASK_GROUP TaskGroup)
{
/* TODO: Show task group right click menu */
}
static BOOL
TaskSwitchWnd_HandleButtonRightClick(IN OUT PTASK_SWITCH_WND This,
IN WORD wIndex)
{
PTASK_ITEM TaskItem;
PTASK_GROUP TaskGroup;
if (This->IsGroupingEnabled)
{
TaskGroup = FindTaskGroupByIndex(This,
(INT)wIndex);
if (TaskGroup != NULL && TaskGroup->IsCollapsed)
{
TaskSwitchWnd_HandleTaskGroupRightClick(This,
TaskGroup);
return TRUE;
}
}
TaskItem = FindTaskItemByIndex(This,
(INT)wIndex);
if (TaskItem != NULL)
{
TaskSwitchWnd_HandleTaskItemRightClick(This,
TaskItem);
return TRUE;
}
return FALSE;
}
static LRESULT
TaskSwichWnd_HandleItemPaint(IN OUT PTASK_SWITCH_WND This,
IN OUT NMTBCUSTOMDRAW *nmtbcd)
@ -2001,7 +2059,8 @@ TaskSwitchWndProc(IN HWND hwnd,
(LPARAM)&pt);
if (iBtn >= 0)
{
/* FIXME: Display the system menu of the window */
TaskSwitchWnd_HandleButtonRightClick(This,
iBtn);
}
else
goto ForwardContextMenuMsg;

View file

@ -29,6 +29,7 @@
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
#include <windows.h>
#include <undocuser.h>
// Unicode support
#if defined(UNICODE) && !defined(_UNICODE)