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







IKpDatabase.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 ___IKPDATABASE_H___
31 #define ___IKPDATABASE_H___
32 
33 #pragma once
34 
35 #include "../../SysDefEx.h"
36 #include "IKpUnknown.h"
37 #include "../../PwStructs.h"
38 
39 #pragma pack(1)
40 
44 struct KP_DECL_INTERFACE("29A5C55A-7100-4A1E-B74D-986C0E085AB2") IKpDatabase :
45  public IKpUnknown
46 {
47 public:
49  STDMETHOD(InitPrimaryInstance)() = 0;
50 
53  STDMETHOD_(INT, SetMasterKey)(LPCTSTR lpMasterKey, BOOL bDiskDrive,
54  LPCTSTR lpSecondKey) = 0;
55 
56  STDMETHOD_(DWORD, GetEntryCount)() = 0;
57  STDMETHOD_(DWORD, GetGroupCount)() = 0;
58 
60  STDMETHOD_(DWORD, GetEntryCountInGroup)(LPCTSTR lpGroup) = 0;
62  STDMETHOD_(DWORD, GetEntryCountInGroupN)(DWORD dwGroupId) = 0;
63 
64  // Access entry information
65 
67  STDMETHOD_(PW_ENTRY*, GetEntry)(DWORD dwIndex) = 0;
69  STDMETHOD_(PW_ENTRY*, GetEntryByGroup)(DWORD dwGroupId, DWORD dwIndex) = 0;
70  STDMETHOD_(DWORD, GetEntryByGroupN)(DWORD dwGroupId, DWORD dwIndex) = 0;
72  STDMETHOD_(PW_ENTRY*, GetEntryByUuid)(const BYTE* pUuid) = 0;
73  STDMETHOD_(DWORD, GetEntryByUuidN)(const BYTE* pUuid) = 0; // Returns the index of the item with pUuid
74  STDMETHOD_(DWORD, GetEntryPosInGroup)(const PW_ENTRY* pEntry) = 0;
76  STDMETHOD_(PW_ENTRY*, GetLastEditedEntry)() = 0;
77 
78  // Access group information
79 
81  STDMETHOD_(PW_GROUP*, GetGroup)(DWORD dwIndex) = 0;
83  STDMETHOD_(PW_GROUP*, GetGroupById)(DWORD dwGroupId) = 0;
84  STDMETHOD_(DWORD, GetGroupByIdN)(DWORD dwGroupId) = 0;
85  STDMETHOD_(DWORD, GetGroupId)(LPCTSTR lpGroupName) = 0;
86  STDMETHOD_(DWORD, GetGroupIdByIndex)(DWORD dwIndex) = 0;
87  STDMETHOD_(DWORD, GetLastChildGroup)(DWORD dwParentIndex) = 0;
88  STDMETHOD_(BOOL, GetGroupTree)(DWORD dwGroupId, DWORD* pvIndices) = 0;
89 
90  // Add entries and groups
91  STDMETHOD_(BOOL, AddGroup)(const PW_GROUP* pTemplate) = 0;
92  STDMETHOD_(BOOL, AddEntry)(const PW_ENTRY* pTemplate) = 0;
93  STDMETHOD_(BOOL, BackupEntry)(const PW_ENTRY* pe, BOOL* pbGroupCreated) = 0; // pe must be unlocked already
94 
95  // Delete entries and groups
96  STDMETHOD_(BOOL, DeleteEntry)(DWORD dwIndex) = 0;
97  STDMETHOD_(BOOL, DeleteGroupById)(DWORD dwGroupId, BOOL bCreateBackupEntries) = 0;
98 
99  STDMETHOD_(BOOL, SetGroup)(DWORD dwIndex, const PW_GROUP* pTemplate) = 0;
100  STDMETHOD_(BOOL, SetEntry)(DWORD dwIndex, const PW_ENTRY* pTemplate) = 0;
101 
104  STDMETHOD(LockEntryPassword)(PW_ENTRY* pEntry) = 0;
105 
111  STDMETHOD(UnlockEntryPassword)(PW_ENTRY* pEntry) = 0;
112 
113  STDMETHOD(NewDatabase)() = 0;
114  STDMETHOD_(INT, OpenDatabase)(LPCTSTR lpFile, PWDB_REPAIR_INFO* pRepair) = 0;
115  STDMETHOD_(INT, SaveDatabase)(LPCTSTR lpFile, BYTE* pWrittenDataHash32) = 0;
116 
117  // Move entries and groups
118  STDMETHOD(MoveEntry)(DWORD dwGroupId, DWORD dwFrom, DWORD dwTo) = 0;
119  STDMETHOD_(BOOL, MoveGroup)(DWORD dwFrom, DWORD dwTo) = 0;
120  STDMETHOD_(BOOL, MoveGroupEx)(DWORD dwFromId, DWORD dwToId) = 0;
121  STDMETHOD_(BOOL, MoveGroupExDir)(DWORD dwGroupId, INT iDirection) = 0;
122 
123  // Sort entry and group lists
124  STDMETHOD(SortGroup)(DWORD dwGroupId, DWORD dwSortByField) = 0;
125  STDMETHOD(SortGroupList)() = 0;
126 
127  // Find an item
128  STDMETHOD_(DWORD, Find)(LPCTSTR lpFindString, BOOL bCaseSensitive,
129  DWORD dwSearchFlags, DWORD dwStart) = 0;
130 
131  // Get and set the algorithm used to encrypt the database
132  STDMETHOD_(BOOL, SetEncryptionAlgorithm)(INT nAlgorithm) = 0;
133  STDMETHOD_(INT, GetEncryptionAlgorithm)() = 0;
134 
135  STDMETHOD_(DWORD, GetKeyEncRounds)() = 0;
136  STDMETHOD(SetKeyEncRounds)(DWORD dwRounds) = 0;
137 
139  STDMETHOD_(const PW_DBHEADER*, GetLastDatabaseHeader)() = 0;
140 
142  STDMETHOD(FixGroupTree)() = 0;
143 
144  STDMETHOD(SubstEntryGroupIds)(DWORD dwExistingId, DWORD dwNewId) = 0;
145 
146  STDMETHOD(GetRawMasterKey)(BYTE* pStorage) = 0;
147  STDMETHOD(SetRawMasterKey)(const BYTE* pNewKey) = 0;
148 
149  STDMETHOD(GetPropertyString)(DWORD dwPropertyId, LPTSTR lpBuf, DWORD dwBufMaxChars) = 0;
150  STDMETHOD_(BOOL, SetPropertyString)(DWORD dwPropertyId, LPCTSTR lpValue) = 0;
151 
154  STDMETHOD_(BOOL, SetCustomKvp)(LPCTSTR lpKey, LPCTSTR lpValue) = 0;
157  STDMETHOD_(LPCTSTR, GetCustomKvp)(LPCTSTR lpKey) = 0;
158 
160  STDMETHOD_(LPCTSTR, GetBackupGroupName)(BOOL bTranslated) = 0;
161 };
162 
163 #pragma pack()
164 
165 #endif // ___IKPDATABASE_H___
Base interface from which all other interfaces must derive.
Definition: IKpUnknown.h:41
Interface to a database handling object.
Definition: IKpDatabase.h:44

Documentation generated with Doxygen.





Get KeePass