diff --git a/base/shell/explorer/traywnd.cpp b/base/shell/explorer/traywnd.cpp index 466e766da14..49d3ae40886 100644 --- a/base/shell/explorer/traywnd.cpp +++ b/base/shell/explorer/traywnd.cpp @@ -21,7 +21,6 @@ #include "precomp.h" #include -#include HRESULT TrayWindowCtxMenuCreator(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu); diff --git a/dll/shellext/acppage/ACPPage.cpp b/dll/shellext/acppage/ACPPage.cpp index 18d035fb9cf..14f4f632b01 100644 --- a/dll/shellext/acppage/ACPPage.cpp +++ b/dll/shellext/acppage/ACPPage.cpp @@ -82,36 +82,6 @@ struct CCoInit HRESULT hres; }; -EXTERN_C -inline ULONG -Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...) -{ - char Buffer[512]; - char* Current = Buffer; - size_t Length = _countof(Buffer); - const char* fname = strrchr(filename, '\\'); - if (fname == NULL) - { - fname = strrchr(filename, '/'); - if (fname != NULL) - fname++; - } - else - fname++; - - if (fname == NULL) - fname = filename; - - StringCchPrintfExA(Current, Length, &Current, &Length, STRSAFE_NULL_ON_FAILURE, "%s:%d: ", fname, line); - va_list ArgList; - va_start(ArgList, lpFormat); - StringCchVPrintfExA(Current, Length, &Current, &Length, STRSAFE_NULL_ON_FAILURE, lpFormat, ArgList); - va_end(ArgList); - OutputDebugStringA(Buffer); - return 0; -} - - EXTERN_C BOOL WINAPI GetExeFromLnk(PCWSTR pszLnk, PWSTR pszExe, size_t cchSize) { diff --git a/dll/shellext/zipfldr/precomp.h b/dll/shellext/zipfldr/precomp.h index 06c82a8b15d..e25e2f19024 100644 --- a/dll/shellext/zipfldr/precomp.h +++ b/dll/shellext/zipfldr/precomp.h @@ -37,7 +37,6 @@ EXTERN_C const GUID CLSID_ZipFolderExtractAllCommand; extern LONG g_ModuleRefCnt; -#define Win32DbgPrint(file, line, warn, func) DbgPrint("(%s:%d) " warn, file, line, func) WCHAR* guid2string(REFCLSID iid); diff --git a/dll/win32/shell32/CShellDispatch.cpp b/dll/win32/shell32/CShellDispatch.cpp index b07a42f89d7..d021bf5ea2b 100644 --- a/dll/win32/shell32/CShellDispatch.cpp +++ b/dll/win32/shell32/CShellDispatch.cpp @@ -8,7 +8,6 @@ #include "precomp.h" #include "winsvc.h" -#include // tray commands WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/modules/rostests/apitests/browseui/ACListISF.cpp b/modules/rostests/apitests/browseui/ACListISF.cpp index 59607dd58ad..7ae0d10b4c4 100644 --- a/modules/rostests/apitests/browseui/ACListISF.cpp +++ b/modules/rostests/apitests/browseui/ACListISF.cpp @@ -17,6 +17,7 @@ // Yes, gcc at it again, let's validate everything found inside unused templates! ULONG DbgPrint(PCH Format,...); +#include #include #include #include diff --git a/modules/rostests/apitests/shell32/CFSFolder.cpp b/modules/rostests/apitests/shell32/CFSFolder.cpp index 57c015b3511..b4be49fcc1c 100644 --- a/modules/rostests/apitests/shell32/CFSFolder.cpp +++ b/modules/rostests/apitests/shell32/CFSFolder.cpp @@ -9,6 +9,7 @@ #define NDEBUG #include +#include #include LPITEMIDLIST _CreateDummyPidl() diff --git a/modules/rostests/apitests/shell32/CMyComputer.cpp b/modules/rostests/apitests/shell32/CMyComputer.cpp index 85f04fc7383..0d77ea23afb 100644 --- a/modules/rostests/apitests/shell32/CMyComputer.cpp +++ b/modules/rostests/apitests/shell32/CMyComputer.cpp @@ -9,6 +9,7 @@ #define NDEBUG #include +#include #include #define INVALID_POINTER ((PVOID)(ULONG_PTR)0xdeadbeefdeadbeefULL) diff --git a/modules/rostests/apitests/shell32/CShellDesktop.cpp b/modules/rostests/apitests/shell32/CShellDesktop.cpp index 764e1508818..885e2251639 100644 --- a/modules/rostests/apitests/shell32/CShellDesktop.cpp +++ b/modules/rostests/apitests/shell32/CShellDesktop.cpp @@ -9,6 +9,7 @@ #include "shelltest.h" #include +#include #include // We would normally use S_LESSTHAN and S_GREATERTHAN, but w2k3 returns numbers like 3 and -3... diff --git a/modules/rostests/apitests/shell32/CShellLink.cpp b/modules/rostests/apitests/shell32/CShellLink.cpp index 223ad5bfde2..67e72405091 100644 --- a/modules/rostests/apitests/shell32/CShellLink.cpp +++ b/modules/rostests/apitests/shell32/CShellLink.cpp @@ -9,6 +9,7 @@ #define NDEBUG #include +#include #include /* Test IShellLink::SetPath with environment-variables, existing, non-existing, ...*/ diff --git a/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp b/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp index 144ce8128e0..9b7dda200bc 100644 --- a/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp +++ b/modules/rostests/apitests/shell32/SHCreateFileExtractIconW.cpp @@ -9,8 +9,7 @@ #include #include - -ULONG DbgPrint(PCH Format,...); +#include #include HRESULT (STDAPICALLTYPE *pSHCreateFileExtractIconW)(LPCWSTR pszFile, DWORD dwFileAttributes, REFIID riid, void **ppv); diff --git a/modules/rostests/apitests/shell32/ShellState.cpp b/modules/rostests/apitests/shell32/ShellState.cpp index 94a4a38cff6..fb79eccab98 100644 --- a/modules/rostests/apitests/shell32/ShellState.cpp +++ b/modules/rostests/apitests/shell32/ShellState.cpp @@ -8,6 +8,7 @@ #define NDEBUG #include +#include #include #include diff --git a/sdk/include/reactos/shellutils.h b/sdk/include/reactos/shellutils.h index f7f6bd03353..2f5d72ece0f 100644 --- a/sdk/include/reactos/shellutils.h +++ b/sdk/include/reactos/shellutils.h @@ -23,6 +23,42 @@ extern "C" { #endif /* defined(__cplusplus) */ +static inline ULONG +Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...) +{ + char szMsg[512]; + char *szMsgStart; + const char *fname; + va_list vl; + ULONG uRet; + + fname = strrchr(filename, '\\'); + if (fname == NULL) + { + fname = strrchr(filename, '/'); + if (fname != NULL) + fname++; + } + else + fname++; + + if (fname == NULL) + fname = filename; + + szMsgStart = szMsg + sprintf(szMsg, "%s:%d: ", fname, line); + + va_start(vl, lpFormat); + uRet = (ULONG) vsprintf(szMsgStart, lpFormat, vl); + va_end(vl); + + OutputDebugStringA(szMsg); + + return uRet; +} + +#define DbgPrint(fmt, ...) \ + Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__) + #ifdef __cplusplus # define IID_PPV_ARG(Itype, ppType) IID_##Itype, reinterpret_cast((static_cast(ppType))) # define IID_NULL_PPV_ARG(Itype, ppType) IID_##Itype, NULL, reinterpret_cast((static_cast(ppType))) @@ -372,6 +408,103 @@ HRESULT inline SHSetStrRet(LPSTRRET pStrRet, HINSTANCE hInstance, DWORD resId) return SHSetStrRet(pStrRet, Buffer); } +static inline void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel) +{ + WCHAR label[128]; + int i; + int count = GetMenuItemCount(hmenu); + + padding[padlevel] = '.'; + padding[padlevel + 1] = '.'; + padding[padlevel + 2] = 0; + + for (i = 0; i < count; i++) + { + MENUITEMINFOW mii = { 0 }; + + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU | MIIM_STATE | MIIM_ID; + mii.dwTypeData = label; + mii.cch = _countof(label); + + GetMenuItemInfoW(hmenu, i, TRUE, &mii); + + if (mii.fType & MFT_BITMAP) + DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.hbmpItem, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE"); + else if (mii.fType & MFT_SEPARATOR) + DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding, i, mii.wID); + else + DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.dwTypeData, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE"); + + if (mii.hSubMenu) + DbgDumpMenuInternal(mii.hSubMenu, padding, padlevel + 2); + + } + + padding[padlevel] = 0; +} + +static __inline void DbgDumpMenu(HMENU hmenu) +{ + char padding[128]; + DbgDumpMenuInternal(hmenu, padding, 0); +} + + +static inline +void DumpIdList(LPCITEMIDLIST pcidl) +{ + DbgPrint("Begin IDList Dump\n"); + + for (; pcidl != NULL; pcidl = ILGetNext(pcidl)) + { + int i; + int cb = pcidl->mkid.cb; + BYTE * sh = (BYTE*) &(pcidl->mkid); + if (cb == 0) // ITEMIDLISTs are terminatedwith a null SHITEMID. + break; + DbgPrint("Begin SHITEMID (cb=%d)\n", cb); + if ((cb & 3) != 0) + DbgPrint(" - WARNING: cb is not a multiple of 4\n"); + for (i = 0; (i + 4) <= cb; i += 4) + { + DbgPrint(" - abID[%08x]: %02x %02x %02x %02x\n", + i, + sh[i + 0], + sh[i + 1], + sh[i + 2], + sh[i + 3]); + } + if (i < cb) + { + cb -= i; + if (cb == 3) + { + DbgPrint(" - abID[%08x]: %02x %02x %02x --\n", + i, + sh[i + 0], + sh[i + 1], + sh[i + 2]); + } + else if (cb == 2) + { + DbgPrint(" - abID[%08x]: %02x %02x -- --\n", + i, + sh[i + 0], + sh[i + 1]); + } + else if (cb == 1) + { + DbgPrint(" - abID[%08x]: %02x -- -- --\n", + i, + sh[i + 0]); + } + } + DbgPrint("End SHITEMID\n"); + } + DbgPrint("End IDList Dump.\n"); +} + #endif /* __cplusplus */ #define S_LESSTHAN 0xffff diff --git a/sdk/include/reactos/traycmd.h b/sdk/include/reactos/traycmd.h deleted file mode 100644 index 7273caaa373..00000000000 --- a/sdk/include/reactos/traycmd.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Tray Commands - * - * Copyright 2018 Katayama Hirofumi MZ - * - * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef TRAYCMD_H_ -#define TRAYCMD_H_ - -/* TODO: Add more and implement them */ -#define TRAYCMD_STARTMENU 305 /* Same as IDMA_START. */ -#define TRAYCMD_RUN_DIALOG 401 /* Implemented. Same as IDM_RUN. */ -#define TRAYCMD_LOGOFF_DIALOG 402 /* Implemented. Same as IDM_LOGOFF. */ -#define TRAYCMD_CASCADE 403 /* */ -#define TRAYCMD_TILE_H 404 /* */ -#define TRAYCMD_TILE_V 405 /* */ -#define TRAYCMD_TOGGLE_DESKTOP 407 /* Implemented. */ -#define TRAYCMD_DATE_AND_TIME 408 /* Implemented. */ -#define TRAYCMD_TASKBAR_PROPERTIES 413 /* Implemented. Same as IDM_TASKBARANDSTARTMENU. */ -#define TRAYCMD_MINIMIZE_ALL 415 /* Implemented. */ -#define TRAYCMD_RESTORE_ALL 416 /* Implemented. Same as IDMA_RESTORE_OPEN. */ -#define TRAYCMD_SHOW_DESKTOP 419 /* Implemented. */ -#define TRAYCMD_SHOW_TASK_MGR 420 /* Implemented. */ -#define TRAYCMD_CUSTOMIZE_TASKBAR 421 /* */ -#define TRAYCMD_LOCK_TASKBAR 424 /* Implemented. */ -#define TRAYCMD_HELP_AND_SUPPORT 503 /* Implemented. Same as IDM_HELPANDSUPPORT. */ -#define TRAYCMD_CONTROL_PANEL 505 /* Same as IDM_CONTROLPANEL. */ -#define TRAYCMD_SHUTDOWN_DIALOG 506 /* Implemented. Same as IDM_SHUTDOWN. */ -#define TRAYCMD_PRINTERS_AND_FAXES 510 /* Same as IDM_PRINTERSANDFAXES. */ -#define TRAYCMD_LOCK_DESKTOP 517 /* */ -#define TRAYCMD_SWITCH_USER_DIALOG 5000 /* */ -#define TRAYCMD_SEARCH_FILES 41093 /* Implemented. Same as IDMA_SEARCH. */ -#define TRAYCMD_SEARCH_COMPUTERS 41094 /* Implemented. */ - -#endif /* ndef TRAYCMD_H_ */ diff --git a/sdk/include/reactos/undocshell.h b/sdk/include/reactos/undocshell.h index a93fcdd0706..570c69d806d 100644 --- a/sdk/include/reactos/undocshell.h +++ b/sdk/include/reactos/undocshell.h @@ -618,140 +618,6 @@ BOOL WINAPI GUIDFromStringW( _Out_ LPGUID pguid ); -static inline ULONG -Win32DbgPrint(const char *filename, int line, const char *lpFormat, ...) -{ - char szMsg[512]; - char *szMsgStart; - const char *fname; - va_list vl; - ULONG uRet; - - fname = strrchr(filename, '\\'); - if (fname == NULL) - { - fname = strrchr(filename, '/'); - if (fname != NULL) - fname++; - } - else - fname++; - - if (fname == NULL) - fname = filename; - - szMsgStart = szMsg + sprintf(szMsg, "%s:%d: ", fname, line); - - va_start(vl, lpFormat); - uRet = (ULONG) vsprintf(szMsgStart, lpFormat, vl); - va_end(vl); - - OutputDebugStringA(szMsg); - - return uRet; -} - -#define DbgPrint(fmt, ...) \ - Win32DbgPrint(__FILE__, __LINE__, fmt, ##__VA_ARGS__) - -static inline void DbgDumpMenuInternal(HMENU hmenu, char* padding, int padlevel) -{ - WCHAR label[128]; - int i; - int count = GetMenuItemCount(hmenu); - - padding[padlevel] = '.'; - padding[padlevel + 1] = '.'; - padding[padlevel + 2] = 0; - - for (i = 0; i < count; i++) - { - MENUITEMINFOW mii = { 0 }; - - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU | MIIM_STATE | MIIM_ID; - mii.dwTypeData = label; - mii.cch = _countof(label); - - GetMenuItemInfoW(hmenu, i, TRUE, &mii); - - if (mii.fType & MFT_BITMAP) - DbgPrint("%s%2d - %08x: BITMAP %08p (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.hbmpItem, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE"); - else if (mii.fType & MFT_SEPARATOR) - DbgPrint("%s%2d - %08x ---SEPARATOR---\n", padding, i, mii.wID); - else - DbgPrint("%s%2d - %08x: %S (state=%d, has submenu=%s)\n", padding, i, mii.wID, mii.dwTypeData, mii.fState, mii.hSubMenu ? "TRUE" : "FALSE"); - - if (mii.hSubMenu) - DbgDumpMenuInternal(mii.hSubMenu, padding, padlevel + 2); - - } - - padding[padlevel] = 0; -} - -static __inline void DbgDumpMenu(HMENU hmenu) -{ - char padding[128]; - DbgDumpMenuInternal(hmenu, padding, 0); -} - - -static inline -void DumpIdList(LPCITEMIDLIST pcidl) -{ - DbgPrint("Begin IDList Dump\n"); - - for (; pcidl != NULL; pcidl = ILGetNext(pcidl)) - { - int i; - int cb = pcidl->mkid.cb; - BYTE * sh = (BYTE*) &(pcidl->mkid); - if (cb == 0) // ITEMIDLISTs are terminatedwith a null SHITEMID. - break; - DbgPrint("Begin SHITEMID (cb=%d)\n", cb); - if ((cb & 3) != 0) - DbgPrint(" - WARNING: cb is not a multiple of 4\n"); - for (i = 0; (i + 4) <= cb; i += 4) - { - DbgPrint(" - abID[%08x]: %02x %02x %02x %02x\n", - i, - sh[i + 0], - sh[i + 1], - sh[i + 2], - sh[i + 3]); - } - if (i < cb) - { - cb -= i; - if (cb == 3) - { - DbgPrint(" - abID[%08x]: %02x %02x %02x --\n", - i, - sh[i + 0], - sh[i + 1], - sh[i + 2]); - } - else if (cb == 2) - { - DbgPrint(" - abID[%08x]: %02x %02x -- --\n", - i, - sh[i + 0], - sh[i + 1]); - } - else if (cb == 1) - { - DbgPrint(" - abID[%08x]: %02x -- -- --\n", - i, - sh[i + 0]); - } - } - DbgPrint("End SHITEMID\n"); - } - DbgPrint("End IDList Dump.\n"); -} - - /***************************************************************************** * Shell32 resources */ @@ -785,6 +651,31 @@ void DumpIdList(LPCITEMIDLIST pcidl) #define SMSET_UNKNOWN08 0x08 #define SMSET_UNKNOWN10 0x10 +// explorer tray commands +#define TRAYCMD_STARTMENU 305 +#define TRAYCMD_RUN_DIALOG 401 +#define TRAYCMD_LOGOFF_DIALOG 402 +#define TRAYCMD_CASCADE 403 +#define TRAYCMD_TILE_H 404 +#define TRAYCMD_TILE_V 405 +#define TRAYCMD_TOGGLE_DESKTOP 407 +#define TRAYCMD_DATE_AND_TIME 408 +#define TRAYCMD_TASKBAR_PROPERTIES 413 +#define TRAYCMD_MINIMIZE_ALL 415 +#define TRAYCMD_RESTORE_ALL 416 +#define TRAYCMD_SHOW_DESKTOP 419 +#define TRAYCMD_SHOW_TASK_MGR 420 +#define TRAYCMD_CUSTOMIZE_TASKBAR 421 +#define TRAYCMD_LOCK_TASKBAR 424 +#define TRAYCMD_HELP_AND_SUPPORT 503 +#define TRAYCMD_CONTROL_PANEL 505 +#define TRAYCMD_SHUTDOWN_DIALOG 506 +#define TRAYCMD_PRINTERS_AND_FAXES 510 +#define TRAYCMD_LOCK_DESKTOP 517 +#define TRAYCMD_SWITCH_USER_DIALOG 5000 +#define TRAYCMD_SEARCH_FILES 41093 +#define TRAYCMD_SEARCH_COMPUTERS 41094 + void WINAPI ShellDDEInit(BOOL bInit); DWORD WINAPI WinList_Init(void);