KeePass Help Center KeePass Home | Downloads | Translations | Plugins | Donate 
Help Center Home | Forums | Awards | Links 







KpDefs.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008-2024 Dominik Reichl
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions
7  are met:
8 
9  * Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11  * Redistributions in binary form must reproduce the above copyright
12  notice, this list of conditions and the following disclaimer in
13  the documentation and/or other materials provided with the
14  distribution.
15 
16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  POSSIBILITY OF SUCH DAMAGE.
28 */
29 
30 #ifndef ___KP_DEFS_H___
31 #define ___KP_DEFS_H___
32 
33 #pragma once
34 
35 #include "../../SysDefEx.h"
36 #include "IKpUnknown.h"
37 
38 // Interface names
39 #ifndef _UNICODE
40 #define KP_I_CREATEINSTANCE "KpCreateInstance"
41 #define KP_I_INITIALIZELIB "KpInitializeLibrary"
42 #define KP_I_RELEASELIB "KpReleaseLibrary"
43 #else
44 #define KP_I_CREATEINSTANCE "KpCreateInstanceW"
45 #define KP_I_INITIALIZELIB "KpInitializeLibraryW"
46 #define KP_I_RELEASELIB "KpReleaseLibraryW"
47 #endif
48 
49 #define KP_I_CREATEINSTANCE_DECL KpCreateInstance
50 #define KP_I_INITIALIZELIB_DECL KpInitializeLibrary
51 #define KP_I_RELEASELIB_DECL KpReleaseLibrary
52 
54 // KeePass menu item flags
55 
56 #define KPMIF_NORMAL 0
57 #define KPMIF_CHECKBOX 1
58 #define KPMIF_ENABLED 0
59 #define KPMIF_DISABLED 2
60 #define KPMIF_POPUP_START 4
61 #define KPMIF_POPUP_END 8
62 // To make a separator, set lpCommandString to ""
63 
65 // KeePass menu item states
66 
67 #define KPMIS_UNCHECKED 0
68 #define KPMIS_CHECKED 1
69 
71 // Callback-like communication functions
72 
73 // typedef DWORD_PTR(KP_API *LPKP_CALL)(DWORD dwCode, LPARAM lParamW, LPARAM lParamL, LPARAM lParamM);
74 // typedef DWORD_PTR(KP_API *LPKP_QUERY)(DWORD dwCode, LPARAM lParam);
75 
77 // KeePass plugin structures
78 
79 // #pragma pack(1)
80 
81 // typedef struct
82 // {
83 // DWORD dwAppVersion; // 0.98b would be 0x00090802, 1.04 is 0x01000401
84 // HWND hwndMain;
85 // void *pMainDlg; // Pointer to current CPwSafeDlg class, cast it
86 // void *pPwMgr; // Pointer to current CPwManager class, cast it
87 //
88 // LPKP_CALL lpKPCall; // KeePass call function (see KP_Call)
89 // LPKP_QUERY lpKPQuery; // KeePass query function (see KP_Query)
90 // } KP_APP_INFO, *LPKP_APP_INFO;
91 
92 // typedef struct
93 // {
94 // DWORD dwForAppVer; // Plugin has been designed for this KeePass version
95 // DWORD dwPluginVer;
96 // TCHAR tszPluginName[64];
97 // TCHAR tszAuthor[64]; // Author of the plugin
98 // const TCHAR* cmdLineArgPrefix; // See Note 1 below.
99 // DWORD dwNumCommands; // Number of menu items
100 // KP_MENU_ITEM *pMenuItems;
101 // } KP_PLUGIN_INFO, *LPKP_PLUGIN_INFO;
102 
103 // #pragma pack()
104 
105 // Note 1:
106 // If the plugin does not define command line options, set cmdLineArgPrefix to null.
107 // If the plugin defines command line options, cmdLineArgPrefix should point to
108 // a null terminated lower case string whose last character is dot _T('.').
109 // This string represents the prefix for the command line arguments.
110 
112 // Functions called by KeePass (must be exported by the plugin DLL)
113 
114 // KP_EXP BOOL KP_API KeePluginInit(const KP_APP_INFO *pAppInfo, KP_PLUGIN_INFO *pPluginInfo);
115 // typedef BOOL(KP_API *LPKEEPLUGININIT)(const KP_APP_INFO *pAppInfo, KP_PLUGIN_INFO *pPluginInfo);
116 
117 // KP_EXP BOOL KP_API KeePluginCall(DWORD dwCode, LPARAM lParamW, LPARAM lParamL);
118 // typedef BOOL(KP_API *LPKEEPLUGINCALL)(DWORD dwCode, LPARAM lParamW, LPARAM lParamL);
119 
120 // KP_EXP BOOL KP_API KeePluginExit(LPARAM lParamW, LPARAM lParamL);
121 // typedef BOOL(KP_API *LPKEEPLUGINEXIT)(LPARAM lParamW, LPARAM lParamL);
122 
123 typedef HRESULT(KP_API *LPKPCREATEINSTANCE)(REFIID riid, void** ppvObject,
124  IKpUnknown* pAPI);
125 
126 typedef HRESULT(KP_API *LPKPLIBFUNC)(IKpUnknown* pAPI);
127 
129 // The structure that holds all information about one single plugin
130 
131 // #pragma pack(1)
132 
133 // typedef struct
134 // {
135 // DWORD dwPluginID; // Assigned by KeePass, used internally
136 // TCHAR tszFile[MAX_PATH];
137 // BOOL bEnabled;
138 // HINSTANCE hinstDLL;
139 //
140 // KP_PLUGIN_INFO info;
141 //
142 // LPKEEPLUGININIT lpInit;
143 // LPKEEPLUGINCALL lpCall;
144 // LPKEEPLUGINEXIT lpExit;
145 // } KP_PLUGIN_INSTANCE, *LPKP_PLUGIN_INSTANCE;
146 
147 // #pragma pack()
148 
150 // KeePass plugin message codes
151 
152 #define KPM_NULL 0
153 #define KPM_DIRECT_EXEC 1
154 #define KPM_DIRECT_CONFIG 2
155 #define KPM_PLUGIN_INFO 3
156 
157 #define KPM_DELAYED_INIT 58
158 
159 #define KPM_CLEANUP 72
160 
161 // General notifications
162 
163 #define KPM_INIT_MENU_POPUP 4
164 
165 #define KPM_WND_INIT_POST 6
166 #define KPM_READ_COMMAND_ARGS 54
167 
168 #define KPM_DELETE_TEMP_FILES_PRE 7
169 #define KPM_WM_CANCEL 12
170 
171 #define KPM_PWLIST_CONTEXTMENU 18
172 #define KPM_GROUPLIST_CONTEXTMENU 20
173 
174 #define KPM_OPENDB_PRE 25
175 #define KPM_OPENDB_POST 26
176 #define KPM_OPENDB_COMMITTED 53
177 
178 #define KPM_SAVEDB_POST 49
179 #define KPM_SAVEDB_AS_POST 51
180 
181 #define KPM_CHANGE_MASTER_KEY_PRE 50
182 
183 // File menu commands
184 
185 #define KPM_FILE_NEW_PRE 23
186 #define KPM_FILE_NEW_POST 24
187 #define KPM_FILE_OPEN_PRE 27
188 #define KPM_FILE_SAVE_PRE 28
189 #define KPM_FILE_SAVEAS_PRE 29
190 #define KPM_FILE_CLOSE_PRE 30
191 #define KPM_FILE_CLOSE_POST 52
192 
193 #define KPM_FILE_PRINT_PRE 35
194 #define KPM_FILE_PRINTPREVIEW_PRE 45
195 
196 #define KPM_FILE_DBSETTINGS_PRE 48
197 #define KPM_FILE_CHANGE_MASTER_KEY_PRE 34
198 
199 #define KPM_FILE_LOCK_PRE 42
200 #define KPM_FILE_LOCK_CLOSE_PRE 55
201 #define KPM_FILE_LOCK_CLOSE_POST 56
202 #define KPM_FILE_UNLOCK_FAILED 57
203 
204 #define KPM_FILE_EXIT_PRE 8
205 
206 // Other menu commands
207 
208 #define KPM_OPTIONS_PRE 31
209 #define KPM_OPTIONS_POST 32
210 #define KPM_VIEW_HIDE_STARS_PRE 11
211 #define KPM_GEN_PASSWORD_PRE 36
212 #define KPM_TANWIZARD_PRE 44
213 #define KPM_INFO_ABOUT_PRE 9
214 
215 // Entry list commands
216 
217 #define KPM_ADD_ENTRY_PRE 5
218 #define KPM_ADD_ENTRY 14
219 #define KPM_EDIT_ENTRY_PRE 15
220 // #define KPM_EDIT_ENTRY 16
221 #define KPM_DELETE_ENTRY_PRE 17
222 #define KPM_DUPLICATE_ENTRY_PRE 40
223 
224 #define KPM_PWLIST_FIND_PRE 38
225 #define KPM_PWLIST_FIND_IN_GROUP_PRE 39
226 
227 #define KPM_MASSMODIFY_ENTRIES_PRE 43
228 
229 // Direct entry commands
230 
231 #define KPM_PW_COPY 19
232 #define KPM_USER_COPY 21
233 #define KPM_URL_VISIT 22
234 
235 // Group list commands
236 
237 #define KPM_GROUP_ADD_PRE 10
238 #define KPM_GROUP_ADD 13
239 #define KPM_GROUP_ADD_SUBGROUP_PRE 46
240 #define KPM_GROUP_MODIFY_PRE 37
241 #define KPM_GROUP_REMOVE_PRE 33
242 #define KPM_GROUP_SORT_PRE 47
243 #define KPM_GROUP_PRINT_PRE 41
244 
245 // Key provider messages
246 
247 #define KPM_KEYPROV_QUERY_INFO_FIRST 59
248 #define KPM_KEYPROV_QUERY_INFO_NEXT 60
249 #define KPM_KEYPROV_QUERY_KEY 61
250 #define KPM_KEYPROV_QUERY_KEY_EX 70
251 #define KPM_KEYPROV_FINALIZE 62
252 
253 // Other messages
254 
255 #define KPM_OPTIONS_SAVE_GLOBAL 63
256 
257 #define KPM_VALIDATE_MASTERPASSWORD 64
258 #define KPM_VALIDATE_ENTRY 65
259 #define KPM_VALIDATE_GENPASSWORD 66
260 
261 #define KPM_SELECTAPP_ASURL 67
262 
263 #define KPM_USERAPP_GETFIRST 68
264 #define KPM_USERAPP_GETNEXT 69
265 
266 #define KPM_TRAY_NOTIFY 71
267 #define KPM_TRAY_CUSTOMIZE_PRE 73
268 #define KPM_TRAY_CUSTOMIZE_POST 74
269 
270 // The following is unused; it's always the last command ID + 1;
271 // do not use this value under any circumstances (it will break
272 // upward compatibility, if you do!)
273 #if (0 == 1)
274 #define KPM_NEXT 75
275 #error Your build will not be upward-compatible.
276 #endif
277 
278 // FREELY AVAILABLE MESSAGE CODES:
279 // Plugins may internally use message codes in the range
280 // 0xFF000000 to 0xFFFFFF00. It is guaranteed that KeePass will
281 // never call your message handler with any of the codes in this range.
282 
284 // KeePass query IDs (used in function KP_Query)
285 
286 // #define KPQUERY_NULL 0 /* Deprecated, use KPQ_NULL */
287 // #define KPQUERY_VERSION 1 /* Deprecated, use KPQ_VERSION */
288 
289 // #define KPQ_NULL 0
290 // #define KPQ_VERSION 1
291 // #define KPQ_FILEOPEN 2
292 // #define KPQ_PWLIST_ITEMCOUNT 3
293 // #define KPQ_SELECTEDGROUPID 4
294 // #define KPQ_NEVER_EXPIRE_TIME 5
295 // #define KPQ_GET_GROUP 6
296 // #define KPQ_ABSOLUTE_DB_PATH 7
297 // #define KPQ_TRANSLATION_NAME 8
298 // #define KPQ_GET_CUSTOMKVP 9
299 // #define KPQ_MAINWINDOW_HWND 10
300 
302 // KeePass call result codes (return value from KP_Call)
303 
304 // #define KPR_SUCCESS 0
305 // #define KPR_FAILED 1
306 
308 // KeePass call IDs (used in function KP_Call)
309 
310 // #define KPC_NULL 0
311 // #define KPC_INSERT_IMPORTFROM_ITEM 1 // w: Name, l: ID, m: Icon index
312 // #define KPC_MODIFIED 2
313 // #define KPC_DISPLAYDIALOG 3
314 // #define KPC_PWLIST_ENSUREVISIBLE 4
315 // #define KPC_UPDATE_TOOLBAR 5
316 // #define KPC_UPDATE_GROUPLIST 6
317 // #define KPC_UPDATE_PASSWORDLIST 7
318 // #define KPC_STATUSBARTEXT 8
319 // #define KPC_UPDATE_UI 9
320 // #define KPC_OPENFILE_DIALOG 10
321 // #define KPC_ADD_ENTRY 11
322 // #define KPC_EDIT_ENTRY 12
323 // #define KPC_DELETE_ENTRY 13
324 // #define KPC_AUTOTYPE 14
325 // #define KPC_SET_CUSTOMKVP 15
326 
328 // KeePass call flags (used in function IKpAPI::AutoType)
329 
330 #define KPF_AUTOTYPE_LOSEFOCUS 0x10000
331 
333 // Plugin string identifiers (used for GetProperty method)
334 
335 #define KPPS_COMMANDLINEARGPREFIX _T("CommandLineArgPrefix")
336 #define KPPS_UNLOAD_LATE _T("UnloadLate")
337 
339 // Open mode for IKpUtilities::ShellOpenLocalFile
340 
341 #define OLF_OPEN 0
342 #define OLF_PRINT 1
343 #define OLF_EXPLORE 2
344 
346 // Flags for IKpUtilities::ValidatePath
347 
348 #define KPVPF_DEFAULT 0
349 #define KPVPF_MUST_EXIST 1
350 
351 // The following additional flags are only valid if KPVPF_MUST_EXIST is
352 // specified:
353 #define KPVPF_TYPE_DIRECTORY 2
354 #define KPVPF_TYPE_FILE 4
355 
356 // Other optional checks:
357 #define KPVPF_REGULAR_NAME 8
358 
360 // Base64 utility method definitions
361 
362 #define CB64_PROTOCOL "base64://"
363 #define CB64_PROTOCOL_LEN 9
364 
366 // Configuration definitions
367 
368 #define SI_REGSIZE 2048
369 
371 // IKpFullPathName state definitions
372 
373 #define KPFPN_UNINITIALIZED 1
374 #define KPFPN_INVALID_PATH 2
375 #define KPFPN_PATH_ONLY 4
376 #define KPFPN_PATH_AND_FILENAME 8
377 
379 // Key provider definitions
380 
381 // For dwType in KP_KEYPROV_KEY:
382 #define KPKTF_DIRECT 1
383 
384 #endif // ___KP_DEFS_H___
Base interface from which all other interfaces must derive.
Definition: IKpUnknown.h:41
HRESULT(KP_API * LPKPLIBFUNC)(IKpUnknown *pAPI)
Definition: KpDefs.h:126
HRESULT(KP_API * LPKPCREATEINSTANCE)(REFIID riid, void **ppvObject, IKpUnknown *pAPI)
Definition: KpDefs.h:123

Documentation generated with Doxygen.





Get KeePass