|
// PasswordStorageShellExt.cpp : Implementation of CPasswordStorageShellExt
#include "stdafx.h"
#include "PwsInfo.h"
#include "PasswordStorageShellExt.h"
#include "../Exile/typedefs.h"
/////////////////////////////////////////////////////////////////////////////
// CPasswordStorageShellExt
// IPersistFile
HRESULT CPasswordStorageShellExt::Load(LPCOLESTR wszFilename, DWORD dwMode)
{
if(m_pszFile)
delete [] m_pszFile;
m_pszFile = new OLECHAR[wcslen(wszFilename) + sizeof(OLECHAR)];
wcscpy(m_pszFile, wszFilename);
return S_OK;
}
// IQueryInfo
HRESULT CPasswordStorageShellExt::GetInfoTip(DWORD dwFlags, LPWSTR *ppwszTip)
{
USES_CONVERSION;
LPMALLOC pMalloc;
STORAGEHEADER sth;
DWORD dwBytes;
//LPWSTR
if(!(m_hStorage = ::CreateFileW(m_pszFile, GENERIC_READ | STANDARD_RIGHTS_READ, FILE_SHARE_READ, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)))
return E_FAIL;
if(FAILED(::SHGetMalloc(&pMalloc)))
return E_FAIL;
// Reading file header
if(!::ReadFile(m_hStorage, &sth, sizeof(STORAGEHEADER), &dwBytes, 0))
{
pMalloc->Release();
return E_FAIL;
}
::CloseHandle(m_hStorage);
// We'll show file version and key size
if(!(*ppwszTip = (LPWSTR)pMalloc->Alloc(513 * sizeof(wchar_t))))
return E_OUTOFMEMORY;
*ppwszTip[0] = '\0';
swprintf(*ppwszTip, A2CW("octalforty Exile Password Storage\nStorage Version: %d.%d\nKey Size: %d bits"),
HIWORD(sth.lVersion), LOWORD(sth.lVersion), sth.nKeySize);
pMalloc->Release();
return S_OK;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here