Skip to content

Commit cabee0a

Browse files
committed
Init
1 parent 9d6f4ac commit cabee0a

14 files changed

+795
-0
lines changed

Crypto Clipper.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.0.31912.275
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Clipper", "Crypto Clipper\Crypto Clipper.vcxproj", "{28BDF50C-5333-4F6C-B0C8-B17B9ABF6257}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|x64 = Release|x64
13+
Release|x86 = Release|x86
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{28BDF50C-5333-4F6C-B0C8-B17B9ABF6257}.Debug|x64.ActiveCfg = Debug|x64
17+
{28BDF50C-5333-4F6C-B0C8-B17B9ABF6257}.Debug|x64.Build.0 = Debug|x64
18+
{28BDF50C-5333-4F6C-B0C8-B17B9ABF6257}.Debug|x86.ActiveCfg = Debug|Win32
19+
{28BDF50C-5333-4F6C-B0C8-B17B9ABF6257}.Debug|x86.Build.0 = Debug|Win32
20+
{28BDF50C-5333-4F6C-B0C8-B17B9ABF6257}.Release|x64.ActiveCfg = Release|x64
21+
{28BDF50C-5333-4F6C-B0C8-B17B9ABF6257}.Release|x64.Build.0 = Release|x64
22+
{28BDF50C-5333-4F6C-B0C8-B17B9ABF6257}.Release|x86.ActiveCfg = Release|Win32
23+
{28BDF50C-5333-4F6C-B0C8-B17B9ABF6257}.Release|x86.Build.0 = Release|Win32
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {3440763E-5CD1-457F-96DB-F9166FD1CA55}
30+
EndGlobalSection
31+
EndGlobal

