Skip to content

Commit

Permalink
Update system integration for Windows 11, issue #347, issue #367.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Sep 5, 2021
1 parent 57426ea commit 3b27a22
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Latest development builds (artifacts in Release configuration for each compiler
* [AWK](../master/tools/lang/Awk.awk), up to GNU AWK 5.1.
* [Batch Script](../master/tools/lang/Batch.bat), [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#batch)
* [C#](../master/tools/lang/CSharp.cs), up to C# 10.0. [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#c)
[Vala](https://wiki.gnome.org/Projects/Vala) 0.54
* [Vala](https://wiki.gnome.org/Projects/Vala) 0.54
* C/C++, [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#cc)
* Objective-C/C++, [Screenshots](https://github.com/zufuliu/notepad2/wiki/Screenshots#objective-cc)
* [C Standard Library](../master/tools/lang/C.c), up to C2x.
Expand Down
29 changes: 26 additions & 3 deletions src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2522,8 +2522,20 @@ HKEY_CLASSES_ROOT\Applications\Notepad2.exe
(Default) REG_SZ "Notepad2.exe" "%1"
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe
Debugger REG_SZ "Notepad2.exe" /z
UseFilter REG_DWORD 0
Debugger REG_SZ "Notepad2.exe" /z
UseFilter REG_DWORD 0
0
AppExecutionAliasRedirect REG_DWORD 1
AppExecutionAliasRedirectPackages REG_SZ *
FilterFullPath REG_SZ "Notepad2.exe"
1
AppExecutionAliasRedirect REG_DWORD 1
AppExecutionAliasRedirectPackages REG_SZ *
FilterFullPath REG_SZ "Notepad2.exe"
2
AppExecutionAliasRedirect REG_DWORD 1
AppExecutionAliasRedirectPackages REG_SZ *
FilterFullPath REG_SZ "Notepad2.exe"
*/
extern BOOL fIsElevated;
extern int flagUseSystemMRU;
Expand Down Expand Up @@ -2657,11 +2669,22 @@ void UpdateSystemIntegrationStatus(int mask, LPCWSTR lpszText, LPCWSTR lpszName)
// replace Windows Notepad
if (mask & SystemIntegration_ReplaceNotepad) {
HKEY hKey;
const LSTATUS status = Registry_CreateKey(HKEY_LOCAL_MACHINE, NP2RegSubKey_ReplaceNotepad, &hKey);
LSTATUS status = Registry_CreateKey(HKEY_LOCAL_MACHINE, NP2RegSubKey_ReplaceNotepad, &hKey);
if (status == ERROR_SUCCESS) {
wsprintf(command, L"\"%s\" /z", tchModule);
Registry_SetString(hKey, L"Debugger", command);
Registry_SetInt(hKey, L"UseFilter", 0);
for (WCHAR ch = 0; ch < 3; ch ++) {
const WCHAR num[2] = { ch + '0', L'\0' };
HKEY hSubKey;
status = Registry_CreateKey(hKey, num, &hSubKey);
if (status == ERROR_SUCCESS) {
Registry_SetInt(hSubKey, L"AppExecutionAliasRedirect", 1);
Registry_SetString(hSubKey, L"AppExecutionAliasRedirectPackages", L"*");
Registry_SetString(hSubKey, L"FilterFullPath", tchModule);
RegCloseKey(hSubKey);
}
}
RegCloseKey(hKey);
}
} else if (mask & SystemIntegration_RestoreNotepad) {
Expand Down
2 changes: 1 addition & 1 deletion wiki
Submodule wiki updated from 92d09b to d92463

0 comments on commit 3b27a22

Please sign in to comment.