diff --git a/base/applications/kbswitch/kbswitch.c b/base/applications/kbswitch/kbswitch.c index 72b517384a7..9487956bc9d 100644 --- a/base/applications/kbswitch/kbswitch.c +++ b/base/applications/kbswitch/kbswitch.c @@ -11,6 +11,7 @@ #include #include #include +#include /* * This program kbswitch is a mimic of Win2k's internat.exe. @@ -26,13 +27,6 @@ * won't be generated in Vista+. */ -#define IME_MASK (0xE0000000UL) -#define SPECIAL_MASK (0xF0000000UL) - -#define IS_IME_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == IME_MASK) -#define IS_SPECIAL_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == SPECIAL_MASK) -#define SPECIALIDFROMHKL(hKL) ((WORD)(HIWORD(hKL) & 0x0FFF)) - #define WM_NOTIFYICONMSG (WM_USER + 248) PKBSWITCHSETHOOKS KbSwitchSetHooks = NULL; diff --git a/base/shell/explorer/resource.h b/base/shell/explorer/resource.h index 1d79e677842..f78d7538e9a 100644 --- a/base/shell/explorer/resource.h +++ b/base/shell/explorer/resource.h @@ -109,6 +109,11 @@ /* These values must be synchronized with shell32 */ #define IDS_ADVANCED_DISPLAY_FAVORITES 30466 #define IDS_ADVANCED_DISPLAY_LOG_OFF 30467 +#define IDS_ADVANCED_EXPAND_CONTROL_PANEL 30468 +#define IDS_ADVANCED_EXPAND_MY_DOCUMENTS 30469 +#define IDS_ADVANCED_EXPAND_PRINTERS 30470 +#define IDS_ADVANCED_EXPAND_MY_PICTURES 30472 +#define IDS_ADVANCED_EXPAND_NET_CONNECTIONS 30473 #define IDS_ADVANCED_DISPLAY_RUN 30474 #define IDS_ADVANCED_DISPLAY_ADMINTOOLS 30476 diff --git a/base/shell/explorer/startmnucust.cpp b/base/shell/explorer/startmnucust.cpp index b4465de9722..922d4581aab 100644 --- a/base/shell/explorer/startmnucust.cpp +++ b/base/shell/explorer/startmnucust.cpp @@ -21,6 +21,7 @@ #include "precomp.h" +#define I_UNCHECKED 1 #define I_CHECKED 2 // TODO: Windows Explorer appears to be calling NewLinkHere / ConfigStartMenu directly for both items. @@ -82,34 +83,57 @@ struct CUSTOMIZE_ENTRY { LPARAM id; LPCWSTR name; - FN_CUSTOMIZE_READ fnRead; - FN_CUSTOMIZE_WRITE fnWrite; + BOOL bDefaultValue; + RESTRICTIONS policy1, policy2; }; -static DWORD CALLBACK CustomizeRead0(const CUSTOMIZE_ENTRY *entry) -{ - return GetAdvancedBool(entry->name, FALSE); -} - -static BOOL CALLBACK CustomizeWrite0(const CUSTOMIZE_ENTRY *entry, DWORD dwValue) -{ - return SetAdvancedDword(entry->name, dwValue); -} - static const CUSTOMIZE_ENTRY s_CustomizeEntries[] = { - // FIXME: Make "StartMenuAdminTools" effective - //{ IDS_ADVANCED_DISPLAY_ADMINTOOLS, L"StartMenuAdminTools", CustomizeRead1, CustomizeWrite1 }, // FIXME - - { IDS_ADVANCED_DISPLAY_FAVORITES, L"StartMenuFavorites", CustomizeRead0, CustomizeWrite0 }, - { IDS_ADVANCED_DISPLAY_LOG_OFF, L"StartMenuLogoff", CustomizeRead0, CustomizeWrite0 }, - - // FIXME: SHRestricted is buggy! - //{ IDS_ADVANCED_DISPLAY_RUN, L"NoRun", CustomizeRead2, CustomizeWrite2 }, + { + IDS_ADVANCED_DISPLAY_ADMINTOOLS, L"StartMenuAdminTools", TRUE, + }, + { + IDS_ADVANCED_DISPLAY_FAVORITES, L"StartMenuFavorites", FALSE, + REST_NOFAVORITESMENU + }, + { + IDS_ADVANCED_DISPLAY_LOG_OFF, L"StartMenuLogoff", FALSE, + REST_STARTMENULOGOFF + }, + { + IDS_ADVANCED_DISPLAY_RUN, L"StartMenuRun", TRUE, + REST_NORUN + }, + { + IDS_ADVANCED_EXPAND_MY_DOCUMENTS, L"CascadeMyDocuments", FALSE, + REST_NOSMMYDOCS + }, + { + IDS_ADVANCED_EXPAND_MY_PICTURES, L"CascadeMyPictures", FALSE, + REST_NOSMMYPICS + }, + { + IDS_ADVANCED_EXPAND_CONTROL_PANEL, L"CascadeControlPanel", FALSE, + REST_NOSETFOLDERS, REST_NOCONTROLPANEL, + }, + { + IDS_ADVANCED_EXPAND_PRINTERS, L"CascadePrinters", FALSE, + REST_NOSETFOLDERS + }, + { + IDS_ADVANCED_EXPAND_NET_CONNECTIONS, L"CascadeNetworkConnections", FALSE, + REST_NOSETFOLDERS, REST_NONETWORKCONNECTIONS + }, }; static VOID AddCustomizeItem(HWND hTreeView, const CUSTOMIZE_ENTRY *entry) { + if (SHRestricted(entry->policy1) || SHRestricted(entry->policy2)) + { + TRACE("%p: Restricted\n", entry->id); + return; // Restricted. Don't show + } + TV_INSERTSTRUCT Insert = { TVI_ROOT, TVI_LAST }; Insert.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM; @@ -118,8 +142,9 @@ static VOID AddCustomizeItem(HWND hTreeView, const CUSTOMIZE_ENTRY *entry) Insert.item.pszText = szText; Insert.item.lParam = entry->id; Insert.item.stateMask = TVIS_STATEIMAGEMASK; - if (entry->fnRead(entry)) - Insert.item.state = INDEXTOSTATEIMAGEMASK(I_CHECKED); + BOOL bChecked = GetAdvancedBool(entry->name, entry->bDefaultValue); + Insert.item.state = INDEXTOSTATEIMAGEMASK(bChecked ? I_CHECKED : I_UNCHECKED); + TRACE("%p: %d\n", entry->id, bChecked); TreeView_InsertItem(hTreeView, &Insert); } @@ -142,7 +167,7 @@ static BOOL CustomizeClassic_OnOK(HWND hwnd) { HWND hTreeView = GetDlgItem(hwnd, IDC_CLASSICSTART_SETTINGS); - for (HTREEITEM hItem = TreeView_GetFirstVisible(hTreeView); + for (HTREEITEM hItem = TreeView_GetRoot(hTreeView); hItem != NULL; hItem = TreeView_GetNextVisible(hTreeView, hItem)) { @@ -151,12 +176,16 @@ static BOOL CustomizeClassic_OnOK(HWND hwnd) item.stateMask = TVIS_STATEIMAGEMASK; TreeView_GetItem(hTreeView, &item); - BOOL bChecked = (item.state & INDEXTOSTATEIMAGEMASK(I_CHECKED)); + BOOL bChecked = !!(item.state & INDEXTOSTATEIMAGEMASK(I_CHECKED)); for (auto& entry : s_CustomizeEntries) { + if (SHRestricted(entry.policy1) || SHRestricted(entry.policy2)) + continue; + if (item.lParam == entry.id) { - entry.fnWrite(&entry, bChecked); + TRACE("%p: %d\n", item.lParam, bChecked); + SetAdvancedDword(entry.name, bChecked); break; } } diff --git a/base/shell/explorer/startmnusite.cpp b/base/shell/explorer/startmnusite.cpp index 5f52b43de36..872a24e335e 100644 --- a/base/shell/explorer/startmnusite.cpp +++ b/base/shell/explorer/startmnusite.cpp @@ -130,107 +130,96 @@ class CStartMenuSite : /* Remove menu items that don't apply */ - dwLogoff = SHRestricted(REST_STARTMENULOGOFF); - bWantLogoff = (dwLogoff == 2 || - SHRestricted(REST_FORCESTARTMENULOGOFF) || - GetAdvancedBool(L"StartMenuLogoff", FALSE)); - /* Favorites */ - if (!GetAdvancedBool(L"StartMenuFavorites", FALSE)) + if (SHRestricted(REST_NOFAVORITESMENU) || + !GetAdvancedBool(L"StartMenuFavorites", FALSE)) { - DeleteMenu(hMenu, - IDM_FAVORITES, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_FAVORITES, MF_BYCOMMAND); } /* Documents */ - if (SHRestricted(REST_NORECENTDOCSMENU)) + if (SHRestricted(REST_NORECENTDOCSMENU) || + !GetAdvancedBool(L"Start_ShowRecentDocs", TRUE)) { - DeleteMenu(hMenu, - IDM_DOCUMENTS, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_DOCUMENTS, MF_BYCOMMAND); } /* Settings */ - hSettingsMenu = FindSubMenu(hMenu, - IDM_SETTINGS, - FALSE); - if (hSettingsMenu != NULL) + hSettingsMenu = FindSubMenu(hMenu, IDM_SETTINGS, FALSE); + + /* Control Panel */ + if (SHRestricted(REST_NOSETFOLDERS) || + SHRestricted(REST_NOCONTROLPANEL) || + !GetAdvancedBool(L"Start_ShowControlPanel", TRUE)) { - if (SHRestricted(REST_NOSETFOLDERS)) - { - /* Control Panel */ - if (SHRestricted(REST_NOCONTROLPANEL)) - { - DeleteMenu(hSettingsMenu, - IDM_CONTROLPANEL, - MF_BYCOMMAND); - - /* Delete the separator below it */ - DeleteMenu(hSettingsMenu, - 0, - MF_BYPOSITION); - } - - /* Network Connections */ - if (SHRestricted(REST_NONETWORKCONNECTIONS)) - { - DeleteMenu(hSettingsMenu, - IDM_NETWORKCONNECTIONS, - MF_BYCOMMAND); - } - - /* Printers and Faxes */ - DeleteMenu(hSettingsMenu, - IDM_PRINTERSANDFAXES, - MF_BYCOMMAND); - } + DeleteMenu(hSettingsMenu, IDM_CONTROLPANEL, MF_BYCOMMAND); - /* Security */ - if (GetSystemMetrics(SM_REMOTECONTROL) == 0 || - SHRestricted(REST_NOSECURITY)) - { - DeleteMenu(hSettingsMenu, - IDM_SECURITY, - MF_BYCOMMAND); - } + /* Delete the separator below it */ + DeleteMenu(hSettingsMenu, 0, MF_BYPOSITION); + } - if (GetMenuItemCount(hSettingsMenu) == 0) - { - DeleteMenu(hMenu, - IDM_SETTINGS, - MF_BYCOMMAND); - } + /* Network Connections */ + if (SHRestricted(REST_NOSETFOLDERS) || + SHRestricted(REST_NONETWORKCONNECTIONS) || + !GetAdvancedBool(L"Start_ShowNetConn", TRUE)) + { + DeleteMenu(hSettingsMenu, IDM_NETWORKCONNECTIONS, MF_BYCOMMAND); + } + + /* Printers and Faxes */ + if (SHRestricted(REST_NOSETFOLDERS) || + !GetAdvancedBool(L"Start_ShowPrinters", TRUE)) + { + DeleteMenu(hSettingsMenu, IDM_PRINTERSANDFAXES, MF_BYCOMMAND); + } + + /* Security */ + if (SHRestricted(REST_NOSETFOLDERS) || + GetSystemMetrics(SM_REMOTECONTROL) == 0 || + SHRestricted(REST_NOSECURITY)) + { + DeleteMenu(hSettingsMenu, IDM_SECURITY, MF_BYCOMMAND); + } + + /* Delete Settings menu if it was empty */ + if (GetMenuItemCount(hSettingsMenu) == 0) + { + DeleteMenu(hMenu, IDM_SETTINGS, MF_BYCOMMAND); } /* Search */ - if (SHRestricted(REST_NOFIND)) + if (SHRestricted(REST_NOFIND) || + !GetAdvancedBool(L"Start_ShowSearch", TRUE)) { - DeleteMenu(hMenu, - IDM_SEARCH, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_SEARCH, MF_BYCOMMAND); } - /* FIXME: Help */ + /* Help */ + if (SHRestricted(REST_NOSMHELP) || + !GetAdvancedBool(L"Start_ShowHelp", TRUE)) + { + DeleteMenu(hMenu, IDM_HELPANDSUPPORT, MF_BYCOMMAND); + } /* Run */ - if (SHRestricted(REST_NORUN)) + if (SHRestricted(REST_NORUN) || + !GetAdvancedBool(L"StartMenuRun", TRUE)) { - DeleteMenu(hMenu, - IDM_RUN, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_RUN, MF_BYCOMMAND); } /* Synchronize */ if (!ShowSynchronizeMenuItem()) { - DeleteMenu(hMenu, - IDM_SYNCHRONIZE, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_SYNCHRONIZE, MF_BYCOMMAND); uLastItemsCount--; } /* Log off */ + dwLogoff = SHRestricted(REST_STARTMENULOGOFF); + bWantLogoff = (dwLogoff == 2 || + SHRestricted(REST_FORCESTARTMENULOGOFF) || + GetAdvancedBool(L"StartMenuLogoff", FALSE)); if (dwLogoff != 1 && bWantLogoff) { /* FIXME: We need a more sophisticated way to determine whether to show @@ -248,53 +237,41 @@ class CStartMenuSite : szUser)) { /* We couldn't update the menu item, delete it... */ - DeleteMenu(hMenu, - IDM_LOGOFF, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_LOGOFF, MF_BYCOMMAND); } } else { - DeleteMenu(hMenu, - IDM_LOGOFF, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_LOGOFF, MF_BYCOMMAND); uLastItemsCount--; } - /* Disconnect */ - if (GetSystemMetrics(SM_REMOTECONTROL) == 0) + if (SHRestricted(REST_NODISCONNECT) || + GetSystemMetrics(SM_REMOTECONTROL) == 0) { - DeleteMenu(hMenu, - IDM_DISCONNECT, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_DISCONNECT, MF_BYCOMMAND); uLastItemsCount--; } /* Undock computer */ if (!ShowUndockMenuItem()) { - DeleteMenu(hMenu, - IDM_UNDOCKCOMPUTER, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_UNDOCKCOMPUTER, MF_BYCOMMAND); uLastItemsCount--; } /* Shut down */ if (SHRestricted(REST_NOCLOSE)) { - DeleteMenu(hMenu, - IDM_SHUTDOWN, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_SHUTDOWN, MF_BYCOMMAND); uLastItemsCount--; } if (uLastItemsCount == 0) { /* Remove the separator at the end of the menu */ - DeleteMenu(hMenu, - IDM_LASTSTARTMENU_SEPARATOR, - MF_BYCOMMAND); + DeleteMenu(hMenu, IDM_LASTSTARTMENU_SEPARATOR, MF_BYCOMMAND); } return S_OK; diff --git a/boot/boot_images.cmake b/boot/boot_images.cmake index ae3e600c05b..a140a4b1104 100644 --- a/boot/boot_images.cmake +++ b/boot/boot_images.cmake @@ -100,7 +100,7 @@ function(add_user_profile_dirs _image_filelist _rootdir _username) file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Recent=${CMAKE_CURRENT_BINARY_DIR}/empty\n") file(APPEND ${_image_filelist} "${_rootdir}/${_username}/SendTo=${CMAKE_CURRENT_BINARY_DIR}/empty\n") file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs=${CMAKE_CURRENT_BINARY_DIR}/empty\n") - file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/Administrative Tools=${CMAKE_CURRENT_BINARY_DIR}/empty\n") + #file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/Administrative Tools=${CMAKE_CURRENT_BINARY_DIR}/empty\n") # CORE-12328 file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Start Menu/Programs/StartUp=${CMAKE_CURRENT_BINARY_DIR}/empty\n") file(APPEND ${_image_filelist} "${_rootdir}/${_username}/Templates=${CMAKE_CURRENT_BINARY_DIR}/empty\n") endfunction() diff --git a/boot/freeldr/freeldr/arch/i386/hwdisk.c b/boot/freeldr/freeldr/arch/i386/hwdisk.c index 0a7ef8600ae..421fd38d48c 100644 --- a/boot/freeldr/freeldr/arch/i386/hwdisk.c +++ b/boot/freeldr/freeldr/arch/i386/hwdisk.c @@ -28,6 +28,9 @@ DBG_DEFAULT_CHANNEL(HWDETECT); * This is the common code for harddisk for both the PC and the XBOX. */ +#define FIRST_BIOS_DISK 0x80 +#define FIRST_PARTITION 1 + typedef struct tagDISKCONTEXT { UCHAR DriveNumber; @@ -248,7 +251,7 @@ static const DEVVTBL DiskVtbl = PCHAR GetHarddiskIdentifier(UCHAR DriveNumber) { - return PcDiskIdentifier[DriveNumber - 0x80]; + return PcDiskIdentifier[DriveNumber - FIRST_BIOS_DISK]; } static VOID @@ -262,7 +265,7 @@ GetHarddiskInformation(UCHAR DriveNumber) BOOLEAN ValidPartitionTable; CHAR ArcName[MAX_PATH]; PARTITION_TABLE_ENTRY PartitionTableEntry; - PCHAR Identifier = PcDiskIdentifier[DriveNumber - 0x80]; + PCHAR Identifier = PcDiskIdentifier[DriveNumber - FIRST_BIOS_DISK]; /* Detect disk partition type */ DiskDetectPartitionType(DriveNumber); @@ -272,7 +275,7 @@ GetHarddiskInformation(UCHAR DriveNumber) { ERR("Reading MBR failed\n"); /* We failed, use a default identifier */ - sprintf(Identifier, "BIOSDISK%d", DriveNumber - 0x80 + 1); + sprintf(Identifier, "BIOSDISK%d", DriveNumber - FIRST_BIOS_DISK + 1); return; } @@ -294,20 +297,20 @@ GetHarddiskInformation(UCHAR DriveNumber) ValidPartitionTable = (Mbr->MasterBootRecordMagic == 0xAA55); /* Fill out the ARC disk block */ - sprintf(ArcName, "multi(0)disk(0)rdisk(%u)", DriveNumber - 0x80); + sprintf(ArcName, "multi(0)disk(0)rdisk(%u)", DriveNumber - FIRST_BIOS_DISK); AddReactOSArcDiskInfo(ArcName, Signature, Checksum, ValidPartitionTable); - sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", DriveNumber - 0x80); + sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", DriveNumber - FIRST_BIOS_DISK); FsRegisterDevice(ArcName, &DiskVtbl); /* Add partitions */ - i = 1; + i = FIRST_PARTITION; DiskReportError(FALSE); while (DiskGetPartitionEntry(DriveNumber, i, &PartitionTableEntry)) { if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED) { - sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(%lu)", DriveNumber - 0x80, i); + sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(%lu)", DriveNumber - FIRST_BIOS_DISK, i); FsRegisterDevice(ArcName, &DiskVtbl); } i++; @@ -350,7 +353,7 @@ EnumerateHarddisks(OUT PBOOLEAN BootDriveReported) /* Count the number of visible harddisk drives */ DiskReportError(FALSE); DiskCount = 0; - DriveNumber = 0x80; + DriveNumber = FIRST_BIOS_DISK; ASSERT(DiskReadBufferSize > 0); @@ -432,7 +435,7 @@ DiskGetBootPath(BOOLEAN IsPxe) // RtlStringCbPrintfA(FrLdrBootPath, sizeof(FrLdrBootPath), "ramdisk(%u)", 0); RtlStringCbCopyA(FrLdrBootPath, sizeof(FrLdrBootPath), "ramdisk(0)"); } - else if (FrldrBootDrive < 0x80) + else if (FrldrBootDrive < FIRST_BIOS_DISK) { /* This is a floppy */ RtlStringCbPrintfA(FrLdrBootPath, sizeof(FrLdrBootPath), @@ -442,7 +445,7 @@ DiskGetBootPath(BOOLEAN IsPxe) { /* Boot Partition 0xFF is the magic value that indicates booting from CD-ROM (see isoboot.S) */ RtlStringCbPrintfA(FrLdrBootPath, sizeof(FrLdrBootPath), - "multi(0)disk(0)cdrom(%u)", FrldrBootDrive - 0x80); + "multi(0)disk(0)cdrom(%u)", FrldrBootDrive - FIRST_BIOS_DISK); } else { @@ -460,7 +463,7 @@ DiskGetBootPath(BOOLEAN IsPxe) RtlStringCbPrintfA(FrLdrBootPath, sizeof(FrLdrBootPath), "multi(0)disk(0)rdisk(%u)partition(%lu)", - FrldrBootDrive - 0x80, FrldrBootPartition); + FrldrBootDrive - FIRST_BIOS_DISK, FrldrBootPartition); } return TRUE; @@ -479,7 +482,7 @@ PcInitializeBootDevices(VOID) DiskGetBootPath(PxeInit()); /* Add it, if it's a floppy or cdrom */ - if ((FrldrBootDrive >= 0x80 && !BootDriveReported) || + if ((FrldrBootDrive >= FIRST_BIOS_DISK && !BootDriveReported) || DiskIsDriveRemovable(FrldrBootDrive)) { /* TODO: Check if it's really a CDROM drive */ diff --git a/boot/freeldr/freeldr/arch/uefi/stubs.c b/boot/freeldr/freeldr/arch/uefi/stubs.c index e9263d60ba3..f63bd4d2105 100644 --- a/boot/freeldr/freeldr/arch/uefi/stubs.c +++ b/boot/freeldr/freeldr/arch/uefi/stubs.c @@ -7,8 +7,6 @@ #include -#include - #ifndef _M_ARM /* TODO: Handle this with custom Disk / partition setup */ UCHAR diff --git a/boot/freeldr/freeldr/arch/uefi/ueficon.c b/boot/freeldr/freeldr/arch/uefi/ueficon.c index 6dc6eb5b8b6..b3471fd1b83 100644 --- a/boot/freeldr/freeldr/arch/uefi/ueficon.c +++ b/boot/freeldr/freeldr/arch/uefi/ueficon.c @@ -77,6 +77,21 @@ ConvertToBiosExtValue(UCHAR KeyIn) return KEY_RIGHT; case SCAN_LEFT: return KEY_LEFT; + case SCAN_HOME: + return KEY_HOME; + case SCAN_END: + return KEY_END; + + // case SCAN_INSERT: + // break; + + case SCAN_DELETE: + return KEY_DELETE; + + // case SCAN_PAGE_UP: + // case SCAN_PAGE_DOWN: + // break; + case SCAN_F1: return KEY_F1; case SCAN_F2: @@ -99,8 +114,6 @@ ConvertToBiosExtValue(UCHAR KeyIn) return KEY_F10; case SCAN_ESC: return KEY_ESC; - case SCAN_DELETE: - return KEY_DELETE; } return 0; } diff --git a/boot/freeldr/freeldr/arch/uefi/uefidisk.c b/boot/freeldr/freeldr/arch/uefi/uefidisk.c index 4905e2b867f..2d5458d4707 100644 --- a/boot/freeldr/freeldr/arch/uefi/uefidisk.c +++ b/boot/freeldr/freeldr/arch/uefi/uefidisk.c @@ -98,7 +98,7 @@ UefiGetBootPartitionEntry( { TRACE("Boot PartitionNumber is 0\n"); /* The OffsetToBoot is equal to the RootIdentifier */ - PartitionNum = 1; + PartitionNum = FIRST_PARTITION; } *BootPartition = PartitionNum; @@ -395,7 +395,7 @@ UefiSetupBlockDevices(VOID) PcBiosDiskCount = 0; UefiBootRootIdentifier = 0; - /* 1) Setup a list of boothandles by using the LocateHandle protocol */ + /* 1) Setup a list of boot handles by using the LocateHandle protocol */ Status = GlobalSystemTable->BootServices->LocateHandle(ByProtocol, &bioGuid, NULL, &handle_size, handles); handles = MmAllocateMemoryWithType(handle_size, LoaderFirmwareTemporary); Status = GlobalSystemTable->BootServices->LocateHandle(ByProtocol, &bioGuid, NULL, &handle_size, handles); diff --git a/boot/freeldr/freeldr/arch/uefi/uefisetup.c b/boot/freeldr/freeldr/arch/uefi/uefisetup.c index ec3b0d405a6..a7950c67621 100644 --- a/boot/freeldr/freeldr/arch/uefi/uefisetup.c +++ b/boot/freeldr/freeldr/arch/uefi/uefisetup.c @@ -52,7 +52,7 @@ MachInit(const char *CmdLine) MachVtbl.HwIdle = UefiHwIdle; /* Setup GOP */ - if (UefiInitalizeVideo() != EFI_SUCCESS) + if (UefiInitializeVideo() != EFI_SUCCESS) { ERR("Failed to setup GOP\n"); } diff --git a/boot/freeldr/freeldr/arch/uefi/uefivid.c b/boot/freeldr/freeldr/arch/uefi/uefivid.c index 341798c4d85..2afd69aee18 100644 --- a/boot/freeldr/freeldr/arch/uefi/uefivid.c +++ b/boot/freeldr/freeldr/arch/uefi/uefivid.c @@ -28,7 +28,7 @@ EFI_GUID EfiGraphicsOutputProtocol = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; /* FUNCTIONS ******************************************************************/ EFI_STATUS -UefiInitalizeVideo(VOID) +UefiInitializeVideo(VOID) { EFI_STATUS Status; EFI_GRAPHICS_OUTPUT_PROTOCOL* gop = NULL; diff --git a/boot/freeldr/freeldr/bootmgr.c b/boot/freeldr/freeldr/bootmgr.c index 2c837951fec..98abf5ed955 100644 --- a/boot/freeldr/freeldr/bootmgr.c +++ b/boot/freeldr/freeldr/bootmgr.c @@ -26,31 +26,33 @@ DBG_DEFAULT_CHANNEL(WARNING); /* GLOBALS ********************************************************************/ -typedef -VOID +typedef VOID (*EDIT_OS_ENTRY_PROC)( - IN OUT OperatingSystemItem* OperatingSystem); + _Inout_ OperatingSystemItem* OperatingSystem); static VOID EditCustomBootReactOSSetup( - IN OUT OperatingSystemItem* OperatingSystem) + _Inout_ OperatingSystemItem* OperatingSystem) { EditCustomBootReactOS(OperatingSystem, TRUE); } static VOID EditCustomBootNTOS( - IN OUT OperatingSystemItem* OperatingSystem) + _Inout_ OperatingSystemItem* OperatingSystem) { EditCustomBootReactOS(OperatingSystem, FALSE); } -static const struct +typedef struct _OS_LOADING_METHOD { PCSTR BootType; EDIT_OS_ENTRY_PROC EditOsEntry; ARC_ENTRY_POINT OsLoader; -} OSLoadingMethods[] = +} OS_LOADING_METHOD, *POS_LOADING_METHOD; + +static const OS_LOADING_METHOD +OSLoadingMethods[] = { {"ReactOSSetup", EditCustomBootReactOSSetup, LoadReactOSSetup}, @@ -71,13 +73,40 @@ static const struct /* FUNCTIONS ******************************************************************/ +static const OS_LOADING_METHOD* +GetOSLoadingMethod( + _In_ ULONG_PTR SectionId) +{ + ULONG i; + CHAR BootType[80]; + + /* The operating system section has been opened by InitOperatingSystemList() */ + ASSERT(SectionId != 0); + + /* Try to read the boot type. We must have the value (it + * has been possibly added by InitOperatingSystemList()) */ + *BootType = ANSI_NULL; + IniReadSettingByName(SectionId, "BootType", BootType, sizeof(BootType)); + ASSERT(*BootType); + + /* Find the suitable OS loading method */ + for (i = 0; ; ++i) + { + if (i >= RTL_NUMBER_OF(OSLoadingMethods)) + return NULL; + if (_stricmp(BootType, OSLoadingMethods[i].BootType) == 0) + return &OSLoadingMethods[i]; + } + UNREACHABLE; +} + /* * This function converts the list of key=value options in the given operating * system section into an ARC-compatible argument vector, providing in addition * the extra mandatory Software Loading Environment Variables, following the * ARC specification. */ -PCHAR* +static PCHAR* BuildArgvForOsLoader( IN PCSTR LoadIdentifier, IN ULONG_PTR SectionId, @@ -177,23 +206,25 @@ BuildArgvForOsLoader( return Argv; } -VOID LoadOperatingSystem(IN OperatingSystemItem* OperatingSystem) +VOID +LoadOperatingSystem( + _In_ OperatingSystemItem* OperatingSystem) { ULONG_PTR SectionId = OperatingSystem->SectionId; - ULONG i; + const OS_LOADING_METHOD* OSLoadingMethod; ULONG Argc; PCHAR* Argv; - CHAR BootType[80]; - - /* The operating system section has been opened by InitOperatingSystemList() */ - ASSERT(SectionId != 0); - /* Try to read the boot type */ - *BootType = ANSI_NULL; - IniReadSettingByName(SectionId, "BootType", BootType, sizeof(BootType)); + /* Find the suitable OS loader to start */ + OSLoadingMethod = GetOSLoadingMethod(SectionId); + if (!OSLoadingMethod) + return; + ASSERT(OSLoadingMethod->OsLoader); - /* We must have the "BootType" value (it has been possibly added by InitOperatingSystemList()) */ - ASSERT(*BootType); + /* Build the ARC-compatible argument vector */ + Argv = BuildArgvForOsLoader(OperatingSystem->LoadIdentifier, SectionId, &Argc); + if (!Argv) + return; // Unexpected failure. #ifdef _M_IX86 #ifndef UEFIBOOT @@ -202,56 +233,25 @@ VOID LoadOperatingSystem(IN OperatingSystemItem* OperatingSystem) #endif #endif - /* Find the suitable OS loader to start */ - for (i = 0; ; ++i) - { - if (i >= RTL_NUMBER_OF(OSLoadingMethods)) - return; - if (_stricmp(BootType, OSLoadingMethods[i].BootType) == 0) - break; - } - - /* Build the ARC-compatible argument vector */ - Argv = BuildArgvForOsLoader(OperatingSystem->LoadIdentifier, SectionId, &Argc); - if (!Argv) - return; // Unexpected failure. - /* Start the OS loader */ - OSLoadingMethods[i].OsLoader(Argc, Argv, NULL); + OSLoadingMethod->OsLoader(Argc, Argv, NULL); FrLdrHeapFree(Argv, TAG_STRING); } #ifdef HAS_OPTION_MENU_EDIT_CMDLINE - -VOID EditOperatingSystemEntry(IN OperatingSystemItem* OperatingSystem) +VOID +EditOperatingSystemEntry( + _Inout_ OperatingSystemItem* OperatingSystem) { - ULONG_PTR SectionId = OperatingSystem->SectionId; - ULONG i; - CHAR BootType[80]; - - /* The operating system section has been opened by InitOperatingSystemList() */ - ASSERT(SectionId != 0); - - /* Try to read the boot type */ - *BootType = ANSI_NULL; - IniReadSettingByName(SectionId, "BootType", BootType, sizeof(BootType)); - - /* We must have the "BootType" value (it has been possibly added by InitOperatingSystemList()) */ - ASSERT(*BootType); - - /* Find the suitable OS entry editor */ - for (i = 0; ; ++i) + /* Find the suitable OS entry editor and open it */ + const OS_LOADING_METHOD* OSLoadingMethod = + GetOSLoadingMethod(OperatingSystem->SectionId); + if (OSLoadingMethod) { - if (i >= RTL_NUMBER_OF(OSLoadingMethods)) - return; - if (_stricmp(BootType, OSLoadingMethods[i].BootType) == 0) - break; + ASSERT(OSLoadingMethod->EditOsEntry); + OSLoadingMethod->EditOsEntry(OperatingSystem); } - - /* Run it */ - OSLoadingMethods[i].EditOsEntry(OperatingSystem); } - #endif // HAS_OPTION_MENU_EDIT_CMDLINE static LONG diff --git a/boot/freeldr/freeldr/include/arch/uefi/machuefi.h b/boot/freeldr/freeldr/include/arch/uefi/machuefi.h index 6df376b1494..dbae085dbd2 100644 --- a/boot/freeldr/freeldr/include/arch/uefi/machuefi.h +++ b/boot/freeldr/freeldr/include/arch/uefi/machuefi.h @@ -7,24 +7,17 @@ #include -EFI_STATUS -UefiMachInit(_In_ EFI_HANDLE ImageHandle, - _In_ EFI_SYSTEM_TABLE *SystemTable); - VOID UefiConsPutChar(int Ch); BOOLEAN UefiConsKbHit(VOID); -VOID -UefiConsSetCursor(UINT32 Col, UINT32 Row); - int UefiConsGetCh(void); EFI_STATUS -UefiInitalizeVideo(VOID); +UefiInitializeVideo(VOID); VOID UefiVideoClearScreen(UCHAR Attr); @@ -47,10 +40,6 @@ UefiVideoSetTextCursorPosition(UCHAR X, UCHAR Y); VOID UefiVideoHideShowTextCursor(BOOLEAN Show); -VOID -UefiVideoOutputChar(UCHAR Char, unsigned X, - unsigned Y, ULONG FgColor, ULONG BgColor); - VOID UefiVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); diff --git a/boot/freeldr/freeldr/include/freeldr.h b/boot/freeldr/freeldr/include/freeldr.h index ca03b496b86..f37e585b232 100644 --- a/boot/freeldr/freeldr/include/freeldr.h +++ b/boot/freeldr/freeldr/include/freeldr.h @@ -113,11 +113,9 @@ #include #endif #include -#include #elif defined(_M_AMD64) #include #include -#include #elif defined(_M_PPC) #include #elif defined(_M_ARM) @@ -127,10 +125,17 @@ #endif VOID __cdecl BootMain(IN PCCH CmdLine); -VOID LoadOperatingSystem(IN OperatingSystemItem* OperatingSystem); + +VOID +LoadOperatingSystem( + _In_ OperatingSystemItem* OperatingSystem); + #ifdef HAS_OPTION_MENU_EDIT_CMDLINE -VOID EditOperatingSystemEntry(IN OperatingSystemItem* OperatingSystem); +VOID +EditOperatingSystemEntry( + _Inout_ OperatingSystemItem* OperatingSystem); #endif + VOID RunLoader(VOID); VOID FrLdrCheckCpuCompatibility(VOID); diff --git a/boot/freeldr/freeldr/include/ui.h b/boot/freeldr/freeldr/include/ui.h index 7a7e5cfc6e3..1b47cc89447 100644 --- a/boot/freeldr/freeldr/include/ui.h +++ b/boot/freeldr/freeldr/include/ui.h @@ -49,11 +49,7 @@ extern CHAR UiTimeText[260]; extern const PCSTR UiMonthNames[12]; -/////////////////////////////////////////////////////////////////////////////////////// -// -// User Interface Functions -// -/////////////////////////////////////////////////////////////////////////////////////// +/* User Interface Functions **************************************************/ BOOLEAN UiInitialize(BOOLEAN ShowUi); // Initialize User-Interface VOID UiUnInitialize(PCSTR BootText); // Un-initialize User-Interface @@ -91,10 +87,21 @@ UiDrawCenteredText( VOID UiDrawStatusText(PCSTR StatusText); // Draws text at the very bottom line on the screen VOID UiUpdateDateTime(VOID); // Updates the date and time -VOID UiInfoBox(PCSTR MessageText); // Displays a info box on the screen -VOID UiMessageBox(PCSTR Format, ...); // Displays a message box on the screen with an ok button -VOID UiMessageBoxCritical(PCSTR MessageText); // Displays a message box on the screen with an ok button using no system resources +/* Displays an info box on the screen */ +VOID +UiInfoBox( + _In_ PCSTR MessageText); + +/* Displays a message box on the screen with an ok button */ +VOID +UiMessageBox( + _In_ PCSTR Format, ...); + +/* Displays a message box on the screen with an ok button using no system resources */ +VOID +UiMessageBoxCritical( + _In_ PCSTR MessageText); /* Loading Progress-Bar Functions ********************************************/ @@ -192,11 +199,7 @@ UCHAR UiTextToFillStyle(PCSTR FillStyleText); // Converts the VOID UiFadeInBackdrop(VOID); // Draws the backdrop and fades the screen in VOID UiFadeOut(VOID); // Fades the screen out -/////////////////////////////////////////////////////////////////////////////////////// -// -// Menu Functions -// -/////////////////////////////////////////////////////////////////////////////////////// +/* Menu Functions ************************************************************/ typedef struct tagUI_MENU_INFO { diff --git a/boot/freeldr/freeldr/include/ui/gui.h b/boot/freeldr/freeldr/include/ui/gui.h index a2ce9373ad3..e1b2be55890 100644 --- a/boot/freeldr/freeldr/include/ui/gui.h +++ b/boot/freeldr/freeldr/include/ui/gui.h @@ -21,11 +21,8 @@ #define TITLE_BOX_CHAR_HEIGHT 5 -/////////////////////////////////////////////////////////////////////////////////////// -// -// Graphical User Interface Functions -// -/////////////////////////////////////////////////////////////////////////////////////// +/* Graphical User Interface Functions ****************************************/ + VOID GuiDrawBackdrop(VOID); // Fills the entire screen with a backdrop VOID GuiFillArea(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom, UCHAR FillChar, UCHAR Attr /* Color Attributes */); // Fills the area specified with FillChar and Attr VOID GuiDrawShadow(ULONG Left, ULONG Top, ULONG Right, ULONG Bottom); // Draws a shadow on the bottom and right sides of the area specified @@ -34,20 +31,34 @@ VOID GuiDrawText(ULONG X, ULONG Y, PUCHAR Text, UCHAR Attr); // Draws text VOID GuiDrawText2(ULONG X, ULONG Y, ULONG MaxNumChars, PUCHAR Text, UCHAR Attr); // Draws text at coordinates specified VOID GuiDrawStatusText(PCSTR StatusText); // Draws text at the very bottom line on the screen VOID GuiUpdateDateTime(VOID); // Updates the date and time -VOID GuiSaveScreen(PUCHAR Buffer); // Saves the screen so that it can be restored later -VOID GuiRestoreScreen(PUCHAR Buffer); // Restores the screen from a previous save -VOID GuiMessageBox(PCSTR MessageText); // Displays a message box on the screen with an ok button -VOID GuiMessageBoxCritical(PCSTR MessageText); // Displays a message box on the screen with an ok button using no system resources + +/* Saves the screen so that it can be restored later */ +_Ret_maybenull_ +__drv_allocatesMem(Mem) +PUCHAR +GuiSaveScreen(VOID); + +/* Restores the screen from a previous save */ +VOID +GuiRestoreScreen( + _In_opt_ __drv_freesMem(Mem) PUCHAR Buffer); + +/* Displays a message box on the screen with an ok button */ +VOID +GuiMessageBox( + _In_ PCSTR MessageText); + +/* Displays a message box on the screen with an ok button using no system resources */ +VOID +GuiMessageBoxCritical( + _In_ PCSTR MessageText); + VOID GuiDrawProgressBar(ULONG Position, ULONG Range); // Draws the progress bar showing nPos percent filled UCHAR GuiTextToColor(PCSTR ColorText); // Converts the text color into it's equivalent color value UCHAR GuiTextToFillStyle(PCSTR FillStyleText); // Converts the text fill into it's equivalent fill value -/////////////////////////////////////////////////////////////////////////////////////// -// -// Menu Functions -// -/////////////////////////////////////////////////////////////////////////////////////// +/* Menu Functions ************************************************************/ BOOLEAN GuiDisplayMenu( diff --git a/boot/freeldr/freeldr/include/ui/noui.h b/boot/freeldr/freeldr/include/ui/noui.h index 72eca1a9298..df986bfd178 100644 --- a/boot/freeldr/freeldr/include/ui/noui.h +++ b/boot/freeldr/freeldr/include/ui/noui.h @@ -47,8 +47,14 @@ NoUiDrawCenteredText( VOID NoUiDrawStatusText(PCSTR StatusText); VOID NoUiUpdateDateTime(VOID); -VOID NoUiMessageBox(PCSTR MessageText); -VOID NoUiMessageBoxCritical(PCSTR MessageText); + +VOID +NoUiMessageBox( + _In_ PCSTR MessageText); + +VOID +NoUiMessageBoxCritical( + _In_ PCSTR MessageText); /* Loading Progress-Bar Functions ********************************************/ diff --git a/boot/freeldr/freeldr/include/ui/tui.h b/boot/freeldr/freeldr/include/ui/tui.h index cb90ae214a3..9017c0b4ef6 100644 --- a/boot/freeldr/freeldr/include/ui/tui.h +++ b/boot/freeldr/freeldr/include/ui/tui.h @@ -101,10 +101,27 @@ TuiDrawCenteredText( VOID TuiDrawStatusText(PCSTR StatusText); // Draws text at the very bottom line on the screen VOID TuiUpdateDateTime(VOID); // Updates the date and time -VOID TuiSaveScreen(PUCHAR Buffer); // Saves the screen so that it can be restored later -VOID TuiRestoreScreen(PUCHAR Buffer); // Restores the screen from a previous save -VOID TuiMessageBox(PCSTR MessageText); // Displays a message box on the screen with an ok button -VOID TuiMessageBoxCritical(PCSTR MessageText); // Displays a message box on the screen with an ok button using no system resources + +/* Saves the screen so that it can be restored later */ +_Ret_maybenull_ +__drv_allocatesMem(Mem) +PUCHAR +TuiSaveScreen(VOID); + +/* Restores the screen from a previous save */ +VOID +TuiRestoreScreen( + _In_opt_ __drv_freesMem(Mem) PUCHAR Buffer); + +/* Displays a message box on the screen with an ok button */ +VOID +TuiMessageBox( + _In_ PCSTR MessageText); + +/* Displays a message box on the screen with an ok button using no system resources */ +VOID +TuiMessageBoxCritical( + _In_ PCSTR MessageText); BOOLEAN TuiEditBox(PCSTR MessageText, PCHAR EditTextBuffer, ULONG Length); UCHAR TuiTextToColor(PCSTR ColorText); // Converts the text color into it's equivalent color value diff --git a/boot/freeldr/freeldr/lib/inifile/inifile.c b/boot/freeldr/freeldr/lib/inifile/inifile.c index a15102f28da..a1bd7c9f91a 100644 --- a/boot/freeldr/freeldr/lib/inifile/inifile.c +++ b/boot/freeldr/freeldr/lib/inifile/inifile.c @@ -24,14 +24,18 @@ DBG_DEFAULT_CHANNEL(INIFILE); BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR* SectionId) { - PINI_SECTION Section; + PLIST_ENTRY Entry; + PINI_SECTION Section; TRACE("IniOpenSection() SectionName = %s\n", SectionName); - // Loop through each section and find the one they want - Section = CONTAINING_RECORD(IniFileSectionListHead.Flink, INI_SECTION, ListEntry); - while (&Section->ListEntry != &IniFileSectionListHead) + // Loop through each section and find the one we want + for (Entry = IniFileSectionListHead.Flink; + Entry != &IniFileSectionListHead; + Entry = Entry->Flink) { + Section = CONTAINING_RECORD(Entry, INI_SECTION, ListEntry); + // Compare against the section name if (_stricmp(SectionName, Section->SectionName) == 0) { @@ -41,9 +45,6 @@ BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR* SectionId) TRACE("IniOpenSection() Found it! SectionId = 0x%x\n", SectionId); return TRUE; } - - // Get the next section in the list - Section = CONTAINING_RECORD(Section->ListEntry.Flink, INI_SECTION, ListEntry); } TRACE("IniOpenSection() Section not found.\n"); @@ -53,7 +54,7 @@ BOOLEAN IniOpenSection(PCSTR SectionName, ULONG_PTR* SectionId) ULONG IniGetNumSectionItems(ULONG_PTR SectionId) { - PINI_SECTION Section = (PINI_SECTION)SectionId; + PINI_SECTION Section = (PINI_SECTION)SectionId; TRACE("IniGetNumSectionItems() SectionId = 0x%x\n", SectionId); TRACE("IniGetNumSectionItems() Item count = %d\n", Section->SectionItemCount); @@ -63,14 +64,18 @@ ULONG IniGetNumSectionItems(ULONG_PTR SectionId) PINI_SECTION_ITEM IniGetSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber) { - PINI_SECTION Section = (PINI_SECTION)SectionId; - PINI_SECTION_ITEM SectionItem; + PINI_SECTION Section = (PINI_SECTION)SectionId; + PLIST_ENTRY Entry; + PINI_SECTION_ITEM SectionItem; - // Loop through each section item and find the one they want - SectionItem = CONTAINING_RECORD(Section->SectionItemList.Flink, INI_SECTION_ITEM, ListEntry); - while (&SectionItem->ListEntry != &Section->SectionItemList) + // Loop through each section item and find the one we want + for (Entry = Section->SectionItemList.Flink; + Entry != &Section->SectionItemList; + Entry = Entry->Flink) { - // Check to see if this is the setting they want + SectionItem = CONTAINING_RECORD(Entry, INI_SECTION_ITEM, ListEntry); + + // Check to see if this is the setting we want if (SettingNumber == 0) { return SectionItem; @@ -78,16 +83,13 @@ PINI_SECTION_ITEM IniGetSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber // Nope, keep going SettingNumber--; - - // Get the next section item in the list - SectionItem = CONTAINING_RECORD(SectionItem->ListEntry.Flink, INI_SECTION_ITEM, ListEntry); } return NULL; } ULONG IniGetSectionSettingNameSize(ULONG_PTR SectionId, ULONG SettingIndex) { - PINI_SECTION_ITEM SectionItem; + PINI_SECTION_ITEM SectionItem; // Retrieve requested setting SectionItem = IniGetSettingByNumber(SectionId, SettingIndex); @@ -100,7 +102,7 @@ ULONG IniGetSectionSettingNameSize(ULONG_PTR SectionId, ULONG SettingIndex) ULONG IniGetSectionSettingValueSize(ULONG_PTR SectionId, ULONG SettingIndex) { - PINI_SECTION_ITEM SectionItem; + PINI_SECTION_ITEM SectionItem; // Retrieve requested setting SectionItem = IniGetSettingByNumber(SectionId, SettingIndex); @@ -146,16 +148,20 @@ BOOLEAN IniReadSettingByNumber(ULONG_PTR SectionId, ULONG SettingNumber, PCHAR S BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffer, ULONG BufferSize) { - PINI_SECTION Section = (PINI_SECTION)SectionId; - PINI_SECTION_ITEM SectionItem; + PINI_SECTION Section = (PINI_SECTION)SectionId; + PLIST_ENTRY Entry; + PINI_SECTION_ITEM SectionItem; TRACE("IniReadSettingByName() SectionId = 0x%x\n", SectionId); - // Loop through each section item and find the one they want - SectionItem = CONTAINING_RECORD(Section->SectionItemList.Flink, INI_SECTION_ITEM, ListEntry); - while (&SectionItem->ListEntry != &Section->SectionItemList) + // Loop through each section item and find the one we want + for (Entry = Section->SectionItemList.Flink; + Entry != &Section->SectionItemList; + Entry = Entry->Flink) { - // Check to see if this is the setting they want + SectionItem = CONTAINING_RECORD(Entry, INI_SECTION_ITEM, ListEntry); + + // Check to see if this is the setting we want if (_stricmp(SettingName, SectionItem->ItemName) == 0) { TRACE("IniReadSettingByName() Setting \'%s\' found.\n", SettingName); @@ -166,9 +172,6 @@ BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffe return TRUE; } - - // Get the next section item in the list - SectionItem = CONTAINING_RECORD(SectionItem->ListEntry.Flink, INI_SECTION_ITEM, ListEntry); } WARN("IniReadSettingByName() Setting \'%s\' not found.\n", SettingName); @@ -178,7 +181,7 @@ BOOLEAN IniReadSettingByName(ULONG_PTR SectionId, PCSTR SettingName, PCHAR Buffe BOOLEAN IniAddSection(PCSTR SectionName, ULONG_PTR* SectionId) { - PINI_SECTION Section; + PINI_SECTION Section; // Allocate a new section structure Section = FrLdrTempAlloc(sizeof(INI_SECTION), TAG_INI_SECTION); @@ -251,8 +254,8 @@ VOID IniCleanup(VOID) BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue) { - PINI_SECTION Section = (PINI_SECTION)SectionId; - PINI_SECTION_ITEM SectionItem; + PINI_SECTION Section = (PINI_SECTION)SectionId; + PINI_SECTION_ITEM SectionItem; // Allocate a new item structure SectionItem = FrLdrTempAlloc(sizeof(INI_SECTION_ITEM), TAG_INI_SECTION_ITEM); @@ -292,26 +295,27 @@ BOOLEAN IniAddSettingValueToSection(ULONG_PTR SectionId, PCSTR SettingName, PCST BOOLEAN IniModifySettingValue(ULONG_PTR SectionId, PCSTR SettingName, PCSTR SettingValue) { - PINI_SECTION Section = (PINI_SECTION)SectionId; - PINI_SECTION_ITEM SectionItem; + PINI_SECTION Section = (PINI_SECTION)SectionId; + PLIST_ENTRY Entry; + PINI_SECTION_ITEM SectionItem; PCHAR NewItemValue; // Loop through each section item and find the one we want - SectionItem = CONTAINING_RECORD(Section->SectionItemList.Flink, INI_SECTION_ITEM, ListEntry); - while (&SectionItem->ListEntry != &Section->SectionItemList) + for (Entry = Section->SectionItemList.Flink; + Entry != &Section->SectionItemList; + Entry = Entry->Flink) { + SectionItem = CONTAINING_RECORD(Entry, INI_SECTION_ITEM, ListEntry); + // Check to see if this is the setting we want if (_stricmp(SectionItem->ItemName, SettingName) == 0) { break; } - // Nope, keep going - // Get the next section item in the list - SectionItem = CONTAINING_RECORD(SectionItem->ListEntry.Flink, INI_SECTION_ITEM, ListEntry); } // If the section item does not exist, create it - if (&SectionItem->ListEntry == &Section->SectionItemList) + if (Entry == &Section->SectionItemList) { return IniAddSettingValueToSection(SectionId, SettingName, SettingValue); } diff --git a/boot/freeldr/freeldr/lib/inifile/parse.c b/boot/freeldr/freeldr/lib/inifile/parse.c index 9a3c161e0ab..ab36448e40e 100644 --- a/boot/freeldr/freeldr/lib/inifile/parse.c +++ b/boot/freeldr/freeldr/lib/inifile/parse.c @@ -22,10 +22,10 @@ #include DBG_DEFAULT_CHANNEL(INIFILE); -LIST_ENTRY IniFileSectionListHead; -BOOLEAN IniFileSectionInitialized = FALSE; -ULONG IniFileSectionCount = 0; -ULONG IniFileSettingCount = 0; +LIST_ENTRY IniFileSectionListHead = {&IniFileSectionListHead, &IniFileSectionListHead}; +BOOLEAN IniFileSectionInitialized = FALSE; +ULONG IniFileSectionCount = 0; +ULONG IniFileSettingCount = 0; BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize) @@ -122,9 +122,9 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize) // First check to make sure we're inside a [section] if (CurrentSection == NULL) { - printf("Error: freeldr.ini:%lu: Setting '%s' found outside of a [section].\n", CurrentLineNumber, IniFileLine); - printf("Press any key to continue...\n"); - MachConsGetCh(); + ERR("Error: freeldr.ini:%lu: Setting '%s' found outside of a [section].\n", CurrentLineNumber, IniFileLine); + + // Skip it CurrentLineNumber++; continue; } diff --git a/boot/freeldr/freeldr/lib/mm/heap.c b/boot/freeldr/freeldr/lib/mm/heap.c index 7f2fda05380..35adcd35039 100644 --- a/boot/freeldr/freeldr/lib/mm/heap.c +++ b/boot/freeldr/freeldr/lib/mm/heap.c @@ -71,6 +71,7 @@ FrLdrHeapCreate( PHEAP_BLOCK Block; SIZE_T Remaining; USHORT PreviousSize; + TRACE("HeapCreate(MemoryType=%ld)\n", MemoryType); /* Allocate some memory for the heap */ @@ -78,7 +79,7 @@ FrLdrHeapCreate( Heap = MmAllocateMemoryWithType(MaximumSize, MemoryType); if (!Heap) { - ERR("HEAP: Failed to allocate heap of size 0x%lx, Type\n", + ERR("HEAP: Failed to allocate heap of size 0x%lx, Type %lu\n", MaximumSize, MemoryType); return NULL; } @@ -445,6 +446,7 @@ FrLdrHeapFreeEx( #if DBG && !defined(_M_ARM) ULONGLONG Time = __rdtsc(); #endif + TRACE("HeapFree(%p, %p)\n", HeapHandle, Pointer); ASSERT(Tag != 'dnE#'); diff --git a/boot/freeldr/freeldr/lib/mm/meminit.c b/boot/freeldr/freeldr/lib/mm/meminit.c index aacccda4800..953b6596330 100644 --- a/boot/freeldr/freeldr/lib/mm/meminit.c +++ b/boot/freeldr/freeldr/lib/mm/meminit.c @@ -419,9 +419,9 @@ PVOID MmFindLocationForPageLookupTable(PFN_NUMBER TotalPageCount) SIZE_T PageLookupTableSize; PFN_NUMBER RequiredPages; PFN_NUMBER CandidateBasePage = 0; - PFN_NUMBER CandidatePageCount; + PFN_NUMBER CandidatePageCount = 0; PFN_NUMBER PageLookupTableEndPage; - PVOID PageLookupTableMemAddress = NULL; + PVOID PageLookupTableMemAddress; // Calculate how much pages we need to keep the page lookup table PageLookupTableSize = TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM); diff --git a/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c b/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c index 5c804372844..19359798fa9 100644 --- a/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c +++ b/boot/freeldr/freeldr/ntldr/arch/amd64/winldr.c @@ -10,6 +10,7 @@ #include #include +#include #include "../../winldr.h" #include diff --git a/boot/freeldr/freeldr/ntldr/arch/i386/winldr.c b/boot/freeldr/freeldr/ntldr/arch/i386/winldr.c index 2fccbf9225d..852fb7b12f3 100644 --- a/boot/freeldr/freeldr/ntldr/arch/i386/winldr.c +++ b/boot/freeldr/freeldr/ntldr/arch/i386/winldr.c @@ -10,6 +10,7 @@ #include #include +#include #include "../../winldr.h" #include diff --git a/boot/freeldr/freeldr/pcat.cmake b/boot/freeldr/freeldr/pcat.cmake index 5ea6f9b8aa7..177d5a3adba 100644 --- a/boot/freeldr/freeldr/pcat.cmake +++ b/boot/freeldr/freeldr/pcat.cmake @@ -50,8 +50,6 @@ if(ARCH STREQUAL "i386") list(APPEND PCATLDR_ARC_SOURCE # disk/scsiport.c lib/fs/pxe.c - # arch/i386/halstub.c - # arch/i386/ntoskrnl.c arch/i386/drivemap.c arch/i386/hwacpi.c arch/i386/hwapm.c @@ -120,7 +118,6 @@ elseif(ARCH STREQUAL "amd64") list(APPEND PCATLDR_ARC_SOURCE lib/fs/pxe.c - # arch/i386/ntoskrnl.c arch/i386/drivemap.c arch/i386/hwacpi.c arch/i386/hwapm.c diff --git a/boot/freeldr/freeldr/ui/directui.c b/boot/freeldr/freeldr/ui/directui.c index 8bd47b2be0e..197061927d2 100644 --- a/boot/freeldr/freeldr/ui/directui.c +++ b/boot/freeldr/freeldr/ui/directui.c @@ -93,19 +93,22 @@ UiDrawStatusText(IN PCSTR StatusText) } VOID -UiInfoBox(IN PCSTR MessageText) +UiInfoBox( + _In_ PCSTR MessageText) { TuiPrintf(MessageText); } VOID -UiMessageBox(IN PCSTR MessageText) +UiMessageBox( + _In_ PCSTR MessageText) { TuiPrintf(MessageText); } VOID -UiMessageBoxCritical(IN PCSTR MessageText) +UiMessageBoxCritical( + _In_ PCSTR MessageText) { TuiPrintf(MessageText); } diff --git a/boot/freeldr/freeldr/ui/gui.c b/boot/freeldr/freeldr/ui/gui.c index d3160199ac9..ddd81fce547 100644 --- a/boot/freeldr/freeldr/ui/gui.c +++ b/boot/freeldr/freeldr/ui/gui.c @@ -51,19 +51,29 @@ VOID GuiUpdateDateTime(VOID) { } -VOID GuiSaveScreen(PUCHAR Buffer) +_Ret_maybenull_ +__drv_allocatesMem(Mem) +PUCHAR +GuiSaveScreen(VOID) { + return NULL; } -VOID GuiRestoreScreen(PUCHAR Buffer) +VOID +GuiRestoreScreen( + _In_opt_ __drv_freesMem(Mem) PUCHAR Buffer) { } -VOID GuiMessageBox(PCSTR MessageText) +VOID +GuiMessageBox( + _In_ PCSTR MessageText) { } -VOID GuiMessageBoxCritical(PCSTR MessageText) +VOID +GuiMessageBoxCritical( + _In_ PCSTR MessageText) { } diff --git a/boot/freeldr/freeldr/ui/noui.c b/boot/freeldr/freeldr/ui/noui.c index 1e7c21d1554..e79598bec63 100644 --- a/boot/freeldr/freeldr/ui/noui.c +++ b/boot/freeldr/freeldr/ui/noui.c @@ -77,23 +77,23 @@ VOID NoUiUpdateDateTime(VOID) { } -VOID NoUiMessageBox(PCSTR MessageText) +VOID +NoUiMessageBox( + _In_ PCSTR MessageText) { - // We have not yet displayed the user interface - // We are probably still reading the .ini file - // and have encountered an error. Just use printf() - // and return. - printf("%s\n", MessageText); - printf("Press any key\n"); - MachConsGetCh(); + NoUiMessageBoxCritical(MessageText); } -VOID NoUiMessageBoxCritical(PCSTR MessageText) -{ - // We have not yet displayed the user interface - // We are probably still reading the .ini file - // and have encountered an error. Just use printf() - // and return. +VOID +NoUiMessageBoxCritical( + _In_ PCSTR MessageText) +{ + /* + * We have not yet displayed the user interface + * We are probably still reading the .ini file + * and have encountered an error. Just use printf() + * and return. + */ printf("%s\n", MessageText); printf("Press any key\n"); MachConsGetCh(); diff --git a/boot/freeldr/freeldr/ui/tui.c b/boot/freeldr/freeldr/ui/tui.c index d8669ea196b..587b5bc44f9 100644 --- a/boot/freeldr/freeldr/ui/tui.c +++ b/boot/freeldr/freeldr/ui/tui.c @@ -19,6 +19,14 @@ #include +typedef struct _SMALL_RECT +{ + SHORT Left; + SHORT Top; + SHORT Right; + SHORT Bottom; +} SMALL_RECT, *PSMALL_RECT; + PVOID TextVideoBuffer = NULL; /* GENERIC TUI UTILS *********************************************************/ @@ -606,68 +614,76 @@ VOID TuiUpdateDateTime(VOID) Buffer, ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor)); } -VOID TuiSaveScreen(PUCHAR Buffer) +_Ret_maybenull_ +__drv_allocatesMem(Mem) +PUCHAR +TuiSaveScreen(VOID) { - PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer; - ULONG i; + PUCHAR Buffer; + PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer; + ULONG i; + + /* Allocate the buffer */ + Buffer = FrLdrTempAlloc(UiScreenWidth * UiScreenHeight * 2, + TAG_TUI_SCREENBUFFER); + if (!Buffer) + return NULL; + /* Loop through each cell and copy it */ for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++) { Buffer[i] = ScreenMemory[i]; } + + return Buffer; } -VOID TuiRestoreScreen(PUCHAR Buffer) +VOID +TuiRestoreScreen( + _In_opt_ __drv_freesMem(Mem) PUCHAR Buffer) { - PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer; - ULONG i; + PUCHAR ScreenMemory = (PUCHAR)TextVideoBuffer; + ULONG i; + if (!Buffer) + return; + + /* Loop through each cell and copy it */ for (i=0; i < (UiScreenWidth * UiScreenHeight * 2); i++) { ScreenMemory[i] = Buffer[i]; } - VideoCopyOffScreenBufferToVRAM(); -} - -VOID TuiMessageBox(PCSTR MessageText) -{ - PVOID ScreenBuffer; - // Save the screen contents - ScreenBuffer = FrLdrTempAlloc(UiScreenWidth * UiScreenHeight * 2, - TAG_TUI_SCREENBUFFER); - TuiSaveScreen(ScreenBuffer); + /* Free the buffer */ + FrLdrTempFree(Buffer, TAG_TUI_SCREENBUFFER); - // Display the message box - TuiMessageBoxCritical(MessageText); - - // Restore the screen contents - TuiRestoreScreen(ScreenBuffer); - FrLdrTempFree(ScreenBuffer, TAG_TUI_SCREENBUFFER); + VideoCopyOffScreenBufferToVRAM(); } -VOID TuiMessageBoxCritical(PCSTR MessageText) +static VOID +TuiDrawMsgBoxCommon( + _In_ PCSTR MessageText, + _Out_ PSMALL_RECT MsgBoxRect) { - int width = 8; - unsigned int height = 1; - int curline = 0; - int k; - size_t i , j; - int x1, x2, y1, y2; - char temp[260]; - char key; - - // Find the height - for (i=0; iLeft = x1; MsgBoxRect->Right = x2; + MsgBoxRect->Top = y1; MsgBoxRect->Bottom = y2; + - // Draw the text - for (i=0,j=0; i width) - width = k; - - k = 0; - j++; - } - - // Calculate box area - x1 = (UiScreenWidth - (width+2))/2; - x2 = x1 + width + 3; - y1 = ((UiScreenHeight - height - 2)/2) + 1; - y2 = y1 + height + 4; - - // Draw the box - TuiDrawBox(x1, y1, x2, y2, D_VERT, D_HORZ, TRUE, TRUE, ATTR(UiMessageBoxFgColor, UiMessageBoxBgColor)); - - // Draw the text - for (i=0,j=0; i #include #include +#include #include "resource.h" @@ -83,17 +84,6 @@ DWORDfromString(const WCHAR *pszString) return wcstoul(pszString, &pszEnd, 16); } -#define IME_MASK (0xE0000000UL) -#define SUBST_MASK (0xD0000000UL) -#define SPECIAL_MASK (0xF0000000UL) - -#define IS_IME_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == IME_MASK) -#define IS_SPECIAL_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == SPECIAL_MASK) -#define SPECIALIDFROMHKL(hKL) ((WORD)(HIWORD(hKL) & 0x0FFF)) - -#define IS_IME_KLID(dwKLID) ((((ULONG)(dwKLID)) & 0xF0000000) == IME_MASK) -#define IS_SUBST_KLID(dwKLID) ((((ULONG)(dwKLID)) & 0xF0000000) == SUBST_MASK) - VOID GetSystemLibraryPath(LPWSTR pszPath, INT cchPath, LPCWSTR pszFileName); #endif /* _INPUT_H */ diff --git a/dll/ime/msctfime/bridge.cpp b/dll/ime/msctfime/bridge.cpp index 9fdc8c4cc39..a61a66cfa69 100644 --- a/dll/ime/msctfime/bridge.cpp +++ b/dll/ime/msctfime/bridge.cpp @@ -679,15 +679,111 @@ CicBridge::SetActiveContextAlways(TLS *pTLS, HIMC hIMC, BOOL fActive, HWND hWnd, } /// @unimplemented +BOOL +CicBridge::DoOpenCandidateHanja( + ITfThreadMgr_P *pThreadMgr, + CicIMCLock& imcLock, + CicInputContext *pCicIC) +{ + return FALSE; +} + +/// @unimplemented +HRESULT +CicBridge::OnSetConversionSentenceMode( + ITfThreadMgr_P *pThreadMgr, + CicIMCLock& imcLock, + CicInputContext *pCicIC, + DWORD dwValue, + LANGID LangID) +{ + return E_NOTIMPL; +} + +/// @implemented HRESULT CicBridge::Notify( TLS *pTLS, - ITfThreadMgr *pThreadMgr, + ITfThreadMgr_P *pThreadMgr, HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD_PTR dwValue) { - return E_NOTIMPL; // FIXME + CicIMCLock imcLock(hIMC); + if (FAILED(imcLock.m_hr)) + return imcLock.m_hr; + + CicIMCCLock imeContext(imcLock.get().hCtfImeContext); + if (FAILED(imeContext.m_hr)) + return imeContext.m_hr; + + CicInputContext *pCicIC = imeContext.get().m_pCicIC; + if (!pCicIC) + return E_OUTOFMEMORY; + + CicProfile *pProfile = pTLS->m_pProfile; + if (!pProfile) + return E_OUTOFMEMORY; + + LANGID LangID; + pProfile->GetLangId(&LangID); + + switch (dwAction) + { + case NI_OPENCANDIDATE: + if (PRIMARYLANGID(LangID) == LANG_KOREAN) + { + if (DoOpenCandidateHanja(pThreadMgr, imcLock, pCicIC)) + return S_OK; + return E_FAIL; + } + return E_NOTIMPL; + + case NI_COMPOSITIONSTR: + switch (dwIndex) + { + case CPS_COMPLETE: + pCicIC->EscbCompComplete(imcLock); + break; + + case CPS_CONVERT: + case CPS_REVERT: + return E_NOTIMPL; + + case CPS_CANCEL: + pCicIC->EscbCompCancel(imcLock); + break; + + default: + return E_FAIL; + } + return S_OK; + + case NI_CONTEXTUPDATED: + switch (dwValue) + { + case IMC_SETCONVERSIONMODE: + case IMC_SETSENTENCEMODE: + return OnSetConversionSentenceMode(pThreadMgr, imcLock, pCicIC, dwValue, LangID); + + case IMC_SETOPENSTATUS: + return OnSetOpenStatus(pTLS, pThreadMgr, imcLock, pCicIC); + + case IMC_SETCANDIDATEPOS: + return pCicIC->OnSetCandidatePos(pTLS, imcLock); + + case IMC_SETCOMPOSITIONFONT: + case IMC_SETCOMPOSITIONWINDOW: + return E_NOTIMPL; + + default: + return E_FAIL; + } + break; + + default: + return E_NOTIMPL; + } } /// @unimplemented @@ -719,7 +815,7 @@ CicBridge::ToAsciiEx( return E_NOTIMPL; // FIXME } -/// @unimplemented +/// @implemented BOOL CicBridge::SetCompositionString( TLS *pTLS, @@ -731,14 +827,80 @@ CicBridge::SetCompositionString( LPCVOID lpRead, DWORD dwReadLen) { - return FALSE; // FIXME + CicIMCLock imcLock(hIMC); + if (FAILED(imcLock.m_hr)) + return FALSE; + + CicIMCCLock imeContext(imcLock.get().hCtfImeContext); + if (FAILED(imeContext.m_hr)) + return FALSE; + + CicInputContext *pCicIC = imeContext.get().m_pCicIC; + auto pProfile = pTLS->m_pProfile; + if (!pCicIC || !pProfile) + return FALSE; + + UINT uCodePage; + pProfile->GetCodePageA(&uCodePage); + + LANGID LangID; + if (dwIndex != SCS_SETSTR || + !lpComp || *(WORD*)lpComp || + !dwCompLen || + FAILED(pProfile->GetLangId(&LangID)) || + PRIMARYLANGID(LangID) != LANG_KOREAN) + { + return pCicIC->SetCompositionString(imcLock, pThreadMgr, dwIndex, + lpComp, dwCompLen, lpRead, dwReadLen, + uCodePage); + } + + if (imcLock.get().fdwConversion & IME_CMODE_NATIVE) + { + ::ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_COMPLETE, 0); + return TRUE; + } + + return FALSE; } /// @unimplemented LRESULT +CicBridge::EscHanjaMode(TLS *pTLS, HIMC hIMC, LPVOID lpData) +{ + CicIMCLock imcLock(hIMC); + if (FAILED(imcLock.m_hr)) + return imcLock.m_hr; + + CicIMCCLock imeContext(imcLock.get().hCtfImeContext); + if (FAILED(imeContext.m_hr)) + return imeContext.m_hr; + + CicInputContext *pCicIC = imeContext.get().m_pCicIC; + if (!pCicIC) + return TRUE; + + if (pCicIC->m_bCandidateOpen) + return TRUE; + + pCicIC->m_dwUnknown6_5[4] |= 0x1; + + //FIXME + + pCicIC->m_dwUnknown6_5[4] &= ~0x1; + + return TRUE; +} + +/// @implemented +LRESULT CicBridge::EscapeKorean(TLS *pTLS, HIMC hIMC, UINT uSubFunc, LPVOID lpData) { - return 0; // FIXME + if (uSubFunc == IME_ESC_QUERY_SUPPORT) + return *(DWORD*)lpData == IME_ESC_HANJA_MODE; + if (uSubFunc == IME_ESC_HANJA_MODE) + return EscHanjaMode(pTLS, hIMC, lpData); + return 0; } /// @implemented diff --git a/dll/ime/msctfime/bridge.h b/dll/ime/msctfime/bridge.h index 6e0853ccb7e..f1cc1aa2ee4 100644 --- a/dll/ime/msctfime/bridge.h +++ b/dll/ime/msctfime/bridge.h @@ -28,6 +28,8 @@ class CicBridge : public ITfSysHookSink static BOOL CALLBACK EnumCreateInputContextCallback(HIMC hIMC, LPARAM lParam); static BOOL CALLBACK EnumDestroyInputContextCallback(HIMC hIMC, LPARAM lParam); + LRESULT EscHanjaMode(TLS *pTLS, HIMC hIMC, LPVOID lpData); + public: CicBridge(); virtual ~CicBridge(); @@ -89,7 +91,7 @@ class CicBridge : public ITfSysHookSink HRESULT Notify( TLS *pTLS, - ITfThreadMgr *pThreadMgr, + ITfThreadMgr_P *pThreadMgr, HIMC hIMC, DWORD dwAction, DWORD dwIndex, @@ -132,4 +134,18 @@ class CicBridge : public ITfSysHookSink LPVOID lpData); static BOOL IsOwnDim(ITfDocumentMgr *pDocMgr); + + BOOL + DoOpenCandidateHanja( + ITfThreadMgr_P *pThreadMgr, + CicIMCLock& imcLock, + CicInputContext *pCicIC); + + HRESULT + OnSetConversionSentenceMode( + ITfThreadMgr_P *pThreadMgr, + CicIMCLock& imcLock, + CicInputContext *pCicIC, + DWORD dwValue, + LANGID LangID); }; diff --git a/dll/ime/msctfime/inputcontext.cpp b/dll/ime/msctfime/inputcontext.cpp index 86ffb1f5627..7c7a3c91d20 100644 --- a/dll/ime/msctfime/inputcontext.cpp +++ b/dll/ime/msctfime/inputcontext.cpp @@ -9,6 +9,185 @@ WINE_DEFAULT_DEBUG_CHANNEL(msctfime); +/*********************************************************************** + * CInputContextOwner + */ + +/// @unimplemented +CInputContextOwner::CInputContextOwner(FN_IC_OWNER_CALLBACK fnCallback, LPVOID pCallbackPV) +{ + m_dwCookie = -1; + m_fnCallback = fnCallback; + m_cRefs = 1; + m_pCallbackPV = pCallbackPV; +} + +/// @implemented +CInputContextOwner::~CInputContextOwner() +{ +} + +/// @implemented +HRESULT CInputContextOwner::_Advise(IUnknown *pContext) +{ + ITfSource *pSource = NULL; + + m_pContext = NULL; + + HRESULT hr = E_FAIL; + if (SUCCEEDED(m_pContext->QueryInterface(IID_ITfSource, (LPVOID*)&pSource)) && + SUCCEEDED(pSource->AdviseSink(IID_ITfContextOwner, + static_cast(this), &m_dwCookie))) + { + m_pContext = pContext; + m_pContext->AddRef(); + hr = S_OK; + } + + if (pSource) + pSource->Release(); + + return hr; +} + +/// @implemented +HRESULT CInputContextOwner::_Unadvise() +{ + ITfSource *pSource = NULL; + + HRESULT hr = E_FAIL; + if (m_pContext) + { + if (SUCCEEDED(m_pContext->QueryInterface(IID_ITfSource, (LPVOID*)&pSource)) && + SUCCEEDED(pSource->UnadviseSink(m_dwCookie))) + { + hr = S_OK; + } + } + + if (m_pContext) + { + m_pContext->Release(); + m_pContext = NULL; + } + + if (pSource) + pSource->Release(); + + return hr; +} + +/// @implemented +STDMETHODIMP CInputContextOwner::QueryInterface(REFIID riid, LPVOID* ppvObj) +{ + *ppvObj = NULL; + + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfContextOwner)) + { + *ppvObj = this; + AddRef(); + return S_OK; + } + + if (IsEqualIID(riid, IID_ITfMouseTrackerACP)) + { + *ppvObj = static_cast(this); + AddRef(); + return S_OK; + } + + return E_NOINTERFACE; +} + +/// @implemented +STDMETHODIMP_(ULONG) CInputContextOwner::AddRef() +{ + return ++m_cRefs; +} + +/// @implemented +STDMETHODIMP_(ULONG) CInputContextOwner::Release() +{ + if (--m_cRefs == 0) + { + delete this; + return 0; + } + return m_cRefs; +} + +/// @unimplemented +STDMETHODIMP +CInputContextOwner::GetACPFromPoint( + const POINT *ptScreen, + DWORD dwFlags, + LONG *pacp) +{ + return E_NOTIMPL; +} + +/// @unimplemented +STDMETHODIMP +CInputContextOwner::GetTextExt( + LONG acpStart, + LONG acpEnd, + RECT *prc, + BOOL *pfClipped) +{ + return E_NOTIMPL; +} + +/// @implemented +STDMETHODIMP CInputContextOwner::GetScreenExt(RECT *prc) +{ + return m_fnCallback(2, &prc, m_pCallbackPV); +} + +/// @implemented +STDMETHODIMP CInputContextOwner::GetStatus(TF_STATUS *pdcs) +{ + return m_fnCallback(6, &pdcs, m_pCallbackPV); +} + +/// @unimplemented +STDMETHODIMP CInputContextOwner::GetWnd(HWND *phwnd) +{ + return m_fnCallback(7, &phwnd, m_pCallbackPV); +} + +/// @unimplemented +STDMETHODIMP CInputContextOwner::GetAttribute(REFGUID rguidAttribute, VARIANT *pvarValue) +{ + return E_NOTIMPL; +} + +struct MOUSE_SINK_ARGS +{ + ITfRangeACP *range; + ITfMouseSink *pSink; + DWORD *pdwCookie; +}; + +/// @implemented +STDMETHODIMP CInputContextOwner::AdviseMouseSink( + ITfRangeACP *range, + ITfMouseSink *pSink, + DWORD *pdwCookie) +{ + MOUSE_SINK_ARGS args = { range, pSink, pdwCookie }; + return m_fnCallback(9, &args, m_pCallbackPV); +} + +/// @implemented +STDMETHODIMP CInputContextOwner::UnadviseMouseSink(DWORD dwCookie) +{ + return m_fnCallback(10, &dwCookie, m_pCallbackPV); +} + +/*********************************************************************** + * CicInputContext + */ + /// @unimplemented CicInputContext::CicInputContext( _In_ TfClientId cliendId, @@ -157,7 +336,12 @@ CicInputContext::DestroyInputContext() m_pCompEventSink1 = NULL; } - //FIXME: m_pInputContextOwner + if (m_pInputContextOwner) + { + m_pInputContextOwner->_Unadvise(); + m_pInputContextOwner->Release(); + m_pInputContextOwner = NULL; + } if (m_pDocumentMgr) m_pDocumentMgr->Pop(1); @@ -265,6 +449,18 @@ HRESULT CicInputContext::EscbCompComplete(CicIMCLock& imcLock) return E_NOTIMPL; } +/// @unimplemented +HRESULT CicInputContext::EscbCompCancel(CicIMCLock& imcLock) +{ + return E_NOTIMPL; +} + +/// @unimplemented +HRESULT CicInputContext::OnSetCandidatePos(TLS *pTLS, CicIMCLock& imcLock) +{ + return E_NOTIMPL; +} + /// @unimplemented HRESULT CicInputContext::DelayedReconvertFuncCall(CicIMCLock& imcLock) { @@ -308,3 +504,17 @@ HRESULT CicInputContext::EndReconvertString(CicIMCLock& imcLock) { return E_NOTIMPL; } + +/// @unimplemented +BOOL CicInputContext::SetCompositionString( + CicIMCLock& imcLock, + ITfThreadMgr_P *pThreadMgr, + DWORD dwIndex, + LPCVOID lpComp, + DWORD dwCompLen, + LPCVOID lpRead, + DWORD dwReadLen, + UINT uCodePage) +{ + return FALSE; +} diff --git a/dll/ime/msctfime/inputcontext.h b/dll/ime/msctfime/inputcontext.h index 7ae33906fd5..2ed51862140 100644 --- a/dll/ime/msctfime/inputcontext.h +++ b/dll/ime/msctfime/inputcontext.h @@ -12,6 +12,59 @@ class CInputContextOwnerCallBack; class CInputContextOwner; +class CicInputContext; + + +typedef HRESULT (CALLBACK *FN_IC_OWNER_CALLBACK)(UINT uType, LPVOID args, LPVOID param); + +/*********************************************************************** + * CInputContextOwner + */ +class CInputContextOwner + : public ITfContextOwner + , public ITfMouseTrackerACP +{ +protected: + LONG m_cRefs; + IUnknown *m_pContext; + DWORD m_dwCookie; + FN_IC_OWNER_CALLBACK m_fnCallback; + LPVOID m_pCallbackPV; + +public: + CInputContextOwner(FN_IC_OWNER_CALLBACK fnCallback, LPVOID pCallbackPV); + virtual ~CInputContextOwner(); + + HRESULT _Advise(IUnknown *pContext); + HRESULT _Unadvise(); + + // IUnknown methods + STDMETHODIMP QueryInterface(REFIID riid, LPVOID* ppvObj) override; + STDMETHODIMP_(ULONG) AddRef() override; + STDMETHODIMP_(ULONG) Release() override; + + // ITfContextOwner methods + STDMETHODIMP GetACPFromPoint( + const POINT *ptScreen, + DWORD dwFlags, + LONG *pacp) override; + STDMETHODIMP GetTextExt( + LONG acpStart, + LONG acpEnd, + RECT *prc, + BOOL *pfClipped) override; + STDMETHODIMP GetScreenExt(RECT *prc) override; + STDMETHODIMP GetStatus(TF_STATUS *pdcs) override; + STDMETHODIMP GetWnd(HWND *phwnd) override; + STDMETHODIMP GetAttribute(REFGUID rguidAttribute, VARIANT *pvarValue) override; + + // ITfMouseTrackerACP methods + STDMETHODIMP AdviseMouseSink( + ITfRangeACP *range, + ITfMouseSink *pSink, + DWORD *pdwCookie) override; + STDMETHODIMP UnadviseMouseSink(DWORD dwCookie) override; +}; /*********************************************************************** * CicInputContext @@ -88,9 +141,14 @@ class CicInputContext HRESULT CreateInputContext(_Inout_ ITfThreadMgr *pThreadMgr, _Inout_ CicIMCLock& imcLock); HRESULT DestroyInputContext(); + BOOL SetCompositionString(CicIMCLock& imcLock, ITfThreadMgr_P *pThreadMgr, DWORD dwIndex, + LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen, + UINT uCodePage); + HRESULT SetupDocFeedString(CicIMCLock& imcLock, UINT uCodePage); HRESULT EscbClearDocFeedBuffer(CicIMCLock& imcLock, BOOL bFlag); HRESULT EscbCompComplete(CicIMCLock& imcLock); + HRESULT EscbCompCancel(CicIMCLock& imcLock); HRESULT SetupReconvertString( CicIMCLock& imcLock, ITfThreadMgr_P *pThreadMgr, @@ -106,4 +164,6 @@ class CicInputContext HRESULT EndReconvertString(CicIMCLock& imcLock); HRESULT DelayedReconvertFuncCall(CicIMCLock& imcLock); void ClearPrevCandidatePos(); + + HRESULT OnSetCandidatePos(TLS *pTLS, CicIMCLock& imcLock); }; diff --git a/dll/win32/browseui/lang/bg-BG.rc b/dll/win32/browseui/lang/bg-BG.rc index 2138165570c..85eb1cd35eb 100644 --- a/dll/win32/browseui/lang/bg-BG.rc +++ b/dll/win32/browseui/lang/bg-BG.rc @@ -145,7 +145,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Търси в:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Тър&сене", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Спри", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/de-DE.rc b/dll/win32/browseui/lang/de-DE.rc index 02020fd4843..c38adff1d86 100644 --- a/dll/win32/browseui/lang/de-DE.rc +++ b/dll/win32/browseui/lang/de-DE.rc @@ -152,7 +152,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Suchen in:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "&Jetzt suchen", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "Abbrec&hen", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/en-US.rc b/dll/win32/browseui/lang/en-US.rc index 8ba65eb7e85..0cc96a612a8 100644 --- a/dll/win32/browseui/lang/en-US.rc +++ b/dll/win32/browseui/lang/en-US.rc @@ -163,7 +163,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Look in:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Sea&rch", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Stop", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/es-ES.rc b/dll/win32/browseui/lang/es-ES.rc index 6ada459824c..97be2a77f22 100644 --- a/dll/win32/browseui/lang/es-ES.rc +++ b/dll/win32/browseui/lang/es-ES.rc @@ -154,7 +154,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Buscar en:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Bus&car", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Parar", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/et-EE.rc b/dll/win32/browseui/lang/et-EE.rc index b3804492ec2..692178b4aeb 100644 --- a/dll/win32/browseui/lang/et-EE.rc +++ b/dll/win32/browseui/lang/et-EE.rc @@ -152,7 +152,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Look in:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Sea&rch", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Stop", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/eu-ES.rc b/dll/win32/browseui/lang/eu-ES.rc index 22facab3084..71f1a4b89da 100644 --- a/dll/win32/browseui/lang/eu-ES.rc +++ b/dll/win32/browseui/lang/eu-ES.rc @@ -152,7 +152,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Buscar en:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Bus&car", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Parar", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/fr-FR.rc b/dll/win32/browseui/lang/fr-FR.rc index c4c9e30fba3..dc4eec607ae 100644 --- a/dll/win32/browseui/lang/fr-FR.rc +++ b/dll/win32/browseui/lang/fr-FR.rc @@ -163,7 +163,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Chercher dans :", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Che&rcher", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Arrêter", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/he-IL.rc b/dll/win32/browseui/lang/he-IL.rc index 5cbc355debb..d8514bd5b2a 100644 --- a/dll/win32/browseui/lang/he-IL.rc +++ b/dll/win32/browseui/lang/he-IL.rc @@ -147,7 +147,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&חפש ב:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "&חפש", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&עצור", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/hi-IN.rc b/dll/win32/browseui/lang/hi-IN.rc index aefe0f9a268..a9869c7f850 100644 --- a/dll/win32/browseui/lang/hi-IN.rc +++ b/dll/win32/browseui/lang/hi-IN.rc @@ -145,7 +145,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Look in:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Sea&rch", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Stop", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/hu-HU.rc b/dll/win32/browseui/lang/hu-HU.rc index 43d26737ca3..6e3a31ac28f 100644 --- a/dll/win32/browseui/lang/hu-HU.rc +++ b/dll/win32/browseui/lang/hu-HU.rc @@ -163,7 +163,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "Keresés &itt:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "&Keresés", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Megállítás", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/id-ID.rc b/dll/win32/browseui/lang/id-ID.rc index 3f6d1e24103..ea8d286876e 100644 --- a/dll/win32/browseui/lang/id-ID.rc +++ b/dll/win32/browseui/lang/id-ID.rc @@ -164,7 +164,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Cari di:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Ca&ri", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Berhenti", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/it-IT.rc b/dll/win32/browseui/lang/it-IT.rc index 5e7cfaaa80c..79cd2ffb44c 100644 --- a/dll/win32/browseui/lang/it-IT.rc +++ b/dll/win32/browseui/lang/it-IT.rc @@ -145,7 +145,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Look in:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Sea&rch", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Stop", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/ja-JP.rc b/dll/win32/browseui/lang/ja-JP.rc index b364f788821..4ffed19d1b7 100644 --- a/dll/win32/browseui/lang/ja-JP.rc +++ b/dll/win32/browseui/lang/ja-JP.rc @@ -163,7 +163,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "次のフォルダ内部(&L):", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "検索(&R)", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "停止(&S)", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/pl-PL.rc b/dll/win32/browseui/lang/pl-PL.rc index f7b671858ce..b9aa53ff175 100644 --- a/dll/win32/browseui/lang/pl-PL.rc +++ b/dll/win32/browseui/lang/pl-PL.rc @@ -154,7 +154,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "Szu&kaj w:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Wy&szukaj", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Zatrzymaj", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/pt-BR.rc b/dll/win32/browseui/lang/pt-BR.rc index 16c96a9c561..845176e3e43 100644 --- a/dll/win32/browseui/lang/pt-BR.rc +++ b/dll/win32/browseui/lang/pt-BR.rc @@ -147,7 +147,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Look in:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Sea&rch", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Stop", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/pt-PT.rc b/dll/win32/browseui/lang/pt-PT.rc index fb08d194705..2d4b6d03f69 100644 --- a/dll/win32/browseui/lang/pt-PT.rc +++ b/dll/win32/browseui/lang/pt-PT.rc @@ -147,7 +147,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Procurar em:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Pro&curar", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "Pa&rar", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/ro-RO.rc b/dll/win32/browseui/lang/ro-RO.rc index a06c14e34cc..ea065d92cfa 100644 --- a/dll/win32/browseui/lang/ro-RO.rc +++ b/dll/win32/browseui/lang/ro-RO.rc @@ -153,7 +153,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Uită-te în:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "&Căutare", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Oprește", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/ru-RU.rc b/dll/win32/browseui/lang/ru-RU.rc index 312e72f1bf5..582a53e31ac 100644 --- a/dll/win32/browseui/lang/ru-RU.rc +++ b/dll/win32/browseui/lang/ru-RU.rc @@ -154,7 +154,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "П&оиск в:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Най&ти", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "Остановит&ь", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/sq-AL.rc b/dll/win32/browseui/lang/sq-AL.rc index 3565f3610ac..1d34450e988 100644 --- a/dll/win32/browseui/lang/sq-AL.rc +++ b/dll/win32/browseui/lang/sq-AL.rc @@ -164,7 +164,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Look in:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Sea&rch", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Stop", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/tr-TR.rc b/dll/win32/browseui/lang/tr-TR.rc index 5efd7ecf59f..5578a1e2f75 100644 --- a/dll/win32/browseui/lang/tr-TR.rc +++ b/dll/win32/browseui/lang/tr-TR.rc @@ -147,7 +147,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Şurada ara:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "&Ara", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Durdur", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/uk-UA.rc b/dll/win32/browseui/lang/uk-UA.rc index ed8a6557c67..9e606fa86b8 100644 --- a/dll/win32/browseui/lang/uk-UA.rc +++ b/dll/win32/browseui/lang/uk-UA.rc @@ -153,7 +153,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "&Look in:", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "Sea&rch", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "&Stop", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/zh-CN.rc b/dll/win32/browseui/lang/zh-CN.rc index 198a1b46d10..b5b58963be5 100644 --- a/dll/win32/browseui/lang/zh-CN.rc +++ b/dll/win32/browseui/lang/zh-CN.rc @@ -167,7 +167,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "搜索范围(&L):", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "搜索(&R)", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "停止搜索(&S)", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/browseui/lang/zh-TW.rc b/dll/win32/browseui/lang/zh-TW.rc index b8adf2df828..89b59c0672a 100644 --- a/dll/win32/browseui/lang/zh-TW.rc +++ b/dll/win32/browseui/lang/zh-TW.rc @@ -169,7 +169,7 @@ BEGIN EDITTEXT IDC_SEARCH_QUERY, 10, 60, 100, 12, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP LTEXT "在以下資料夾搜尋(&L):", -1, 10, 75, 500, 10 - CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY | CBS_OWNERDRAWFIXED, 10, 85, 200, 200 + CONTROL "", IDC_SEARCH_COMBOBOX, WC_COMBOBOXEXW, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_TABSTOP | CCS_NODIVIDER | CCS_NOMOVEY, 10, 85, 200, 200 DEFPUSHBUTTON "搜尋(&R)", IDC_SEARCH_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP | WS_VISIBLE PUSHBUTTON "停止(&S)", IDC_SEARCH_STOP_BUTTON, 80, 110, 40, 15, WS_GROUP | WS_TABSTOP diff --git a/dll/win32/comctl32/treeview.c b/dll/win32/comctl32/treeview.c index d3066d72e2a..945084d60bf 100644 --- a/dll/win32/comctl32/treeview.c +++ b/dll/win32/comctl32/treeview.c @@ -2334,8 +2334,18 @@ TREEVIEW_GetCount(const TREEVIEW_INFO *infoPtr) return (LRESULT)infoPtr->uNumItems; } +#ifdef __REACTOS__ +static LRESULT +TREEVIEW_SelectItem(TREEVIEW_INFO *infoPtr, INT wParam, HTREEITEM item); +#endif + +#ifdef __REACTOS__ +static VOID +TREEVIEW_ToggleItemState(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item) +#else static VOID TREEVIEW_ToggleItemState(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item) +#endif { if (infoPtr->dwStyle & TVS_CHECKBOXES) { @@ -2353,6 +2363,9 @@ TREEVIEW_ToggleItemState(const TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item) item->state |= INDEXTOSTATEIMAGEMASK(state); TRACE("state: 0x%x\n", state); +#ifdef __REACTOS__ + TREEVIEW_SelectItem(infoPtr, TVGN_CARET, item); +#endif TREEVIEW_Invalidate(infoPtr, item); } } diff --git a/dll/win32/comdlg32/lang/cdlg_Ja.rc b/dll/win32/comdlg32/lang/cdlg_Ja.rc index 2edd500f428..3baeb3b7d4a 100644 --- a/dll/win32/comdlg32/lang/cdlg_Ja.rc +++ b/dll/win32/comdlg32/lang/cdlg_Ja.rc @@ -34,7 +34,7 @@ STRINGTABLE / : < > |" IDS_PATHNOTEXISTING "パスが見つかりません" IDS_FILENOTEXISTING "ファイルが見つかりません" - IDS_INVALID_FOLDERNAME "The selection contains a non-folder object" + IDS_INVALID_FOLDERNAME "フォルダ以外のオブジェクトを選択しています" } STRINGTABLE @@ -131,14 +131,14 @@ STRINGTABLE /* Color names */ STRINGTABLE { - IDS_FONT_SIZE "フォントサイズを %1!d! ポイントから %2!d! ポイントの間で選択してください。" + IDS_FONT_SIZE "フォントサイズを %1!d! ~ %2!d! ポイントの範囲内で選択してください。" IDS_SAVE_BUTTON "保存(&S)" IDS_SAVE_IN "保存する場所(&I):" IDS_SAVE "保存" IDS_SAVE_AS "名前を付けて保存" IDS_OPEN_FILE "ファイルを開く" - IDS_SELECT_FOLDER "Select Folder" - IDS_FONT_SIZE_INPUT "Font size has to be a number." + IDS_SELECT_FOLDER "フォルダの選択" + IDS_FONT_SIZE_INPUT "フォント サイズは数字でなければいけません。" } /* @@ -408,7 +408,7 @@ BEGIN GROUPBOX "用紙", grp2, 8, 92, 164,56, WS_GROUP LTEXT "サイズ(&Z):", stc2, 16,108, 36, 8 COMBOBOX cmb2, 52,106, 112,112,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP - LTEXT "&Source:", stc3, 16,128, 36, 8 + LTEXT "ソース(&S):", stc3, 16,128, 36, 8 COMBOBOX cmb3, 52,126, 112,112,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP GROUPBOX "方向", grp1, 180, 92, 100,56, WS_GROUP @@ -452,20 +452,20 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_VISIBLE | WS_POPUP | WS CAPTION "開く" FONT 9, "MS UI Gothic" { - LTEXT "ファイルの場所(&I):",IDC_LOOKINSTATIC,4,6,43,8, SS_NOTIFY - COMBOBOX IDC_LOOKIN,49,3,132,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + LTEXT "ファイルの場所(&I):", IDC_LOOKINSTATIC, 4, 6, 61, 8, SS_NOTIFY + COMBOBOX IDC_LOOKIN, 70, 3, 111, 300, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP LTEXT "" , IDC_TOOLBARSTATIC, 181, 2, 102, 17, NOT WS_GROUP | NOT WS_VISIBLE LISTBOX IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE - LTEXT "ファイル名(&N):",IDC_FILENAMESTATIC,5,112,56,16, SS_NOTIFY - EDITTEXT IDC_FILENAME,63,110,150,12,ES_AUTOHSCROLL - CONTROL "", cmb13, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP, 63,110,150,150 + LTEXT "ファイル名(&N):",IDC_FILENAMESTATIC, 5, 112, 62, 16, SS_NOTIFY + EDITTEXT IDC_FILENAME, 70, 110, 150, 12, ES_AUTOHSCROLL + CONTROL "", cmb13, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP, 70, 110, 150, 150 - LTEXT "ファイルの種類(&T):",IDC_FILETYPESTATIC,5,130,56,16, SS_NOTIFY - COMBOBOX IDC_FILETYPE,63,128,150,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "ファイルの種類(&T):", IDC_FILETYPESTATIC , 5, 130, 62, 16, SS_NOTIFY + COMBOBOX IDC_FILETYPE, 70, 128, 150, 53, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "読み取り専用ファイルとして開く(&R)",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,63,148,150,10 + CONTROL "読み込み専用で開く(&R)", IDC_OPENREADONLY, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 70, 148, 150, 10 DEFPUSHBUTTON "開く(&O)", IDOK,222,110,54,14 PUSHBUTTON "キャンセル", IDCANCEL,222,128,54,14 @@ -474,28 +474,28 @@ FONT 9, "MS UI Gothic" NEWFILEOPENV2ORD DIALOG 0, 0, 370, 237 STYLE DS_MODALFRAME | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN -CAPTION "Open" -FONT 8, "MS Shell Dlg" +CAPTION "開く" +FONT 9, "MS UI Gothic" { - LTEXT "Look &in:", IDC_LOOKINSTATIC, 28, 6, 43, 8, SS_NOTIFY - COMBOBOX IDC_LOOKIN, 64, 3, 150, 100, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + LTEXT "ファイルの場所(&I):", IDC_LOOKINSTATIC, 5, 6, 61, 8, SS_NOTIFY + COMBOBOX IDC_LOOKIN, 70, 3, 130, 300, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP LTEXT "" , IDC_TOOLBARSTATIC, 209, 2, 102, 17, NOT WS_GROUP | NOT WS_VISIBLE CONTROL "", IDC_TOOLBARPLACES, "ToolbarWindow32", 0x800 | CCS_NORESIZE | CCS_TOP | CCS_NOPARENTALIGN | CCS_NODIVIDER, 4, 20, 56, 192 LISTBOX IDC_SHELLSTATIC, 64, 20, 300, 155, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE - LTEXT "File &name:", IDC_FILENAMESTATIC, 65, 182, 56, 16, SS_NOTIFY - EDITTEXT IDC_FILENAME, 123, 180, 180, 12, ES_AUTOHSCROLL - CONTROL "", cmb13, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP, 123, 180, 180, 150 + LTEXT "ファイル名(&N):", IDC_FILENAMESTATIC, 65, 182, 63, 16, SS_NOTIFY + EDITTEXT IDC_FILENAME, 130, 180, 170, 12, ES_AUTOHSCROLL + CONTROL "", cmb13, "ComboBoxEx32", CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP, 130, 180, 170, 150 - LTEXT "Files of &type:", IDC_FILETYPESTATIC, 65, 200, 56, 16, SS_NOTIFY - COMBOBOX IDC_FILETYPE, 123, 198, 180, 53, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "ファイルの種類(&T):", IDC_FILETYPESTATIC, 65, 200, 63, 16, SS_NOTIFY + COMBOBOX IDC_FILETYPE, 130, 198, 170, 53, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Open as &read-only", IDC_OPENREADONLY, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 123, 218, 150, 10 + CONTROL "読み込み専用で開く(&R)", IDC_OPENREADONLY, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 130, 218, 150, 10 - DEFPUSHBUTTON "&Open", IDOK, 310, 180, 54, 14 - PUSHBUTTON "Cancel", IDCANCEL, 310, 198, 54, 14 - PUSHBUTTON "&Help", pshHelp, 310, 215, 54, 14 + DEFPUSHBUTTON "開く(&O)", IDOK, 310, 180, 54, 14 + PUSHBUTTON "キャンセル", IDCANCEL, 310, 198, 54, 14 + PUSHBUTTON "ヘルプ(&H)", pshHelp, 310, 215, 54, 14 } NEWFILEOPENV3ORD DIALOG 0, 0, 440, 300 diff --git a/dll/win32/msctf/CMakeLists.txt b/dll/win32/msctf/CMakeLists.txt index a167162dc58..896fc3cc943 100644 --- a/dll/win32/msctf/CMakeLists.txt +++ b/dll/win32/msctf/CMakeLists.txt @@ -21,6 +21,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/msctf_stubs.c) list(APPEND PCH_SKIP_SOURCE + mlng.cpp utils.cpp) add_library(msctf MODULE @@ -32,6 +33,6 @@ add_library(msctf MODULE set_module_type(msctf win32dll UNICODE) target_link_libraries(msctf uuid wine cicero) add_importlibs(msctf user32 advapi32 advapi32_vista msvcrt kernel32 ntdll) -add_delay_importlibs(msctf ole32 oleaut32) +add_delay_importlibs(msctf shell32 shlwapi ole32 oleaut32 imm32 gdi32) add_pch(msctf precomp.h SOURCE) add_cd_file(TARGET msctf DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/msctf/mlng.cpp b/dll/win32/msctf/mlng.cpp new file mode 100644 index 00000000000..6ec66d099f4 --- /dev/null +++ b/dll/win32/msctf/mlng.cpp @@ -0,0 +1,694 @@ +/* + * PROJECT: ReactOS msctf.dll + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: Multi-language handling of Cicero + * COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ + */ + +#define WIN32_NO_STATUS + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include "mlng.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msctf); + +extern CRITICAL_SECTION g_cs; + +CicArray *g_pMlngInfo = NULL; +INT CStaticIconList::s_cx = 0; +INT CStaticIconList::s_cy = 0; +CStaticIconList g_IconList; + +// Cache for GetSpecialKLID +static HKL s_hCacheKL = NULL; +static DWORD s_dwCacheKLID = 0; + +/*********************************************************************** + * The helper funtions + */ + +/// @implemented +DWORD GetSpecialKLID(_In_ HKL hKL) +{ + assert(IS_SPECIAL_HKL(hKL)); + + if (s_hCacheKL == hKL && s_dwCacheKLID != 0) + return s_dwCacheKLID; + + s_dwCacheKLID = 0; + + CicRegKey regKey1; + LSTATUS error = regKey1.Open(HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts"); + if (error != ERROR_SUCCESS) + return 0; + + WCHAR szName[16], szLayoutId[16]; + const DWORD dwSpecialId = SPECIALIDFROMHKL(hKL); + for (DWORD dwIndex = 0; ; ++dwIndex) + { + error = ::RegEnumKeyW(regKey1, dwIndex, szName, _countof(szName)); + szName[_countof(szName) - 1] = UNICODE_NULL; // Avoid buffer overrun + if (error != ERROR_SUCCESS) + break; + + CicRegKey regKey2; + error = regKey2.Open(regKey1, szName); + if (error != ERROR_SUCCESS) + break; + + error = regKey2.QuerySz(L"Layout Id", szLayoutId, _countof(szLayoutId)); + szLayoutId[_countof(szLayoutId) - 1] = UNICODE_NULL; // Avoid buffer overrun + if (error == ERROR_SUCCESS) + continue; + + DWORD dwLayoutId = wcstoul(szLayoutId, NULL, 16); + if (dwLayoutId == dwSpecialId) + { + s_hCacheKL = hKL; + s_dwCacheKLID = wcstoul(szName, NULL, 16); + break; + } + } + + return s_dwCacheKLID; +} + +/// @implemented +DWORD GetHKLSubstitute(_In_ HKL hKL) +{ + if (IS_IME_HKL(hKL)) + return HandleToUlong(hKL); + + DWORD dwKLID; + if (HIWORD(hKL) == LOWORD(hKL)) + dwKLID = LOWORD(hKL); + else if (IS_SPECIAL_HKL(hKL)) + dwKLID = GetSpecialKLID(hKL); + else + dwKLID = HandleToUlong(hKL); + + if (dwKLID == 0) + return HandleToUlong(hKL); + + CicRegKey regKey; + LSTATUS error = regKey.Open(HKEY_CURRENT_USER, L"Keyboard Layout\\Substitutes"); + if (error == ERROR_SUCCESS) + { + WCHAR szName[MAX_PATH], szValue[MAX_PATH]; + DWORD dwIndex, dwValue; + for (dwIndex = 0; ; ++dwIndex) + { + error = regKey.EnumValue(dwIndex, szName, _countof(szName)); + szName[_countof(szName) - 1] = UNICODE_NULL; // Avoid buffer overrun + if (error != ERROR_SUCCESS) + break; + + error = regKey.QuerySz(szName, szValue, _countof(szValue)); + szValue[_countof(szValue) - 1] = UNICODE_NULL; // Avoid buffer overrun + if (error != ERROR_SUCCESS) + break; + + dwValue = wcstoul(szValue, NULL, 16); + if ((dwKLID & ~SPECIAL_MASK) == dwValue) + { + dwKLID = wcstoul(szName, NULL, 16); + break; + } + } + } + + return dwKLID; +} + +/// @implemented +static BOOL +GetKbdLayoutNameFromReg(_In_ HKL hKL, _Out_ LPWSTR pszDesc, _In_ UINT cchDesc) +{ + const DWORD dwKLID = GetHKLSubstitute(hKL); + + WCHAR szSubKey[MAX_PATH]; + StringCchPrintfW(szSubKey, _countof(szSubKey), + L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\%08lX", + dwKLID); + + CicRegKey regKey; + LSTATUS error = regKey.Open(HKEY_LOCAL_MACHINE, szSubKey); + if (error != ERROR_SUCCESS) + return FALSE; + + if (SHLoadRegUIStringW(regKey, L"Layout Display Name", pszDesc, cchDesc) == S_OK) + { + pszDesc[cchDesc - 1] = UNICODE_NULL; // Avoid buffer overrun + return TRUE; + } + + error = regKey.QuerySz(L"Layout Text", pszDesc, cchDesc); + pszDesc[cchDesc - 1] = UNICODE_NULL; // Avoid buffer overrun + return (error == ERROR_SUCCESS); +} + +/// @implemented +static BOOL +GetHKLName(_In_ HKL hKL, _Out_ LPWSTR pszDesc, _In_ UINT cchDesc) +{ + if (::GetLocaleInfoW(LOWORD(hKL), LOCALE_SLANGUAGE, pszDesc, cchDesc)) + return TRUE; + + *pszDesc = UNICODE_NULL; + + if (LOWORD(hKL) == HIWORD(hKL)) + return FALSE; + + return GetKbdLayoutNameFromReg(hKL, pszDesc, cchDesc); +} + +/// @implemented +static BOOL +GetHKLDesctription( + _In_ HKL hKL, + _Out_ LPWSTR pszDesc, + _In_ UINT cchDesc, + _Out_ LPWSTR pszImeFileName, + _In_ UINT cchImeFileName) +{ + pszDesc[0] = pszImeFileName[0] = UNICODE_NULL; + + if (!IS_IME_HKL(hKL)) + return GetHKLName(hKL, pszDesc, cchDesc); + + if (GetKbdLayoutNameFromReg(hKL, pszDesc, cchDesc)) + return TRUE; + + if (!::ImmGetDescriptionW(hKL, pszDesc, cchDesc)) + { + *pszDesc = UNICODE_NULL; + return GetHKLName(hKL, pszDesc, cchDesc); + } + + if (!::ImmGetIMEFileNameW(hKL, pszImeFileName, cchImeFileName)) + *pszImeFileName = UNICODE_NULL; + + return TRUE; +} + +/// @implemented +HICON GetIconFromFile(_In_ INT cx, _In_ INT cy, _In_ LPCWSTR pszFileName, _In_ INT iIcon) +{ + HICON hIcon; + + if (cx <= GetSystemMetrics(SM_CXSMICON)) + ::ExtractIconExW(pszFileName, iIcon, NULL, &hIcon, 1); + else + ::ExtractIconExW(pszFileName, iIcon, &hIcon, NULL, 1); + + return hIcon; +} + +/// @implemented +static BOOL EnsureIconImageList(VOID) +{ + if (!CStaticIconList::s_cx) + g_IconList.Init(::GetSystemMetrics(SM_CYSMICON), ::GetSystemMetrics(SM_CXSMICON)); + + return TRUE; +} + +/// @implemented +static INT GetPhysicalFontHeight(LOGFONTW *plf) +{ + HDC hDC = ::GetDC(NULL); + HFONT hFont = ::CreateFontIndirectW(plf); + HGDIOBJ hFontOld = ::SelectObject(hDC, hFont); + TEXTMETRICW tm; + ::GetTextMetricsW(hDC, &tm); + INT ret = tm.tmExternalLeading + tm.tmHeight; + ::SelectObject(hDC, hFontOld); + ::DeleteObject(hFont); + ::ReleaseDC(NULL, hDC); + return ret; +} + +/*********************************************************************** + * Inat helper functions + */ + +/// @implemented +INT InatAddIcon(_In_ HICON hIcon) +{ + if (!EnsureIconImageList()) + return -1; + return g_IconList.AddIcon(hIcon); +} + +/// @implemented +HICON +InatCreateIconBySize( + _In_ LANGID LangID, + _In_ INT nWidth, + _In_ INT nHeight, + _In_ const LOGFONTW *plf) +{ + WCHAR szText[64]; + BOOL ret = ::GetLocaleInfoW(LangID, LOCALE_NOUSEROVERRIDE | LOCALE_SABBREVLANGNAME, + szText, _countof(szText)); + if (!ret) + szText[0] = szText[1] = L'?'; + + szText[2] = UNICODE_NULL; + CharUpperW(szText); + + HFONT hFont = ::CreateFontIndirectW(plf); + if (!hFont) + return NULL; + + HDC hDC = ::GetDC(NULL); + HDC hMemDC = ::CreateCompatibleDC(hDC); + HBITMAP hbmColor = ::CreateCompatibleBitmap(hDC, nWidth, nHeight); + HBITMAP hbmMask = ::CreateBitmap(nWidth, nHeight, 1, 1, NULL); + ::ReleaseDC(NULL, hDC); + + HICON hIcon = NULL; + HGDIOBJ hbmOld = ::SelectObject(hMemDC, hbmColor); + HGDIOBJ hFontOld = ::SelectObject(hMemDC, hFont); + if (hMemDC && hbmColor && hbmMask) + { + ::SetBkColor(hMemDC, ::GetSysColor(COLOR_HIGHLIGHT)); + ::SetTextColor(hMemDC, ::GetSysColor(COLOR_HIGHLIGHTTEXT)); + + RECT rc = { 0, 0, nWidth, nHeight }; + ::ExtTextOutW(hMemDC, 0, 0, ETO_OPAQUE, &rc, L"", 0, NULL); + + ::DrawTextW(hMemDC, szText, 2, &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER); + ::SelectObject(hMemDC, hbmMask); + + ::PatBlt(hMemDC, 0, 0, nWidth, nHeight, BLACKNESS); + + ICONINFO IconInfo = { TRUE, 0, 0, hbmMask, hbmColor }; + hIcon = ::CreateIconIndirect(&IconInfo); + } + ::SelectObject(hMemDC, hFontOld); + ::SelectObject(hMemDC, hbmOld); + + ::DeleteObject(hbmMask); + ::DeleteObject(hbmColor); + ::DeleteDC(hMemDC); + ::DeleteObject(hFont); + return hIcon; +} + +/// @implemented +HICON InatCreateIcon(_In_ LANGID LangID) +{ + INT cxSmIcon = ::GetSystemMetrics(SM_CXSMICON), cySmIcon = ::GetSystemMetrics(SM_CYSMICON); + + LOGFONTW lf; + if (!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(LOGFONTW), &lf, 0)) + return NULL; + + if (cySmIcon < GetPhysicalFontHeight(&lf)) + { + lf.lfWidth = 0; + lf.lfHeight = - (7 * cySmIcon) / 10; + } + + return InatCreateIconBySize(LangID, cxSmIcon, cySmIcon, &lf); +} + +/// @implemented +BOOL InatGetIconSize(_Out_ INT *pcx, _Out_ INT *pcy) +{ + g_IconList.GetIconSize(pcx, pcy); + return TRUE; +} + +/// @implemented +INT InatGetImageCount(VOID) +{ + return g_IconList.GetImageCount(); +} + +/// @implemented +VOID InatRemoveAll(VOID) +{ + if (CStaticIconList::s_cx) + g_IconList.RemoveAll(FALSE); +} + +/// @implemented +VOID UninitINAT(VOID) +{ + g_IconList.RemoveAll(TRUE); + + if (g_pMlngInfo) + { + delete g_pMlngInfo; + g_pMlngInfo = NULL; + } +} + +/*********************************************************************** + * MLNGINFO + */ + +/// @implemented +void MLNGINFO::InitDesc() +{ + if (m_bInitDesc) + return; + + WCHAR szDesc[MAX_PATH], szImeFileName[MAX_PATH]; + GetHKLDesctription(m_hKL, szDesc, (UINT)_countof(szDesc), + szImeFileName, (UINT)_countof(szImeFileName)); + SetDesc(szDesc); + m_bInitDesc = TRUE; +} + +/// @implemented +void MLNGINFO::InitIcon() +{ + if (m_bInitIcon) + return; + + WCHAR szDesc[MAX_PATH], szImeFileName[MAX_PATH]; + GetHKLDesctription(m_hKL, szDesc, (UINT)_countof(szDesc), + szImeFileName, (UINT)_countof(szImeFileName)); + SetDesc(szDesc); + m_bInitDesc = TRUE; + + INT cxIcon, cyIcon; + InatGetIconSize(&cxIcon, &cyIcon); + + HICON hIcon = NULL; + if (szImeFileName[0]) + hIcon = GetIconFromFile(cxIcon, cyIcon, szImeFileName, 0); + + if (!hIcon) + hIcon = InatCreateIcon(LOWORD(m_hKL)); + + if (hIcon) + { + m_iIconIndex = InatAddIcon(hIcon); + ::DestroyIcon(hIcon); + } + + m_bInitIcon = TRUE; +} + +/// @implemented +LPCWSTR MLNGINFO::GetDesc() +{ + if (!m_bInitDesc) + InitDesc(); + + return m_szDesc; +} + +/// @implemented +void MLNGINFO::SetDesc(LPCWSTR pszDesc) +{ + StringCchCopyW(m_szDesc, _countof(m_szDesc), pszDesc); +} + +/// @implemented +INT MLNGINFO::GetIconIndex() +{ + if (!m_bInitIcon) + InitIcon(); + + return m_iIconIndex; +} + +/*********************************************************************** + * CStaticIconList + */ + +/// @implemented +void CStaticIconList::Init(INT cxIcon, INT cyIcon) +{ + ::EnterCriticalSection(&g_cs); + s_cx = cxIcon; + s_cy = cyIcon; + ::LeaveCriticalSection(&g_cs); +} + +/// @implemented +INT CStaticIconList::AddIcon(HICON hIcon) +{ + ::EnterCriticalSection(&g_cs); + + INT iItem = -1; + HICON hCopyIcon = ::CopyIcon(hIcon); + if (hCopyIcon) + { + if (g_IconList.Add(hIcon)) + iItem = INT(g_IconList.size() - 1); + } + + ::LeaveCriticalSection(&g_cs); + return iItem; +} + +/// @implemented +HICON CStaticIconList::ExtractIcon(INT iIcon) +{ + HICON hCopyIcon = NULL; + ::EnterCriticalSection(&g_cs); + if (iIcon <= (INT)g_IconList.size()) + hCopyIcon = ::CopyIcon(g_IconList[iIcon]); + ::LeaveCriticalSection(&g_cs); + return hCopyIcon; +} + +/// @implemented +void CStaticIconList::GetIconSize(INT *pcx, INT *pcy) +{ + ::EnterCriticalSection(&g_cs); + *pcx = s_cx; + *pcy = s_cy; + ::LeaveCriticalSection(&g_cs); +} + +/// @implemented +INT CStaticIconList::GetImageCount() +{ + ::EnterCriticalSection(&g_cs); + INT cItems = (INT)g_IconList.size(); + ::LeaveCriticalSection(&g_cs); + return cItems; +} + +/// @implemented +void CStaticIconList::RemoveAll(BOOL bNoLock) +{ + if (!bNoLock) + ::EnterCriticalSection(&g_cs); + + for (size_t iItem = 0; iItem < g_IconList.size(); ++iItem) + { + ::DestroyIcon(g_IconList[iItem]); + } + + clear(); + + if (!bNoLock) + ::LeaveCriticalSection(&g_cs); +} + +/// @implemented +static BOOL CheckMlngInfo(VOID) +{ + if (!g_pMlngInfo) + return TRUE; // Needs creation + + INT cKLs = ::GetKeyboardLayoutList(0, NULL); + if (cKLs != TF_MlngInfoCount()) + return TRUE; // Needs refresh + + if (!cKLs) + return FALSE; + + HKL *phKLs = (HKL*)cicMemAlloc(cKLs * sizeof(HKL)); + if (!phKLs) + return FALSE; + + ::GetKeyboardLayoutList(cKLs, phKLs); + + assert(g_pMlngInfo); + + BOOL ret = FALSE; + for (INT iKL = 0; iKL < cKLs; ++iKL) + { + if ((*g_pMlngInfo)[iKL].m_hKL != phKLs[iKL]) + { + ret = TRUE; // Needs refresh + break; + } + } + + cicMemFree(phKLs); + return ret; +} + +/// @implemented +static VOID DestroyMlngInfo(VOID) +{ + if (!g_pMlngInfo) + return; + + delete g_pMlngInfo; + g_pMlngInfo = NULL; +} + +/// @implemented +static VOID CreateMlngInfo(VOID) +{ + if (!g_pMlngInfo) + { + g_pMlngInfo = new(cicNoThrow) CicArray(); + if (!g_pMlngInfo) + return; + } + + if (!EnsureIconImageList()) + return; + + INT cKLs = ::GetKeyboardLayoutList(0, NULL); + HKL *phKLs = (HKL*)cicMemAllocClear(cKLs * sizeof(HKL)); + if (!phKLs) + return; + + ::GetKeyboardLayoutList(cKLs, phKLs); + + for (INT iKL = 0; iKL < cKLs; ++iKL) + { + MLNGINFO& info = (*g_pMlngInfo)[iKL]; + info.m_hKL = phKLs[iKL]; + info.m_bInitDesc = FALSE; + info.m_bInitIcon = FALSE; + } + + cicMemFree(phKLs); +} + +/*********************************************************************** + * TF_InitMlngInfo (MSCTF.@) + * + * @implemented + */ +EXTERN_C VOID WINAPI TF_InitMlngInfo(VOID) +{ + TRACE("()\n"); + + ::EnterCriticalSection(&g_cs); + + if (CheckMlngInfo()) + { + DestroyMlngInfo(); + CreateMlngInfo(); + } + + ::LeaveCriticalSection(&g_cs); +} + +/*********************************************************************** + * TF_MlngInfoCount (MSCTF.@) + * + * @implemented + */ +EXTERN_C INT WINAPI TF_MlngInfoCount(VOID) +{ + TRACE("()\n"); + + if (!g_pMlngInfo) + return 0; + + return (INT)g_pMlngInfo->size(); +} + +/*********************************************************************** + * TF_InatExtractIcon (MSCTF.@) + * + * @implemented + */ +EXTERN_C HICON WINAPI TF_InatExtractIcon(_In_ INT iKL) +{ + TRACE("(%d)\n", iKL); + return g_IconList.ExtractIcon(iKL); +} + +/*********************************************************************** + * TF_GetMlngIconIndex (MSCTF.@) + * + * @implemented + */ +EXTERN_C INT WINAPI TF_GetMlngIconIndex(_In_ INT iKL) +{ + TRACE("(%d)\n", iKL); + + INT iIcon = -1; + + ::EnterCriticalSection(&g_cs); + + assert(g_pMlngInfo); + + if (iKL < (INT)g_pMlngInfo->size()) + iIcon = (*g_pMlngInfo)[iKL].GetIconIndex(); + + ::LeaveCriticalSection(&g_cs); + + return iIcon; +} + +/*********************************************************************** + * TF_GetMlngHKL (MSCTF.@) + * + * @implemented + */ +EXTERN_C BOOL WINAPI +TF_GetMlngHKL( + _In_ INT iKL, + _Out_opt_ HKL *phKL, + _Out_opt_ LPWSTR pszDesc, + _In_ INT cchDesc) +{ + TRACE("(%d, %p, %p, %d)\n", iKL, phKL, pszDesc, cchDesc); + + BOOL ret = FALSE; + + ::EnterCriticalSection(&g_cs); + + assert(g_pMlngInfo); + + if (iKL < (INT)g_pMlngInfo->size()) + { + MLNGINFO& info = (*g_pMlngInfo)[iKL]; + + if (phKL) + *phKL = info.m_hKL; + + if (pszDesc) + StringCchCopyW(pszDesc, cchDesc, info.GetDesc()); + + ret = TRUE; + } + + ::LeaveCriticalSection(&g_cs); + + return ret; +} diff --git a/dll/win32/msctf/mlng.h b/dll/win32/msctf/mlng.h new file mode 100644 index 00000000000..e55e8b1ed7a --- /dev/null +++ b/dll/win32/msctf/mlng.h @@ -0,0 +1,59 @@ +/* + * PROJECT: ReactOS msctf.dll + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: Multi-language handling of Cicero + * COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ + */ + +#pragma once + +struct MLNGINFO +{ + HKL m_hKL; + BOOL m_bInitDesc; + BOOL m_bInitIcon; + INT m_iIconIndex; + WCHAR m_szDesc[128]; + + void InitDesc(); + void InitIcon(); + + INT GetIconIndex(); + LPCWSTR GetDesc(); + void SetDesc(LPCWSTR pszDesc); +}; + +class CStaticIconList : public CicArray +{ +public: + static INT s_cx; + static INT s_cy; + + CStaticIconList() { } + + void Init(INT cxIcon, INT cyIcon); + INT AddIcon(HICON hIcon); + HICON ExtractIcon(INT iIcon); + void GetIconSize(INT *pcx, INT *pcy); + INT GetImageCount(); + void RemoveAll(BOOL bNoLock); +}; + +INT InatAddIcon(_In_ HICON hIcon); +HICON InatCreateIcon(_In_ LANGID LangID); + +HICON +InatCreateIconBySize( + _In_ LANGID LangID, + _In_ INT nWidth, + _In_ INT nHeight, + _In_ const LOGFONTW *plf); + +BOOL InatGetIconSize(_Out_ INT *pcx, _Out_ INT *pcy); +INT InatGetImageCount(VOID); +VOID InatRemoveAll(VOID); + +DWORD GetHKLSubstitute(_In_ HKL hKL); +HICON GetIconFromFile(_In_ INT cx, _In_ INT cy, _In_ LPCWSTR pszFileName, _In_ INT iIcon); + +VOID UninitINAT(VOID); diff --git a/dll/win32/msctf/msctf.c b/dll/win32/msctf/msctf.c index c6e3a2ca597..a20d0fd55b6 100644 --- a/dll/win32/msctf/msctf.c +++ b/dll/win32/msctf/msctf.c @@ -697,6 +697,7 @@ HRESULT WINAPI TF_CreateLangBarItemMgr(ITfLangBarItemMgr **pplbim) return E_NOTIMPL; } +#ifndef __REACTOS__ /* See mlng.cpp */ /*********************************************************************** * TF_InitMlngInfo (MSCTF.@) */ @@ -705,3 +706,4 @@ HRESULT WINAPI TF_InitMlngInfo(void) FIXME("stub\n"); return S_OK; } +#endif diff --git a/dll/win32/msctf/msctf.spec b/dll/win32/msctf/msctf.spec index a2cb7984b72..6b036567346 100644 --- a/dll/win32/msctf/msctf.spec +++ b/dll/win32/msctf/msctf.spec @@ -19,11 +19,11 @@ @ stdcall -stub TF_GetGlobalCompartment(ptr) @ stub TF_GetInputScope @ stdcall -stub TF_GetLangIcon(long ptr long) -@ stdcall -stub TF_GetMlngHKL(long ptr ptr long) -@ stdcall -stub TF_GetMlngIconIndex(long) +@ stdcall TF_GetMlngHKL(long ptr ptr long) +@ stdcall TF_GetMlngIconIndex(long) @ stdcall -stub TF_GetThreadFlags(long ptr ptr ptr) @ stdcall TF_GetThreadMgr(ptr) -@ stdcall -stub TF_InatExtractIcon(long) +@ stdcall TF_InatExtractIcon(long) @ stdcall TF_InitMlngInfo() @ stdcall -stub TF_InitSystem() @ stdcall -stub TF_UninitSystem() @@ -31,7 +31,7 @@ @ stdcall TF_InvalidAssemblyListCacheIfExist() @ stdcall TF_IsCtfmonRunning() @ stdcall -stub TF_IsInMarshaling(long) -@ stdcall -stub TF_MlngInfoCount() +@ stdcall TF_MlngInfoCount() @ stdcall TF_RunInputCPL() @ stdcall -stub TF_PostAllThreadMsg(long long) @ stdcall TF_RegisterLangBarAddIn(ptr wstr long) diff --git a/dll/win32/msctf/utils.cpp b/dll/win32/msctf/utils.cpp index ec469ceef28..394c21b316e 100644 --- a/dll/win32/msctf/utils.cpp +++ b/dll/win32/msctf/utils.cpp @@ -23,10 +23,13 @@ #include #include +#include #include #include #include +#include "mlng.h" + #include WINE_DEFAULT_DEBUG_CHANNEL(msctf); @@ -617,6 +620,9 @@ VOID ProcessDetach(HINSTANCE hinstDLL) // FIXME: Call me from DllMain TFUninitLib(); //FIXME } + + UninitINAT(); + //FIXME //TF_UninitThreadSystem(); diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 912edc45598..b81e2e23ba1 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -11,6 +11,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(msutb); //#define ENABLE_DESKBAND +typedef struct LANGBARITEMSTATE +{ + CLSID m_clsid; + DWORD m_dwDemoteLevel; + UINT_PTR m_nTimerID; + UINT m_uTimeOut; + BOOL m_bStartedIntentionally; + BOOL m_bDisableDemoting; + + BOOL IsShown() + { + return m_dwDemoteLevel < 2; + } +} LANGBARITEMSTATE, *PLANGBARITEMSTATE; + HINSTANCE g_hInst = NULL; UINT g_wmTaskbarCreated = 0; UINT g_uACP = CP_ACP; @@ -1062,6 +1077,27 @@ class CTipbarGripper : public CUIFGripper /***********************************************************************/ +class CLangBarItemList : public CicArray +{ +public: + BOOL IsStartedIntentionally(REFCLSID rclsid); + + LANGBARITEMSTATE *AddItem(REFCLSID rclsid); + void Clear(); + BOOL SetDemoteLevel(REFCLSID rclsid, DWORD dwDemoteLevel); + + LANGBARITEMSTATE *FindItem(REFCLSID rclsid); + LANGBARITEMSTATE *GetItemStateFromTimerId(UINT_PTR nTimerID); + + void Load(); + void SaveItem(CicRegKey *pRegKey, const LANGBARITEMSTATE *pState); + + void StartDemotingTimer(REFCLSID rclsid, BOOL bIntentional); + UINT_PTR FindDemotingTimerId(); +}; + +/***********************************************************************/ + class CTrayIconWnd { protected: @@ -1300,6 +1336,7 @@ class CTipbarThread void AddUIObjs(); void RemoveUIObjs(); + CTipbarItem *GetItem(REFCLSID rclsid); void GetTextSize(BSTR bstr, LPSIZE pSize); void LocateItems(); void MyMoveWnd(LONG xDelta, LONG yDelta); @@ -1425,7 +1462,7 @@ class CTipbarWnd DWORD m_dwSinkCookie; CModalMenu *m_pModalMenu; CTipbarThread *m_pThread; - CicArray m_TipbarGUIDArray; + CLangBarItemList m_LangBarItemList; DWORD m_dwUnknown20; CUIFWndFrame *m_pWndFrame; CTipbarGripper *m_pTipbarGripper; @@ -1467,6 +1504,7 @@ class CTipbarWnd friend class CTipbarThread; friend class CTipbarItem; friend class CLBarInatItem; + friend class CMainIconItem; friend VOID WINAPI ClosePopupTipbar(VOID); friend BOOL GetTipbarInternal(HWND hWnd, DWORD dwFlags, CDeskBand *pDeskBand); friend LONG MyWaitForInputIdle(DWORD dwThreadId, DWORD dwMilliseconds); @@ -2786,7 +2824,7 @@ CUTBContextMenu::CUTBContextMenu(CTipbarWnd *pTipbarWnd) m_pTipbarWnd = pTipbarWnd; } -/// @unimplemented +/// @implemented BOOL CUTBContextMenu::Init() { m_pTipbarThread = m_pTipbarWnd->m_pFocusThread; @@ -3121,17 +3159,19 @@ STDMETHODIMP_(BOOL) CButtonIconItem::OnDelayMsg(UINT uMsg) * CMainIconItem */ +/// @implemented CMainIconItem::CMainIconItem(CTrayIconWnd *pWnd) : CButtonIconItem(pWnd, 1) { } +/// @implemented BOOL CMainIconItem::Init(HWND hWnd) { return CTrayIconItem::_Init(hWnd, WM_USER, 0, GUID_LBI_TRAYMAIN); } -/// @unimplemented +/// @implemented STDMETHODIMP_(BOOL) CMainIconItem::OnDelayMsg(UINT uMsg) { if (!CButtonIconItem::OnDelayMsg(uMsg)) @@ -3139,14 +3179,12 @@ STDMETHODIMP_(BOOL) CMainIconItem::OnDelayMsg(UINT uMsg) if (uMsg == WM_LBUTTONDBLCLK) { - //FIXME - //if (g_pTipbarWnd->m_dwUnknown20) - // g_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_SHOWNORMAL); + if (g_pTipbarWnd->m_dwUnknown20) + g_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_SHOWNORMAL); } else if (uMsg == WM_LBUTTONDOWN || uMsg == WM_RBUTTONDOWN) { - //FIXME - //g_pTipbarWnd->ShowContextMenu(m_ptCursor, &m_rcClient, uMsg == WM_RBUTTONDOWN); + g_pTipbarWnd->ShowContextMenu(m_ptCursor, &m_rcMenu, uMsg == WM_RBUTTONDOWN); } return TRUE; } @@ -3255,16 +3293,15 @@ HWND CTrayIconWnd::GetNotifyWnd() return m_hNotifyWnd; } -/// @unimplemented +/// @implemented BOOL CTrayIconWnd::OnIconMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { - //FIXME - //if (g_pTipbarWnd) - // g_pTipbarWnd->AttachFocusThread(); + if (g_pTipbarWnd) + g_pTipbarWnd->AttachFocusThread(); for (size_t iItem = 0; iItem < m_Items.size(); ++iItem) { - auto pItem = m_Items[iItem]; + auto *pItem = m_Items[iItem]; if (pItem) { if (uMsg == pItem->m_uCallbackMessage) @@ -3893,6 +3930,229 @@ STDMETHODIMP_(BOOL) CTipbarGripper::OnSetCursor(UINT uMsg, LONG x, LONG y) return CUIFGripper::OnSetCursor(uMsg, x, y); } +/*********************************************************************** + * CLangBarItemList + */ + +BOOL CLangBarItemList::IsStartedIntentionally(REFCLSID rclsid) +{ + auto *pItem = FindItem(rclsid); + if (!pItem) + return FALSE; + return pItem->m_bStartedIntentionally; +} + +LANGBARITEMSTATE *CLangBarItemList::AddItem(REFCLSID rclsid) +{ + auto *pItem = FindItem(rclsid); + if (pItem) + return pItem; + + pItem = Append(1); + if (!pItem) + return NULL; + + ZeroMemory(pItem, sizeof(*pItem)); + pItem->m_clsid = rclsid; + pItem->m_dwDemoteLevel = 0; + return pItem; +} + +void CLangBarItemList::Clear() +{ + clear(); + + CicRegKey regKey; + LSTATUS error; + error = regKey.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF\\LangBar", KEY_ALL_ACCESS); + if (error == ERROR_SUCCESS) + regKey.RecurseDeleteKey(L"ItemState"); +} + +BOOL CLangBarItemList::SetDemoteLevel(REFCLSID rclsid, DWORD dwDemoteLevel) +{ + auto *pItem = AddItem(rclsid); + if (!pItem) + return TRUE; + + pItem->m_dwDemoteLevel = dwDemoteLevel; + if (!pItem->IsShown()) + { + if (pItem->m_nTimerID) + { + if (g_pTipbarWnd) + g_pTipbarWnd->KillTimer(pItem->m_nTimerID); + pItem->m_nTimerID = 0; + pItem->m_uTimeOut = 0; + } + pItem->m_bDisableDemoting = FALSE; + } + + SaveItem(0, pItem); + return TRUE; +} + +LANGBARITEMSTATE *CLangBarItemList::FindItem(REFCLSID rclsid) +{ + for (size_t iItem = 0; iItem < size(); ++iItem) + { + auto& item = (*this)[iItem]; + if (IsEqualCLSID(item.m_clsid, rclsid)) + return &item; + } + return NULL; +} + +LANGBARITEMSTATE *CLangBarItemList::GetItemStateFromTimerId(UINT_PTR nTimerID) +{ + for (size_t iItem = 0; iItem < size(); ++iItem) + { + auto& item = (*this)[iItem]; + if (item.m_nTimerID == nTimerID) + return &item; + } + return NULL; +} + +void CLangBarItemList::Load() +{ + CicRegKey regKey; + LSTATUS error; + error = regKey.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF\\LangBar\\ItemState"); + if (error != ERROR_SUCCESS) + return; + + WCHAR szKeyName[MAX_PATH]; + for (DWORD dwIndex = 0; ; ++dwIndex) + { + error = ::RegEnumKeyW(regKey, dwIndex, szKeyName, _countof(szKeyName)); + if (error != ERROR_SUCCESS) + break; + + CLSID clsid; + if (::CLSIDFromString(szKeyName, &clsid) != S_OK) + continue; + + CicRegKey regKey2; + error = regKey2.Open(regKey, szKeyName); + if (error != ERROR_SUCCESS) + continue; + + auto *pItem = AddItem(clsid); + if (!pItem) + continue; + + DWORD Data = 0; + regKey2.QueryDword(L"DemoteLevel", &Data); + pItem->m_dwDemoteLevel = Data; + regKey2.QueryDword(L"DisableDemoting", &Data); + pItem->m_bDisableDemoting = !!Data; + } +} + +void CLangBarItemList::SaveItem(CicRegKey *pRegKey, const LANGBARITEMSTATE *pState) +{ + LSTATUS error; + CicRegKey regKey; + + if (!pRegKey) + { + error = regKey.Create(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\CTF\\LangBar\\ItemState"); + if (error != ERROR_SUCCESS) + return; + + pRegKey = ®Key; + } + + WCHAR szSubKey[MAX_PATH]; + ::StringFromGUID2(pState->m_clsid, szSubKey, _countof(szSubKey)); + + if (pState->m_dwDemoteLevel || pState->m_bDisableDemoting) + { + CicRegKey regKey2; + error = regKey2.Create(*pRegKey, szSubKey); + if (error == ERROR_SUCCESS) + { + DWORD dwDemoteLevel = pState->m_dwDemoteLevel; + if (dwDemoteLevel) + regKey2.SetDword(L"DemoteLevel", dwDemoteLevel); + else + regKey2.DeleteValue(L"DemoteLevel"); + + regKey2.SetDword(L"DisableDemoting", pState->m_bDisableDemoting); + } + } + else + { + pRegKey->RecurseDeleteKey(szSubKey); + } +} + +void CLangBarItemList::StartDemotingTimer(REFCLSID rclsid, BOOL bIntentional) +{ + if (!g_bIntelliSense) + return; + + auto *pItem = AddItem(rclsid); + if (!pItem || pItem->m_bDisableDemoting) + return; + + if (pItem->m_nTimerID) + { + if (!bIntentional) + return; + + if (g_pTipbarWnd) + g_pTipbarWnd->KillTimer(pItem->m_nTimerID); + + pItem->m_nTimerID = 0; + } + + pItem->m_bStartedIntentionally |= bIntentional; + + UINT uTimeOut = (bIntentional ? g_uTimeOutIntentional : g_uTimeOutNonIntentional); + pItem->m_uTimeOut += uTimeOut; + + if (pItem->m_uTimeOut < g_uTimeOutMax) + { + UINT_PTR uDemotingTimerId = FindDemotingTimerId(); + pItem->m_nTimerID = uDemotingTimerId; + if (uDemotingTimerId) + { + if (g_pTipbarWnd) + g_pTipbarWnd->SetTimer(uDemotingTimerId, uTimeOut); + } + } + else + { + pItem->m_bDisableDemoting = TRUE; + } +} + +UINT_PTR CLangBarItemList::FindDemotingTimerId() +{ + UINT_PTR nTimerID = 10000; + + if (empty()) + return nTimerID; + + for (;;) + { + size_t iItem = 0; + + while ((*this)[iItem].m_nTimerID != nTimerID) + { + ++iItem; + if (iItem >= size()) + return nTimerID; + } + + ++nTimerID; + if (nTimerID >= 10050) + return 0; + } +} + /*********************************************************************** * CTipbarWnd */ @@ -4358,7 +4618,7 @@ BOOL CTipbarWnd::CheckExcludeCaptionButtonMode(LPRECT prc1, LPCRECT prc2) void CTipbarWnd::ClearLBItemList() { - m_TipbarGUIDArray.clear(); + m_LangBarItemList.Clear(); if (m_pFocusThread) OnThreadItemChange(m_pFocusThread->m_dwThreadId); } @@ -5281,9 +5541,20 @@ STDMETHODIMP_(void) CTipbarWnd::OnTimer(WPARAM wParam) break; default: { - if ((10000 <= wParam) && (wParam <= 10049)) + if (10000 <= wParam && wParam < 10050) { - // FIXME: CLangBarItemList + auto *pItem = m_LangBarItemList.GetItemStateFromTimerId(wParam); + if (pItem) + { + auto& clsid = pItem->m_clsid; + m_LangBarItemList.SetDemoteLevel(pItem->m_clsid, 2); + if (m_pFocusThread) + { + auto *pThreadItem = m_pFocusThread->GetItem(clsid); + if (pThreadItem) + pThreadItem->AddRemoveMeToUI(FALSE); + } + } } break; } @@ -5624,6 +5895,17 @@ void CTipbarThread::RemoveUIObjs() RemoveAllSeparators(); } +CTipbarItem *CTipbarThread::GetItem(REFCLSID rclsid) +{ + for (size_t iItem = 0; iItem < m_UIObjects.size(); ++iItem) + { + auto *pItem = m_UIObjects[iItem]; + if (pItem && IsEqualCLSID(pItem->m_ItemInfo.guidItem, rclsid)) + return pItem; + } + return NULL; +} + void CTipbarThread::GetTextSize(BSTR bstr, LPSIZE pSize) { HWND hWnd = *m_pTipbarWnd->GetWindow(); diff --git a/dll/win32/shell32/dialogs/general.cpp b/dll/win32/shell32/dialogs/general.cpp index 9102c96f43b..33e3e94f73a 100644 --- a/dll/win32/shell32/dialogs/general.cpp +++ b/dll/win32/shell32/dialogs/general.cpp @@ -34,9 +34,6 @@ typedef struct REGSHELLSTATE static const LPCWSTR s_pszExplorerKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"; -extern "C" -BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCVOID inpRegKey); - ///////////////////////////////////////////////////////////////////////////// // Shell settings diff --git a/dll/win32/shell32/folders/CRegFolder.cpp b/dll/win32/shell32/folders/CRegFolder.cpp index d06230a83d5..5965039c147 100644 --- a/dll/win32/shell32/folders/CRegFolder.cpp +++ b/dll/win32/shell32/folders/CRegFolder.cpp @@ -116,6 +116,7 @@ HRESULT CGuidItemContextMenu_CreateInstance(PCIDLIST_ABSOLUTE pidlFolder, { wcscpy(&key[6], pwszCLSID); AddClassKeyToArray(key, hKeys, &cKeys); + CoTaskMemFree(pwszCLSID); } } AddClassKeyToArray(L"Folder", hKeys, &cKeys); diff --git a/dll/win32/shell32/icon_res.rc b/dll/win32/shell32/icon_res.rc index 31326738158..d0d18f94d46 100644 --- a/dll/win32/shell32/icon_res.rc +++ b/dll/win32/shell32/icon_res.rc @@ -47,6 +47,10 @@ IDI_SHELL_EXPLORER ICON "res/icons/46.ico" IDI_SHELL_UPDATE ICON "res/icons/47.ico" IDI_SHELL_LOCKED ICON "res/icons/48.ico" IDI_SHELL_DISCONN ICON "res/icons/49.ico" +IDI_SHELL_NONE_50 ICON "res/icons/50.ico" +IDI_SHELL_NONE_51 ICON "res/icons/50.ico" +IDI_SHELL_NONE_52 ICON "res/icons/50.ico" +IDI_SHELL_NONE_53 ICON "res/icons/50.ico" IDI_SHELL_NOT_CONNECTED_HDD ICON "res/icons/54.ico" IDI_SHELL_MULTIPLE_FILES ICON "res/icons/133.ico" IDI_SHELL_OPEN_WITH ICON "res/icons/134.ico" diff --git a/dll/win32/shell32/lang/bg-BG.rc b/dll/win32/shell32/lang/bg-BG.rc index fd8917c194f..c64e11fba90 100644 --- a/dll/win32/shell32/lang/bg-BG.rc +++ b/dll/win32/shell32/lang/bg-BG.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/ca-ES.rc b/dll/win32/shell32/lang/ca-ES.rc index f63e63e804f..948b4cbc51b 100644 --- a/dll/win32/shell32/lang/ca-ES.rc +++ b/dll/win32/shell32/lang/ca-ES.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/cs-CZ.rc b/dll/win32/shell32/lang/cs-CZ.rc index cd1e690b6bf..84a0ea85e5e 100644 --- a/dll/win32/shell32/lang/cs-CZ.rc +++ b/dll/win32/shell32/lang/cs-CZ.rc @@ -1022,6 +1022,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/da-DK.rc b/dll/win32/shell32/lang/da-DK.rc index 017aec2cff3..50fb44e6d03 100644 --- a/dll/win32/shell32/lang/da-DK.rc +++ b/dll/win32/shell32/lang/da-DK.rc @@ -1021,6 +1021,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/de-DE.rc b/dll/win32/shell32/lang/de-DE.rc index b4db49177b2..48a7798c2d3 100644 --- a/dll/win32/shell32/lang/de-DE.rc +++ b/dll/win32/shell32/lang/de-DE.rc @@ -1015,6 +1015,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Popupinformationen für Ordner- und Desktop-Elemente anzeigen" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/el-GR.rc b/dll/win32/shell32/lang/el-GR.rc index ce38f44b65e..fa9951a6b29 100644 --- a/dll/win32/shell32/lang/el-GR.rc +++ b/dll/win32/shell32/lang/el-GR.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/en-GB.rc b/dll/win32/shell32/lang/en-GB.rc index 3cbf42580f8..d4a577ceeb2 100644 --- a/dll/win32/shell32/lang/en-GB.rc +++ b/dll/win32/shell32/lang/en-GB.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/en-US.rc b/dll/win32/shell32/lang/en-US.rc index af8f821962b..5f15dbff2b5 100644 --- a/dll/win32/shell32/lang/en-US.rc +++ b/dll/win32/shell32/lang/en-US.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/es-ES.rc b/dll/win32/shell32/lang/es-ES.rc index 0e02d16aac5..15ab62ac077 100644 --- a/dll/win32/shell32/lang/es-ES.rc +++ b/dll/win32/shell32/lang/es-ES.rc @@ -1023,6 +1023,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Mostrar descripción de íconos y carpetas en el escritorio" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/et-EE.rc b/dll/win32/shell32/lang/et-EE.rc index 7451f1f42a5..bc0f0a8925e 100644 --- a/dll/win32/shell32/lang/et-EE.rc +++ b/dll/win32/shell32/lang/et-EE.rc @@ -1021,6 +1021,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Näita kausta- ja töölauaüksuste hüpikkirjeldusi" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/eu-ES.rc b/dll/win32/shell32/lang/eu-ES.rc index 7c4e8545880..8d2330ae3eb 100644 --- a/dll/win32/shell32/lang/eu-ES.rc +++ b/dll/win32/shell32/lang/eu-ES.rc @@ -1019,6 +1019,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Erakutsi ikonoen eta karpeten deskribapena mahaigainean" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/fi-FI.rc b/dll/win32/shell32/lang/fi-FI.rc index 506771e1f2f..af229c16a50 100644 --- a/dll/win32/shell32/lang/fi-FI.rc +++ b/dll/win32/shell32/lang/fi-FI.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/fr-FR.rc b/dll/win32/shell32/lang/fr-FR.rc index 0dd366692ad..cc0fe50d721 100644 --- a/dll/win32/shell32/lang/fr-FR.rc +++ b/dll/win32/shell32/lang/fr-FR.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Afficher les info-bulles pour les fichiers et les dossiers" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/he-IL.rc b/dll/win32/shell32/lang/he-IL.rc index 271218e5386..124e2a782c4 100644 --- a/dll/win32/shell32/lang/he-IL.rc +++ b/dll/win32/shell32/lang/he-IL.rc @@ -1021,6 +1021,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/hi-IN.rc b/dll/win32/shell32/lang/hi-IN.rc index 31f246172a4..397e975dda7 100644 --- a/dll/win32/shell32/lang/hi-IN.rc +++ b/dll/win32/shell32/lang/hi-IN.rc @@ -1016,6 +1016,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "फ़ोल्डर और डेस्कटॉप आइटम के लिए पॉप-अप विवरण दिखाएं" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/hu-HU.rc b/dll/win32/shell32/lang/hu-HU.rc index fdac1f499ca..436dfb73792 100644 --- a/dll/win32/shell32/lang/hu-HU.rc +++ b/dll/win32/shell32/lang/hu-HU.rc @@ -1013,6 +1013,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Felugró leírások megjelenítése a mappákhoz és az asztalon lévő elemekhez" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/id-ID.rc b/dll/win32/shell32/lang/id-ID.rc index 01f067658a0..261ce8d012a 100644 --- a/dll/win32/shell32/lang/id-ID.rc +++ b/dll/win32/shell32/lang/id-ID.rc @@ -1011,6 +1011,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Tampilkan deskrisi popup untuk butir folder dan desktop" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/it-IT.rc b/dll/win32/shell32/lang/it-IT.rc index 6c899156918..6af11defb3b 100644 --- a/dll/win32/shell32/lang/it-IT.rc +++ b/dll/win32/shell32/lang/it-IT.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/ja-JP.rc b/dll/win32/shell32/lang/ja-JP.rc index 3ec9aa07552..75537d33a5c 100644 --- a/dll/win32/shell32/lang/ja-JP.rc +++ b/dll/win32/shell32/lang/ja-JP.rc @@ -1011,6 +1011,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "フォルダとデスクトップの項目にポップアップ式の説明を表示する" IDS_ADVANCED_DISPLAY_FAVORITES "「お気に入り」を表示" IDS_ADVANCED_DISPLAY_LOG_OFF "「ログオフ」を表示" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "「コントロール パネル」を展開" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "「マイ ドキュメント」を展開" + IDS_ADVANCED_EXPAND_PRINTERS "「プリンタ」を展開" + IDS_ADVANCED_EXPAND_MY_PICTURES "「マイ ピクチャ」を展開" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "「マイ ネットワーク」を展開" IDS_ADVANCED_DISPLAY_RUN "「ファイル名を指定して実行」を表示" IDS_ADVANCED_DISPLAY_ADMINTOOLS "「管理者ツール」を表示" diff --git a/dll/win32/shell32/lang/ko-KR.rc b/dll/win32/shell32/lang/ko-KR.rc index f6bf96c3944..81f89b1c4af 100644 --- a/dll/win32/shell32/lang/ko-KR.rc +++ b/dll/win32/shell32/lang/ko-KR.rc @@ -1021,6 +1021,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/nl-NL.rc b/dll/win32/shell32/lang/nl-NL.rc index 9198a63f23e..079fd5766e4 100644 --- a/dll/win32/shell32/lang/nl-NL.rc +++ b/dll/win32/shell32/lang/nl-NL.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/no-NO.rc b/dll/win32/shell32/lang/no-NO.rc index b47d0f937f1..ea625e68480 100644 --- a/dll/win32/shell32/lang/no-NO.rc +++ b/dll/win32/shell32/lang/no-NO.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/pl-PL.rc b/dll/win32/shell32/lang/pl-PL.rc index 248a1b9ac6b..a308132b212 100644 --- a/dll/win32/shell32/lang/pl-PL.rc +++ b/dll/win32/shell32/lang/pl-PL.rc @@ -1023,6 +1023,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Pokaż podręczny opis elementów folderów i pulpitu" IDS_ADVANCED_DISPLAY_FAVORITES "Wyświetl polecenie Ulubione" IDS_ADVANCED_DISPLAY_LOG_OFF "Wyświetl polecenie Wyloguj" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Rozwiń polecenie Panel sterowania" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Rozwiń polecenie Moje dokumenty" + IDS_ADVANCED_EXPAND_PRINTERS "Rozwiń polecenie Drukarki" + IDS_ADVANCED_EXPAND_MY_PICTURES "Rozwiń polecenie Moje obrazy" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Rozwiń polecenie Połączenia sieciowe" IDS_ADVANCED_DISPLAY_RUN "Wyświetl polecenie Uruchom" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Wyświetl polecenie Narzędzia administracyjne" diff --git a/dll/win32/shell32/lang/pt-BR.rc b/dll/win32/shell32/lang/pt-BR.rc index 3c43e989993..32df4c6519b 100644 --- a/dll/win32/shell32/lang/pt-BR.rc +++ b/dll/win32/shell32/lang/pt-BR.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/pt-PT.rc b/dll/win32/shell32/lang/pt-PT.rc index f3c10f5daf0..b4370d67019 100644 --- a/dll/win32/shell32/lang/pt-PT.rc +++ b/dll/win32/shell32/lang/pt-PT.rc @@ -1013,6 +1013,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Mostrar descrição pop-up para itens de pastas e área de trabalho" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/ro-RO.rc b/dll/win32/shell32/lang/ro-RO.rc index 621ec05e753..c839f9d9db9 100644 --- a/dll/win32/shell32/lang/ro-RO.rc +++ b/dll/win32/shell32/lang/ro-RO.rc @@ -1022,6 +1022,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Permite descriere prin indicii pentru foldere și elemente de desktop" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/ru-RU.rc b/dll/win32/shell32/lang/ru-RU.rc index 9828f1b3a0d..48b24cbc26d 100644 --- a/dll/win32/shell32/lang/ru-RU.rc +++ b/dll/win32/shell32/lang/ru-RU.rc @@ -1023,6 +1023,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Отображать описание для папок и элементов рабочего стола" IDS_ADVANCED_DISPLAY_FAVORITES "Отображать папку ""Избранное""" IDS_ADVANCED_DISPLAY_LOG_OFF "Отображать команду ""Завершение сеанса""" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Раскрывать ""Панель управления""" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Раскрывать папку ""Мои документы""" + IDS_ADVANCED_EXPAND_PRINTERS "Раскрывать папку ""Принтеры""" + IDS_ADVANCED_EXPAND_MY_PICTURES "Раскрывать папку ""Мои рисунки""" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Раскрывать ""Сетевые подключения""" IDS_ADVANCED_DISPLAY_RUN "Отображать команду ""Выполнить""" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Отображать меню ""Администрирование""" diff --git a/dll/win32/shell32/lang/sk-SK.rc b/dll/win32/shell32/lang/sk-SK.rc index d712f2302d8..c18a52969e5 100644 --- a/dll/win32/shell32/lang/sk-SK.rc +++ b/dll/win32/shell32/lang/sk-SK.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/sl-SI.rc b/dll/win32/shell32/lang/sl-SI.rc index 731cd06ea72..8f891e7422d 100644 --- a/dll/win32/shell32/lang/sl-SI.rc +++ b/dll/win32/shell32/lang/sl-SI.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/sq-AL.rc b/dll/win32/shell32/lang/sq-AL.rc index 3d40941ac93..fe9f522ad0a 100644 --- a/dll/win32/shell32/lang/sq-AL.rc +++ b/dll/win32/shell32/lang/sq-AL.rc @@ -1021,6 +1021,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/sv-SE.rc b/dll/win32/shell32/lang/sv-SE.rc index 42f5014e8f3..514ffc671c1 100644 --- a/dll/win32/shell32/lang/sv-SE.rc +++ b/dll/win32/shell32/lang/sv-SE.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Show pop-up description for folder and desktop items" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/tr-TR.rc b/dll/win32/shell32/lang/tr-TR.rc index 6948821098a..be6886bd04a 100644 --- a/dll/win32/shell32/lang/tr-TR.rc +++ b/dll/win32/shell32/lang/tr-TR.rc @@ -1023,6 +1023,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Dizin ve masaüstü ögeleri için açılan tanım göster" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/uk-UA.rc b/dll/win32/shell32/lang/uk-UA.rc index 14be2ba092c..83ca1877267 100644 --- a/dll/win32/shell32/lang/uk-UA.rc +++ b/dll/win32/shell32/lang/uk-UA.rc @@ -1014,6 +1014,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "Показувати спливаючий опис для елементів папки та робочого столу" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/zh-CN.rc b/dll/win32/shell32/lang/zh-CN.rc index b27be47fad7..253eb1d3883 100644 --- a/dll/win32/shell32/lang/zh-CN.rc +++ b/dll/win32/shell32/lang/zh-CN.rc @@ -1024,6 +1024,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "显示文件夹和桌面项目的弹出描述" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/zh-HK.rc b/dll/win32/shell32/lang/zh-HK.rc index ac4dec30dec..7a3709ac5c6 100644 --- a/dll/win32/shell32/lang/zh-HK.rc +++ b/dll/win32/shell32/lang/zh-HK.rc @@ -1022,6 +1022,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "顯示資料夾和桌面項目的快顯描述" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/lang/zh-TW.rc b/dll/win32/shell32/lang/zh-TW.rc index c3054d7c4b4..cc14c766b8d 100644 --- a/dll/win32/shell32/lang/zh-TW.rc +++ b/dll/win32/shell32/lang/zh-TW.rc @@ -1023,6 +1023,11 @@ BEGIN IDS_ADVANCED_SHOW_INFO_TIP "顯示資料夾和桌面項目的快顯描述" IDS_ADVANCED_DISPLAY_FAVORITES "Display Favorites" IDS_ADVANCED_DISPLAY_LOG_OFF "Display Log Off" + IDS_ADVANCED_EXPAND_CONTROL_PANEL "Expand Control Panel" + IDS_ADVANCED_EXPAND_MY_DOCUMENTS "Expand My Documents" + IDS_ADVANCED_EXPAND_PRINTERS "Expand Printers" + IDS_ADVANCED_EXPAND_MY_PICTURES "Expand My Pictures" + IDS_ADVANCED_EXPAND_NET_CONNECTIONS "Expand Network Connections" IDS_ADVANCED_DISPLAY_RUN "Display Run" IDS_ADVANCED_DISPLAY_ADMINTOOLS "Display Administrative Tools" diff --git a/dll/win32/shell32/res/icons/50.ico b/dll/win32/shell32/res/icons/50.ico new file mode 100644 index 00000000000..09d9c20589d Binary files /dev/null and b/dll/win32/shell32/res/icons/50.ico differ diff --git a/dll/win32/shell32/shellmenu/CMenuToolbars.cpp b/dll/win32/shell32/shellmenu/CMenuToolbars.cpp index 0d5cd9ce514..d3a0b959754 100644 --- a/dll/win32/shell32/shellmenu/CMenuToolbars.cpp +++ b/dll/win32/shell32/shellmenu/CMenuToolbars.cpp @@ -1323,6 +1323,18 @@ int CALLBACK PidlListSort(void* item1, void* item2, LPARAM lParam) return (int)(short)LOWORD(hr); } +static BOOL IsPidlPrograms(LPCITEMIDLIST pidlTarget) +{ + WCHAR szTarget[MAX_PATH], szPath[MAX_PATH]; + if (!SHGetPathFromIDListW(pidlTarget, szTarget)) + return FALSE; + SHGetSpecialFolderPathW(NULL, szPath, CSIDL_COMMON_PROGRAMS, FALSE); + if (lstrcmpiW(szTarget, szPath) == 0) + return TRUE; + SHGetSpecialFolderPathW(NULL, szPath, CSIDL_PROGRAMS, FALSE); + return (lstrcmpiW(szTarget, szPath) == 0); +} + HRESULT CMenuSFToolbar::FillToolbar(BOOL clearFirst) { HRESULT hr; @@ -1361,17 +1373,26 @@ HRESULT CMenuSFToolbar::FillToolbar(BOOL clearFirst) DPA_Sort(dpaSort, PidlListSort, (LPARAM) m_shellFolder.p); - for (int i = 0; iGetDisplayNameOf(item, SIGDN_NORMALDISPLAY, &sr); if (FAILED_UNEXPECTEDLY(hr)) { @@ -1379,9 +1400,18 @@ HRESULT CMenuSFToolbar::FillToolbar(BOOL clearFirst) return hr; } + PWSTR MenuString; StrRetToStr(&sr, NULL, &MenuString); - index = SHMapPIDLToSystemImageListIndex(m_shellFolder, item, &indexOpen); + if (bMustHideAdminTools && lstrcmpiW(MenuString, szAdminTools) == 0) + { + ++i; + CoTaskMemFree(MenuString); + continue; + } + + INT indexOpen = 0; + INT index = SHMapPIDLToSystemImageListIndex(m_shellFolder, item, &indexOpen); LPCITEMIDLIST itemc = item; diff --git a/dll/win32/shell32/shellmenu/CStartMenu.cpp b/dll/win32/shell32/shellmenu/CStartMenu.cpp index 311b6516124..218f18919a2 100644 --- a/dll/win32/shell32/shellmenu/CStartMenu.cpp +++ b/dll/win32/shell32/shellmenu/CStartMenu.cpp @@ -153,46 +153,127 @@ class CShellMenuCallback : return S_OK; } - void InsertRecentItem(HMENU hMenu, UINT nID, INT csidl, BOOL bExpand) const + void AddOrSetMenuItem(HMENU hMenu, UINT nID, INT csidl, BOOL bExpand, + BOOL bAdd = TRUE, BOOL bSetText = TRUE) const { - WCHAR szPath[MAX_PATH]; - if (!SHGetSpecialFolderPathW(NULL, szPath, csidl, FALSE)) + MENUITEMINFOW mii = { sizeof(mii), MIIM_ID | MIIM_SUBMENU }; + mii.wID = nID; + + SHFILEINFOW fileInfo = { 0 }; + if (bAdd || bSetText) { - ERR("SHGetSpecialFolderPathW failed\n"); - return; + LPITEMIDLIST pidl; + if (SHGetSpecialFolderLocation(NULL, csidl, &pidl) != S_OK) + { + ERR("SHGetSpecialFolderLocation failed\n"); + return; + } + + SHGetFileInfoW((LPWSTR)pidl, 0, &fileInfo, sizeof(fileInfo), + SHGFI_PIDL | SHGFI_DISPLAYNAME); + CoTaskMemFree(pidl); + + mii.fMask |= MIIM_TYPE; + mii.fType = MFT_STRING; + mii.dwTypeData = fileInfo.szDisplayName; } - LPWSTR pszText = PathFindFileNameW(szPath); if (bExpand) - { - MENUITEMINFOW mii = { sizeof(mii), MIIM_TYPE | MIIM_ID | MIIM_SUBMENU }; - mii.fType = MFT_STRING; - mii.wID = nID; mii.hSubMenu = ::CreatePopupMenu(); - mii.dwTypeData = pszText; - mii.cch = lstrlenW(pszText); + + if (bAdd) InsertMenuItemW(hMenu, GetMenuItemCount(hMenu), TRUE, &mii); - } else - { - AppendMenuW(hMenu, MF_STRING | MF_ENABLED, nID, pszText); - } + SetMenuItemInfoW(hMenu, nID, FALSE, &mii); } - HMENU CreateRecentMenu(BOOL bExpandMyDocuments, BOOL bExpandMyPictures) const + BOOL GetAdvancedValue(LPCWSTR pszName, BOOL bDefault = FALSE) const + { + return SHRegGetBoolUSValueW( + L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", + pszName, FALSE, bDefault); + } + + HMENU CreateRecentMenu() const { HMENU hMenu = ::CreateMenu(); - InsertRecentItem(hMenu, IDM_MYDOCUMENTS, CSIDL_MYDOCUMENTS, bExpandMyDocuments); - InsertRecentItem(hMenu, IDM_MYPICTURES, CSIDL_MYPICTURES, bExpandMyPictures); - AppendMenuW(hMenu, MF_SEPARATOR, 0, NULL); + BOOL bAdded = FALSE; + + // My Documents + if (!SHRestricted(REST_NOSMMYDOCS) && + GetAdvancedValue(L"Start_ShowMyDocs", TRUE)) + { + BOOL bExpand = GetAdvancedValue(L"CascadeMyDocuments", FALSE); + AddOrSetMenuItem(hMenu, IDM_MYDOCUMENTS, CSIDL_MYDOCUMENTS, bExpand); + bAdded = TRUE; + } + + // My Pictures + if (!SHRestricted(REST_NOSMMYPICS) && + GetAdvancedValue(L"Start_ShowMyPics", TRUE)) + { + BOOL bExpand = GetAdvancedValue(L"CascadeMyPictures", FALSE); + AddOrSetMenuItem(hMenu, IDM_MYPICTURES, CSIDL_MYPICTURES, bExpand); + bAdded = TRUE; + } + + if (bAdded) + AppendMenuW(hMenu, MF_SEPARATOR, 0, NULL); + return hMenu; } + void UpdateSettingsMenu(HMENU hMenu) + { + BOOL bExpand; + + bExpand = GetAdvancedValue(L"CascadeControlPanel"); + AddOrSetMenuItem(hMenu, IDM_CONTROLPANEL, CSIDL_CONTROLS, bExpand, FALSE, FALSE); + + bExpand = GetAdvancedValue(L"CascadeNetworkConnections"); + AddOrSetMenuItem(hMenu, IDM_NETWORKCONNECTIONS, CSIDL_NETWORK, bExpand, FALSE, FALSE); + + bExpand = GetAdvancedValue(L"CascadePrinters"); + AddOrSetMenuItem(hMenu, IDM_PRINTERSANDFAXES, CSIDL_PRINTERS, bExpand, FALSE, FALSE); + } + + HRESULT AddStartMenuItems(IShellMenu *pShellMenu, INT csidl, DWORD dwFlags, IShellFolder *psf = NULL) + { + CComHeapPtr pidlFolder; + CComPtr psfDesktop; + CComPtr pShellFolder; + HRESULT hr; + + hr = SHGetFolderLocation(NULL, csidl, 0, 0, &pidlFolder); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + + if (psf) + { + pShellFolder = psf; + } + else + { + hr = SHGetDesktopFolder(&psfDesktop); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + + hr = psfDesktop->BindToObject(pidlFolder, NULL, IID_PPV_ARG(IShellFolder, &pShellFolder)); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + } + + hr = pShellMenu->SetShellFolder(pShellFolder, pidlFolder, NULL, dwFlags); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + + return hr; + } + HRESULT OnGetSubMenu(LPSMDATA psmd, REFIID iid, void ** pv) { HRESULT hr; - int csidl = 0; - IShellMenu *pShellMenu; + CComPtr pShellMenu; hr = CMenuBand_CreateInstance(IID_PPV_ARG(IShellMenu, &pShellMenu)); if (FAILED_UNEXPECTEDLY(hr)) @@ -202,86 +283,107 @@ class CShellMenuCallback : if (FAILED_UNEXPECTEDLY(hr)) return hr; + hr = E_FAIL; switch (psmd->uId) { - case IDM_PROGRAMS: csidl = CSIDL_PROGRAMS; break; - case IDM_FAVORITES: csidl = CSIDL_FAVORITES; break; - case IDM_DOCUMENTS: csidl = CSIDL_RECENT; break; - case IDM_MYDOCUMENTS: csidl = CSIDL_MYDOCUMENTS; break; - case IDM_MYPICTURES: csidl = CSIDL_MYPICTURES; break; - } + case IDM_PROGRAMS: + { + hr = AddStartMenuItems(pShellMenu, CSIDL_PROGRAMS, SMSET_TOP, m_psfPrograms); + break; + } + case IDM_FAVORITES: + case IDM_MYDOCUMENTS: + case IDM_MYPICTURES: + case IDM_CONTROLPANEL: + case IDM_NETWORKCONNECTIONS: + case IDM_PRINTERSANDFAXES: + { + hr = AddStartMenuItems(pShellMenu, CSIDLFromID(psmd->uId), SMSET_TOP); + break; + } + case IDM_DOCUMENTS: + { + HMENU hMenu = CreateRecentMenu(); + if (hMenu == NULL) + ERR("CreateRecentMenu failed\n"); - if (csidl) - { - IShellFolder *psfStartMenu; - DWORD dwFlags = SMSET_TOP; + hr = pShellMenu->SetMenu(hMenu, NULL, SMSET_BOTTOM); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; - if (csidl == CSIDL_PROGRAMS && m_psfPrograms) - { - psfStartMenu = m_psfPrograms; + hr = AddStartMenuItems(pShellMenu, CSIDL_RECENT, SMSET_BOTTOM); + break; } - else + case IDM_SETTINGS: { - if (csidl == CSIDL_RECENT) + MENUITEMINFOW mii = { sizeof(mii), MIIM_SUBMENU }; + if (GetMenuItemInfoW(psmd->hmenu, psmd->uId, FALSE, &mii)) { - BOOL bExpandMyDocuments = FALSE; /* FIXME: Get value from registry */ - BOOL bExpandMyPictures = FALSE; /* FIXME: Get value from registry */ - HMENU hMenu = CreateRecentMenu(bExpandMyDocuments, bExpandMyPictures); - if (hMenu == NULL) - ERR("CreateRecentMenu failed\n"); + UpdateSettingsMenu(mii.hSubMenu); - hr = pShellMenu->SetMenu(hMenu, NULL, SMSET_BOTTOM); + hr = pShellMenu->SetMenu(mii.hSubMenu, NULL, SMSET_BOTTOM); if (FAILED_UNEXPECTEDLY(hr)) return hr; - - dwFlags = SMSET_BOTTOM; } - - LPITEMIDLIST pidlStartMenu; - IShellFolder *psfDestop; - hr = SHGetFolderLocation(NULL, csidl, 0, 0, &pidlStartMenu); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - - hr = SHGetDesktopFolder(&psfDestop); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - - hr = psfDestop->BindToObject(pidlStartMenu, NULL, IID_PPV_ARG(IShellFolder, &psfStartMenu)); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; + break; } - - hr = pShellMenu->SetShellFolder(psfStartMenu, NULL, NULL, dwFlags); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - } - else - { - MENUITEMINFO mii; - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_SUBMENU; - if (GetMenuItemInfoW(psmd->hmenu, psmd->uId, FALSE, &mii)) + default: { - hr = pShellMenu->SetMenu(mii.hSubMenu, NULL, SMSET_BOTTOM); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; + MENUITEMINFOW mii = { sizeof(mii), MIIM_SUBMENU }; + if (GetMenuItemInfoW(psmd->hmenu, psmd->uId, FALSE, &mii)) + { + hr = pShellMenu->SetMenu(mii.hSubMenu, NULL, SMSET_BOTTOM); + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + } } } - return pShellMenu->QueryInterface(iid, pv); + + if (FAILED(hr)) + return hr; + + hr = pShellMenu->QueryInterface(iid, pv); + pShellMenu.Detach(); + return hr; } - HRESULT OnGetContextMenu(LPSMDATA psmd, REFIID iid, void ** pv) + INT CSIDLFromID(UINT uId) const { - if (psmd->uId == IDM_PROGRAMS || - psmd->uId == IDM_CONTROLPANEL || - psmd->uId == IDM_NETWORKCONNECTIONS || - psmd->uId == IDM_PRINTERSANDFAXES) + switch (uId) { - //UNIMPLEMENTED + case IDM_PROGRAMS: return CSIDL_PROGRAMS; + case IDM_FAVORITES: return CSIDL_FAVORITES; + case IDM_DOCUMENTS: return CSIDL_RECENT; + case IDM_MYDOCUMENTS: return CSIDL_MYDOCUMENTS; + case IDM_MYPICTURES: return CSIDL_MYPICTURES; + case IDM_CONTROLPANEL: return CSIDL_CONTROLS; + case IDM_NETWORKCONNECTIONS: return CSIDL_NETWORK; + case IDM_PRINTERSANDFAXES: return CSIDL_PRINTERS; + default: return 0; } + } - return S_FALSE; + HRESULT OnGetContextMenu(LPSMDATA psmd, REFIID iid, void ** pv) + { + INT csidl = CSIDLFromID(psmd->uId); + if (!csidl) + return S_FALSE; + + TRACE("csidl: 0x%X\n", csidl); + + if (csidl == CSIDL_CONTROLS || csidl == CSIDL_NETWORK || csidl == CSIDL_PRINTERS) + FIXME("This CSIDL %d wrongly opens My Computer. CORE-19477\n", csidl); + + CComHeapPtr pidl; + SHGetSpecialFolderLocation(NULL, csidl, &pidl); + + CComPtr pSF; + LPCITEMIDLIST pidlChild = NULL; + HRESULT hr = SHBindToParent(pidl, IID_IShellFolder, (void**)&pSF, &pidlChild); + if (FAILED(hr)) + return hr; + + return pSF->GetUIObjectOf(NULL, 1, &pidlChild, IID_IContextMenu, NULL, pv); } HRESULT OnGetObject(LPSMDATA psmd, REFIID iid, void ** pv) diff --git a/dll/win32/shell32/shresdef.h b/dll/win32/shell32/shresdef.h index 7ed1a413624..fea82a77561 100644 --- a/dll/win32/shell32/shresdef.h +++ b/dll/win32/shell32/shresdef.h @@ -309,6 +309,11 @@ /* These values must be synchronized with explorer */ #define IDS_ADVANCED_DISPLAY_FAVORITES 30466 #define IDS_ADVANCED_DISPLAY_LOG_OFF 30467 +#define IDS_ADVANCED_EXPAND_CONTROL_PANEL 30468 +#define IDS_ADVANCED_EXPAND_MY_DOCUMENTS 30469 +#define IDS_ADVANCED_EXPAND_PRINTERS 30470 +#define IDS_ADVANCED_EXPAND_MY_PICTURES 30472 +#define IDS_ADVANCED_EXPAND_NET_CONNECTIONS 30473 #define IDS_ADVANCED_DISPLAY_RUN 30474 #define IDS_ADVANCED_DISPLAY_ADMINTOOLS 30476 @@ -590,6 +595,10 @@ #define IDI_SHELL_UPDATE 47 #define IDI_SHELL_LOCKED 48 #define IDI_SHELL_DISCONN 49 +#define IDI_SHELL_NONE_50 50 +#define IDI_SHELL_NONE_51 51 +#define IDI_SHELL_NONE_52 52 +#define IDI_SHELL_NONE_53 53 #define IDI_SHELL_NOT_CONNECTED_HDD 54 #define IDI_SHELL_MULTIPLE_FILES 133 #define IDI_SHELL_OPEN_WITH 134 diff --git a/dll/win32/shell32/wine/PolicyData.h b/dll/win32/shell32/wine/PolicyData.h new file mode 100644 index 00000000000..f106d28fcfd --- /dev/null +++ b/dll/win32/shell32/wine/PolicyData.h @@ -0,0 +1,307 @@ +/* + * PROJECT: ReactOS Shell32 + * LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later) + * PURPOSE: Defining shell policy data + * COPYRIGHT: Copyright 2022 Hermès Bélusca-Maïto + * Copyright 2024 Katayama Hirofumi MZ + */ + +/* + * NOTE: Up to date as of SHELL32 v6.00 (Win2k3). + * References: + * https://www.geoffchappell.com/studies/windows/shell/shell32/api/util/restrictions.htm + * https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/ne-shlobj_core-restrictions + * https://abi-laboratory.pro/compatibility/Windows_5.0_to_Windows_6.0/x86_64/headers_diff/shell32.dll/diff.html + */ + +DEFINE_POLICY( REST_NORUN, "Explorer", "NoRun" ), +DEFINE_POLICY( REST_NOCLOSE, "Explorer", "NoClose" ), +DEFINE_POLICY( REST_NOSAVESET, "Explorer", "NoSaveSettings" ), +DEFINE_POLICY( REST_NOFILEMENU, "Explorer", "NoFileMenu" ), +DEFINE_POLICY( REST_NOSETFOLDERS, "Explorer", "NoSetFolders" ), +DEFINE_POLICY( REST_NOSETTASKBAR, "Explorer", "NoSetTaskbar" ), +DEFINE_POLICY( REST_NODESKTOP, "Explorer", "NoDesktop" ), +DEFINE_POLICY( REST_NOFIND, "Explorer", "NoFind" ), +DEFINE_POLICY( REST_NODRIVES, "Explorer", "NoDrives" ), +DEFINE_POLICY( REST_NODRIVEAUTORUN, "Explorer", "NoDriveAutoRun" ), +DEFINE_POLICY( REST_NODRIVETYPEAUTORUN, "Explorer", "NoDriveTypeAutoRun" ), +DEFINE_POLICY( REST_NONETHOOD, "Explorer", "NoNetHood" ), +DEFINE_POLICY( REST_STARTBANNER, "Explorer", "NoStartBanner" ), +DEFINE_POLICY( REST_RESTRICTRUN, "Explorer", "RestrictRun" ), // REGSTR_VAL_RESTRICTRUN +DEFINE_POLICY( REST_NOPRINTERTABS, "Explorer", "NoPrinterTabs" ), // REGSTR_VAL_PRINTERS_HIDETABS +DEFINE_POLICY( REST_NOPRINTERDELETE, "Explorer", "NoDeletePrinter" ), // REGSTR_VAL_PRINTERS_NODELETE +DEFINE_POLICY( REST_NOPRINTERADD, "Explorer", "NoAddPrinter" ), // REGSTR_VAL_PRINTERS_NOADD +DEFINE_POLICY( REST_NOSTARTMENUSUBFOLDERS, "Explorer", "NoStartMenuSubFolders" ), +DEFINE_POLICY( REST_MYDOCSONNET, "Explorer", "MyDocsOnNet" ), +DEFINE_POLICY( REST_NOEXITTODOS, "WinOldApp", "NoRealMode" ), // REGSTR_VAL_WINOLDAPP_NOREALMODE +DEFINE_POLICY( REST_ENFORCESHELLEXTSECURITY, "Explorer", "EnforceShellExtensionSecurity" ), +DEFINE_POLICY( REST_LINKRESOLVEIGNORELINKINFO, "Explorer", "LinkResolveIgnoreLinkInfo" ), +DEFINE_POLICY( REST_NOCOMMONGROUPS, "Explorer", "NoCommonGroups" ), +DEFINE_POLICY( REST_SEPARATEDESKTOPPROCESS, "Explorer", "SeparateProcess" ), +DEFINE_POLICY( REST_NOWEB, "Explorer", "NoWebMenu" ), +DEFINE_POLICY( REST_NOTRAYCONTEXTMENU, "Explorer", "NoTrayContextMenu" ), +DEFINE_POLICY( REST_NOVIEWCONTEXTMENU, "Explorer", "NoViewContextMenu" ), +DEFINE_POLICY( REST_NONETCONNECTDISCONNECT, "Explorer", "NoNetConnectDisconnect" ), + +#if (WINE_FILEVERSION_MAJOR < 5) +// NOTE: This policy only controls the LogOff capability in the TaskMgr. +DEFINE_POLICY( REST_STARTMENULOGOFF, "Explorer", "NoLogoff" ), +#else +// NOTE: This policy now controls the presence/absence of the LogOff item in the Start Menu. +DEFINE_POLICY( REST_STARTMENULOGOFF, "Explorer", "StartMenuLogoff" ), +#endif + +DEFINE_POLICY( REST_NOSETTINGSASSIST, "Explorer", "NoSettingsWizards" ), +DEFINE_POLICY( REST_NOINTERNETICON, "Explorer", "NoInternetIcon" ), +DEFINE_POLICY( REST_NORECENTDOCSHISTORY, "Explorer", "NoRecentDocsHistory" ), +DEFINE_POLICY( REST_NORECENTDOCSMENU, "Explorer", "NoRecentDocsMenu" ), +DEFINE_POLICY( REST_NOACTIVEDESKTOP, "Explorer", "NoActiveDesktop" ), +DEFINE_POLICY( REST_NOACTIVEDESKTOPCHANGES, "Explorer", "NoActiveDesktopChanges" ), +DEFINE_POLICY( REST_NOFAVORITESMENU, "Explorer", "NoFavoritesMenu" ), +DEFINE_POLICY( REST_CLEARRECENTDOCSONEXIT, "Explorer", "ClearRecentDocsOnExit" ), +DEFINE_POLICY( REST_CLASSICSHELL, "Explorer", "ClassicShell" ), +DEFINE_POLICY( REST_NOCUSTOMIZEWEBVIEW, "Explorer", "NoCustomizeWebView" ), +DEFINE_POLICY( REST_NOHTMLWALLPAPER, "ActiveDesktop", "NoHTMLWallpaper" ), +DEFINE_POLICY( REST_NOCHANGINGWALLPAPER, "ActiveDesktop", "NoChangingWallpaper" ), +DEFINE_POLICY( REST_NODESKCOMP, "ActiveDesktop", "NoComponents" ), +DEFINE_POLICY( REST_NOADDDESKCOMP, "ActiveDesktop", "NoAddingComponents" ), +DEFINE_POLICY( REST_NODELDESKCOMP, "ActiveDesktop", "NoDeletingComponents" ), +DEFINE_POLICY( REST_NOCLOSEDESKCOMP, "ActiveDesktop", "NoClosingComponents" ), + +#if (WINE_FILEVERSION_MAJOR < 5) +DEFINE_POLICY( REST_NOCLOSE_DRAGDROPBAND, "ActiveDesktop", "NoCloseDragDropBands" ), +DEFINE_POLICY( REST_NOMOVINGBAND, "ActiveDesktop", "NoMovingBands" ), +#else +DEFINE_POLICY( REST_NOCLOSE_DRAGDROPBAND, "Explorer", "NoCloseDragDropBands" ), +DEFINE_POLICY( REST_NOMOVINGBAND, "Explorer", "NoMovingBands" ), +#endif + +DEFINE_POLICY( REST_NOEDITDESKCOMP, "ActiveDesktop", "NoEditingComponents" ), +DEFINE_POLICY( REST_NORESOLVESEARCH, "Explorer", "NoResolveSearch" ), +DEFINE_POLICY( REST_NORESOLVETRACK, "Explorer", "NoResolveTrack" ), +DEFINE_POLICY( REST_FORCECOPYACLWITHFILE, "Explorer", "ForceCopyACLWithFile" ), + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NOLOGO3CHANNELNOTIFY, "Explorer", "NoMSAppLogo5ChannelNotify" ), +#endif + +DEFINE_POLICY( REST_NOFORGETSOFTWAREUPDATE, "Explorer", "NoForgetSoftwareUpdate" ), +DEFINE_POLICY( REST_NOSETACTIVEDESKTOP, "Explorer", "NoSetActiveDesktop" ), +DEFINE_POLICY( REST_NOUPDATEWINDOWS, "Explorer", "NoWindowsUpdate" ), +DEFINE_POLICY( REST_NOCHANGESTARMENU, "Explorer", "NoChangeStartMenu" ), +DEFINE_POLICY( REST_NOFOLDEROPTIONS, "Explorer", "NoFolderOptions" ), +DEFINE_POLICY( REST_HASFINDCOMPUTERS, "Explorer", "FindComputers" ), +DEFINE_POLICY( REST_INTELLIMENUS, "Explorer", "IntelliMenus" ), +DEFINE_POLICY( REST_RUNDLGMEMCHECKBOX, "Explorer", "MemCheckBoxInRunDlg" ), +DEFINE_POLICY( REST_ARP_ShowPostSetup, "Uninstall", "ShowPostSetup" ), +DEFINE_POLICY( REST_NOCSC, "Explorer", "NoSyncAll" ), +DEFINE_POLICY( REST_NOCONTROLPANEL, "Explorer", "NoControlPanel" ), +DEFINE_POLICY( REST_ENUMWORKGROUP, "Explorer", "EnumWorkgroup" ), +DEFINE_POLICY( REST_ARP_NOARP, "Uninstall", "NoAddRemovePrograms" ), +DEFINE_POLICY( REST_ARP_NOREMOVEPAGE, "Uninstall", "NoRemovePage" ), +DEFINE_POLICY( REST_ARP_NOADDPAGE, "Uninstall", "NoAddPage" ), +DEFINE_POLICY( REST_ARP_NOWINSETUPPAGE, "Uninstall", "NoWindowsSetupPage" ), +DEFINE_POLICY( REST_GREYMSIADS, "Explorer", "GreyMSIAds" ), +DEFINE_POLICY( REST_NOCHANGEMAPPEDDRIVELABEL, "Explorer", "NoChangeMappedDriveLabel" ), +DEFINE_POLICY( REST_NOCHANGEMAPPEDDRIVECOMMENT, "Explorer", "NoChangeMappedDriveComment" ), +DEFINE_POLICY( REST_MaxRecentDocs, "Explorer", "MaxRecentDocs" ), +DEFINE_POLICY( REST_NONETWORKCONNECTIONS, "Explorer", "NoNetworkConnections" ), +DEFINE_POLICY( REST_FORCESTARTMENULOGOFF, "Explorer", "ForceStartMenuLogoff" ), +DEFINE_POLICY( REST_NOWEBVIEW, "Explorer", "NoWebView" ), +DEFINE_POLICY( REST_NOCUSTOMIZETHISFOLDER, "Explorer", "NoCustomizeThisFolder" ), +DEFINE_POLICY( REST_NOENCRYPTION, "Explorer", "NoEncryption" ), + +#if (WINE_FILEVERSION_MAJOR == 5) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_ALLOWFRENCHENCRYPTION, "Explorer", "AllowFrenchEncryption" ), +#endif + +DEFINE_POLICY( REST_DONTSHOWSUPERHIDDEN, "Explorer", "DontShowSuperHidden" ), +DEFINE_POLICY( REST_NOSHELLSEARCHBUTTON, "Explorer", "NoShellSearchButton" ), +DEFINE_POLICY( REST_NOHARDWARETAB, "Explorer", "NoHardwareTab" ), + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NORUNASINSTALLPROMPT, "Explorer", "NoRunasInstallPrompt" ), +DEFINE_POLICY( REST_PROMPTRUNASINSTALLNETPATH, "Explorer", "PromptRunasInstallNetPath" ), +#endif + +DEFINE_POLICY( REST_NOMANAGEMYCOMPUTERVERB, "Explorer", "NoManageMyComputerVerb" ), + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NORECENTDOCSNETHOOD, "Explorer", "NoRecentDocsNetHood" ), +#endif + +DEFINE_POLICY( REST_DISALLOWRUN, "Explorer", "DisallowRun" ), +DEFINE_POLICY( REST_NOWELCOMESCREEN, "Explorer", "NoWelcomeScreen" ), +DEFINE_POLICY( REST_RESTRICTCPL, "Explorer", "RestrictCpl" ), +DEFINE_POLICY( REST_DISALLOWCPL, "Explorer", "DisallowCpl" ), +DEFINE_POLICY( REST_NOSMBALLOONTIP, "Explorer", "NoSMBalloonTip" ), +DEFINE_POLICY( REST_NOSMHELP, "Explorer", "NoSMHelp" ), +DEFINE_POLICY( REST_NOWINKEYS, "Explorer", "NoWinKeys" ), +DEFINE_POLICY( REST_NOENCRYPTONMOVE, "Explorer", "NoEncryptOnMove" ), +DEFINE_POLICY( REST_NOLOCALMACHINERUN, "Explorer", "DisableLocalMachineRun" ), +DEFINE_POLICY( REST_NOCURRENTUSERRUN, "Explorer", "DisableCurrentUserRun" ), +DEFINE_POLICY( REST_NOLOCALMACHINERUNONCE, "Explorer", "DisableLocalMachineRunOnce" ), +DEFINE_POLICY( REST_NOCURRENTUSERRUNONCE, "Explorer", "DisableCurrentUserRunOnce" ), +DEFINE_POLICY( REST_FORCEACTIVEDESKTOPON, "Explorer", "ForceActiveDesktopOn" ), + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NOCOMPUTERSNEARME, "Explorer", "NoComputersNearMe" ), +#endif + +DEFINE_POLICY( REST_NOVIEWONDRIVE, "Explorer", "NoViewOnDrive" ), +DEFINE_POLICY( REST_NONETCRAWL, "Explorer", "NoNetCrawling" ), +DEFINE_POLICY( REST_NOSHAREDDOCUMENTS, "Explorer", "NoSharedDocuments" ), +DEFINE_POLICY( REST_NOSMMYDOCS, "Explorer", "NoSMMyDocs" ), +DEFINE_POLICY( REST_NOSMMYPICS, "Explorer", "NoSMMyPictures" ), +DEFINE_POLICY( REST_ALLOWBITBUCKDRIVES, "Explorer", "RecycleBinDrives" ), + +/* 0x4000050 - 0x4000060 */ +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_NONLEGACYSHELLMODE, "Explorer", "NoneLegacyShellMode" ), +#endif + +DEFINE_POLICY( REST_NOCONTROLPANELBARRICADE, "Explorer", "NoControlPanelBarricade" ), + +// NOTE: REST_NOSTARTPAGE never really existed. + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_NOAUTOTRAYNOTIFY, "Explorer", "NoAutoTrayNotify" ), +DEFINE_POLICY( REST_NOTASKGROUPING, "Explorer", "NoTaskGrouping" ), +DEFINE_POLICY( REST_NOCDBURNING, "Explorer", "NoCDBurning" ), +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_MYCOMPNOPROP, "Explorer", "NoPropertiesMyComputer" ), +DEFINE_POLICY( REST_MYDOCSNOPROP, "Explorer", "NoPropertiesMyDocuments" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_NOSTARTPANEL, "Explorer", "NoSimpleStartMenu" ), +DEFINE_POLICY( REST_NODISPLAYAPPEARANCEPAGE, "System", "NoDispAppearancePage" ), // REGSTR_VAL_DISPCPL_NOAPPEARANCEPAGE +DEFINE_POLICY( REST_NOTHEMESTAB, "Explorer", "NoThemesTab" ), +DEFINE_POLICY( REST_NOVISUALSTYLECHOICE, "System", "NoVisualStyleChoice" ), +DEFINE_POLICY( REST_NOSIZECHOICE, "System", "NoSizeChoice" ), +DEFINE_POLICY( REST_NOCOLORCHOICE, "System", "NoColorChoice" ), +DEFINE_POLICY( REST_SETVISUALSTYLE, "System", "SetVisualStyle" ), +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_STARTRUNNOHOMEPATH, "Explorer", "StartRunNoHOMEPATH" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_NOUSERNAMEINSTARTPANEL, "Explorer", "NoUserNameInStartMenu" ), +DEFINE_POLICY( REST_NOMYCOMPUTERICON, "NonEnum", "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" ), +DEFINE_POLICY( REST_NOSMNETWORKPLACES, "Explorer", "NoStartMenuNetworkPlaces" ), +DEFINE_POLICY( REST_NOSMPINNEDLIST, "Explorer", "NoStartMenuPinnedList" ), +DEFINE_POLICY( REST_NOSMMYMUSIC, "Explorer", "NoStartMenuMyMusic" ), +DEFINE_POLICY( REST_NOSMEJECTPC, "Explorer", "NoStartMenuEjectPC" ), +DEFINE_POLICY( REST_NOSMMOREPROGRAMS, "Explorer", "NoStartMenuMorePrograms" ), +DEFINE_POLICY( REST_NOSMMFUPROGRAMS, "Explorer", "NoStartMenuMFUprogramsList" ), +DEFINE_POLICY( REST_NOTRAYITEMSDISPLAY, "Explorer", "NoTrayItemsDisplay" ), +DEFINE_POLICY( REST_NOTOOLBARSONTASKBAR, "Explorer", "NoToolbarsOnTaskbar" ), +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_NOSMCONFIGUREPROGRAMS, "Explorer", "NoSMConfigurePrograms" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_HIDECLOCK, "Explorer", "HideClock" ), +DEFINE_POLICY( REST_NOLOWDISKSPACECHECKS, "Explorer", "NoLowDiskSpaceChecks" ), +#endif + +#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NOENTIRENETWORK, "Network", "NoEntireNetwork" ), // REGSTR_VAL_NOENTIRENETWORK +DEFINE_POLICY( REST_NODESKTOPCLEANUP, "Explorer", "NoDesktopCleanupWizard" ), +#endif + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_BITBUCKNUKEONDELETE, "Explorer", "NoRecycleFiles" ), +DEFINE_POLICY( REST_BITBUCKCONFIRMDELETE, "Explorer", "ConfirmFileDelete" ), +DEFINE_POLICY( REST_BITBUCKNOPROP, "Explorer", "NoPropertiesRecycleBin" ), +DEFINE_POLICY( REST_NODISPBACKGROUND, "System", "NoDispBackgroundPage" ), // REGSTR_VAL_DISPCPL_NOBACKGROUNDPAGE +DEFINE_POLICY( REST_NODISPSCREENSAVEPG, "System", "NoDispScrSavPage" ), // REGSTR_VAL_DISPCPL_NOSCRSAVPAGE +DEFINE_POLICY( REST_NODISPSETTINGSPG, "System", "NoDispSettingsPage" ), // REGSTR_VAL_DISPCPL_NOSETTINGSPAGE +DEFINE_POLICY( REST_NODISPSCREENSAVEPREVIEW, "System", "NoScreenSavePreview" ), +DEFINE_POLICY( REST_NODISPLAYCPL, "System", "NoDispCPL" ), // REGSTR_VAL_DISPCPL_NODISPCPL +DEFINE_POLICY( REST_HIDERUNASVERB, "Explorer", "HideRunAsVerb" ), +DEFINE_POLICY( REST_NOTHUMBNAILCACHE, "Explorer", "NoThumbnailCache" ), +DEFINE_POLICY( REST_NOSTRCMPLOGICAL, "Explorer", "NoStrCmpLogical" ), +DEFINE_POLICY( REST_NOPUBLISHWIZARD, "Explorer", "NoPublishingWizard" ), +DEFINE_POLICY( REST_NOONLINEPRINTSWIZARD, "Explorer", "NoOnlinePrintsWizard" ), +DEFINE_POLICY( REST_NOWEBSERVICES, "Explorer", "NoWebServices" ), +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_ALLOWUNHASHEDWEBVIEW, "Explorer", "AllowUnhashedWebView" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) +DEFINE_POLICY( REST_ALLOWLEGACYWEBVIEW, "Explorer", "AllowLegacyWebView" ), +#endif + +DEFINE_POLICY( REST_REVERTWEBVIEWSECURITY, "Explorer", "RevertWebViewSecurity" ), +DEFINE_POLICY( REST_INHERITCONSOLEHANDLES, "Explorer", "InheritConsoleHandles" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) + +#if (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_SORTMAXITEMCOUNT, "Explorer", "SortMaxItemCount" ), +#endif +DEFINE_POLICY( REST_NOREMOTERECURSIVEEVENTS, "Explorer", "NoRemoteRecursiveEvents" ), + +#endif // WINE_FILEVERSION_MAJOR + +DEFINE_POLICY( REST_NOREMOTECHANGENOTIFY, "Explorer", "NoRemoteChangeNotify" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) + +#if (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NOSIMPLENETIDLIST, "Explorer", "NoSimpleNetIDList" ), +#endif + +// #if (NTDDI_VERSION < NTDDI_LONGHORN) +// NOTE: Geoff Chappell is inacurrate here. + DEFINE_POLICY( REST_NOENUMENTIRENETWORK, "Explorer", "NoEnumEntireNetwork" ), +// #endif + +#if (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_NODETAILSTHUMBNAILONNETWORK, "Explorer", "NoDetailsThumbnailOnNetwork" ), +#endif + +DEFINE_POLICY( REST_NOINTERNETOPENWITH, "Explorer", "NoInternetOpenWith" ), + +#if (NTDDI_VERSION >= NTDDI_WINXPSP2) && (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_ALLOWLEGACYLMZBEHAVIOR, "Explorer", "AllowLegacyLMZBehavior" ), +#endif + +DEFINE_POLICY( REST_DONTRETRYBADNETNAME, "Explorer", "DontRetryBadNetName" ), +DEFINE_POLICY( REST_ALLOWFILECLSIDJUNCTIONS, "Explorer", "AllowFileCLSIDJunctions" ), +DEFINE_POLICY( REST_NOUPNPINSTALL, "Explorer", "NoUPnPInstallTask" ), + +// "NormalizeLinkNetPidls" only in version 6.0 from Windows XP SP3. + +#if (NTDDI_VERSION >= NTDDI_LONGHORN) +DEFINE_POLICY( REST_ARP_DONTGROUPPATCHES, "Uninstall", "DontGroupPatches" ), +DEFINE_POLICY( REST_ARP_NOCHOOSEPROGRAMSPAGE, "Uninstall", "NoChooseProgramsPage" ), +#endif + +// "AllowCLSIDPROGIDMapping" in Windows XP SP3 and Windows Server 2003 SP2 only. +// Maybe in Vista+ too? + +#endif // WINE_FILEVERSION_MAJOR + +/* 0x4000061 - 0x4000086 */ +DEFINE_POLICY( REST_NODISCONNECT, "Explorer", "NoDisconnect" ), +DEFINE_POLICY( REST_NOSECURITY, "Explorer", "NoNTSecurity" ), +DEFINE_POLICY( REST_NOFILEASSOCIATE, "Explorer", "NoFileAssociate" ), + +#if (WINE_FILEVERSION_MAJOR >= 6) + +// #if (NTDDI_VERSION < NTDDI_LONGHORN) +// NOTE: Either Geoff Chappell or MSDN is inaccurate here. +DEFINE_POLICY( REST_ALLOWCOMMENTTOGGLE, "Explorer", "ToggleCommentPosition" ), +// #endif +#if (NTDDI_VERSION < NTDDI_LONGHORN) +DEFINE_POLICY( REST_USEDESKTOPINICACHE, "Explorer", "UseDesktopIniCache" ), +#endif + +// "NoNetFolderInfoTip" only in version 6.0 from Windows XP SP3. + +#endif // WINE_FILEVERSION_MAJOR + +// NOTE: This is a SHDOCVW-only policy. +// DEFINE_POLICY( 0x50000024, "Explorer", "NoFileUrl" ), diff --git a/dll/win32/shell32/wine/shpolicy.c b/dll/win32/shell32/wine/shpolicy.c index 1300a2e7aa9..7a24ef49b40 100644 --- a/dll/win32/shell32/wine/shpolicy.c +++ b/dll/win32/shell32/wine/shpolicy.c @@ -2,7 +2,7 @@ * shpolicy.c - Data for shell/system policies. * * Copyright 1999 Ian Schmidt - * Copyright 2022 Hermes Belusca-Maito + * Copyright 2024 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 @@ -26,11 +26,6 @@ * would handle the many new policies introduced since then. * You could easily write one with the information in * this file... - * - * Up to date as of SHELL32 v6.00 (Win2k3) - * References: - * https://www.geoffchappell.com/studies/windows/shell/shell32/api/util/restrictions.htm - * https://docs.microsoft.com/en-us/windows/win32/api/shlobj_core/ne-shlobj_core-restrictions */ #include @@ -43,1276 +38,89 @@ #include #include #include +#include +#include #include #include "shell32_main.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); -#define SHELL_NO_POLICY 0xffffffff - -typedef struct tagPOLICYDAT -{ - DWORD policy; /* policy value passed to SHRestricted */ - LPCSTR appstr; /* application str such as "Explorer" */ - LPCSTR keystr; /* name of the actual registry key / policy */ - DWORD cache; /* cached value or 0xffffffff for invalid */ -} POLICYDATA, *LPPOLICYDATA; - -/* application strings */ +DEFINE_GUID(GUID_Restrictions, 0xA48F1A32, 0xA340, 0x11D1, 0xBC, 0x6B, 0x00, 0xA0, 0xC9, 0x03, 0x12, 0xE1); -static const char strExplorer[] = {"Explorer"}; -static const char strActiveDesk[] = {"ActiveDesktop"}; -static const char strWinOldApp[] = {"WinOldApp"}; -#if (WINE_FILEVERSION_MAJOR < 6) -/* Windows 2000/Me SHELL32 uses "AddRemoveProgs" */ -static const char strAddRemoveProgs[] = {"AddRemoveProgs"}; -#else -static const char strAddRemoveProgs[] = {"Uninstall"}; -#endif -#ifdef __REACTOS__ -static const char strSystem[] = {"System"}; -#endif +#define DEFINE_POLICY(policy, appstr, keystr) \ + { policy, L##appstr, L##keystr } -/* key strings */ - -#ifndef __REACTOS__ -static const char strNoFileURL[] = {"NoFileUrl"}; -#endif -static const char strNoFolderOptions[] = {"NoFolderOptions"}; -static const char strNoChangeStartMenu[] = {"NoChangeStartMenu"}; -static const char strNoWindowsUpdate[] = {"NoWindowsUpdate"}; -static const char strNoSetActiveDesktop[] = {"NoSetActiveDesktop"}; -static const char strNoForgetSoftwareUpdate[] = {"NoForgetSoftwareUpdate"}; -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) -static const char strNoMSAppLogo[] = {"NoMSAppLogo5ChannelNotify"}; -#endif -static const char strForceCopyACLW[] = {"ForceCopyACLWithFile"}; -static const char strNoResolveTrk[] = {"NoResolveTrack"}; -static const char strNoResolveSearch[] = {"NoResolveSearch"}; -static const char strNoEditComponent[] = {"NoEditingComponents"}; -static const char strNoMovingBand[] = {"NoMovingBands"}; -static const char strNoCloseDragDrop[] = {"NoCloseDragDropBands"}; -static const char strNoCloseComponent[] = {"NoClosingComponents"}; -static const char strNoDelComponent[] = {"NoDeletingComponents"}; -static const char strNoAddComponent[] = {"NoAddingComponents"}; -static const char strNoComponent[] = {"NoComponents"}; -static const char strNoChangeWallpaper[] = {"NoChangingWallpaper"}; -static const char strNoHTMLWallpaper[] = {"NoHTMLWallpaper"}; -static const char strNoCustomWebView[] = {"NoCustomizeWebView"}; -static const char strClassicShell[] = {"ClassicShell"}; -static const char strClearRecentDocs[] = {"ClearRecentDocsOnExit"}; -static const char strNoFavoritesMenu[] = {"NoFavoritesMenu"}; -static const char strNoActiveDesktopChanges[] = {"NoActiveDesktopChanges"}; -static const char strNoActiveDesktop[] = {"NoActiveDesktop"}; -static const char strNoRecentDocMenu[] = {"NoRecentDocsMenu"}; -static const char strNoRecentDocHistory[] = {"NoRecentDocsHistory"}; -static const char strNoInetIcon[] = {"NoInternetIcon"}; -static const char strNoSettingsWizard[] = {"NoSettingsWizards"}; -#if (WINE_FILEVERSION_MAJOR < 5) -// NOTE: This value now only controls the LogOff capability in the TaskMgr. -static const char strNoLogoff[] = {"NoLogoff"}; -#else -// NOTE: This is the new value that controls the presence/absence -// of the LogOff item in the Start Menu. -static const char strNoLogoff[] = {"StartMenuLogoff"}; -#endif -static const char strNoNetConDis[] = {"NoNetConnectDisconnect"}; -static const char strNoViewContextMenu[] = {"NoViewContextMenu"}; -static const char strNoTrayContextMenu[] = {"NoTrayContextMenu"}; -static const char strNoWebMenu[] = {"NoWebMenu"}; -static const char strLnkResolveIgnoreLnkInfo[] = {"LinkResolveIgnoreLinkInfo"}; -static const char strNoCommonGroups[] = {"NoCommonGroups"}; -static const char strEnforceShlExtSecurity[] = {"EnforceShellExtensionSecurity"}; -static const char strNoRealMode[] = {"NoRealMode"}; // REGSTR_VAL_WINOLDAPP_NOREALMODE -static const char strMyDocsOnNet[] = {"MyDocsOnNet"}; -static const char strNoStartMenuSubfolder[] = {"NoStartMenuSubFolders"}; -static const char strNoAddPrinters[] = {"NoAddPrinter"}; // REGSTR_VAL_PRINTERS_NOADD -static const char strNoDeletePrinters[] = {"NoDeletePrinter"}; // REGSTR_VAL_PRINTERS_NODELETE -static const char strNoPrintTab[] = {"NoPrinterTabs"}; // REGSTR_VAL_PRINTERS_HIDETABS -static const char strRestrictRun[] = {"RestrictRun"}; // REGSTR_VAL_RESTRICTRUN -static const char strNoStartBanner[] = {"NoStartBanner"}; -static const char strNoNetworkNeighborhood[] = {"NoNetHood"}; -static const char strNoDriveTypeAtRun[] = {"NoDriveTypeAutoRun"}; -static const char strNoDrivesAutoRun[] = {"NoDriveAutoRun"}; -static const char strSeparateProcess[] = {"SeparateProcess"}; -static const char strNoDrives[] = {"NoDrives"}; -static const char strNoFind[] = {"NoFind"}; -static const char strNoDesktop[] = {"NoDesktop"}; -static const char strNoSetTaskBar[] = {"NoSetTaskbar"}; -static const char strNoSetFld[] = {"NoSetFolders"}; -static const char strNoFileMenu[] = {"NoFileMenu"}; -static const char strNoSaveSetting[] = {"NoSaveSettings"}; -static const char strNoClose[] = {"NoClose"}; -static const char strNoRun[] = {"NoRun"}; - -/* policy data array */ -static POLICYDATA sh32_policy_table[] = +static const POLICYDATA s_PolicyTable[] = { - { - REST_NORUN, - strExplorer, - strNoRun, - SHELL_NO_POLICY - }, - { - REST_NOCLOSE, - strExplorer, - strNoClose, - SHELL_NO_POLICY - }, - { - REST_NOSAVESET, - strExplorer, - strNoSaveSetting, - SHELL_NO_POLICY - }, - { - REST_NOFILEMENU, - strExplorer, - strNoFileMenu, - SHELL_NO_POLICY - }, - { - REST_NOSETFOLDERS, - strExplorer, - strNoSetFld, - SHELL_NO_POLICY - }, - { - REST_NOSETTASKBAR, - strExplorer, - strNoSetTaskBar, - SHELL_NO_POLICY - }, - { - REST_NODESKTOP, - strExplorer, - strNoDesktop, - SHELL_NO_POLICY - }, - { - REST_NOFIND, - strExplorer, - strNoFind, - SHELL_NO_POLICY - }, - { - REST_NODRIVES, - strExplorer, - strNoDrives, - SHELL_NO_POLICY - }, - { - REST_NODRIVEAUTORUN, - strExplorer, - strNoDrivesAutoRun, - SHELL_NO_POLICY - }, - { - REST_NODRIVETYPEAUTORUN, - strExplorer, - strNoDriveTypeAtRun, - SHELL_NO_POLICY - }, - { - REST_NONETHOOD, - strExplorer, - strNoNetworkNeighborhood, - SHELL_NO_POLICY - }, - { - REST_STARTBANNER, - strExplorer, - strNoStartBanner, - SHELL_NO_POLICY - }, - { - REST_RESTRICTRUN, - strExplorer, - strRestrictRun, - SHELL_NO_POLICY - }, - { - REST_NOPRINTERTABS, - strExplorer, - strNoPrintTab, - SHELL_NO_POLICY - }, - { - REST_NOPRINTERDELETE, - strExplorer, - strNoDeletePrinters, - SHELL_NO_POLICY - }, - { - REST_NOPRINTERADD, - strExplorer, - strNoAddPrinters, - SHELL_NO_POLICY - }, - { - REST_NOSTARTMENUSUBFOLDERS, - strExplorer, - strNoStartMenuSubfolder, - SHELL_NO_POLICY - }, - { - REST_MYDOCSONNET, - strExplorer, - strMyDocsOnNet, - SHELL_NO_POLICY - }, - { - REST_NOEXITTODOS, - strWinOldApp, - strNoRealMode, - SHELL_NO_POLICY - }, - { - REST_ENFORCESHELLEXTSECURITY, - strExplorer, - strEnforceShlExtSecurity, - SHELL_NO_POLICY - }, - { - REST_LINKRESOLVEIGNORELINKINFO, - strExplorer, - strLnkResolveIgnoreLnkInfo, - SHELL_NO_POLICY - }, - { - REST_NOCOMMONGROUPS, - strExplorer, - strNoCommonGroups, - SHELL_NO_POLICY - }, - { - REST_SEPARATEDESKTOPPROCESS, - strExplorer, - strSeparateProcess, - SHELL_NO_POLICY - }, - { - REST_NOWEB, - strExplorer, - strNoWebMenu, - SHELL_NO_POLICY - }, - { - REST_NOTRAYCONTEXTMENU, - strExplorer, - strNoTrayContextMenu, - SHELL_NO_POLICY - }, - { - REST_NOVIEWCONTEXTMENU, - strExplorer, - strNoViewContextMenu, - SHELL_NO_POLICY - }, - { - REST_NONETCONNECTDISCONNECT, - strExplorer, - strNoNetConDis, - SHELL_NO_POLICY - }, - { - REST_STARTMENULOGOFF, - strExplorer, - strNoLogoff, - SHELL_NO_POLICY - }, - { - REST_NOSETTINGSASSIST, - strExplorer, - strNoSettingsWizard, - SHELL_NO_POLICY - }, - { - REST_NOINTERNETICON, - strExplorer, - strNoInetIcon, - SHELL_NO_POLICY - }, - { - REST_NORECENTDOCSHISTORY, - strExplorer, - strNoRecentDocHistory, - SHELL_NO_POLICY - }, - { - REST_NORECENTDOCSMENU, - strExplorer, - strNoRecentDocMenu, - SHELL_NO_POLICY - }, - { - REST_NOACTIVEDESKTOP, - strExplorer, - strNoActiveDesktop, - SHELL_NO_POLICY - }, - { - REST_NOACTIVEDESKTOPCHANGES, - strExplorer, - strNoActiveDesktopChanges, - SHELL_NO_POLICY - }, - { - REST_NOFAVORITESMENU, - strExplorer, - strNoFavoritesMenu, - SHELL_NO_POLICY - }, - { - REST_CLEARRECENTDOCSONEXIT, - strExplorer, - strClearRecentDocs, - SHELL_NO_POLICY - }, - { - REST_CLASSICSHELL, - strExplorer, - strClassicShell, - SHELL_NO_POLICY - }, - { - REST_NOCUSTOMIZEWEBVIEW, - strExplorer, - strNoCustomWebView, - SHELL_NO_POLICY - }, - { - REST_NOHTMLWALLPAPER, - strActiveDesk, - strNoHTMLWallpaper, - SHELL_NO_POLICY - }, - { - REST_NOCHANGINGWALLPAPER, - strActiveDesk, - strNoChangeWallpaper, - SHELL_NO_POLICY - }, - { - REST_NODESKCOMP, - strActiveDesk, - strNoComponent, - SHELL_NO_POLICY - }, - { - REST_NOADDDESKCOMP, - strActiveDesk, - strNoAddComponent, - SHELL_NO_POLICY - }, - { - REST_NODELDESKCOMP, - strActiveDesk, - strNoDelComponent, - SHELL_NO_POLICY - }, - { - REST_NOCLOSEDESKCOMP, - strActiveDesk, - strNoCloseComponent, - SHELL_NO_POLICY - }, - { - REST_NOCLOSE_DRAGDROPBAND, -#if (WINE_FILEVERSION_MAJOR < 5) - strActiveDesk, -#else - strExplorer, -#endif - strNoCloseDragDrop, - SHELL_NO_POLICY - }, - { - REST_NOMOVINGBAND, -#if (WINE_FILEVERSION_MAJOR < 5) - strActiveDesk, -#else - strExplorer, -#endif - strNoMovingBand, - SHELL_NO_POLICY - }, - { - REST_NOEDITDESKCOMP, - strActiveDesk, - strNoEditComponent, - SHELL_NO_POLICY - }, - { - REST_NORESOLVESEARCH, - strExplorer, - strNoResolveSearch, - SHELL_NO_POLICY - }, - { - REST_NORESOLVETRACK, - strExplorer, - strNoResolveTrk, - SHELL_NO_POLICY - }, - { - REST_FORCECOPYACLWITHFILE, - strExplorer, - strForceCopyACLW, - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NOLOGO3CHANNELNOTIFY, - strExplorer, - strNoMSAppLogo, - SHELL_NO_POLICY - }, -#endif - { - REST_NOFORGETSOFTWAREUPDATE, - strExplorer, - strNoForgetSoftwareUpdate, - SHELL_NO_POLICY - }, - { - REST_NOSETACTIVEDESKTOP, - strExplorer, - strNoSetActiveDesktop, - SHELL_NO_POLICY - }, - { - REST_NOUPDATEWINDOWS, - strExplorer, - strNoWindowsUpdate, - SHELL_NO_POLICY - }, - { - REST_NOCHANGESTARMENU, - strExplorer, - strNoChangeStartMenu, - SHELL_NO_POLICY - }, - { - REST_NOFOLDEROPTIONS, - strExplorer, - strNoFolderOptions, - SHELL_NO_POLICY - }, - { - REST_HASFINDCOMPUTERS, - strExplorer, - "FindComputers", - SHELL_NO_POLICY - }, - { - REST_INTELLIMENUS, - strExplorer, - "IntelliMenus", - SHELL_NO_POLICY - }, - { - REST_RUNDLGMEMCHECKBOX, - strExplorer, - "MemCheckBoxInRunDlg", - SHELL_NO_POLICY - }, - { - REST_ARP_ShowPostSetup, - strAddRemoveProgs, - "ShowPostSetup", - SHELL_NO_POLICY - }, - { - REST_NOCSC, - strExplorer, - "NoSyncAll", - SHELL_NO_POLICY - }, - { - REST_NOCONTROLPANEL, - strExplorer, - "NoControlPanel", - SHELL_NO_POLICY - }, - { - REST_ENUMWORKGROUP, - strExplorer, - "EnumWorkgroup", - SHELL_NO_POLICY - }, - { - REST_ARP_NOARP, - strAddRemoveProgs, - "NoAddRemovePrograms", - SHELL_NO_POLICY - }, - { - REST_ARP_NOREMOVEPAGE, - strAddRemoveProgs, - "NoRemovePage", - SHELL_NO_POLICY - }, - { - REST_ARP_NOADDPAGE, - strAddRemoveProgs, - "NoAddPage", - SHELL_NO_POLICY - }, - { - REST_ARP_NOWINSETUPPAGE, - strAddRemoveProgs, - "NoWindowsSetupPage", - SHELL_NO_POLICY - }, - { - REST_GREYMSIADS, - strExplorer, -#ifndef __REACTOS__ -// NOTE: Wine buggy - "", -#else - "GreyMSIAds", -#endif - SHELL_NO_POLICY - }, - { - REST_NOCHANGEMAPPEDDRIVELABEL, - strExplorer, - "NoChangeMappedDriveLabel", - SHELL_NO_POLICY - }, - { - REST_NOCHANGEMAPPEDDRIVECOMMENT, - strExplorer, - "NoChangeMappedDriveComment", - SHELL_NO_POLICY - }, - { - REST_MaxRecentDocs, - strExplorer, - "MaxRecentDocs", - SHELL_NO_POLICY - }, - { - REST_NONETWORKCONNECTIONS, - strExplorer, - "NoNetworkConnections", - SHELL_NO_POLICY - }, - { - REST_FORCESTARTMENULOGOFF, - strExplorer, - "ForceStartMenuLogoff", - SHELL_NO_POLICY - }, - { - REST_NOWEBVIEW, - strExplorer, - "NoWebView", - SHELL_NO_POLICY - }, - { - REST_NOCUSTOMIZETHISFOLDER, - strExplorer, - "NoCustomizeThisFolder", - SHELL_NO_POLICY - }, - { - REST_NOENCRYPTION, - strExplorer, - "NoEncryption", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR == 5) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_ALLOWFRENCHENCRYPTION, - strExplorer, - "AllowFrenchEncryption", - SHELL_NO_POLICY - }, -#endif - { - REST_DONTSHOWSUPERHIDDEN, - strExplorer, - "DontShowSuperHidden", - SHELL_NO_POLICY - }, - { - REST_NOSHELLSEARCHBUTTON, - strExplorer, - "NoShellSearchButton", - SHELL_NO_POLICY - }, - { - REST_NOHARDWARETAB, - strExplorer, - "NoHardwareTab", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NORUNASINSTALLPROMPT, - strExplorer, - "NoRunasInstallPrompt", - SHELL_NO_POLICY - }, - { - REST_PROMPTRUNASINSTALLNETPATH, - strExplorer, - "PromptRunasInstallNetPath", - SHELL_NO_POLICY - }, -#endif - { - REST_NOMANAGEMYCOMPUTERVERB, - strExplorer, - "NoManageMyComputerVerb", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NORECENTDOCSNETHOOD, - strExplorer, - "NoRecentDocsNetHood", - SHELL_NO_POLICY - }, -#endif - { - REST_DISALLOWRUN, - strExplorer, - "DisallowRun", - SHELL_NO_POLICY - }, - { - REST_NOWELCOMESCREEN, - strExplorer, - "NoWelcomeScreen", - SHELL_NO_POLICY - }, - { - REST_RESTRICTCPL, - strExplorer, - "RestrictCpl", - SHELL_NO_POLICY - }, - { - REST_DISALLOWCPL, - strExplorer, - "DisallowCpl", - SHELL_NO_POLICY - }, - { - REST_NOSMBALLOONTIP, - strExplorer, - "NoSMBalloonTip", - SHELL_NO_POLICY - }, - { - REST_NOSMHELP, - strExplorer, - "NoSMHelp", - SHELL_NO_POLICY - }, - { - REST_NOWINKEYS, - strExplorer, - "NoWinKeys", - SHELL_NO_POLICY - }, - { - REST_NOENCRYPTONMOVE, - strExplorer, - "NoEncryptOnMove", - SHELL_NO_POLICY - }, - { - REST_NOLOCALMACHINERUN, - strExplorer, - "DisableLocalMachineRun", - SHELL_NO_POLICY - }, - { - REST_NOCURRENTUSERRUN, - strExplorer, - "DisableCurrentUserRun", - SHELL_NO_POLICY - }, - { - REST_NOLOCALMACHINERUNONCE, - strExplorer, - "DisableLocalMachineRunOnce", - SHELL_NO_POLICY - }, - { - REST_NOCURRENTUSERRUNONCE, - strExplorer, - "DisableCurrentUserRunOnce", - SHELL_NO_POLICY - }, - { - REST_FORCEACTIVEDESKTOPON, - strExplorer, - "ForceActiveDesktopOn", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NOCOMPUTERSNEARME, - strExplorer, - "NoComputersNearMe", - SHELL_NO_POLICY - }, -#endif - { - REST_NOVIEWONDRIVE, - strExplorer, - "NoViewOnDrive", - SHELL_NO_POLICY - }, - { - REST_NONETCRAWL, - strExplorer, -#ifndef __REACTOS__ -// NOTE: Wine buggy - "NoNetCrawl", -#else - "NoNetCrawling", -#endif - SHELL_NO_POLICY - }, - { - REST_NOSHAREDDOCUMENTS, - strExplorer, -#ifndef __REACTOS__ -// NOTE: Wine buggy - "NoSharedDocs", -#else - "NoSharedDocuments", -#endif - SHELL_NO_POLICY - }, - { - REST_NOSMMYDOCS, - strExplorer, - "NoSMMyDocs", - SHELL_NO_POLICY - }, - -#ifdef __REACTOS__ - { - REST_NOSMMYPICS, - strExplorer, - "NoSMMyPictures", - SHELL_NO_POLICY - }, - { - REST_ALLOWBITBUCKDRIVES, - strExplorer, - "RecycleBinDrives", - SHELL_NO_POLICY - }, -#endif - -/* 0x4000050 - 0x4000060 */ -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_NONLEGACYSHELLMODE, - strExplorer, - "NoneLegacyShellMode", - SHELL_NO_POLICY - }, -#endif - -#ifdef __REACTOS__ - - { - REST_NOCONTROLPANELBARRICADE, - strExplorer, - "NoControlPanelBarricade", - SHELL_NO_POLICY - }, - -// NOTE: REST_NOSTARTPAGE never really existed. - -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_NOAUTOTRAYNOTIFY, - strExplorer, - "NoAutoTrayNotify", - SHELL_NO_POLICY - }, - { - REST_NOTASKGROUPING, - strExplorer, - "NoTaskGrouping", - SHELL_NO_POLICY - }, - { - REST_NOCDBURNING, - strExplorer, - "NoCDBurning", - SHELL_NO_POLICY - }, -#endif // WINE_FILEVERSION_MAJOR - { - REST_MYCOMPNOPROP, - strExplorer, - "NoPropertiesMyComputer", - SHELL_NO_POLICY - }, - { - REST_MYDOCSNOPROP, - strExplorer, - "NoPropertiesMyDocuments", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_NOSTARTPANEL, - strExplorer, - "NoSimpleStartMenu", - SHELL_NO_POLICY - }, - { - REST_NODISPLAYAPPEARANCEPAGE, - strSystem, - "NoDispAppearancePage", // REGSTR_VAL_DISPCPL_NOAPPEARANCEPAGE - SHELL_NO_POLICY - }, - { - REST_NOTHEMESTAB, - strExplorer, - "NoThemesTab", - SHELL_NO_POLICY - }, - { - REST_NOVISUALSTYLECHOICE, - strSystem, - "NoVisualStyleChoice", - SHELL_NO_POLICY - }, - { - REST_NOSIZECHOICE, - strSystem, - "NoSizeChoice", - SHELL_NO_POLICY - }, - { - REST_NOCOLORCHOICE, - strSystem, - "NoColorChoice", - SHELL_NO_POLICY - }, - { - REST_SETVISUALSTYLE, - strSystem, - "SetVisualStyle", - SHELL_NO_POLICY - }, -#endif // WINE_FILEVERSION_MAJOR - -#endif // __REACTOS__ - - { - REST_STARTRUNNOHOMEPATH, - strExplorer, - "StartRunNoHOMEPATH", - SHELL_NO_POLICY - }, - -#ifdef __REACTOS__ - -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_NOUSERNAMEINSTARTPANEL, - strExplorer, - "NoUserNameInStartMenu", - SHELL_NO_POLICY - }, - { - REST_NOMYCOMPUTERICON, - "NonEnum", - "{20D04FE0-3AEA-1069-A2D8-08002B30309D}", - SHELL_NO_POLICY - }, - { - REST_NOSMNETWORKPLACES, - strExplorer, - "NoStartMenuNetworkPlaces", - SHELL_NO_POLICY - }, - { - REST_NOSMPINNEDLIST, - strExplorer, - "NoStartMenuPinnedList", - SHELL_NO_POLICY - }, - { - REST_NOSMMYMUSIC, - strExplorer, - "NoStartMenuMyMusic", - SHELL_NO_POLICY - }, - { - REST_NOSMEJECTPC, - strExplorer, - "NoStartMenuEjectPC", - SHELL_NO_POLICY - }, - { - REST_NOSMMOREPROGRAMS, - strExplorer, - "NoStartMenuMorePrograms", - SHELL_NO_POLICY - }, - { - REST_NOSMMFUPROGRAMS, - strExplorer, - "NoStartMenuMFUprogramsList", - SHELL_NO_POLICY - }, - { - REST_NOTRAYITEMSDISPLAY, - strExplorer, - "NoTrayItemsDisplay", - SHELL_NO_POLICY - }, - { - REST_NOTOOLBARSONTASKBAR, - strExplorer, - "NoToolbarsOnTaskbar", - SHELL_NO_POLICY - }, -#endif // WINE_FILEVERSION_MAJOR - - { - REST_NOSMCONFIGUREPROGRAMS, - strExplorer, - "NoSMConfigurePrograms", - SHELL_NO_POLICY - }, - -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_HIDECLOCK, - strExplorer, - "HideClock", - SHELL_NO_POLICY - }, - { - REST_NOLOWDISKSPACECHECKS, - strExplorer, - "NoLowDiskSpaceChecks", - SHELL_NO_POLICY - }, -#endif - -#if (WINE_FILEVERSION_MAJOR <= 6) && (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NOENTIRENETWORK, - "Network", - "NoEntireNetwork", // REGSTR_VAL_NOENTIRENETWORK - SHELL_NO_POLICY - }, - { - REST_NODESKTOPCLEANUP, - strExplorer, - "NoDesktopCleanupWizard", - SHELL_NO_POLICY - }, -#endif - -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_BITBUCKNUKEONDELETE, - strExplorer, - "NoRecycleFiles", - SHELL_NO_POLICY - }, - { - REST_BITBUCKCONFIRMDELETE, - strExplorer, - "ConfirmFileDelete", - SHELL_NO_POLICY - }, - { - REST_BITBUCKNOPROP, - strExplorer, - "NoPropertiesRecycleBin", - SHELL_NO_POLICY - }, - { - REST_NODISPBACKGROUND, - strSystem, - "NoDispBackgroundPage", // REGSTR_VAL_DISPCPL_NOBACKGROUNDPAGE - SHELL_NO_POLICY - }, - { - REST_NODISPSCREENSAVEPG, - strSystem, - "NoDispScrSavPage", // REGSTR_VAL_DISPCPL_NOSCRSAVPAGE - SHELL_NO_POLICY - }, - { - REST_NODISPSETTINGSPG, - strSystem, - "NoDispSettingsPage", // REGSTR_VAL_DISPCPL_NOSETTINGSPAGE - SHELL_NO_POLICY - }, - { - REST_NODISPSCREENSAVEPREVIEW, - strSystem, - "NoScreenSavePreview", - SHELL_NO_POLICY - }, - { - REST_NODISPLAYCPL, - strSystem, - "NoDispCPL", // REGSTR_VAL_DISPCPL_NODISPCPL - SHELL_NO_POLICY - }, - { - REST_HIDERUNASVERB, - strExplorer, - "HideRunAsVerb", - SHELL_NO_POLICY - }, - { - REST_NOTHUMBNAILCACHE, - strExplorer, - "NoThumbnailCache", - SHELL_NO_POLICY - }, - { - REST_NOSTRCMPLOGICAL, - strExplorer, - "NoStrCmpLogical", - SHELL_NO_POLICY - }, - { - REST_NOPUBLISHWIZARD, - strExplorer, - "NoPublishingWizard", - SHELL_NO_POLICY - }, - { - REST_NOONLINEPRINTSWIZARD, - strExplorer, - "NoOnlinePrintsWizard", - SHELL_NO_POLICY - }, - { - REST_NOWEBSERVICES, - strExplorer, - "NoWebServices", - SHELL_NO_POLICY - }, -#endif // WINE_FILEVERSION_MAJOR - - { - REST_ALLOWUNHASHEDWEBVIEW, - strExplorer, - "AllowUnhashedWebView", - SHELL_NO_POLICY - }, -#if (WINE_FILEVERSION_MAJOR >= 6) - { - REST_ALLOWLEGACYWEBVIEW, - strExplorer, - "AllowLegacyWebView", - SHELL_NO_POLICY - }, -#endif - { - REST_REVERTWEBVIEWSECURITY, - strExplorer, - "RevertWebViewSecurity", - SHELL_NO_POLICY - }, - { - REST_INHERITCONSOLEHANDLES, - strExplorer, - "InheritConsoleHandles", - SHELL_NO_POLICY - }, - -#if (WINE_FILEVERSION_MAJOR >= 6) - -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_SORTMAXITEMCOUNT, - strExplorer, - "SortMaxItemCount", - SHELL_NO_POLICY - }, -#endif - { - REST_NOREMOTERECURSIVEEVENTS, - strExplorer, - "NoRemoteRecursiveEvents", - SHELL_NO_POLICY - }, - -#endif // WINE_FILEVERSION_MAJOR - - { - REST_NOREMOTECHANGENOTIFY, - strExplorer, - "NoRemoteChangeNotify", - SHELL_NO_POLICY - }, - -#if (WINE_FILEVERSION_MAJOR >= 6) - -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NOSIMPLENETIDLIST, - strExplorer, - "NoSimpleNetIDList", - SHELL_NO_POLICY - }, -#endif -// #if (NTDDI_VERSION < NTDDI_LONGHORN) -// NOTE: Geoff Chappell is inacurrate here. - { - REST_NOENUMENTIRENETWORK, - strExplorer, - "NoEnumEntireNetwork", - SHELL_NO_POLICY - }, -// #endif -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_NODETAILSTHUMBNAILONNETWORK, - strExplorer, - "NoDetailsThumbnailOnNetwork", - SHELL_NO_POLICY - }, -#endif - { - REST_NOINTERNETOPENWITH, - strExplorer, - "NoInternetOpenWith", - SHELL_NO_POLICY - }, -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_ALLOWLEGACYLMZBEHAVIOR, - strExplorer, - "AllowLegacyLMZBehavior", - SHELL_NO_POLICY - }, -#endif - { - REST_DONTRETRYBADNETNAME, - strExplorer, - "DontRetryBadNetName", - SHELL_NO_POLICY - }, - { - REST_ALLOWFILECLSIDJUNCTIONS, - strExplorer, - "AllowFileCLSIDJunctions", - SHELL_NO_POLICY - }, - { - REST_NOUPNPINSTALL, - strExplorer, - "NoUPnPInstallTask", - SHELL_NO_POLICY - }, - -// "NormalizeLinkNetPidls" only in version 6.0 from Windows XP SP3. - -#if (NTDDI_VERSION >= NTDDI_LONGHORN) - { - REST_ARP_DONTGROUPPATCHES, - strAddRemoveProgs, - "DontGroupPatches", - SHELL_NO_POLICY - }, - { - REST_ARP_NOCHOOSEPROGRAMSPAGE, - strAddRemoveProgs, - "NoChooseProgramsPage", - SHELL_NO_POLICY - }, -#endif - -// "AllowCLSIDPROGIDMapping" in Windows XP SP3 and Windows Server 2003 SP2 only. -// Maybe in Vista+ too? - -#endif // WINE_FILEVERSION_MAJOR - -#endif // __REACTOS__ - -/* 0x4000061 - 0x4000086 */ - { - REST_NODISCONNECT, - strExplorer, - "NoDisconnect", - SHELL_NO_POLICY - }, - { - REST_NOSECURITY, - strExplorer, - "NoNTSecurity", - SHELL_NO_POLICY - }, - { - REST_NOFILEASSOCIATE, - strExplorer, - "NoFileAssociate", - SHELL_NO_POLICY - }, - -#ifdef __REACTOS__ +#include "PolicyData.h" + { 0, NULL, NULL } +}; -#if (WINE_FILEVERSION_MAJOR >= 6) -// #if (NTDDI_VERSION < NTDDI_LONGHORN) -// NOTE: Either Geoff Chappell or MSDN is inacurrate here. - { - REST_ALLOWCOMMENTTOGGLE, - strExplorer, - "ToggleCommentPosition", - SHELL_NO_POLICY - }, -// #endif -#if (NTDDI_VERSION < NTDDI_LONGHORN) - { - REST_USEDESKTOPINICACHE, - strExplorer, - "UseDesktopIniCache", - SHELL_NO_POLICY - }, -#endif +#undef DEFINE_POLICY -// "NoNetFolderInfoTip" only in version 6.0 from Windows XP SP3. +/* + * The restriction-related variables + */ +HANDLE g_hRestGlobalCounter = NULL; +LONG g_nRestCountValue = -1; +DWORD g_RestValues[_countof(s_PolicyTable)] = { 0 }; -#endif // WINE_FILEVERSION_MAJOR +/**************************************************************************** + * SHELL_GetCachedGlobalCounter + * + * Retrieves the global counter using cache in a thread-safe manner. + * If a cache of global counter exists, the function returns it. + * If there is no cache, the function creates a global counter. + * + * @param[in,out] phGlobalCounter The pointer to the handle of global counter. + * @param[in] rguid The GUID of global counter. + * @return The handle of the global counter. + * @implemented + */ +static HANDLE +SHELL_GetCachedGlobalCounter(_Inout_ HANDLE *phGlobalCounter, _In_ REFGUID rguid) +{ + HANDLE hGlobalCounter; + if (*phGlobalCounter) + return *phGlobalCounter; + hGlobalCounter = SHGlobalCounterCreate(rguid); + if (InterlockedCompareExchangePointer(phGlobalCounter, hGlobalCounter, NULL)) + CloseHandle(hGlobalCounter); + return *phGlobalCounter; +} -#endif // __REACTOS__ +/**************************************************************************** + * SHELL_GetRestrictionsCounter + * + * Retrieves the global counter for GUID_Restrictions using caching in a + * thread-safe manner. The variable g_hRestGlobalCounter is used for caching. + * + * @return The handle of the global counter. + * @see SHELL_GetCachedGlobalCounter + * @implemented + */ +static HANDLE SHELL_GetRestrictionsCounter(VOID) +{ + return SHELL_GetCachedGlobalCounter(&g_hRestGlobalCounter, &GUID_Restrictions); +} -#ifndef __REACTOS__ -// NOTE: This is a SHDOCVW-only policy. - { - 0x50000024, - strExplorer, - strNoFileURL, - SHELL_NO_POLICY - }, -#endif +/**************************************************************************** + * SHELL_QueryRestrictionsChanged + * + * @return The value of the global counter for GUID_Restrictions. + * @see SHELL_GetRestrictionsCounter + * @implemented + */ +static BOOL SHELL_QueryRestrictionsChanged(VOID) +{ + LONG Value = SHGlobalCounterGetValue(SHELL_GetRestrictionsCounter()); + if (g_nRestCountValue == Value) + return FALSE; - { - 0, - 0, - 0, - SHELL_NO_POLICY - } -}; + g_nRestCountValue = Value; + return TRUE; +} /************************************************************************* * SHRestricted [SHELL32.100] @@ -1335,64 +143,15 @@ static POLICYDATA sh32_policy_table[] = * b: 98Lite 2.0 (which uses many of these policy keys) http://www.98lite.net/ * c: 'The Windows 95 Registry', by John Woram, 1996 MIS: Press */ -DWORD WINAPI SHRestricted (RESTRICTIONS policy) +DWORD WINAPI SHRestricted (RESTRICTIONS rest) { - char regstr[256]; - HKEY xhkey; - DWORD retval, datsize = 4; - LPPOLICYDATA p; - - TRACE("(%08x)\n", policy); - - /* scan to see if we know this policy ID */ - for (p = sh32_policy_table; p->policy; p++) - { - if (policy == p->policy) - { - break; - } - } + TRACE("(0x%08lX)\n", rest); - if (p->policy == 0) - { - /* we don't know this policy, return 0 */ - TRACE("unknown policy: (%08x)\n", policy); - return 0; - } + /* If restrictions from registry have changed, reset all cached values to SHELL_NO_POLICY */ + if (SHELL_QueryRestrictionsChanged()) + FillMemory(&g_RestValues, sizeof(g_RestValues), 0xFF); - /* we have a known policy */ - - /* first check if this policy has been cached, return it if so */ - if (p->cache != SHELL_NO_POLICY) - { - return p->cache; - } - - lstrcpyA(regstr, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\"); - lstrcatA(regstr, p->appstr); - - /* return 0 and don't set the cache if any registry errors occur */ -#ifndef __REACTOS__ - retval = 0; - if (RegOpenKeyA(HKEY_CURRENT_USER, regstr, &xhkey) == ERROR_SUCCESS) -#else // FIXME: Actually this *MUST* use shlwapi!SHRestrictionLookup() - // See http://www.geoffchappell.com/studies/windows/shell/shell32/api/util/shrestricted.htm - retval = RegOpenKeyExA(HKEY_LOCAL_MACHINE, regstr, 0, KEY_READ, &xhkey); - if (retval != ERROR_SUCCESS) - { - retval = RegOpenKeyExA(HKEY_CURRENT_USER, regstr, 0, KEY_READ, &xhkey); - if (retval != ERROR_SUCCESS) - return 0; - } -#endif - { - if (RegQueryValueExA(xhkey, p->keystr, NULL, NULL, (LPBYTE)&retval, &datsize) == ERROR_SUCCESS) - { - p->cache = retval; - } - RegCloseKey(xhkey); - } - return retval; + return SHRestrictionLookup(rest, NULL, s_PolicyTable, g_RestValues); } /************************************************************************* @@ -1402,7 +161,7 @@ DWORD WINAPI SHRestricted (RESTRICTIONS policy) * * PARAMS * unused [I] Reserved. - * inpRegKey [I] Registry key to scan. + * pszKey [I] Registry key to scan. * * RETURNS * Success: -1. The policy cache is initialised. @@ -1412,30 +171,16 @@ DWORD WINAPI SHRestricted (RESTRICTIONS policy) * NOTES * Exported by ordinal. Introduced in Win98. */ -BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCVOID inpRegKey) +BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCWSTR pszKey) { - TRACE("(%p, %p)\n", unused, inpRegKey); + TRACE("(%p, %s)\n", unused, debugstr_w(pszKey)); - /* first check - if input is non-NULL and points to the secret - key string, then pass. Otherwise return 0. - */ - if (inpRegKey != NULL) - { - if (SHELL_OsIsUnicode()) - { - if (lstrcmpiW(inpRegKey, L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies") && - lstrcmpiW(inpRegKey, L"Policy")) - /* doesn't match, fail */ - return FALSE; - } - else - { - if (lstrcmpiA(inpRegKey, "Software\\Microsoft\\Windows\\CurrentVersion\\Policies") && - lstrcmpiA(inpRegKey, "Policy")) - /* doesn't match, fail */ - return FALSE; - } - } + if (pszKey && + lstrcmpiW(L"Policy", pszKey) != 0 && + lstrcmpiW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies", pszKey) != 0) + { + return FALSE; + } - return TRUE; + return SHGlobalCounterIncrement(SHELL_GetRestrictionsCounter()); } diff --git a/dll/win32/shlwapi/ordinal.c b/dll/win32/shlwapi/ordinal.c index 37181442f48..bd25ca1144b 100644 --- a/dll/win32/shlwapi/ordinal.c +++ b/dll/win32/shlwapi/ordinal.c @@ -2665,6 +2665,7 @@ HWND WINAPI SHCreateWorkerWindowA(WNDPROC wndProc, HWND hWndParent, DWORD dwExSt return hWnd; } +#ifndef __REACTOS__ /* The followings are defined in */ typedef struct tagPOLICYDATA { DWORD policy; /* flags value passed to SHRestricted */ @@ -2679,6 +2680,7 @@ static const WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\', 's','o','f','t','\\','W','i','n','d','o','w','s','\\', 'C','u','r','r','e','n','t','V','e','r','s','i','o','n', '\\','P','o','l','i','c','i','e','s',0}; +#endif /* ndef __REACTOS__ */ /************************************************************************* * @ [SHLWAPI.271] @@ -2695,6 +2697,25 @@ static const WCHAR strRegistryPolicyW[] = {'S','o','f','t','w','a','r','e','\\', */ DWORD WINAPI SHGetRestriction(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpValue) { +#ifdef __REACTOS__ + WCHAR szPath[MAX_PATH]; + DWORD dwSize, dwValue = 0; + + TRACE("(%s, %s, %s)\n", debugstr_w(lpSubKey), debugstr_w(lpSubName), debugstr_w(lpValue)); + + if (!lpSubKey) + lpSubKey = L"Software\\Microsoft\\Windows\\CurrentVersion\\Policies"; + + PathCombineW(szPath, lpSubKey, lpSubName); + + dwSize = sizeof(dwValue); + if (SHGetValueW(HKEY_LOCAL_MACHINE, szPath, lpValue, NULL, &dwValue, &dwSize) == ERROR_SUCCESS) + return dwValue; + + dwSize = sizeof(dwValue); + SHGetValueW(HKEY_CURRENT_USER, szPath, lpValue, NULL, &dwValue, &dwSize); + return dwValue; +#else DWORD retval, datsize = sizeof(retval); HKEY hKey; @@ -2710,6 +2731,7 @@ DWORD WINAPI SHGetRestriction(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpVal SHGetValueW(hKey, lpSubName, lpValue, NULL, &retval, &datsize); RegCloseKey(hKey); return retval; +#endif } /************************************************************************* @@ -2732,18 +2754,33 @@ DWORD WINAPI SHGetRestriction(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpVal * different POLICYDATA structure and implements a similar algorithm adapted to * that structure. */ +#ifdef __REACTOS__ +DWORD WINAPI +SHRestrictionLookup( + _In_ DWORD policy, + _In_ LPCWSTR initial, + _In_ const POLICYDATA *polTable, + _Inout_ LPDWORD polArr) +#else DWORD WINAPI SHRestrictionLookup( DWORD policy, LPCWSTR initial, LPPOLICYDATA polTable, LPDWORD polArr) +#endif { TRACE("(0x%08x %s %p %p)\n", policy, debugstr_w(initial), polTable, polArr); +#ifndef __REACTOS__ if (!polTable || !polArr) return 0; +#endif +#ifndef __REACTOS__ + for (;polTable->appstr; polTable++, polArr++) +#else for (;polTable->policy; polTable++, polArr++) +#endif { if (policy == polTable->policy) { diff --git a/modules/rosapps/applications/sysutils/kill/kill.c b/modules/rosapps/applications/sysutils/kill/kill.c index bce146ad721..170cfd8c8a3 100644 --- a/modules/rosapps/applications/sysutils/kill/kill.c +++ b/modules/rosapps/applications/sysutils/kill/kill.c @@ -28,51 +28,47 @@ * from the old shell.exe */ -#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ +#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ #include + #include #include int -ExecuteKill(char * lpPid) +ExecuteKill(const char *lpPid) { - HANDLE hProcess; - DWORD dwProcessId; + HANDLE hProcess; + DWORD dwProcessId; + + dwProcessId = strtoul(lpPid, NULL, 10); + fprintf(stderr, "Killing the process with PID %lu...\n", dwProcessId); + + hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessId); + if (hProcess == NULL) + { + fprintf(stderr, "Could not open the process with PID %lu\n", dwProcessId); + return 1; + } - dwProcessId = (DWORD) atol(lpPid); - fprintf( stderr, "Killing PID %ld...\n",dwProcessId); - hProcess = OpenProcess( - PROCESS_TERMINATE, - FALSE, - dwProcessId - ); - if (NULL == hProcess) - { - fprintf( stderr, "Could not open the process with PID = %ld\n", dwProcessId); - return 0; - } - if (FALSE == TerminateProcess( - hProcess, - 0 - ) - ) { - fprintf( stderr, "Could not terminate the process with PID = %ld\n", dwProcessId); - return 0; - } - CloseHandle(hProcess); - return 0; + if (!TerminateProcess(hProcess, 0)) + { + fprintf(stderr, "Could not terminate the process with PID %lu\n", dwProcessId); + CloseHandle(hProcess); + return 1; + } + + CloseHandle(hProcess); + return 0; } -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - char tail; - DBG_UNREFERENCED_LOCAL_VARIABLE(tail); + if (argc != 2) + { + fprintf(stderr, "Usage: %s PID (Process ID)\n", argv[0]); + return 1; + } - if (argc < 2) - { - fprintf( stderr, "Usage: %s PID (Process ID) \n", argv[0] ); - return 1; - } - tail = ExecuteKill(argv[1]); - return 0; + return ExecuteKill(argv[1]); } diff --git a/modules/rostests/apitests/imm32/CMakeLists.txt b/modules/rostests/apitests/imm32/CMakeLists.txt index 0b428e03bbe..6af5bb17cda 100644 --- a/modules/rostests/apitests/imm32/CMakeLists.txt +++ b/modules/rostests/apitests/imm32/CMakeLists.txt @@ -10,11 +10,12 @@ list(APPEND SOURCE ImmIsUIMessage.c JapanImeConvTestA.c JapanImeConvTestW.c + KLID.c testlist.c resource.rc) add_executable(imm32_apitest ${SOURCE}) target_link_libraries(imm32_apitest wine ${PSEH_LIB}) set_module_type(imm32_apitest win32cui) -add_importlibs(imm32_apitest imm32 msvcrt user32 kernel32 ntdll) +add_importlibs(imm32_apitest advapi32 imm32 msvcrt user32 kernel32 ntdll) add_rostests_file(TARGET imm32_apitest) diff --git a/modules/rostests/apitests/imm32/KLID.c b/modules/rostests/apitests/imm32/KLID.c new file mode 100644 index 00000000000..bb95cfb1600 --- /dev/null +++ b/modules/rostests/apitests/imm32/KLID.c @@ -0,0 +1,199 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) + * PURPOSE: Test for Keyboard Layout ID (KLID), HKL, and registry + * COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) + */ + +#include "precomp.h" + +#include +#include +#include + +typedef enum tagHKL_TYPE +{ + HKL_TYPE_PURE = 0, + HKL_TYPE_SPECIAL = 1, + HKL_TYPE_IME = 2, + HKL_TYPE_CHIMERA = 3, +} HKL_TYPE; + +static HKL_TYPE GetHKLType(HKL hKL) +{ + /* 0xEXXXYYYY: An IME HKL. EXXX is an IME keyboard. YYYY is a language */ + if (IS_IME_HKL(hKL)) + return HKL_TYPE_IME; + + /* 0xFXXXYYYY: A special HKL. XXX is a special ID. YYYY is a language */ + if (IS_SPECIAL_HKL(hKL)) + return HKL_TYPE_SPECIAL; + + /* 0xXXXXXXXX: The keyboard layout and language is the same value */ + if (LOWORD(hKL) == HIWORD(hKL)) + return HKL_TYPE_PURE; + + /* 0xXXXXYYYY: XXXX is a keyboard. YYYY is a language */ + return HKL_TYPE_CHIMERA; +} + +static HKEY OpenKeyboardLayouts(void) +{ + HKEY hKey = NULL; + RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts", + 0, KEY_READ, &hKey); + return hKey; +} + +static DWORD KLIDFromSpecialHKL(HKL hKL) +{ + WCHAR szName[16], szLayoutId[16]; + HKEY hkeyLayouts, hkeyKLID; + LSTATUS error; + DWORD dwSpecialId, dwLayoutId, cbValue, dwKLID = 0; + + hkeyLayouts = OpenKeyboardLayouts(); + ok(hkeyLayouts != NULL, "hkeyLayouts was NULL\n"); + + dwSpecialId = SPECIALIDFROMHKL(hKL); + + /* Search from "Keyboard Layouts" registry key */ + for (DWORD dwIndex = 0; dwIndex < 1000; ++dwIndex) + { + error = RegEnumKeyW(hkeyLayouts, dwIndex, szName, _countof(szName)); + szName[_countof(szName) - 1] = UNICODE_NULL; /* Avoid buffer overrun */ + if (error != ERROR_SUCCESS) + break; + + error = RegOpenKeyExW(hkeyLayouts, szName, 0, KEY_READ, &hkeyKLID); + if (error != ERROR_SUCCESS) + break; + + cbValue = sizeof(szLayoutId); + error = RegQueryValueExW(hkeyKLID, L"Layout Id", NULL, NULL, (LPBYTE)szLayoutId, &cbValue); + szLayoutId[_countof(szLayoutId) - 1] = UNICODE_NULL; /* Avoid buffer overrun */ + if (error != ERROR_SUCCESS) + { + RegCloseKey(hkeyKLID); + continue; + } + + dwLayoutId = wcstoul(szLayoutId, NULL, 16); + RegCloseKey(hkeyKLID); + if (dwLayoutId == dwSpecialId) /* Found */ + { + dwKLID = wcstoul(szName, NULL, 16); + break; + } + } + + RegCloseKey(hkeyLayouts); + return dwKLID; +} + +static DWORD KLIDFromHKL(HKL hKL) +{ + HKL_TYPE type = GetHKLType(hKL); + + trace("type: %d\n", type); + switch (type) + { + case HKL_TYPE_PURE: + case HKL_TYPE_CHIMERA: + return HIWORD(hKL); + + case HKL_TYPE_SPECIAL: + return KLIDFromSpecialHKL(hKL); + + case HKL_TYPE_IME: + return HandleToUlong(hKL); + } + + return 0; +} + +static void Test_KLID(DWORD dwKLID, HKL hKL) +{ + WCHAR szKLID[16], szValue[MAX_PATH]; + LSTATUS error; + DWORD dwValue, cbValue; + HKEY hkeyKLID, hkeyLayouts; + HKL_TYPE type; + + hkeyLayouts = OpenKeyboardLayouts(); + ok(hkeyLayouts != NULL, "hkeyLayouts was NULL\n"); + + StringCchPrintfW(szKLID, _countof(szKLID), L"%08lX", dwKLID); + RegOpenKeyExW(hkeyLayouts, szKLID, 0, KEY_READ, &hkeyKLID); + ok(hkeyKLID != NULL, "hkeyKLID was NULL\n"); + + error = RegQueryValueExW(hkeyKLID, L"Layout File", NULL, NULL, NULL, NULL); + ok_long(error, ERROR_SUCCESS); + + type = GetHKLType(hKL); + + if (type == HKL_TYPE_IME) + { + ok_long(dwKLID, HandleToUlong(hKL)); + error = RegQueryValueExW(hkeyKLID, L"IME File", NULL, NULL, NULL, NULL); + ok_long(error, ERROR_SUCCESS); + } + + if (type == HKL_TYPE_SPECIAL) + { + cbValue = sizeof(szValue); + error = RegQueryValueExW(hkeyKLID, L"Layout Id", NULL, NULL, (LPBYTE)&szValue, &cbValue); + ok_long(error, ERROR_SUCCESS); + + dwValue = wcstoul(szValue, NULL, 16); + ok_long(dwValue, SPECIALIDFROMHKL(hKL)); + } + + RegCloseKey(hkeyKLID); + RegCloseKey(hkeyLayouts); +} + +static void Test_HKL(HKL hKL) +{ + DWORD dwKLID; + + ok(hKL != NULL, "hKL was NULL\n"); + + dwKLID = KLIDFromHKL(hKL); + trace("dwKLID 0x%08lX, hKL %p\n", dwKLID, hKL); + + Test_KLID(dwKLID, hKL); +} + +START_TEST(KLID) +{ + HKL *phKLs; + INT iKL, cKLs; + + cKLs = GetKeyboardLayoutList(0, NULL); + trace("cKLs: %d\n", cKLs); + if (!cKLs) + { + skip("cKLs was zero\n"); + return; + } + + phKLs = calloc(cKLs, sizeof(HKL)); + if (!phKLs) + { + skip("!phKLs\n"); + return; + } + + ok_int(GetKeyboardLayoutList(cKLs, phKLs), cKLs); + + for (iKL = 0; iKL < cKLs; ++iKL) + { + trace("---\n"); + trace("phKLs[%d]: %p\n", iKL, phKLs[iKL]); + Test_HKL(phKLs[iKL]); + } + + free(phKLs); +} diff --git a/modules/rostests/apitests/imm32/testlist.c b/modules/rostests/apitests/imm32/testlist.c index 51005448c3d..a39c480f085 100644 --- a/modules/rostests/apitests/imm32/testlist.c +++ b/modules/rostests/apitests/imm32/testlist.c @@ -8,6 +8,7 @@ extern void func_imcc(void); extern void func_ImmEnumInputContext(void); extern void func_ImmGetImeInfoEx(void); extern void func_ImmIsUIMessage(void); +extern void func_KLID(void); extern void func_JapanImeConvTestA(void); extern void func_JapanImeConvTestW(void); @@ -19,6 +20,7 @@ const struct test winetest_testlist[] = { "ImmEnumInputContext", func_ImmEnumInputContext }, { "ImmGetImeInfoEx", func_ImmGetImeInfoEx }, { "ImmIsUIMessage", func_ImmIsUIMessage }, + { "KLID", func_KLID }, { "JapanImeConvTestA", func_JapanImeConvTestA }, { "JapanImeConvTestW", func_JapanImeConvTestW }, { 0, 0 } diff --git a/modules/rostests/apitests/shell32/CMakeLists.txt b/modules/rostests/apitests/shell32/CMakeLists.txt index da5c512640e..642f398f9ec 100644 --- a/modules/rostests/apitests/shell32/CMakeLists.txt +++ b/modules/rostests/apitests/shell32/CMakeLists.txt @@ -56,6 +56,7 @@ set_target_properties(shell32_apitest target_link_libraries(shell32_apitest wine uuid ${PSEH_LIB} cpprt atl_classes) set_module_type(shell32_apitest win32cui) +target_compile_definitions(shell32_apitest PRIVATE UNICODE _UNICODE) add_importlibs(shell32_apitest user32 gdi32 shell32 shlwapi ole32 oleaut32 advapi32 shlwapi msvcrt kernel32 ntdll) add_pch(shell32_apitest shelltest.h "${PCH_SKIP_SOURCE}") add_rostests_file(TARGET shell32_apitest) diff --git a/modules/rostests/apitests/shell32/FindExecutable.cpp b/modules/rostests/apitests/shell32/FindExecutable.cpp index 132c9589e65..fa91932d041 100644 --- a/modules/rostests/apitests/shell32/FindExecutable.cpp +++ b/modules/rostests/apitests/shell32/FindExecutable.cpp @@ -8,30 +8,6 @@ #include "shelltest.h" #include #include -#include "shell32_apitest_sub.h" - -static char s_sub_program[MAX_PATH]; - -static BOOL -GetSubProgramPath(void) -{ - GetModuleFileNameA(NULL, s_sub_program, _countof(s_sub_program)); - PathRemoveFileSpecA(s_sub_program); - PathAppendA(s_sub_program, "shell32_apitest_sub.exe"); - - if (!PathFileExistsA(s_sub_program)) - { - PathRemoveFileSpecA(s_sub_program); - PathAppendA(s_sub_program, "testdata\\shell32_apitest_sub.exe"); - - if (!PathFileExistsA(s_sub_program)) - { - return FALSE; - } - } - - return TRUE; -} typedef struct TEST_ENTRY { @@ -170,11 +146,6 @@ static const TEST_ENTRY s_entries[] = { __LINE__, TRUE, "\"test program.bat\"", DIR_2, s_sys_bat_file }, { __LINE__, TRUE, "\"test program.bat\"", DIR_3, s_win_bat_file }, { __LINE__, TRUE, "\"test program.bat\"", DIR_4, s_sys_bat_file }, - { __LINE__, TRUE, "shell32_apitest_sub.exe", DIR_0, s_sub_program }, - { __LINE__, TRUE, "shell32_apitest_sub.exe", DIR_1, "shell32_apitest_sub.exe" }, - { __LINE__, FALSE, "shell32_apitest_sub.exe", DIR_2, "" }, - { __LINE__, FALSE, "shell32_apitest_sub.exe", DIR_3, "" }, - { __LINE__, FALSE, "shell32_apitest_sub.exe", DIR_4, "" }, { __LINE__, TRUE, "test file.txt", DIR_0, s_sys_notepad }, { __LINE__, TRUE, "test file.txt", DIR_1, s_sys_notepad }, { __LINE__, TRUE, "test file.txt", DIR_2, s_sys_notepad }, @@ -203,12 +174,6 @@ static void DoTestEntry(const TEST_ENTRY *pEntry) START_TEST(FindExecutable) { - if (!GetSubProgramPath()) - { - skip("shell32_apitest_sub.exe not found\n"); - return; - } - char cur_dir[MAX_PATH]; GetCurrentDirectoryA(_countof(cur_dir), cur_dir); if (PathIsRootA(cur_dir)) @@ -227,7 +192,7 @@ START_TEST(FindExecutable) GetWindowsDirectoryA(s_win_test_exe, _countof(s_win_test_exe)); PathAppendA(s_win_test_exe, "test program.exe"); - BOOL ret = CopyFileA(s_sub_program, s_win_test_exe, FALSE); + BOOL ret = CopyFileA(s_win_notepad, s_win_test_exe, FALSE); if (!ret) { skip("Please retry with admin rights\n"); @@ -236,7 +201,12 @@ START_TEST(FindExecutable) GetSystemDirectoryA(s_sys_test_exe, _countof(s_sys_test_exe)); PathAppendA(s_sys_test_exe, "test program.exe"); - ok_int(CopyFileA(s_sub_program, s_sys_test_exe, FALSE), TRUE); + ret = CopyFileA(s_win_notepad, s_sys_test_exe, FALSE); + if (!ret) + { + skip("Please retry with admin rights\n"); + return; + } GetWindowsDirectoryA(s_win_bat_file, _countof(s_win_bat_file)); PathAppendA(s_win_bat_file, "test program.bat"); @@ -269,6 +239,4 @@ START_TEST(FindExecutable) DeleteFileA(s_sys_bat_file); DeleteFileA(s_win_txt_file); DeleteFileA(s_sys_txt_file); - - DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE); } diff --git a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp index 29f03be94b8..30b9080b7b3 100644 --- a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp +++ b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp @@ -7,436 +7,382 @@ */ #include "shelltest.h" -#include +#include +#include +#include #include -#include "shell32_apitest_sub.h" - -#define ok_ShellExecuteEx (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : TestShellExecuteEx +#include +#include + +static WCHAR s_win_dir[MAX_PATH]; +static WCHAR s_sys_dir[MAX_PATH]; +static WCHAR s_win_notepad[MAX_PATH]; +static WCHAR s_sys_notepad[MAX_PATH]; +static WCHAR s_win_test_exe[MAX_PATH]; +static WCHAR s_sys_test_exe[MAX_PATH]; +static WCHAR s_win_bat_file[MAX_PATH]; +static WCHAR s_sys_bat_file[MAX_PATH]; +static WCHAR s_win_txt_file[MAX_PATH]; +static WCHAR s_sys_txt_file[MAX_PATH]; +static WCHAR s_win_notepad_cmdline[MAX_PATH]; +static WCHAR s_sys_notepad_cmdline[MAX_PATH]; +static WCHAR s_win_test_exe_cmdline[MAX_PATH]; +static WCHAR s_sys_test_exe_cmdline[MAX_PATH]; +static BOOL s_bWow64; + +#define REG_APPPATHS L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" + +typedef enum TEST_RESULT +{ + TEST_FAILED, + TEST_SUCCESS_NO_PROCESS, + TEST_SUCCESS_WITH_PROCESS, +} TEST_RESULT; -static -BOOL -CreateAppPathRegKey(const WCHAR* Name) +typedef struct TEST_ENTRY { - HKEY RegistryKey; - LONG Result; - WCHAR Buffer[1024]; - WCHAR KeyValue[1024]; - DWORD Length = sizeof(KeyValue); - DWORD Disposition; - - wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"); - wcscat(Buffer, L"IEXPLORE.EXE"); - Result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, Buffer, 0, KEY_READ, &RegistryKey); - if (Result != ERROR_SUCCESS) trace("Could not open iexplore.exe key. Status: %lu\n", Result); - if (Result) goto end; - Result = RegQueryValueExW(RegistryKey, NULL, NULL, NULL, (LPBYTE)KeyValue, &Length); - if (Result != ERROR_SUCCESS) trace("Could not read iexplore.exe key. Status: %lu\n", Result); - if (Result) goto end; - RegCloseKey(RegistryKey); - - wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"); - wcscat(Buffer, Name); - Result = RegCreateKeyExW(HKEY_LOCAL_MACHINE, Buffer, 0, NULL, - 0, KEY_WRITE, NULL, &RegistryKey, &Disposition); - if (Result != ERROR_SUCCESS) trace("Could not create test key. Status: %lu\n", Result); - if (Result) goto end; - Result = RegSetValueW(RegistryKey, NULL, REG_SZ, KeyValue, 0); - if (Result != ERROR_SUCCESS) trace("Could not set value of the test key. Status: %lu\n", Result); - if (Result) goto end; - RegCloseKey(RegistryKey); -end: - if (RegistryKey) RegCloseKey(RegistryKey); - return Result == ERROR_SUCCESS; -} + INT line; + TEST_RESULT result; + LPCWSTR lpFile; + LPCWSTR cmdline; +} TEST_ENTRY, *PTEST_ENTRY; + +static void +TEST_DoTestEntry(INT line, TEST_RESULT result, LPCWSTR lpFile, LPCWSTR cmdline = NULL); -static -VOID -DeleteAppPathRegKey(const WCHAR* Name) +static void TEST_DoTestEntries(void) { - LONG Result; - WCHAR Buffer[1024]; - wcscpy(Buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"); - wcscat(Buffer, Name); - Result = RegDeleteKeyW(HKEY_LOCAL_MACHINE, Buffer); - if (Result != ERROR_SUCCESS) trace("Could not remove the test key. Status: %lu\n", Result); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, NULL); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L""); + TEST_DoTestEntry(__LINE__, TEST_FAILED, L"This is an invalid path."); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, s_sys_bat_file, NULL); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, s_sys_test_exe, s_sys_test_exe_cmdline); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, s_sys_txt_file, NULL); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, s_win_bat_file, NULL); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, s_win_notepad, s_win_notepad_cmdline); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, s_win_test_exe, s_win_test_exe_cmdline); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, s_win_txt_file, NULL); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, L"notepad", s_sys_notepad_cmdline); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, L"notepad.exe", s_sys_notepad_cmdline); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, L"\"notepad.exe\"", s_sys_notepad_cmdline); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, L"\"notepad\"", s_sys_notepad_cmdline); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, L"test program.exe", s_sys_test_exe_cmdline); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, L"\"test program.exe\"", s_sys_test_exe_cmdline); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, s_win_dir); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, s_sys_dir); + TEST_DoTestEntry(__LINE__, TEST_FAILED, L"shell:ThisIsAnInvalidName"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"); // My Computer + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"); // My Computer (with shell:) + + if (!IsWindowsVistaOrGreater()) + { + WCHAR szCurDir[MAX_PATH]; + GetCurrentDirectoryW(_countof(szCurDir), szCurDir); + SetCurrentDirectoryW(s_sys_dir); + TEST_DoTestEntry(__LINE__, TEST_FAILED, L"::{21EC2020-3AEA-1069-A2DD-08002B30309D}"); // Control Panel (without path) + SetCurrentDirectoryW(szCurDir); + } + + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"); // Control Panel (with path) + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\::{21EC2020-3AEA-1069-A2DD-08002B30309D}"); // Control Panel (with path and shell:) + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:AppData"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Common Desktop"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Common Programs"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Common Start Menu"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Common StartUp"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:ControlPanelFolder"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Desktop"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Favorites"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Fonts"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Local AppData"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:My Pictures"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Personal"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Programs"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Recent"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:RecycleBinFolder"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:SendTo"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:Start Menu"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_NO_PROCESS, L"shell:StartUp"); } -static -VOID -TestShellExecuteEx(const WCHAR* Name, BOOL ExpectedResult) +static LPWSTR +getCommandLineFromProcess(HANDLE hProcess) { - SHELLEXECUTEINFOW ShellExecInfo; - BOOL Result; + PEB peb; + PROCESS_BASIC_INFORMATION info; + RTL_USER_PROCESS_PARAMETERS Params; - ZeroMemory(&ShellExecInfo, sizeof(ShellExecInfo)); - ShellExecInfo.cbSize = sizeof(ShellExecInfo); - ShellExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI; - ShellExecInfo.hwnd = NULL; - ShellExecInfo.nShow = SW_SHOWNORMAL; - ShellExecInfo.lpFile = Name; - ShellExecInfo.lpDirectory = NULL; + NtQueryInformationProcess(hProcess, ProcessBasicInformation, &info, sizeof(info), NULL); + ReadProcessMemory(hProcess, info.PebBaseAddress, &peb, sizeof(peb), NULL); + ReadProcessMemory(hProcess, peb.ProcessParameters, &Params, sizeof(Params), NULL); - Result = ShellExecuteExW(&ShellExecInfo); - ok(Result == ExpectedResult, "ShellExecuteEx lpFile %s failed. Error: %lu\n", wine_dbgstr_w(Name), GetLastError()); - if (ShellExecInfo.hProcess) - { - Result = TerminateProcess(ShellExecInfo.hProcess, 0); - if (!Result) trace("Terminate process failed. Error: %lu\n", GetLastError()); - WaitForSingleObject(ShellExecInfo.hProcess, INFINITE); - CloseHandle(ShellExecInfo.hProcess); - } + LPWSTR cmdline = Params.CommandLine.Buffer; + SIZE_T cchCmdLine = Params.CommandLine.Length; + LPWSTR pszBuffer = (LPWSTR)calloc(cchCmdLine + 1, sizeof(WCHAR)); + ReadProcessMemory(hProcess, cmdline, pszBuffer, cchCmdLine, NULL); + pszBuffer[cchCmdLine] = UNICODE_NULL; + + return pszBuffer; // needs free() } -static void DoAppPathTest(void) +static void TEST_DoTestEntryStruct(const TEST_ENTRY *pEntry) { - ok_ShellExecuteEx(L"iexplore", TRUE); - ok_ShellExecuteEx(L"iexplore.exe", TRUE); + SHELLEXECUTEINFOW info = { sizeof(info) }; + info.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_WAITFORINPUTIDLE | SEE_MASK_FLAG_NO_UI; + info.hwnd = NULL; + info.lpVerb = NULL; + info.lpFile = pEntry->lpFile; + info.nShow = SW_SHOWNORMAL; - if (CreateAppPathRegKey(L"iexplore.bat")) - { - ok_ShellExecuteEx(L"iexplore.bat", TRUE); - ok_ShellExecuteEx(L"iexplore.bat.exe", FALSE); - DeleteAppPathRegKey(L"iexplore.bat"); - } + BOOL ret = ShellExecuteExW(&info); + + TEST_RESULT result; + if (ret && info.hProcess) + result = TEST_SUCCESS_WITH_PROCESS; + else if (ret && !info.hProcess) + result = TEST_SUCCESS_NO_PROCESS; + else + result = TEST_FAILED; - if (CreateAppPathRegKey(L"iexplore.bat.exe")) + ok(pEntry->result == result, + "Line %d: result: %d vs %d\n", pEntry->line, pEntry->result, result); + + if (pEntry->result == TEST_SUCCESS_WITH_PROCESS && pEntry->cmdline && !s_bWow64) { - ok_ShellExecuteEx(L"iexplore.bat", FALSE); - ok_ShellExecuteEx(L"iexplore.bat.exe", TRUE); - DeleteAppPathRegKey(L"iexplore.bat.exe"); + LPWSTR cmdline = getCommandLineFromProcess(info.hProcess); + if (!cmdline) + { + skip("!cmdline\n"); + } + else + { + ok(lstrcmpiW(pEntry->cmdline, cmdline) == 0, + "Line %d: cmdline: '%ls' vs '%ls'\n", pEntry->line, + pEntry->cmdline, cmdline); + } + + TerminateProcess(info.hProcess, 0xDEADFACE); + free(cmdline); } + + CloseHandle(info.hProcess); } -typedef struct TEST_ENTRY -{ - INT lineno; - BOOL ret; - BOOL bProcessHandle; - LPCSTR file; - LPCSTR params; - LPCSTR curdir; -} TEST_ENTRY; - -static char s_sub_program[MAX_PATH]; -static char s_win_test_exe[MAX_PATH]; -static char s_sys_test_exe[MAX_PATH]; -static char s_win_bat_file[MAX_PATH]; -static char s_sys_bat_file[MAX_PATH]; -static char s_win_txt_file[MAX_PATH]; -static char s_sys_txt_file[MAX_PATH]; - -#define DONT_CARE 0x0BADF00D - -static const TEST_ENTRY s_entries_1[] = +static void +TEST_DoTestEntry(INT line, TEST_RESULT result, LPCWSTR lpFile, LPCWSTR cmdline) { - { __LINE__, TRUE, TRUE, "test program" }, - { __LINE__, TRUE, TRUE, "test program.bat" }, - { __LINE__, TRUE, TRUE, "test program.exe" }, - { __LINE__, FALSE, FALSE, " test program" }, - { __LINE__, FALSE, FALSE, " test program.bat" }, - { __LINE__, FALSE, FALSE, " test program.exe" }, - { __LINE__, FALSE, FALSE, "test program " }, - { __LINE__, TRUE, TRUE, "test program.bat " }, - { __LINE__, TRUE, TRUE, "test program.exe " }, - { __LINE__, TRUE, TRUE, "test program", "TEST" }, - { __LINE__, TRUE, TRUE, "test program.bat", "TEST" }, - { __LINE__, TRUE, TRUE, "test program.exe", "TEST" }, - { __LINE__, FALSE, FALSE, ".\\test program.bat" }, - { __LINE__, FALSE, FALSE, ".\\test program.exe" }, - { __LINE__, TRUE, TRUE, "\"test program\"" }, - { __LINE__, TRUE, TRUE, "\"test program.bat\"" }, - { __LINE__, TRUE, TRUE, "\"test program.exe\"" }, - { __LINE__, FALSE, FALSE, "\"test program\" TEST" }, - { __LINE__, FALSE, FALSE, "\"test program.bat\" TEST" }, - { __LINE__, FALSE, FALSE, "\"test program.exe\" TEST" }, - { __LINE__, FALSE, FALSE, " \"test program\"" }, - { __LINE__, FALSE, FALSE, " \"test program.bat\"" }, - { __LINE__, FALSE, FALSE, " \"test program.exe\"" }, - { __LINE__, FALSE, FALSE, "\"test program\" " }, - { __LINE__, FALSE, FALSE, "\"test program.bat\" " }, - { __LINE__, FALSE, FALSE, "\"test program.exe\" " }, - { __LINE__, FALSE, FALSE, "\".\\test program.bat\"" }, - { __LINE__, FALSE, FALSE, "\".\\test program.exe\"" }, - { __LINE__, TRUE, TRUE, s_win_test_exe }, - { __LINE__, TRUE, TRUE, s_sys_test_exe }, - { __LINE__, TRUE, TRUE, s_win_bat_file }, - { __LINE__, TRUE, TRUE, s_sys_bat_file }, - { __LINE__, TRUE, TRUE, s_win_bat_file, "TEST" }, - { __LINE__, TRUE, TRUE, s_sys_bat_file, "TEST" }, - { __LINE__, FALSE, FALSE, "invalid program" }, - { __LINE__, FALSE, FALSE, "invalid program.bat" }, - { __LINE__, FALSE, FALSE, "invalid program.exe" }, - { __LINE__, TRUE, TRUE, "test_file.txt" }, - { __LINE__, TRUE, TRUE, "test_file.txt", "parameters parameters" }, - { __LINE__, TRUE, TRUE, "test_file.txt", "parameters parameters", "." }, - { __LINE__, TRUE, TRUE, "shell32_apitest_sub.exe" }, - { __LINE__, TRUE, TRUE, ".\\shell32_apitest_sub.exe" }, - { __LINE__, TRUE, TRUE, "\"shell32_apitest_sub.exe\"" }, - { __LINE__, TRUE, TRUE, "\".\\shell32_apitest_sub.exe\"" }, - { __LINE__, TRUE, DONT_CARE, "https://google.com" }, - { __LINE__, TRUE, FALSE, "::{450d8fba-ad25-11d0-98a8-0800361b1103}" }, - { __LINE__, TRUE, FALSE, "shell:::{450d8fba-ad25-11d0-98a8-0800361b1103}" }, - { __LINE__, TRUE, FALSE, "shell:sendto" }, -}; - -static const TEST_ENTRY s_entries_2[] = -{ - { __LINE__, TRUE, TRUE, "test program" }, - { __LINE__, TRUE, TRUE, "test program", "TEST" }, - { __LINE__, TRUE, TRUE, "\"test program\"" }, - { __LINE__, TRUE, TRUE, s_win_test_exe }, - { __LINE__, TRUE, TRUE, s_sys_test_exe }, - { __LINE__, FALSE, FALSE, s_win_bat_file }, - { __LINE__, FALSE, FALSE, s_sys_bat_file }, - { __LINE__, FALSE, FALSE, s_win_bat_file, "TEST" }, - { __LINE__, FALSE, FALSE, s_sys_bat_file, "TEST" }, -}; - -typedef struct OPENWNDS + TEST_ENTRY entry = { line, result, lpFile, cmdline }; + TEST_DoTestEntryStruct(&entry); +} + +static BOOL +enableTokenPrivilege(LPCWSTR pszPrivilege) { - UINT count; - HWND *phwnd; -} OPENWNDS; + HANDLE hToken; + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken)) + return FALSE; -static OPENWNDS s_wi0 = { 0 }, s_wi1 = { 0 }; + TOKEN_PRIVILEGES tkp = { 0 }; + if (!LookupPrivilegeValueW(NULL, pszPrivilege, &tkp.Privileges[0].Luid)) + return FALSE; + + tkp.PrivilegeCount = 1; + tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + return AdjustTokenPrivileges(hToken, FALSE, &tkp, 0, NULL, NULL); +} + +typedef struct WINDOW_LIST +{ + SIZE_T m_chWnds; + HWND *m_phWnds; +} WINDOW_LIST, *PWINDOW_LIST; static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) { - OPENWNDS *info = (OPENWNDS *)lParam; - info->phwnd = (HWND *)realloc(info->phwnd, (info->count + 1) * sizeof(HWND)); - if (!info->phwnd) + if (!IsWindowVisible(hwnd)) + return TRUE; + + PWINDOW_LIST pList = (PWINDOW_LIST)lParam; + SIZE_T cb = (pList->m_chWnds + 1) * sizeof(HWND); + HWND *phWnds = (HWND *)realloc(pList->m_phWnds, cb); + if (!phWnds) return FALSE; - info->phwnd[info->count] = hwnd; - ++(info->count); + phWnds[pList->m_chWnds++] = hwnd; + pList->m_phWnds = phWnds; return TRUE; } -static void CleanupNewlyCreatedWindows(void) +static inline void TEST_GetWindowList(PWINDOW_LIST pList) { - EnumWindows(EnumWindowsProc, (LPARAM)&s_wi1); - for (UINT i1 = 0; i1 < s_wi1.count; ++i1) - { - BOOL bFound = FALSE; - for (UINT i0 = 0; i0 < s_wi0.count; ++i0) - { - if (s_wi1.phwnd[i1] == s_wi0.phwnd[i0]) - { - bFound = TRUE; - break; - } - } - if (!bFound) - PostMessageW(s_wi1.phwnd[i1], WM_CLOSE, 0, 0); - } - free(s_wi1.phwnd); - ZeroMemory(&s_wi1, sizeof(s_wi1)); + EnumWindows(EnumWindowsProc, (LPARAM)pList); } -static VOID DoTestEntry(const TEST_ENTRY *pEntry) +static void TEST_CloseNewWindows(PWINDOW_LIST List1, PWINDOW_LIST List2) { - SHELLEXECUTEINFOA info = { sizeof(info) }; - info.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI; - info.nShow = SW_SHOWNORMAL; - info.lpFile = pEntry->file; - info.lpParameters = pEntry->params; - info.lpDirectory = pEntry->curdir; - BOOL ret = ShellExecuteExA(&info); - ok(ret == pEntry->ret, "Line %u: ret expected %d, got %d\n", - pEntry->lineno, pEntry->ret, ret); - if (!pEntry->ret) - return; - - if ((UINT)pEntry->bProcessHandle != DONT_CARE) + for (SIZE_T i2 = 0; i2 < List2->m_chWnds; ++i2) { - if (pEntry->bProcessHandle) + BOOL bFoundInList1 = FALSE; + HWND hWnd = List2->m_phWnds[i2]; + for (SIZE_T i1 = 0; i1 < List1->m_chWnds; ++i1) { - ok(!!info.hProcess, "Line %u: hProcess expected non-NULL\n", pEntry->lineno); + if (hWnd == List1->m_phWnds[i1]) + { + bFoundInList1 = TRUE; + goto Escape; + } } - else +Escape: + if (!bFoundInList1) { - ok(!info.hProcess, "Line %u: hProcess expected NULL\n", pEntry->lineno); - return; - } - } - - WaitForInputIdle(info.hProcess, INFINITE); + for (INT i = 0; i < 5; ++i) + { + if (!IsWindow(hWnd)) + break; - CleanupNewlyCreatedWindows(); + SwitchToThisWindow(hWnd, TRUE); - if (WaitForSingleObject(info.hProcess, 10 * 1000) == WAIT_TIMEOUT) - { - TerminateProcess(info.hProcess, 11); - ok(0, "Process %s did not quit!\n", pEntry->file); + // Alt+F4 + keybd_event(VK_MENU, 0x38, 0, 0); + keybd_event(VK_F4, 0x3E, 0, 0); + keybd_event(VK_F4, 0x3E, KEYEVENTF_KEYUP, 0); + keybd_event(VK_MENU, 0x38, KEYEVENTF_KEYUP, 0); + Sleep(100); + } + } } - CloseHandle(info.hProcess); } -static BOOL -GetSubProgramPath(void) +static WINDOW_LIST s_List1, s_List2; + +static BOOL TEST_Start(void) { - GetModuleFileNameA(NULL, s_sub_program, _countof(s_sub_program)); - PathRemoveFileSpecA(s_sub_program); - PathAppendA(s_sub_program, "shell32_apitest_sub.exe"); + // Check Wow64 + s_bWow64 = FALSE; + IsWow64Process(GetCurrentProcess(), &s_bWow64); + if (s_bWow64) + skip("Wow64: Command Line check is skipped\n"); - if (!PathFileExistsA(s_sub_program)) - { - PathRemoveFileSpecA(s_sub_program); - PathAppendA(s_sub_program, "testdata\\shell32_apitest_sub.exe"); + // getCommandLineFromProcess needs this + enableTokenPrivilege(SE_DEBUG_NAME); - if (!PathFileExistsA(s_sub_program)) - { - return FALSE; - } - } + // s_win_dir + GetWindowsDirectoryW(s_win_dir, _countof(s_win_dir)); - return TRUE; -} + // s_sys_dir + GetSystemDirectoryW(s_sys_dir, _countof(s_sys_dir)); -static void DoTestEntries(void) -{ - if (!GetSubProgramPath()) - { - skip("shell32_apitest_sub.exe is not found\n"); - return; - } + // s_win_notepad + GetWindowsDirectoryW(s_win_notepad, _countof(s_win_notepad)); + PathAppendW(s_win_notepad, L"notepad.exe"); + + // s_sys_notepad + GetSystemDirectoryW(s_sys_notepad, _countof(s_sys_notepad)); + PathAppendW(s_sys_notepad, L"notepad.exe"); // s_win_test_exe - GetWindowsDirectoryA(s_win_test_exe, _countof(s_win_test_exe)); - PathAppendA(s_win_test_exe, "test program.exe"); - BOOL ret = CopyFileA(s_sub_program, s_win_test_exe, FALSE); + GetWindowsDirectoryW(s_win_test_exe, _countof(s_win_test_exe)); + PathAppendW(s_win_test_exe, L"test program.exe"); + BOOL ret = CopyFileW(s_win_notepad, s_win_test_exe, FALSE); if (!ret) { skip("Please retry with admin rights\n"); - return; - } - - // record open windows - if (!EnumWindows(EnumWindowsProc, (LPARAM)&s_wi0)) - { - skip("EnumWindows failed\n"); - DeleteFileA(s_win_test_exe); - free(s_wi0.phwnd); - return; + return FALSE; } // s_sys_test_exe - GetSystemDirectoryA(s_sys_test_exe, _countof(s_sys_test_exe)); - PathAppendA(s_sys_test_exe, "test program.exe"); - ok_int(CopyFileA(s_sub_program, s_sys_test_exe, FALSE), TRUE); + GetSystemDirectoryW(s_sys_test_exe, _countof(s_sys_test_exe)); + PathAppendW(s_sys_test_exe, L"test program.exe"); + ok_int(CopyFileW(s_win_notepad, s_sys_test_exe, FALSE), TRUE); // s_win_bat_file - GetWindowsDirectoryA(s_win_bat_file, _countof(s_win_bat_file)); - PathAppendA(s_win_bat_file, "test program.bat"); - FILE *fp = fopen(s_win_bat_file, "wb"); + GetWindowsDirectoryW(s_win_bat_file, _countof(s_win_bat_file)); + PathAppendW(s_win_bat_file, L"test program.bat"); + FILE *fp = _wfopen(s_win_bat_file, L"wb"); fprintf(fp, "exit /b 3"); fclose(fp); - ok_int(PathFileExistsA(s_win_bat_file), TRUE); + ok_int(PathFileExistsW(s_win_bat_file), TRUE); // s_sys_bat_file - GetSystemDirectoryA(s_sys_bat_file, _countof(s_sys_bat_file)); - PathAppendA(s_sys_bat_file, "test program.bat"); - fp = fopen(s_sys_bat_file, "wb"); + GetSystemDirectoryW(s_sys_bat_file, _countof(s_sys_bat_file)); + PathAppendW(s_sys_bat_file, L"test program.bat"); + fp = _wfopen(s_sys_bat_file, L"wb"); fprintf(fp, "exit /b 4"); fclose(fp); - ok_int(PathFileExistsA(s_sys_bat_file), TRUE); + ok_int(PathFileExistsW(s_sys_bat_file), TRUE); // s_win_txt_file - GetWindowsDirectoryA(s_win_txt_file, _countof(s_win_txt_file)); - PathAppendA(s_win_txt_file, "test_file.txt"); - fp = fopen(s_win_txt_file, "wb"); + GetWindowsDirectoryW(s_win_txt_file, _countof(s_win_txt_file)); + PathAppendW(s_win_txt_file, L"test_file.txt"); + fp = _wfopen(s_win_txt_file, L"wb"); fclose(fp); - ok_int(PathFileExistsA(s_win_txt_file), TRUE); + ok_int(PathFileExistsW(s_win_txt_file), TRUE); // s_sys_txt_file - GetSystemDirectoryA(s_sys_txt_file, _countof(s_sys_txt_file)); - PathAppendA(s_sys_txt_file, "test_file.txt"); - fp = fopen(s_sys_txt_file, "wb"); + GetSystemDirectoryW(s_sys_txt_file, _countof(s_sys_txt_file)); + PathAppendW(s_sys_txt_file, L"test_file.txt"); + fp = _wfopen(s_sys_txt_file, L"wb"); fclose(fp); - ok_int(PathFileExistsA(s_sys_txt_file), TRUE); - - for (UINT iTest = 0; iTest < _countof(s_entries_1); ++iTest) - { - DoTestEntry(&s_entries_1[iTest]); - } - - DeleteFileA(s_win_bat_file); - DeleteFileA(s_sys_bat_file); + ok_int(PathFileExistsW(s_sys_txt_file), TRUE); - for (UINT iTest = 0; iTest < _countof(s_entries_2); ++iTest) + // Check .txt settings + WCHAR szPath[MAX_PATH]; + FindExecutableW(s_sys_txt_file, NULL, szPath); + if (lstrcmpiW(PathFindFileNameW(szPath), L"notepad.exe") != 0) { - DoTestEntry(&s_entries_2[iTest]); + skip("Please associate .txt with notepad.exe before tests\n"); + return FALSE; } - DeleteFileA(s_win_test_exe); - DeleteFileA(s_sys_test_exe); - DeleteFileA(s_win_txt_file); - DeleteFileA(s_sys_txt_file); - - free(s_wi0.phwnd); -} + // command lines + StringCchPrintfW(s_win_notepad_cmdline, _countof(s_win_notepad_cmdline), + L"\"%s\" ", s_win_notepad); + StringCchPrintfW(s_sys_notepad_cmdline, _countof(s_sys_notepad_cmdline), + L"\"%s\" ", s_sys_notepad); + StringCchPrintfW(s_win_test_exe_cmdline, _countof(s_win_test_exe_cmdline), + L"\"%s\" ", s_win_test_exe); + StringCchPrintfW(s_sys_test_exe_cmdline, _countof(s_sys_test_exe_cmdline), + L"\"%s\" ", s_sys_test_exe); -WCHAR* ExeName = NULL; + TEST_GetWindowList(&s_List1); -BOOL CALLBACK EnumProc(_In_ HWND hwnd, _In_ LPARAM lParam) -{ - DWORD pid = 0; - GetWindowThreadProcessId(hwnd, &pid); - if (pid == GetCurrentProcessId() && - IsWindowVisible(hwnd)) - { - WCHAR Buffer[512] = {0}; - - GetWindowTextW(hwnd, Buffer, _countof(Buffer) - 1); - if (Buffer[0] && StrStrIW(Buffer, ExeName)) - { - HWND* pHwnd = (HWND*)lParam; - *pHwnd = hwnd; - return FALSE; - } - } return TRUE; } -BOOL WaitAndCloseWindow() +static void TEST_End(void) { - HWND hWnd = NULL; - for (int n = 0; n < 100; ++n) - { - Sleep(50); - - EnumWindows(EnumProc, (LPARAM)&hWnd); - - if (hWnd) - { - SendMessageW(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0); - return TRUE; - break; - } - } - return FALSE; + Sleep(500); + TEST_GetWindowList(&s_List2); + TEST_CloseNewWindows(&s_List1, &s_List2); + free(s_List1.m_phWnds); + free(s_List2.m_phWnds); + + DeleteFileW(s_win_test_exe); + DeleteFileW(s_sys_test_exe); + DeleteFileW(s_win_txt_file); + DeleteFileW(s_sys_txt_file); + DeleteFileW(s_win_bat_file); + DeleteFileW(s_sys_bat_file); } static void test_properties() { WCHAR Buffer[MAX_PATH * 4]; - CoInitialize(NULL); + HRESULT hrCoInit = CoInitialize(NULL); GetModuleFileNameW(NULL, Buffer, _countof(Buffer)); - SHELLEXECUTEINFOW info = { 0 }; + SHELLEXECUTEINFOW info = { sizeof(info) }; info.cbSize = sizeof(SHELLEXECUTEINFOW); info.fMask = SEE_MASK_INVOKEIDLIST | SEE_MASK_FLAG_NO_UI; info.lpVerb = L"properties"; info.lpFile = Buffer; - info.lpParameters = L""; info.nShow = SW_SHOW; BOOL bRet = ShellExecuteExW(&info); ok(bRet, "Failed! (GetLastError(): %d)\n", (int)GetLastError()); ok_ptr(info.hInstApp, (HINSTANCE)42); - ExeName = PathFindFileNameW(Buffer); WCHAR* Extension = PathFindExtensionW(Buffer); if (Extension) { @@ -444,80 +390,110 @@ static void test_properties() *Extension = UNICODE_NULL; } - if (bRet) - { - ok(WaitAndCloseWindow(), "Could not find properties window!\n"); - } - // Now retry it with the extension cut off bRet = ShellExecuteExW(&info); ok(bRet, "Failed! (GetLastError(): %d)\n", (int)GetLastError()); ok_ptr(info.hInstApp, (HINSTANCE)42); - if (bRet) - { - ok(WaitAndCloseWindow(), "Could not find properties window!\n"); - } - - info.lpFile = L"complete garbage, cannot run this!"; - // Now retry it with complete garabage + info.lpFile = L"complete garbage, cannot run this!"; bRet = ShellExecuteExW(&info); - ok(bRet == 0, "Succeeded!\n"); + ok_int(bRet, 0); ok_ptr(info.hInstApp, (HINSTANCE)2); + + if (SUCCEEDED(hrCoInit)) + CoUninitialize(); } static void test_sei_lpIDList() { + if (IsWindowsVistaOrGreater()) + { + skip("Vista+\n"); + return; + } + /* This tests ShellExecuteEx with lpIDList for explorer C:\ */ /* ITEMIDLIST for CLSID of 'My Computer' followed by PIDL for 'C:\' */ BYTE lpitemidlist[30] = { 0x14, 0, 0x1f, 0, 0xe0, 0x4f, 0xd0, 0x20, 0xea, 0x3a, 0x69, 0x10, 0xa2, 0xd8, 0x08, 0, 0x2b, 0x30, 0x30, 0x9d, // My Computer 0x8, 0, 0x23, 0x43, 0x3a, 0x5c, 0x5c, 0, 0, 0,}; // C:\\ + NUL-NUL ending - BYTE *lpBytes; - lpBytes = lpitemidlist; - - SHELLEXECUTEINFOW ShellExecInfo; - BOOL Result; - STARTUPINFOW si; - PROCESS_INFORMATION pi; - HWND hWnd; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); - - ZeroMemory(&ShellExecInfo, sizeof(ShellExecInfo)); - ShellExecInfo.cbSize = sizeof(ShellExecInfo); + SHELLEXECUTEINFOW ShellExecInfo = { sizeof(ShellExecInfo) }; ShellExecInfo.fMask = SEE_MASK_IDLIST; ShellExecInfo.hwnd = NULL; ShellExecInfo.nShow = SW_SHOWNORMAL; - ShellExecInfo.lpFile = NULL; - ShellExecInfo.lpDirectory = NULL; - ShellExecInfo.lpIDList = lpBytes; - - Result = ShellExecuteExW(&ShellExecInfo); - ok(Result == TRUE, "ShellExecuteEx lpIDList 'C:\\' failed\n"); - trace("sei_lpIDList returned: %s\n", Result ? "SUCCESS" : "FAILURE"); - if (Result) + ShellExecInfo.lpIDList = lpitemidlist; + BOOL ret = ShellExecuteExW(&ShellExecInfo); + ok_int(ret, TRUE); +} + +static BOOL +CreateAppPath(LPCWSTR pszName, LPCWSTR pszValue) +{ + WCHAR szSubKey[MAX_PATH]; + StringCchPrintfW(szSubKey, _countof(szSubKey), L"%s\\%s", REG_APPPATHS, pszName); + + LSTATUS error; + HKEY hKey; + error = RegCreateKeyExW(HKEY_LOCAL_MACHINE, szSubKey, 0, NULL, 0, KEY_WRITE, NULL, + &hKey, NULL); + if (error != ERROR_SUCCESS) + trace("Could not create test key (%lu)\n", error); + + DWORD cbValue = (lstrlenW(pszValue) + 1) * sizeof(WCHAR); + error = RegSetValueExW(hKey, NULL, 0, REG_SZ, (LPBYTE)pszValue, cbValue); + if (error != ERROR_SUCCESS) + trace("Could not set value of the test key (%lu)\n", error); + + RegCloseKey(hKey); + + return error == ERROR_SUCCESS; +} + +static VOID +DeleteAppPath(LPCWSTR pszName) +{ + WCHAR szSubKey[MAX_PATH]; + StringCchPrintfW(szSubKey, _countof(szSubKey), L"%s\\%s", REG_APPPATHS, pszName); + + LSTATUS error = RegDeleteKeyW(HKEY_LOCAL_MACHINE, szSubKey); + if (error != ERROR_SUCCESS) + trace("Could not remove the test key (%lu)\n", error); +} + +static void TEST_AppPath(void) +{ + if (CreateAppPath(L"app_path_test.bat", s_win_test_exe)) + { + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, L"app_path_test.bat"); + TEST_DoTestEntry(__LINE__, TEST_FAILED, L"app_path_test.bat.exe"); + DeleteAppPath(L"app_path_test.bat"); + } + + if (CreateAppPath(L"app_path_test.bat.exe", s_sys_test_exe)) { - Sleep(700); - // Terminate Window - hWnd = FindWindowW(L"CabinetWClass", L"Local Disk (C:)"); - PostMessage(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0); + TEST_DoTestEntry(__LINE__, TEST_FAILED, L"app_path_test.bat"); + TEST_DoTestEntry(__LINE__, TEST_SUCCESS_WITH_PROCESS, L"app_path_test.bat.exe"); + DeleteAppPath(L"app_path_test.bat.exe"); } } START_TEST(ShellExecuteEx) { - DoAppPathTest(); - DoTestEntries(); - test_properties(); +#ifdef _WIN64 + skip("Win64 is not supported yet\n"); + return; +#endif - DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE); - Sleep(100); + if (!TEST_Start()) + return; + TEST_AppPath(); + TEST_DoTestEntries(); + test_properties(); test_sei_lpIDList(); + TEST_End(); } diff --git a/modules/rostests/apitests/shell32/ShellHook.cpp b/modules/rostests/apitests/shell32/ShellHook.cpp index 1afb4155071..f2cb202f41d 100644 --- a/modules/rostests/apitests/shell32/ShellHook.cpp +++ b/modules/rostests/apitests/shell32/ShellHook.cpp @@ -2,15 +2,15 @@ * PROJECT: ReactOS api tests * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later) * PURPOSE: Test for Shell Hook - * COPYRIGHT: Copyright 2020-2021 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) + * COPYRIGHT: Copyright 2020-2024 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com) */ #include "shelltest.h" -#include "undocshell.h" struct TEST_ENTRY { INT lineno; - UINT nCount; + UINT cCreated; + UINT cDestroyed; BOOL bIsChild; BOOL bHasOwner; DWORD style; @@ -35,353 +35,228 @@ struct TEST_ENTRY static const TEST_ENTRY s_entries1[] = { // TYPE_0 - { __LINE__, 0, TYPE_0, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_0, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_0, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_0, STYLE_0, EXSTYLE_3 }, - { __LINE__, 1, TYPE_0, STYLE_1, EXSTYLE_0 }, - { __LINE__, 1, TYPE_0, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_0, STYLE_1, EXSTYLE_2 }, - { __LINE__, 1, TYPE_0, STYLE_1, EXSTYLE_3 }, - { __LINE__, 1, TYPE_0, STYLE_2, EXSTYLE_0 }, - { __LINE__, 1, TYPE_0, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_0, STYLE_2, EXSTYLE_2 }, - { __LINE__, 1, TYPE_0, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_0, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_0, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_0, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_0, STYLE_0, EXSTYLE_3 }, + { __LINE__, 1, 1, TYPE_0, STYLE_1, EXSTYLE_0 }, + { __LINE__, 1, 1, TYPE_0, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_0, STYLE_1, EXSTYLE_2 }, + { __LINE__, 1, 1, TYPE_0, STYLE_1, EXSTYLE_3 }, + { __LINE__, 1, 1, TYPE_0, STYLE_2, EXSTYLE_0 }, + { __LINE__, 1, 1, TYPE_0, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_0, STYLE_2, EXSTYLE_2 }, + { __LINE__, 1, 1, TYPE_0, STYLE_2, EXSTYLE_3 }, // TYPE_1 - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_3 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_0 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_1 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_2 }, - { __LINE__, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_3 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_0 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_2 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_1, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_3 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_0 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_2 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_1, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_3 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_0 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_2 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_1, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_3 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_0 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_2 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_1, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_3 }, // TYPE_2 - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_3 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_0 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_1 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_2 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_3 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_0 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_1 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_2 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_3 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_0 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_1 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_2 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_3 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_0 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_1 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_2 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_3 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_0 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_1 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_2 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_3 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_0 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_1 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_2 }, - { __LINE__, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_3 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_0 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_1 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_2 }, - { __LINE__, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_0, STYLE_2, EXSTYLE_3 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_0 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_2 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_0, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_1, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_1, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_1, EXSTYLE_2, STYLE_2, EXSTYLE_3 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_0 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_2 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_0, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_1, EXSTYLE_3 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_0 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_1 }, + { __LINE__, 1, 1, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_2 }, + { __LINE__, 1, 2, TYPE_2, STYLE_1, EXSTYLE_3, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_0, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_1, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_2, STYLE_2, EXSTYLE_3 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_0 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_2 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_0, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_1, EXSTYLE_3 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_0 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_1 }, + { __LINE__, 0, 0, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_2 }, + { __LINE__, 0, 1, TYPE_2, STYLE_2, EXSTYLE_3, STYLE_2, EXSTYLE_3 }, }; -typedef struct RUDEAPP_TEST_ENTRY -{ - INT lineno; - UINT nCount; - DWORD style; - DWORD exstyle; - BOOL bSetForeground; - BOOL bFullscreen; - BOOL bSetFullscreen; -} RUDEAPP_TEST_ENTRY; - -static const RUDEAPP_TEST_ENTRY s_entries2[] = -{ - /* STYLE_0 */ - { __LINE__, 0, STYLE_0, EXSTYLE_0, FALSE, FALSE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_0, FALSE, FALSE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_0, FALSE, TRUE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_0, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_0, TRUE, FALSE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_0, TRUE, FALSE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_0, TRUE, TRUE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_0, TRUE, TRUE, TRUE }, - - { __LINE__, 0, STYLE_0, EXSTYLE_1, FALSE, FALSE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_1, FALSE, FALSE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_1, FALSE, TRUE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_1, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_1, TRUE, FALSE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_1, TRUE, FALSE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_1, TRUE, TRUE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_1, TRUE, TRUE, TRUE }, - - { __LINE__, 0, STYLE_0, EXSTYLE_2, FALSE, FALSE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_2, FALSE, FALSE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_2, FALSE, TRUE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_2, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_2, TRUE, FALSE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_2, TRUE, FALSE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_2, TRUE, TRUE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_2, TRUE, TRUE, TRUE }, - - { __LINE__, 0, STYLE_0, EXSTYLE_3, FALSE, FALSE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_3, FALSE, FALSE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_3, FALSE, TRUE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_3, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_3, TRUE, FALSE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_3, TRUE, FALSE, TRUE }, - { __LINE__, 0, STYLE_0, EXSTYLE_3, TRUE, TRUE, FALSE }, - { __LINE__, 0, STYLE_0, EXSTYLE_3, TRUE, TRUE, TRUE }, - - /* STYLE_1 */ - { __LINE__, 0, STYLE_1, EXSTYLE_0, FALSE, FALSE, FALSE }, - { __LINE__, 1, STYLE_1, EXSTYLE_0, FALSE, FALSE, TRUE }, - { __LINE__, 1, STYLE_1, EXSTYLE_0, FALSE, TRUE, FALSE }, - { __LINE__, 1, STYLE_1, EXSTYLE_0, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_1, EXSTYLE_0, TRUE, FALSE, FALSE }, - { __LINE__, 1, STYLE_1, EXSTYLE_0, TRUE, FALSE, TRUE }, - { __LINE__, 1, STYLE_1, EXSTYLE_0, TRUE, TRUE, FALSE }, - { __LINE__, 1, STYLE_1, EXSTYLE_0, TRUE, TRUE, TRUE }, - - { __LINE__, 0, STYLE_1, EXSTYLE_1, FALSE, FALSE, FALSE }, - { __LINE__, 1, STYLE_1, EXSTYLE_1, FALSE, FALSE, TRUE }, - { __LINE__, 1, STYLE_1, EXSTYLE_1, FALSE, TRUE, FALSE }, - { __LINE__, 1, STYLE_1, EXSTYLE_1, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_1, EXSTYLE_1, TRUE, FALSE, FALSE }, - { __LINE__, 1, STYLE_1, EXSTYLE_1, TRUE, FALSE, TRUE }, - { __LINE__, 1, STYLE_1, EXSTYLE_1, TRUE, TRUE, FALSE }, - { __LINE__, 1, STYLE_1, EXSTYLE_1, TRUE, TRUE, TRUE }, - - { __LINE__, 0, STYLE_1, EXSTYLE_2, FALSE, FALSE, FALSE }, - { __LINE__, 0, STYLE_1, EXSTYLE_2, FALSE, FALSE, TRUE }, - { __LINE__, 0, STYLE_1, EXSTYLE_2, FALSE, TRUE, FALSE }, - { __LINE__, 0, STYLE_1, EXSTYLE_2, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_1, EXSTYLE_2, TRUE, FALSE, FALSE }, - { __LINE__, 0, STYLE_1, EXSTYLE_2, TRUE, FALSE, TRUE }, - { __LINE__, 0, STYLE_1, EXSTYLE_2, TRUE, TRUE, FALSE }, - { __LINE__, 0, STYLE_1, EXSTYLE_2, TRUE, TRUE, TRUE }, - - { __LINE__, 0, STYLE_1, EXSTYLE_3, FALSE, FALSE, FALSE }, - { __LINE__, 0, STYLE_1, EXSTYLE_3, FALSE, FALSE, TRUE }, - { __LINE__, 0, STYLE_1, EXSTYLE_3, FALSE, TRUE, FALSE }, - { __LINE__, 0, STYLE_1, EXSTYLE_3, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_1, EXSTYLE_3, TRUE, FALSE, FALSE }, - { __LINE__, 0, STYLE_1, EXSTYLE_3, TRUE, FALSE, TRUE }, - { __LINE__, 0, STYLE_1, EXSTYLE_3, TRUE, TRUE, FALSE }, - { __LINE__, 0, STYLE_1, EXSTYLE_3, TRUE, TRUE, TRUE }, - - /* STYLE_2 */ - { __LINE__, 0, STYLE_2, EXSTYLE_0, FALSE, FALSE, FALSE }, - { __LINE__, 1, STYLE_2, EXSTYLE_0, FALSE, FALSE, TRUE }, - { __LINE__, 1, STYLE_2, EXSTYLE_0, FALSE, TRUE, FALSE }, - { __LINE__, 1, STYLE_2, EXSTYLE_0, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_2, EXSTYLE_0, TRUE, FALSE, FALSE }, - { __LINE__, 1, STYLE_2, EXSTYLE_0, TRUE, FALSE, TRUE }, - { __LINE__, 1, STYLE_2, EXSTYLE_0, TRUE, TRUE, FALSE }, - { __LINE__, 1, STYLE_2, EXSTYLE_0, TRUE, TRUE, TRUE }, - - { __LINE__, 0, STYLE_2, EXSTYLE_1, FALSE, FALSE, FALSE }, - { __LINE__, 1, STYLE_2, EXSTYLE_1, FALSE, FALSE, TRUE }, - { __LINE__, 1, STYLE_2, EXSTYLE_1, FALSE, TRUE, FALSE }, - { __LINE__, 1, STYLE_2, EXSTYLE_1, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_2, EXSTYLE_1, TRUE, FALSE, FALSE }, - { __LINE__, 1, STYLE_2, EXSTYLE_1, TRUE, FALSE, TRUE }, - { __LINE__, 1, STYLE_2, EXSTYLE_1, TRUE, TRUE, FALSE }, - { __LINE__, 1, STYLE_2, EXSTYLE_1, TRUE, TRUE, TRUE }, - - { __LINE__, 0, STYLE_2, EXSTYLE_2, FALSE, FALSE, FALSE }, - { __LINE__, 0, STYLE_2, EXSTYLE_2, FALSE, FALSE, TRUE }, - { __LINE__, 0, STYLE_2, EXSTYLE_2, FALSE, TRUE, FALSE }, - { __LINE__, 0, STYLE_2, EXSTYLE_2, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_2, EXSTYLE_2, TRUE, FALSE, FALSE }, - { __LINE__, 0, STYLE_2, EXSTYLE_2, TRUE, FALSE, TRUE }, - { __LINE__, 0, STYLE_2, EXSTYLE_2, TRUE, TRUE, FALSE }, - { __LINE__, 0, STYLE_2, EXSTYLE_2, TRUE, TRUE, TRUE }, - - { __LINE__, 0, STYLE_2, EXSTYLE_3, FALSE, FALSE, FALSE }, - { __LINE__, 0, STYLE_2, EXSTYLE_3, FALSE, FALSE, TRUE }, - { __LINE__, 0, STYLE_2, EXSTYLE_3, FALSE, TRUE, FALSE }, - { __LINE__, 0, STYLE_2, EXSTYLE_3, FALSE, TRUE, TRUE }, - { __LINE__, 0, STYLE_2, EXSTYLE_3, TRUE, FALSE, FALSE }, - { __LINE__, 0, STYLE_2, EXSTYLE_3, TRUE, FALSE, TRUE }, - { __LINE__, 0, STYLE_2, EXSTYLE_3, TRUE, TRUE, FALSE }, - { __LINE__, 0, STYLE_2, EXSTYLE_3, TRUE, TRUE, TRUE }, -}; - -static UINT s_uShellHookMsg = 0; -static HWND s_hwndHookViewer = NULL; +static HHOOK s_hShellHook = NULL; +static UINT s_cCreated = 0; +static UINT s_cDestroyed = 0; +static WCHAR s_szName[] = L"ReactOS ShellHook testcase"; static HWND s_hwndParent = NULL; static HWND s_hwndTarget = NULL; -static UINT s_nWindowCreatedCount = 0; -static UINT s_nRudeAppActivated = 0; -static WCHAR s_szName[] = L"ReactOS ShellHook testcase"; +static HWND s_hwndMain = NULL; static HWND DoCreateWindow(HWND hwndParent, DWORD style, DWORD exstyle, BOOL bFullscreen = FALSE) { - INT x = CW_USEDEFAULT, y = CW_USEDEFAULT, cx = 100, cy = 100; + INT x = CW_USEDEFAULT, y = CW_USEDEFAULT, cx = 300, cy = 100; if (bFullscreen) { x = y = 0; @@ -399,9 +274,7 @@ static void DoTestEntryPart1(const TEST_ENTRY *pEntry) s_hwndParent = NULL; if (pEntry->bIsChild || pEntry->bHasOwner) - { s_hwndParent = DoCreateWindow(NULL, pEntry->owner_style, pEntry->owner_exstyle); - } DWORD style = pEntry->style; DWORD exstyle = pEntry->exstyle; @@ -410,124 +283,120 @@ static void DoTestEntryPart1(const TEST_ENTRY *pEntry) else style &= ~WS_CHILD; - s_nWindowCreatedCount = 0; + s_cCreated = s_cDestroyed = 0; s_hwndTarget = DoCreateWindow(s_hwndParent, style, exstyle); } static void DoTestEntryPart2(const TEST_ENTRY *pEntry) { - ok(s_nWindowCreatedCount == pEntry->nCount, - "Line %d: s_nWindowCreatedCount expected %u but was %u\n", - pEntry->lineno, pEntry->nCount, s_nWindowCreatedCount); - - PostMessageW(s_hwndTarget, WM_CLOSE, 0, 0); + DestroyWindow(s_hwndTarget); s_hwndTarget = NULL; if (pEntry->bIsChild || pEntry->bHasOwner) { - PostMessageW(s_hwndParent, WM_CLOSE, 0, 0); + DestroyWindow(s_hwndParent); s_hwndParent = NULL; } + + ok(s_cCreated == pEntry->cCreated, + "Line %d: cCreated expected %u but was %u\n", + pEntry->lineno, pEntry->cCreated, s_cCreated); + + ok(s_cDestroyed == pEntry->cDestroyed, + "Line %d: cDestroyed expected %u but was %u\n", + pEntry->lineno, pEntry->cDestroyed, s_cDestroyed); } -static void DoRudeAppTest1(const RUDEAPP_TEST_ENTRY *pEntry) +static +LRESULT CALLBACK +ShellProc( + INT nCode, + WPARAM wParam, + LPARAM lParam) { - s_hwndParent = NULL; - - DWORD style = pEntry->style; - DWORD exstyle = pEntry->exstyle; + if (nCode < 0) + return CallNextHookEx(s_hShellHook, nCode, wParam, lParam); - s_nRudeAppActivated = 0; - s_hwndTarget = DoCreateWindow(s_hwndParent, style, exstyle, pEntry->bFullscreen); - if (pEntry->bSetForeground) - SetForegroundWindow(s_hwndTarget); - if (pEntry->bSetFullscreen) + switch (nCode) { - MoveWindow(s_hwndTarget, 0, 0, - GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), TRUE); - } -} + case HSHELL_WINDOWCREATED: + s_cCreated++; + break; -static void DoRudeAppTest2(const RUDEAPP_TEST_ENTRY *pEntry) -{ - ok(s_nRudeAppActivated == pEntry->nCount, - "Line %d: s_nRudeAppActivated expected %u but was %u\n", - pEntry->lineno, pEntry->nCount, s_nRudeAppActivated); + case HSHELL_WINDOWDESTROYED: + s_cDestroyed++; + break; + } - PostMessageW(s_hwndTarget, WM_CLOSE, 0, 0); - s_hwndTarget = NULL; + return CallNextHookEx(s_hShellHook, nCode, wParam, lParam); } -static LRESULT CALLBACK -WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK +DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - if (uMsg == s_uShellHookMsg && uMsg != 0) - { - switch (wParam) - { - case HSHELL_WINDOWCREATED: - if ((HWND)lParam != s_hwndTarget) - break; - ++s_nWindowCreatedCount; - break; - - case HSHELL_RUDEAPPACTIVATED: - if ((HWND)lParam != s_hwndTarget) - break; - ++s_nRudeAppActivated; - break; - } - } -#define ID_IGNITION 1000 -#define ID_BURNING 2000 -#define ID_RUDEAPPTEST1 3000 -#define ID_RUDEAPPTEST2 4000 +#define ID_TESTSTART 1000 +#define ID_TESTEND 2000 switch (uMsg) { - case WM_CREATE: - PostMessageW(hwnd, WM_COMMAND, ID_IGNITION, 0); - return DefWindowProcW(hwnd, uMsg, wParam, lParam); - case WM_COMMAND: - if (hwnd != s_hwndHookViewer) - break; + case WM_INITDIALOG: + ok_int(s_cCreated, 0); + ok_int(s_cDestroyed, 0); + PostMessageW(hwnd, WM_COMMAND, ID_TESTSTART, 0); + return TRUE; - if (ID_IGNITION <= wParam && wParam < ID_BURNING) - { - INT i = (INT)wParam - ID_IGNITION; - DoTestEntryPart1(&s_entries1[i]); - PostMessageW(hwnd, WM_COMMAND, ID_BURNING + i, 0); - } - else if (ID_BURNING <= wParam && wParam < ID_RUDEAPPTEST1) + case WM_COMMAND: + switch (LOWORD(wParam)) { - INT i = (INT)wParam - ID_BURNING; - DoTestEntryPart2(&s_entries1[i]); - ++i; - if (i == (INT)_countof(s_entries1)) - { - PostMessageW(hwnd, WM_COMMAND, ID_RUDEAPPTEST1, 0); + case IDOK: + case IDCANCEL: + DestroyWindow(hwnd); break; - } - PostMessageW(hwnd, WM_COMMAND, ID_IGNITION + i, 0); - } - else if (ID_RUDEAPPTEST1 <= wParam && wParam < ID_RUDEAPPTEST2) - { - INT i = (INT)wParam - ID_RUDEAPPTEST1; - DoRudeAppTest1(&s_entries2[i]); - PostMessageW(hwnd, WM_COMMAND, ID_RUDEAPPTEST2 + i, 0); - } - else if (ID_RUDEAPPTEST2 <= wParam) - { - INT i = (INT)wParam - ID_RUDEAPPTEST2; - DoRudeAppTest2(&s_entries2[i]); - ++i; - if (i == (INT)_countof(s_entries2)) + + default: { - PostQuitMessage(0); - break; + if (ID_TESTSTART <= LOWORD(wParam) && LOWORD(wParam) < ID_TESTEND) + { + UINT_PTR i = (UINT_PTR)wParam - ID_TESTSTART; + + if (i < _countof(s_entries1)) + { + DoTestEntryPart1(&s_entries1[i]); + PostMessageW(hwnd, WM_COMMAND, ID_TESTEND + i, 0); + } + else + { + DestroyWindow(hwnd); + } + } + else if (ID_TESTEND <= LOWORD(wParam)) + { + UINT_PTR i = (UINT_PTR)wParam - ID_TESTEND; + + if (i < _countof(s_entries1)) + { + DoTestEntryPart2(&s_entries1[i]); + PostMessageW(hwnd, WM_COMMAND, ID_TESTSTART + i + 1, 0); + } + } } - PostMessageW(hwnd, WM_COMMAND, ID_RUDEAPPTEST1 + i, 0); } break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + } + + return 0; +} + +static LRESULT CALLBACK +WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_CREATE: + break; default: return DefWindowProcW(hwnd, uMsg, wParam, lParam); } @@ -536,14 +405,11 @@ WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) START_TEST(ShellHook) { - WNDCLASSW wc; - - ZeroMemory(&wc, sizeof(wc)); - wc.lpfnWndProc = WindowProc; + WNDCLASSW wc = { CS_HREDRAW | CS_VREDRAW, WindowProc }; wc.hInstance = GetModuleHandleW(NULL); wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); - wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); + wc.hbrBackground = (HBRUSH)(INT_PTR)(COLOR_3DFACE + 1); wc.lpszClassName = s_szName; if (!RegisterClassW(&wc)) { @@ -551,24 +417,33 @@ START_TEST(ShellHook) return; } - s_hwndHookViewer = DoCreateWindow(NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0); - if (s_hwndHookViewer == NULL) + s_hShellHook = SetWindowsHookEx(WH_SHELL, ShellProc, NULL, GetCurrentThreadId()); + if (!s_hShellHook) + { + skip("!s_hShellHook\n"); + return; + } + + s_hwndMain = CreateDialogW(GetModuleHandleW(NULL), L"ShellHook", NULL, DialogProc); + if (!s_hShellHook) { - skip("CreateWindowExW failed\n"); + skip("!s_hwndMain\n"); + UnhookWindowsHookEx(s_hShellHook); return; } - s_uShellHookMsg = RegisterWindowMessageW(L"SHELLHOOK"); - RegisterShellHookWindow(s_hwndHookViewer); + ShowWindow(s_hwndMain, SW_SHOWNOACTIVATE); + UpdateWindow(s_hwndMain); MSG msg; while (GetMessageW(&msg, NULL, 0, 0)) { + if (IsDialogMessageW(s_hwndMain, &msg)) + continue; + TranslateMessage(&msg); DispatchMessageW(&msg); } - DeregisterShellHookWindow(s_hwndHookViewer); - DestroyWindow(s_hwndHookViewer); - s_hwndHookViewer = NULL; + UnhookWindowsHookEx(s_hShellHook); } diff --git a/modules/rostests/apitests/shell32/resource.rc b/modules/rostests/apitests/shell32/resource.rc index 177ef5b3f03..1e7f377ee96 100644 --- a/modules/rostests/apitests/shell32/resource.rc +++ b/modules/rostests/apitests/shell32/resource.rc @@ -16,3 +16,10 @@ FONT 9, "Tahoma" CONTROL "edt1", edt1, "EDIT", ES_AUTOHSCROLL | ES_MULTILINE | WS_BORDER | WS_TABSTOP, 19, 18, 80, 14 LTEXT "stc1", stc1, 24, 49, 72, 21 } + +ShellHook DIALOG 0, 0, 200, 84 +CAPTION "ReactOS ShellHook test dialog" +STYLE DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION +FONT 9, "Tahoma" +{ +} diff --git a/sdk/include/ndk/i386/ketypes.h b/sdk/include/ndk/i386/ketypes.h index 4d77e015b02..757fd4e82d4 100644 --- a/sdk/include/ndk/i386/ketypes.h +++ b/sdk/include/ndk/i386/ketypes.h @@ -75,8 +75,10 @@ Header Name: #define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS)) #define PCR ((KPCR *)K0IPCR) #if defined(CONFIG_SMP) || defined(NT_BUILD) -#undef KeGetPcr +//#undef KeGetPcr #define KeGetPcr() ((KPCR *)__readfsdword(FIELD_OFFSET(KPCR, SelfPcr))) +#else +#define KeGetPcr() PCR #endif // diff --git a/sdk/include/ndk/inline_ntcurrentteb.h b/sdk/include/ndk/inline_ntcurrentteb.h index 13d99b6d1d9..a065945e610 100644 --- a/sdk/include/ndk/inline_ntcurrentteb.h +++ b/sdk/include/ndk/inline_ntcurrentteb.h @@ -1,29 +1,31 @@ #ifndef _INLINE_NT_CURRENTTEB_H_ #define _INLINE_NT_CURRENTTEB_H_ -#if defined(_M_IX86) -FORCEINLINE struct _TEB * NtCurrentTeb(void) +#ifdef __cplusplus +extern "C" { +#endif + +FORCEINLINE struct _TEB * NtCurrentTeb(VOID) { +#if defined(_M_IX86) return (struct _TEB *)__readfsdword(0x18); -} -#elif defined(_M_ARM) -FORCEINLINE struct _TEB * NtCurrentTeb(void) -{ - __debugbreak(); - return (struct _TEB *)0; -} #elif defined(_M_AMD64) -FORCEINLINE struct _TEB * NtCurrentTeb(void) -{ return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self)); -} -#elif defined(_M_PPC) -FORCEINLINE struct _TEB * NtCurrentTeb(void) -{ - return (struct _TEB *)__readfsdword_winnt(0x18); -} +#elif defined(_M_ARM) + // return (struct _TEB *)KeGetPcr()->Used_Self; + return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW); +#elif defined (_M_ARM64) + //UNIMPLEMENTED; + return 0; +// #elif defined(_M_PPC) +// return (struct _TEB *)_read_teb_dword(0x18); #else #error Unsupported architecture #endif +} + +#ifdef __cplusplus +} +#endif -#endif//_INLINE_NT_CURRENTTEB_H_ +#endif // _INLINE_NT_CURRENTTEB_H_ diff --git a/sdk/include/ndk/psfuncs.h b/sdk/include/ndk/psfuncs.h index 76f2dc94ea4..48fa4a934e2 100644 --- a/sdk/include/ndk/psfuncs.h +++ b/sdk/include/ndk/psfuncs.h @@ -420,15 +420,23 @@ NtCreateThread( FORCEINLINE struct _TEB * NtCurrentTeb(VOID) { #if defined(_M_IX86) - return (PTEB)__readfsdword(0x18); + return (struct _TEB *)__readfsdword(0x18); #elif defined (_M_AMD64) return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self)); #elif defined (_M_ARM) - return (struct _TEB *)KeGetPcr()->Used_Self; + // return (struct _TEB *)KeGetPcr()->Used_Self; + return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW); +#elif defined (_M_ARM64) + //UNIMPLEMENTED; + return 0; +// #elif defined(_M_PPC) +// return (struct _TEB *)_read_teb_dword(0x18); +#else +#error Unsupported architecture #endif } #else -struct _TEB * NtCurrentTeb(void); +struct _TEB * NtCurrentTeb(VOID); #endif NTSYSCALLAPI diff --git a/sdk/include/psdk/msctf.idl b/sdk/include/psdk/msctf.idl index f7f3b12327d..787c3d88d1c 100644 --- a/sdk/include/psdk/msctf.idl +++ b/sdk/include/psdk/msctf.idl @@ -62,9 +62,9 @@ cpp_quote("EXTERN_C HRESULT WINAPI TF_DllDetachInOther(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateCategoryMgr(_Out_ ITfCategoryMgr **ppcat);") cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateDisplayAttributeMgr(_Out_ ITfDisplayAttributeMgr **ppdam);") cpp_quote("EXTERN_C HICON WINAPI TF_GetLangIcon(_In_ LANGID LangID, _Out_ LPWSTR pszText, _In_ INT cchText);") -cpp_quote("EXTERN_C HRESULT WINAPI TF_InitMlngInfo(VOID);") +cpp_quote("EXTERN_C VOID WINAPI TF_InitMlngInfo(VOID);") cpp_quote("EXTERN_C INT WINAPI TF_MlngInfoCount(VOID);") -cpp_quote("EXTERN_C BOOL WINAPI TF_GetMlngHKL(_In_ INT iKL, _Out_ HKL *phKL, _Out_ LPWSTR pszText, _In_ INT cchText);") +cpp_quote("EXTERN_C BOOL WINAPI TF_GetMlngHKL(_In_ INT iKL, _Out_opt_ HKL *phKL, _Out_opt_ LPWSTR pszText, _In_ INT cchText);") cpp_quote("EXTERN_C INT WINAPI TF_GetMlngIconIndex(_In_ INT iKL);") cpp_quote("EXTERN_C HICON WINAPI TF_InatExtractIcon(_In_ INT iKL);") cpp_quote("EXTERN_C HRESULT WINAPI TF_RunInputCPL(VOID);") @@ -950,6 +950,38 @@ interface ITfTextEditSink : IUnknown [in] ITfEditRecord *pEditRecord); } +[ + object, + uuid(AA80E80C-2021-11D2-93E0-0060B067B86E), + pointer_default(unique) +] +interface ITfContextOwner : IUnknown +{ + HRESULT GetACPFromPoint( + [in] const POINT *ptScreen, + [in] DWORD dwFlags, + [out] LONG *pacp); + + HRESULT GetTextExt( + [in] LONG acpStart, + [in] LONG acpEnd, + [out] RECT *prc, + [out] BOOL *pfClipped); + + HRESULT GetScreenExt( + [out] RECT *prc); + + HRESULT GetStatus( + [out] TF_STATUS *pdcs); + + HRESULT GetWnd( + [out] HWND *phwnd); + + HRESULT GetAttribute( + [in] REFGUID rguidAttribute, + [out] VARIANT *pvarValue); +} + [ object, uuid(5F20AA40-B57A-4F34-96AB-3576F377CC79), diff --git a/sdk/include/psdk/shlobj.h b/sdk/include/psdk/shlobj.h index ba9f05b4878..3d27f328631 100644 --- a/sdk/include/psdk/shlobj.h +++ b/sdk/include/psdk/shlobj.h @@ -1832,11 +1832,11 @@ typedef enum RESTRICTIONS REST_NODETAILSTHUMBNAILONNETWORK = 0x40000094, #endif REST_NOINTERNETOPENWITH = 0x40000095, -#if (NTDDI_VERSION < NTDDI_VISTA) - REST_ALLOWLEGACYLMZBEHAVIOR = 0x40000096, /* not documented */ -#endif #endif #if (NTDDI_VERSION >= NTDDI_WINXPSP2) +#if (NTDDI_VERSION < NTDDI_VISTA) + REST_ALLOWLEGACYLMZBEHAVIOR = 0x4000009A, /* not documented */ +#endif REST_DONTRETRYBADNETNAME = 0x4000009B, REST_ALLOWFILECLSIDJUNCTIONS, REST_NOUPNPINSTALL, diff --git a/sdk/include/reactos/imm32_undoc.h b/sdk/include/reactos/imm32_undoc.h index a37c8ea4e58..184f6e13eac 100644 --- a/sdk/include/reactos/imm32_undoc.h +++ b/sdk/include/reactos/imm32_undoc.h @@ -13,7 +13,16 @@ extern "C" { #include -#define IS_IME_HKL(hkl) ((((ULONG_PTR)(hkl)) & 0xF0000000) == 0xE0000000) +#define IME_MASK (0xE0000000UL) +#define SUBST_MASK (0xD0000000UL) +#define SPECIAL_MASK (0xF0000000UL) + +#define IS_IME_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == IME_MASK) +#define IS_SPECIAL_HKL(hKL) ((((ULONG_PTR)(hKL)) & 0xF0000000) == SPECIAL_MASK) +#define SPECIALIDFROMHKL(hKL) ((WORD)(HIWORD(hKL) & 0x0FFF)) + +#define IS_IME_KLID(dwKLID) ((((ULONG)(dwKLID)) & 0xF0000000) == IME_MASK) +#define IS_SUBST_KLID(dwKLID) ((((ULONG)(dwKLID)) & 0xF0000000) == SUBST_MASK) typedef struct tagIMEINFOEX { diff --git a/sdk/include/reactos/shlwapi_undoc.h b/sdk/include/reactos/shlwapi_undoc.h index 1a46c7b7438..746284d2cb4 100644 --- a/sdk/include/reactos/shlwapi_undoc.h +++ b/sdk/include/reactos/shlwapi_undoc.h @@ -25,6 +25,27 @@ extern "C" { #endif /* defined(__cplusplus) */ +#define SHELL_NO_POLICY ((DWORD)-1) + +typedef struct tagPOLICYDATA +{ + DWORD policy; /* flags value passed to SHRestricted */ + LPCWSTR appstr; /* application str such as "Explorer" */ + LPCWSTR keystr; /* name of the actual registry key / policy */ +} POLICYDATA, *LPPOLICYDATA; + +HANDLE WINAPI SHGlobalCounterCreate(REFGUID guid); +PVOID WINAPI SHInterlockedCompareExchange(PVOID *dest, PVOID xchg, PVOID compare); +LONG WINAPI SHGlobalCounterGetValue(HANDLE hGlobalCounter); +LONG WINAPI SHGlobalCounterIncrement(HANDLE hGlobalCounter); + +DWORD WINAPI +SHRestrictionLookup( + _In_ DWORD policy, + _In_ LPCWSTR key, + _In_ const POLICYDATA *polTable, + _Inout_ LPDWORD polArr); + BOOL WINAPI SHAboutInfoA(LPSTR lpszDest, DWORD dwDestLen); BOOL WINAPI SHAboutInfoW(LPWSTR lpszDest, DWORD dwDestLen); #ifdef UNICODE diff --git a/sdk/include/reactos/undocshell.h b/sdk/include/reactos/undocshell.h index 5d0689827f9..8f180604359 100644 --- a/sdk/include/reactos/undocshell.h +++ b/sdk/include/reactos/undocshell.h @@ -49,14 +49,12 @@ typedef struct _TRAYNOTIFYDATAW #endif /* defined (_SHELLAPI_H) || defined (_INC_SHELLAPI) */ - /**************************************************************************** * Taskbar WM_COMMAND identifiers */ #define TWM_DOEXITWINDOWS (WM_USER + 342) #define TWM_CYCLEFOCUS (WM_USER + 348) - /**************************************************************************** * IDList Functions */ @@ -96,7 +94,6 @@ HRESULT WINAPI SHILCreateFromPathW ( BOOL WINAPI StrRetToStrNA(LPSTR,DWORD,LPSTRRET,const ITEMIDLIST*); BOOL WINAPI StrRetToStrNW(LPWSTR,DWORD,LPSTRRET,const ITEMIDLIST*); - /**************************************************************************** * SHChangeNotifyRegister API */ @@ -258,6 +255,7 @@ ExtractIconResInfoW( /**************************************************************************** * File Menu Routines */ + /* FileMenu_Create nSelHeight constants */ #define FM_DEFAULT_SELHEIGHT -1 #define FM_FULL_SELHEIGHT 0 @@ -732,6 +730,8 @@ Activate_RunDLL( _In_ LPCWSTR cmdline, _In_ INT cmdshow); +BOOL WINAPI SHSettingsChanged(LPCVOID unused, LPCWSTR pszKey); + /***************************************************************************** * Shell32 resources */ diff --git a/sdk/include/xdk/arm/ke.h b/sdk/include/xdk/arm/ke.h index dc344b30c11..5a611a0dfde 100644 --- a/sdk/include/xdk/arm/ke.h +++ b/sdk/include/xdk/arm/ke.h @@ -334,14 +334,13 @@ typedef struct _KPCR } KPCR, *PKPCR; #define CP15_PCR_RESERVED_MASK 0xFFF -//#define KIPCR() ((ULONG_PTR)(_MoveFromCoprocessor(CP15_TPIDRPRW)) & ~CP15_PCR_RESERVED_MASK) +#define KIPCR() (((ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRPRW)) & ~CP15_PCR_RESERVED_MASK) FORCEINLINE PKPCR -KeGetPcr( - VOID) +KeGetPcr(VOID) { - return (PKPCR)(_MoveFromCoprocessor(CP15_TPIDRPRW) & ~CP15_PCR_RESERVED_MASK); + return (PKPCR)KIPCR(); } #if (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS) @@ -349,8 +348,8 @@ FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID) { - return *((PUCHAR)KeGetPcr() + 0x580); + return (ULONG)*((PUCHAR)KIPCR() + 0x580); } #endif /* (NTDDI_VERSION < NTDDI_WIN7) || !defined(NT_PROCESSOR_GROUPS) */ -$endif +$endif (_NTDDK_) diff --git a/sdk/include/xdk/winnt_old.h b/sdk/include/xdk/winnt_old.h index 08443624d29..f8c375d104f 100644 --- a/sdk/include/xdk/winnt_old.h +++ b/sdk/include/xdk/winnt_old.h @@ -4297,7 +4297,7 @@ RtlSecureZeroMemory(_Out_writes_bytes_all_(Length) PVOID Buffer, } #if defined(_M_IX86) -FORCEINLINE struct _TEB * NtCurrentTeb(void) +FORCEINLINE struct _TEB * NtCurrentTeb(VOID) { return (struct _TEB *)__readfsdword(0x18); } @@ -4306,17 +4306,17 @@ FORCEINLINE PVOID GetCurrentFiber(VOID) return (PVOID)(ULONG_PTR)__readfsdword(0x10); } #elif defined (_M_AMD64) -FORCEINLINE struct _TEB * NtCurrentTeb(void) +FORCEINLINE struct _TEB * NtCurrentTeb(VOID) { return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self)); } FORCEINLINE PVOID GetCurrentFiber(VOID) { - #ifdef NONAMELESSUNION +#ifdef NONAMELESSUNION return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, DUMMYUNIONNAME.FiberData)); - #else +#else return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, FiberData)); - #endif +#endif } #elif defined (_M_ARM) #define CP15_PMSELR 15, 0, 9, 12, 5 @@ -4324,20 +4324,20 @@ FORCEINLINE PVOID GetCurrentFiber(VOID) #define CP15_TPIDRURW 15, 0, 13, 0, 2 #define CP15_TPIDRURO 15, 0, 13, 0, 3 #define CP15_TPIDRPRW 15, 0, 13, 0, 4 -FORCEINLINE struct _TEB * NtCurrentTeb(void) +FORCEINLINE struct _TEB * NtCurrentTeb(VOID) { return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW); } FORCEINLINE PVOID GetCurrentFiber(VOID) { - #ifdef NONAMELESSUNION - return ((PNT_TIB )(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->DUMMYUNIONNAME.FiberData; - #else - return ((PNT_TIB )(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->FiberData; - #endif +#ifdef NONAMELESSUNION + return ((PNT_TIB)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->DUMMYUNIONNAME.FiberData; +#else + return ((PNT_TIB)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->FiberData; +#endif } #elif defined (_M_ARM64) -FORCEINLINE struct _TEB * NtCurrentTeb(void) +FORCEINLINE struct _TEB * NtCurrentTeb(VOID) { //UNIMPLEMENTED; return 0; @@ -4358,11 +4358,11 @@ FORCEINLINE unsigned long _read_teb_dword(const unsigned long Offset) : "r7"); return result; } -FORCEINLINE struct _TEB * NtCurrentTeb(void) +FORCEINLINE struct _TEB * NtCurrentTeb(VOID) { return (struct _TEB *)_read_teb_dword(0x18); } -FORCEINLINE PVOID GetCurrentFiber(void) +FORCEINLINE PVOID GetCurrentFiber(VOID) { return _read_teb_dword(0x10); } @@ -4370,7 +4370,7 @@ FORCEINLINE PVOID GetCurrentFiber(void) #error Unknown architecture #endif -FORCEINLINE PVOID GetFiberData(void) +FORCEINLINE PVOID GetFiberData(VOID) { return *((PVOID *)GetCurrentFiber()); } @@ -4397,7 +4397,7 @@ FORCEINLINE PVOID GetFiberData(void) #if defined(_MSC_VER) FORCEINLINE VOID -MemoryBarrier (VOID) +MemoryBarrier(VOID) { LONG Barrier; __asm { xchg Barrier, eax } diff --git a/sdk/include/xdk/x86/ke.h b/sdk/include/xdk/x86/ke.h index b367a93d1b5..713eff15061 100644 --- a/sdk/include/xdk/x86/ke.h +++ b/sdk/include/xdk/x86/ke.h @@ -283,8 +283,6 @@ typedef struct _CONTEXT { } CONTEXT; #include "poppack.h" -#define KeGetPcr() PCR - #define PCR_MINOR_VERSION 1 #define PCR_MAJOR_VERSION 1 @@ -325,6 +323,18 @@ typedef struct _KPCR { ULONG HalReserved[16]; } KPCR, *PKPCR; +/* NOTE: This macro is not exposed in the DDK/WDK for _M_IX86. + * If it were, this would be its definition. */ +#if 0 +// #define KeGetPcr() ((PKPCR)__readfsdword(FIELD_OFFSET(KPCR, SelfPcr))) +FORCEINLINE +PKPCR +KeGetPcr(VOID) +{ + return (PKPCR)__readfsdword(FIELD_OFFSET(KPCR, SelfPcr)); +} +#endif + #if (NTDDI_VERSION >= NTDDI_WIN7) _CRT_DEPRECATE_TEXT("KeGetCurrentProcessorNumber is deprecated. Use KeGetCurrentProcessorNumberEx or KeGetCurrentProcessorIndex instead.") #endif diff --git a/win32ss/user/ntuser/msgqueue.c b/win32ss/user/ntuser/msgqueue.c index c8ae61ad4eb..b704dbce5ca 100644 --- a/win32ss/user/ntuser/msgqueue.c +++ b/win32ss/user/ntuser/msgqueue.c @@ -1986,8 +1986,7 @@ co_MsqPeekHardwareMessage(IN PTHREADINFO pti, ( Window == PWND_BOTTOM && CurrentMessage->Msg.hwnd == NULL ) || // 2 ( Window != PWND_BOTTOM && UserHMGetHandle(Window) == CurrentMessage->Msg.hwnd ) || // 3 ( is_mouse_message(CurrentMessage->Msg.message) ) ) && // Null window for anything mouse. - ( ( ( MsgFilterLow == 0 && MsgFilterHigh == 0 ) && CurrentMessage->QS_Flags & QSflags ) || - ( MsgFilterLow <= CurrentMessage->Msg.message && MsgFilterHigh >= CurrentMessage->Msg.message ) ) ) + ( CurrentMessage->QS_Flags & QSflags ) ) { idSave = MessageQueue->idSysPeek; MessageQueue->idSysPeek = (ULONG_PTR)CurrentMessage; @@ -2000,6 +1999,13 @@ co_MsqPeekHardwareMessage(IN PTHREADINFO pti, UpdateKeyStateFromMsg(MessageQueue, &msg); AcceptMessage = co_IntProcessHardwareMessage(&msg, &Remove, &NotForUs, ExtraInfo, MsgFilterLow, MsgFilterHigh); + + if (MsgFilterLow != 0 || MsgFilterHigh != 0) + { + /* Don't return message if not in range */ + if (msg.message < MsgFilterLow || msg.message > MsgFilterHigh) + AcceptMessage = FALSE; + } if (Remove) { diff --git a/win32ss/user/ntuser/nonclient.c b/win32ss/user/ntuser/nonclient.c index a3852066b69..796f5772690 100644 --- a/win32ss/user/ntuser/nonclient.c +++ b/win32ss/user/ntuser/nonclient.c @@ -394,11 +394,13 @@ DefWndDoSizeMove(PWND pwnd, WORD wParam) if (msg.message == WM_KEYDOWN && (msg.wParam == VK_RETURN || msg.wParam == VK_ESCAPE)) break; // Exit on Return or Esc - if (!g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP)) + if (!g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP || + (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0))) { // If no WindowSnapEnabled: Exit on button-up immediately break; } - else if (g_bWindowSnapEnabled && msg.message == WM_LBUTTONUP) + else if (g_bWindowSnapEnabled && (msg.message == WM_LBUTTONUP || + (msg.message == WM_MOUSEMOVE && (msg.wParam & MK_LBUTTON) == 0))) { // If WindowSnapEnabled: Decide whether to snap before exiting DWORD ExStyleTB, StyleTB; BOOL IsTaskBar; diff --git a/win32ss/user/user32/windows/cursoricon.c b/win32ss/user/user32/windows/cursoricon.c index a3f8a48602e..eb160a88c13 100644 --- a/win32ss/user/user32/windows/cursoricon.c +++ b/win32ss/user/user32/windows/cursoricon.c @@ -179,6 +179,12 @@ static int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, LONG *height, WORD *bpp, DWORD *compr ) { + #define CR 13 + #define LF 10 + #define EOFM 26 // DOS End Of File Marker + #define HighBitDetect 0x89 // Byte with high bit set to test if not 7-bit + /* wine's definition */ + static const BYTE png_sig_pattern[] = { HighBitDetect, 'P', 'N', 'G', CR, LF, EOFM, LF }; if (header->biSize == sizeof(BITMAPCOREHEADER)) { const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)header; @@ -198,7 +204,15 @@ static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, *compr = header->biCompression; return 1; } - ERR("(%d): unknown/wrong size for header\n", header->biSize ); + if (memcmp(&header->biSize, png_sig_pattern, sizeof(png_sig_pattern)) == 0) + { + ERR("Cannot yet display PNG icons\n"); + /* for PNG format details see https://en.wikipedia.org/wiki/PNG */ + } + else + { + ERR("Unknown/wrong size for header of 0x%x\n", header->biSize ); + } return -1; } @@ -1377,7 +1391,10 @@ CURSORICON_LoadFromFileW( /* Do the dance */ if(!CURSORICON_GetCursorDataFromBMI(&cursorData, (BITMAPINFO*)(&bits[entry->dwDIBOffset]))) - goto end; + { + ERR("Failing File is \n '%S'.\n", lpszName); + goto end; + } hCurIcon = NtUserxCreateEmptyCurObject(FALSE); if(!hCurIcon)