Skip to content

Commit

Permalink
[PowerRename]Don't crash dllhost on right-click (#19723)
Browse files Browse the repository at this point in the history
* Add version to PowerRename context menu

* [PowerRename]Don't crash dllhost on right-click
  • Loading branch information
jaimecbernardo committed Aug 2, 2022
1 parent 223de59 commit 41971e2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,60 +1,40 @@
// Microsoft Visual C++ generated resource script.
//

#include <windows.h>
#include "resource.h"
#include "../../../common/version/version.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
"resource.h\0"
END

2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END

3 TEXTINCLUDE
1 VERSIONINFO
FILEVERSION FILE_VERSION
PRODUCTVERSION PRODUCT_VERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_UNKNOWN
BEGIN
"\r\n"
"\0"
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION
VALUE "FileVersion", FILE_VERSION_STRING
VALUE "InternalName", INTERNAL_NAME
VALUE "LegalCopyright", COPYRIGHT_NOTE
VALUE "OriginalFilename", ORIGINAL_FILENAME
VALUE "ProductName", PRODUCT_NAME
VALUE "ProductVersion", PRODUCT_VERSION_STRING
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
END
END

#endif // APSTUDIO_INVOKED

#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
6 changes: 6 additions & 0 deletions src/modules/powerrename/PowerRenameContextMenu/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ class __declspec(uuid("1861E28B-A1F0-4EF4-A1FE-4C8CA88E2174")) PowerRenameContex
{
*cmdState = ECS_ENABLED;

// We've observed that it's possible that a null gets passed instead of an empty array. Just don't show the context menu in this case.
if (nullptr == selection) {
*cmdState = ECS_HIDDEN;
return S_OK;
}

if (!CSettingsInstance().GetEnabled())
{
*cmdState = ECS_HIDDEN;
Expand Down
19 changes: 9 additions & 10 deletions src/modules/powerrename/PowerRenameContextMenu/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
// Microsoft Visual C++ generated include file.
// Used by PowerRenameContextMenu.rc

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
//////////////////////////////
// Non-localizable

#define FILE_DESCRIPTION "PowerToys Rename Context Menu"
#define INTERNAL_NAME "PowerToys.PowerRenameContextMenu"
#define ORIGINAL_FILENAME "PowerToys.PowerRenameContextMenu.dll"

// Non-localizable
//////////////////////////////

0 comments on commit 41971e2

Please sign in to comment.