- Get the locations of DrawCaptionTemp and RegisterShellHook when required instead of at link time. This allows building with msvc due to missing .lib stuff

- Remove SHGetViewStatePropertyBag test code
- Move more stuff to appropiate headers
- Remove unneeded linker libs

svn path=/trunk/; revision=33232
This commit is contained in:
Ged Murphy 2008-05-02 08:22:09 +00:00
parent f593891576
commit 8e8e7c35eb
8 changed files with 117 additions and 83 deletions

View file

@ -11,11 +11,8 @@
<library>gdi32</library>
<library>user32</library>
<library>comctl32</library>
<library>msvcrt20</library>
<library>ntdll</library>
<library>ole32</library>
<library>oleaut32</library>
<library>shdocvw</library>
<library>shell32</library>
<library>shlwapi</library>
<library>uuid</library>

View file

@ -23,6 +23,10 @@
#include "todo.h"
#include "undoc.h"
/* dynamic imports due to lack of support in msvc linker libs */
typedef INT (STDCALL *REGSHELLHOOK)(HWND, DWORD);
typedef BOOL (STDCALL *DRAWCAPTEMP)(HWND, HDC, const RECT*, HFONT, HICON, LPCWSTR, UINT);
static ULONG __inline
Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...)
{
@ -222,13 +226,6 @@ DisplayTrayProperties(ITrayWindow *Tray);
/*
* desktop.c
*/
#define SHCNRF_InterruptLevel (0x0001)
#define SHCNRF_ShellLevel (0x0002)
#define SHCNRF_RecursiveInterrupt (0x1000)
#define SHCNRF_NewDelivery (0x8000)
HANDLE
DesktopCreateWindow(IN OUT ITrayWindow *Tray);

View file

@ -1358,6 +1358,7 @@ TaskSwitchWnd_Create(IN OUT PTASK_SWITCH_WND This)
if (This->hWndToolbar != NULL)
{
HMODULE hShell32;
SIZE BtnSize;
/* Identify the version we're using */
@ -1391,8 +1392,22 @@ TaskSwitchWnd_Create(IN OUT PTASK_SWITCH_WND This)
/* Register the shell hook */
This->ShellHookMsg = RegisterWindowMessage(TEXT("SHELLHOOK"));
RegisterShellHook(This->hWnd,
3); /* 1 if not NT! We're targeting NT so we don't care! */
hShell32 = LoadLibrary(TEXT("SHELL32.DLL"));
if (hShell32 != NULL)
{
REGSHELLHOOK RegShellHook;
/* RegisterShellHook */
RegShellHook = (REGSHELLHOOK)GetProcAddress(hShell32,
(LPCSTR)((LONG)181));
if (RegShellHook != NULL)
{
RegShellHook(This->hWnd,
3); /* 1 if no NT! We're targeting NT so we don't care! */
}
FreeLibrary(hShell32);
}
/* Add all windows to the toolbar */
EnumWindows(TaskSwitchWnd_EnumWindowsProc,
@ -1414,11 +1429,27 @@ TaskSwitchWnd_Create(IN OUT PTASK_SWITCH_WND This)
static VOID
TaskSwitchWnd_NCDestroy(IN OUT PTASK_SWITCH_WND This)
{
HMODULE hShell32;
This->IsDestroying = TRUE;
/* Unregister the shell hook */
RegisterShellHook(This->hWnd,
FALSE);
hShell32 = LoadLibrary(TEXT("SHELL32.DLL"));
if (hShell32 != NULL)
{
REGSHELLHOOK RegShellHook;
/* RegisterShellHook */
RegShellHook = (REGSHELLHOOK)GetProcAddress(hShell32,
(LPCSTR)((LONG)181));
if (RegShellHook != NULL)
{
RegShellHook(This->hWnd,
FALSE);
}
FreeLibrary(hShell32);
}
TaskSwitchWnd_DeleteAllTasks(This);
}
@ -1572,6 +1603,7 @@ TaskSwichWnd_HandleItemPaint(IN OUT PTASK_SWITCH_WND This,
{
HFONT hCaptionFont, hBoldCaptionFont;
LRESULT Ret = CDRF_DODEFAULT;
HMODULE hUser32;
#if TASK_USE_DRAWCAPTIONTEMP != 0
@ -1627,14 +1659,31 @@ TaskSwichWnd_HandleItemPaint(IN OUT PTASK_SWITCH_WND This,
uidctFlags |= DC_ACTIVE;
}
/* Draw the button content */
TaskItem->DisplayTooltip = !DrawCaptionTemp(TaskItem->hWnd,
nmtbcd->nmcd.hdc,
&nmtbcd->nmcd.rc,
hCaptionFont,
NULL,
NULL,
uidctFlags);
hUser32 = LoadLibrary(TEXT("USER32.DLL"));
if (hUser32 != NULL)
{
DRAWCAPTEMP DrawCapTemp;
LONG ord = 187;
#ifndef UNICODE
ord = 186;
#endif
/* DrawCaptionTemp */
DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32,
(LPCSTR)ord);
if (DrawCapTemp != NULL)
{
/* Draw the button content */
TaskItem->DisplayTooltip = !DrawCapTemp(TaskItem->hWnd,
nmtbcd->nmcd.hdc,
&nmtbcd->nmcd.rc,
hCaptionFont,
NULL,
NULL,
uidctFlags);
}
FreeLibrary(hUser32);
}
return CDRF_SKIPDEFAULT;

View file

@ -1,12 +1,6 @@
#ifndef __TODO_H
#define __TODO_H
/*
* Stuff missing in our headers
*/
#define SM_REMOTECONTROL 0x2001
/* FIXME: Ugly hack!!! FIX ASAP! Move to uuid! */
static const GUID IID_HACK_IShellView2 = {0x88E39E80,0x3578,0x11CF,{0xAE,0x69,0x08,0x00,0x2B,0x2E,0x12,0x62}};
#define IID_IShellView2 IID_HACK_IShellView2
@ -46,18 +40,6 @@ static const GUID SID_HACK_SMenuPopup = {0xD1E7AFEB,0x6A2E,0x11D0,{0x8C,0x78,0x0
#define IDeskBarClient_GetSize(T,a,b) (T)->lpVtbl->GetSize(T,a,b)
#endif
#define SHGVSPB_PERUSER 0x1
#define SHGVSPB_PERFOLDER 0x4
#define SHGVSPB_ROAM 0x00000020
#define SHGVSPB_NOAUTODEFAULTS 0x80000000
#define SHGVSPB_FOLDER (SHGVSPB_PERUSER | SHGVSPB_PERFOLDER)
#define SHGVSPB_FOLDERNODEFAULTS (SHGVSPB_PERUSER | SHGVSPB_PERFOLDER | SHGVSPB_NOAUTODEFAULTS)
#define DBC_SHOW 1
#define DBC_HIDE 0
static const GUID IID_HACK_IShellService = {0x5836FB00,0x8187,0x11CF,{0xA1,0x2B,0x00,0xAA,0x00,0x4A,0xE8,0x37}};
#define IID_IShellService IID_HACK_IShellService
@ -80,40 +62,4 @@ DECLARE_INTERFACE_(IShellService,IUnknown)
#define IShellService_SetOwner(T,a) (T)->lpVtbl->SetOwner(T,a)
#endif
#if _MSC_VER
HRESULT WINAPI SHGetViewStatePropertyBag(LPCITEMIDLIST,LPCWSTR,DWORD,REFIID,PVOID*);/* FIXME: Parameter should be PCIDLIST_ABSOLUTE */
#else
typedef HRESULT (WINAPI *PSHGetViewStatePropertyBag)(LPCITEMIDLIST,LPCWSTR,DWORD,REFIID,PVOID*);
static HRESULT __inline
SHGetViewStatePropertyBag(IN LPCITEMIDLIST pidl,
IN LPCWSTR pszBagName,
IN DWORD dwFlags,
IN REFIID riid,
OUT PVOID* ppv)
{
static PSHGetViewStatePropertyBag Func = NULL;
if (Func == NULL)
{
HMODULE hShlwapi;
hShlwapi = LoadLibrary(TEXT("SHLWAPI.DLL"));
if (hShlwapi != NULL)
{
Func = (PSHGetViewStatePropertyBag)GetProcAddress(hShlwapi, "SHGetViewStatePropertyBag");
}
}
if (Func != NULL)
{
return Func(pidl, pszBagName, dwFlags, riid, ppv);
}
MessageBox(NULL, TEXT("SHGetViewStatePropertyBag not available"), NULL, 0);
return E_NOTIMPL;
}
#endif
#define PIDLIST_ABSOLUTE LPITEMIDLIST
PIDLIST_ABSOLUTE WINAPI SHCloneSpecialIDList(HWND hwnd, int csidl, BOOL fCreate);
#endif /* __TODO_H */

View file

@ -1224,6 +1224,7 @@ ITrayWindowImpl_CreateStartButtonBitmap(IN OUT ITrayWindowImpl *This)
BOOL Ret;
UINT Flags;
RECT rcButton;
HMODULE hUser32;
/* NOTE: This is the backwards compatibility code that is used if the
Common Controls Version 6.0 are not available! */
@ -1294,13 +1295,30 @@ ITrayWindowImpl_CreateStartButtonBitmap(IN OUT ITrayWindowImpl *This)
if (hIconStart != NULL)
Flags |= DC_ICON;
Ret = DrawCaptionTemp(NULL,
hDC,
&rcButton,
This->hStartBtnFont,
hIconStart,
szStartCaption,
Flags);
hUser32 = LoadLibrary(TEXT("USER32.DLL"));
if (hUser32 != NULL)
{
DRAWCAPTEMP DrawCapTemp;
LONG ord = 187;
#ifndef UNICODE
ord = 186;
#endif
/* DrawCaptionTemp */
DrawCapTemp = (DRAWCAPTEMP)GetProcAddress(hUser32,
(LPCSTR)ord);
if (DrawCapTemp != NULL)
{
Ret = DrawCapTemp(NULL,
hDC,
&rcButton,
This->hStartBtnFont,
hIconStart,
szStartCaption,
Flags);
}
FreeLibrary(hUser32);
}
SelectObject(hDC,
hbmpOld);

View file

@ -442,6 +442,13 @@ DECLARE_INTERFACE_(IDeskBarClient,IUnknown)
};
#undef INTERFACE
#define DBC_GS_IDEAL 0
#define DBC_GS_SIZEDOWN 1
#define DBC_HIDE 0
#define DBC_SHOW 1
#define DBC_SHOWOBSCURE 2
/****************************************************************************
* SHAddToRecentDocs API
@ -752,6 +759,7 @@ HRESULT WINAPI SHGetDataFromIDListA(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int n
HRESULT WINAPI SHGetDataFromIDListW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, int nFormat, LPVOID pv, int cb);
#define SHGetDataFromIDList WINELIB_NAME_AW(SHGetDataFromIDList)
PIDLIST_ABSOLUTE WINAPI SHCloneSpecialIDList(HWND hwnd, int csidl, BOOL fCreate);
BOOL WINAPI SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR szPath, int nFolder, BOOL bCreate);
BOOL WINAPI SHGetSpecialFolderPathW (HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate);
#define SHGetSpecialFolderPath WINELIB_NAME_AW(SHGetSpecialFolderPath)

View file

@ -1001,6 +1001,24 @@ typedef struct _DLLVERSIONINFO2 {
HRESULT WINAPI DllInstall(BOOL,LPCWSTR) DECLSPEC_HIDDEN;
#if (_WIN32_IE >= 0x0600)
#define SHGVSPB_PERUSER 0x00000001
#define SHGVSPB_ALLUSERS 0x00000002
#define SHGVSPB_PERFOLDER 0x00000004
#define SHGVSPB_ALLFOLDERS 0x00000008
#define SHGVSPB_INHERIT 0x00000010
#define SHGVSPB_ROAM 0x00000020
#define SHGVSPB_NOAUTODEFAULTS 0x80000000
#define SHGVSPB_FOLDER (SHGVSPB_PERUSER | SHGVSPB_PERFOLDER)
#define SHGVSPB_FOLDERNODEFAULTS (SHGVSPB_PERUSER | SHGVSPB_PERFOLDER | SHGVSPB_NOAUTODEFAULTS)
#define SHGVSPB_USERDEFAULTS (SHGVSPB_PERUSER | SHGVSPB_ALLFOLDERS)
#define SHGVSPB_GLOBALDEAFAULTS (SHGVSPB_ALLUSERS | SHGVSPB_ALLFOLDERS)
HRESULT WINAPI SHGetViewStatePropertyBag(PCIDLIST_ABSOLUTE pidl, LPCWSTR pszBagName, DWORD dwFlags, REFIID riid, void** ppv);
#endif /* (_WIN32_IE >= 0x0600) */
/* IsOS definitions */
#define OS_WIN32SORGREATER 0x00

View file

@ -1004,6 +1004,7 @@ extern "C" {
#define SM_CXFOCUSBORDER 83
#define SM_CYFOCUSBORDER 84
#define SM_SHUTTINGDOWN 0x2000
#define SM_REMOTECONTROL 0x2001
#endif /* _WIN32_WINNT >= 0x0501 */
#define SM_REMOTESESSION 0X1000
#define ARW_BOTTOMLEFT 0