[SHLWAPI][EXPLORER] Implement OS_SERVERADMINUI

This commit is contained in:
Whindmar Saksit 2024-06-25 03:33:45 +02:00
parent d769f5675d
commit d97a1be972
2 changed files with 50 additions and 0 deletions

View file

@ -49,6 +49,41 @@ static VOID InitializeAtlModule(HINSTANCE hInstance, BOOL bInitialize)
}
}
static BOOL
GetServerAdminUIDefault()
{
BOOL server;
DWORD value = 0, size = sizeof(value);
LPCWSTR rosregpath = L"SYSTEM\\CurrentControlSet\\Control\\ReactOS\\Settings\\Version";
if (SHGetValueW(HKEY_LOCAL_MACHINE, rosregpath, L"ReportAsWorkstation", NULL, &value, &size) == NO_ERROR)
server = value == 0;
else
server = IsOS(OS_ANYSERVER);
return server && IsUserAnAdmin();
}
static void
InitializeServerAdminUI()
{
HKEY hKey = SHGetShellKey(SHKEY_Root_HKCU | SHKEY_Key_Explorer, L"Advanced", TRUE);
if (hKey)
{
DWORD value, size = sizeof(value), type;
DWORD error = SHGetValueW(hKey, NULL, L"ServerAdminUI", &type, &value, &size);
if (error || type != REG_DWORD || size != sizeof(value))
{
value = GetServerAdminUIDefault();
if (value)
{
// TODO: Apply registry tweaks with RegInstallW; RegServerAdmin in the REGINST resource in shell32.
SystemParametersInfo(SPI_SETKEYBOARDCUES, 0, IntToPtr(TRUE), SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
}
SHSetValueW(hKey, NULL, L"ServerAdminUI", REG_DWORD, &value, sizeof(value));
}
RegCloseKey(hKey);
}
}
#if !WIN7_DEBUG_MODE
static BOOL
SetShellReadyEvent(IN LPCWSTR lpEventName)
@ -199,6 +234,8 @@ StartWithDesktop(IN HINSTANCE hInstance)
if (!SetShellReadyEvent(L"msgina: ShellReadyEvent"))
SetShellReadyEvent(L"Global\\msgina: ShellReadyEvent");
InitializeServerAdminUI();
if (DoStartStartupItems(Tray))
{
ProcessStartupItems();

View file

@ -4225,8 +4225,21 @@ BOOL WINAPI IsOS(DWORD feature)
FIXME("(OS_TABLETPC) What should we return here?\n");
return FALSE;
case OS_SERVERADMINUI:
#ifdef __REACTOS__
{
DWORD value = FALSE, size = sizeof(value);
HKEY hKey = SHGetShellKey(SHKEY_Root_HKCU | SHKEY_Key_Explorer, L"Advanced", FALSE);
if (hKey)
{
SHQueryValueExW(hKey, L"ServerAdminUI", NULL, NULL, &value, &size);
RegCloseKey(hKey);
}
ISOS_RETURN(value);
}
#else
FIXME("(OS_SERVERADMINUI) What should we return here?\n");
return FALSE;
#endif
case OS_MEDIACENTER:
FIXME("(OS_MEDIACENTER) What should we return here?\n");
return FALSE;