[SHLWAPI][SHELL32][SDK] Support SHRestrictedMessageBox (#9160)

Implementing missing features...
JIRA issue: CORE-19278
- Add IDS_RESTRICTED and IDS_RESTRICTIONS
  resource strings.
- Implement SHRestrictedMessageBox function.
- Modify shlwapi.spec.
- Add prototype into <shlwapi_undoc.h>.
- Restrict Folder Options on
  REST_NOFOLDEROPTIONS by using
  SHRestrictedMessageBox.
This commit is contained in:
Katayama Hirofumi MZ
2026-06-20 09:25:47 +09:00
committed by GitHub
parent 269b585eed
commit 0533a67b18
32 changed files with 89 additions and 12 deletions

View File

@@ -136,6 +136,23 @@ ShowFolderOptionsDialogThreadProc(LPVOID param)
HPROPSHEETPAGE hpage;
UINT num_pages = 0;
// the stub window to hide taskbar button
DWORD style = WS_DISABLED | WS_CLIPSIBLINGS | WS_CAPTION;
DWORD exstyle = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW;
CMSGlobalFolderOptionsStub stub;
if (!stub.Create(NULL, NULL, NULL, style, exstyle))
{
ERR("stub.Create failed\n");
return 0;
}
if (SHRestricted(REST_NOFOLDEROPTIONS))
{
SHRestrictedMessageBox(stub);
stub.DestroyWindow();
return 0;
}
hpage = SH_CreatePropertySheetPage(IDD_FOLDER_OPTIONS_GENERAL, FolderOptionsGeneralDlg, 0, NULL);
if (hpage)
hppages[num_pages++] = hpage;
@@ -148,16 +165,6 @@ ShowFolderOptionsDialogThreadProc(LPVOID param)
if (hpage)
hppages[num_pages++] = hpage;
// the stub window to hide taskbar button
DWORD style = WS_DISABLED | WS_CLIPSIBLINGS | WS_CAPTION;
DWORD exstyle = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW;
CMSGlobalFolderOptionsStub stub;
if (!stub.Create(NULL, NULL, NULL, style, exstyle))
{
ERR("stub.Create failed\n");
return 0;
}
memset(&pinfo, 0x0, sizeof(PROPSHEETHEADERW));
pinfo.dwSize = sizeof(PROPSHEETHEADERW);
pinfo.dwFlags = PSH_NOCONTEXTHELP | PSH_USEICONID | PSH_USECALLBACK;
@@ -190,7 +197,7 @@ ShowFolderOptionsDialog(UINT Page, BOOL Async = FALSE)
SetForegroundWindow(hPop);
return;
}
LPVOID param = UlongToPtr(Page);
if (Async)
SHCreateThread(ShowFolderOptionsDialogThreadProc, param, 0, 0);

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s To"
IDS_PB_FORMAT "%s Po"
IDS_EB_FORMAT "%s Eo"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -35,6 +35,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -34,6 +34,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -36,6 +36,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -36,6 +36,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TO"
IDS_PB_FORMAT "%s PO"
IDS_EB_FORMAT "%s EO"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s ТБ"
IDS_PB_FORMAT "%s ПБ"
IDS_EB_FORMAT "%s ЭБ"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -34,6 +34,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -33,6 +33,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -36,6 +36,8 @@ STRINGTABLE
IDS_TB_FORMAT "%s TB"
IDS_PB_FORMAT "%s PB"
IDS_EB_FORMAT "%s EB"
IDS_RESTRICTED "This operation has been cancelled due to restrictions on this computer. Please contact your system administrator."
IDS_RESTRICTIONS "Restrictions"
#endif
}

View File

@@ -29,6 +29,7 @@
#ifdef __REACTOS__
EXTERN_C HRESULT VariantChangeTypeForRead(_Inout_ VARIANTARG *pvarg, _In_ VARTYPE vt);
EXTERN_C DECLSPEC_HIDDEN HINSTANCE shlwapi_hInstance;
EXTERN_C ULONG WINAPI GetProcessOsVersion(void);
#endif

View File

@@ -34,6 +34,8 @@
#define IDS_TB_FORMAT 71
#define IDS_PB_FORMAT 72
#define IDS_EB_FORMAT 73
#define IDS_RESTRICTED 283
#define IDS_RESTRICTIONS 284
#endif
/* These numbers match native IDs and shouldn't be arbitrarily changed */

View File

@@ -381,7 +381,7 @@
381 stub -noname AssocCopyVerbs
382 stdcall -noname ZoneComputePaneSize(ptr)
383 stub -noname ZoneConfigureW
384 stub -noname SHRestrictedMessageBox
384 stdcall -noname SHRestrictedMessageBox(ptr)
385 stub -noname SHLoadRawAccelerators
386 stub -noname SHQueryRawAccelerator
387 stub -noname SHQueryRawAcceleratorMsg

View File

@@ -22,6 +22,7 @@
#include <shlguid_undoc.h>
#include <userenv.h>
#include <atlstr.h>
#include "resource.h"
#include <shlwapi_undoc.h>
#include <ishellfolder_helpers.h>
@@ -1241,6 +1242,18 @@ BOOL WINAPI SHGetFileDescriptionA(
return ret;
}
/*************************************************************************
* SHRestrictedMessageBox [SHLWAPI.384]
*
* @see https://www.geoffchappell.com/studies/windows/shell/shlwapi/api/util/restrictions/messagebox.htm
* @see ShellMessageBoxW
*/
EXTERN_C INT WINAPI SHRestrictedMessageBox(_In_ HWND hWnd)
{
return ShellMessageBoxW(shlwapi_hInstance, hWnd, MAKEINTRESOURCEW(IDS_RESTRICTED),
MAKEINTRESOURCEW(IDS_RESTRICTIONS), MB_ICONERROR);
}
EXTERN_C ULONG WINAPI GetProcessOsVersion(void)
{
PPEB Peb = NtCurrentTeb()->Peb;

View File

@@ -58,6 +58,8 @@ SHRestrictionLookup(
_In_ const POLICYDATA *polTable,
_Inout_ LPDWORD polArr);
INT WINAPI SHRestrictedMessageBox(_In_ HWND hWnd);
BOOL WINAPI SHAboutInfoA(LPSTR lpszDest, DWORD dwDestLen);
BOOL WINAPI SHAboutInfoW(LPWSTR lpszDest, DWORD dwDestLen);