Skip to content

Commit 2f3c8f6

Browse files
committed
First reasonably working push
Note: if you try to use this, Configurator can do most of the work, but it doesn't grant permissions for the WinLogon registry keys. These keys need to be modified for proper functioning of the system. Installer ideally to come later.
1 parent 969829b commit 2f3c8f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3650
-65
lines changed

.gitignore

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,135 @@
3636
/BSCP/RegProvider/Debug
3737
/BSCP/Configurator/bin/Debug
3838
/BSCP/Configurator/obj/Debug
39+
/BSCP/Configurator/bin/Release/Configurator.vshost.exe.manifest
40+
/BSCP/Configurator/bin/Release/Configurator.vshost.exe.config
41+
/BSCP/Configurator/bin/Release/Configurator.pdb
42+
/BSCP/Configurator/bin/Release/Configurator.exe.config
43+
/BSCP/ConfigurableShell/x64/Release/vc140.pdb
44+
/BSCP/ConfigurableShell/x64/Release/ConfigurableShell.vcxprojResolveAssemblyReference.cache
45+
/BSCP/ConfigurableShell/x64/Release/ConfigurableShell.res
46+
/BSCP/ConfigurableShell/x64/Release/ConfigurableShell.log
47+
/BSCP/ConfigurableShell/x64/Release/ConfigurableShell.Build.CppClean.log
48+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/rc.write.1.tlog
49+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/rc.read.1.tlog
50+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/rc.command.1.tlog
51+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/link.write.1.tlog
52+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/link.read.1.tlog
53+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/link.command.1.tlog
54+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/ConfigurableShell.lastbuildstate
55+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/CL.write.1.tlog
56+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/CL.read.1.tlog
57+
/BSCP/ConfigurableShell/x64/Release/Configur.B8642BA3.tlog/CL.command.1.tlog
58+
/BSCP/ConfigurableShell/x64/Debug/vc140.pdb
59+
/BSCP/ConfigurableShell/x64/Debug/vc140.idb
60+
/BSCP/ConfigurableShell/x64/Debug/ConfigurableShell.res
61+
/BSCP/ConfigurableShell/x64/Debug/ConfigurableShell.log
62+
/BSCP/ConfigurableShell/x64/Debug/ConfigurableShell.Build.CppClean.log
63+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/rc.write.1.tlog
64+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/rc.read.1.tlog
65+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/rc.command.1.tlog
66+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/link.write.1.tlog
67+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/link.read.1.tlog
68+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/link.command.1.tlog
69+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/ConfigurableShell.lastbuildstate
70+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/CL.write.1.tlog
71+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/CL.read.1.tlog
72+
/BSCP/ConfigurableShell/x64/Debug/Configur.B8642BA3.tlog/CL.command.1.tlog
73+
/BSCP/BSCP/x64/Release/vc140.pdb
74+
/BSCP/BSCP/x64/Release/TestApp.tlog/TestApp.lastbuildstate
75+
/BSCP/BSCP/x64/Release/TestApp.tlog/link.write.1.tlog
76+
/BSCP/BSCP/x64/Release/TestApp.tlog/link.read.1.tlog
77+
/BSCP/BSCP/x64/Release/TestApp.tlog/link.command.1.tlog
78+
/BSCP/BSCP/x64/Release/TestApp.tlog/CL.write.1.tlog
79+
/BSCP/BSCP/x64/Release/TestApp.tlog/CL.read.1.tlog
80+
/BSCP/BSCP/x64/Release/TestApp.tlog/CL.command.1.tlog
81+
/BSCP/BSCP/x64/Release/TestApp.Build.CppClean.log
82+
/BSCP/BSCP/x64/Release/BSCP.vcxprojResolveAssemblyReference.cache
83+
/BSCP/BSCP/x64/Release/BSCP.log
84+
/BSCP/Configurator/obj/Release/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
85+
/BSCP/Configurator/obj/Release/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
86+
/BSCP/Configurator/obj/Release/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
87+
/BSCP/Configurator/obj/Release/MainWindow.g.i.cs
88+
/BSCP/Configurator/obj/Release/MainWindow.g.cs
89+
/BSCP/Configurator/obj/Release/MainWindow.baml
90+
/BSCP/Configurator/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
91+
/BSCP/Configurator/obj/Release/DesignTimeResolveAssemblyReferences.cache
92+
/BSCP/Configurator/obj/Release/Configurator_MarkupCompile.lref
93+
/BSCP/Configurator/obj/Release/Configurator_MarkupCompile.i.cache
94+
/BSCP/Configurator/obj/Release/Configurator_MarkupCompile.cache
95+
/BSCP/Configurator/obj/Release/Configurator_Content.g.i.cs
96+
/BSCP/Configurator/obj/Release/Configurator.Properties.Resources.resources
97+
/BSCP/Configurator/obj/Release/Configurator.pdb
98+
/BSCP/Configurator/obj/Release/Configurator.g.resources
99+
/BSCP/Configurator/obj/Release/Configurator.csproj.GenerateResource.Cache
100+
/BSCP/Configurator/obj/Release/Configurator.csproj.FileListAbsolute.txt
101+
/BSCP/Configurator/obj/Release/App.g.i.cs
102+
/BSCP/Configurator/obj/Release/App.g.cs
103+
/BSCP/RegProvider/x64/Release/vc140.pdb
104+
/BSCP/RegProvider/x64/Release/RegProvider.tlog/RegProvider.write.1u.tlog
105+
/BSCP/RegProvider/x64/Release/RegProvider.tlog/RegProvider.lastbuildstate
106+
/BSCP/RegProvider/x64/Release/RegProvider.tlog/link.write.1.tlog
107+
/BSCP/RegProvider/x64/Release/RegProvider.tlog/link.read.1.tlog
108+
/BSCP/RegProvider/x64/Release/RegProvider.tlog/link.command.1.tlog
109+
/BSCP/RegProvider/x64/Release/RegProvider.tlog/CL.write.1.tlog
110+
/BSCP/RegProvider/x64/Release/RegProvider.tlog/CL.read.1.tlog
111+
/BSCP/RegProvider/x64/Release/RegProvider.tlog/CL.command.1.tlog
112+
/BSCP/RegProvider/x64/Release/RegProvider.log
113+
/BSCP/RegProvider/x64/Release/RegProvider.Build.CppClean.log
114+
/BSCP/CredentialProvider/x64/Release/vc140.pdb
115+
/BSCP/CredentialProvider/x64/Release/SampleV2CredentialProvider.log
116+
/BSCP/CredentialProvider/x64/Release/resources.res
117+
/BSCP/CredentialProvider/x64/Release/BootShellCredentialProvider.Build.CppClean.log
118+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/rc.write.1.tlog
119+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/rc.read.1.tlog
120+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/rc.command.1.tlog
121+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/link.write.1.tlog
122+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/link.read.1.tlog
123+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/link.command.1.tlog
124+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/CL.write.1.tlog
125+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/CL.read.1.tlog
126+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/CL.command.1.tlog
127+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/BootShellCredentialProvider.write.1u.tlog
128+
/BSCP/CredentialProvider/x64/Release/BootShel.98E74D71.tlog/BootShellCredentialProvider.lastbuildstate
129+
/BSCP/CredentialProvider/x64/Debug/vc140.pdb
130+
/BSCP/CredentialProvider/x64/Debug/vc140.idb
131+
/BSCP/CredentialProvider/x64/Debug/SampleV2CredentialProvider.log
132+
/BSCP/CredentialProvider/x64/Debug/resources.res
133+
/BSCP/CredentialProvider/x64/Debug/BootShellCredentialProvider.Build.CppClean.log
134+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/rc.write.1.tlog
135+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/rc.read.1.tlog
136+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/rc.command.1.tlog
137+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/link.write.1.tlog
138+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/link.read.1.tlog
139+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/link.command.1.tlog
140+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/CL.write.1.tlog
141+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/CL.read.1.tlog
142+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/CL.command.1.tlog
143+
/BSCP/CredentialProvider/x64/Debug/BootShel.98E74D71.tlog/BootShellCredentialProvider.lastbuildstate
144+
/BSCP/CredentialProvider/Release/vc140.pdb
145+
/BSCP/CredentialProvider/Release/SampleV2CredentialProvider.log
146+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/SampleV2CredentialProvider.write.1u.tlog
147+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/SampleV2CredentialProvider.lastbuildstate
148+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/rc.write.1.tlog
149+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/rc.read.1.tlog
150+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/rc.command.1.tlog
151+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/link.write.1.tlog
152+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/link.read.1.tlog
153+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/link.command.1.tlog
154+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/CL.write.1.tlog
155+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/CL.read.1.tlog
156+
/BSCP/CredentialProvider/Release/SampleV2.98E74D71.tlog/CL.command.1.tlog
157+
/BSCP/x64/Release/TestApp.pdb
158+
/BSCP/x64/Release/TestApp.ipdb
159+
/BSCP/x64/Release/TestApp.iobj
160+
/BSCP/x64/Release/RegProvider.pdb
161+
/BSCP/x64/Release/RegProvider.ipdb
162+
/BSCP/x64/Release/RegProvider.iobj
163+
/BSCP/x64/Release/RegProvider.exp
164+
/BSCP/x64/Release/ConfigurableShell.pdb
165+
/BSCP/x64/Release/ConfigurableShell.ipdb
166+
/BSCP/x64/Release/ConfigurableShell.iobj
167+
/BSCP/x64/Release/BootShellCredentialProvider.pdb
168+
/BSCP/x64/Release/BootShellCredentialProvider.ipdb
169+
/BSCP/x64/Release/BootShellCredentialProvider.iobj
170+
/BSCP/x64/Release/BootShellCredentialProvider.exp

