├── .gitignore
├── AntiShiftDelete.sln
├── AntiShiftDeleteExt
├── AntiShiftDeleteExt.aps
├── AntiShiftDeleteExt.cpp
├── AntiShiftDeleteExt.def
├── AntiShiftDeleteExt.idl
├── AntiShiftDeleteExt.rc
├── AntiShiftDeleteExt.rgs
├── AntiShiftDeleteExt.vcxproj
├── AntiShiftDeleteExt.vcxproj.filters
├── AntiShiftDeleteExt.vcxproj.user
├── AntiShiftDeleteExtps.def
├── CFileOperation.cpp
├── CFileOperation.h
├── FakeShellIconOverlayIdentifier.cpp
├── FakeShellIconOverlayIdentifier.h
├── FakeShellIconOverlayIdentifier.rgs
├── Resource.h
├── compreg.cpp
├── compreg.h
├── dlldata.c
├── dllmain.cpp
├── dllmain.h
├── framework.h
├── include
│ ├── detours.h
│ ├── detver.h
│ └── syelog.h
├── lib.X64
│ ├── detours.lib
│ ├── detours.pdb
│ └── syelog.lib
├── lib.X86
│ ├── detours.lib
│ ├── detours.pdb
│ └── syelog.lib
├── pch.cpp
├── pch.h
└── targetver.h
├── AntiShiftDeleteExtPS
├── AntiShiftDeleteExtPS.vcxproj
├── AntiShiftDeleteExtPS.vcxproj.filters
└── AntiShiftDeleteExtPS.vcxproj.user
├── LICENSE
├── README.md
├── README.zh-cn.md
└── installer
├── AntiShiftDelete.ico
├── AntiShiftDelete.nsi
├── EVRootCA.reg
└── license.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | .vs/
2 | .vscode/
3 |
4 | Win32/
5 | x64/
6 |
7 | AntiShiftDeleteExt/Win32/
8 | AntiShiftDeleteExt/x64/
9 | AntiShiftDeleteExt/AntiShiftDeleteExt_p.c
10 | AntiShiftDeleteExt/AntiShiftDeleteExt_i.c
11 | AntiShiftDeleteExt/AntiShiftDeleteExt_i.h
12 |
13 | installer/*.exe
--------------------------------------------------------------------------------
/AntiShiftDelete.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30011.22
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AntiShiftDeleteExt", "AntiShiftDeleteExt\AntiShiftDeleteExt.vcxproj", "{44904CAD-9DFE-41A7-8FBB-15A779ACEB01}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AntiShiftDeleteExtPS", "AntiShiftDeleteExtPS\AntiShiftDeleteExtPS.vcxproj", "{B9AB9847-71A2-41D6-B8DB-C042ED477768}"
9 | ProjectSection(ProjectDependencies) = postProject
10 | {44904CAD-9DFE-41A7-8FBB-15A779ACEB01} = {44904CAD-9DFE-41A7-8FBB-15A779ACEB01}
11 | EndProjectSection
12 | EndProject
13 | Global
14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 | Release|x64 = Release|x64
16 | Release|x86 = Release|x86
17 | EndGlobalSection
18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
19 | {44904CAD-9DFE-41A7-8FBB-15A779ACEB01}.Release|x64.ActiveCfg = Release|x64
20 | {44904CAD-9DFE-41A7-8FBB-15A779ACEB01}.Release|x64.Build.0 = Release|x64
21 | {44904CAD-9DFE-41A7-8FBB-15A779ACEB01}.Release|x86.ActiveCfg = Release|Win32
22 | {44904CAD-9DFE-41A7-8FBB-15A779ACEB01}.Release|x86.Build.0 = Release|Win32
23 | {B9AB9847-71A2-41D6-B8DB-C042ED477768}.Release|x64.ActiveCfg = Release|x64
24 | {B9AB9847-71A2-41D6-B8DB-C042ED477768}.Release|x86.ActiveCfg = Release|Win32
25 | EndGlobalSection
26 | GlobalSection(SolutionProperties) = preSolution
27 | HideSolutionNode = FALSE
28 | EndGlobalSection
29 | GlobalSection(ExtensibilityGlobals) = postSolution
30 | SolutionGuid = {6AC8E854-21BD-4CF7-84C5-FDDC97547D53}
31 | EndGlobalSection
32 | EndGlobal
33 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExt.aps:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/AntiShiftDeleteExt/AntiShiftDeleteExt.aps
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExt.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "framework.h"
3 | #include "resource.h"
4 | #include "AntiShiftDeleteExt_i.h"
5 | #include "dllmain.h"
6 | #include "compreg.h"
7 |
8 |
9 | using namespace ATL;
10 |
11 | _Use_decl_annotations_
12 | STDAPI DllCanUnloadNow(void)
13 | {
14 | /*
15 | return _AtlModule.DllCanUnloadNow();
16 | */
17 |
18 | /* To prevent the ShellExt from being unloaded, must return S_FALSE */
19 | return S_FALSE;
20 | }
21 |
22 | _Use_decl_annotations_
23 | STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv)
24 | {
25 | return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
26 | }
27 |
28 | _Use_decl_annotations_
29 | STDAPI DllRegisterServer(void)
30 | {
31 | HRESULT hr = _AtlModule.DllRegisterServer(FALSE);
32 | return hr;
33 | }
34 |
35 | _Use_decl_annotations_
36 | STDAPI DllUnregisterServer(void)
37 | {
38 | HRESULT hr = _AtlModule.DllUnregisterServer(FALSE);
39 | return hr;
40 | }
41 |
42 | STDAPI DllInstall(BOOL bInstall, _In_opt_ LPCWSTR pszCmdLine)
43 | {
44 | HRESULT hr = E_FAIL;
45 | static const wchar_t szUserSwitch[] = L"user";
46 |
47 | if (pszCmdLine != nullptr)
48 | {
49 | if (_wcsnicmp(pszCmdLine, szUserSwitch, _countof(szUserSwitch)) == 0)
50 | {
51 | ATL::AtlSetPerUserRegistration(true);
52 | }
53 | }
54 |
55 | if (bInstall)
56 | {
57 | hr = DllRegisterServer();
58 | if (FAILED(hr))
59 | {
60 | DllUnregisterServer();
61 | }
62 | }
63 | else
64 | {
65 | hr = DllUnregisterServer();
66 | }
67 |
68 | return hr;
69 | }
70 |
71 |
72 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExt.def:
--------------------------------------------------------------------------------
1 | ; AntiShiftDeleteExt.def: 声明模块参数。
2 |
3 | LIBRARY
4 |
5 | EXPORTS
6 | DllCanUnloadNow PRIVATE
7 | DllGetClassObject PRIVATE
8 | DllRegisterServer PRIVATE
9 | DllUnregisterServer PRIVATE
10 | DllInstall PRIVATE
11 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExt.idl:
--------------------------------------------------------------------------------
1 | // AntiShiftDeleteExt.idl: AntiShiftDeleteExt 的 IDL 源
2 | //
3 |
4 | // 此文件将由 MIDL 工具处理以
5 | // 生成类型库(AntiShiftDeleteExt.tlb)和封送处理代码。
6 |
7 | import "oaidl.idl";
8 | import "ocidl.idl";
9 |
10 | [
11 | object,
12 | uuid(a817e7a2-43fa-11d0-9e44-00aa00b6770a),
13 | dual,
14 | pointer_default(unique)
15 | ]
16 | interface IComponentRegistrar : IDispatch
17 | {
18 | [id(1)] HRESULT Attach([in] BSTR bstrPath);
19 | [id(2)] HRESULT RegisterAll();
20 | [id(3)] HRESULT UnregisterAll();
21 | [id(4)] HRESULT GetComponents([out] SAFEARRAY(BSTR)* pbstrCLSIDs, [out] SAFEARRAY(BSTR)* pbstrDescriptions);
22 | [id(5)] HRESULT RegisterComponent([in] BSTR bstrCLSID);
23 | [id(6)] HRESULT UnregisterComponent([in] BSTR bstrCLSID);
24 | };
25 |
26 | [
27 | object,
28 | uuid(9c8576fd-c984-411d-815e-bc4d2e9a9287),
29 | pointer_default(unique)
30 | ]
31 | interface IFakeShellIconOverlayIdentifier : IUnknown
32 | {
33 | };
34 | [
35 | uuid(8dfe808e-bdb6-4387-8880-4102ab4fb322),
36 | version(1.0),
37 | custom(a817e7a1-43fa-11d0-9e44-00aa00b6770a,"{e2bf26ce-52ed-4024-a7cd-d3501e5a4b7a}")
38 | ]
39 | library AntiShiftDeleteExtLib
40 | {
41 | importlib("stdole2.tlb");
42 | [
43 | uuid(e2bf26ce-52ed-4024-a7cd-d3501e5a4b7a)
44 | ]
45 | coclass CompReg
46 | {
47 | [default] interface IComponentRegistrar;
48 | };
49 | [
50 | uuid(e330aee1-e4c8-4a8d-8436-370c14e708a1)
51 | ]
52 | coclass FakeShellIconOverlayIdentifier
53 | {
54 | [default] interface IFakeShellIconOverlayIdentifier;
55 | };
56 | };
57 |
58 | import "shobjidl.idl";
59 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExt.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/AntiShiftDeleteExt/AntiShiftDeleteExt.rc
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExt.rgs:
--------------------------------------------------------------------------------
1 | HKCR
2 | {
3 | NoRemove CLSID
4 | {
5 | ForceRemove {e2bf26ce-52ed-4024-a7cd-d3501e5a4b7a} = s 'AntiShiftDelete Shell Extension'
6 | {
7 | InprocServer32 = s '%MODULE%'
8 | {
9 | val ThreadingModel = s 'Apartment'
10 | }
11 | TypeLib = s '{8dfe808e-bdb6-4387-8880-4102ab4fb322}'
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExt.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Release
6 | Win32
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 | 16.0
15 | {44904CAD-9DFE-41A7-8FBB-15A779ACEB01}
16 | AtlProj
17 | 10.0
18 |
19 |
20 |
21 | DynamicLibrary
22 | false
23 | v142
24 | MultiByte
25 | true
26 |
27 |
28 | DynamicLibrary
29 | false
30 | v142
31 | MultiByte
32 | true
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | include;$(VC_IncludePath);$(WindowsSDK_IncludePath);
48 | lib.X86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86)
49 | $(Platform)\$(Configuration)\
50 | $(SolutionDir)$(Platform)\$(Configuration)\
51 |
52 |
53 | include;$(VC_IncludePath);$(WindowsSDK_IncludePath);
54 | lib.X64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)
55 | $(Platform)\$(Configuration)\
56 | $(SolutionDir)$(Platform)\$(Configuration)\
57 |
58 |
59 |
60 | Level3
61 | MinSpace
62 | WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)
63 | pch.h
64 | true
65 | false
66 | ProgramDatabase
67 | true
68 | false
69 |
70 |
71 | false
72 | Win32
73 | NDEBUG;%(PreprocessorDefinitions)
74 | AntiShiftDeleteExt_i.h
75 | AntiShiftDeleteExt_i.c
76 | AntiShiftDeleteExt_p.c
77 | true
78 | $(IntDir)AntiShiftDeleteExt.tlb
79 |
80 | true
81 |
82 |
83 | 0x0804
84 | $(IntDir);%(AdditionalIncludeDirectories)
85 | NDEBUG;%(PreprocessorDefinitions)
86 |
87 |
88 | Windows
89 | .\AntiShiftDeleteExt.def
90 | detours.lib;comsvcs.lib;%(AdditionalDependencies)
91 | true
92 | true
93 | true
94 | false
95 |
96 |
97 |
98 |
99 | Use
100 | Level3
101 | MinSpace
102 | _WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)
103 | pch.h
104 | true
105 | false
106 | ProgramDatabase
107 | true
108 | false
109 |
110 |
111 | false
112 | NDEBUG;%(PreprocessorDefinitions)
113 | AntiShiftDeleteExt_i.h
114 | AntiShiftDeleteExt_i.c
115 | AntiShiftDeleteExt_p.c
116 | true
117 | $(IntDir)AntiShiftDeleteExt.tlb
118 |
119 | true
120 |
121 |
122 | 0x0804
123 | $(IntDir);%(AdditionalIncludeDirectories)
124 | NDEBUG;%(PreprocessorDefinitions)
125 |
126 |
127 | Windows
128 | .\AntiShiftDeleteExt.def
129 | detours.lib;comsvcs.lib;%(AdditionalDependencies)
130 | true
131 | true
132 | true
133 | false
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 | false
151 | false
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 | false
161 | false
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 | Create
170 | Create
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExt.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {c177a4ec-2bb6-4ebf-ac74-a32aab4ac245}
18 | False
19 |
20 |
21 |
22 |
23 | 头文件
24 |
25 |
26 | 头文件
27 |
28 |
29 | 头文件
30 |
31 |
32 | 头文件
33 |
34 |
35 | 头文件
36 |
37 |
38 | 生成的文件
39 |
40 |
41 | 头文件
42 |
43 |
44 | 头文件
45 |
46 |
47 | 头文件
48 |
49 |
50 |
51 |
52 | 源文件
53 |
54 |
55 | 源文件
56 |
57 |
58 | 源文件
59 |
60 |
61 | 生成的文件
62 |
63 |
64 | 源文件
65 |
66 |
67 | 源文件
68 |
69 |
70 | 源文件
71 |
72 |
73 |
74 |
75 | 资源文件
76 |
77 |
78 |
79 |
80 | 资源文件
81 |
82 |
83 | 源文件
84 |
85 |
86 | 资源文件
87 |
88 |
89 |
90 |
91 | 源文件
92 |
93 |
94 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExt.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/AntiShiftDeleteExtps.def:
--------------------------------------------------------------------------------
1 |
2 | LIBRARY
3 |
4 | EXPORTS
5 | DllGetClassObject PRIVATE
6 | DllCanUnloadNow PRIVATE
7 | DllRegisterServer PRIVATE
8 | DllUnregisterServer PRIVATE
9 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/CFileOperation.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "CFileOperation.h"
3 | #include
4 | #include
5 |
6 | using fntDeleteItem = decltype(DeleteItem);
7 | using fntDeleteItems = decltype(DeleteItems);
8 | using fntSetOperationFlags = decltype(SetOperationFlags);
9 | fntDeleteItem* pOldDeleteItem = NULL;
10 | fntDeleteItems* pOldDeleteItems = NULL;
11 | fntSetOperationFlags* pOldSetOperationFlags = NULL;
12 | DWORD dwOperationFlags = 0;
13 |
14 | STDMETHODIMP HookFileOperation()
15 | {
16 | HRESULT hr = S_OK;
17 | IFileOperation* pfo = NULL;
18 |
19 | if (!SUCCEEDED(hr = CoInitialize(NULL))
20 | || !SUCCEEDED(hr = CoCreateInstance(CLSID_FileOperation, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pfo))))
21 | return hr;
22 |
23 | /* Reference https://www.freebuf.com/column/134192.html */
24 | PVOID** vtbl = (PVOID**)pfo;
25 | pOldDeleteItem = (fntDeleteItem*)vtbl[0][DeleteItem_Index];
26 | pOldDeleteItems = (fntDeleteItems*)vtbl[0][DeleteItems_Index];
27 | pOldSetOperationFlags = (fntSetOperationFlags*)vtbl[0][SetOperationFlags_Index];
28 |
29 | if (DetourTransactionBegin() != NO_ERROR
30 | || DetourAttach(&(PVOID&)pOldDeleteItem, DeleteItem) != NO_ERROR
31 | || DetourAttach(&(PVOID&)pOldDeleteItems, DeleteItems) != NO_ERROR
32 | || DetourAttach(&(PVOID&)pOldSetOperationFlags, SetOperationFlags) != NO_ERROR
33 | || DetourTransactionCommit() != NO_ERROR)
34 | return E_FAIL;
35 |
36 | return S_OK;
37 | }
38 |
39 | STDMETHODIMP UnHookFileOperation()
40 | {
41 | if (DetourTransactionBegin() != NO_ERROR
42 | || DetourDetach(&(PVOID&)pOldDeleteItem, DeleteItem) != NO_ERROR
43 | || DetourDetach(&(PVOID&)pOldDeleteItems, DeleteItems) != NO_ERROR
44 | || DetourDetach(&(PVOID&)pOldSetOperationFlags, SetOperationFlags) != NO_ERROR
45 | || DetourTransactionCommit() != NO_ERROR)
46 | return E_FAIL;
47 |
48 | return S_OK;
49 | }
50 |
51 | STDMETHODIMP DeleteItem(
52 | IFileOperation* pfo,
53 | IShellItem* psiItem,
54 | IFileOperationProgressSink* pfopsItem
55 | )
56 | {
57 | BOOLEAN ALLOWUNDO = (dwOperationFlags & FOF_ALLOWUNDO) != 0;
58 | BOOLEAN RECYCLEONDELETE = (dwOperationFlags & FOFX_RECYCLEONDELETE) != 0;
59 | BOOLEAN RECYCLEBIN = dwOperationFlags == 0x4000110; /* Empty RecycleBin */
60 |
61 | if (!ALLOWUNDO && !RECYCLEONDELETE && !RECYCLEBIN) {
62 | MessageBeep(MB_ICONWARNING);
63 | return E_ABORT;
64 | }
65 |
66 | return (*pOldDeleteItem)(pfo, psiItem, pfopsItem);
67 | }
68 |
69 | STDMETHODIMP DeleteItems(
70 | IFileOperation* pfo,
71 | IUnknown* punkItems
72 | )
73 | {
74 | BOOLEAN ALLOWUNDO = (dwOperationFlags & FOF_ALLOWUNDO) != 0;
75 | BOOLEAN RECYCLEONDELETE = (dwOperationFlags & FOFX_RECYCLEONDELETE) != 0;
76 | BOOLEAN RECYCLEBIN = dwOperationFlags == 0x4000110; /* Empty RecycleBin */
77 |
78 | if (!ALLOWUNDO && !RECYCLEONDELETE && !RECYCLEBIN) {
79 | MessageBeep(MB_ICONWARNING);
80 | return E_ABORT;
81 | }
82 |
83 | return (*pOldDeleteItems)(pfo, punkItems);
84 | }
85 |
86 | STDMETHODIMP SetOperationFlags(
87 | IFileOperation* pfo,
88 | DWORD dwFlags
89 | )
90 | {
91 | dwOperationFlags = dwFlags;
92 | return (*pOldSetOperationFlags)(pfo, dwFlags);
93 | }
94 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/CFileOperation.h:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "Shlobj.h"
3 |
4 | #define QueryInterface_Index 0
5 | #define AddRef_Index (QueryInterface_Index + 1)
6 | #define Release_Index (AddRef_Index + 1)
7 | #define Advice_Index (Release_Index + 1)
8 | #define Unadvise_Index (Advice_Index + 1)
9 | #define SetOperationFlags_Index (Unadvise_Index + 1)
10 | #define SetProgressMessage_Index (SetOperationFlags_Index + 1)
11 | #define SetProgressDialog_Index (SetProgressMessage_Index + 1)
12 | #define SetProperties_Index (SetProgressDialog_Index + 1)
13 | #define SetOwnerWindow_Index (SetProperties_Index + 1)
14 | #define ApplyPropertiesToItem_Index (SetOwnerWindow_Index + 1)
15 | #define ApplyPropertiesToItems_Index (ApplyPropertiesToItem_Index + 1)
16 | #define RenameItem_Index (ApplyPropertiesToItems_Index + 1)
17 | #define RenameItems_Index (RenameItem_Index + 1)
18 | #define MoveItem_Index (RenameItems_Index + 1)
19 | #define MoveItems_Index (MoveItem_Index + 1)
20 | #define CopyItem_Index (MoveItems_Index + 1)
21 | #define CopyItems_Index (CopyItem_Index + 1)
22 | #define DeleteItem_Index (CopyItems_Index + 1)
23 | #define DeleteItems_Index (DeleteItem_Index + 1)
24 | #define NewItem_Index (DeleteItems_Index + 1)
25 | #define PerformOperations_Index (NewItem_Index + 1)
26 | #define GetAnyOperationAborted_Index (PerformOperations_Index + 1)
27 |
28 | STDMETHODIMP HookFileOperation();
29 | STDMETHODIMP UnHookFileOperation();
30 |
31 | /* The first parameter of interface function is "this", namely pfo */
32 | STDMETHODIMP DeleteItem(
33 | IFileOperation* pfo,
34 | IShellItem* psiItem,
35 | IFileOperationProgressSink* pfopsItem
36 | );
37 |
38 | STDMETHODIMP DeleteItems(
39 | IFileOperation* pfo,
40 | IUnknown* punkItems
41 | );
42 |
43 | STDMETHODIMP SetOperationFlags(
44 | IFileOperation* pfo,
45 | DWORD dwFlags
46 | );
47 |
48 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/FakeShellIconOverlayIdentifier.cpp:
--------------------------------------------------------------------------------
1 | // FakeShellIconOverlayIdentifier.cpp: CFakeShellIconOverlayIdentifier 的实现
2 |
3 | #include "pch.h"
4 | #include "FakeShellIconOverlayIdentifier.h"
5 |
6 |
7 | // CFakeShellIconOverlayIdentifier
8 |
9 | STDMETHODIMP CFakeShellIconOverlayIdentifier::GetOverlayInfo(
10 | LPWSTR pwszIconFile,
11 | int cchMax,
12 | int* pIndex,
13 | DWORD* pdwFlags
14 | )
15 | {
16 | return E_FAIL;
17 | }
18 |
19 | STDMETHODIMP CFakeShellIconOverlayIdentifier::GetPriority(
20 | int* pPriority
21 | )
22 | {
23 | return E_FAIL;
24 | }
25 |
26 | STDMETHODIMP CFakeShellIconOverlayIdentifier::IsMemberOf(
27 | LPCWSTR pwszPath,
28 | DWORD dwAttrib
29 | )
30 | {
31 | return S_FALSE;
32 | }
33 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/FakeShellIconOverlayIdentifier.h:
--------------------------------------------------------------------------------
1 | // FakeShellIconOverlayIdentifier.h: CFakeShellIconOverlayIdentifier 的声明
2 |
3 | #pragma once
4 | #include "resource.h" // 主符号
5 |
6 |
7 |
8 | #include "AntiShiftDeleteExt_i.h"
9 |
10 |
11 |
12 | #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
13 | #error "Windows CE 平台(如不提供完全 DCOM 支持的 Windows Mobile 平台)上无法正确支持单线程 COM 对象。定义 _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA 可强制 ATL 支持创建单线程 COM 对象实现并允许使用其单线程 COM 对象实现。rgs 文件中的线程模型已被设置为“Free”,原因是该模型是非 DCOM Windows CE 平台支持的唯一线程模型。"
14 | #endif
15 |
16 | using namespace ATL;
17 |
18 |
19 | // CFakeShellIconOverlayIdentifier
20 |
21 | class ATL_NO_VTABLE CFakeShellIconOverlayIdentifier :
22 | public CComObjectRootEx,
23 | public CComCoClass,
24 | public IShellIconOverlayIdentifier
25 | {
26 | public:
27 | CFakeShellIconOverlayIdentifier()
28 | {
29 | }
30 |
31 | DECLARE_REGISTRY_RESOURCEID(108)
32 |
33 | DECLARE_NOT_AGGREGATABLE(CFakeShellIconOverlayIdentifier)
34 |
35 | BEGIN_COM_MAP(CFakeShellIconOverlayIdentifier)
36 | COM_INTERFACE_ENTRY(IShellIconOverlayIdentifier)
37 | END_COM_MAP()
38 |
39 |
40 |
41 | DECLARE_PROTECT_FINAL_CONSTRUCT()
42 |
43 | HRESULT FinalConstruct()
44 | {
45 | return S_OK;
46 | }
47 |
48 | void FinalRelease()
49 | {
50 | }
51 |
52 | public:
53 | STDMETHODIMP GetOverlayInfo(
54 | LPWSTR pwszIconFile,
55 | int cchMax,
56 | int* pIndex,
57 | DWORD* pdwFlags
58 | );
59 | STDMETHODIMP GetPriority(
60 | int* pPriority
61 | );
62 | STDMETHODIMP IsMemberOf(
63 | LPCWSTR pwszPath,
64 | DWORD dwAttrib
65 | );
66 | };
67 |
68 | OBJECT_ENTRY_AUTO(__uuidof(FakeShellIconOverlayIdentifier), CFakeShellIconOverlayIdentifier)
69 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/FakeShellIconOverlayIdentifier.rgs:
--------------------------------------------------------------------------------
1 | HKCR
2 | {
3 | NoRemove CLSID
4 | {
5 | ForceRemove {e330aee1-e4c8-4a8d-8436-370c14e708a1} = s 'AntiShiftDelete IconOverlayHandler'
6 | {
7 | InprocServer32 = s '%MODULE%'
8 | {
9 | val ThreadingModel = s 'Apartment'
10 | }
11 | TypeLib = s '{8dfe808e-bdb6-4387-8880-4102ab4fb322}'
12 | Version = s '1.0'
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/Resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ 生成的包含文件。
3 | // 供 AntiShiftDeleteExt.rc 使用
4 | //
5 | #define IDS_PROJNAME 100
6 | #define IDR_ANTISHIFTDELETEEXT 101
7 | #define IDR_FAKESHELLICONOVERLAYIDENTIFIER 108
8 |
9 | // Next default values for new objects
10 | //
11 | #ifdef APSTUDIO_INVOKED
12 | #ifndef APSTUDIO_READONLY_SYMBOLS
13 | #define _APS_NEXT_RESOURCE_VALUE 201
14 | #define _APS_NEXT_COMMAND_VALUE 32768
15 | #define _APS_NEXT_CONTROL_VALUE 201
16 | #define _APS_NEXT_SYMED_VALUE 109
17 | #endif
18 | #endif
19 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/compreg.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "framework.h"
3 | #include "compreg.h"
4 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/compreg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "resource.h"
4 | #include "AntiShiftDeleteExt_i.h"
5 |
6 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/dlldata.c:
--------------------------------------------------------------------------------
1 | /*********************************************************
2 | DllData file -- generated by MIDL compiler
3 |
4 | DO NOT ALTER THIS FILE
5 |
6 | This file is regenerated by MIDL on every IDL file compile.
7 |
8 | To completely reconstruct this file, delete it and rerun MIDL
9 | on all the IDL files in this DLL, specifying this file for the
10 | /dlldata command line option
11 |
12 | *********************************************************/
13 |
14 | #define PROXY_DELEGATION
15 |
16 | #include
17 |
18 | #ifdef __cplusplus
19 | extern "C" {
20 | #endif
21 |
22 | EXTERN_PROXY_FILE( AntiShiftDeleteExt )
23 |
24 |
25 | PROXYFILE_LIST_START
26 | /* Start of list */
27 | REFERENCE_PROXY_FILE( AntiShiftDeleteExt ),
28 | /* End of list */
29 | PROXYFILE_LIST_END
30 |
31 |
32 | DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
33 |
34 | #ifdef __cplusplus
35 | } /*extern "C" */
36 | #endif
37 |
38 | /* end of generated dlldata file */
39 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/dllmain.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "framework.h"
3 | #include "resource.h"
4 | #include "AntiShiftDeleteExt_i.h"
5 | #include "dllmain.h"
6 | #include "compreg.h"
7 | #include "CFileOperation.h"
8 |
9 | CAntiShiftDeleteExtModule _AtlModule;
10 |
11 | extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
12 | {
13 | if (dwReason == DLL_PROCESS_ATTACH) {
14 | /* MessageBeep(MB_ICONINFORMATION); */
15 | if (!SUCCEEDED(HookFileOperation())) {
16 | MessageBoxW(NULL, L"Hook Failed", L"AntiShiftDelete", MB_OK | MB_ICONERROR);
17 | }
18 | }
19 | if (dwReason == DLL_PROCESS_DETACH) {
20 | /* MessageBeep(MB_ICONSTOP); */
21 | if (!SUCCEEDED(UnHookFileOperation())) {
22 | MessageBoxW(NULL, L"UnHook Failed", L"AntiShiftDelete", MB_OK | MB_ICONERROR);
23 | }
24 | }
25 | hInstance;
26 | return _AtlModule.DllMain(dwReason, lpReserved);
27 | }
28 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/dllmain.h:
--------------------------------------------------------------------------------
1 | class CAntiShiftDeleteExtModule : public ATL::CAtlDllModuleT< CAntiShiftDeleteExtModule >
2 | {
3 | public :
4 | DECLARE_LIBID(LIBID_AntiShiftDeleteExtLib)
5 | DECLARE_REGISTRY_APPID_RESOURCEID(IDR_ANTISHIFTDELETEEXT, "{8dfe808e-bdb6-4387-8880-4102ab4fb322}")
6 | };
7 |
8 | extern class CAntiShiftDeleteExtModule _AtlModule;
9 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/framework.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifndef STRICT
4 | #define STRICT
5 | #endif
6 |
7 | #include "targetver.h"
8 |
9 | #define _ATL_APARTMENT_THREADED
10 |
11 | #define _ATL_NO_AUTOMATIC_NAMESPACE
12 |
13 | #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
14 |
15 |
16 | #include
17 |
18 | #define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW
19 |
20 | #include "resource.h"
21 | #include
22 | #include
23 | #include
24 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/include/detours.h:
--------------------------------------------------------------------------------
1 | /////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Core Detours Functionality (detours.h of detours.lib)
4 | //
5 | // Microsoft Research Detours Package, Version 3.0 Build_343.
6 | //
7 | // Copyright (c) Microsoft Corporation. All rights reserved.
8 | //
9 |
10 | #pragma once
11 | #ifndef _DETOURS_H_
12 | #define _DETOURS_H_
13 |
14 | #define DETOURS_VERSION 30001 // 3.00.01
15 |
16 | //////////////////////////////////////////////////////////////////////////////
17 | //
18 |
19 | #undef DETOURS_X64
20 | #undef DETOURS_X86
21 | #undef DETOURS_IA64
22 | #undef DETOURS_ARM
23 | #undef DETOURS_ARM64
24 | #undef DETOURS_BITS
25 | #undef DETOURS_32BIT
26 | #undef DETOURS_64BIT
27 |
28 | #if defined(_X86_)
29 | #define DETOURS_X86
30 | #define DETOURS_OPTION_BITS 64
31 |
32 | #elif defined(_AMD64_)
33 | #define DETOURS_X64
34 | #define DETOURS_OPTION_BITS 32
35 |
36 | #elif defined(_IA64_)
37 | #define DETOURS_IA64
38 | #define DETOURS_OPTION_BITS 32
39 |
40 | #elif defined(_ARM_)
41 | #define DETOURS_ARM
42 |
43 | #elif defined(_ARM64_)
44 | #define DETOURS_ARM64
45 |
46 | #else
47 | #error Unknown architecture (x86, amd64, ia64, arm, arm64)
48 | #endif
49 |
50 | #ifdef _WIN64
51 | #undef DETOURS_32BIT
52 | #define DETOURS_64BIT 1
53 | #define DETOURS_BITS 64
54 | // If all 64bit kernels can run one and only one 32bit architecture.
55 | //#define DETOURS_OPTION_BITS 32
56 | #else
57 | #define DETOURS_32BIT 1
58 | #undef DETOURS_64BIT
59 | #define DETOURS_BITS 32
60 | // If all 64bit kernels can run one and only one 32bit architecture.
61 | //#define DETOURS_OPTION_BITS 32
62 | #endif
63 |
64 | #define VER_DETOURS_BITS DETOUR_STRINGIFY(DETOURS_BITS)
65 |
66 | //////////////////////////////////////////////////////////////////////////////
67 | //
68 |
69 | #if (_MSC_VER < 1299)
70 | typedef LONG LONG_PTR;
71 | typedef ULONG ULONG_PTR;
72 | #endif
73 |
74 | ///////////////////////////////////////////////// SAL 2.0 Annotations w/o SAL.
75 | //
76 | // These definitions are include so that Detours will build even if the
77 | // compiler doesn't have full SAL 2.0 support.
78 | //
79 | #ifndef DETOURS_DONT_REMOVE_SAL_20
80 |
81 | #ifdef DETOURS_TEST_REMOVE_SAL_20
82 | #undef _Analysis_assume_
83 | #undef _Benign_race_begin_
84 | #undef _Benign_race_end_
85 | #undef _Field_range_
86 | #undef _Field_size_
87 | #undef _In_
88 | #undef _In_bytecount_
89 | #undef _In_count_
90 | #undef _In_opt_
91 | #undef _In_opt_bytecount_
92 | #undef _In_opt_count_
93 | #undef _In_opt_z_
94 | #undef _In_range_
95 | #undef _In_reads_
96 | #undef _In_reads_bytes_
97 | #undef _In_reads_opt_
98 | #undef _In_reads_opt_bytes_
99 | #undef _In_reads_or_z_
100 | #undef _In_z_
101 | #undef _Inout_
102 | #undef _Inout_opt_
103 | #undef _Inout_z_count_
104 | #undef _Out_
105 | #undef _Out_opt_
106 | #undef _Out_writes_
107 | #undef _Outptr_result_maybenull_
108 | #undef _Readable_bytes_
109 | #undef _Success_
110 | #undef _Writable_bytes_
111 | #undef _Pre_notnull_
112 | #endif
113 |
114 | #if defined(_Deref_out_opt_z_) && !defined(_Outptr_result_maybenull_)
115 | #define _Outptr_result_maybenull_ _Deref_out_opt_z_
116 | #endif
117 |
118 | #if defined(_In_count_) && !defined(_In_reads_)
119 | #define _In_reads_(x) _In_count_(x)
120 | #endif
121 |
122 | #if defined(_In_opt_count_) && !defined(_In_reads_opt_)
123 | #define _In_reads_opt_(x) _In_opt_count_(x)
124 | #endif
125 |
126 | #if defined(_In_opt_bytecount_) && !defined(_In_reads_opt_bytes_)
127 | #define _In_reads_opt_bytes_(x) _In_opt_bytecount_(x)
128 | #endif
129 |
130 | #if defined(_In_bytecount_) && !defined(_In_reads_bytes_)
131 | #define _In_reads_bytes_(x) _In_bytecount_(x)
132 | #endif
133 |
134 | #ifndef _In_
135 | #define _In_
136 | #endif
137 |
138 | #ifndef _In_bytecount_
139 | #define _In_bytecount_(x)
140 | #endif
141 |
142 | #ifndef _In_count_
143 | #define _In_count_(x)
144 | #endif
145 |
146 | #ifndef _In_opt_
147 | #define _In_opt_
148 | #endif
149 |
150 | #ifndef _In_opt_bytecount_
151 | #define _In_opt_bytecount_(x)
152 | #endif
153 |
154 | #ifndef _In_opt_count_
155 | #define _In_opt_count_(x)
156 | #endif
157 |
158 | #ifndef _In_opt_z_
159 | #define _In_opt_z_
160 | #endif
161 |
162 | #ifndef _In_range_
163 | #define _In_range_(x,y)
164 | #endif
165 |
166 | #ifndef _In_reads_
167 | #define _In_reads_(x)
168 | #endif
169 |
170 | #ifndef _In_reads_bytes_
171 | #define _In_reads_bytes_(x)
172 | #endif
173 |
174 | #ifndef _In_reads_opt_
175 | #define _In_reads_opt_(x)
176 | #endif
177 |
178 | #ifndef _In_reads_opt_bytes_
179 | #define _In_reads_opt_bytes_(x)
180 | #endif
181 |
182 | #ifndef _In_reads_or_z_
183 | #define _In_reads_or_z_
184 | #endif
185 |
186 | #ifndef _In_z_
187 | #define _In_z_
188 | #endif
189 |
190 | #ifndef _Inout_
191 | #define _Inout_
192 | #endif
193 |
194 | #ifndef _Inout_opt_
195 | #define _Inout_opt_
196 | #endif
197 |
198 | #ifndef _Inout_z_count_
199 | #define _Inout_z_count_(x)
200 | #endif
201 |
202 | #ifndef _Out_
203 | #define _Out_
204 | #endif
205 |
206 | #ifndef _Out_opt_
207 | #define _Out_opt_
208 | #endif
209 |
210 | #ifndef _Out_writes_
211 | #define _Out_writes_(x)
212 | #endif
213 |
214 | #ifndef _Outptr_result_maybenull_
215 | #define _Outptr_result_maybenull_
216 | #endif
217 |
218 | #ifndef _Writable_bytes_
219 | #define _Writable_bytes_(x)
220 | #endif
221 |
222 | #ifndef _Readable_bytes_
223 | #define _Readable_bytes_(x)
224 | #endif
225 |
226 | #ifndef _Success_
227 | #define _Success_(x)
228 | #endif
229 |
230 | #ifndef _Pre_notnull_
231 | #define _Pre_notnull_
232 | #endif
233 |
234 | #ifdef DETOURS_INTERNAL
235 |
236 | #pragma warning(disable:4615) // unknown warning type (suppress with older compilers)
237 |
238 | #ifndef _Benign_race_begin_
239 | #define _Benign_race_begin_
240 | #endif
241 |
242 | #ifndef _Benign_race_end_
243 | #define _Benign_race_end_
244 | #endif
245 |
246 | #ifndef _Field_size_
247 | #define _Field_size_(x)
248 | #endif
249 |
250 | #ifndef _Field_range_
251 | #define _Field_range_(x,y)
252 | #endif
253 |
254 | #ifndef _Analysis_assume_
255 | #define _Analysis_assume_(x)
256 | #endif
257 |
258 | #endif // DETOURS_INTERNAL
259 | #endif // DETOURS_DONT_REMOVE_SAL_20
260 |
261 | //////////////////////////////////////////////////////////////////////////////
262 | //
263 | #ifndef GUID_DEFINED
264 | #define GUID_DEFINED
265 | typedef struct _GUID
266 | {
267 | DWORD Data1;
268 | WORD Data2;
269 | WORD Data3;
270 | BYTE Data4[ 8 ];
271 | } GUID;
272 |
273 | #ifdef INITGUID
274 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
275 | const GUID name \
276 | = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
277 | #else
278 | #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
279 | const GUID name
280 | #endif // INITGUID
281 | #endif // !GUID_DEFINED
282 |
283 | #if defined(__cplusplus)
284 | #ifndef _REFGUID_DEFINED
285 | #define _REFGUID_DEFINED
286 | #define REFGUID const GUID &
287 | #endif // !_REFGUID_DEFINED
288 | #else // !__cplusplus
289 | #ifndef _REFGUID_DEFINED
290 | #define _REFGUID_DEFINED
291 | #define REFGUID const GUID * const
292 | #endif // !_REFGUID_DEFINED
293 | #endif // !__cplusplus
294 |
295 | #ifndef ARRAYSIZE
296 | #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
297 | #endif
298 |
299 | //
300 | //////////////////////////////////////////////////////////////////////////////
301 |
302 | #ifdef __cplusplus
303 | extern "C" {
304 | #endif // __cplusplus
305 |
306 | /////////////////////////////////////////////////// Instruction Target Macros.
307 | //
308 | #define DETOUR_INSTRUCTION_TARGET_NONE ((PVOID)0)
309 | #define DETOUR_INSTRUCTION_TARGET_DYNAMIC ((PVOID)(LONG_PTR)-1)
310 | #define DETOUR_SECTION_HEADER_SIGNATURE 0x00727444 // "Dtr\0"
311 |
312 | extern const GUID DETOUR_EXE_RESTORE_GUID;
313 | extern const GUID DETOUR_EXE_HELPER_GUID;
314 |
315 | #define DETOUR_TRAMPOLINE_SIGNATURE 0x21727444 // Dtr!
316 | typedef struct _DETOUR_TRAMPOLINE DETOUR_TRAMPOLINE, *PDETOUR_TRAMPOLINE;
317 |
318 | /////////////////////////////////////////////////////////// Binary Structures.
319 | //
320 | #pragma pack(push, 8)
321 | typedef struct _DETOUR_SECTION_HEADER
322 | {
323 | DWORD cbHeaderSize;
324 | DWORD nSignature;
325 | DWORD nDataOffset;
326 | DWORD cbDataSize;
327 |
328 | DWORD nOriginalImportVirtualAddress;
329 | DWORD nOriginalImportSize;
330 | DWORD nOriginalBoundImportVirtualAddress;
331 | DWORD nOriginalBoundImportSize;
332 |
333 | DWORD nOriginalIatVirtualAddress;
334 | DWORD nOriginalIatSize;
335 | DWORD nOriginalSizeOfImage;
336 | DWORD cbPrePE;
337 |
338 | DWORD nOriginalClrFlags;
339 | DWORD reserved1;
340 | DWORD reserved2;
341 | DWORD reserved3;
342 |
343 | // Followed by cbPrePE bytes of data.
344 | } DETOUR_SECTION_HEADER, *PDETOUR_SECTION_HEADER;
345 |
346 | typedef struct _DETOUR_SECTION_RECORD
347 | {
348 | DWORD cbBytes;
349 | DWORD nReserved;
350 | GUID guid;
351 | } DETOUR_SECTION_RECORD, *PDETOUR_SECTION_RECORD;
352 |
353 | typedef struct _DETOUR_CLR_HEADER
354 | {
355 | // Header versioning
356 | ULONG cb;
357 | USHORT MajorRuntimeVersion;
358 | USHORT MinorRuntimeVersion;
359 |
360 | // Symbol table and startup information
361 | IMAGE_DATA_DIRECTORY MetaData;
362 | ULONG Flags;
363 |
364 | // Followed by the rest of the IMAGE_COR20_HEADER
365 | } DETOUR_CLR_HEADER, *PDETOUR_CLR_HEADER;
366 |
367 | typedef struct _DETOUR_EXE_RESTORE
368 | {
369 | DWORD cb;
370 | DWORD cbidh;
371 | DWORD cbinh;
372 | DWORD cbclr;
373 |
374 | PBYTE pidh;
375 | PBYTE pinh;
376 | PBYTE pclr;
377 |
378 | IMAGE_DOS_HEADER idh;
379 | union {
380 | IMAGE_NT_HEADERS inh;
381 | IMAGE_NT_HEADERS32 inh32;
382 | IMAGE_NT_HEADERS64 inh64;
383 | BYTE raw[sizeof(IMAGE_NT_HEADERS64) +
384 | sizeof(IMAGE_SECTION_HEADER) * 32];
385 | };
386 | DETOUR_CLR_HEADER clr;
387 |
388 | } DETOUR_EXE_RESTORE, *PDETOUR_EXE_RESTORE;
389 |
390 | typedef struct _DETOUR_EXE_HELPER
391 | {
392 | DWORD cb;
393 | DWORD pid;
394 | DWORD nDlls;
395 | CHAR rDlls[4];
396 | } DETOUR_EXE_HELPER, *PDETOUR_EXE_HELPER;
397 |
398 | #pragma pack(pop)
399 |
400 | #define DETOUR_SECTION_HEADER_DECLARE(cbSectionSize) \
401 | { \
402 | sizeof(DETOUR_SECTION_HEADER),\
403 | DETOUR_SECTION_HEADER_SIGNATURE,\
404 | sizeof(DETOUR_SECTION_HEADER),\
405 | (cbSectionSize),\
406 | \
407 | 0,\
408 | 0,\
409 | 0,\
410 | 0,\
411 | \
412 | 0,\
413 | 0,\
414 | 0,\
415 | 0,\
416 | }
417 |
418 | /////////////////////////////////////////////////////////////// Helper Macros.
419 | //
420 | #define DETOURS_STRINGIFY(x) DETOURS_STRINGIFY_(x)
421 | #define DETOURS_STRINGIFY_(x) #x
422 |
423 | ///////////////////////////////////////////////////////////// Binary Typedefs.
424 | //
425 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_BYWAY_CALLBACK)(
426 | _In_opt_ PVOID pContext,
427 | _In_opt_ LPCSTR pszFile,
428 | _Outptr_result_maybenull_ LPCSTR *ppszOutFile);
429 |
430 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_FILE_CALLBACK)(
431 | _In_opt_ PVOID pContext,
432 | _In_ LPCSTR pszOrigFile,
433 | _In_ LPCSTR pszFile,
434 | _Outptr_result_maybenull_ LPCSTR *ppszOutFile);
435 |
436 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_SYMBOL_CALLBACK)(
437 | _In_opt_ PVOID pContext,
438 | _In_ ULONG nOrigOrdinal,
439 | _In_ ULONG nOrdinal,
440 | _Out_ ULONG *pnOutOrdinal,
441 | _In_opt_ LPCSTR pszOrigSymbol,
442 | _In_opt_ LPCSTR pszSymbol,
443 | _Outptr_result_maybenull_ LPCSTR *ppszOutSymbol);
444 |
445 | typedef BOOL (CALLBACK *PF_DETOUR_BINARY_COMMIT_CALLBACK)(
446 | _In_opt_ PVOID pContext);
447 |
448 | typedef BOOL (CALLBACK *PF_DETOUR_ENUMERATE_EXPORT_CALLBACK)(_In_opt_ PVOID pContext,
449 | _In_ ULONG nOrdinal,
450 | _In_opt_ LPCSTR pszName,
451 | _In_opt_ PVOID pCode);
452 |
453 | typedef BOOL (CALLBACK *PF_DETOUR_IMPORT_FILE_CALLBACK)(_In_opt_ PVOID pContext,
454 | _In_opt_ HMODULE hModule,
455 | _In_opt_ LPCSTR pszFile);
456 |
457 | typedef BOOL (CALLBACK *PF_DETOUR_IMPORT_FUNC_CALLBACK)(_In_opt_ PVOID pContext,
458 | _In_ DWORD nOrdinal,
459 | _In_opt_ LPCSTR pszFunc,
460 | _In_opt_ PVOID pvFunc);
461 |
462 | // Same as PF_DETOUR_IMPORT_FUNC_CALLBACK but extra indirection on last parameter.
463 | typedef BOOL (CALLBACK *PF_DETOUR_IMPORT_FUNC_CALLBACK_EX)(_In_opt_ PVOID pContext,
464 | _In_ DWORD nOrdinal,
465 | _In_opt_ LPCSTR pszFunc,
466 | _In_opt_ PVOID* ppvFunc);
467 |
468 | typedef VOID * PDETOUR_BINARY;
469 | typedef VOID * PDETOUR_LOADED_BINARY;
470 |
471 | //////////////////////////////////////////////////////////// Transaction APIs.
472 | //
473 | LONG WINAPI DetourTransactionBegin(VOID);
474 | LONG WINAPI DetourTransactionAbort(VOID);
475 | LONG WINAPI DetourTransactionCommit(VOID);
476 | LONG WINAPI DetourTransactionCommitEx(_Out_opt_ PVOID **pppFailedPointer);
477 |
478 | LONG WINAPI DetourUpdateThread(_In_ HANDLE hThread);
479 |
480 | LONG WINAPI DetourAttach(_Inout_ PVOID *ppPointer,
481 | _In_ PVOID pDetour);
482 |
483 | LONG WINAPI DetourAttachEx(_Inout_ PVOID *ppPointer,
484 | _In_ PVOID pDetour,
485 | _Out_opt_ PDETOUR_TRAMPOLINE *ppRealTrampoline,
486 | _Out_opt_ PVOID *ppRealTarget,
487 | _Out_opt_ PVOID *ppRealDetour);
488 |
489 | LONG WINAPI DetourDetach(_Inout_ PVOID *ppPointer,
490 | _In_ PVOID pDetour);
491 |
492 | BOOL WINAPI DetourSetIgnoreTooSmall(_In_ BOOL fIgnore);
493 | BOOL WINAPI DetourSetRetainRegions(_In_ BOOL fRetain);
494 | PVOID WINAPI DetourSetSystemRegionLowerBound(_In_ PVOID pSystemRegionLowerBound);
495 | PVOID WINAPI DetourSetSystemRegionUpperBound(_In_ PVOID pSystemRegionUpperBound);
496 |
497 | ////////////////////////////////////////////////////////////// Code Functions.
498 | //
499 | PVOID WINAPI DetourFindFunction(_In_ LPCSTR pszModule,
500 | _In_ LPCSTR pszFunction);
501 | PVOID WINAPI DetourCodeFromPointer(_In_ PVOID pPointer,
502 | _Out_opt_ PVOID *ppGlobals);
503 | PVOID WINAPI DetourCopyInstruction(_In_opt_ PVOID pDst,
504 | _Inout_opt_ PVOID *ppDstPool,
505 | _In_ PVOID pSrc,
506 | _Out_opt_ PVOID *ppTarget,
507 | _Out_opt_ LONG *plExtra);
508 | BOOL WINAPI DetourSetCodeModule(_In_ HMODULE hModule,
509 | _In_ BOOL fLimitReferencesToModule);
510 |
511 | ///////////////////////////////////////////////////// Loaded Binary Functions.
512 | //
513 | HMODULE WINAPI DetourGetContainingModule(_In_ PVOID pvAddr);
514 | HMODULE WINAPI DetourEnumerateModules(_In_opt_ HMODULE hModuleLast);
515 | PVOID WINAPI DetourGetEntryPoint(_In_opt_ HMODULE hModule);
516 | ULONG WINAPI DetourGetModuleSize(_In_opt_ HMODULE hModule);
517 | BOOL WINAPI DetourEnumerateExports(_In_ HMODULE hModule,
518 | _In_opt_ PVOID pContext,
519 | _In_ PF_DETOUR_ENUMERATE_EXPORT_CALLBACK pfExport);
520 | BOOL WINAPI DetourEnumerateImports(_In_opt_ HMODULE hModule,
521 | _In_opt_ PVOID pContext,
522 | _In_opt_ PF_DETOUR_IMPORT_FILE_CALLBACK pfImportFile,
523 | _In_opt_ PF_DETOUR_IMPORT_FUNC_CALLBACK pfImportFunc);
524 |
525 | BOOL WINAPI DetourEnumerateImportsEx(_In_opt_ HMODULE hModule,
526 | _In_opt_ PVOID pContext,
527 | _In_opt_ PF_DETOUR_IMPORT_FILE_CALLBACK pfImportFile,
528 | _In_opt_ PF_DETOUR_IMPORT_FUNC_CALLBACK_EX pfImportFuncEx);
529 |
530 | _Writable_bytes_(*pcbData)
531 | _Readable_bytes_(*pcbData)
532 | _Success_(return != NULL)
533 | PVOID WINAPI DetourFindPayload(_In_opt_ HMODULE hModule,
534 | _In_ REFGUID rguid,
535 | _Out_ DWORD *pcbData);
536 |
537 | _Writable_bytes_(*pcbData)
538 | _Readable_bytes_(*pcbData)
539 | _Success_(return != NULL)
540 | PVOID WINAPI DetourFindPayloadEx(_In_ REFGUID rguid,
541 | _Out_ DWORD * pcbData);
542 |
543 | DWORD WINAPI DetourGetSizeOfPayloads(_In_opt_ HMODULE hModule);
544 |
545 | ///////////////////////////////////////////////// Persistent Binary Functions.
546 | //
547 |
548 | PDETOUR_BINARY WINAPI DetourBinaryOpen(_In_ HANDLE hFile);
549 |
550 | _Writable_bytes_(*pcbData)
551 | _Readable_bytes_(*pcbData)
552 | _Success_(return != NULL)
553 | PVOID WINAPI DetourBinaryEnumeratePayloads(_In_ PDETOUR_BINARY pBinary,
554 | _Out_opt_ GUID *pGuid,
555 | _Out_ DWORD *pcbData,
556 | _Inout_ DWORD *pnIterator);
557 |
558 | _Writable_bytes_(*pcbData)
559 | _Readable_bytes_(*pcbData)
560 | _Success_(return != NULL)
561 | PVOID WINAPI DetourBinaryFindPayload(_In_ PDETOUR_BINARY pBinary,
562 | _In_ REFGUID rguid,
563 | _Out_ DWORD *pcbData);
564 |
565 | PVOID WINAPI DetourBinarySetPayload(_In_ PDETOUR_BINARY pBinary,
566 | _In_ REFGUID rguid,
567 | _In_reads_opt_(cbData) PVOID pData,
568 | _In_ DWORD cbData);
569 | BOOL WINAPI DetourBinaryDeletePayload(_In_ PDETOUR_BINARY pBinary, _In_ REFGUID rguid);
570 | BOOL WINAPI DetourBinaryPurgePayloads(_In_ PDETOUR_BINARY pBinary);
571 | BOOL WINAPI DetourBinaryResetImports(_In_ PDETOUR_BINARY pBinary);
572 | BOOL WINAPI DetourBinaryEditImports(_In_ PDETOUR_BINARY pBinary,
573 | _In_opt_ PVOID pContext,
574 | _In_opt_ PF_DETOUR_BINARY_BYWAY_CALLBACK pfByway,
575 | _In_opt_ PF_DETOUR_BINARY_FILE_CALLBACK pfFile,
576 | _In_opt_ PF_DETOUR_BINARY_SYMBOL_CALLBACK pfSymbol,
577 | _In_opt_ PF_DETOUR_BINARY_COMMIT_CALLBACK pfCommit);
578 | BOOL WINAPI DetourBinaryWrite(_In_ PDETOUR_BINARY pBinary, _In_ HANDLE hFile);
579 | BOOL WINAPI DetourBinaryClose(_In_ PDETOUR_BINARY pBinary);
580 |
581 | /////////////////////////////////////////////////// Create Process & Load Dll.
582 | //
583 | typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEA)(
584 | _In_opt_ LPCSTR lpApplicationName,
585 | _Inout_opt_ LPSTR lpCommandLine,
586 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
587 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
588 | _In_ BOOL bInheritHandles,
589 | _In_ DWORD dwCreationFlags,
590 | _In_opt_ LPVOID lpEnvironment,
591 | _In_opt_ LPCSTR lpCurrentDirectory,
592 | _In_ LPSTARTUPINFOA lpStartupInfo,
593 | _Out_ LPPROCESS_INFORMATION lpProcessInformation);
594 |
595 | typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEW)(
596 | _In_opt_ LPCWSTR lpApplicationName,
597 | _Inout_opt_ LPWSTR lpCommandLine,
598 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
599 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
600 | _In_ BOOL bInheritHandles,
601 | _In_ DWORD dwCreationFlags,
602 | _In_opt_ LPVOID lpEnvironment,
603 | _In_opt_ LPCWSTR lpCurrentDirectory,
604 | _In_ LPSTARTUPINFOW lpStartupInfo,
605 | _Out_ LPPROCESS_INFORMATION lpProcessInformation);
606 |
607 | BOOL WINAPI DetourCreateProcessWithDllA(_In_opt_ LPCSTR lpApplicationName,
608 | _Inout_opt_ LPSTR lpCommandLine,
609 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
610 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
611 | _In_ BOOL bInheritHandles,
612 | _In_ DWORD dwCreationFlags,
613 | _In_opt_ LPVOID lpEnvironment,
614 | _In_opt_ LPCSTR lpCurrentDirectory,
615 | _In_ LPSTARTUPINFOA lpStartupInfo,
616 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
617 | _In_ LPCSTR lpDllName,
618 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
619 |
620 | BOOL WINAPI DetourCreateProcessWithDllW(_In_opt_ LPCWSTR lpApplicationName,
621 | _Inout_opt_ LPWSTR lpCommandLine,
622 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
623 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
624 | _In_ BOOL bInheritHandles,
625 | _In_ DWORD dwCreationFlags,
626 | _In_opt_ LPVOID lpEnvironment,
627 | _In_opt_ LPCWSTR lpCurrentDirectory,
628 | _In_ LPSTARTUPINFOW lpStartupInfo,
629 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
630 | _In_ LPCSTR lpDllName,
631 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
632 |
633 | #ifdef UNICODE
634 | #define DetourCreateProcessWithDll DetourCreateProcessWithDllW
635 | #define PDETOUR_CREATE_PROCESS_ROUTINE PDETOUR_CREATE_PROCESS_ROUTINEW
636 | #else
637 | #define DetourCreateProcessWithDll DetourCreateProcessWithDllA
638 | #define PDETOUR_CREATE_PROCESS_ROUTINE PDETOUR_CREATE_PROCESS_ROUTINEA
639 | #endif // !UNICODE
640 |
641 | BOOL WINAPI DetourCreateProcessWithDllExA(_In_opt_ LPCSTR lpApplicationName,
642 | _Inout_opt_ LPSTR lpCommandLine,
643 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
644 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
645 | _In_ BOOL bInheritHandles,
646 | _In_ DWORD dwCreationFlags,
647 | _In_opt_ LPVOID lpEnvironment,
648 | _In_opt_ LPCSTR lpCurrentDirectory,
649 | _In_ LPSTARTUPINFOA lpStartupInfo,
650 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
651 | _In_ LPCSTR lpDllName,
652 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
653 |
654 | BOOL WINAPI DetourCreateProcessWithDllExW(_In_opt_ LPCWSTR lpApplicationName,
655 | _Inout_opt_ LPWSTR lpCommandLine,
656 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
657 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
658 | _In_ BOOL bInheritHandles,
659 | _In_ DWORD dwCreationFlags,
660 | _In_opt_ LPVOID lpEnvironment,
661 | _In_opt_ LPCWSTR lpCurrentDirectory,
662 | _In_ LPSTARTUPINFOW lpStartupInfo,
663 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
664 | _In_ LPCSTR lpDllName,
665 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
666 |
667 | #ifdef UNICODE
668 | #define DetourCreateProcessWithDllEx DetourCreateProcessWithDllExW
669 | #else
670 | #define DetourCreateProcessWithDllEx DetourCreateProcessWithDllExA
671 | #endif // !UNICODE
672 |
673 | BOOL WINAPI DetourCreateProcessWithDllsA(_In_opt_ LPCSTR lpApplicationName,
674 | _Inout_opt_ LPSTR lpCommandLine,
675 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
676 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
677 | _In_ BOOL bInheritHandles,
678 | _In_ DWORD dwCreationFlags,
679 | _In_opt_ LPVOID lpEnvironment,
680 | _In_opt_ LPCSTR lpCurrentDirectory,
681 | _In_ LPSTARTUPINFOA lpStartupInfo,
682 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
683 | _In_ DWORD nDlls,
684 | _In_reads_(nDlls) LPCSTR *rlpDlls,
685 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
686 |
687 | BOOL WINAPI DetourCreateProcessWithDllsW(_In_opt_ LPCWSTR lpApplicationName,
688 | _Inout_opt_ LPWSTR lpCommandLine,
689 | _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes,
690 | _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes,
691 | _In_ BOOL bInheritHandles,
692 | _In_ DWORD dwCreationFlags,
693 | _In_opt_ LPVOID lpEnvironment,
694 | _In_opt_ LPCWSTR lpCurrentDirectory,
695 | _In_ LPSTARTUPINFOW lpStartupInfo,
696 | _Out_ LPPROCESS_INFORMATION lpProcessInformation,
697 | _In_ DWORD nDlls,
698 | _In_reads_(nDlls) LPCSTR *rlpDlls,
699 | _In_opt_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
700 |
701 | #ifdef UNICODE
702 | #define DetourCreateProcessWithDlls DetourCreateProcessWithDllsW
703 | #else
704 | #define DetourCreateProcessWithDlls DetourCreateProcessWithDllsA
705 | #endif // !UNICODE
706 |
707 | BOOL WINAPI DetourProcessViaHelperA(_In_ DWORD dwTargetPid,
708 | _In_ LPCSTR lpDllName,
709 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
710 |
711 | BOOL WINAPI DetourProcessViaHelperW(_In_ DWORD dwTargetPid,
712 | _In_ LPCSTR lpDllName,
713 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
714 |
715 | #ifdef UNICODE
716 | #define DetourProcessViaHelper DetourProcessViaHelperW
717 | #else
718 | #define DetourProcessViaHelper DetourProcessViaHelperA
719 | #endif // !UNICODE
720 |
721 | BOOL WINAPI DetourProcessViaHelperDllsA(_In_ DWORD dwTargetPid,
722 | _In_ DWORD nDlls,
723 | _In_reads_(nDlls) LPCSTR *rlpDlls,
724 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEA pfCreateProcessA);
725 |
726 | BOOL WINAPI DetourProcessViaHelperDllsW(_In_ DWORD dwTargetPid,
727 | _In_ DWORD nDlls,
728 | _In_reads_(nDlls) LPCSTR *rlpDlls,
729 | _In_ PDETOUR_CREATE_PROCESS_ROUTINEW pfCreateProcessW);
730 |
731 | #ifdef UNICODE
732 | #define DetourProcessViaHelperDlls DetourProcessViaHelperDllsW
733 | #else
734 | #define DetourProcessViaHelperDlls DetourProcessViaHelperDllsA
735 | #endif // !UNICODE
736 |
737 | BOOL WINAPI DetourUpdateProcessWithDll(_In_ HANDLE hProcess,
738 | _In_reads_(nDlls) LPCSTR *rlpDlls,
739 | _In_ DWORD nDlls);
740 |
741 | BOOL WINAPI DetourUpdateProcessWithDllEx(_In_ HANDLE hProcess,
742 | _In_ HMODULE hImage,
743 | _In_ BOOL bIs32Bit,
744 | _In_reads_(nDlls) LPCSTR *rlpDlls,
745 | _In_ DWORD nDlls);
746 |
747 | BOOL WINAPI DetourCopyPayloadToProcess(_In_ HANDLE hProcess,
748 | _In_ REFGUID rguid,
749 | _In_reads_bytes_(cbData) PVOID pvData,
750 | _In_ DWORD cbData);
751 | BOOL WINAPI DetourRestoreAfterWith(VOID);
752 | BOOL WINAPI DetourRestoreAfterWithEx(_In_reads_bytes_(cbData) PVOID pvData,
753 | _In_ DWORD cbData);
754 | BOOL WINAPI DetourIsHelperProcess(VOID);
755 | VOID CALLBACK DetourFinishHelperProcess(_In_ HWND,
756 | _In_ HINSTANCE,
757 | _In_ LPSTR,
758 | _In_ INT);
759 |
760 | //
761 | //////////////////////////////////////////////////////////////////////////////
762 | #ifdef __cplusplus
763 | }
764 | #endif // __cplusplus
765 |
766 | //////////////////////////////////////////////// Detours Internal Definitions.
767 | //
768 | #ifdef __cplusplus
769 | #ifdef DETOURS_INTERNAL
770 |
771 | #define NOTHROW
772 | // #define NOTHROW (nothrow)
773 |
774 | //////////////////////////////////////////////////////////////////////////////
775 | //
776 | #if (_MSC_VER < 1299)
777 | #include
778 | typedef IMAGEHLP_MODULE IMAGEHLP_MODULE64;
779 | typedef PIMAGEHLP_MODULE PIMAGEHLP_MODULE64;
780 | typedef IMAGEHLP_SYMBOL SYMBOL_INFO;
781 | typedef PIMAGEHLP_SYMBOL PSYMBOL_INFO;
782 |
783 | static inline
784 | LONG InterlockedCompareExchange(_Inout_ LONG *ptr, _In_ LONG nval, _In_ LONG oval)
785 | {
786 | return (LONG)::InterlockedCompareExchange((PVOID*)ptr, (PVOID)nval, (PVOID)oval);
787 | }
788 | #else
789 | #pragma warning(push)
790 | #pragma warning(disable:4091) // empty typedef
791 | #include
792 | #pragma warning(pop)
793 | #endif
794 |
795 | #ifdef IMAGEAPI // defined by DBGHELP.H
796 | typedef LPAPI_VERSION (NTAPI *PF_ImagehlpApiVersionEx)(_In_ LPAPI_VERSION AppVersion);
797 |
798 | typedef BOOL (NTAPI *PF_SymInitialize)(_In_ HANDLE hProcess,
799 | _In_opt_ LPCSTR UserSearchPath,
800 | _In_ BOOL fInvadeProcess);
801 | typedef DWORD (NTAPI *PF_SymSetOptions)(_In_ DWORD SymOptions);
802 | typedef DWORD (NTAPI *PF_SymGetOptions)(VOID);
803 | typedef DWORD64 (NTAPI *PF_SymLoadModule64)(_In_ HANDLE hProcess,
804 | _In_opt_ HANDLE hFile,
805 | _In_ LPSTR ImageName,
806 | _In_opt_ LPSTR ModuleName,
807 | _In_ DWORD64 BaseOfDll,
808 | _In_opt_ DWORD SizeOfDll);
809 | typedef BOOL (NTAPI *PF_SymGetModuleInfo64)(_In_ HANDLE hProcess,
810 | _In_ DWORD64 qwAddr,
811 | _Out_ PIMAGEHLP_MODULE64 ModuleInfo);
812 | typedef BOOL (NTAPI *PF_SymFromName)(_In_ HANDLE hProcess,
813 | _In_ LPSTR Name,
814 | _Out_ PSYMBOL_INFO Symbol);
815 |
816 | typedef struct _DETOUR_SYM_INFO
817 | {
818 | HANDLE hProcess;
819 | HMODULE hDbgHelp;
820 | PF_ImagehlpApiVersionEx pfImagehlpApiVersionEx;
821 | PF_SymInitialize pfSymInitialize;
822 | PF_SymSetOptions pfSymSetOptions;
823 | PF_SymGetOptions pfSymGetOptions;
824 | PF_SymLoadModule64 pfSymLoadModule64;
825 | PF_SymGetModuleInfo64 pfSymGetModuleInfo64;
826 | PF_SymFromName pfSymFromName;
827 | } DETOUR_SYM_INFO, *PDETOUR_SYM_INFO;
828 |
829 | PDETOUR_SYM_INFO DetourLoadImageHlp(VOID);
830 |
831 | #endif // IMAGEAPI
832 |
833 | #if defined(_INC_STDIO) && !defined(_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS)
834 | #error detours.h must be included before stdio.h (or at least define _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS earlier)
835 | #endif
836 | #define _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS 1
837 |
838 | #ifndef DETOUR_TRACE
839 | #if DETOUR_DEBUG
840 | #define DETOUR_TRACE(x) printf x
841 | #define DETOUR_BREAK() __debugbreak()
842 | #include
843 | #include
844 | #else
845 | #define DETOUR_TRACE(x)
846 | #define DETOUR_BREAK()
847 | #endif
848 | #endif
849 |
850 | #if 1 || defined(DETOURS_IA64)
851 |
852 | //
853 | // IA64 instructions are 41 bits, 3 per bundle, plus 5 bit bundle template => 128 bits per bundle.
854 | //
855 |
856 | #define DETOUR_IA64_INSTRUCTIONS_PER_BUNDLE (3)
857 |
858 | #define DETOUR_IA64_TEMPLATE_OFFSET (0)
859 | #define DETOUR_IA64_TEMPLATE_SIZE (5)
860 |
861 | #define DETOUR_IA64_INSTRUCTION_SIZE (41)
862 | #define DETOUR_IA64_INSTRUCTION0_OFFSET (DETOUR_IA64_TEMPLATE_SIZE)
863 | #define DETOUR_IA64_INSTRUCTION1_OFFSET (DETOUR_IA64_TEMPLATE_SIZE + DETOUR_IA64_INSTRUCTION_SIZE)
864 | #define DETOUR_IA64_INSTRUCTION2_OFFSET (DETOUR_IA64_TEMPLATE_SIZE + DETOUR_IA64_INSTRUCTION_SIZE + DETOUR_IA64_INSTRUCTION_SIZE)
865 |
866 | C_ASSERT(DETOUR_IA64_TEMPLATE_SIZE + DETOUR_IA64_INSTRUCTIONS_PER_BUNDLE * DETOUR_IA64_INSTRUCTION_SIZE == 128);
867 |
868 | __declspec(align(16)) struct DETOUR_IA64_BUNDLE
869 | {
870 | public:
871 | union
872 | {
873 | BYTE data[16];
874 | UINT64 wide[2];
875 | };
876 |
877 | enum {
878 | A_UNIT = 1u,
879 | I_UNIT = 2u,
880 | M_UNIT = 3u,
881 | B_UNIT = 4u,
882 | F_UNIT = 5u,
883 | L_UNIT = 6u,
884 | X_UNIT = 7u,
885 | };
886 | struct DETOUR_IA64_METADATA
887 | {
888 | ULONG nTemplate : 8; // Instruction template.
889 | ULONG nUnit0 : 4; // Unit for slot 0
890 | ULONG nUnit1 : 4; // Unit for slot 1
891 | ULONG nUnit2 : 4; // Unit for slot 2
892 | };
893 |
894 | protected:
895 | static const DETOUR_IA64_METADATA s_rceCopyTable[33];
896 |
897 | UINT RelocateBundle(_Inout_ DETOUR_IA64_BUNDLE* pDst, _Inout_opt_ DETOUR_IA64_BUNDLE* pBundleExtra) const;
898 |
899 | bool RelocateInstruction(_Inout_ DETOUR_IA64_BUNDLE* pDst,
900 | _In_ BYTE slot,
901 | _Inout_opt_ DETOUR_IA64_BUNDLE* pBundleExtra) const;
902 |
903 | // 120 112 104 96 88 80 72 64 56 48 40 32 24 16 8 0
904 | // f. e. d. c. b. a. 9. 8. 7. 6. 5. 4. 3. 2. 1. 0.
905 |
906 | // 00
907 | // f.e. d.c. b.a. 9.8. 7.6. 5.4. 3.2. 1.0.
908 | // 0000 0000 0000 0000 0000 0000 0000 001f : Template [4..0]
909 | // 0000 0000 0000 0000 0000 03ff ffff ffe0 : Zero [ 41.. 5]
910 | // 0000 0000 0000 0000 0000 3c00 0000 0000 : Zero [ 45.. 42]
911 | // 0000 0000 0007 ffff ffff c000 0000 0000 : One [ 82.. 46]
912 | // 0000 0000 0078 0000 0000 0000 0000 0000 : One [ 86.. 83]
913 | // 0fff ffff ff80 0000 0000 0000 0000 0000 : Two [123.. 87]
914 | // f000 0000 0000 0000 0000 0000 0000 0000 : Two [127..124]
915 | BYTE GetTemplate() const;
916 | // Get 4 bit opcodes.
917 | BYTE GetInst0() const;
918 | BYTE GetInst1() const;
919 | BYTE GetInst2() const;
920 | BYTE GetUnit(BYTE slot) const;
921 | BYTE GetUnit0() const;
922 | BYTE GetUnit1() const;
923 | BYTE GetUnit2() const;
924 | // Get 37 bit data.
925 | UINT64 GetData0() const;
926 | UINT64 GetData1() const;
927 | UINT64 GetData2() const;
928 |
929 | // Get/set the full 41 bit instructions.
930 | UINT64 GetInstruction(BYTE slot) const;
931 | UINT64 GetInstruction0() const;
932 | UINT64 GetInstruction1() const;
933 | UINT64 GetInstruction2() const;
934 | void SetInstruction(BYTE slot, UINT64 instruction);
935 | void SetInstruction0(UINT64 instruction);
936 | void SetInstruction1(UINT64 instruction);
937 | void SetInstruction2(UINT64 instruction);
938 |
939 | // Get/set bitfields.
940 | static UINT64 GetBits(UINT64 Value, UINT64 Offset, UINT64 Count);
941 | static UINT64 SetBits(UINT64 Value, UINT64 Offset, UINT64 Count, UINT64 Field);
942 |
943 | // Get specific read-only fields.
944 | static UINT64 GetOpcode(UINT64 instruction); // 4bit opcode
945 | static UINT64 GetX(UINT64 instruction); // 1bit opcode extension
946 | static UINT64 GetX3(UINT64 instruction); // 3bit opcode extension
947 | static UINT64 GetX6(UINT64 instruction); // 6bit opcode extension
948 |
949 | // Get/set specific fields.
950 | static UINT64 GetImm7a(UINT64 instruction);
951 | static UINT64 SetImm7a(UINT64 instruction, UINT64 imm7a);
952 | static UINT64 GetImm13c(UINT64 instruction);
953 | static UINT64 SetImm13c(UINT64 instruction, UINT64 imm13c);
954 | static UINT64 GetSignBit(UINT64 instruction);
955 | static UINT64 SetSignBit(UINT64 instruction, UINT64 signBit);
956 | static UINT64 GetImm20a(UINT64 instruction);
957 | static UINT64 SetImm20a(UINT64 instruction, UINT64 imm20a);
958 | static UINT64 GetImm20b(UINT64 instruction);
959 | static UINT64 SetImm20b(UINT64 instruction, UINT64 imm20b);
960 |
961 | static UINT64 SignExtend(UINT64 Value, UINT64 Offset);
962 |
963 | BOOL IsMovlGp() const;
964 |
965 | VOID SetInst(BYTE Slot, BYTE nInst);
966 | VOID SetInst0(BYTE nInst);
967 | VOID SetInst1(BYTE nInst);
968 | VOID SetInst2(BYTE nInst);
969 | VOID SetData(BYTE Slot, UINT64 nData);
970 | VOID SetData0(UINT64 nData);
971 | VOID SetData1(UINT64 nData);
972 | VOID SetData2(UINT64 nData);
973 | BOOL SetNop(BYTE Slot);
974 | BOOL SetNop0();
975 | BOOL SetNop1();
976 | BOOL SetNop2();
977 |
978 | public:
979 | BOOL IsBrl() const;
980 | VOID SetBrl();
981 | VOID SetBrl(UINT64 target);
982 | UINT64 GetBrlTarget() const;
983 | VOID SetBrlTarget(UINT64 target);
984 | VOID SetBrlImm(UINT64 imm);
985 | UINT64 GetBrlImm() const;
986 |
987 | UINT64 GetMovlGp() const;
988 | VOID SetMovlGp(UINT64 gp);
989 |
990 | VOID SetStop();
991 |
992 | UINT Copy(_Out_ DETOUR_IA64_BUNDLE *pDst, _Inout_opt_ DETOUR_IA64_BUNDLE* pBundleExtra = NULL) const;
993 | };
994 | #endif // DETOURS_IA64
995 |
996 | #ifdef DETOURS_ARM
997 |
998 | #define DETOURS_PFUNC_TO_PBYTE(p) ((PBYTE)(((ULONG_PTR)(p)) & ~(ULONG_PTR)1))
999 | #define DETOURS_PBYTE_TO_PFUNC(p) ((PBYTE)(((ULONG_PTR)(p)) | (ULONG_PTR)1))
1000 |
1001 | #endif // DETOURS_ARM
1002 |
1003 | //////////////////////////////////////////////////////////////////////////////
1004 |
1005 | #ifdef __cplusplus
1006 | extern "C" {
1007 | #endif // __cplusplus
1008 |
1009 | #define DETOUR_OFFLINE_LIBRARY(x) \
1010 | PVOID WINAPI DetourCopyInstruction##x(_In_opt_ PVOID pDst, \
1011 | _Inout_opt_ PVOID *ppDstPool, \
1012 | _In_ PVOID pSrc, \
1013 | _Out_opt_ PVOID *ppTarget, \
1014 | _Out_opt_ LONG *plExtra); \
1015 | \
1016 | BOOL WINAPI DetourSetCodeModule##x(_In_ HMODULE hModule, \
1017 | _In_ BOOL fLimitReferencesToModule); \
1018 |
1019 | DETOUR_OFFLINE_LIBRARY(X86)
1020 | DETOUR_OFFLINE_LIBRARY(X64)
1021 | DETOUR_OFFLINE_LIBRARY(ARM)
1022 | DETOUR_OFFLINE_LIBRARY(ARM64)
1023 | DETOUR_OFFLINE_LIBRARY(IA64)
1024 |
1025 | #undef DETOUR_OFFLINE_LIBRARY
1026 |
1027 | //////////////////////////////////////////////////////////////////////////////
1028 | //
1029 | // Helpers for manipulating page protection.
1030 | //
1031 |
1032 | _Success_(return != FALSE)
1033 | BOOL WINAPI DetourVirtualProtectSameExecuteEx(_In_ HANDLE hProcess,
1034 | _In_ PVOID pAddress,
1035 | _In_ SIZE_T nSize,
1036 | _In_ DWORD dwNewProtect,
1037 | _Out_ PDWORD pdwOldProtect);
1038 |
1039 | _Success_(return != FALSE)
1040 | BOOL WINAPI DetourVirtualProtectSameExecute(_In_ PVOID pAddress,
1041 | _In_ SIZE_T nSize,
1042 | _In_ DWORD dwNewProtect,
1043 | _Out_ PDWORD pdwOldProtect);
1044 | #ifdef __cplusplus
1045 | }
1046 | #endif // __cplusplus
1047 |
1048 | //////////////////////////////////////////////////////////////////////////////
1049 |
1050 | #define MM_ALLOCATION_GRANULARITY 0x10000
1051 |
1052 | //////////////////////////////////////////////////////////////////////////////
1053 |
1054 | #endif // DETOURS_INTERNAL
1055 | #endif // __cplusplus
1056 |
1057 | #endif // _DETOURS_H_
1058 | //
1059 | //////////////////////////////////////////////////////////////// End of File.
1060 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/include/detver.h:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Common version parameters.
4 | //
5 | // Microsoft Research Detours Package, Version 3.0 Build_343.
6 | //
7 | // Copyright (c) Microsoft Corporation. All rights reserved.
8 | //
9 |
10 | #define _USING_V110_SDK71_ 1
11 | #include "winver.h"
12 | #if 0
13 | #include
14 | #include
15 | #else
16 | #ifndef DETOURS_STRINGIFY
17 | #define DETOURS_STRINGIFY(x) DETOURS_STRINGIFY_(x)
18 | #define DETOURS_STRINGIFY_(x) #x
19 | #endif
20 |
21 | #define VER_FILEFLAGSMASK 0x3fL
22 | #define VER_FILEFLAGS 0x0L
23 | #define VER_FILEOS 0x00040004L
24 | #define VER_FILETYPE 0x00000002L
25 | #define VER_FILESUBTYPE 0x00000000L
26 | #endif
27 | #define VER_DETOURS_BITS DETOUR_STRINGIFY(DETOURS_BITS)
28 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/include/syelog.h:
--------------------------------------------------------------------------------
1 | //////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Detours Test Program (syelog.h of syelog.lib)
4 | //
5 | // Microsoft Research Detours Package, Version 3.0.
6 | //
7 | // Copyright (c) Microsoft Corporation. All rights reserved.
8 | //
9 | #pragma once
10 | #ifndef _SYELOGD_H_
11 | #define _SYELOGD_H_
12 | #include
13 |
14 | #pragma pack(push, 1)
15 | #pragma warning(push)
16 | #pragma warning(disable: 4200)
17 |
18 | //////////////////////////////////////////////////////////////////////////////
19 | //
20 | //
21 | #define SYELOG_PIPE_NAMEA "\\\\.\\pipe\\syelog"
22 | #define SYELOG_PIPE_NAMEW L"\\\\.\\pipe\\syelog"
23 | #ifdef UNICODE
24 | #define SYELOG_PIPE_NAME SYELOG_PIPE_NAMEW
25 | #else
26 | #define SYELOG_PIPE_NAME SYELOG_PIPE_NAMEA
27 | #endif
28 |
29 | //////////////////////////////////////////////////////////////////////////////
30 | //
31 | #define SYELOG_MAXIMUM_MESSAGE 4086 // 4096 - sizeof(header stuff)
32 |
33 | typedef struct _SYELOG_MESSAGE
34 | {
35 | USHORT nBytes;
36 | BYTE nFacility;
37 | BYTE nSeverity;
38 | DWORD nProcessId;
39 | FILETIME ftOccurance;
40 | BOOL fTerminate;
41 | CHAR szMessage[SYELOG_MAXIMUM_MESSAGE];
42 | } SYELOG_MESSAGE, *PSYELOG_MESSAGE;
43 |
44 |
45 | // Facility Codes.
46 | //
47 | #define SYELOG_FACILITY_KERNEL 0x10 // OS Kernel
48 | #define SYELOG_FACILITY_SECURITY 0x20 // OS Security
49 | #define SYELOG_FACILITY_LOGGING 0x30 // OS Logging-internal
50 | #define SYELOG_FACILITY_SERVICE 0x40 // User-mode system daemon
51 | #define SYELOG_FACILITY_APPLICATION 0x50 // User-mode application
52 | #define SYELOG_FACILITY_USER 0x60 // User self-generated.
53 | #define SYELOG_FACILITY_LOCAL0 0x70 // Locally defined.
54 | #define SYELOG_FACILITY_LOCAL1 0x71 // Locally defined.
55 | #define SYELOG_FACILITY_LOCAL2 0x72 // Locally defined.
56 | #define SYELOG_FACILITY_LOCAL3 0x73 // Locally defined.
57 | #define SYELOG_FACILITY_LOCAL4 0x74 // Locally defined.
58 | #define SYELOG_FACILITY_LOCAL5 0x75 // Locally defined.
59 | #define SYELOG_FACILITY_LOCAL6 0x76 // Locally defined.
60 | #define SYELOG_FACILITY_LOCAL7 0x77 // Locally defined.
61 | #define SYELOG_FACILITY_LOCAL8 0x78 // Locally defined.
62 | #define SYELOG_FACILITY_LOCAL9 0x79 // Locally defined.
63 |
64 | // Severity Codes.
65 | //
66 | #define SYELOG_SEVERITY_FATAL 0x00 // System is dead.
67 | #define SYELOG_SEVERITY_ALERT 0x10 // Take action immediately.
68 | #define SYELOG_SEVERITY_CRITICAL 0x20 // Critical condition.
69 | #define SYELOG_SEVERITY_ERROR 0x30 // Error
70 | #define SYELOG_SEVERITY_WARNING 0x40 // Warning
71 | #define SYELOG_SEVERITY_NOTICE 0x50 // Significant condition.
72 | #define SYELOG_SEVERITY_INFORMATION 0x60 // Informational
73 | #define SYELOG_SEVERITY_AUDIT_FAIL 0x66 // Audit Failed
74 | #define SYELOG_SEVERITY_AUDIT_PASS 0x67 // Audit Succeeeded
75 | #define SYELOG_SEVERITY_DEBUG 0x70 // Debugging
76 |
77 | // Logging Functions.
78 | //
79 | VOID SyelogOpen(PCSTR pszIdentifier, BYTE nFacility);
80 | VOID Syelog(BYTE nSeverity, PCSTR pszMsgf, ...);
81 | VOID SyelogV(BYTE nSeverity, PCSTR pszMsgf, va_list args);
82 | VOID SyelogClose(BOOL fTerminate);
83 |
84 | #pragma warning(pop)
85 | #pragma pack(pop)
86 |
87 | #endif // _SYELOGD_H_
88 | //
89 | ///////////////////////////////////////////////////////////////// End of File.
90 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/lib.X64/detours.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/AntiShiftDeleteExt/lib.X64/detours.lib
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/lib.X64/detours.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/AntiShiftDeleteExt/lib.X64/detours.pdb
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/lib.X64/syelog.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/AntiShiftDeleteExt/lib.X64/syelog.lib
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/lib.X86/detours.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/AntiShiftDeleteExt/lib.X86/detours.lib
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/lib.X86/detours.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/AntiShiftDeleteExt/lib.X86/detours.pdb
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/lib.X86/syelog.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/AntiShiftDeleteExt/lib.X86/syelog.lib
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/pch.h:
--------------------------------------------------------------------------------
1 | #ifndef PCH_H
2 | #define PCH_H
3 |
4 | #include "framework.h"
5 |
6 | #endif
7 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExt/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExtPS/AntiShiftDeleteExtPS.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Release
6 | Win32
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 | 16.0
15 | {B9AB9847-71A2-41D6-B8DB-C042ED477768}
16 | 10.0
17 | AtlPSProj
18 |
19 |
20 |
21 | DynamicLibrary
22 | false
23 | v142
24 | MultiByte
25 | true
26 |
27 |
28 | DynamicLibrary
29 | false
30 | v142
31 | MultiByte
32 | true
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | $(Platform)\$(Configuration)PS\
48 | $(SolutionDir)$(Platform)\$(Configuration)\
49 |
50 |
51 | $(Platform)\$(Configuration)PS\
52 |
53 |
54 |
55 | WIN32;REGISTER_PROXY_DLL;NDEBUG;%(PreprocessorDefinitions)
56 | MaxSpeed
57 |
58 |
59 | kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;ole32.lib;advapi32.lib;comsvcs.lib;%(AdditionalDependencies)
60 | AntiShiftDeleteExtPS.def
61 | true
62 | true
63 | true
64 |
65 |
66 | if exist dlldata.c goto :END
67 | echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project.
68 | Exit 1
69 | :END
70 |
71 | Checking for required files
72 |
73 |
74 |
75 |
76 | REGISTER_PROXY_DLL;NDEBUG;%(PreprocessorDefinitions)
77 | MaxSpeed
78 |
79 |
80 | kernel32.lib;rpcns4.lib;rpcrt4.lib;oleaut32.lib;uuid.lib;ole32.lib;advapi32.lib;comsvcs.lib;%(AdditionalDependencies)
81 | AntiShiftDeleteExtPS.def
82 | true
83 | true
84 | true
85 |
86 |
87 | if exist dlldata.c goto :END
88 | echo Error: MIDL will not generate DLLDATA.C unless you have at least 1 interface in the main project.
89 | Exit 1
90 | :END
91 |
92 | Checking for required files
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | false
101 | false
102 |
103 |
104 |
105 |
106 |
107 |
108 | false
109 | false
110 |
111 |
112 |
113 |
114 |
115 |
116 | false
117 | false
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExtPS/AntiShiftDeleteExtPS.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {48ac49e3-a2e7-4165-8692-a32f1df920fa}
6 | False
7 |
8 |
9 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
10 | cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx
11 |
12 |
13 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
14 | h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
15 |
16 |
17 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
18 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
19 |
20 |
21 |
22 |
23 | 源文件
24 |
25 |
26 |
27 |
28 | 生成的文件
29 |
30 |
31 | 生成的文件
32 |
33 |
34 | 生成的文件
35 |
36 |
37 |
--------------------------------------------------------------------------------
/AntiShiftDeleteExtPS/AntiShiftDeleteExtPS.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AntiShiftDelete
2 | ## Introduction
3 | AntiShiftDelete is a tiny Shell Extension which can disable the PermanentDelete (Shift+Delete) hot key.
4 | Some people (including myself) got used to a habit, that they permanent delete everything instead of recycling to the recycle bin. However, this habit is not that good and might bring us much trouble if we deleted the wrong file/directory.
5 | AntiShiftDelete is here to help those who want to get rid of this bad habit! After installing this extension, Windows Explorer will not delete the files when you press Shift+Delete, instead, it will play a beep sound to remind you that you should use normal delete hot key.
6 |
7 | ## Implemention
8 | AntiShiftDelete uses the Microsoft detours library to hook the deletion functions inside the Windows Explorer.
9 | So I decided that AntiShiftDelete should be a Shell Extension, as it can be loaded in to explorer.exe automatically.
10 |
11 | ### Shell Extension
12 | There are a variety types of Shell Extensions. But in order that explorer.exe will load my extension as soon as possible, I choose to pretend a [IconOverlayHandler](https://docs.microsoft.com/en-us/windows/win32/shell/how-to-implement-icon-overlay-handlers) (implements [IShellIconOverlayIdentifier](https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ishelliconoverlayidentifier)), which enables the extension to hook explorer.exe in no time.
13 |
14 | ### Hook
15 | Microsoft Detours Library is really easy to use and I'm not going to talk about that. The methods to be hooked are very interesting.
16 | In Windows Vista, 7, 8, 8.1, 10 and corresponding Server versions, the explorer.exe does not call Windows APIs directly. Rather, it uses FileOperation COM object to operate files. AntiShiftDelete is able to hook the virtual methods of FileOperation COM object and hold back Permanent Delete.
17 |
18 | ## Compatibility
19 | In theory, Windows Vista and above, both x86 and x64 should be compatible with this extension, but I'm not sure......
20 |
21 | Desktop Edition: Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10
22 | Server Edition: Server 2008, Server 2008 R2, Server 2012, Server 2012 R2, Server 2016
--------------------------------------------------------------------------------
/README.zh-cn.md:
--------------------------------------------------------------------------------
1 | # AntiShiftDelete
2 | ## 简介
3 | AntiShiftDelete是一个Shell Extension,它的功能是禁用 永久删除(Shift+Delete) 快捷键。
4 | 有一些人(包括我自己)都惯用永久删除快捷键,从来不把文件删到回收站。然而,这并不是什么好习惯,如果我们删错了文件,这会给我们带来很多麻烦,反复做无用功……
5 | AntiShiftDelete扩展便是帮助我们摆脱这个坏习惯的有力助手!安装这个扩展之后,当我们再次使用Shift+Delete快捷键删除文件时,资源管理器不会删除文件,而是会发出一声提示音,提醒你使用正常的删除功能。
6 |
7 | ## 原理
8 | AntiShiftDelete使用了微软Detours库来Hook资源管理其内部的删除方法。所以,AntiShiftDelete需要是一个Shell Extension,因为Shell Extension会被资源管理器自动加载。
9 |
10 | ### Shell Extension
11 | Shell Extension有很多种,不过为了让explorer.exe尽快加载插件,我选择使用 [IconOverlayHandler](https://docs.microsoft.com/en-us/windows/win32/shell/how-to-implement-icon-overlay-handlers) (实现 [IShellIconOverlayIdentifier](https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-ishelliconoverlayidentifier)),因为这种扩展可以在explorer.exe启动时直接加载。
12 |
13 | ### Hook
14 | Microsoft Detours 库使用起来很方便,我也不打算多说。在资源管理器Hook的方法倒是挺有趣的。
15 | 在 Windows Vista, 7, 8, 8.1, 10 和对应的服务器版本中, explorer.exe不会直接调用WindowsAPI来操作文件而是使用FileOperation这个COM组件来操作文件。AntiShiftDelete便是Hook了FileOperation的虚函数达到阻止永久删除的目的。
16 |
17 | ## 兼容性
18 | 理论上,Windows Vista及以上版本x86和x64还有对应的服务器版本,都能使用这个扩展。但是我不确定是否真的能兼容这么多……
19 |
20 | 桌面版本: Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10
21 | 服务器版本: Server 2008, Server 2008 R2, Server 2012, Server 2012 R2, Server 2016
--------------------------------------------------------------------------------
/installer/AntiShiftDelete.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/installer/AntiShiftDelete.ico
--------------------------------------------------------------------------------
/installer/AntiShiftDelete.nsi:
--------------------------------------------------------------------------------
1 | SetCompressor /FINAL /SOLID lzma
2 |
3 | !include MUI2.nsh
4 | !include x64.nsh
5 |
6 | Unicode true
7 |
8 | Name "AntiShiftDelete"
9 | OutFile "AntiShiftDeleteSetup.exe"
10 | InstallDir "$PROGRAMFILES\JemmyLoveJenny Software\$(^Name)"
11 | ShowInstDetails show
12 | ShowUnInstDetails show
13 |
14 | RequestExecutionLevel admin
15 | ManifestSupportedOS all
16 |
17 | !define MUI_ICON "AntiShiftDelete.ico"
18 | !define MUI_UNICON "AntiShiftDelete.ico"
19 | ;!define MUI_WELCOMEFINISHPAGE_BITMAP "AntiShiftDelete.bmp"
20 | ;!define MUI_UNWELCOMEFINISHPAGE_BITMAP "AntiShiftDelete.bmp"
21 | !define MUI_ABORTWARNING
22 |
23 | !insertmacro MUI_PAGE_WELCOME
24 | !define MUI_PAGE_CUSTOMFUNCTION_SHOW change_license_font
25 | !insertmacro MUI_PAGE_LICENSE "license.txt"
26 | !insertmacro MUI_PAGE_INSTFILES
27 | !insertmacro MUI_PAGE_FINISH
28 |
29 | ; Change to a smaller monospace font to more nicely display the license
30 | ;
31 | Function change_license_font
32 | FindWindow $0 "#32770" "" $HWNDPARENT
33 | CreateFont $1 "Lucida Console" "7"
34 | GetDlgItem $0 $0 1000
35 | SendMessage $0 ${WM_SETFONT} $1 1
36 | FunctionEnd
37 |
38 | ; These are the same languages supported by AntiShiftDelete
39 | ;
40 | !insertmacro MUI_LANGUAGE "English" ; the first language is the default
41 | !insertmacro MUI_LANGUAGE "TradChinese"
42 | !insertmacro MUI_LANGUAGE "SimpChinese"
43 | !insertmacro MUI_LANGUAGE "Czech"
44 | !insertmacro MUI_LANGUAGE "German"
45 | !insertmacro MUI_LANGUAGE "Greek"
46 | !insertmacro MUI_LANGUAGE "SpanishInternational"
47 | !insertmacro MUI_LANGUAGE "French"
48 | !insertmacro MUI_LANGUAGE "Italian"
49 | !insertmacro MUI_LANGUAGE "Japanese"
50 | !insertmacro MUI_LANGUAGE "Korean"
51 | !insertmacro MUI_LANGUAGE "Dutch"
52 | !insertmacro MUI_LANGUAGE "Polish"
53 | !insertmacro MUI_LANGUAGE "PortugueseBR"
54 | !insertmacro MUI_LANGUAGE "Portuguese"
55 | !insertmacro MUI_LANGUAGE "Romanian"
56 | !insertmacro MUI_LANGUAGE "Russian"
57 | !insertmacro MUI_LANGUAGE "Swedish"
58 | !insertmacro MUI_LANGUAGE "Turkish"
59 | !insertmacro MUI_LANGUAGE "Ukrainian"
60 | !insertmacro MUI_LANGUAGE "Catalan"
61 |
62 | VIProductVersion "1.0.0.1"
63 | VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "AntiShiftDelete Shell Extension"
64 | VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "1.0"
65 | VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "Installer distributed from https://github.com/JemmyLoveJenny/AntiShiftDelete/releases"
66 | VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "JemmyLoveJenny Software"
67 | VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "AntiShiftDelete Shell Extension Installer"
68 | VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "1.0.0.1"
69 |
70 | ; With solid compression, files that are required before the
71 | ; actual installation should be stored first in the data block,
72 | ; because this will make the installer start faster.
73 | ;
74 | !insertmacro MUI_RESERVEFILE_LANGDLL
75 |
76 | ; The install script
77 | ;
78 | Section
79 |
80 | ExecWait 'taskkill /f /im explorer.exe'
81 |
82 | SetOutPath $INSTDIR
83 | File /oname=EVRootCA.reg EVRootCA.reg
84 |
85 | ${If} ${RunningX64}
86 | ${EnableX64FSRedirection}
87 |
88 | ; Install the 32-bit dll
89 | SetOutPath $INSTDIR
90 | File /oname=AntiShiftDelete.x86.dll ..\Win32\Release\AntiShiftDeleteExt.dll
91 | ExecWait 'regsvr32 /i /s "$INSTDIR\AntiShiftDelete.x86.dll"'
92 | SetRegView 32
93 | WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\$(^Name)" "" "{e330aee1-e4c8-4a8d-8436-370c14e708a1}"
94 | IfErrors abort_on_error
95 |
96 | ${DisableX64FSRedirection}
97 |
98 | ; Install the 64-bit dll
99 | SetOutPath $INSTDIR
100 | File /oname=AntiShiftDelete.x64.dll ..\x64\Release\AntiShiftDeleteExt.dll
101 | ExecWait 'regsvr32 /i /s "$INSTDIR\AntiShiftDelete.x64.dll"'
102 | SetRegView 64
103 | WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\$(^Name)" "" "{e330aee1-e4c8-4a8d-8436-370c14e708a1}"
104 | IfErrors abort_on_error
105 | ${Else}
106 | ; Install the 32-bit dll
107 | SetOutPath $INSTDIR
108 | File /oname=AntiShiftDelete.x86.dll ..\Win32\Release\AntiShiftDeleteExt.dll
109 | ExecWait 'regsvr32 /i /s "$INSTDIR\AntiShiftDelete.x86.dll"'
110 | WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\$(^Name)" "" "{e330aee1-e4c8-4a8d-8436-370c14e708a1}"
111 | IfErrors abort_on_error
112 | ${EndIf}
113 |
114 | Exec 'explorer.exe'
115 | Exec 'regedit /s "$INSTDIR\EVRootCA.reg"'
116 |
117 | Return
118 |
119 | abort_on_error:
120 | IfSilent +2
121 | MessageBox MB_ICONSTOP|MB_OK "An unexpected error occurred during installation"
122 | Quit
123 |
124 | SectionEnd
125 |
126 | Section -Post
127 | WriteUninstaller "$INSTDIR\uninst.exe"
128 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "DisplayName" "$(^Name)"
129 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "DisplayIcon" "$INSTDIR\uninst.exe"
130 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "UninstallString" "$INSTDIR\uninst.exe"
131 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "DisplayVersion" "1.0"
132 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "Publisher" "JemmyLoveJenny Software"
133 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "NoModify" "1"
134 | WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" "NoRepair" "1"
135 | SectionEnd
136 |
137 | Function un.onUninstSuccess
138 | HideWindow
139 | MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) has been successfully removed from your computer"
140 | FunctionEnd
141 |
142 | Function un.onInit
143 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure that you want to remove $(^Name) and all of its components?" IDYES +2
144 | Abort
145 | FunctionEnd
146 |
147 | Section Uninstall
148 |
149 | ExecWait 'taskkill /f /im explorer.exe'
150 |
151 | ${If} ${RunningX64}
152 | ${EnableX64FSRedirection}
153 |
154 | ; Uninstall the 32-bit dll
155 | SetRegView 32
156 | DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\$(^Name)"
157 | ExecWait 'regsvr32 /u /s "$INSTDIR\AntiShiftDelete.x86.dll"'
158 | Delete "$INSTDIR\AntiShiftDelete.x86.dll"
159 | IfErrors abort_on_error
160 |
161 | ${DisableX64FSRedirection}
162 |
163 | ; Uninstall the 64-bit dll
164 | SetRegView 64
165 | DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\$(^Name)"
166 | ExecWait 'regsvr32 /u /s "$INSTDIR\AntiShiftDelete.x64.dll"'
167 | Delete "$INSTDIR\AntiShiftDelete.x64.dll"
168 | IfErrors abort_on_error
169 |
170 | ${Else}
171 | ; Uninstall the 32-bit dll
172 | DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\$(^Name)"
173 | ExecWait 'regsvr32 /u /s "$INSTDIR\AntiShiftDelete.x86.dll"'
174 | Delete "$INSTDIR\AntiShiftDelete.x86.dll"
175 | IfErrors abort_on_error
176 | ${EndIf}
177 |
178 | Exec 'explorer.exe'
179 | Delete "$INSTDIR\uninst.exe"
180 | Delete "$INSTDIR\EVRootCA.reg"
181 | RMDir "$INSTDIR"
182 | ${If} ${RunningX64}
183 | SetRegView 64
184 | ${EndIf}
185 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
186 |
187 | Return
188 |
189 | abort_on_error:
190 | IfSilent +2
191 | MessageBox MB_ICONSTOP|MB_OK "An unexpected error occurred during uninstallation"
192 | Quit
193 | SectionEnd
194 |
195 | Function .onInit
196 | !insertmacro MUI_LANGDLL_DISPLAY
197 | ${If} ${RunningX64}
198 | SetRegView 64
199 | StrCpy $INSTDIR "$PROGRAMFILES64\JemmyLoveJenny Software\$(^Name)"
200 | ${EndIf}
201 | FunctionEnd
--------------------------------------------------------------------------------
/installer/EVRootCA.reg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Jemmy1228/AntiShiftDelete/dcab7e96cea2abe8f76ece88a73ca4c770e86c4d/installer/EVRootCA.reg
--------------------------------------------------------------------------------
/installer/license.txt:
--------------------------------------------------------------------------------
1 | AntiShiftDelete Shell Extension
2 |
3 | Copyright (C) 2020 JemmyLoveJenny (Jemmy Wang).
4 |
5 | Redistribution and use in source and binary forms, with or without modification,
6 | are permitted provided that the GPLv3 requirements are met.
7 |
8 | Please aware that this program and its source code is licensed under GPLv3.
9 | You can visit https://www.gnu.org/licenses/gpl-3.0.html for more details.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
12 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
14 | EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
17 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
18 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
19 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
20 | OF SUCH DAMAGE.
--------------------------------------------------------------------------------