(empty log message)
@@ -0,0 +1,180 @@ | ||
1 | +▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽▲▽ | |
2 | + | |
3 | + AlterDnD (ドラッグ&ドロップ改変ツール) Ver.1.0 2013/06/10 | |
4 | + しゅう(S Project) | |
5 | + http://sourceforge.jp/projects/alterdnd/ | |
6 | + http://s-project.appspot.com/ | |
7 | + | |
8 | + | |
9 | +△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼△▼ | |
10 | + | |
11 | + | |
12 | +■ 著作権について | |
13 | + | |
14 | + ドラッグ&ドロップ改変ツール(AlterDnD)はGNU General Public Licenseに | |
15 | + 基づくソフトウェアで、どなたでも自由に利用することができます。 | |
16 | + ライセンスの全文は同封の LICENCE.txt で確認して下さい。 | |
17 | + | |
18 | + 当ソフトウェアの著作権は、コードの作成者がそれぞれ保有します。 | |
19 | + ソースファイルは下記の場所から入手できます。 | |
20 | + | |
21 | + SourceForge.JP http://sourceforge.jp/projects/alterdnd/scm/ | |
22 | + | |
23 | + 当ソフトウェアの複製、頒布、改変はGNU General Public Licenseに従って行ってください。 | |
24 | + | |
25 | + | |
26 | +■ 免責事項 | |
27 | + | |
28 | + 当ソフトウェアには、明示的、暗示的を問わず、いかなる種類の保証もありません。 | |
29 | + ソフトウェアを利用した事によって生じた損害について、作成者は一切の責任を負いません。 | |
30 | + また、改善、要望、その他サポートなどの要求に対し、何らの義務も負いません。 | |
31 | + | |
32 | + この文書の内容及びソフトウェアの仕様は、予告無しに変更することがあります。 | |
33 | + | |
34 | + | |
35 | +■ 当ソフトの目的 | |
36 | + | |
37 | + 在ったはずのファイルが、いつの間にか他のフォルダに移動していた経験はありませんか? | |
38 | + 管理者の方なら「ファイルファイルが行方不明になった。」という苦情があって、 | |
39 | + 調べてみたら、隣のフォルダに移動していた、なんて経験があるかと思います。 | |
40 | + ほとんどの場合、この原因は意図しないドラッグ&ドロップ操作にあります。 | |
41 | + PCに慣れていない人の場合、本人はファイルをクリックしたつもりでも、ドラッグ操作と | |
42 | + 認識されてしまうことがよくあります。 | |
43 | + また、慣れた人でもあっても、ノートPCのトラックパッドなどでは、意図しないクリックや | |
44 | + ドラッグが発生して、誤った操作になってしまうことがあります。 | |
45 | + | |
46 | + 当ソフトは、これらの意図しないドラッグ&ドロップ操作を防止する目的で作成しています。 | |
47 | + | |
48 | + | |
49 | +■ 当ソフトについて | |
50 | + | |
51 | + 当ソフトはWindows(エクスプローラ)でのファイルのドラッグ&ドロップの動作を | |
52 | + 変更するユーティリティソフトです。 | |
53 | + マウスの左ボタンでのドラッグ&ドロップを下記の様に変更します。 | |
54 | + (正確には、ドロップ対象の動作を変更します。) | |
55 | + | |
56 | + ・通常通り | |
57 | + マウスの左ボタンでドラッグ&ドロップを通常通り許可します。 | |
58 | + | |
59 | + ・Shift/Ctrl/Altキーを押した時のみ許可 | |
60 | + Shiftキー、Ctrlキー、Altキーのいずれかを押している場合のみ、ドロップを許可します。 | |
61 | + それぞれのキーを押した時の動作は下記の通りです。 | |
62 | + (※状況によっては必ずしも下記の通りにならない場合があります。) | |
63 | + | |
64 | + Shiftキー :移動 | |
65 | + Ctrlキー :コピー | |
66 | + Altキー :リンクを作成 | |
67 | + | |
68 | + ・右ボタンでドラッグした様に振舞う | |
69 | + マウスの右ボタンでドラッグ&ドロップした場合の様に振舞います。 | |
70 | + 通常、ドロップしたときにコンテキストメニューが表示されます。 | |
71 | + | |
72 | + ・ドロップを禁止 | |
73 | + マウスの左ボタンでドロップを禁止します。 | |
74 | + | |
75 | + | |
76 | + 動作を変更する対象は下記の通りです。 | |
77 | + | |
78 | + ・エクスプローラ | |
79 | + ・デスクトップ | |
80 | + | |
81 | + | |
82 | +■ファイル | |
83 | + | |
84 | + ReadMe.txt このファイル | |
85 | + LICENCE.txt ライセンス条文(GPLv3) | |
86 | + | |
87 | + AlterDnD32.exe 32bit環境の実行ファイル | |
88 | + AlterDnDDLL32.dll 32bit環境のDLL | |
89 | + AlterDnD32_ja.dll 32bit環境の日本語リソース | |
90 | + | |
91 | + AlterDnD64.exe 64bit環境の実行ファイル | |
92 | + AlterDnDDLL64.dll 64bit環境のDLL | |
93 | + AlterDnD64_ja.dll 64bit環境の日本語リソース | |
94 | + | |
95 | + ※AlterDnD32.exe、AlterDnD64.exe は実行環境に応じてどちらかを実行してください。 | |
96 | + ※AlterDnD.exe と記述されている部分は、実行環境に応じて、 | |
97 | + AlterDnD32.exe または、AlterDnD64.exe と読み替えてください。 | |
98 | + | |
99 | + | |
100 | +■ 既知の問題/制限事項 | |
101 | + | |
102 | + ・AlterDnD.exeを終了しても、DLLが開放されません。 | |
103 | + DLLを削除するには、一度ログアウトする必要があります。 | |
104 | + (explorer.exe の再起動でも可) | |
105 | + | |
106 | + | |
107 | +■ 動作環境 | |
108 | + | |
109 | + Microsoft Windows XP / Vista(x86,x64) / 7(x86,x64) / 8(x36,x64) が動作する環境 | |
110 | + | |
111 | + ※サーバでの動作は推奨しません。万が一の場合、再起動が必要になる可能性があります。 | |
112 | + | |
113 | + | |
114 | +■ インストール | |
115 | + | |
116 | + AlterDnD_X.X.X.zip をダウンロードして、適当なフォルダに展開してください。 | |
117 | + ファイルを展開した後、AlterDnD.exe を実行してください。 | |
118 | + | |
119 | + ログイン時に自動実行する場合は、スタートメニューの「スタートアップ」フォルダに | |
120 | + AlterDnD.exeへのショートカットを作成してください。 | |
121 | + | |
122 | + ※このソフトは実際にファイルを操作するクライアントPCにインストールしてください。 | |
123 | + ファイルサーバにインストールしても効果がありません。(ファイルサーバで作業をする場合を除く) | |
124 | + | |
125 | + | |
126 | +■ アンインストール | |
127 | + | |
128 | + 当ソフトを実行中の場合は終了し、一度ログアウト後、再ログインしてください。 | |
129 | + 再ログイン後、展開したファイルを全て削除してください。 | |
130 | + (explorer.exe の再起動でも可) | |
131 | + | |
132 | + 下記のレジストリを使用しています。 | |
133 | + 残しておいても害はありませんが、気になる方は削除して下さい。 | |
134 | + | |
135 | + HKEY_CURRENT_USER\Software\S Project\Alter Drag & Drop | |
136 | + | |
137 | + | |
138 | +■動作原理 | |
139 | + | |
140 | + 1. AlterDnD.exe を起動すると、Windowsのグローバルフックをインストールします。 | |
141 | + 2. グローバルフックで、explorer.exe の動作を検出すると、ドラッグ&ドロップで使用しする、 | |
142 | + エクスプローラ標準の IDropTarget オブジェクトを AlterDnD 独自の IDropTarget に差し替えます。 | |
143 | + 3. ドラッグ&ドロップのイベントは、AlterDnD 独自の IDropTarget で前処理した後、 | |
144 | + 標準のIDropTargetに送られます。 | |
145 | + | |
146 | + | |
147 | +■変更履歴 | |
148 | + 2013/06/10 Ver. 1.0.0 | |
149 | + ・Windows Vista以前で、Windows+D 後のドラッグ&ドロップの制御が利かない問題を修正。 | |
150 | + | |
151 | + 2013/06/06 Ver. 0.7.0 β | |
152 | + ・実行ファイル、ショットカット、ごみ箱、ZIPファイルなどのアイコン上での動きをを修正。 | |
153 | + ・圧縮フォルダなどの仮想フォルダで、ドラッグ&ドロップの制御ができていない問題を修正。 | |
154 | + ・Windowsキー + D を押してデスクトップを表示した状態で、 | |
155 | + ドラッグ&ドロップの制御が利かない問題を修正。 | |
156 | + | |
157 | + 2013/06/04 Ver. 0.6.0 β | |
158 | + ・デスクトップのドラッグ&ドロップを対象に出来る機能の追加。 | |
159 | + ・Windows 7 以降で、一部のアイコン上で、Shift等のキーを押したり離したりしても、 | |
160 | + 一度アイコン上から外れないと、移動・コピーなどの状態が変わらない問題の対応。 | |
161 | + | |
162 | + 2013/05/31 Ver. 0.5.0 β | |
163 | + ・Windows XP で起動しないバグを修正 | |
164 | + ・その他もろもろの修正 | |
165 | + | |
166 | + 2013/05/28 Ver. 0.4.0 β | |
167 | + ・アイコンの調整 | |
168 | + | |
169 | + 2013/05/27 Ver. 0.3.0 β | |
170 | + ・日本語リソースを分離 | |
171 | + | |
172 | + 2013/05/26 Ver. 0.2.0 β | |
173 | + ・下記のバグを修正 | |
174 | + ・#31432: エクスプローラを再起動すると、ドラッグ&ドロップ操作が変更されなくなる | |
175 | + ・#31431: マウスの右ボタンでドラッグした場合も動作が変更される | |
176 | + ・実行速度の改善 | |
177 | + ・その他もろもろの修正 | |
178 | + | |
179 | + 2013/05/24 Ver. 0.1.0 β | |
180 | + ・Ver. 0.1.0 β リリース |
@@ -0,0 +1,287 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#include "stdafx.h" | |
20 | +#include "AlterDnD.h" | |
21 | +#include "Locale.h" | |
22 | +#include "../AlterDnD_DLL/AlterDnD_DLL.h" | |
23 | + | |
24 | +#define MAX_LOADSTRING 100 | |
25 | + | |
26 | +// グローバル変数: | |
27 | +HINSTANCE hInst; // 現在のインターフェイス | |
28 | +TCHAR szTitle[MAX_LOADSTRING]; // タイトル バーのテキスト | |
29 | +TCHAR szWindowClass[MAX_LOADSTRING]; // メイン ウィンドウ クラス名 | |
30 | + | |
31 | +// このコード モジュールに含まれる関数の宣言を転送します: | |
32 | +ATOM MyRegisterClass(HINSTANCE hInstance); | |
33 | +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); | |
34 | +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); | |
35 | +HANDLE CreateMutexNew(LPCTSTR name); | |
36 | + | |
37 | +int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, | |
38 | + _In_opt_ HINSTANCE hPrevInstance, | |
39 | + _In_ LPTSTR lpCmdLine, | |
40 | + _In_ int nCmdShow) | |
41 | +{ | |
42 | + UNREFERENCED_PARAMETER(hPrevInstance); | |
43 | + UNREFERENCED_PARAMETER(lpCmdLine); | |
44 | + | |
45 | + hInst = hInstance; // グローバル変数にインスタンス処理を格納します。 | |
46 | + | |
47 | + HANDLE mutex = CreateMutexNew(_T("AlterDnD Mutex")); | |
48 | + if (mutex == NULL) { | |
49 | + return 0; | |
50 | + } | |
51 | + InitialLocaleResource(hInstance); | |
52 | + | |
53 | + LoadStringLocale(IDS_APP_TITLE, szTitle, MAX_LOADSTRING); | |
54 | + LoadStringLocale(IDC_ALTERDND, szWindowClass, MAX_LOADSTRING); | |
55 | + | |
56 | + LoadDnDMode(); | |
57 | + | |
58 | + MyRegisterClass(hInstance); | |
59 | + | |
60 | + // メッセージ受け取り用のダミーウィンドウ | |
61 | + HWND hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, | |
62 | + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); | |
63 | + if (!hWnd) { | |
64 | + TCHAR szMsg[MAX_LOADSTRING]; | |
65 | + LoadStringLocale(IDS_ERR_CREATE_WINDOW, szMsg, MAX_LOADSTRING); | |
66 | + MessageBox(NULL, szMsg, szTitle, MB_ICONERROR); | |
67 | + ReleaseMutex(mutex); | |
68 | + return FALSE; | |
69 | + } | |
70 | + //ShowWindow(hWnd, nCmdShow); | |
71 | + //UpdateWindow(hWnd); | |
72 | + InstallHook(); | |
73 | + | |
74 | + MSG msg; | |
75 | + HACCEL hAccelTable; | |
76 | + | |
77 | + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_ALTERDND)); | |
78 | + // メイン メッセージ ループ: | |
79 | + while (GetMessage(&msg, NULL, 0, 0)) { | |
80 | + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { | |
81 | + TranslateMessage(&msg); | |
82 | + DispatchMessage(&msg); | |
83 | + } | |
84 | + } | |
85 | + | |
86 | + UninstallHook(); | |
87 | + ReleaseMutex(mutex); | |
88 | + | |
89 | + return (int) msg.wParam; | |
90 | +} | |
91 | + | |
92 | +HANDLE CreateMutexNew(LPCTSTR name) | |
93 | +{ | |
94 | + HANDLE hMutex = CreateMutex(NULL, TRUE, name); | |
95 | + if (GetLastError() == ERROR_ALREADY_EXISTS) { | |
96 | + ReleaseMutex(hMutex); | |
97 | + return NULL; | |
98 | + } | |
99 | + return hMutex; | |
100 | +} | |
101 | + | |
102 | +// | |
103 | +// 関数: MyRegisterClass() | |
104 | +// | |
105 | +// 目的: ウィンドウ クラスを登録します。 | |
106 | +// | |
107 | +ATOM MyRegisterClass(HINSTANCE hInstance) | |
108 | +{ | |
109 | + WNDCLASSEX wcex; | |
110 | + | |
111 | + wcex.cbSize = sizeof(WNDCLASSEX); | |
112 | + | |
113 | + wcex.style = CS_HREDRAW | CS_VREDRAW; | |
114 | + wcex.lpfnWndProc = WndProc; | |
115 | + wcex.cbClsExtra = 0; | |
116 | + wcex.cbWndExtra = 0; | |
117 | + wcex.hInstance = hInstance; | |
118 | + wcex.hIcon = LoadIconLocale(MAKEINTRESOURCE(IDI_ALTERDND)); | |
119 | + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); | |
120 | + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); | |
121 | + wcex.lpszMenuName = NULL; | |
122 | + wcex.lpszClassName = szWindowClass; | |
123 | + wcex.hIconSm = LoadIconLocale(MAKEINTRESOURCE(IDI_SMALL)); | |
124 | + | |
125 | + return RegisterClassEx(&wcex); | |
126 | +} | |
127 | + | |
128 | +// | |
129 | +// 関数: WndProc(HWND, UINT, WPARAM, LPARAM) | |
130 | +// | |
131 | +// 目的: メイン ウィンドウのメッセージを処理します。 | |
132 | +// | |
133 | +// WM_COMMAND - アプリケーション メニューの処理 | |
134 | +// WM_PAINT - メイン ウィンドウの描画 | |
135 | +// WM_DESTROY - 中止メッセージを表示して戻る | |
136 | +// | |
137 | +// | |
138 | +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) | |
139 | +{ | |
140 | + static UINT s_uTaskbarRestart; | |
141 | + static HMENU hMenu; | |
142 | + static HMENU hPopupMenu; | |
143 | + | |
144 | + switch (message) | |
145 | + { | |
146 | + case WM_CREATE: | |
147 | + { | |
148 | + s_uTaskbarRestart = RegisterWindowMessage(TEXT("TaskbarCreated")); | |
149 | + hMenu = LoadMenuLocale(MAKEINTRESOURCE(IDC_ALTERDND)); | |
150 | + hPopupMenu = GetSubMenu(hMenu, 0); | |
151 | + | |
152 | + AddTaskTrayIcon(hWnd); | |
153 | + } | |
154 | + return 0; | |
155 | + case WM_TIMER: | |
156 | + if (wParam == ID_TIMER_RETRY_TRAY) { | |
157 | + AddTaskTrayIcon(hWnd); | |
158 | + return 0; | |
159 | + } | |
160 | + break; | |
161 | + case WM_INITMENUPOPUP: | |
162 | + if ((HMENU)wParam == hPopupMenu) { | |
163 | + MENUITEMINFO mii; | |
164 | + ZeroMemory(&mii, sizeof(MENUITEMINFO)); | |
165 | + mii.cbSize = sizeof(MENUITEMINFO); | |
166 | + | |
167 | + WORD mode, targets; | |
168 | + GetDnDMode(&mode, &targets); | |
169 | + | |
170 | + // 動作モード | |
171 | + mii.fMask = MIIM_STATE | MIIM_FTYPE; | |
172 | + mii.fType = MFT_RADIOCHECK; | |
173 | + | |
174 | + mii.fState = (mode == DNDMODE_NORMAL) ? MFS_CHECKED : MFS_UNCHECKED; | |
175 | + SetMenuItemInfo(hPopupMenu, IDM_DND_NORMAL, FALSE, &mii); | |
176 | + | |
177 | + mii.fState = (mode == DNDMODE_ANY_KEYDOWN) ? MFS_CHECKED : MFS_UNCHECKED; | |
178 | + SetMenuItemInfo(hPopupMenu, IDM_DND_ANY_KEYDONWN, FALSE, &mii); | |
179 | + | |
180 | + mii.fState = (mode == DNDMODE_RBUTTON_SIMULATE) ? MFS_CHECKED : MFS_UNCHECKED; | |
181 | + SetMenuItemInfo(hPopupMenu, IDM_DND_RBUTTON_SIMULATE, FALSE, &mii); | |
182 | + | |
183 | + mii.fState = (mode == DNDMODE_DISABLE) ? MFS_CHECKED : MFS_UNCHECKED; | |
184 | + SetMenuItemInfo(hPopupMenu, IDM_DND_DISABLE, FALSE, &mii); | |
185 | + | |
186 | + // 対象 | |
187 | + mii.fMask = MIIM_STATE; | |
188 | + mii.fType = 0; | |
189 | + | |
190 | + mii.fState = (targets & DNDTARGET_EXPLORER) ? MFS_CHECKED : MFS_UNCHECKED; | |
191 | + SetMenuItemInfo(hPopupMenu, IDM_DND_EXPLORER, FALSE, &mii); | |
192 | + | |
193 | + mii.fState = (targets & DNDTARGET_DESKTOP) ? MFS_CHECKED : MFS_UNCHECKED; | |
194 | + SetMenuItemInfo(hPopupMenu, IDM_DND_DESKTOP, FALSE, &mii); | |
195 | + | |
196 | + | |
197 | + return 0; | |
198 | + } | |
199 | + break; | |
200 | + case WM_COMMAND: | |
201 | + { | |
202 | + WORD mode, targets; | |
203 | + GetDnDMode(&mode, &targets); | |
204 | + | |
205 | + // 選択されたメニューの解析: | |
206 | + switch (LOWORD(wParam)) { | |
207 | + case IDM_DND_NORMAL: | |
208 | + SetDnDMode(DNDMODE_NORMAL, targets); | |
209 | + SaveDnDMode(); | |
210 | + return 0; | |
211 | + case IDM_DND_ANY_KEYDONWN: | |
212 | + SetDnDMode(DNDMODE_ANY_KEYDOWN, targets); | |
213 | + SaveDnDMode(); | |
214 | + return 0; | |
215 | + case IDM_DND_RBUTTON_SIMULATE: | |
216 | + SetDnDMode(DNDMODE_RBUTTON_SIMULATE, targets); | |
217 | + SaveDnDMode(); | |
218 | + return 0; | |
219 | + case IDM_DND_DISABLE: | |
220 | + SetDnDMode(DNDMODE_DISABLE, targets); | |
221 | + SaveDnDMode(); | |
222 | + return 0; | |
223 | + | |
224 | + case IDM_DND_EXPLORER: | |
225 | + SetDnDMode(mode, targets ^ DNDTARGET_EXPLORER); | |
226 | + SaveDnDMode(); | |
227 | + return 0; | |
228 | + case IDM_DND_DESKTOP: | |
229 | + SetDnDMode(mode, targets ^ DNDTARGET_DESKTOP); | |
230 | + SaveDnDMode(); | |
231 | + return 0; | |
232 | + | |
233 | + case IDM_ABOUT: | |
234 | + DialogBoxLocale(MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); | |
235 | + return 0; | |
236 | + case IDM_EXIT: | |
237 | + DestroyWindow(hWnd); | |
238 | + return 0; | |
239 | + default: | |
240 | + break; | |
241 | + } | |
242 | + } | |
243 | + break; | |
244 | + case WM_ALTERDND_TRAY_ICON: | |
245 | + if (wParam == ID_ALTERDND_TRAY_ICON) { | |
246 | + POINT pt; | |
247 | + | |
248 | + switch (lParam) { | |
249 | + case WM_RBUTTONUP: | |
250 | + GetCursorPos(&pt); | |
251 | + SetForegroundWindow(hWnd); | |
252 | + TrackPopupMenu(hPopupMenu, TPM_BOTTOMALIGN, pt.x, pt.y, 0, hWnd, NULL); | |
253 | + } | |
254 | + } | |
255 | + return 0; | |
256 | + case WM_DESTROY: | |
257 | + RemoveTaskTrayIcon(hWnd); | |
258 | + PostQuitMessage(0); | |
259 | + return 0; | |
260 | + default: | |
261 | + if(message == s_uTaskbarRestart) { | |
262 | + AddTaskTrayIcon(hWnd); | |
263 | + return 0; | |
264 | + } | |
265 | + break; | |
266 | + } | |
267 | + return DefWindowProc(hWnd, message, wParam, lParam); | |
268 | +} | |
269 | + | |
270 | +// バージョン情報ボックスのメッセージ ハンドラーです。 | |
271 | +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) | |
272 | +{ | |
273 | + UNREFERENCED_PARAMETER(lParam); | |
274 | + switch (message) { | |
275 | + case WM_INITDIALOG: | |
276 | + return (INT_PTR)TRUE; | |
277 | + | |
278 | + case WM_COMMAND: | |
279 | + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { | |
280 | + EndDialog(hDlg, LOWORD(wParam)); | |
281 | + return (INT_PTR)TRUE; | |
282 | + } | |
283 | + break; | |
284 | + } | |
285 | + return (INT_PTR)FALSE; | |
286 | +} | |
287 | + |
@@ -0,0 +1,130 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#include "stdafx.h" | |
20 | +#include "Locale.h" | |
21 | + | |
22 | +static HINSTANCE ghDefaultRes; | |
23 | +static HINSTANCE ghLangRes; | |
24 | + | |
25 | +BOOL InitialLocaleResource(HINSTANCE hInstance) | |
26 | +{ | |
27 | + TCHAR exeName[MAX_PATH]; | |
28 | + TCHAR resName[MAX_PATH]; | |
29 | + TCHAR langName[4]; | |
30 | + TCHAR ctryName[4]; | |
31 | + | |
32 | + ghDefaultRes = hInstance; | |
33 | + | |
34 | + LCID local = GetUserDefaultLCID(); | |
35 | + GetLocaleInfo(local, LOCALE_SISO639LANGNAME, langName, _countof(langName)); | |
36 | + GetLocaleInfo(local, LOCALE_SISO3166CTRYNAME, ctryName, _countof(ctryName)); | |
37 | + | |
38 | + GetModuleFileName(hInstance, exeName, _countof(exeName)); | |
39 | + exeName[_tcslen(exeName) - 4] = _T('\0'); | |
40 | + | |
41 | + StringCchCopy(resName, _countof(resName), exeName); | |
42 | + StringCchCat(resName, _countof(resName), _T("_")); | |
43 | + StringCchCat(resName, _countof(resName), langName); | |
44 | + StringCchCat(resName, _countof(resName), _T("-")); | |
45 | + StringCchCat(resName, _countof(resName), ctryName); | |
46 | + StringCchCat(resName, _countof(resName), _T(".dll")); | |
47 | + | |
48 | + ghLangRes = LoadLibrary(resName); | |
49 | + if (ghLangRes) { | |
50 | + return TRUE; | |
51 | + } | |
52 | + | |
53 | + // AlterDnD_xx-XX.dll が無ければ、AlterDnD_xx.dll を使う | |
54 | + StringCchCopy(resName, _countof(resName), exeName); | |
55 | + StringCchCat(resName, _countof(resName), _T("_")); | |
56 | + StringCchCat(resName, _countof(resName), langName); | |
57 | + StringCchCat(resName, _countof(resName), _T(".dll")); | |
58 | + | |
59 | + ghLangRes = LoadLibrary(resName); | |
60 | + if (ghLangRes) { | |
61 | + return TRUE; | |
62 | + } | |
63 | + return FALSE; | |
64 | +} | |
65 | + | |
66 | +void LoadStringLocale(UINT uID, LPTSTR buff, int buffSize) | |
67 | +{ | |
68 | + if (ghLangRes) { | |
69 | + if (LoadString(ghLangRes, uID, buff, buffSize)) { | |
70 | + return; | |
71 | + } | |
72 | + } | |
73 | + if (LoadString(ghDefaultRes, uID, buff, buffSize)) { | |
74 | + return; | |
75 | + } | |
76 | + _stprintf_s(buff, buffSize, _T("# uID = %d"), uID); | |
77 | +} | |
78 | + | |
79 | +HICON LoadIconLocale(LPCWSTR lpIconName) | |
80 | +{ | |
81 | + HICON hIcon; | |
82 | + | |
83 | + if (ghLangRes) { | |
84 | + hIcon = LoadIcon(ghLangRes, lpIconName); | |
85 | + if (hIcon) { | |
86 | + return hIcon; | |
87 | + } | |
88 | + } | |
89 | + return LoadIcon(ghDefaultRes, lpIconName); | |
90 | +} | |
91 | + | |
92 | +HANDLE LoadImagenLocale(LPCWSTR lpName, UINT type, int cx, int cy, UINT fuLoad) | |
93 | +{ | |
94 | + HANDLE hImage; | |
95 | + | |
96 | + if (ghLangRes) { | |
97 | + hImage = LoadImage(ghLangRes, lpName, type, cx, cy, fuLoad); | |
98 | + if (hImage) { | |
99 | + return hImage; | |
100 | + } | |
101 | + } | |
102 | + return LoadImage(ghDefaultRes, lpName, type, cx, cy, fuLoad); | |
103 | +} | |
104 | + | |
105 | + | |
106 | +HMENU LoadMenuLocale(LPCTSTR lpMenuName) | |
107 | +{ | |
108 | + HMENU hMenu; | |
109 | + | |
110 | + if (ghLangRes) { | |
111 | + hMenu = LoadMenu(ghLangRes, lpMenuName); | |
112 | + if (hMenu) { | |
113 | + return hMenu; | |
114 | + } | |
115 | + } | |
116 | + return LoadMenu(ghDefaultRes, lpMenuName); | |
117 | +} | |
118 | + | |
119 | +INT_PTR DialogBoxLocale(LPCTSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc) | |
120 | +{ | |
121 | + INT_PTR dlg; | |
122 | + if (ghLangRes) { | |
123 | + dlg = DialogBox(ghLangRes, lpTemplateName, hWndParent, lpDialogFunc); | |
124 | + if (dlg != -1) { | |
125 | + return dlg; | |
126 | + } | |
127 | + } | |
128 | + return DialogBox(ghDefaultRes, lpTemplateName, hWndParent, lpDialogFunc); | |
129 | +} | |
130 | + |
@@ -0,0 +1,54 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#include "stdafx.h" | |
20 | +#include "AlterDnD.h" | |
21 | +#include "Locale.h" | |
22 | + | |
23 | +static NOTIFYICONDATA ni; | |
24 | +static UINT_PTR trayTimerId = 0; | |
25 | + | |
26 | +void AddTaskTrayIcon(HWND hWnd) | |
27 | +{ | |
28 | + ni.cbSize = sizeof(NOTIFYICONDATA); | |
29 | + ni.hIcon = (HICON)LoadImagenLocale(MAKEINTRESOURCE(IDI_ALTERDND), IMAGE_ICON, 16, 16, LR_SHARED); | |
30 | + ni.hWnd = hWnd; | |
31 | + ni.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; | |
32 | + ni.uID = ID_ALTERDND_TRAY_ICON; | |
33 | + ni.uCallbackMessage = WM_ALTERDND_TRAY_ICON; | |
34 | + StringCchCopy(ni.szTip, _countof(ni.szTip), szTitle); | |
35 | + | |
36 | + if (Shell_NotifyIcon(NIM_ADD, &ni)) { | |
37 | + if (trayTimerId) { | |
38 | + KillTimer(hWnd, trayTimerId); | |
39 | + trayTimerId = 0; | |
40 | + } | |
41 | + } else { | |
42 | + // アイコンが登録できない場合は、一定時間後リトライ | |
43 | + trayTimerId = SetTimer(hWnd, ID_TIMER_RETRY_TRAY, 500, NULL); | |
44 | + } | |
45 | +} | |
46 | + | |
47 | +void RemoveTaskTrayIcon(HWND hWnd) | |
48 | +{ | |
49 | + if (trayTimerId) { | |
50 | + KillTimer(hWnd, trayTimerId); | |
51 | + trayTimerId = 0; | |
52 | + } | |
53 | + Shell_NotifyIcon(NIM_DELETE, &ni); | |
54 | +} |
@@ -0,0 +1,28 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#pragma once | |
20 | + | |
21 | +#include "stdafx.h" | |
22 | + | |
23 | +BOOL InitialLocaleResource(HINSTANCE hInstance); | |
24 | +void LoadStringLocale(UINT uID, LPTSTR buff, int buffSize); | |
25 | +HMENU LoadMenuLocale(LPCTSTR lpMenuName); | |
26 | +HICON LoadIconLocale(LPCWSTR lpIconName); | |
27 | +HANDLE LoadImagenLocale(LPCWSTR lpName, UINT type, int cx, int cy, UINT fuLoad); | |
28 | +INT_PTR DialogBoxLocale(LPCTSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc); |
@@ -0,0 +1,23 @@ | ||
1 | +// stdafx.h : 標準のシステム インクルード ファイルのインクルード ファイル、または | |
2 | +// 参照回数が多く、かつあまり変更されない、プロジェクト専用のインクルード ファイル | |
3 | +// を記述します。 | |
4 | +// | |
5 | + | |
6 | +#pragma once | |
7 | + | |
8 | +#include "targetver.h" | |
9 | + | |
10 | +#define WIN32_LEAN_AND_MEAN // Windows ヘッダーから使用されていない部分を除外します。 | |
11 | +// Windows ヘッダー ファイル: | |
12 | +#include <windows.h> | |
13 | +#include <windowsx.h> | |
14 | +#include <ShellApi.h> | |
15 | + | |
16 | +// C ランタイム ヘッダー ファイル | |
17 | +#include <stdlib.h> | |
18 | +#include <malloc.h> | |
19 | +#include <memory.h> | |
20 | +#include <tchar.h> | |
21 | +#include <strsafe.h> | |
22 | + | |
23 | +// TODO: プログラムに必要な追加ヘッダーをここで参照してください。 |
@@ -0,0 +1,32 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#pragma once | |
20 | + | |
21 | +#include "resource.h" | |
22 | + | |
23 | +#define ID_TIMER_RETRY_TRAY (1000) | |
24 | +#define ID_ALTERDND_TRAY_ICON (2000) | |
25 | +#define WM_ALTERDND_TRAY_ICON (WM_APP + 0x1) | |
26 | + | |
27 | +extern HINSTANCE hInst; | |
28 | +extern TCHAR szTitle[]; // タイトル バーのテキスト | |
29 | +extern TCHAR szWindowClass[]; // メイン ウィンドウ クラス名 | |
30 | + | |
31 | +void AddTaskTrayIcon(HWND hWnd); | |
32 | +void RemoveTaskTrayIcon(HWND hWnd); |
@@ -0,0 +1,18 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | +// SDKDDKVer.h をインクルードすると、利用できる最も上位の Windows プラットフォームが定義されます。 | |
4 | + | |
5 | +// 以前の Windows プラットフォーム用にアプリケーションをビルドする場合は、WinSDKVer.h をインクルードし、 | |
6 | +// SDKDDKVer.h をインクルードする前に、サポート対象とするプラットフォームを示すように _WIN32_WINNT マクロを設定します。 | |
7 | + | |
8 | +//#define WINVER 0x0500 // Windows 2000 | |
9 | +#define WINVER 0x0501 // Windows XP | |
10 | +//#define WINVER 0x0502 // Windows Server 2003 | |
11 | +//#define WINVER 0x0600 // Windows Vista | |
12 | +//#define WINVER 0x0601 // Windows 7 | |
13 | + | |
14 | +#define _WIN32_WINNT 0x0501 | |
15 | +#define _WIN32_WINDOWS 0x0410 | |
16 | +#define _WIN32_IE 0x0500 | |
17 | + | |
18 | +#include <SDKDDKVer.h> |
@@ -0,0 +1,8 @@ | ||
1 | +// stdafx.cpp : 標準インクルード AlterDnD.pch のみを | |
2 | +// 含むソース ファイルは、プリコンパイル済みヘッダーになります。 | |
3 | +// stdafx.obj にはプリコンパイル済み型情報が含まれます。 | |
4 | + | |
5 | +#include "stdafx.h" | |
6 | + | |
7 | +// TODO: このファイルではなく、STDAFX.H で必要な | |
8 | +// 追加ヘッダーを参照してください。 |
@@ -0,0 +1,273 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#include "stdafx.h" | |
20 | +#include "AlterDnD_DLL.h" | |
21 | +#include "DropTargetWrapper.h" | |
22 | + | |
23 | +void LockThisDLL(); | |
24 | +void UnlockThisDLL(); | |
25 | + | |
26 | +DropTargetWrapper::DropTargetWrapper(HWND hwnd, IDropTarget *pTarget, WORD thisTargetType) | |
27 | +{ | |
28 | + LockThisDLL(); | |
29 | + CoCreateInstance(CLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER, IID_IDropTargetHelper, (LPVOID*)&m_pdth); | |
30 | + | |
31 | + m_hWnd = hwnd; | |
32 | + m_cRef = 0; | |
33 | + m_pTarget = pTarget; | |
34 | + m_thisTargetType = thisTargetType; | |
35 | + ULONG count = m_pTarget->AddRef(); | |
36 | + DP(_T("DropTargetWrapper:DropTargetWrapper m_pTarget->AddRef() hwnd=%x count=%d"), m_hWnd, (int)count); | |
37 | +} | |
38 | + | |
39 | +DropTargetWrapper::~DropTargetWrapper() | |
40 | +{ | |
41 | + ULONG ret = m_pTarget->Release(); | |
42 | + DP(_T("DropTargetWrapper:~DropTargetWrapper m_pTarget->Release() hwnd=%x count=%d"), m_hWnd, (int)ret); | |
43 | + m_pTarget = NULL; | |
44 | + | |
45 | + m_pdth->Release(); | |
46 | + UnlockThisDLL(); | |
47 | +} | |
48 | + | |
49 | +IDropTarget* DropTargetWrapper::GetOriginalTarget() | |
50 | +{ | |
51 | + ULONG count = m_pTarget->AddRef(); | |
52 | + DP(_T("DropTargetWrapper::GetOriginalTarget hwnd=%x count=%d"), m_hWnd, count); | |
53 | + return m_pTarget; | |
54 | +} | |
55 | + | |
56 | +STDMETHODIMP DropTargetWrapper::QueryInterface(REFIID riid, void **ppvObject) | |
57 | +{ | |
58 | + DP(_T("DropTargetWrapper::QueryInterface hwnd=%x"), m_hWnd); | |
59 | + | |
60 | + *ppvObject = NULL; | |
61 | + | |
62 | + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDropTarget) || IsEqualIID(riid, IID_DropTargetWrapper)) | |
63 | + *ppvObject = static_cast<IDropTarget *>(this); | |
64 | + else | |
65 | + return E_NOINTERFACE; | |
66 | + | |
67 | + AddRef(); | |
68 | + | |
69 | + return S_OK; | |
70 | +} | |
71 | + | |
72 | +STDMETHODIMP_(ULONG) DropTargetWrapper::AddRef() | |
73 | +{ | |
74 | + DP(_T("DropTargetWrapper::AddRef hwnd=%x count=%d"), m_hWnd, m_cRef + 1); | |
75 | + return InterlockedIncrement(&m_cRef); | |
76 | +} | |
77 | + | |
78 | +STDMETHODIMP_(ULONG) DropTargetWrapper::Release() | |
79 | +{ | |
80 | + DP(_T("DropTargetWrapper::Release hwnd=%x count=%d"), m_hWnd, m_cRef - 1); | |
81 | + if (InterlockedDecrement(&m_cRef) == 0) { | |
82 | + DP(_T("hwnd=%x delete"), m_hWnd); | |
83 | + delete this; | |
84 | + } | |
85 | + return m_cRef; | |
86 | +} | |
87 | + | |
88 | +void DropTargetWrapper::EffectFilter(DWORD grfKeyState, LPDWORD pEffect) | |
89 | +{ | |
90 | + switch (m_DnDMode) { | |
91 | + case DNDMODE_DISABLE: | |
92 | + *pEffect = DROPEFFECT_NONE; | |
93 | + break; | |
94 | + case DNDMODE_ANY_KEYDOWN: | |
95 | + if ((grfKeyState & (MK_SHIFT | MK_CONTROL | MK_ALT)) == 0) { | |
96 | + *pEffect = DROPEFFECT_NONE; | |
97 | + } | |
98 | + break; | |
99 | + default: // DNDMODE_NORMAL,DNDMODE_RBUTTON_SIMULATE | |
100 | + break; | |
101 | + } | |
102 | +} | |
103 | + | |
104 | +BOOL DropTargetWrapper::IsTarget(WORD mode) | |
105 | +{ | |
106 | + return ((mode & m_thisTargetType) != m_thisTargetType); | |
107 | +} | |
108 | + | |
109 | +DWORD DropTargetWrapper::KeyStateL2R(DWORD grfKeyState) | |
110 | +{ | |
111 | + return (grfKeyState & ~MK_LBUTTON) | MK_RBUTTON; | |
112 | +} | |
113 | + | |
114 | +BOOL DropTargetWrapper::DoUseOwnDropTargetHelper(POINTL pt, DWORD dwEffect) | |
115 | +{ | |
116 | + // Effectの処理を自前のDropTargetHelperでやるか、元のDropTargetに任せるかの判定 | |
117 | + | |
118 | + // ドロップ禁止ではない場合は、元のDropTargetに任せる | |
119 | + if (dwEffect != DROPEFFECT_NONE) { | |
120 | + return FALSE; | |
121 | + } | |
122 | + | |
123 | + // デスクトップ以外の場合は、自前のDropTargetHelperを使う。 | |
124 | + // TODO デスクトップ以外も、元のDropTargetに任せたいけど、 | |
125 | + // 仮想フォルダが渡されたpdwEffectを無視する可能性があるので... | |
126 | + if (m_thisTargetType != DNDTARGET_DESKTOP) { | |
127 | + return TRUE; | |
128 | + } | |
129 | + | |
130 | + // デスクトップの場合は、デスクトップ内でのアイコンの移動が出来ないと使いづらいので、 | |
131 | + // アイコンが無い位置へのドロップは、元のDropTargetに任せる。 | |
132 | + TCHAR buff[32] = { _T('\0') }; | |
133 | + GetClassName(m_hWnd, buff, sizeof(buff)); | |
134 | + DP(_T("TargetType=DNDTARGET_DESKTOP class=%s"), buff); | |
135 | + | |
136 | + HWND hShell = FindWindowEx(m_hWnd, NULL, _T("SHELLDLL_DefView"), NULL); | |
137 | + if (!hShell) { | |
138 | + // SHELLDLL_DefViewが無い場合はデスクトップではないので、自前のDropTargetHelperを使う。 | |
139 | + DP(_T("SHELLDLL_DefView not found. hwnd=%x"), m_hWnd); | |
140 | + return TRUE; | |
141 | + } | |
142 | + HWND hList = FindWindowEx(hShell, NULL, _T("SysListView32"), _T("FolderView")); | |
143 | + if (!hList) { | |
144 | + // SysListView32が無い場合はデスクトップではないので、自前のDropTargetHelperを使う。 | |
145 | + DP(_T("SysListView32 not found. hwnd=%x"), m_hWnd); | |
146 | + return TRUE; | |
147 | + } | |
148 | + | |
149 | + // アイコン上にある場合は、自前のDropTargetHelperを使う。 | |
150 | + LVHITTESTINFO ht; | |
151 | + ht.pt.x = pt.x; | |
152 | + ht.pt.y = pt.y; | |
153 | + ClientToScreen(m_hWnd, &ht.pt); | |
154 | + ScreenToClient(hList, &ht.pt); | |
155 | + | |
156 | + int index = ListView_HitTest(hList, &ht); | |
157 | + DP(_T("ListView_HitTest index=%d pt=%d,%d(%d,%d)"), index, ht.pt.x, ht.pt.y, pt.x, pt.y); | |
158 | + return (index != -1); | |
159 | +} | |
160 | + | |
161 | +STDMETHODIMP DropTargetWrapper::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) | |
162 | +{ | |
163 | + // 左ボタンで開始されていない場合は、通常通りの処理を行う。 | |
164 | + m_pDataObj = NULL; | |
165 | + if ((grfKeyState & MK_LBUTTON) == 0) { | |
166 | + return m_pTarget->DragEnter(pDataObj, grfKeyState, pt, pdwEffect); | |
167 | + } | |
168 | + | |
169 | + // ドラッグ&ドロップ中に設定が変更されるとまずいので、開始時に記憶 | |
170 | + GetDnDMode(&m_DnDMode, &m_DnDTargets); | |
171 | + | |
172 | + // このクラスが設定されたウインドウが処理対象外に設定されている場合、何もしない | |
173 | + if (IsTarget(m_DnDTargets)) { | |
174 | + return m_pTarget->DragEnter(pDataObj, grfKeyState, pt, pdwEffect); | |
175 | + } | |
176 | + | |
177 | + m_pDataObj = pDataObj; | |
178 | + m_pDataObj->AddRef(); | |
179 | + | |
180 | + DP(_T("DropTargetWrapper:DragEnter=%x,%x"), grfKeyState, *pdwEffect); | |
181 | + if (m_DnDMode == DNDMODE_RBUTTON_SIMULATE) { | |
182 | + return m_pTarget->DragEnter(pDataObj, KeyStateL2R(grfKeyState), pt, pdwEffect); | |
183 | + } | |
184 | + EffectFilter(grfKeyState, pdwEffect); | |
185 | + | |
186 | + // Windows 7 以降で、独自のDropHandlerを登録しているアイコン上で、 | |
187 | + // DROPEFFECT_NONE <=> DROPEFFECT_NONE以外 の切り替えを行うと、 | |
188 | + // 一度アイコン上から外れないと、表示が更新されない。 | |
189 | + // 圧縮フォルダのDropHandlerなどは、渡したpdwEffectを無視しているみたい。 | |
190 | + // DROPEFFECT_NONE の場合は、元のDropTargetに頼らず、自分でアイコンを描画する。 | |
191 | + | |
192 | + // ただし、デスクトップの場合は、デスクトップ内でのアイコンの移動が出来ないと使いづらいので、 | |
193 | + // アイコンが無い位置へのドロップは、元のDropTargetに任せる。 | |
194 | + useOwnHelper = DoUseOwnDropTargetHelper(pt, *pdwEffect); | |
195 | + if (useOwnHelper) { | |
196 | + POINT pt2 = { pt.x, pt.y }; | |
197 | + return m_pdth->DragEnter(m_hWnd, m_pDataObj, &pt2, DROPEFFECT_NONE); | |
198 | + } else { | |
199 | + return m_pTarget->DragEnter(pDataObj, grfKeyState, pt, pdwEffect); | |
200 | + } | |
201 | +} | |
202 | + | |
203 | +STDMETHODIMP DropTargetWrapper::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) | |
204 | +{ | |
205 | + // 左ボタンで開始されていない場合、このクラスをセットしたウインドウが対象外の場合は、 | |
206 | + // 通常通りの処理を行う。 | |
207 | + if (m_pDataObj == NULL) { | |
208 | + return m_pTarget->DragOver(grfKeyState, pt, pdwEffect); | |
209 | + } | |
210 | + | |
211 | + DP(_T("DropTargetWrapper:DragOver hwnd=%x param=%x,%x"), m_hWnd, grfKeyState, *pdwEffect); | |
212 | + if (m_DnDMode == DNDMODE_RBUTTON_SIMULATE) { | |
213 | + return m_pTarget->DragOver(KeyStateL2R(grfKeyState), pt, pdwEffect); | |
214 | + } | |
215 | + EffectFilter(grfKeyState, pdwEffect); | |
216 | + DP(_T("DropTargetWrapper:DragOver2 hwnd=%x param=%x,%x"), m_hWnd, grfKeyState, *pdwEffect); | |
217 | + | |
218 | + BOOL prevUseOwn = useOwnHelper; | |
219 | + useOwnHelper = DoUseOwnDropTargetHelper(pt, *pdwEffect); | |
220 | + if (useOwnHelper) { | |
221 | + DP(_T("useOwnHelper=TRUE")); | |
222 | + POINT pt2 = { pt.x, pt.y }; | |
223 | + if (!prevUseOwn) { | |
224 | + DP(_T("m_pTarget->DragLeave()")); | |
225 | + m_pTarget->DragLeave(); | |
226 | + m_pdth->DragEnter(m_hWnd, m_pDataObj, &pt2, DROPEFFECT_NONE); | |
227 | + } | |
228 | + DP(_T("m_pdth->DragOver(&pt2, DROPEFFECT_NONE)")); | |
229 | + return m_pdth->DragOver(&pt2, DROPEFFECT_NONE); | |
230 | + } else { | |
231 | + DP(_T("useOwnHelper=FALSE")); | |
232 | + if (prevUseOwn) { | |
233 | + DP(_T("m_pdth->DragLeave()")); | |
234 | + DWORD effect = *pdwEffect; | |
235 | + m_pdth->DragLeave(); | |
236 | + m_pTarget->DragEnter(m_pDataObj, grfKeyState, pt, &effect); | |
237 | + } | |
238 | + DP(_T("DropTargetWrapper:m_pTarget->DragOver=%x,%x"), grfKeyState, *pdwEffect); | |
239 | + return m_pTarget->DragOver(grfKeyState, pt, pdwEffect); | |
240 | + } | |
241 | +} | |
242 | + | |
243 | +STDMETHODIMP DropTargetWrapper::DragLeave() | |
244 | +{ | |
245 | + // 左ボタンで開始されていない場合、このクラスをセットしたウインドウが対象外の場合は、 | |
246 | + // 通常通りの処理を行う。 | |
247 | + if (m_pDataObj == NULL) { | |
248 | + return m_pTarget->DragLeave(); | |
249 | + } | |
250 | + m_pDataObj->Release(); | |
251 | + m_pDataObj = NULL; | |
252 | + | |
253 | + if (m_DnDMode == DNDMODE_RBUTTON_SIMULATE) { | |
254 | + return m_pTarget->DragLeave(); | |
255 | + } | |
256 | + | |
257 | + DP(_T("DropTargetWrapper:DragLeave hwnd=%x"), m_hWnd); | |
258 | + if (useOwnHelper) { | |
259 | + return m_pdth->DragLeave(); | |
260 | + } else { | |
261 | + return m_pTarget->DragLeave(); | |
262 | + } | |
263 | +} | |
264 | + | |
265 | +STDMETHODIMP DropTargetWrapper::Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) | |
266 | +{ | |
267 | + DP(_T("DropTargetWrapper:Drop hwnd=%x param=%x,%x"), m_hWnd, grfKeyState, *pdwEffect); | |
268 | + //DnDFilter(&grfKeyState, pdwEffect); | |
269 | + //DP(_T("DropTargetWrapper:Drop2=%x,%x"), grfKeyState, *pdwEffect); | |
270 | + HRESULT hr = m_pTarget->Drop(pDataObj, grfKeyState, pt, pdwEffect); | |
271 | + //DP(_T("DROPEFFECT=%d"), (int)*pdwEffect); | |
272 | + return hr; | |
273 | +} |
@@ -0,0 +1,321 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#include "stdafx.h" | |
20 | +#include "DropTargetWrapper.h" | |
21 | +#include "registory.h" | |
22 | + | |
23 | +#ifndef MSGFLG_ADD | |
24 | +#define MSGFLT_ADD 1 | |
25 | +#define MSGFLT_REMOVE 2 | |
26 | +#endif | |
27 | + | |
28 | +#define ALTERDND_CF_PROJECT_NAME _T("S Project") | |
29 | +#define ALTERDND_CF_APP_NAME _T("Alter Drag & Drop") | |
30 | +#define ALTERDND_CF_MODE _T("Mode") | |
31 | +#define ALTERDND_CF_TARGETS _T("Targets") | |
32 | + | |
33 | +#define ALTERDND_REG_APP_KEY (_T("Software\\") ALTERDND_CF_PROJECT_NAME _T("\\") ALTERDND_CF_APP_NAME) | |
34 | + | |
35 | +#define TARGET_PROCESS_NAME _T("explorer.exe") | |
36 | +#define TARGET_WINDOW_CLASS1 _T("CabinetWClass") | |
37 | +#define TARGET_WINDOW_CLASS2 _T("ExploreWClass") | |
38 | +#define TARGET_PROGMAN_CLASS _T("Progman") | |
39 | +#define TARGET_WORKERW_CLASS _T("WorkerW") | |
40 | + | |
41 | +#pragma data_seg(".AlterDnD_shared") | |
42 | +HHOOK wndProcHook = NULL; | |
43 | +DWORD gDnDMode = MAKELONG(DNDMODE_NORMAL, DNDTARGET_NONE); | |
44 | +#pragma data_seg() | |
45 | + | |
46 | +HINSTANCE hInst; | |
47 | +BOOL gIsTargetProcess = TRUE; | |
48 | +BOOL gIsTargetProcessChecked = FALSE; | |
49 | +UINT gHookDnDMsg = 0; | |
50 | +LONG gDLLRefCount = 0; | |
51 | + | |
52 | +BOOL CheckTargetProcess(); | |
53 | +LRESULT CALLBACK MsgHookProc(int nCode, WPARAM wParam, LPARAM lParam); | |
54 | + | |
55 | +void SetAlterDnDWindowMessageFilter() | |
56 | +{ | |
57 | + BOOL (WINAPI *pChangeWindowMessageFilter)(UINT, DWORD); | |
58 | + HMODULE hUser = LoadLibrary(_T("user32.dll")); | |
59 | + pChangeWindowMessageFilter = (BOOL (WINAPI*)(UINT, DWORD))GetProcAddress(hUser, "ChangeWindowMessageFilter"); | |
60 | + | |
61 | + if (pChangeWindowMessageFilter) { | |
62 | + pChangeWindowMessageFilter(gHookDnDMsg, MSGFLT_ADD); | |
63 | + } | |
64 | + FreeLibrary(hUser); | |
65 | +} | |
66 | + | |
67 | +void InitializeDLL(HMODULE hModule) | |
68 | +{ | |
69 | + hInst = hModule; | |
70 | +} | |
71 | + | |
72 | +HMODULE GetDLLModuleHandle() | |
73 | +{ | |
74 | + return (HMODULE)hInst; | |
75 | +} | |
76 | + | |
77 | +IMPORT BOOL InstallHook() | |
78 | +{ | |
79 | + //wndProcRetHook = SetWindowsHookEx(WH_CALLWNDPROCRET, MsgHookProc, hInst, 0); | |
80 | + wndProcHook = SetWindowsHookEx(WH_CALLWNDPROCRET, MsgHookProc, hInst, 0); | |
81 | + | |
82 | + DP(_T("InstallHook=%x"), wndProcHook); | |
83 | + return TRUE; | |
84 | +} | |
85 | + | |
86 | +IMPORT void UninstallHook() | |
87 | +{ | |
88 | + SetDnDMode(DNDMODE_NORMAL, DNDTARGET_NONE); | |
89 | + if (wndProcHook != NULL) { | |
90 | + UnhookWindowsHookEx(wndProcHook); | |
91 | + wndProcHook = NULL; | |
92 | + } | |
93 | + //UINT hookDnDMsg = RegisterWindowMessage(TEXT("WM_AlterDnD_Hook")); | |
94 | + //PostMessage(HWND_BROADCAST, hookDnDMsg, FALSE, NULL); | |
95 | +} | |
96 | + | |
97 | +BOOL CheckTargetProcess() | |
98 | +{ | |
99 | + TCHAR path[MAX_PATH] = _T(""); | |
100 | + HMODULE hMod = GetModuleHandle(NULL); | |
101 | + GetModuleFileName(hMod, path, _countof(path)); | |
102 | + | |
103 | + // パスからファイル名を小文字に変換して切り出し | |
104 | + TCHAR *name = &path[_tcslen(path)]; | |
105 | + while (name > path && *name != _T('\\')) { | |
106 | + *name = _totlower(*name); | |
107 | + name--; | |
108 | + } | |
109 | + name++; | |
110 | + if (_tccmp(name, TARGET_PROCESS_NAME) == 0) { | |
111 | + return TRUE; | |
112 | + } | |
113 | + //EnumWindows(EnumWindowsProc_CheckTargetProcess, NULL); | |
114 | + return FALSE; | |
115 | +} | |
116 | + | |
117 | +IMPORT BOOL LoadDnDMode() | |
118 | +{ | |
119 | + HKEY appKey; | |
120 | + | |
121 | + if (RegOpenKeyEx(HKEY_CURRENT_USER, ALTERDND_REG_APP_KEY, 0, KEY_READ, &appKey) != ERROR_SUCCESS) { | |
122 | + appKey = NULL; | |
123 | + } | |
124 | + WORD mode = (WORD)ReadDWord(appKey, ALTERDND_CF_MODE, DNDMODE_ANY_KEYDOWN); | |
125 | + WORD targets = (WORD)ReadDWord(appKey, ALTERDND_CF_TARGETS, DNDTARGET_EXPLORER); | |
126 | + | |
127 | + SetDnDMode(mode, targets); | |
128 | + | |
129 | + if (appKey) { | |
130 | + RegCloseKey(appKey); | |
131 | + return TRUE; | |
132 | + } | |
133 | + return FALSE; | |
134 | +} | |
135 | + | |
136 | +IMPORT BOOL SaveDnDMode() | |
137 | +{ | |
138 | + HKEY appKey; | |
139 | + BOOL error = FALSE; | |
140 | + DWORD disp; | |
141 | + | |
142 | + WORD mode, targets; | |
143 | + GetDnDMode(&mode, &targets); | |
144 | + | |
145 | + if (RegCreateKeyEx(HKEY_CURRENT_USER, ALTERDND_REG_APP_KEY, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &appKey, &disp) == ERROR_SUCCESS) { | |
146 | + error |= !WriteDWord(appKey, ALTERDND_CF_MODE, mode); | |
147 | + error |= !WriteDWord(appKey, ALTERDND_CF_TARGETS, targets); | |
148 | + | |
149 | + RegCloseKey(appKey); | |
150 | + } else { | |
151 | + error = TRUE; | |
152 | + } | |
153 | + return !error; | |
154 | +} | |
155 | + | |
156 | +IMPORT void GetDnDMode(WORD *mode, WORD *targets) | |
157 | +{ | |
158 | + DP(_T("GetDnDMode=%08x"), gDnDMode); | |
159 | + DWORD m = gDnDMode; | |
160 | + | |
161 | + *mode = LOWORD(m); | |
162 | + *targets = HIWORD(m); | |
163 | +} | |
164 | + | |
165 | +IMPORT void SetDnDMode(WORD mode, WORD targets) | |
166 | +{ | |
167 | + gDnDMode = MAKELONG(mode, targets); | |
168 | + DP(_T("SetDnDMode=%08x"), mode); | |
169 | +} | |
170 | + | |
171 | +IDropTarget* HookDropTarget(HWND hwnd, WORD targetType) | |
172 | +{ | |
173 | + //TCHAR buff[32] = { _T('\0') }; | |
174 | + //GetClassName(hwnd, buff, sizeof(buff)); | |
175 | + //DP(_T("HookDropTarget ClassName=%s"), buff); | |
176 | + | |
177 | + IDropTarget *target = (IDropTarget *)GetProp(hwnd, _T("OleDropTargetInterface")); | |
178 | + DP(_T("IDropTarget=%d"), target); | |
179 | + if (target == NULL) { | |
180 | + return NULL; | |
181 | + } | |
182 | + target->AddRef(); | |
183 | + | |
184 | + //GetWindowText(hwnd, buff, sizeof(buff)); | |
185 | + //DP(_T("WindowText=%s"), buff); | |
186 | + //GetExeFileName(hwnd, buff, sizeof(buff)); | |
187 | + //DP(_T("ExeFileName=%s"), buff); | |
188 | + | |
189 | + | |
190 | + // 既に差し替え済みか判定する。 | |
191 | + DropTargetWrapper *target2; | |
192 | + HRESULT hr = target->QueryInterface(IID_DropTargetWrapper, (void **)&target2); | |
193 | + DP(_T("QueryInterface=%d(%x)"), target2, hr); | |
194 | + if (SUCCEEDED(hr)) { | |
195 | + target2->Release(); | |
196 | + return target; | |
197 | + } | |
198 | + | |
199 | + // 差し替え | |
200 | + hr = RevokeDragDrop(hwnd); | |
201 | + DP(_T("RevokeDragDrop=%x"), hr); | |
202 | + if (!SUCCEEDED(hr)) { | |
203 | + target->Release(); | |
204 | + return target; | |
205 | + } | |
206 | + DropTargetWrapper *wrap = new DropTargetWrapper(hwnd, target, targetType); | |
207 | + hr = RegisterDragDrop(hwnd, wrap); | |
208 | + DP(_T("RegisterDragDrop=%x, %d"), wrap, hr); | |
209 | + target->Release(); | |
210 | + | |
211 | + return wrap; | |
212 | +} | |
213 | + | |
214 | +void UnHookDropTarget(HWND hwnd) | |
215 | +{ | |
216 | + RemoveProp(hwnd, _T("AlterDnD_Checked")); | |
217 | + IDropTarget *target = (IDropTarget *)GetProp(hwnd, _T("OleDropTargetInterface")); | |
218 | + if (target) { | |
219 | + target->AddRef(); | |
220 | + } | |
221 | + if (target) { | |
222 | + DropTargetWrapper *target2; | |
223 | + HRESULT hr = target->QueryInterface(IID_DropTargetWrapper, (void **)&target2); | |
224 | + if (SUCCEEDED(hr)) { | |
225 | + HRESULT hr = RevokeDragDrop(hwnd); | |
226 | + DP(_T("UnHookDnD_Revoke=%d"), hr); | |
227 | + if (SUCCEEDED(hr)) { | |
228 | + IDropTarget *org = target2->GetOriginalTarget(); | |
229 | + hr = RegisterDragDrop(hwnd, org); | |
230 | + DP(_T("UnHookDnD_Register=%d"), hr); | |
231 | + org->Release(); | |
232 | + } | |
233 | + target2->Release(); | |
234 | + } | |
235 | + target->Release(); | |
236 | + } | |
237 | +} | |
238 | + | |
239 | +//BOOL CALLBACK EnumChildWindowsProc_HookDropTarget(HWND hwnd, LPARAM lParam) | |
240 | +//{ | |
241 | +// HookDropTarget(hwnd); | |
242 | +// return TRUE; | |
243 | +//} | |
244 | +// | |
245 | +// | |
246 | +//BOOL CALLBACK EnumChildWindowsProc_UnHookDropTarget(HWND hwnd, LPARAM lParam) | |
247 | +//{ | |
248 | +// TCHAR buff[32] = { _T('\0') }; | |
249 | +// GetClassName(hwnd, buff, sizeof(buff)); | |
250 | +// DP(_T("UnHookDropTarget=%s"), buff); | |
251 | +// UnHookDropTarget(hwnd); | |
252 | +// return TRUE; | |
253 | +//} | |
254 | + | |
255 | +LRESULT CALLBACK MsgHookProc(int nCode, WPARAM wParam, LPARAM lParam) | |
256 | +{ | |
257 | + if (!gIsTargetProcess) { | |
258 | + return CallNextHookEx(wndProcHook, nCode, wParam, lParam); | |
259 | + } | |
260 | + if (!gIsTargetProcessChecked) { | |
261 | + gIsTargetProcessChecked = TRUE; | |
262 | + gIsTargetProcess = CheckTargetProcess(); | |
263 | + DP(_T("CheckTargetProcess=%d"), gIsTargetProcess); | |
264 | + //if (gIsTargetProcess) { | |
265 | + // gHookDnDMsg = RegisterWindowMessage(TEXT("WM_AlterDnD_Hook")); | |
266 | + // SetAlterDnDWindowMessageFilter(); // AlterDnD.exe からのメッセージを許可 | |
267 | + // //PostMessage(HWND_BROADCAST, gHookDnDMsg, TRUE, NULL); | |
268 | + //} | |
269 | + } | |
270 | + | |
271 | + if (nCode == HC_ACTION) { | |
272 | + LPCWPRETSTRUCT p = (LPCWPRETSTRUCT)lParam; | |
273 | + | |
274 | + HANDLE hOleDrop = GetProp(p->hwnd, _T("OleDropTargetInterface")); | |
275 | + if (hOleDrop) { | |
276 | + if (GetProp(p->hwnd, _T("AlterDnD Checked")) != hOleDrop) { | |
277 | + //TCHAR className[32] = {_T('\0') }; | |
278 | + //GetClassName(p->hwnd, className, sizeof(className)); | |
279 | + | |
280 | + TCHAR rootClass[32] = {_T('\0') }; | |
281 | + HWND hRoot = GetAncestor(p->hwnd, GA_ROOT); | |
282 | + GetClassName(hRoot, rootClass, sizeof(rootClass)); | |
283 | + | |
284 | + DP(_T("AlterDnD Checked root=%s hwnd=%x"), rootClass, p->hwnd); | |
285 | + | |
286 | + if (_tcscmp(rootClass, TARGET_WINDOW_CLASS1) == 0 || | |
287 | + _tcscmp(rootClass, TARGET_WINDOW_CLASS2) == 0) { | |
288 | + hOleDrop = HookDropTarget(p->hwnd, DNDTARGET_EXPLORER); | |
289 | + } else if (_tcscmp(rootClass, TARGET_PROGMAN_CLASS) == 0 || | |
290 | + _tcscmp(rootClass, TARGET_WORKERW_CLASS) == 0) { | |
291 | + hOleDrop = HookDropTarget(p->hwnd, DNDTARGET_DESKTOP); | |
292 | + } | |
293 | + // 元のプログラムが OleDropTargetInterface を変更する可能性があるので、 | |
294 | + // 検出用に、今の(差し替え後の)値を記録しておく。 | |
295 | + SetProp(p->hwnd, _T("AlterDnD Checked"), hOleDrop); | |
296 | + } | |
297 | + } | |
298 | + } | |
299 | + return CallNextHookEx(wndProcHook, nCode, wParam, lParam); | |
300 | +} | |
301 | + | |
302 | +void LockThisDLL() | |
303 | +{ | |
304 | + LONG count = InterlockedIncrement(&gDLLRefCount); | |
305 | + DP(_T("LockThisDLL 0x%x count=%d"), GetModuleHandle(NULL), count); | |
306 | + if (count == 1) { | |
307 | + TCHAR name[MAX_PATH] = {_T('\0')}; | |
308 | + GetModuleFileName(hInst, name, _countof(name)); | |
309 | + LoadLibrary(name); // 勝手にアンロードされないように | |
310 | + } | |
311 | +} | |
312 | + | |
313 | +void UnlockThisDLL() | |
314 | +{ | |
315 | + LONG count = InterlockedDecrement(&gDLLRefCount); | |
316 | + DP(_T("UnlockThisDLL 0x%x count=%d"), GetModuleHandle(NULL), count); | |
317 | + if (count == 0) { | |
318 | + //FreeLibrary(hInst); | |
319 | + } | |
320 | +} | |
321 | + |
@@ -0,0 +1,61 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#pragma once | |
20 | + | |
21 | +#include "stdafx.h" | |
22 | + | |
23 | +// {1D18C667-02E8-4744-866B-4F4CAC4D565E} | |
24 | +static const IID IID_DropTargetWrapper = | |
25 | +{ 0x1d18c667, 0x2e8, 0x4744, { 0x86, 0x6b, 0x4f, 0x4c, 0xac, 0x4d, 0x56, 0x5e } }; | |
26 | + | |
27 | +class DropTargetWrapper : public IDropTarget | |
28 | +{ | |
29 | +public: | |
30 | + DropTargetWrapper(HWND hwnd, IDropTarget *pTarget, WORD targetType); | |
31 | + ~DropTargetWrapper(); | |
32 | + | |
33 | + STDMETHODIMP QueryInterface(REFIID riid, void **ppvObject); | |
34 | + STDMETHODIMP_(ULONG) AddRef(); | |
35 | + STDMETHODIMP_(ULONG) Release(); | |
36 | + | |
37 | + STDMETHODIMP DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); | |
38 | + STDMETHODIMP DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); | |
39 | + STDMETHODIMP DragLeave(); | |
40 | + STDMETHODIMP Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect); | |
41 | + | |
42 | + IDropTarget* GetOriginalTarget(); | |
43 | + | |
44 | +private: | |
45 | + LONG m_cRef; | |
46 | + IDropTarget *m_pTarget; // 元のDropTarget | |
47 | + HWND m_hWnd; | |
48 | + WORD m_thisTargetType; // このオブジェクトのDropTargetの種類 DNDTARGET_? | |
49 | + | |
50 | + WORD m_DnDMode; // ドラッグが開始された時の動作モード | |
51 | + WORD m_DnDTargets; // ドラッグが開始された時の対象 | |
52 | + | |
53 | + IDataObject *m_pDataObj; | |
54 | + BOOL useOwnHelper; | |
55 | + IDropTargetHelper *m_pdth; // DROPEFFECT_NONEの場合、自前でEffectを描画する為 | |
56 | + | |
57 | + BOOL IsTarget(WORD mode); | |
58 | + void EffectFilter(DWORD grfKeyState, LPDWORD pEffect); | |
59 | + DWORD KeyStateL2R(DWORD grfKeyState); | |
60 | + BOOL DoUseOwnDropTargetHelper(POINTL pt, DWORD dwEffect); | |
61 | +}; |
@@ -0,0 +1,51 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#include "stdafx.h" | |
20 | + | |
21 | +DWORD ReadDWord(HKEY key, LPCTSTR subKey, DWORD defaultValue) | |
22 | +{ | |
23 | + DWORD bytes = sizeof(DWORD); | |
24 | + DWORD work; | |
25 | + DWORD type; | |
26 | + | |
27 | + if (key == NULL) { | |
28 | + return defaultValue; | |
29 | + } | |
30 | + if (RegQueryValueEx(key, subKey, 0, &type, (LPBYTE)&work, &bytes) == ERROR_SUCCESS) { | |
31 | + if (type == REG_DWORD) { | |
32 | + return work; | |
33 | + } | |
34 | + } | |
35 | + return defaultValue; | |
36 | +} | |
37 | + | |
38 | +BOOL WriteDWord(HKEY key, LPCTSTR subKey, DWORD value) | |
39 | +{ | |
40 | + return (RegSetValueEx(key, subKey, 0, REG_DWORD, (LPBYTE)&value, sizeof(DWORD)) == ERROR_SUCCESS); | |
41 | +} | |
42 | + | |
43 | +BOOL ReadBool(HKEY key, LPCTSTR subKey, BOOL defaultValue) | |
44 | +{ | |
45 | + return (ReadDWord(key, subKey, defaultValue) ? 1 : 0); | |
46 | +} | |
47 | + | |
48 | +BOOL WriteBool(HKEY key, LPCTSTR subKey, BOOL value) | |
49 | +{ | |
50 | + return WriteDWord(key, subKey, (value ? 1 : 0)); | |
51 | +} |
@@ -0,0 +1,26 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#pragma once | |
20 | + | |
21 | +#include "stdafx.h" | |
22 | + | |
23 | +DWORD ReadDWord(HKEY key, LPCTSTR subKey, DWORD defaultValue); | |
24 | +BOOL WriteDWord(HKEY key, LPCTSTR subKey, DWORD value); | |
25 | +BOOL ReadBool(HKEY key, LPCTSTR subKey, BOOL defaultValue); | |
26 | +BOOL WriteBool(HKEY key, LPCTSTR subKey, BOOL value); |
@@ -0,0 +1,45 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#pragma once | |
20 | + | |
21 | +#include "stdafx.h" | |
22 | +#include "debug.h" | |
23 | + | |
24 | +#ifdef ALTERDND_DLL_EXPORTS | |
25 | +#define IMPORT extern "C" __declspec(dllexport) | |
26 | +#else | |
27 | +#define IMPORT extern "C" __declspec(dllimport) | |
28 | +#endif | |
29 | + | |
30 | +#define DNDMODE_NORMAL (0x0) | |
31 | +#define DNDMODE_ANY_KEYDOWN (0x1) | |
32 | +#define DNDMODE_RBUTTON_SIMULATE (0x2) | |
33 | +#define DNDMODE_DISABLE (0x3) | |
34 | + | |
35 | +#define DNDTARGET_NONE (0x0) | |
36 | +#define DNDTARGET_EXPLORER (0x1) | |
37 | +#define DNDTARGET_DESKTOP (0x2) | |
38 | + | |
39 | +IMPORT BOOL InstallHook(); | |
40 | +IMPORT void UninstallHook(); | |
41 | + | |
42 | +IMPORT BOOL LoadDnDMode(); | |
43 | +IMPORT BOOL SaveDnDMode(); | |
44 | +IMPORT void GetDnDMode(WORD *mode, WORD *targets); | |
45 | +IMPORT void SetDnDMode(WORD mode, WORD targets); |
@@ -0,0 +1,15 @@ | ||
1 | +//{{NO_DEPENDENCIES}} | |
2 | +// Microsoft Visual C++ generated include file. | |
3 | +// Used by AlterDnD_DLL.rc | |
4 | + | |
5 | +// Next default values for new objects | |
6 | +// | |
7 | +#ifdef APSTUDIO_INVOKED | |
8 | +#ifndef APSTUDIO_READONLY_SYMBOLS | |
9 | +#define _APS_NO_MFC 1 | |
10 | +#define _APS_NEXT_RESOURCE_VALUE 101 | |
11 | +#define _APS_NEXT_COMMAND_VALUE 40001 | |
12 | +#define _APS_NEXT_CONTROL_VALUE 1001 | |
13 | +#define _APS_NEXT_SYMED_VALUE 101 | |
14 | +#endif | |
15 | +#endif |
@@ -0,0 +1,22 @@ | ||
1 | +// stdafx.h : 標準のシステム インクルード ファイルのインクルード ファイル、または | |
2 | +// 参照回数が多く、かつあまり変更されない、プロジェクト専用のインクルード ファイル | |
3 | +// を記述します。 | |
4 | +// | |
5 | + | |
6 | +#pragma once | |
7 | + | |
8 | +#include "targetver.h" | |
9 | + | |
10 | +#define WIN32_LEAN_AND_MEAN // Windows ヘッダーから使用されていない部分を除外します。 | |
11 | +// Windows ヘッダー ファイル: | |
12 | +#include <windows.h> | |
13 | +#include <oleidl.h> | |
14 | +#include <shlobj.h> | |
15 | + | |
16 | +#include <stdio.h> | |
17 | +#include <tchar.h> | |
18 | +#include <strsafe.h> | |
19 | +#include <stdlib.h> | |
20 | + | |
21 | +// TODO: プログラムに必要な追加ヘッダーをここで参照してください。 | |
22 | +#include "AlterDnD_DLL.h" |
@@ -0,0 +1,67 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#include "stdafx.h" | |
20 | + | |
21 | +HMODULE GetDLLModuleHandle(); | |
22 | + | |
23 | +void debug_print(const TCHAR *format, ...) | |
24 | +{ | |
25 | + TCHAR filename[MAX_PATH]; | |
26 | + TCHAR logname[MAX_PATH]; | |
27 | + SYSTEMTIME st; | |
28 | + GetLocalTime(&st); | |
29 | + | |
30 | + if (GetModuleFileName(GetDLLModuleHandle(), filename, _countof(filename)) == 0) { | |
31 | + // ログ出力失敗(モジュール名取得できず) | |
32 | + return; | |
33 | + } | |
34 | + | |
35 | + HRESULT hr = StringCchPrintf(logname, _countof(logname), _T("%s_%04d%02d%02d.log"), filename, (int)st.wYear, (int)st.wMonth, (int)st.wDay); | |
36 | + if (FAILED(hr)) { | |
37 | + // ログ出力失敗(パスが長すぎる) | |
38 | + return; | |
39 | + } | |
40 | + | |
41 | + HANDLE hMutex = CreateMutex(NULL, FALSE, _T("AlterDnD Log Section")); | |
42 | + WaitForSingleObject(hMutex , INFINITE); | |
43 | + | |
44 | + FILE *fp; | |
45 | + _tfopen_s(&fp, logname, _T("a")); | |
46 | + if (fp != NULL) { | |
47 | + va_list argptr; | |
48 | + HMODULE hMod; | |
49 | + TCHAR exename[MAX_PATH] = _T(""); | |
50 | + | |
51 | + hMod = GetModuleHandle(NULL); | |
52 | + GetModuleFileName(hMod, exename, _countof(exename)); | |
53 | + | |
54 | + va_start(argptr, format); | |
55 | + _ftprintf(fp, _T("%04d/%02d/%02d %02d:%02d:%02d.%03d\t%s[%08x]\t"), | |
56 | + (int)st.wYear, (int)st.wMonth, (int)st.wDay, | |
57 | + (int)st.wHour, (int)st.wMinute, (int)st.wSecond, (int)st.wMilliseconds, | |
58 | + exename, (unsigned)hMod); | |
59 | + _vftprintf(fp, format, argptr); | |
60 | + _fputtc(_T('\n'), fp); | |
61 | + va_end(argptr); | |
62 | + | |
63 | + fclose(fp); | |
64 | + } | |
65 | + ReleaseMutex(hMutex); | |
66 | + CloseHandle(hMutex); | |
67 | +} |
@@ -0,0 +1,29 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#pragma once | |
20 | + | |
21 | +#include "stdafx.h" | |
22 | + | |
23 | +#ifdef _DEBUG | |
24 | +#define DP(fmt, ...) debug_print(fmt, __VA_ARGS__) | |
25 | +#else | |
26 | +#define DP(fmt, ...) | |
27 | +#endif | |
28 | + | |
29 | +void debug_print(const TCHAR *format, ...); |
@@ -0,0 +1,18 @@ | ||
1 | +#pragma once | |
2 | + | |
3 | +// SDKDDKVer.h をインクルードすると、利用できる最も上位の Windows プラットフォームが定義されます。 | |
4 | + | |
5 | +// 以前の Windows プラットフォーム用にアプリケーションをビルドする場合は、WinSDKVer.h をインクルードし、 | |
6 | +// SDKDDKVer.h をインクルードする前に、サポート対象とするプラットフォームを示すように _WIN32_WINNT マクロを設定します。 | |
7 | + | |
8 | +//#define WINVER 0x0500 // Windows 2000 | |
9 | +#define WINVER 0x0501 // Windows XP | |
10 | +//#define WINVER 0x0502 // Windows Server 2003 | |
11 | +//#define WINVER 0x0600 // Windows Vista | |
12 | +//#define WINVER 0x0601 // Windows 7 | |
13 | + | |
14 | +#define _WIN32_WINNT 0x0501 | |
15 | +#define _WIN32_WINDOWS 0x0410 | |
16 | +#define _WIN32_IE 0x0500 | |
17 | + | |
18 | +#include <SDKDDKVer.h> |
@@ -0,0 +1,41 @@ | ||
1 | +/*********************************************************************** | |
2 | +* | |
3 | +* Copyright (C) 2013 しゅう | |
4 | +* | |
5 | +* This program is free software: you can redistribute it and/or modify | |
6 | +* it under the terms of the GNU General Public License as published by | |
7 | +* the Free Software Foundation; either version 3 of the License, or | |
8 | +* (at your option) any later version. | |
9 | +* | |
10 | +* This program is distributed in the hope that it will be useful, | |
11 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | +* GNU General Public License for more details. | |
14 | +* | |
15 | +* You should have received a copy of the GNU General Public License | |
16 | +* along with this program. If not, see <http://www.gnu.org/licenses/> | |
17 | +***********************************************************************/ | |
18 | + | |
19 | +#include "stdafx.h" | |
20 | + | |
21 | +void InitializeDLL(HMODULE hModule); | |
22 | + | |
23 | +BOOL APIENTRY DllMain( HMODULE hModule, | |
24 | + DWORD ul_reason_for_call, | |
25 | + LPVOID lpReserved | |
26 | + ) | |
27 | +{ | |
28 | + switch (ul_reason_for_call) | |
29 | + { | |
30 | + case DLL_PROCESS_ATTACH: | |
31 | + InitializeDLL(hModule); | |
32 | + break; | |
33 | + case DLL_THREAD_ATTACH: | |
34 | + break; | |
35 | + case DLL_THREAD_DETACH: | |
36 | + break; | |
37 | + case DLL_PROCESS_DETACH: | |
38 | + break; | |
39 | + } | |
40 | + return TRUE; | |
41 | +} |
@@ -0,0 +1,8 @@ | ||
1 | +// stdafx.cpp : 標準インクルード AlterDnD_DLL.pch のみを | |
2 | +// 含むソース ファイルは、プリコンパイル済みヘッダーになります。 | |
3 | +// stdafx.obj にはプリコンパイル済み型情報が含まれます。 | |
4 | + | |
5 | +#include "stdafx.h" | |
6 | + | |
7 | +// TODO: このファイルではなく、STDAFX.H で必要な | |
8 | +// 追加ヘッダーを参照してください。 |
@@ -0,0 +1,674 @@ | ||
1 | + GNU GENERAL PUBLIC LICENSE | |
2 | + Version 3, 29 June 2007 | |
3 | + | |
4 | + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> | |
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 | + <one line to give the program's name and a brief idea of what it does.> | |
635 | + Copyright (C) <year> <name of author> | |
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 <http://www.gnu.org/licenses/>. | |
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 | + <program> Copyright (C) <year> <name of author> | |
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 | +<http://www.gnu.org/licenses/>. | |
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 | +<http://www.gnu.org/philosophy/why-not-lgpl.html>. |