BSCP/.vs/BSCP/v14/.suo

80 KB
Binary file not shown.

BSCP/BSCP.sln

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RegProvider", "RegProvider\
99
EndProject
1010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Configurator", "Configurator\Configurator.csproj", "{F3A59C01-A7A7-45E6-914A-8206C8DA02F9}"
1111
EndProject
12+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleV2CredentialProvider", "CredentialProvider\SampleV2CredentialProvider.vcxproj", "{98E74D71-5237-41FA-8D36-206C0D110626}"
13+
EndProject
14+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConfigurableShell", "ConfigurableShell\ConfigurableShell.vcxproj", "{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}"
15+
EndProject
1216
Global
1317
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1418
Debug|Any CPU = Debug|Any CPU
@@ -43,6 +47,7 @@ Global
4347
{93A778E9-8F70-42C7-BF58-D08B5C6D348F}.Release|ARM.ActiveCfg = Release|Win32
4448
{93A778E9-8F70-42C7-BF58-D08B5C6D348F}.Release|x64.ActiveCfg = Release|x64
4549
{93A778E9-8F70-42C7-BF58-D08B5C6D348F}.Release|x64.Build.0 = Release|x64
50+
{93A778E9-8F70-42C7-BF58-D08B5C6D348F}.Release|x64.Deploy.0 = Release|x64
4651
{93A778E9-8F70-42C7-BF58-D08B5C6D348F}.Release|x86.ActiveCfg = Release|Win32
4752
{93A778E9-8F70-42C7-BF58-D08B5C6D348F}.Release|x86.Build.0 = Release|Win32
4853
{F3A59C01-A7A7-45E6-914A-8206C8DA02F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -61,6 +66,31 @@ Global
6166
{F3A59C01-A7A7-45E6-914A-8206C8DA02F9}.Release|x64.Build.0 = Release|Any CPU
6267
{F3A59C01-A7A7-45E6-914A-8206C8DA02F9}.Release|x86.ActiveCfg = Release|Any CPU
6368
{F3A59C01-A7A7-45E6-914A-8206C8DA02F9}.Release|x86.Build.0 = Release|Any CPU
69+
{98E74D71-5237-41FA-8D36-206C0D110626}.Debug|Any CPU.ActiveCfg = Debug|Win32
70+
{98E74D71-5237-41FA-8D36-206C0D110626}.Debug|ARM.ActiveCfg = Debug|Win32
71+
{98E74D71-5237-41FA-8D36-206C0D110626}.Debug|x64.ActiveCfg = Debug|x64
72+
{98E74D71-5237-41FA-8D36-206C0D110626}.Debug|x64.Build.0 = Debug|x64
73+
{98E74D71-5237-41FA-8D36-206C0D110626}.Debug|x86.ActiveCfg = Debug|Win32
74+
{98E74D71-5237-41FA-8D36-206C0D110626}.Debug|x86.Build.0 = Debug|Win32
75+
{98E74D71-5237-41FA-8D36-206C0D110626}.Release|Any CPU.ActiveCfg = Release|Win32
76+
{98E74D71-5237-41FA-8D36-206C0D110626}.Release|ARM.ActiveCfg = Release|Win32
77+
{98E74D71-5237-41FA-8D36-206C0D110626}.Release|x64.ActiveCfg = Release|x64
78+
{98E74D71-5237-41FA-8D36-206C0D110626}.Release|x64.Build.0 = Release|x64
79+
{98E74D71-5237-41FA-8D36-206C0D110626}.Release|x64.Deploy.0 = Release|x64
80+
{98E74D71-5237-41FA-8D36-206C0D110626}.Release|x86.ActiveCfg = Release|Win32
81+
{98E74D71-5237-41FA-8D36-206C0D110626}.Release|x86.Build.0 = Release|Win32
82+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Debug|Any CPU.ActiveCfg = Debug|Win32
83+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Debug|ARM.ActiveCfg = Debug|Win32
84+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Debug|x64.ActiveCfg = Debug|x64
85+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Debug|x64.Build.0 = Debug|x64
86+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Debug|x86.ActiveCfg = Debug|Win32
87+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Debug|x86.Build.0 = Debug|Win32
88+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Release|Any CPU.ActiveCfg = Release|Win32
89+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Release|ARM.ActiveCfg = Release|Win32
90+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Release|x64.ActiveCfg = Release|x64
91+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Release|x64.Build.0 = Release|x64
92+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Release|x86.ActiveCfg = Release|Win32
93+
{B8642BA3-D582-4F2B-9CB5-5CD5C089D76F}.Release|x86.Build.0 = Release|Win32
6494
EndGlobalSection
6595
GlobalSection(SolutionProperties) = preSolution
6696
HideSolutionNode = FALSE

BSCP/BSCP/BSCP.cpp

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
// BSCP.cpp : Defines the entry point for the console application.
2+
//
3+
4+
#include "stdafx.h"
5+
#include <iostream>
6+
#include <string>
7+
#include "Strsafe.h"
8+
#include "Shellapi.h"
9+
#include "../../BSCP/RegProvider/RegProvider.h"
10+
11+
12+
int main()
13+
{
14+
/*
15+
CONSOLE_READCONSOLE_CONTROL tControl;
16+
tControl.nInitialChars = 0;
17+
tControl.dwCtrlWakeupMask = L'\n';
18+
WCHAR* first_message = TEXT("Enter reg key to open \r\n");
19+
WCHAR* second_message = TEXT("Enter value to open \r\n");
20+
HANDLE hwnd_console_out = GetStdHandle(STD_OUTPUT_HANDLE);
21+
HANDLE hwnd_console_in = GetStdHandle(STD_INPUT_HANDLE);
22+
WCHAR key_name[100]; //reg key in HKLM to read
23+
WCHAR prop_name[100]; //reg key property to read
24+
DWORD len_key = 100;
25+
DWORD len_prop = 100;
26+
DWORD len_output = 0;
27+
//WCHAR* output;
28+
*/
29+
CRegProvider prov = CRegProvider();
30+
int index = 0;
31+
while (true) {
32+
//get values
33+
/*WriteConsole(hwnd_console_out, first_message, _tcslen(first_message), NULL, NULL);
34+
ReadConsole(hwnd_console_in, &key_name, len_key, &len_key, &tControl);
35+
WCHAR* key_rightsized = new WCHAR[len_key + 1];
36+
StringCchCopy(key_rightsized, len_key -1, key_name);
37+
38+
WriteConsole(hwnd_console_out, second_message, _tcslen(second_message), NULL, NULL);
39+
ReadConsole(hwnd_console_in, &prop_name, len_key, &len_prop, &tControl);
40+
WCHAR* prop_rightsized = new WCHAR[len_prop - 1];
41+
StringCchCopy(prop_rightsized, len_prop - 1, prop_name);
42+
43+
//print entered values
44+
WriteConsole(hwnd_console_out, key_name, len_key, NULL, NULL);
45+
WriteConsole(hwnd_console_out, prop_name, len_prop, NULL, NULL);
46+
47+
prov.GetSizeAt_sz(key_rightsized, prop_rightsized, &len_output);
48+
output = new WCHAR[len_output/2];
49+
prov.GetValueAt_sz(key_rightsized, prop_rightsized, output, &len_output);
50+
*/
51+
/*
52+
CRegProvider prov = CRegProvider();
53+
WCHAR* prop_value = TEXT("Windows Explorer");
54+
WCHAR* prop_value_2 = TEXT("/C explorer.exe");
55+
WCHAR* prop_name_1 = TEXT("command");
56+
WCHAR* key_name = TEXT("SOFTWARE\\Castle\\BootShellCredentialProvider\\Shells\\Default");
57+
DWORD prop_val_length = (_tcslen(prop_value) + 1) *2; //extra bytes for terminating char
58+
DWORD prop_val_length_2 = (_tcslen(prop_value) + 1) * 2;
59+
//LONG res = prov.EnsureKeyValueSet_sz(key_name, TEXT("name"), prop_value, &prop_val_length);
60+
LONG res2 = prov.EnsureKeyValueSet_sz(key_name, TEXT("command"), prop_value_2, &prop_val_length_2);
61+
DWORD length = 0;
62+
prov.GetSizeAt_sz(key_name, prop_name_1, &length);
63+
WCHAR* output = new WCHAR[length / 2];
64+
prov.GetValueAt_sz(key_name, prop_name_1, output, &length);
65+
WriteConsole(hwnd_console_out, output, length/2, NULL, NULL);
66+
ShellExecute(NULL, TEXT("Open"), TEXT("cmd.exe"), output, NULL, SW_HIDE);
67+
system("pause");
68+
delete output;
69+
//delete prop_rightsized;
70+
//delete key_rightsized;
71+
*/
72+
/*WCHAR* key_name = TEXT("SOFTWARE\\Castle\\BootShellCredentialProvider\\Shells");
73+
DWORD count_subkeys = 0;
74+
DWORD max_length = 0;
75+
prov.CountSubkeys(key_name, &count_subkeys, &max_length);
76+
77+
int index = 0;
78+
while (index < count_subkeys) {
79+
WCHAR* subkey_name = new WCHAR[max_length];
80+
DWORD length_subkey = max_length * 2; //need bytes
81+
LONG r_result = prov.GetSubKey(key_name, index, subkey_name, &length_subkey);
82+
WCHAR* final_answer = new WCHAR[length_subkey + 1];
83+
StringCchCopy(final_answer, length_subkey + 1, subkey_name);
84+
WriteConsole(hwnd_console_out, final_answer, length_subkey + 1, NULL, NULL);
85+
index++;
86+
}*/
87+
/*DWORD dwSelectedItem = 0;
88+
HRESULT hr;
89+
//load up correct subkey
90+
DWORD max_length = 150;
91+
WCHAR* subkey_name = new WCHAR[max_length];
92+
DWORD length_subkey = max_length; //need bytes
93+
LONG r_result = prov.GetSubKey(TEXT("SOFTWARE\\Castle\\BootShellCredentialProvider\\Shells"), dwSelectedItem, subkey_name, &length_subkey);
94+
//get command for selected option
95+
WCHAR* command_base = TEXT("SOFTWARE\\Castle\\BootShellCredentialProvider\\Shells\\");
96+
DWORD command_length = _tcslen(command_base) + length_subkey + 2;
97+
WCHAR* command_key = new WCHAR[command_length];
98+
StringCchCopy(command_key, _tcslen(command_base) + 2, command_base);
99+
WCHAR* command_pre = new WCHAR[600];
100+
StringCchCat(command_key, command_length, subkey_name);
101+
LONG res = prov.GetValueAt_sz(command_key, TEXT("command"), command_pre, &command_length); //get length
102+
103+
WCHAR* control_key_name = TEXT("SOFTWARE\\Castle\\BootShellCredentialProvider\\Shell");
104+
res = prov.EnsureKeyValueSet_sz(control_key_name, TEXT("name"), subkey_name, &length_subkey);
105+
res += prov.EnsureKeyValueSet_sz(control_key_name, TEXT("command"), command_pre, &command_length);
106+
107+
delete subkey_name;
108+
delete command_pre;
109+
delete command_key;*/
110+
PWSTR s_RegistryKey_Shells = L"SOFTWARE\\Castle\\BootShellCredentialProvider\\Shells";
111+
PWSTR s_RegistryKey_Shells_s = L"SOFTWARE\\Castle\\BootShellCredentialProvider\\Shells\\";
112+
PWSTR s_RegistryKey_Shell = L"SOFTWARE\\Castle\\BootShellCredentialProvider\\Shell";
113+
DWORD _dwComboIndex = index;
114+
//get subkey for selected option
115+
DWORD ccSubkeyLength = 0;
116+
DWORD cbSubkeyLength = 0;
117+
WCHAR* subkey_name = prov.pwszGetSubKey(s_RegistryKey_Shells, _dwComboIndex, &cbSubkeyLength, &ccSubkeyLength);
118+
//get command subkey for selected option
119+
DWORD command_length = wcslen(s_RegistryKey_Shells) + ccSubkeyLength + 2;
120+
WCHAR* command_key = new WCHAR[command_length];
121+
StringCchCopy(command_key, wcslen(s_RegistryKey_Shells_s) + 2, s_RegistryKey_Shells_s);
122+
StringCchCat(command_key, command_length, subkey_name);
123+
//get command for selected option
124+
DWORD ccCommLength = 0;
125+
DWORD cbCommLength = 0;
126+
WCHAR* command_pre = prov.pwszGetValueAt_sz(command_key, TEXT("command"), &cbCommLength, &ccCommLength);
127+
//get console for selected option
128+
DWORD ccConsoleLength = 0;
129+
DWORD cbConsoleLength = 0;
130+
WCHAR* console_name = prov.pwszGetValueAt_sz(command_key, TEXT("console"), &cbConsoleLength, &ccConsoleLength);
131+
//get xming for selected option
132+
DWORD ccXmingLength = 0;
133+
DWORD cbXmingLength = 0;
134+
WCHAR* xming_value = prov.pwszGetValueAt_sz(command_key, TEXT("xming"), &cbXmingLength, &ccXmingLength);
135+
//set values
136+
prov.EnsureKeyValueSet_sz(s_RegistryKey_Shell, TEXT("name"), subkey_name, &cbSubkeyLength);
137+
prov.EnsureKeyValueSet_sz(s_RegistryKey_Shell, TEXT("command"), command_pre, &cbCommLength);
138+
prov.EnsureKeyValueSet_sz(s_RegistryKey_Shell, TEXT("console"), console_name, &cbConsoleLength);
139+
prov.EnsureKeyValueSet_sz(s_RegistryKey_Shell, TEXT("xming"), xming_value, &cbXmingLength);
140+
//ShellExecute(NULL, TEXT("Open"), TEXT("bash.exe"), TEXT("/K \"bash.exe\" "), NULL, SW_SHOW);
141+
//system("pause");
142+
index += 1;
143+
}
144+
return 0;
145+
}
146+

0 commit comments

Comments
 (0)