Build
Docs
Ext
Icons_04_CB
Finals
Finals2
plock-blu.ico
plock-dis.ico
plock.ico
plockb.ico
key-blu.png
key-bw.png
key-grn.ico
key-grn.png
plock-blu.ico
plock-blu.png
plock-bw.png
plock-dis.ico
plock-grn.ico
plock-grn.png
plock.ico
plock.png
plockb.png
plockbw-r.png
plockbw.png
Untitled.ico
key-org.ico
keyhole-grn.ico
lockblue.ico
lockgreen.ico
lockred.ico
lockyellow.ico
plockb.ico
plockb2.ico
plockbw.ico
plockg.ico
plocko.ico
plockr.ico
plocky.ico
Icons_15_VA
KeePass_Round
KeePass_Round_1024.png
KeePass_Round_128.png
KeePass_Round_16.png
KeePass_Round_20.png
KeePass_Round_24.png
KeePass_Round_256.png
KeePass_Round_32.png
KeePass_Round_48.png
KeePass_Round_512.png
KeePass_Round_64.png
KeePass_Round_Keyhole
KeePass_Round_Keyhole_128.png
KeePass_Round_Keyhole_16.png
KeePass_Round_Keyhole_256.png
KeePass_Round_Keyhole_32.png
KeePass_Round_Keyhole_48.png
KeePass_Round_Keyhole_64.png
KeePass_Round_Locked
KeePass_Round_Locked_128.png
KeePass_Round_Locked_16.png
KeePass_Round_Locked_256.png
KeePass_Round_Locked_32.png
KeePass_Round_Locked_48.png
KeePass_Round_Locked_64.png
KeePass_Square_Blue
KeePass_Square_Blue_128.png
KeePass_Square_Blue_16.png
KeePass_Square_Blue_24.png
KeePass_Square_Blue_256.png
KeePass_Square_Blue_32.png
KeePass_Square_Blue_48.png
KeePass_Square_Blue_64.png
KeePass_Square_Blue_Locked
KeePass_Square_Blue_Locked_128.png
KeePass_Square_Blue_Locked_16.png
KeePass_Square_Blue_Locked_24.png
KeePass_Square_Blue_Locked_256.png
KeePass_Square_Blue_Locked_32.png
KeePass_Square_Blue_Locked_48.png
KeePass_Square_Blue_Locked_64.png
KeePass_Square_Yellow
KeePass_Square_Yellow_128.png
KeePass_Square_Yellow_16.png
KeePass_Square_Yellow_256.png
KeePass_Square_Yellow_32.png
KeePass_Square_Yellow_48.png
KeePass_Square_Yellow_64.png
Icons_Nuvola
KeePassMsi
KeePassMsi.vdproj
RegKDB.reg
RegUnRegKDB.reg
KeePassLibC
KeePassLibCpp
Crypto
SHA2
DataExchange
Details
IO
PasswordGenerator
SDK
Details
SysSpec_Windows
Util
KeePassAPI
KeePassLib.def
KeePassLib.vcproj
res
WinGUI
NewGUI
TaskbarListEx
TaskDialog
VistaMenu
Plugins
PwSafe.vcproj
res
autotype.bmp
cancel.bmp
clienticex.bmp
clock.bmp
disk.bmp
document.bmp
entry_ed.ico
file.bmp
help_sma.bmp
help_smp.bmp
iconpic.ico
infoicon.bmp
infoiconex.bmp
KeePass.png
key.ico
keyhole.ico
key_smal.bmp
language.bmp
locked.ico
lock_ovr.ico
MostPopularPasswords.bin
mouse_sm.bmp
ok.bmp
optionicex.bmp
options.ico
plugins.ico
PwSafe.ico
randomke.bmp
random_b.bmp
search.ico
tb_about.bmp
tb_adden.bmp
tb_copyp.bmp
tb_copyu.bmp
tb_defau.bmp
tb_delet.bmp
tb_edite.bmp
tb_find.bmp
tb_lock.bmp
tb_new.bmp
tb_open.bmp
tb_save.bmp
tb_save1.bmp
tb_saved.bmp
toolssma.bmp
unlocked.ico
winprops.bmp
world.ico
Util
CmdLine
SprEngine
KeePass.chm
KeePass.exe
Languages
Plugins
|
/*
KeePass Password Safe - The Open-Source Password Manager
Copyright (C) 2003-2019 Dominik Reichl <dominik.reichl@t-online.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "StdAfx.h"
#include "SprEncoding.h"
#include "../../../KeePassLibCpp/Util/StrUtil.h"
CString SprTagSimString(LPCTSTR lpString);
CString SprEncodeHighAnsi(LPCTSTR lpText);
CString SprMakeAutoTypeSequence(LPCTSTR lpText)
{
ASSERT(lpText != NULL); if(lpText == NULL) return CString();
CString strText = lpText; // Local copy, lpText may mutate
CString strEscaped = SprTagSimString(strText);
CString strEncHA = SprEncodeHighAnsi(strEscaped);
return strEncHA;
}
CString SprTagSimString(LPCTSTR lpString)
{
CStringBuilderEx sb;
ASSERT(lpString != NULL); if(lpString == NULL) return CString();
DWORD i = 0;
while(lpString[i] != 0)
{
const TCHAR tch = lpString[i];
switch(tch)
{
case _T('+'): sb += _T("{PLUS}"); break;
case _T('@'): sb += _T("{AT}"); break;
// case _T('~'): sb += _T("{TILDE}"); break;
case _T('~'): sb += _T("%({NUMPAD0}{NUMPAD1}{NUMPAD2}{NUMPAD6})"); break;
case _T('^'): sb += _T("%({NUMPAD0}{NUMPAD9}{NUMPAD4})"); break;
case _T('\''): sb += _T("%({NUMPAD0}{NUMPAD3}{NUMPAD9})"); break;
case _T('"'): sb += _T("%({NUMPAD0}{NUMPAD3}{NUMPAD4})"); break;
case _T('�'): sb += _T("%({NUMPAD0}{NUMPAD1}{NUMPAD8}{NUMPAD0})"); break;
case _T('`'): sb += _T("%({NUMPAD0}{NUMPAD9}{NUMPAD6})"); break;
case _T('%'): sb += _T("{PERCENT}"); break;
case _T('{'): sb += _T("{LEFTBRACE}"); break;
case _T('}'): sb += _T("{RIGHTBRACE}"); break;
case _T('('): sb += _T("{LEFTPAREN}"); break;
case _T(')'): sb += _T("{RIGHTPAREN}"); break;
default: sb += tch; break;
}
++i;
}
return CString(sb.ToString().c_str());
}
CString SprEncodeHighAnsi(LPCTSTR lpText)
{
CStringBuilderEx sb;
DWORD dwPos = 0;
while(lpText[dwPos] != 0)
{
const TCHAR tch = lpText[dwPos];
const unsigned char uch = static_cast<unsigned char>(tch);
if(uch >= 0x7F)
{
sb += _T("%({NUMPAD0}");
CString strConv;
strConv.Format(_T("%u"), uch);
ASSERT(strConv.GetLength() == 3);
for(int i = 0; i < strConv.GetLength(); ++i)
{
sb += _T("{NUMPAD");
sb += strConv.GetAt(i);
sb += _T("}");
}
sb += _T(")");
}
else sb += tch;
++dwPos;
}
return CString(sb.ToString().c_str());
}
CString SprMakeCmdQuotes(LPCTSTR lpText)
{
ASSERT(lpText != NULL); if(lpText == NULL) return CString();
CString str = lpText;
// See SHELLEXECUTEINFO structure documentation
str.Replace(_T("\""), _T("\"\"\""));
return str;
}
|
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.
Dominik started programming in Omikron Basic, a programming language for the good old Atari ST. After this, there was some short period of QBasic programming on the PC, but soon he began learning C++, which is his favorite language up to now.
Today, his programming experience includes C / C++ / [Visual] C++ [MFC], C#/.NET, Java, JavaScript, PHP and HTML and the basics of pure assembler.
He is interested in almost everything that has to do with computing; his special interests are security, cryptography and data compression.
You can find his latest freeware, open source projects and articles on his website:
https://www.dominik-reichl.de/.