|
Interface to an object providing various utility methods.
More...
#include <IKpUtilities.h>
|
virtual HRESULT | ShowFileDialog (BOOL bOpenMode, LPCTSTR lpSuffix, LPTSTR lpStoreBuf, DWORD dwBufLen)=0 |
|
virtual char * | UnicodeToMultiByte (const WCHAR *lpwString)=0 |
| Convert a Unicode to a multi-byte string. More...
|
|
virtual WCHAR * | MultiByteToUnicode (const char *lpString)=0 |
| Convert a multi-byte to a Unicode string. More...
|
|
virtual BYTE * | StringToUTF8 (LPCTSTR lpSourceString)=0 |
| Convert a string to UTF-8. More...
|
|
virtual DWORD | UTF8NumChars (const UTF8_BYTE *pUTF8String)=0 |
|
virtual DWORD | UTF8BytesNeeded (LPCTSTR lpString)=0 |
|
virtual LPTSTR | UTF8ToString (const UTF8_BYTE *pUTF8String)=0 |
| Convert a UTF-8 string to a TCHAR string. More...
|
|
virtual BOOL | IsUTF8String (const UTF8_BYTE *pUTF8String)=0 |
|
virtual HRESULT | UuidToString (const BYTE *pUuid, LPTSTR lpOutBuf)=0 |
|
virtual HRESULT | StringToUuid (LPCTSTR lpSource, BYTE *pUuid)=0 |
|
virtual INT | ShellOpenLocalFile (LPCTSTR lpFile, INT nMode)=0 |
|
virtual HRESULT | OpenUrl (LPCTSTR lpURL, HWND hParent)=0 |
|
virtual HRESULT | OpenAppHelp (LPCTSTR lpTopicFile)=0 |
|
virtual HRESULT | Base64Encode (const BYTE *pbIn, DWORD cbInLen, BYTE *pbOut, DWORD *pcbOutLen)=0 |
|
virtual HRESULT | Base64Decode (const BYTE *pbIn, DWORD cbInLen, BYTE *pbOut, DWORD *pcbOutLen)=0 |
|
virtual HRESULT | GetApplicationDirectory (LPTSTR lpStoreBuf, DWORD dwBufLen, BOOL bFilterSpecial, BOOL bMakeURL)=0 |
|
virtual LPTSTR | MakeRelativePath (LPCTSTR lpBaseFile, LPCTSTR lpTargetFile)=0 |
| Create a relative path from a given file and a base path. More...
|
|
virtual LPTSTR | GetShortestAbsolutePath (LPCTSTR lpFilePath)=0 |
| Compact a path (evaluate navigations like two dots, etc). More...
|
|
virtual BOOL | IsAbsolutePath (LPCTSTR lpPath)=0 |
|
virtual BOOL | ValidatePath (LPCTSTR lpPath, DWORD dwOptions)=0 |
| Validate a path string. More...
|
|
virtual LPTSTR | GetQuotedPath (LPCTSTR lpPath)=0 |
| Filter quotes of a path. More...
|
|
virtual HRESULT | CreateDirectoryTree (LPCTSTR lpDirPath, DWORD dwOptions)=0 |
| Create a directory tree (the specified directory and all intermediate directories). More...
|
|
virtual HRESULT | FlushStorageBuffers (LPCTSTR lpFileOnStorage, BOOL bOnlyIfRemovable)=0 |
| Try to flush all write buffers to the device containing the specified file/directory. More...
|
|
virtual HRESULT | SecureDeleteFile (LPCTSTR lpFilePath)=0 |
| Securely delete a file (overwrite multiple times before unlinking from file system). More...
|
|
virtual HRESULT | WriteFile (LPCTSTR lpFilePath, const BYTE *pData, DWORD dwDataSize)=0 |
|
virtual INT | CompareTimes (const PW_TIME *pTime1, const PW_TIME *pTime2)=0 |
|
virtual DWORD | EstimatePasswordBits (LPCTSTR lpPassword)=0 |
|
virtual BOOL | IsTANEntry (const PW_ENTRY *pEntry)=0 |
|
virtual HRESULT | HashFileSHA256 (LPCTSTR lpFile, BYTE *pHashBuf)=0 |
|
virtual HRESULT | SHA256CreateContext (void **pOutNewContext)=0 |
| Create a SHA-256 hash context. More...
|
|
virtual HRESULT | SHA256Init (void *pContext)=0 |
| Initialize a hash context. More...
|
|
virtual HRESULT | SHA256Hash (void *pContext, const BYTE *pData, DWORD dwDataLength)=0 |
| Hash data. More...
|
|
virtual HRESULT | SHA256Final (void *pContext, BYTE *pOutHashBuf)=0 |
| Finalize a hash. More...
|
|
virtual HRESULT | EncryptMemory (BYTE *pbBuf, DWORD dwBufLen, const BYTE *pbKey, DWORD dwKeyLen)=0 |
| Encrypt a memory block. More...
|
|
virtual HRESULT | DecryptMemory (BYTE *pbBuf, DWORD dwBufLen, const BYTE *pbKey, DWORD dwKeyLen)=0 |
| Decrypt a memory block. More...
|
|
virtual HRESULT | QueryInterface (REFIID riid, void **ppvObject)=0 |
| COM infrastructure, provides access to all interfaces supported by this object. More...
|
|
virtual ULONG | AddRef ()=0 |
| COM infrastructure, increments the reference count for this object. More...
|
|
virtual ULONG | Release ()=0 |
| COM infrastructure, decrements the reference count for this object and eventually deletes it. More...
|
|
Interface to an object providing various utility methods.
Use IKpAPI::QueryInstance to retrieve an interface to a singleton object in KeePass providing utility methods.
◆ Base64Decode()
virtual HRESULT IKpUtilities::Base64Decode |
( |
const BYTE * |
pbIn, |
|
|
DWORD |
cbInLen, |
|
|
BYTE * |
pbOut, |
|
|
DWORD * |
pcbOutLen |
|
) |
| |
|
pure virtual |
◆ Base64Encode()
virtual HRESULT IKpUtilities::Base64Encode |
( |
const BYTE * |
pbIn, |
|
|
DWORD |
cbInLen, |
|
|
BYTE * |
pbOut, |
|
|
DWORD * |
pcbOutLen |
|
) |
| |
|
pure virtual |
◆ CompareTimes()
virtual INT IKpUtilities::CompareTimes |
( |
const PW_TIME * |
pTime1, |
|
|
const PW_TIME * |
pTime2 |
|
) |
| |
|
pure virtual |
◆ CreateDirectoryTree()
virtual HRESULT IKpUtilities::CreateDirectoryTree |
( |
LPCTSTR |
lpDirPath, |
|
|
DWORD |
dwOptions |
|
) |
| |
|
pure virtual |
Create a directory tree (the specified directory and all intermediate directories).
- Parameters
-
lpDirPath | Directory path. |
dwOptions | Reserved for future use, set it to 0. |
- Returns
- S_OK, if successful.
-
A COM error code (E_XXX), if unsuccessful.
◆ DecryptMemory()
virtual HRESULT IKpUtilities::DecryptMemory |
( |
BYTE * |
pbBuf, |
|
|
DWORD |
dwBufLen, |
|
|
const BYTE * |
pbKey, |
|
|
DWORD |
dwKeyLen |
|
) |
| |
|
pure virtual |
◆ EncryptMemory()
virtual HRESULT IKpUtilities::EncryptMemory |
( |
BYTE * |
pbBuf, |
|
|
DWORD |
dwBufLen, |
|
|
const BYTE * |
pbKey, |
|
|
DWORD |
dwKeyLen |
|
) |
| |
|
pure virtual |
Encrypt a memory block.
This method is only intended for protecting a memory block in order to make it unreadable by other processes. It is not guaranteed that all KeePass versions use the same algorithm, therefore do not store data encrypted with this method. - See also
- DecryptMemory
◆ EstimatePasswordBits()
virtual DWORD IKpUtilities::EstimatePasswordBits |
( |
LPCTSTR |
lpPassword | ) |
|
|
pure virtual |
◆ FlushStorageBuffers()
virtual HRESULT IKpUtilities::FlushStorageBuffers |
( |
LPCTSTR |
lpFileOnStorage, |
|
|
BOOL |
bOnlyIfRemovable |
|
) |
| |
|
pure virtual |
Try to flush all write buffers to the device containing the specified file/directory.
If the user doesn't have administrative rights, this might fail.
◆ GetApplicationDirectory()
virtual HRESULT IKpUtilities::GetApplicationDirectory |
( |
LPTSTR |
lpStoreBuf, |
|
|
DWORD |
dwBufLen, |
|
|
BOOL |
bFilterSpecial, |
|
|
BOOL |
bMakeURL |
|
) |
| |
|
pure virtual |
◆ GetQuotedPath()
virtual LPTSTR IKpUtilities::GetQuotedPath |
( |
LPCTSTR |
lpPath | ) |
|
|
pure virtual |
Filter quotes of a path.
- Returns
- Unquoted path.
-
The returned string must be deleted using IKpAPI::DeleteArray.
◆ GetShortestAbsolutePath()
virtual LPTSTR IKpUtilities::GetShortestAbsolutePath |
( |
LPCTSTR |
lpFilePath | ) |
|
|
pure virtual |
Compact a path (evaluate navigations like two dots, etc).
- Returns
- Absolute path.
-
The returned string must be deleted using IKpAPI::DeleteArray.
◆ HashFileSHA256()
virtual HRESULT IKpUtilities::HashFileSHA256 |
( |
LPCTSTR |
lpFile, |
|
|
BYTE * |
pHashBuf |
|
) |
| |
|
pure virtual |
◆ IsAbsolutePath()
virtual BOOL IKpUtilities::IsAbsolutePath |
( |
LPCTSTR |
lpPath | ) |
|
|
pure virtual |
◆ IsTANEntry()
virtual BOOL IKpUtilities::IsTANEntry |
( |
const PW_ENTRY * |
pEntry | ) |
|
|
pure virtual |
◆ IsUTF8String()
virtual BOOL IKpUtilities::IsUTF8String |
( |
const UTF8_BYTE * |
pUTF8String | ) |
|
|
pure virtual |
◆ MakeRelativePath()
virtual LPTSTR IKpUtilities::MakeRelativePath |
( |
LPCTSTR |
lpBaseFile, |
|
|
LPCTSTR |
lpTargetFile |
|
) |
| |
|
pure virtual |
Create a relative path from a given file and a base path.
- Returns
- Relative path.
-
The returned string must be deleted using IKpAPI::DeleteArray.
◆ MultiByteToUnicode()
virtual WCHAR* IKpUtilities::MultiByteToUnicode |
( |
const char * |
lpString | ) |
|
|
pure virtual |
Convert a multi-byte to a Unicode string.
- Returns
- Unicode string.
-
The returned string must be deleted using IKpAPI::DeleteArray.
◆ OpenAppHelp()
virtual HRESULT IKpUtilities::OpenAppHelp |
( |
LPCTSTR |
lpTopicFile | ) |
|
|
pure virtual |
◆ OpenUrl()
virtual HRESULT IKpUtilities::OpenUrl |
( |
LPCTSTR |
lpURL, |
|
|
HWND |
hParent |
|
) |
| |
|
pure virtual |
◆ SecureDeleteFile()
virtual HRESULT IKpUtilities::SecureDeleteFile |
( |
LPCTSTR |
lpFilePath | ) |
|
|
pure virtual |
Securely delete a file (overwrite multiple times before unlinking from file system).
◆ SHA256CreateContext()
virtual HRESULT IKpUtilities::SHA256CreateContext |
( |
void ** |
pOutNewContext | ) |
|
|
pure virtual |
Create a SHA-256 hash context.
The context pointer stored in pOutNewContext can be passed to the other SHA256XXX methods. It must be deleted using IKpAPI::DeleteObject. The hash context is already initialized, you do not need to call IKpUtilities::SHA256Init. - See also
- SHA256Init
◆ SHA256Final()
virtual HRESULT IKpUtilities::SHA256Final |
( |
void * |
pContext, |
|
|
BYTE * |
pOutHashBuf |
|
) |
| |
|
pure virtual |
Finalize a hash.
Finish the hashing process and store the final hash value in pOutHashBuf. Note that you still have to delete the hash context using IKpAPI::DeleteObject. - Parameters
-
pContext | Context, created by IKpUtilities::SHA256CreateContext. |
pOutHashBuf | Address of a buffer that will receive the hash value. Must be able to hold at least 32 bytes. |
◆ SHA256Hash()
virtual HRESULT IKpUtilities::SHA256Hash |
( |
void * |
pContext, |
|
|
const BYTE * |
pData, |
|
|
DWORD |
dwDataLength |
|
) |
| |
|
pure virtual |
Hash data.
Note this method can be called multiple times consecutively to hash large data step by step. - Parameters
-
◆ SHA256Init()
virtual HRESULT IKpUtilities::SHA256Init |
( |
void * |
pContext | ) |
|
|
pure virtual |
Initialize a hash context.
Calling this method is only required if you want to use a hash context multiple times (immediately call it after the IKpUtilities::SHA256Final method). - Parameters
-
◆ ShellOpenLocalFile()
virtual INT IKpUtilities::ShellOpenLocalFile |
( |
LPCTSTR |
lpFile, |
|
|
INT |
nMode |
|
) |
| |
|
pure virtual |
◆ ShowFileDialog()
virtual HRESULT IKpUtilities::ShowFileDialog |
( |
BOOL |
bOpenMode, |
|
|
LPCTSTR |
lpSuffix, |
|
|
LPTSTR |
lpStoreBuf, |
|
|
DWORD |
dwBufLen |
|
) |
| |
|
pure virtual |
◆ StringToUTF8()
virtual BYTE* IKpUtilities::StringToUTF8 |
( |
LPCTSTR |
lpSourceString | ) |
|
|
pure virtual |
Convert a string to UTF-8.
- Returns
- UTF-8 string.
-
The returned string must be deleted using IKpAPI::DeleteArray.
◆ StringToUuid()
virtual HRESULT IKpUtilities::StringToUuid |
( |
LPCTSTR |
lpSource, |
|
|
BYTE * |
pUuid |
|
) |
| |
|
pure virtual |
◆ UnicodeToMultiByte()
virtual char* IKpUtilities::UnicodeToMultiByte |
( |
const WCHAR * |
lpwString | ) |
|
|
pure virtual |
Convert a Unicode to a multi-byte string.
- Returns
- Multi-byte string.
-
The returned string must be deleted using IKpAPI::DeleteArray.
◆ UTF8BytesNeeded()
virtual DWORD IKpUtilities::UTF8BytesNeeded |
( |
LPCTSTR |
lpString | ) |
|
|
pure virtual |
◆ UTF8NumChars()
virtual DWORD IKpUtilities::UTF8NumChars |
( |
const UTF8_BYTE * |
pUTF8String | ) |
|
|
pure virtual |
◆ UTF8ToString()
virtual LPTSTR IKpUtilities::UTF8ToString |
( |
const UTF8_BYTE * |
pUTF8String | ) |
|
|
pure virtual |
Convert a UTF-8 string to a TCHAR string.
- Returns
- TCHAR string.
-
The returned string must be deleted using IKpAPI::DeleteArray.
◆ UuidToString()
virtual HRESULT IKpUtilities::UuidToString |
( |
const BYTE * |
pUuid, |
|
|
LPTSTR |
lpOutBuf |
|
) |
| |
|
pure virtual |
◆ ValidatePath()
virtual BOOL IKpUtilities::ValidatePath |
( |
LPCTSTR |
lpPath, |
|
|
DWORD |
dwOptions |
|
) |
| |
|
pure virtual |
Validate a path string.
- Parameters
-
lpPath | Path string to validate. |
dwOptions | Validation options flags:
- 0 or KPVPF_DEFAULT. The default validation options. Only valid if specified alone.
- KPVPF_MUST_EXIST. The specified file or directory must exist. If it doesn't exist, the return value is FALSE.
- KPVPF_TYPE_DIRECTORY. Only valid if KPVPF_MUST_EXIST is also specified. Checks whether the specified path is a directory or not (will return FALSE if it's a file).
- KPVPF_TYPE_FILE. Only valid if KPVPF_MUST_EXIST is also specified. Checks whether the specified path is a file or not (will return FALSE if it's a directory).
- KPVPF_REGULAR_NAME. Checks whether or not the given path string contains invalid characters like '*', '?', '/' and others.
|
◆ WriteFile()
virtual HRESULT IKpUtilities::WriteFile |
( |
LPCTSTR |
lpFilePath, |
|
|
const BYTE * |
pData, |
|
|
DWORD |
dwDataSize |
|
) |
| |
|
pure virtual |
The documentation for this struct was generated from the following file:
Documentation generated with
Doxygen.
|
|