Crypto Clipper/Crypto Clipper.vcxproj

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<VCProjectVersion>16.0</VCProjectVersion>
23+
<Keyword>Win32Proj</Keyword>
24+
<ProjectGuid>{28bdf50c-5333-4f6c-b0c8-b17b9abf6257}</ProjectGuid>
25+
<RootNamespace>BTCClipper</RootNamespace>
26+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
27+
<ProjectName>Clipper</ProjectName>
28+
</PropertyGroup>
29+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
30+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
31+
<ConfigurationType>Application</ConfigurationType>
32+
<UseDebugLibraries>true</UseDebugLibraries>
33+
<PlatformToolset>v143</PlatformToolset>
34+
<CharacterSet>Unicode</CharacterSet>
35+
</PropertyGroup>
36+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
37+
<ConfigurationType>Application</ConfigurationType>
38+
<UseDebugLibraries>false</UseDebugLibraries>
39+
<PlatformToolset>v143</PlatformToolset>
40+
<WholeProgramOptimization>true</WholeProgramOptimization>
41+
<CharacterSet>Unicode</CharacterSet>
42+
</PropertyGroup>
43+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
44+
<ConfigurationType>Application</ConfigurationType>
45+
<UseDebugLibraries>true</UseDebugLibraries>
46+
<PlatformToolset>v143</PlatformToolset>
47+
<CharacterSet>MultiByte</CharacterSet>
48+
</PropertyGroup>
49+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
50+
<ConfigurationType>Application</ConfigurationType>
51+
<UseDebugLibraries>false</UseDebugLibraries>
52+
<PlatformToolset>v143</PlatformToolset>
53+
<WholeProgramOptimization>true</WholeProgramOptimization>
54+
<CharacterSet>MultiByte</CharacterSet>
55+
</PropertyGroup>
56+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
57+
<ImportGroup Label="ExtensionSettings">
58+
</ImportGroup>
59+
<ImportGroup Label="Shared">
60+
</ImportGroup>
61+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
62+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
63+
</ImportGroup>
64+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
65+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
66+
</ImportGroup>
67+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
68+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
69+
</ImportGroup>
70+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
71+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
72+
</ImportGroup>
73+
<PropertyGroup Label="UserMacros" />
74+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
75+
<LinkIncremental>true</LinkIncremental>
76+
</PropertyGroup>
77+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
78+
<LinkIncremental>false</LinkIncremental>
79+
</PropertyGroup>
80+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
81+
<LinkIncremental>true</LinkIncremental>
82+
</PropertyGroup>
83+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
84+
<LinkIncremental>false</LinkIncremental>
85+
<TargetName>$(TargetName)</TargetName>
86+
</PropertyGroup>
87+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
88+
<ClCompile>
89+
<WarningLevel>Level3</WarningLevel>
90+
<SDLCheck>true</SDLCheck>
91+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
92+
<ConformanceMode>true</ConformanceMode>
93+
</ClCompile>
94+
<Link>
95+
<SubSystem>Console</SubSystem>
96+
<GenerateDebugInformation>true</GenerateDebugInformation>
97+
</Link>
98+
</ItemDefinitionGroup>
99+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
100+
<ClCompile>
101+
<WarningLevel>Level3</WarningLevel>
102+
<FunctionLevelLinking>true</FunctionLevelLinking>
103+
<IntrinsicFunctions>true</IntrinsicFunctions>
104+
<SDLCheck>true</SDLCheck>
105+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
106+
<ConformanceMode>true</ConformanceMode>
107+
</ClCompile>
108+
<Link>
109+
<SubSystem>Console</SubSystem>
110+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
111+
<OptimizeReferences>true</OptimizeReferences>
112+
<GenerateDebugInformation>true</GenerateDebugInformation>
113+
</Link>
114+
</ItemDefinitionGroup>
115+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
116+
<ClCompile>
117+
<WarningLevel>Level3</WarningLevel>
118+
<SDLCheck>true</SDLCheck>
119+
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
120+
<ConformanceMode>true</ConformanceMode>
121+
<LanguageStandard>stdcpp17</LanguageStandard>
122+
</ClCompile>
123+
<Link>
124+
<SubSystem>Console</SubSystem>
125+
<GenerateDebugInformation>true</GenerateDebugInformation>
126+
</Link>
127+
</ItemDefinitionGroup>
128+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
129+
<ClCompile>
130+
<WarningLevel>Level3</WarningLevel>
131+
<FunctionLevelLinking>true</FunctionLevelLinking>
132+
<IntrinsicFunctions>true</IntrinsicFunctions>
133+
<SDLCheck>true</SDLCheck>
134+
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
135+
<ConformanceMode>true</ConformanceMode>
136+
<LanguageStandard>stdcpp17</LanguageStandard>
137+
</ClCompile>
138+
<Link>
139+
<SubSystem>Console</SubSystem>
140+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
141+
<OptimizeReferences>true</OptimizeReferences>
142+
<GenerateDebugInformation>true</GenerateDebugInformation>
143+
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
144+
</Link>
145+
</ItemDefinitionGroup>
146+
<ItemGroup>
147+
<ClCompile Include="main.cpp" />
148+
</ItemGroup>
149+
<ItemGroup>
150+
<ClInclude Include="clipboard.h" />
151+
<ClInclude Include="clipper.h" />
152+
<ClInclude Include="colours.h" />
153+
<ClInclude Include="config.h" />
154+
<ClInclude Include="console.h" />
155+
<ClInclude Include="other.h" />
156+
<ClInclude Include="registry.h" />
157+
<ClInclude Include="xorstr.h" />
158+
</ItemGroup>
159+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
160+
<ImportGroup Label="ExtensionTargets">
161+
</ImportGroup>
162+
</Project>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="includes">
5+
<UniqueIdentifier>{292002a7-59aa-4a1c-9956-4ed2ecbee4b5}</UniqueIdentifier>
6+
</Filter>
7+
<Filter Include="config">
8+
<UniqueIdentifier>{b196c38a-9cd4-4436-9f85-9a10550eb69c}</UniqueIdentifier>
9+
</Filter>
10+
<Filter Include="main">
11+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
12+
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
13+
</Filter>
14+
</ItemGroup>
15+
<ItemGroup>
16+
<ClCompile Include="main.cpp">
17+
<Filter>main</Filter>
18+
</ClCompile>
19+
</ItemGroup>
20+
<ItemGroup>
21+
<ClInclude Include="config.h">
22+
<Filter>config</Filter>
23+
</ClInclude>
24+
<ClInclude Include="xorstr.h">
25+
<Filter>includes</Filter>
26+
</ClInclude>
27+
<ClInclude Include="console.h">
28+
<Filter>includes</Filter>
29+
</ClInclude>
30+
<ClInclude Include="clipper.h">
31+
<Filter>includes</Filter>
32+
</ClInclude>
33+
<ClInclude Include="clipboard.h">
34+
<Filter>includes</Filter>
35+
</ClInclude>
36+
<ClInclude Include="other.h">
37+
<Filter>includes</Filter>
38+
</ClInclude>
39+
<ClInclude Include="registry.h">
40+
<Filter>includes</Filter>
41+
</ClInclude>
42+
<ClInclude Include="colours.h">
43+
<Filter>includes</Filter>
44+
</ClInclude>
45+
</ItemGroup>
46+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup />
4+
</Project>

