Skip to content

Commit 41971e2

Browse files
[PowerRename]Don't crash dllhost on right-click (#19723)
* Add version to PowerRename context menu * [PowerRename]Don't crash dllhost on right-click
1 parent 223de59 commit 41971e2

File tree

3 files changed

+47
-62
lines changed

3 files changed

+47
-62
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,40 @@
1-
// Microsoft Visual C++ generated resource script.
2-
//
3-
1+
#include <windows.h>
42
#include "resource.h"
3+
#include "../../../common/version/version.h"
54

65
#define APSTUDIO_READONLY_SYMBOLS
7-
/////////////////////////////////////////////////////////////////////////////
8-
//
9-
// Generated from the TEXTINCLUDE 2 resource.
10-
//
116
#include "winres.h"
12-
13-
/////////////////////////////////////////////////////////////////////////////
147
#undef APSTUDIO_READONLY_SYMBOLS
158

16-
/////////////////////////////////////////////////////////////////////////////
17-
// English (United States) resources
18-
19-
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20-
LANGUAGE 9, 1
21-
22-
#ifdef APSTUDIO_INVOKED
23-
/////////////////////////////////////////////////////////////////////////////
24-
//
25-
// TEXTINCLUDE
26-
//
27-
28-
1 TEXTINCLUDE
29-
BEGIN
30-
"resource.h\0"
31-
END
32-
33-
2 TEXTINCLUDE
34-
BEGIN
35-
"#include ""winres.h""\r\n"
36-
"\0"
37-
END
38-
39-
3 TEXTINCLUDE
9+
1 VERSIONINFO
10+
FILEVERSION FILE_VERSION
11+
PRODUCTVERSION PRODUCT_VERSION
12+
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
13+
#ifdef _DEBUG
14+
FILEFLAGS VS_FF_DEBUG
15+
#else
16+
FILEFLAGS 0x0L
17+
#endif
18+
FILEOS VOS_NT_WINDOWS32
19+
FILETYPE VFT_DLL
20+
FILESUBTYPE VFT2_UNKNOWN
4021
BEGIN
41-
"\r\n"
42-
"\0"
22+
BLOCK "StringFileInfo"
23+
BEGIN
24+
BLOCK "040904b0" // US English (0x0409), Unicode (0x04B0) charset
25+
BEGIN
26+
VALUE "CompanyName", COMPANY_NAME
27+
VALUE "FileDescription", FILE_DESCRIPTION
28+
VALUE "FileVersion", FILE_VERSION_STRING
29+
VALUE "InternalName", INTERNAL_NAME
30+
VALUE "LegalCopyright", COPYRIGHT_NOTE
31+
VALUE "OriginalFilename", ORIGINAL_FILENAME
32+
VALUE "ProductName", PRODUCT_NAME
33+
VALUE "ProductVersion", PRODUCT_VERSION_STRING
34+
END
35+
END
36+
BLOCK "VarFileInfo"
37+
BEGIN
38+
VALUE "Translation", 0x409, 1200 // US English (0x0409), Unicode (1200) charset
39+
END
4340
END
44-
45-
#endif // APSTUDIO_INVOKED
46-
47-
#endif // English (United States) resources
48-
/////////////////////////////////////////////////////////////////////////////
49-
50-
51-
52-
#ifndef APSTUDIO_INVOKED
53-
/////////////////////////////////////////////////////////////////////////////
54-
//
55-
// Generated from the TEXTINCLUDE 3 resource.
56-
//
57-
58-
59-
/////////////////////////////////////////////////////////////////////////////
60-
#endif // not APSTUDIO_INVOKED

src/modules/powerrename/PowerRenameContextMenu/dllmain.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ class __declspec(uuid("1861E28B-A1F0-4EF4-A1FE-4C8CA88E2174")) PowerRenameContex
9393
{
9494
*cmdState = ECS_ENABLED;
9595

96+
// 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.
97+
if (nullptr == selection) {
98+
*cmdState = ECS_HIDDEN;
99+
return S_OK;
100+
}
101+
96102
if (!CSettingsInstance().GetEnabled())
97103
{
98104
*cmdState = ECS_HIDDEN;

src/modules/powerrename/PowerRenameContextMenu/resource.h

+9-10
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
// Microsoft Visual C++ generated include file.
33
// Used by PowerRenameContextMenu.rc
44

5-
// Next default values for new objects
6-
//
7-
#ifdef APSTUDIO_INVOKED
8-
#ifndef APSTUDIO_READONLY_SYMBOLS
9-
#define _APS_NEXT_RESOURCE_VALUE 101
10-
#define _APS_NEXT_COMMAND_VALUE 40001
11-
#define _APS_NEXT_CONTROL_VALUE 1001
12-
#define _APS_NEXT_SYMED_VALUE 101
13-
#endif
14-
#endif
5+
//////////////////////////////
6+
// Non-localizable
7+
8+
#define FILE_DESCRIPTION "PowerToys Rename Context Menu"
9+
#define INTERNAL_NAME "PowerToys.PowerRenameContextMenu"
10+
#define ORIGINAL_FILENAME "PowerToys.PowerRenameContextMenu.dll"
11+
12+
// Non-localizable
13+
//////////////////////////////

0 commit comments

Comments
 (0)