Crypto Clipper/clipboard.h

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#pragma once
2+
3+
class Clipboard
4+
{
5+
public:
6+
Clipboard()
7+
{
8+
if (!OpenClipboard(nullptr))
9+
return;
10+
}
11+
12+
~Clipboard()
13+
{
14+
CloseClipboard();
15+
}
16+
17+
private:
18+
Clipboard(const Clipboard&);
19+
Clipboard& operator=(const Clipboard&);
20+
};
21+
22+
class TextGlobalLock
23+
{
24+
public:
25+
explicit TextGlobalLock(HANDLE hData)
26+
: m_hData(hData)
27+
{
28+
m_psz = static_cast<const char*>(GlobalLock(m_hData));
29+
if (!m_psz)
30+
return;
31+
}
32+
33+
~TextGlobalLock()
34+
{
35+
GlobalUnlock(m_hData);
36+
}
37+
38+
const char* Get() const
39+
{
40+
return m_psz;
41+
}
42+
43+
private:
44+
HANDLE m_hData;
45+
const char* m_psz;
46+
47+
TextGlobalLock(const TextGlobalLock&);
48+
TextGlobalLock& operator=(const TextGlobalLock&);
49+
};
50+
51+
std::string get_clipboard_text()
52+
{
53+
Clipboard clipboard;
54+
55+
HANDLE hData = GetClipboardData(CF_TEXT);
56+
if (hData == nullptr)
57+
return xorstr("error");
58+
59+
TextGlobalLock textGlobalLock(hData);
60+
std::string text(textGlobalLock.Get());
61+
62+
return text;
63+
}
64+
65+
void set_clipboard_text(const char* text)
66+
{
67+
sleep(100);
68+
69+
int size = ::MultiByteToWideChar(CP_UTF8, 0, text, -1, nullptr, 0);
70+
if (size < 0) {
71+
return;
72+
}
73+
74+
if (::OpenClipboard(NULL)) {
75+
::EmptyClipboard();
76+
HGLOBAL hGlobal = ::GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE | GMEM_DDESHARE, (size + 1) * sizeof(WCHAR));
77+
if (hGlobal != NULL) {
78+
LPWSTR lpszData = (LPWSTR)::GlobalLock(hGlobal);
79+
if (lpszData != nullptr) {
80+
::MultiByteToWideChar(CP_UTF8, 0, text, -1, lpszData, size);
81+
::GlobalUnlock(hGlobal);
82+
::SetClipboardData(CF_UNICODETEXT, hGlobal);
83+
}
84+
}
85+
::CloseClipboard();
86+
}
87+
}

0 commit comments

Comments
 (0)