Compare commits
258 Commits
1.0-alpha0
...
1.0-alpha7
Author | SHA1 | Date | |
---|---|---|---|
8beb7bd27a | |||
00dd1277c5 | |||
e9839706b6 | |||
f5b03bc0bf | |||
c953fb8db4 | |||
db27355e46 | |||
85d7c3d4ec | |||
d68fd6ce08 | |||
82e910fea4 | |||
7fa3289e3d | |||
de802b7a28 | |||
67fe27f6fd | |||
c8cfe4da42 | |||
3267b7f53d | |||
7b3ecda484 | |||
d8ccf7cbc0 | |||
4dc7083028 | |||
e34d2ba275 | |||
3d6849a523 | |||
217c3dd090 | |||
e807336e7b | |||
95426cde7c | |||
92c62c53d7 | |||
99aa53726d | |||
95e2f7e01b | |||
735d669887 | |||
a8db309a76 | |||
7b94f01aa7 | |||
12beee54ad | |||
956ef9bd4e | |||
f9c5f608d0 | |||
4982fc1a9a | |||
e7e8a88f32 | |||
9a2663eb18 | |||
940def31e6 | |||
47653492a2 | |||
d1925a0704 | |||
a90a7722c7 | |||
ae37c9aa6c | |||
cbda758178 | |||
04444eb99d | |||
b7b45ea64c | |||
4528f2d1fc | |||
eb918f3141 | |||
c749753c68 | |||
9f92a73aa1 | |||
6d54d45512 | |||
9498e8c9a9 | |||
f9c6bce0f8 | |||
3d54c84430 | |||
1306c958fc | |||
09924ea3d2 | |||
537d0c0cbc | |||
6408dbe237 | |||
534f6f6d7d | |||
f7fdfb8dda | |||
c7a41d891a | |||
a8c306953a | |||
77fe6b1bed | |||
659629ed93 | |||
6b4f597f27 | |||
fb0fa0de31 | |||
e92f47677d | |||
ba5bf1e533 | |||
1bf51fda25 | |||
b71e30f642 | |||
788c8cdb16 | |||
ce9e636840 | |||
8f4c177d49 | |||
bf4b7f9787 | |||
be3c591955 | |||
d199cb68bb | |||
e649a86b1f | |||
a0efb6742d | |||
b39cc927d2 | |||
faadb712fc | |||
97d0f75f8d | |||
4114863a94 | |||
afe5450b95 | |||
ac606b7a2e | |||
2aa4bce8cc | |||
b0323d894a | |||
42459ff16a | |||
2711425677 | |||
54bb2050fa | |||
437f5f91b8 | |||
91dcc0bbbc | |||
a60458cdab | |||
4fc029138c | |||
f4be571499 | |||
460adb9858 | |||
a9ecde86d9 | |||
7e7c657358 | |||
f2aa43913d | |||
a102b43a19 | |||
22a87bf90d | |||
caf0352833 | |||
f68a65f8f8 | |||
3e82b7df49 | |||
cb24fbd6a3 | |||
b32b63631a | |||
5fe06deb97 | |||
cadf7272df | |||
2868fd3848 | |||
9fed6dcf9d | |||
a81ddde411 | |||
aafd012809 | |||
3e60bebe3a | |||
6ae8029a47 | |||
ac88d55fe4 | |||
955d7f5dc1 | |||
b4667cac18 | |||
98f20668c3 | |||
df773b649c | |||
6d8bd3f1c1 | |||
fa84cf93b9 | |||
f459a036da | |||
cc43b44d91 | |||
35034789d2 | |||
4834c9e4da | |||
ee8410bdb9 | |||
d69e8b3f6a | |||
4ab60271b7 | |||
1b9f33a6fc | |||
627b20aabc | |||
51428d290f | |||
2f4425f38c | |||
b26ab72e6e | |||
9376404164 | |||
a7d75ea72d | |||
780b738842 | |||
e87c0af221 | |||
180d9b265c | |||
ce0bbc5b45 | |||
3e82e988d4 | |||
418e591aa6 | |||
b7ea2f7a72 | |||
07b4ce988b | |||
427e2fb892 | |||
db69c23689 | |||
43751ed908 | |||
2a19b4624a | |||
434e042f8b | |||
512f46f014 | |||
a92cafea36 | |||
4f6943044f | |||
504ea681a9 | |||
54fc2dd830 | |||
a0303f0a1f | |||
40c992e1a5 | |||
4630b32f77 | |||
4acabbca4e | |||
2f28b89ab2 | |||
9257391938 | |||
4e407b7dad | |||
faea2f3771 | |||
0ee9bade32 | |||
34f16478e4 | |||
00244e3846 | |||
6822a91f41 | |||
06adf7ddae | |||
8eb1936adf | |||
c8de331d50 | |||
560aa3068d | |||
d792520f51 | |||
9f4c4514cb | |||
de94d27380 | |||
ded87eb18c | |||
0639169d9a | |||
fa141fc525 | |||
1fc77fc63d | |||
d15b7066cd | |||
922d0ac3d0 | |||
f3cb90d1c3 | |||
a7e0e5ebd8 | |||
3238881af8 | |||
9d0d3418b0 | |||
81a268df1b | |||
d1a4487503 | |||
24008000a9 | |||
bdd3fc616c | |||
e31fc08a64 | |||
a2ca2fd850 | |||
e98856f934 | |||
b634956901 | |||
0c8492ccd1 | |||
768e0a5a36 | |||
ac23d5f04f | |||
e52b9a636f | |||
2f0948b4fd | |||
33a72acac7 | |||
d430b63829 | |||
cda81dd696 | |||
6e15d3535d | |||
ec0b283540 | |||
03358170f4 | |||
a9fdd1d71d | |||
ef9fa750a0 | |||
fed1e6052a | |||
2f0252a33f | |||
11c28326aa | |||
df2fee4cef | |||
9cf80108b5 | |||
e0460fa15b | |||
8bff2d3060 | |||
822852c8b4 | |||
155671a4da | |||
f675083891 | |||
cf7ca9c8e9 | |||
218aa187f6 | |||
f71c4e8356 | |||
4e16111614 | |||
04b8960f33 | |||
eadcc5eadd | |||
6800de3df7 | |||
98273c6bdc | |||
7ac86e1954 | |||
c79d3e74cf | |||
6b541ce1ff | |||
120da591b4 | |||
a406bc5b89 | |||
1a495051bb | |||
6631e1c798 | |||
2e57879994 | |||
3a2cbe1e40 | |||
697a4a377b | |||
318e6f7c5a | |||
1b54307b38 | |||
091dd43bfc | |||
3ba6074745 | |||
30689b10d2 | |||
c371187edc | |||
ec6291f6ac | |||
6c935d53c3 | |||
1eab05075e | |||
993f280624 | |||
54a041aac0 | |||
9df4d5e9b9 | |||
5e37bd0735 | |||
ce4c208468 | |||
7dbe76d4f4 | |||
3d69a343c7 | |||
da84dea727 | |||
9208e75fe6 | |||
5be9806e2e | |||
86cd27a73b | |||
4a69f7976a | |||
1e68895a92 | |||
b9c60adaaa | |||
8437d86913 | |||
da345c1717 | |||
735ea86e86 | |||
1095d0b343 | |||
b9fa4ae646 | |||
1c28784717 | |||
01270455b8 | |||
19d471ffa1 | |||
93fc4c0097 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
/*.opensdf
|
/*.opensdf
|
||||||
/*.suo
|
/*.suo
|
||||||
/*.sdf
|
/*.sdf
|
||||||
|
/doc
|
||||||
/ipch
|
/ipch
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
|||||||
[submodule "lib/WinStd"]
|
[submodule "lib/WinStd"]
|
||||||
path = lib/WinStd
|
path = lib/WinStd
|
||||||
url = https://github.com/Amebis/WinStd.git
|
url = https://github.com/Amebis/WinStd.git
|
||||||
|
[submodule "lib/wxExtend"]
|
||||||
|
path = lib/wxExtend
|
||||||
|
url = https://github.com/Amebis/wxExtend.git
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\lib\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
Binary file not shown.
@@ -98,10 +98,22 @@
|
|||||||
<ResourceCompile Include="CredWrite.rc" />
|
<ResourceCompile Include="CredWrite.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\lib\EAPBase\build\EAPBase.vcxproj">
|
||||||
|
<Project>{ad6816a0-9600-4e01-8c49-39d03d1e791f}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\lib\Events\build\Events.vcxproj">
|
||||||
|
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\lib\PAP\build\PAP.vcxproj">
|
||||||
|
<Project>{36b0cf8a-7794-46c3-8099-825ba962b4c7}</Project>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
|
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
|
||||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="README.md" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@@ -32,4 +32,7 @@
|
|||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</ResourceCompile>
|
</ResourceCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="README.md" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Binary file not shown.
@@ -1,12 +1,12 @@
|
|||||||
#CredWrite
|
#CredWrite
|
||||||
Imports given credentials to Windows Credential Manager for GEANTLink use
|
Imports given credentials to Windows Credential Manager for G<EFBFBD>ANTLink use
|
||||||
|
|
||||||
##Usage
|
##Usage
|
||||||
```
|
```
|
||||||
CredWrite <username> <password> [<realm>]
|
CredWrite <username> <password> [<realm>]
|
||||||
```
|
```
|
||||||
|
|
||||||
- `username` - a user name usually of the form user@domain
|
- `username` - Base64 encoded UTF-8 user name (usually of the form user@domain or domain\user)
|
||||||
- `password` - Base64 encoded UTF-8 user password
|
- `password` - Base64 encoded UTF-8 user password
|
||||||
- `realm` - A realm ID to allow grouping of credentials over different WLAN profiles (optional, default is domain part of `username`)
|
- `realm` - A realm ID to allow grouping of credentials over different WLAN profiles (optional, default is domain part of `username`)
|
||||||
|
|
||||||
@@ -16,5 +16,4 @@ Return codes:
|
|||||||
- -1 = Invalid parameters
|
- -1 = Invalid parameters
|
||||||
- 0 = Success
|
- 0 = Success
|
||||||
- 1 = Error parsing command line
|
- 1 = Error parsing command line
|
||||||
- 2 = Error encrypting password
|
- 2 = Error encrypting password or writing credentials
|
||||||
- 3 = Error writing credentials to Credential Manager
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ImportGroup Label="PropertySheets">
|
<ImportGroup Label="PropertySheets">
|
||||||
<Import Project="Common.props" />
|
<Import Project="..\build\Common.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<PreprocessorDefinitions>EAPMETHOD_TYPE=21;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>EAPMETHOD_TYPE=21;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<ModuleDefinitionFile>EAPMethod.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>..\build\EAPMethod.def</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
Binary file not shown.
@@ -79,15 +79,11 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\include\EAPMethods.h" />
|
<ClInclude Include="StdAfx.h" />
|
||||||
<ClInclude Include="..\include\EAPTTLS.h" />
|
|
||||||
<ClInclude Include="..\include\StdAfx.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\src\EAPMethods.cpp" />
|
|
||||||
<ClCompile Include="..\src\EAPTTLS.cpp" />
|
|
||||||
<ClCompile Include="..\src\Main.cpp" />
|
<ClCompile Include="..\src\Main.cpp" />
|
||||||
<ClCompile Include="..\src\StdAfx.cpp">
|
<ClCompile Include="StdAfx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
@@ -98,15 +94,27 @@
|
|||||||
<ResourceCompile Include="EAPTTLS.rc" />
|
<ResourceCompile Include="EAPTTLS.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\lib\EAPBase\build\EAPBase.vcxproj">
|
||||||
|
<Project>{ad6816a0-9600-4e01-8c49-39d03d1e791f}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\Events\build\Events.vcxproj">
|
||||||
|
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\PAP\build\PAP.vcxproj">
|
||||||
|
<Project>{36b0cf8a-7794-46c3-8099-825ba962b4c7}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\TLS\build\TLS.vcxproj">
|
||||||
|
<Project>{4d40cb8a-812e-4f12-b23a-31af743878e8}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\TTLS\build\TTLS.vcxproj">
|
||||||
|
<Project>{ee0ef0d9-a475-4038-8637-5754724f65b0}</Project>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
||||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="EAPMethodEvents.vcxproj">
|
|
||||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="EAPMethod.def" />
|
<None Include="..\build\EAPMethod.def" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
40
EAPMethods/EAPTTLS/EAPTTLS.vcxproj.filters
Normal file
40
EAPMethods/EAPTTLS/EAPTTLS.vcxproj.filters
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="StdAfx.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="StdAfx.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\Main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="EAPTTLS.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\build\EAPMethod.def">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
21
EAPMethods/EAPTTLS/StdAfx.cpp
Normal file
21
EAPMethods/EAPTTLS/StdAfx.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
24
EAPMethods/EAPTTLS/StdAfx.h
Normal file
24
EAPMethods/EAPTTLS/StdAfx.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../lib/TTLS/include/Method.h"
|
||||||
|
#include "../../lib/TTLS/include/Module.h"
|
2
EAPMethods/EAPTTLSUI/.gitignore
vendored
Normal file
2
EAPMethods/EAPTTLSUI/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/temp
|
||||||
|
/*.user
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ImportGroup Label="PropertySheets">
|
<ImportGroup Label="PropertySheets">
|
||||||
<Import Project="Common.props" />
|
<Import Project="..\build\Common.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<PreprocessorDefinitions>EAPMETHOD_TYPE=21;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>EAPMETHOD_TYPE=21;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<ModuleDefinitionFile>EAPMethodUI.def</ModuleDefinitionFile>
|
<ModuleDefinitionFile>..\build\EAPMethodUI.def</ModuleDefinitionFile>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
Binary file not shown.
@@ -79,15 +79,11 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\include\EAPMethods.h" />
|
<ClInclude Include="StdAfx.h" />
|
||||||
<ClInclude Include="..\include\EAPTTLS.h" />
|
|
||||||
<ClInclude Include="..\include\StdAfx.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\src\EAPMethods.cpp" />
|
<ClCompile Include="..\src\Main_UI.cpp" />
|
||||||
<ClCompile Include="..\src\EAPTTLS.cpp" />
|
<ClCompile Include="StdAfx.cpp">
|
||||||
<ClCompile Include="..\src\MainUI.cpp" />
|
|
||||||
<ClCompile Include="..\src\StdAfx.cpp">
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
@@ -98,15 +94,39 @@
|
|||||||
<ResourceCompile Include="EAPTTLSUI.rc" />
|
<ResourceCompile Include="EAPTTLSUI.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\lib\EAPBase\build\EAPBase.vcxproj">
|
||||||
|
<Project>{ad6816a0-9600-4e01-8c49-39d03d1e791f}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\EAPBase_UI\build\EAPBase_UI.vcxproj">
|
||||||
|
<Project>{d4b54856-be1f-4937-a8f7-495125be76be}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\Events\build\Events.vcxproj">
|
||||||
|
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\PAP\build\PAP.vcxproj">
|
||||||
|
<Project>{36b0cf8a-7794-46c3-8099-825ba962b4c7}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\PAP_UI\build\PAP_UI.vcxproj">
|
||||||
|
<Project>{3d309c2e-64ab-4bc4-a16d-468571a2bc1a}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\TLS\build\TLS.vcxproj">
|
||||||
|
<Project>{4d40cb8a-812e-4f12-b23a-31af743878e8}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\TLS_UI\build\TLS_UI.vcxproj">
|
||||||
|
<Project>{9a25c261-8ade-4938-8393-e857ef0e37e9}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\TTLS\build\TTLS.vcxproj">
|
||||||
|
<Project>{ee0ef0d9-a475-4038-8637-5754724f65b0}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\lib\TTLS_UI\build\TTLS_UI.vcxproj">
|
||||||
|
<Project>{42f0f0f4-c928-4860-a4e4-94991c2c3d90}</Project>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
<ProjectReference Include="..\..\lib\WinStd\build\WinStd.vcxproj">
|
||||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="EAPMethodEvents.vcxproj">
|
|
||||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="EAPMethodUI.def" />
|
<None Include="..\build\EAPMethodUI.def" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
40
EAPMethods/EAPTTLSUI/EAPTTLSUI.vcxproj.filters
Normal file
40
EAPMethods/EAPTTLSUI/EAPTTLSUI.vcxproj.filters
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="StdAfx.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="StdAfx.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\Main_UI.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="EAPTTLSUI.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\build\EAPMethodUI.def">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
21
EAPMethods/EAPTTLSUI/StdAfx.cpp
Normal file
21
EAPMethods/EAPTTLSUI/StdAfx.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
23
EAPMethods/EAPTTLSUI/StdAfx.h
Normal file
23
EAPMethods/EAPTTLSUI/StdAfx.h
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../lib/TTLS_UI/include/Module.h"
|
Binary file not shown.
@@ -8,11 +8,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>temp\EAPMethodEvents.$(Platform).$(Configuration).$(PlatformToolset);..\include;..\..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(ProjectDir);..\..\lib\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\include;..\..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ResourceCompile>
|
|
||||||
<AdditionalIncludeDirectories>temp\EAPMethodEvents.$(Platform).$(Configuration).$(PlatformToolset);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ResourceCompile>
|
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
</Project>
|
</Project>
|
Binary file not shown.
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ImportGroup Label="PropertySheets">
|
|
||||||
<Import Project="..\..\include\ResourceDLL.props" />
|
|
||||||
<Import Project="Common.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup />
|
|
||||||
<ItemDefinitionGroup />
|
|
||||||
<ItemGroup />
|
|
||||||
</Project>
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
341
EAPMethods/locale/EAPMethods.pot
Normal file
341
EAPMethods/locale/EAPMethods.pot
Normal file
@@ -0,0 +1,341 @@
|
|||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: EAPMethods\n"
|
||||||
|
"POT-Creation-Date: 2016-06-10 12:06+0200\n"
|
||||||
|
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
|
||||||
|
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||||
|
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 1.8.8\n"
|
||||||
|
"X-Poedit-Basepath: ../..\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"Language: en_US\n"
|
||||||
|
"X-Poedit-SourceCharset: UTF-8\n"
|
||||||
|
"X-Poedit-KeywordsList: _\n"
|
||||||
|
"X-Poedit-SearchPath-0: lib/EAPBase_UI\n"
|
||||||
|
"X-Poedit-SearchPath-1: lib/PAP_UI\n"
|
||||||
|
"X-Poedit-SearchPath-2: lib/TLS_UI\n"
|
||||||
|
"X-Poedit-SearchPath-3: lib/TTLS_UI\n"
|
||||||
|
"X-Poedit-SearchPath-4: EAPMethods\n"
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:123 lib/EAPBase_UI/res/wxEAP_UI.cpp:200
|
||||||
|
msgid "Client Credentials"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:134
|
||||||
|
msgid "Manage your credentials stored in Windows Credential Manager."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:144
|
||||||
|
msgid "Identity:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:149
|
||||||
|
msgid "Enter your user name here (user@domain.org, DOMAINUser, etc.)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:159
|
||||||
|
msgid "&Set Credentials..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:160
|
||||||
|
msgid "Click here to set or modify your credentials"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:164
|
||||||
|
msgid "&Clear Credentials"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:165
|
||||||
|
msgid ""
|
||||||
|
"Click to clear your credentials from Credential Manager.\n"
|
||||||
|
"Note: You will be prompted to enter credentials when connecting."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:211
|
||||||
|
msgid "Please provide your user ID and password."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:221
|
||||||
|
msgid "User ID:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:226
|
||||||
|
msgid "Enter your user name here (user@domain.org, DOMAIN\\User, etc.)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:230
|
||||||
|
msgid "Password:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:235
|
||||||
|
msgid "Enter your password here"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:242 lib/TLS_UI/res/wxTLS_UI.cpp:164
|
||||||
|
msgid "&Remember"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:243
|
||||||
|
msgid "Check if you would like to save username and password"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/PAP_UI/src/PAP_UI.cpp:41
|
||||||
|
msgid "This method requires no additional settings."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:17
|
||||||
|
msgid "Server Trust"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:28
|
||||||
|
msgid "Describe the servers you trust to prevent credential interception in case of man-in-the-middle attacks."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:35
|
||||||
|
msgid "Acceptable Certificate Authorities:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:40
|
||||||
|
msgid "List of certificate authorities server's certificate must be issued by"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:47
|
||||||
|
msgid "Add CA from Store..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:48
|
||||||
|
msgid "Adds a new certificate authority from the certificate store to the list"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:52
|
||||||
|
msgid "Add CA from File..."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:53
|
||||||
|
msgid "Adds a new certificate authority from the file to the list"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:57
|
||||||
|
msgid "&Remove CA"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:59
|
||||||
|
msgid "Removes selected certificate authorities from the list"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:72
|
||||||
|
msgid "Acceptable server &names:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:77
|
||||||
|
msgid "A semicolon delimited list of acceptable server FQDN names; blank to skip name check; \"*\" wildchar allowed"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:81
|
||||||
|
msgid "(Example: foo.bar.com;*.domain.org)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:120
|
||||||
|
msgid "TLS Client Certificate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:131
|
||||||
|
msgid "Please select your client certificate to use for authentication."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:138
|
||||||
|
msgid "Co&nnect without providing a client certificate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:139
|
||||||
|
msgid "Select if your server does not require you to provide a client certificate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:146
|
||||||
|
msgid "Use the following &certificate:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:147
|
||||||
|
msgid "Select if you need to provide a client certificate when connecting"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:154
|
||||||
|
msgid "Client certificate to use for authentication"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/res/wxTLS_UI.cpp:165
|
||||||
|
msgid "Check if you would like to save certificate selection"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/src/TLS_UI.cpp:199
|
||||||
|
#, c-format
|
||||||
|
msgid "Invalid character in host name found: %c"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/src/TLS_UI.cpp:199
|
||||||
|
msgid "Validation conflict"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/src/TLS_UI.cpp:551
|
||||||
|
msgid "Add Certificate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/src/TLS_UI.cpp:552
|
||||||
|
msgid "Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/src/TLS_UI.cpp:553
|
||||||
|
msgid "X.509 Certificate Files (*.cer;*.crt;*.der;*.pem)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/src/TLS_UI.cpp:554
|
||||||
|
msgid "PKCS #7 Certificate Files (*.p7b)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/src/TLS_UI.cpp:555
|
||||||
|
msgid "All Files (*.*)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/src/TLS_UI.cpp:571
|
||||||
|
#, c-format
|
||||||
|
msgid "Invalid or unsupported certificate file %s"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TLS_UI/src/TLS_UI.cpp:571
|
||||||
|
#, fuzzy
|
||||||
|
msgid "Error"
|
||||||
|
msgstr "Napaka pri nalaganju knjižnice MSI.DLL (%1!ld!)."
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:17
|
||||||
|
msgid "Outer Identity"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:28
|
||||||
|
msgid "Select the user ID supplicant introduces itself as to authenticator:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:35
|
||||||
|
msgid "&Same as inner identity"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:36
|
||||||
|
msgid "Use my true user name"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:40
|
||||||
|
msgid "Use &empty outer identity (RFC 4822)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:41
|
||||||
|
msgid "Ommit my user name and use @mydomain.org only"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:48
|
||||||
|
msgid "&Custom outer identity:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:49
|
||||||
|
msgid "Specify custom outer identity"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:54
|
||||||
|
msgid "Custom outer identity to use"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/src/TTLS_UI.cpp:92
|
||||||
|
msgid "Outer Authentication"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/src/TTLS_UI.cpp:105
|
||||||
|
msgid "Inner Authentication"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/src/TTLS_UI.cpp:111
|
||||||
|
msgid "Select inner authentication method from the list"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/TTLS_UI/src/TTLS_UI.cpp:112
|
||||||
|
msgid "PAP"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/include/EAP_UI.h:217
|
||||||
|
msgid "<blank>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/include/EAP_UI.h:223
|
||||||
|
#, c-format
|
||||||
|
msgid "<error %u>"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/include/EAP_UI.h:246
|
||||||
|
#, c-format
|
||||||
|
msgid "Deleting credentials failed (error %u)."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/include/EAP_UI.h:300
|
||||||
|
#, c-format
|
||||||
|
msgid "Error reading credentials from Credential Manager: %ls (error %u)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/include/EAP_UI.h:303
|
||||||
|
#, c-format
|
||||||
|
msgid "Reading credentials failed (error %u)."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/include/EAP_UI.h:318
|
||||||
|
#, c-format
|
||||||
|
msgid "Error writing credentials to Credential Manager: %ls (error %u)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/include/EAP_UI.h:321
|
||||||
|
#, c-format
|
||||||
|
msgid "Writing credentials failed (error %u)."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.h:56
|
||||||
|
msgid "EAP Method Configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: lib/EAPBase_UI/res/wxEAP_UI.h:81
|
||||||
|
msgid "EAP Credentials"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:3
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:3
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:3
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:3
|
||||||
|
#, fuzzy
|
||||||
|
msgid "1252"
|
||||||
|
msgstr "1250"
|
||||||
|
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:4
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:4
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||||
|
msgid "EAP Peer Methods"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:4
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:4
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||||
|
msgid "Modules to support individual EAP methods"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:5
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:5
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:5
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:5
|
||||||
|
msgid "TTLS"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Debug.Feature-2.idtx:5
|
||||||
|
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:5
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Debug.Feature-2.idtx:5
|
||||||
|
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:5
|
||||||
|
msgid "Tunneled Transport Layer Security"
|
||||||
|
msgstr ""
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
410
EAPMethods/src/Main_UI.cpp
Normal file
410
EAPMethods/src/Main_UI.cpp
Normal file
@@ -0,0 +1,410 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <StdAfx.h>
|
||||||
|
|
||||||
|
#pragma comment(lib, "msxml6.lib")
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace winstd;
|
||||||
|
|
||||||
|
|
||||||
|
#if EAPMETHOD_TYPE==21
|
||||||
|
#define _EAPMETHOD_PEER_UI eap::peer_ttls_ui
|
||||||
|
#else
|
||||||
|
#error Unknown EAP Method type.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HANDLE g_act_ctx = NULL;
|
||||||
|
_EAPMETHOD_PEER_UI g_peer;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// DLL main entry point
|
||||||
|
///
|
||||||
|
/// \sa [DllMain entry point](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682583.aspx)
|
||||||
|
///
|
||||||
|
BOOL WINAPI DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(lpvReserved);
|
||||||
|
|
||||||
|
if (fdwReason == DLL_PROCESS_ATTACH) {
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
g_peer.m_instance = hinstDLL;
|
||||||
|
|
||||||
|
// Save current activation context, as proper activation context is set at this time only (LoadLibrary() call).
|
||||||
|
GetCurrentActCtx(&g_act_ctx);
|
||||||
|
} else if (fdwReason == DLL_PROCESS_DETACH) {
|
||||||
|
if (g_act_ctx)
|
||||||
|
ReleaseActCtx(g_act_ctx);
|
||||||
|
|
||||||
|
// wxWidgets library has some global objects allocating data on heap in constructors,
|
||||||
|
// causing false-positive memory leak reports.
|
||||||
|
//assert(!_CrtDumpMemoryLeaks());
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Releases all memory associated with an opaque user interface context data buffer.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerFreeMemory function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363606.aspx)
|
||||||
|
///
|
||||||
|
VOID WINAPI EapPeerFreeMemory(_In_ void *pUIContextData)
|
||||||
|
{
|
||||||
|
event_fn_auto event_auto(g_peer.get_event_fn_auto(__FUNCTION__));
|
||||||
|
|
||||||
|
if (pUIContextData)
|
||||||
|
g_peer.free_memory((BYTE*)pUIContextData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Releases error-specific memory allocated by the EAP peer method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerFreeErrorMemory function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363605.aspx)
|
||||||
|
///
|
||||||
|
VOID WINAPI EapPeerFreeErrorMemory(_In_ EAP_ERROR *ppEapError)
|
||||||
|
{
|
||||||
|
event_fn_auto event_auto(g_peer.get_event_fn_auto(__FUNCTION__));
|
||||||
|
|
||||||
|
if (ppEapError)
|
||||||
|
g_peer.free_error_memory(ppEapError);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Converts XML into the configuration BLOB.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerConfigXml2Blob function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363602.aspx)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerConfigXml2Blob(
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||||
|
_In_ IXMLDOMDocument2 *pConfigDoc,
|
||||||
|
_Out_ BYTE **pConnectionDataOut,
|
||||||
|
_Out_ DWORD *pdwConnectionDataOutSize,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
return dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
assert(!*ppEapError);
|
||||||
|
|
||||||
|
if (eapMethodType.eapType.type != EAPMETHOD_TYPE)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)eapMethodType.eapType.type, (int)EAPMETHOD_TYPE).c_str()));
|
||||||
|
else if (eapMethodType.dwAuthorId != 67532)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)eapMethodType.dwAuthorId, (int)67532).c_str()));
|
||||||
|
else if (!pConfigDoc)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pConfigDoc is NULL.")));
|
||||||
|
else if (!pConnectionDataOut)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pConnectionDataOut is NULL.")));
|
||||||
|
else if (!pdwConnectionDataOutSize)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pdwConnectionDataOutSize is NULL.")));
|
||||||
|
else {
|
||||||
|
// <Config>
|
||||||
|
pConfigDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eaphostconfig=\"http://www.microsoft.com/provisioning/EapHostConfig\""));
|
||||||
|
com_obj<IXMLDOMElement> pXmlElConfig;
|
||||||
|
if (FAILED(eapxml::select_element(pConfigDoc, bstr(L"//eaphostconfig:Config"), &pXmlElConfig))) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" Error reading <Config> element.")));
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load configuration.
|
||||||
|
pConfigDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eap-metadata=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\""));
|
||||||
|
try {
|
||||||
|
g_peer.config_xml2blob(dwFlags, pXmlElConfig, pConnectionDataOut, pdwConnectionDataOutSize);
|
||||||
|
} catch (std::exception &err) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||||
|
dwResult = (*ppEapError)->dwWinError;
|
||||||
|
} catch (...) {
|
||||||
|
dwResult = ERROR_INVALID_DATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Converts the configuration BLOB to XML.
|
||||||
|
///
|
||||||
|
/// The configuration BLOB is returned in the ppConnectionDataOut parameter of the EapPeerInvokeConfigUI function.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerConfigBlob2Xml function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363601.aspx)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerConfigBlob2Xml(
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_Out_ IXMLDOMDocument2 **ppConfigDoc,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
return dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
assert(!*ppEapError);
|
||||||
|
|
||||||
|
if (eapMethodType.eapType.type != EAPMETHOD_TYPE)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)eapMethodType.eapType.type, (int)EAPMETHOD_TYPE).c_str()));
|
||||||
|
else if (eapMethodType.dwAuthorId != 67532)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)eapMethodType.dwAuthorId, (int)67532).c_str()));
|
||||||
|
else if (!pConnectionData && dwConnectionDataSize)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pConnectionData is NULL.")));
|
||||||
|
else if (!ppConfigDoc)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppConfigDoc is NULL.")));
|
||||||
|
else {
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
// Create configuration XML document.
|
||||||
|
com_obj<IXMLDOMDocument2> pDoc;
|
||||||
|
if (FAILED(hr = pDoc.create(CLSID_DOMDocument60, NULL, CLSCTX_INPROC_SERVER))) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error creating XML document.")));
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
pDoc->put_async(VARIANT_FALSE);
|
||||||
|
|
||||||
|
// Load empty XML configuration.
|
||||||
|
VARIANT_BOOL isSuccess = VARIANT_FALSE;
|
||||||
|
if (FAILED((hr = pDoc->loadXML(L"<Config xmlns=\"http://www.microsoft.com/provisioning/EapHostConfig\"><EAPIdentityProviderList xmlns=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\"></EAPIdentityProviderList></Config>", &isSuccess)))) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = HRESULT_CODE(hr), _T(__FUNCTION__) _T(" Error loading XML document template.")));
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
if (!isSuccess) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_XML_PARSE_ERROR, _T(__FUNCTION__) _T(" Loading XML template failed.")));
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select <Config> node.
|
||||||
|
com_obj<IXMLDOMNode> pXmlElConfig;
|
||||||
|
pDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eaphostconfig=\"http://www.microsoft.com/provisioning/EapHostConfig\""));
|
||||||
|
if (FAILED(eapxml::select_node(pDoc, bstr(L"eaphostconfig:Config"), &pXmlElConfig))) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting <Config> element.")));
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save configuration.
|
||||||
|
pDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eap-metadata=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\""));
|
||||||
|
try {
|
||||||
|
g_peer.config_blob2xml(dwFlags, pConnectionData, dwConnectionDataSize, pDoc, pXmlElConfig);
|
||||||
|
} catch (std::exception &err) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||||
|
return dwResult = (*ppEapError)->dwWinError;
|
||||||
|
} catch (...) {
|
||||||
|
return dwResult = ERROR_INVALID_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppConfigDoc = pDoc.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Raises the EAP method's specific connection configuration user interface dialog on the client.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerInvokeConfigUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363614.aspx)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerInvokeConfigUI(
|
||||||
|
_In_ const EAP_METHOD_TYPE *pEapType,
|
||||||
|
_In_ HWND hwndParent,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwConnectionDataInSize,
|
||||||
|
_In_count_(dwConnectionDataInSize) const BYTE *pConnectionDataIn,
|
||||||
|
_Out_ DWORD *pdwConnectionDataOutSize,
|
||||||
|
_Out_ BYTE **ppConnectionDataOut,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(dwFlags);
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||||
|
actctx_activator actctx(g_act_ctx);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
return dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
assert(!*ppEapError);
|
||||||
|
|
||||||
|
if (!pEapType)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapType is NULL.")));
|
||||||
|
else if (pEapType->eapType.type != EAPMETHOD_TYPE)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)pEapType->eapType.type, (int)EAPMETHOD_TYPE).c_str()));
|
||||||
|
else if (pEapType->dwAuthorId != 67532)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)pEapType->dwAuthorId, (int)67532).c_str()));
|
||||||
|
else if (!pConnectionDataIn && dwConnectionDataInSize)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pConnectionDataIn is NULL.")));
|
||||||
|
else if (!pdwConnectionDataOutSize)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pdwConnectionDataOutSize is NULL.")));
|
||||||
|
else if (!ppConnectionDataOut)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppConnectionDataOut is NULL.")));
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
g_peer.invoke_config_ui(hwndParent, pConnectionDataIn, dwConnectionDataInSize, ppConnectionDataOut, pdwConnectionDataOutSize);
|
||||||
|
} catch (std::exception &err) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||||
|
dwResult = (*ppEapError)->dwWinError;
|
||||||
|
} catch (...) {
|
||||||
|
dwResult = ERROR_INVALID_DATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Raises a custom interactive user interface dialog to obtain user identity information for the EAP method on the client.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerInvokeIdentityUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363615.aspx)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerInvokeIdentityUI(
|
||||||
|
_In_ const EAP_METHOD_TYPE *pEapType,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ HWND hwndParent,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_In_ DWORD dwUserDataSize,
|
||||||
|
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||||
|
_Out_ DWORD *pdwUserDataOutSize,
|
||||||
|
_Out_ BYTE **ppUserDataOut,
|
||||||
|
_Out_ LPWSTR *ppwszIdentity,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||||
|
actctx_activator actctx(g_act_ctx);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
assert(!*ppEapError);
|
||||||
|
|
||||||
|
if (!pEapType)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapType is NULL.")));
|
||||||
|
else if (pEapType->eapType.type != EAPMETHOD_TYPE)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)pEapType->eapType.type, (int)EAPMETHOD_TYPE).c_str()));
|
||||||
|
else if (pEapType->dwAuthorId != 67532)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)pEapType->dwAuthorId, (int)67532).c_str()));
|
||||||
|
else if (!pConnectionData && dwConnectionDataSize)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pConnectionData is NULL.")));
|
||||||
|
else if (!pUserData && dwUserDataSize)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pUserData is NULL.")));
|
||||||
|
else if (!pdwUserDataOutSize)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pdwUserDataOutSize is NULL.")));
|
||||||
|
else if (!ppUserDataOut)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppUserDataOut is NULL.")));
|
||||||
|
else if (!ppwszIdentity)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppwszIdentity is NULL.")));
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
g_peer.invoke_identity_ui(hwndParent, dwFlags, pConnectionData, dwConnectionDataSize, pUserData, dwUserDataSize, ppUserDataOut, pdwUserDataOutSize, ppwszIdentity);
|
||||||
|
} catch (std::exception &err) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||||
|
dwResult = (*ppEapError)->dwWinError;
|
||||||
|
} catch (...) {
|
||||||
|
dwResult = ERROR_INVALID_DATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Raises a custom interactive user interface dialog for the EAP method on the client.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerInvokeInteractiveUI function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363616.aspx)
|
||||||
|
///
|
||||||
|
DWORD WINAPI EapPeerInvokeInteractiveUI(
|
||||||
|
_In_ const EAP_METHOD_TYPE *pEapType,
|
||||||
|
_In_ HWND hwndParent,
|
||||||
|
_In_ DWORD dwUIContextDataSize,
|
||||||
|
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||||
|
_Out_ DWORD *pdwDataFromInteractiveUISize,
|
||||||
|
_Out_ BYTE **ppDataFromInteractiveUI,
|
||||||
|
_Out_ EAP_ERROR **ppEapError)
|
||||||
|
{
|
||||||
|
DWORD dwResult = ERROR_SUCCESS;
|
||||||
|
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||||
|
actctx_activator actctx(g_act_ctx);
|
||||||
|
#ifdef _DEBUG
|
||||||
|
//Sleep(10000);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Parameter check
|
||||||
|
if (!ppEapError)
|
||||||
|
return dwResult = ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
assert(!*ppEapError);
|
||||||
|
|
||||||
|
if (!pEapType)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapType is NULL.")));
|
||||||
|
else if (pEapType->eapType.type != EAPMETHOD_TYPE)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" Input EAP type (%d) does not match the supported EAP type (%d)."), (int)pEapType->eapType.type, (int)EAPMETHOD_TYPE).c_str()));
|
||||||
|
else if (pEapType->dwAuthorId != 67532)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_SUPPORTED, wstring_printf(_T(__FUNCTION__) _T(" EAP author (%d) does not match the supported author (%d)."), (int)pEapType->dwAuthorId, (int)67532).c_str()));
|
||||||
|
else if (!pUIContextData && dwUIContextDataSize)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pUIContextData is NULL.")));
|
||||||
|
else if (!pdwDataFromInteractiveUISize)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pdwDataFromInteractiveUISize is NULL.")));
|
||||||
|
else if (!ppDataFromInteractiveUI)
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppDataFromInteractiveUI is NULL.")));
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
g_peer.invoke_interactive_ui(hwndParent, pUIContextData, dwUIContextDataSize, ppDataFromInteractiveUI, pdwDataFromInteractiveUISize);
|
||||||
|
} catch (std::exception &err) {
|
||||||
|
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||||
|
dwResult = (*ppEapError)->dwWinError;
|
||||||
|
} catch (...) {
|
||||||
|
dwResult = ERROR_INVALID_DATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dwResult;
|
||||||
|
}
|
Binary file not shown.
2
EventMonitor/.gitignore
vendored
Normal file
2
EventMonitor/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/temp
|
||||||
|
/*.user
|
86
EventMonitor/App.cpp
Normal file
86
EventMonitor/App.cpp
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 G<>ANT
|
||||||
|
|
||||||
|
This file is part of G<>ANTLink.
|
||||||
|
|
||||||
|
G<>ANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
G<>ANTLink 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 G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
#pragma comment(lib, "msi.lib")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// wxEventMonitorApp
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
wxIMPLEMENT_APP(wxEventMonitorApp);
|
||||||
|
|
||||||
|
|
||||||
|
wxEventMonitorApp::wxEventMonitorApp() : wxApp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wxEventMonitorApp::OnInit()
|
||||||
|
{
|
||||||
|
#if defined(__WXMSW__)
|
||||||
|
// To compensate migration to non-advertised shortcut, do the Microsoft Installer's feature completeness check manually.
|
||||||
|
// If execution got this far in the first place (EXE and dependent DLLs are present and loadable).
|
||||||
|
// Furthermore, this increments program usage counter.
|
||||||
|
if (::MsiQueryFeatureState(_T(PRODUCT_VERSION_GUID), _T("featEventMonitor")) != INSTALLSTATE_UNKNOWN)
|
||||||
|
::MsiUseFeature(_T(PRODUCT_VERSION_GUID), _T("featEventMonitor"));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wxConfigBase *cfgPrev = wxConfigBase::Set(new wxConfig(wxT("EventMonitor"), wxT(PRODUCT_NAME_STR)));
|
||||||
|
if (cfgPrev) wxDELETE(cfgPrev);
|
||||||
|
|
||||||
|
if (!wxApp::OnInit())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Set desired locale.
|
||||||
|
wxLanguage language = (wxLanguage)wxConfigBase::Get()->Read(wxT("Language"), wxLANGUAGE_DEFAULT);
|
||||||
|
if (wxLocale::IsAvailable(language)) {
|
||||||
|
wxString sPath;
|
||||||
|
if (wxConfigBase::Get()->Read(wxT("LocalizationRepositoryPath"), &sPath))
|
||||||
|
m_locale.AddCatalogLookupPathPrefix(sPath);
|
||||||
|
if (m_locale.Init(language)) {
|
||||||
|
wxVERIFY(m_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion)));
|
||||||
|
wxVERIFY(m_locale.AddCatalog(wxT("EventMonitor")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
// Find EventMonitor window if already running.
|
||||||
|
HWND okno = ::FindWindow(_T("wxWindowNR"), _("Event Monitor"));
|
||||||
|
if (okno) {
|
||||||
|
if (::IsIconic(okno))
|
||||||
|
::SendMessage(okno, WM_SYSCOMMAND, SC_RESTORE, 0);
|
||||||
|
::SetActiveWindow(okno);
|
||||||
|
::SetForegroundWindow(okno);
|
||||||
|
|
||||||
|
// Not an error condition actually; Just nothing else to do...
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_mainWnd = new wxEventMonitorFrame();
|
||||||
|
wxPersistentRegisterAndRestore<wxEventMonitorFrame>(m_mainWnd);
|
||||||
|
m_mainWnd->Show();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
61
EventMonitor/App.h
Normal file
61
EventMonitor/App.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 G<>ANT
|
||||||
|
|
||||||
|
This file is part of G<>ANTLink.
|
||||||
|
|
||||||
|
G<>ANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
G<>ANTLink 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 G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
///
|
||||||
|
/// EventMonitor application
|
||||||
|
///
|
||||||
|
class wxEventMonitorApp;
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Frame.h"
|
||||||
|
|
||||||
|
#include <wx/app.h>
|
||||||
|
#include <wx/config.h>
|
||||||
|
#include <wx/intl.h>
|
||||||
|
|
||||||
|
|
||||||
|
class wxEventMonitorApp : public wxApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxEventMonitorApp();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called when application initializes.
|
||||||
|
///
|
||||||
|
/// \returns
|
||||||
|
/// - \c true if initialization succeeded
|
||||||
|
/// - \c false otherwise
|
||||||
|
///
|
||||||
|
virtual bool OnInit();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Called when application uninitializes.
|
||||||
|
///
|
||||||
|
/// \returns Result code to return to OS
|
||||||
|
///
|
||||||
|
//virtual int OnExit();
|
||||||
|
|
||||||
|
public:
|
||||||
|
wxEventMonitorFrame *m_mainWnd; ///< Main window
|
||||||
|
wxLocale m_locale; ///< Current locale
|
||||||
|
};
|
||||||
|
|
||||||
|
wxDECLARE_APP(wxEventMonitorApp);
|
830
EventMonitor/ETWLog.cpp
Normal file
830
EventMonitor/ETWLog.cpp
Normal file
@@ -0,0 +1,830 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 G<>ANT
|
||||||
|
|
||||||
|
This file is part of G<>ANTLink.
|
||||||
|
|
||||||
|
G<>ANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
G<>ANTLink 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 G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
#pragma comment(lib, "tdh.lib")
|
||||||
|
#pragma comment(lib, "Ws2_32.lib")
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace winstd;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// Local helper functions declarations
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static tstring MapToString(_In_ const EVENT_MAP_INFO *pMapInfo, _In_ LPCBYTE pData);
|
||||||
|
static tstring DataToString(_In_ USHORT InType, _In_ USHORT OutType, _In_count_(nDataSize) LPCBYTE pData, _In_ SIZE_T nDataSize, _In_ const EVENT_MAP_INFO *pMapInfo, _In_ BYTE nPtrSize);
|
||||||
|
static ULONG GetArraySize(PEVENT_RECORD pEvent, PTRACE_EVENT_INFO pInfo, ULONG i, ULONG *pulArraySize);
|
||||||
|
static tstring PropertyToString(PEVENT_RECORD pEvent, PTRACE_EVENT_INFO pInfo, ULONG ulPropIndex, LPWSTR pStructureName, ULONG ulStructIndex, BYTE nPtrSize);
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// wxETWEvent
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
const EVENT_RECORD wxETWEvent::s_record_null = {};
|
||||||
|
|
||||||
|
|
||||||
|
wxETWEvent::wxETWEvent(wxEventType type, const EVENT_RECORD &record) :
|
||||||
|
m_record(record),
|
||||||
|
wxEvent(0, type)
|
||||||
|
{
|
||||||
|
DoSetExtendedData(record.ExtendedDataCount, record.ExtendedData);
|
||||||
|
DoSetUserData(record.UserDataLength, record.UserData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxETWEvent::wxETWEvent(const wxETWEvent& event) :
|
||||||
|
m_record(event.m_record),
|
||||||
|
wxEvent(event)
|
||||||
|
{
|
||||||
|
DoSetExtendedData(event.m_record.ExtendedDataCount, event.m_record.ExtendedData);
|
||||||
|
DoSetUserData(event.m_record.UserDataLength, event.m_record.UserData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxETWEvent::~wxETWEvent()
|
||||||
|
{
|
||||||
|
if (m_record.ExtendedData)
|
||||||
|
delete (unsigned char*)m_record.ExtendedData;
|
||||||
|
|
||||||
|
if (m_record.UserData)
|
||||||
|
delete (unsigned char*)m_record.UserData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wxETWEvent::SetExtendedData(size_t extended_data_count, const EVENT_HEADER_EXTENDED_DATA_ITEM *extended_data)
|
||||||
|
{
|
||||||
|
if (m_record.ExtendedData)
|
||||||
|
delete (unsigned char*)m_record.ExtendedData;
|
||||||
|
|
||||||
|
return DoSetExtendedData(extended_data_count, extended_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wxETWEvent::SetUserData(size_t user_data_length, const void *user_data)
|
||||||
|
{
|
||||||
|
if (m_record.UserData)
|
||||||
|
delete (unsigned char*)m_record.UserData;
|
||||||
|
|
||||||
|
return DoSetUserData(user_data_length, user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wxETWEvent::DoSetExtendedData(size_t extended_data_count, const EVENT_HEADER_EXTENDED_DATA_ITEM *extended_data)
|
||||||
|
{
|
||||||
|
if (extended_data_count) {
|
||||||
|
wxASSERT_MSG(extended_data, wxT("extended data is NULL"));
|
||||||
|
|
||||||
|
// Count the total required memory.
|
||||||
|
size_t data_size = 0;
|
||||||
|
for (size_t i = 0; i < extended_data_count; i++)
|
||||||
|
data_size += extended_data[i].DataSize;
|
||||||
|
|
||||||
|
// Allocate memory for extended data.
|
||||||
|
m_record.ExtendedData = (EVENT_HEADER_EXTENDED_DATA_ITEM*)(new unsigned char[sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM)*extended_data_count + data_size]);
|
||||||
|
wxCHECK_MSG(m_record.ExtendedData, false, wxT("extended data memory allocation failed"));
|
||||||
|
|
||||||
|
// Bulk-copy extended data descriptors.
|
||||||
|
memcpy(m_record.ExtendedData, extended_data, sizeof(EVENT_HEADER_EXTENDED_DATA_ITEM) * extended_data_count);
|
||||||
|
|
||||||
|
// Copy the data.
|
||||||
|
unsigned char *ptr = (unsigned char*)(m_record.ExtendedData + extended_data_count);
|
||||||
|
for (size_t i = 0; i < extended_data_count; i++) {
|
||||||
|
if (extended_data[i].DataSize) {
|
||||||
|
memcpy(ptr, (void*)(extended_data[i].DataPtr), extended_data[i].DataSize);
|
||||||
|
m_record.ExtendedData[i].DataPtr = (ULONGLONG)ptr;
|
||||||
|
ptr += extended_data[i].DataSize;
|
||||||
|
} else
|
||||||
|
m_record.ExtendedData[i].DataPtr = NULL;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
m_record.ExtendedData = NULL;
|
||||||
|
|
||||||
|
m_record.ExtendedDataCount = extended_data_count;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wxETWEvent::DoSetUserData(size_t user_data_length, const void *user_data)
|
||||||
|
{
|
||||||
|
if (user_data_length) {
|
||||||
|
wxASSERT_MSG(user_data, wxT("user data is NULL"));
|
||||||
|
|
||||||
|
// Allocate memory for user data.
|
||||||
|
m_record.UserData = new unsigned char[user_data_length];
|
||||||
|
wxCHECK_MSG(m_record.UserData, false, wxT("user data memory allocation failed"));
|
||||||
|
|
||||||
|
// Copy user data.
|
||||||
|
memcpy(m_record.UserData, user_data, user_data_length);
|
||||||
|
} else
|
||||||
|
m_record.UserData = NULL;
|
||||||
|
|
||||||
|
m_record.UserDataLength = user_data_length;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxETWEvent, wxEvent)
|
||||||
|
wxDEFINE_EVENT(wxEVT_ETW_EVENT, wxETWEvent);
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// wxEventTraceProcessorThread
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
wxEventTraceProcessorThread::wxEventTraceProcessorThread(wxEvtHandler *parent, const wxArrayString &sessions) :
|
||||||
|
m_parent(parent),
|
||||||
|
wxThread(wxTHREAD_JOINABLE)
|
||||||
|
{
|
||||||
|
EVENT_TRACE_LOGFILE tlf = {};
|
||||||
|
tlf.ProcessTraceMode = PROCESS_TRACE_MODE_REAL_TIME | PROCESS_TRACE_MODE_EVENT_RECORD;
|
||||||
|
tlf.EventRecordCallback = EventRecordCallback;
|
||||||
|
tlf.Context = this;
|
||||||
|
|
||||||
|
for (size_t i = 0, i_end = sessions.GetCount(); i < i_end; i++) {
|
||||||
|
// Open trace.
|
||||||
|
tlf.LoggerName = (LPTSTR)(LPCTSTR)(sessions[i]);
|
||||||
|
event_trace trace;
|
||||||
|
if (!trace.create(&tlf)) {
|
||||||
|
wxLogError(_("Error opening event trace (error %u)."), GetLastError());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save trace to the table.
|
||||||
|
m_traces.push_back(trace.detach());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxEventTraceProcessorThread::~wxEventTraceProcessorThread()
|
||||||
|
{
|
||||||
|
for (vector<TRACEHANDLE>::iterator trace = m_traces.begin(), trace_end = m_traces.end(); trace != trace_end; ++trace) {
|
||||||
|
TRACEHANDLE &h = *trace;
|
||||||
|
if (h) {
|
||||||
|
// Close trace.
|
||||||
|
CloseTrace(h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxEventTraceProcessorThread::Abort()
|
||||||
|
{
|
||||||
|
for (vector<TRACEHANDLE>::iterator trace = m_traces.begin(), trace_end = m_traces.end(); trace != trace_end; ++trace) {
|
||||||
|
TRACEHANDLE &h = *trace;
|
||||||
|
if (h) {
|
||||||
|
// Close trace.
|
||||||
|
CloseTrace(h);
|
||||||
|
h = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxThread::ExitCode wxEventTraceProcessorThread::Entry()
|
||||||
|
{
|
||||||
|
// Process events.
|
||||||
|
ProcessTrace(m_traces.data(), (ULONG)m_traces.size(), NULL, NULL);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID WINAPI wxEventTraceProcessorThread::EventRecordCallback(_In_ PEVENT_RECORD pEvent)
|
||||||
|
{
|
||||||
|
wxASSERT_MSG(pEvent, wxT("event is NULL"));
|
||||||
|
wxASSERT_MSG(pEvent->UserContext, wxT("thread is NULL"));
|
||||||
|
|
||||||
|
wxEventTraceProcessorThread *_this = ((wxEventTraceProcessorThread*)pEvent->UserContext);
|
||||||
|
|
||||||
|
if (_this->TestDestroy()) {
|
||||||
|
// Event processing is pending destruction.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_this->m_parent->QueueEvent(new wxETWEvent(wxEVT_ETW_EVENT, *pEvent));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// wxETWListCtrl
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxETWListCtrl, wxListCtrl)
|
||||||
|
EVT_ETW_EVENT(wxETWListCtrl::OnETWEvent)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
// {6EB8DB94-FE96-443F-A366-5FE0CEE7FB1C}
|
||||||
|
const GUID wxETWListCtrl::s_provider_eaphost = { 0X6EB8DB94, 0XFE96, 0X443F, { 0XA3, 0X66, 0X5F, 0XE0, 0XCE, 0XE7, 0XFB, 0X1C } };
|
||||||
|
|
||||||
|
|
||||||
|
wxETWListCtrl::wxETWListCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxValidator& validator, const wxString& name) :
|
||||||
|
m_proc(NULL),
|
||||||
|
m_item_id(0),
|
||||||
|
wxListCtrl(parent, id, pos, size, style, validator, name)
|
||||||
|
{
|
||||||
|
this->AppendColumn(_("Time" ), wxLIST_FORMAT_LEFT, 100);
|
||||||
|
this->AppendColumn(_("PID" ), wxLIST_FORMAT_LEFT, 50 );
|
||||||
|
this->AppendColumn(_("TID" ), wxLIST_FORMAT_LEFT, 50 );
|
||||||
|
this->AppendColumn(_("Source"), wxLIST_FORMAT_LEFT, 100);
|
||||||
|
this->AppendColumn(_("Event" ), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE_USEHEADER);
|
||||||
|
|
||||||
|
// Start a new session.
|
||||||
|
ULONG ulResult;
|
||||||
|
for (unsigned int i = 0; ; i++) {
|
||||||
|
//tstring log_file(tstring_printf(i ? _T("test.etl") : _T("test %u.etl"), i));
|
||||||
|
tstring name(tstring_printf(i ? _T(PRODUCT_NAME_STR) _T(" Event Monitor Session %u") : _T(PRODUCT_NAME_STR) _T(" Event Monitor Session"), i));
|
||||||
|
|
||||||
|
// Allocate session properties.
|
||||||
|
ULONG
|
||||||
|
ulSizeName = (ULONG)((name .length() + 1)*sizeof(TCHAR)),
|
||||||
|
//ulSizeLogFile = (ULONG)((log_file.length() + 1)*sizeof(TCHAR)),
|
||||||
|
ulSize = sizeof(EVENT_TRACE_PROPERTIES) + ulSizeName /*+ ulSizeLogFile*/;
|
||||||
|
unique_ptr<EVENT_TRACE_PROPERTIES> properties((EVENT_TRACE_PROPERTIES*)new char[ulSize]);
|
||||||
|
wxASSERT_MSG(properties, wxT("error allocating session properties memory"));
|
||||||
|
|
||||||
|
// Initialize properties.
|
||||||
|
memset(properties.get(), 0, sizeof(EVENT_TRACE_PROPERTIES));
|
||||||
|
properties->Wnode.BufferSize = ulSize;
|
||||||
|
properties->Wnode.Flags = WNODE_FLAG_TRACED_GUID;
|
||||||
|
properties->Wnode.ClientContext = 1; //QPC clock resolution
|
||||||
|
CoCreateGuid(&(properties->Wnode.Guid));
|
||||||
|
properties->LogFileMode = /*EVENT_TRACE_FILE_MODE_SEQUENTIAL |*/ EVENT_TRACE_REAL_TIME_MODE;
|
||||||
|
properties->MaximumFileSize = 1; // 1 MB
|
||||||
|
properties->LoggerNameOffset = sizeof(EVENT_TRACE_PROPERTIES);
|
||||||
|
//properties->LogFileNameOffset = sizeof(EVENT_TRACE_PROPERTIES) + ulSizeName;
|
||||||
|
//memcpy((LPTSTR)((char*)properties.get() + properties->LogFileNameOffset), log_file.c_str(), ulSizeLogFile);
|
||||||
|
|
||||||
|
if ((ulResult = m_session.create(name.c_str(), properties.get())) == ERROR_SUCCESS) {
|
||||||
|
break;
|
||||||
|
} else if (ulResult == ERROR_ACCESS_DENIED) {
|
||||||
|
wxLogError(_("Access denied creating event session: you need administrative privileges (Run As Administrator) or be a member of Performance Log Users group to start event tracing session."));
|
||||||
|
return;
|
||||||
|
} else if (ulResult == ERROR_ALREADY_EXISTS) {
|
||||||
|
wxLogDebug(_("The %s event session already exists."), name.c_str());
|
||||||
|
// Do not despair... Retry with a new session name and ID.
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
wxLogError(_("Error creating event session (error %u)."), ulResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable event providers we are interested in to log events to our session.
|
||||||
|
if ((ulResult = EnableTraceEx(
|
||||||
|
&EAPMETHOD_TRACE_EVENT_PROVIDER,
|
||||||
|
&((const EVENT_TRACE_PROPERTIES*)m_session)->Wnode.Guid,
|
||||||
|
m_session,
|
||||||
|
EVENT_CONTROL_CODE_ENABLE_PROVIDER,
|
||||||
|
TRACE_LEVEL_VERBOSE,
|
||||||
|
0, 0,
|
||||||
|
0,
|
||||||
|
NULL)) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
wxLogError(_("Error enabling event provider (error %u)."), ulResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((ulResult = EnableTraceEx(
|
||||||
|
&s_provider_eaphost,
|
||||||
|
&((const EVENT_TRACE_PROPERTIES*)m_session)->Wnode.Guid,
|
||||||
|
m_session,
|
||||||
|
EVENT_CONTROL_CODE_ENABLE_PROVIDER,
|
||||||
|
TRACE_LEVEL_VERBOSE,
|
||||||
|
0, 0,
|
||||||
|
0,
|
||||||
|
NULL)) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
// If the EAPHost trace provider failed to enable, do not despair.
|
||||||
|
wxLogDebug(_("Error enabling EAPHost event provider (error %u)."), ulResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process events in separate thread, not to block wxWidgets' message pump.
|
||||||
|
wxArrayString sessions;
|
||||||
|
sessions.Add(m_session.name());
|
||||||
|
m_proc = new wxEventTraceProcessorThread(this->GetEventHandler(), sessions);
|
||||||
|
wxASSERT_MSG(m_proc, wxT("error allocating thread memory"));
|
||||||
|
if (m_proc->Run() != wxTHREAD_NO_ERROR) {
|
||||||
|
wxFAIL_MSG("Can't create the thread!");
|
||||||
|
delete m_proc;
|
||||||
|
m_proc = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxETWListCtrl::~wxETWListCtrl()
|
||||||
|
{
|
||||||
|
if (m_session) {
|
||||||
|
if (m_proc) {
|
||||||
|
m_proc->Abort();
|
||||||
|
m_proc->Delete();
|
||||||
|
delete m_proc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable event providers.
|
||||||
|
EnableTraceEx(
|
||||||
|
&s_provider_eaphost,
|
||||||
|
&((const EVENT_TRACE_PROPERTIES*)m_session)->Wnode.Guid,
|
||||||
|
m_session,
|
||||||
|
EVENT_CONTROL_CODE_DISABLE_PROVIDER,
|
||||||
|
TRACE_LEVEL_VERBOSE,
|
||||||
|
0, 0,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
EnableTraceEx(
|
||||||
|
&EAPMETHOD_TRACE_EVENT_PROVIDER,
|
||||||
|
&((const EVENT_TRACE_PROPERTIES*)m_session)->Wnode.Guid,
|
||||||
|
m_session,
|
||||||
|
EVENT_CONTROL_CODE_DISABLE_PROVIDER,
|
||||||
|
TRACE_LEVEL_VERBOSE,
|
||||||
|
0, 0,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxETWListCtrl::OnETWEvent(wxETWEvent& event)
|
||||||
|
{
|
||||||
|
EVENT_RECORD &rec = event.GetRecord();
|
||||||
|
bool is_ours = IsEqualGUID(rec.EventHeader.ProviderId, EAPMETHOD_TRACE_EVENT_PROVIDER) ? true : false;
|
||||||
|
int column = 0;
|
||||||
|
|
||||||
|
// Prepare item to insert into the list.
|
||||||
|
wxListItem item;
|
||||||
|
item.SetId(m_item_id++);
|
||||||
|
item.SetTextColour(
|
||||||
|
rec.EventHeader.EventDescriptor.Level >= TRACE_LEVEL_VERBOSE ? (is_ours ? 0x666666 : 0xcccccc) :
|
||||||
|
rec.EventHeader.EventDescriptor.Level >= TRACE_LEVEL_INFORMATION ? (is_ours ? 0x000000 : 0xaaaaaa) :
|
||||||
|
rec.EventHeader.EventDescriptor.Level >= TRACE_LEVEL_WARNING ? (is_ours ? 0x00aacc : 0xaaeeee) :
|
||||||
|
(is_ours ? 0x0000ff : 0xaaaaff));
|
||||||
|
item.SetBackgroundColour(0xffffff);
|
||||||
|
|
||||||
|
{
|
||||||
|
// Output event time-stamp.
|
||||||
|
FILETIME ft;
|
||||||
|
ft.dwHighDateTime = rec.EventHeader.TimeStamp.HighPart;
|
||||||
|
ft.dwLowDateTime = rec.EventHeader.TimeStamp.LowPart;
|
||||||
|
|
||||||
|
SYSTEMTIME st, st_local;
|
||||||
|
FileTimeToSystemTime(&ft, &st);
|
||||||
|
SystemTimeToTzSpecificLocalTime(NULL, &st, &st_local);
|
||||||
|
|
||||||
|
ULONGLONG
|
||||||
|
ts = rec.EventHeader.TimeStamp.QuadPart,
|
||||||
|
nanosec = (ts % 10000000) * 100;
|
||||||
|
|
||||||
|
item.SetColumn(column++);
|
||||||
|
item.SetText(tstring_printf(_T("%04d-%02d-%02d %02d:%02d:%02d.%09I64u"),
|
||||||
|
st_local.wYear, st_local.wMonth, st_local.wDay, st_local.wHour, st_local.wMinute, st_local.wSecond, nanosec));
|
||||||
|
this->InsertItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output process ID.
|
||||||
|
item.SetColumn(column++);
|
||||||
|
item.SetText(wxString::Format(wxT("%u"), rec.EventHeader.ProcessId));
|
||||||
|
this->SetItem(item);
|
||||||
|
|
||||||
|
// Output thread ID.
|
||||||
|
item.SetColumn(column++);
|
||||||
|
item.SetText(wxString::Format(wxT("%u"), rec.EventHeader.ThreadId));
|
||||||
|
this->SetItem(item);
|
||||||
|
|
||||||
|
// Output event source.
|
||||||
|
item.SetColumn(column++);
|
||||||
|
item.SetText(is_ours ? wxT(PRODUCT_NAME_STR) : wxT("EAPHost"));
|
||||||
|
this->SetItem(item);
|
||||||
|
|
||||||
|
item.SetColumn(column++);
|
||||||
|
{
|
||||||
|
// Get event meta-info.
|
||||||
|
unique_ptr<TRACE_EVENT_INFO> info;
|
||||||
|
ULONG ulResult;
|
||||||
|
if ((ulResult = TdhGetEventInformation(&rec, 0, NULL, info)) == ERROR_SUCCESS) {
|
||||||
|
if (info->DecodingSource != DecodingSourceWPP) {
|
||||||
|
if (rec.EventHeader.Flags & EVENT_HEADER_FLAG_STRING_ONLY) {
|
||||||
|
// This is a string-only event. Print it.
|
||||||
|
item.SetText((LPCWSTR)rec.UserData);
|
||||||
|
} else {
|
||||||
|
// This is not a string-only event. Prepare parameters.
|
||||||
|
|
||||||
|
BYTE nPtrSize = (rec.EventHeader.Flags & EVENT_HEADER_FLAG_32_BIT_HEADER) ? 4 : 8;
|
||||||
|
vector<tstring> props;
|
||||||
|
vector<DWORD_PTR> props_msg;
|
||||||
|
props.reserve(info->TopLevelPropertyCount);
|
||||||
|
props_msg.reserve(info->TopLevelPropertyCount);
|
||||||
|
for (ULONG i = 0; i < info->TopLevelPropertyCount; i++) {
|
||||||
|
props.push_back(std::move(PropertyToString(&rec, info.get(), i, NULL, 0, nPtrSize)));
|
||||||
|
props_msg.push_back((DWORD_PTR)props[i].c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info->EventMessageOffset) {
|
||||||
|
// Format the message.
|
||||||
|
item.SetText(wstring_msg(0, (LPCTSTR)((LPCBYTE)info.get() + info->EventMessageOffset), props_msg.data()).c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (info->EventMessageOffset) {
|
||||||
|
// This is a WPP event.
|
||||||
|
item.SetText((LPCWSTR)((LPCBYTE)info.get() + info->EventMessageOffset));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->SetItem(item);
|
||||||
|
|
||||||
|
// Bring the record into view.
|
||||||
|
this->EnsureVisible(item.GetId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// Local helper functions
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
static tstring MapToString(_In_ const EVENT_MAP_INFO *pMapInfo, _In_ LPCBYTE pData)
|
||||||
|
{
|
||||||
|
if ( (pMapInfo->Flag & EVENTMAP_INFO_FLAG_MANIFEST_VALUEMAP) ||
|
||||||
|
((pMapInfo->Flag & EVENTMAP_INFO_FLAG_WBEM_VALUEMAP ) && (pMapInfo->Flag & ~EVENTMAP_INFO_FLAG_WBEM_VALUEMAP) != EVENTMAP_INFO_FLAG_WBEM_FLAG))
|
||||||
|
{
|
||||||
|
if ((pMapInfo->Flag & EVENTMAP_INFO_FLAG_WBEM_NO_MAP) == EVENTMAP_INFO_FLAG_WBEM_NO_MAP)
|
||||||
|
return tstring_printf(_T("%ls"), (PBYTE)pMapInfo + pMapInfo->MapEntryArray[*(PULONG)pData].OutputOffset);
|
||||||
|
else {
|
||||||
|
for (ULONG i = 0; ; i++) {
|
||||||
|
if (i >= pMapInfo->EntryCount)
|
||||||
|
return tstring_printf(_T("%lu"), *(PULONG)pData);
|
||||||
|
else if (pMapInfo->MapEntryArray[i].Value == *(PULONG)pData)
|
||||||
|
return tstring_printf(_T("%ls"), (PBYTE)pMapInfo + pMapInfo->MapEntryArray[i].OutputOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (
|
||||||
|
(pMapInfo->Flag & EVENTMAP_INFO_FLAG_MANIFEST_BITMAP) ||
|
||||||
|
(pMapInfo->Flag & EVENTMAP_INFO_FLAG_WBEM_BITMAP ) ||
|
||||||
|
((pMapInfo->Flag & EVENTMAP_INFO_FLAG_WBEM_VALUEMAP ) && (pMapInfo->Flag & ~EVENTMAP_INFO_FLAG_WBEM_VALUEMAP) == EVENTMAP_INFO_FLAG_WBEM_FLAG))
|
||||||
|
{
|
||||||
|
tstring out;
|
||||||
|
|
||||||
|
if (pMapInfo->Flag & EVENTMAP_INFO_FLAG_WBEM_NO_MAP) {
|
||||||
|
for (ULONG i = 0; i < pMapInfo->EntryCount; i++)
|
||||||
|
if (*(PULONG)pData & (1 << i))
|
||||||
|
out.append(tstring_printf(out.empty() ? _T("%ls") : _T(" | %ls"), (PBYTE)pMapInfo + pMapInfo->MapEntryArray[i].OutputOffset));
|
||||||
|
} else {
|
||||||
|
for (ULONG i = 0; i < pMapInfo->EntryCount; i++)
|
||||||
|
if ((pMapInfo->MapEntryArray[i].Value & *(PULONG)pData) == pMapInfo->MapEntryArray[i].Value)
|
||||||
|
out.append(tstring_printf(out.empty() ? _T("%ls") : _T(" | %ls"), (PBYTE)pMapInfo + pMapInfo->MapEntryArray[i].OutputOffset));
|
||||||
|
}
|
||||||
|
|
||||||
|
return out.empty() ? tstring_printf(_T("%lu"), *(PULONG)pData) : out;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _T("<unknown map>");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static tstring DataToString(_In_ USHORT InType, _In_ USHORT OutType, _In_count_(nDataSize) LPCBYTE pData, _In_ SIZE_T nDataSize, _In_ const EVENT_MAP_INFO *pMapInfo, _In_ BYTE nPtrSize)
|
||||||
|
{
|
||||||
|
assert(pData || !nDataSize);
|
||||||
|
|
||||||
|
switch (InType) {
|
||||||
|
case TDH_INTYPE_UNICODESTRING:
|
||||||
|
case TDH_INTYPE_NONNULLTERMINATEDSTRING:
|
||||||
|
case TDH_INTYPE_UNICODECHAR:
|
||||||
|
return tstring_printf(_T("%.*ls"), nDataSize/sizeof(WCHAR), pData);
|
||||||
|
|
||||||
|
case TDH_INTYPE_ANSISTRING:
|
||||||
|
case TDH_INTYPE_NONNULLTERMINATEDANSISTRING:
|
||||||
|
case TDH_INTYPE_ANSICHAR: {
|
||||||
|
// Convert strings from ANSI code page, all others (JSON, XML etc.) from UTF-8
|
||||||
|
wstring str;
|
||||||
|
MultiByteToWideChar(OutType == TDH_OUTTYPE_STRING ? CP_ACP : CP_UTF8, 0, (LPCSTR)pData, (int)nDataSize, str);
|
||||||
|
return tstring_printf(_T("%ls"), str.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_COUNTEDSTRING:
|
||||||
|
return DataToString(TDH_INTYPE_NONNULLTERMINATEDSTRING, OutType, (LPCBYTE)((PUSHORT)pData + 1), *(PUSHORT)pData, pMapInfo, nPtrSize);
|
||||||
|
|
||||||
|
case TDH_INTYPE_COUNTEDANSISTRING:
|
||||||
|
return DataToString(TDH_INTYPE_NONNULLTERMINATEDANSISTRING, OutType, (LPCBYTE)((PUSHORT)pData + 1), *(PUSHORT)pData, pMapInfo, nPtrSize);
|
||||||
|
|
||||||
|
case TDH_INTYPE_REVERSEDCOUNTEDSTRING:
|
||||||
|
return DataToString(TDH_INTYPE_NONNULLTERMINATEDSTRING, OutType, (LPCBYTE)((PUSHORT)pData + 1), MAKEWORD(HIBYTE(*(PUSHORT)pData), LOBYTE(*(PUSHORT)pData)), pMapInfo, nPtrSize);
|
||||||
|
|
||||||
|
case TDH_INTYPE_REVERSEDCOUNTEDANSISTRING:
|
||||||
|
return DataToString(TDH_INTYPE_NONNULLTERMINATEDANSISTRING, OutType, (LPCBYTE)((PUSHORT)pData + 1), MAKEWORD(HIBYTE(*(PUSHORT)pData), LOBYTE(*(PUSHORT)pData)), pMapInfo, nPtrSize);
|
||||||
|
|
||||||
|
case TDH_INTYPE_INT8:
|
||||||
|
assert(nDataSize >= sizeof(CHAR));
|
||||||
|
switch (OutType) {
|
||||||
|
case TDH_OUTTYPE_STRING: return DataToString(TDH_INTYPE_ANSICHAR, TDH_OUTTYPE_NULL, pData, nDataSize, pMapInfo, nPtrSize);
|
||||||
|
default : return tstring_printf(_T("%hd"), *(PCHAR)pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_UINT8:
|
||||||
|
assert(nDataSize >= sizeof(BYTE));
|
||||||
|
switch (OutType) {
|
||||||
|
case TDH_OUTTYPE_STRING : return DataToString(TDH_INTYPE_ANSICHAR, TDH_OUTTYPE_NULL, pData, nDataSize, pMapInfo, nPtrSize);
|
||||||
|
case TDH_OUTTYPE_HEXINT8: return tstring_printf(_T("0x%x"), *(PBYTE)pData);
|
||||||
|
default : return tstring_printf(_T("%hu" ), *(PBYTE)pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_INT16:
|
||||||
|
assert(nDataSize >= sizeof(SHORT));
|
||||||
|
return tstring_printf(_T("%hd"), *(PSHORT)pData);
|
||||||
|
|
||||||
|
case TDH_INTYPE_UINT16:
|
||||||
|
assert(nDataSize >= sizeof(USHORT));
|
||||||
|
switch (OutType) {
|
||||||
|
case TDH_OUTTYPE_PORT : return tstring_printf(_T("%hu" ), ntohs(*(PUSHORT)pData));
|
||||||
|
case TDH_OUTTYPE_HEXINT16: return tstring_printf(_T("0x%x"), *(PUSHORT)pData );
|
||||||
|
case TDH_OUTTYPE_STRING : return tstring_printf(_T("%lc" ), *(PUSHORT)pData );
|
||||||
|
default : return tstring_printf(_T("%hu" ), *(PUSHORT)pData );
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_INT32:
|
||||||
|
assert(nDataSize >= sizeof(LONG));
|
||||||
|
switch (OutType) {
|
||||||
|
case TDH_OUTTYPE_HRESULT: return tstring_printf(_T("0x%x"), *(PLONG)pData);
|
||||||
|
default : return tstring_printf(_T("%ld" ), *(PLONG)pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_UINT32:
|
||||||
|
assert(nDataSize >= sizeof(ULONG));
|
||||||
|
switch (OutType) {
|
||||||
|
case TDH_OUTTYPE_HRESULT :
|
||||||
|
case TDH_OUTTYPE_WIN32ERROR:
|
||||||
|
case TDH_OUTTYPE_NTSTATUS :
|
||||||
|
case TDH_OUTTYPE_HEXINT32 : return tstring_printf(_T("0x%x" ), *(PULONG)pData);
|
||||||
|
case TDH_OUTTYPE_IPV4 : return tstring_printf(_T("%d.%d.%d.%d"), (*(PULONG)pData >> 0) & 0xff, (*(PULONG)pData >> 8) & 0xff, (*(PULONG)pData >> 16) & 0xff, (*(PULONG)pData >> 24) & 0xff);
|
||||||
|
default: return pMapInfo ? MapToString(pMapInfo, pData) : tstring_printf(_T("%lu"), *(PULONG)pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_HEXINT32:
|
||||||
|
return DataToString(TDH_INTYPE_UINT32, TDH_OUTTYPE_HEXINT32, pData, nDataSize, pMapInfo, nPtrSize);
|
||||||
|
|
||||||
|
case TDH_INTYPE_INT64:
|
||||||
|
assert(nDataSize >= sizeof(LONGLONG));
|
||||||
|
return tstring_printf(_T("%I64d"), *(PLONGLONG)pData);
|
||||||
|
|
||||||
|
case TDH_INTYPE_UINT64:
|
||||||
|
assert(nDataSize >= sizeof(ULONGLONG));
|
||||||
|
switch (OutType) {
|
||||||
|
case TDH_OUTTYPE_HEXINT64: return tstring_printf(_T("0x%I64x"), *(PULONGLONG)pData);
|
||||||
|
default : return tstring_printf(_T("%I64u" ), *(PULONGLONG)pData);
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_HEXINT64:
|
||||||
|
return DataToString(TDH_INTYPE_UINT64, TDH_OUTTYPE_HEXINT64, pData, nDataSize, pMapInfo, nPtrSize);
|
||||||
|
|
||||||
|
case TDH_INTYPE_FLOAT:
|
||||||
|
assert(nDataSize >= sizeof(FLOAT));
|
||||||
|
return tstring_printf(_T("%f"), *(PFLOAT)pData);
|
||||||
|
|
||||||
|
case TDH_INTYPE_DOUBLE:
|
||||||
|
assert(nDataSize >= sizeof(DOUBLE));
|
||||||
|
return tstring_printf(_T("%I64f"), *(DOUBLE*)pData);
|
||||||
|
|
||||||
|
case TDH_INTYPE_BOOLEAN:
|
||||||
|
assert(nDataSize >= sizeof(ULONG)); // Yes, boolean is really 32-bit.
|
||||||
|
return *(PULONG)pData ? _T("true") : _T("false");
|
||||||
|
|
||||||
|
case TDH_INTYPE_BINARY:
|
||||||
|
switch (OutType) {
|
||||||
|
case TDH_OUTTYPE_IPV6: {
|
||||||
|
auto RtlIpv6AddressToString = (LPTSTR(NTAPI*)(const IN6_ADDR*, LPTSTR))GetProcAddress(GetModuleHandle(_T("ntdll.dll")),
|
||||||
|
#ifdef _UNICODE
|
||||||
|
"RtlIpv6AddressToStringW"
|
||||||
|
#else
|
||||||
|
"RtlIpv6AddressToStringA"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
if (RtlIpv6AddressToString) {
|
||||||
|
TCHAR szIPv6Addr[47];
|
||||||
|
RtlIpv6AddressToString((IN6_ADDR*)pData, szIPv6Addr);
|
||||||
|
return tstring_printf(_T("%s"), szIPv6Addr);
|
||||||
|
} else
|
||||||
|
return _T("<IPv6 address>");
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
tstring out;
|
||||||
|
for (SIZE_T i = 0; i < nDataSize; i++)
|
||||||
|
out.append(tstring_printf(i ? _T(" %02x") : _T("%02x"), pData[i]));
|
||||||
|
return out;
|
||||||
|
}}
|
||||||
|
|
||||||
|
case TDH_INTYPE_HEXDUMP:
|
||||||
|
return DataToString(TDH_INTYPE_BINARY, TDH_OUTTYPE_NULL, pData, nDataSize, pMapInfo, nPtrSize);
|
||||||
|
|
||||||
|
case TDH_INTYPE_GUID: {
|
||||||
|
assert(nDataSize >= sizeof(GUID));
|
||||||
|
WCHAR szGuid[39];
|
||||||
|
StringFromGUID2(*(GUID*)pData, szGuid, _countof(szGuid));
|
||||||
|
return tstring_printf(_T("%ls"), szGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_POINTER:
|
||||||
|
assert(nDataSize >= nPtrSize);
|
||||||
|
switch (nPtrSize) {
|
||||||
|
case sizeof(ULONG ): return tstring_printf(_T("0x%08x" ), *(PULONG )pData);
|
||||||
|
case sizeof(ULONGLONG): return tstring_printf(_T("0x%016I64x"), *(PULONGLONG)pData);
|
||||||
|
default: // Unsupported pointer size.
|
||||||
|
assert(0);
|
||||||
|
return _T("<pointer>");
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_SIZET:
|
||||||
|
assert(nDataSize >= nPtrSize);
|
||||||
|
switch (nPtrSize) {
|
||||||
|
case sizeof(ULONG ): return tstring_printf(_T("%u" ), *(PULONG )pData);
|
||||||
|
case sizeof(ULONGLONG): return tstring_printf(_T("%I64u"), *(PULONGLONG)pData);
|
||||||
|
default: // Unsupported size_t size.
|
||||||
|
assert(0);
|
||||||
|
return _T("<size_t>");
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_FILETIME: {
|
||||||
|
assert(nDataSize >= sizeof(FILETIME));
|
||||||
|
SYSTEMTIME st, st_local;
|
||||||
|
FileTimeToSystemTime((PFILETIME)pData, &st);
|
||||||
|
SystemTimeToTzSpecificLocalTime(NULL, &st, &st_local);
|
||||||
|
return DataToString(TDH_INTYPE_SYSTEMTIME, OutType, (LPCBYTE)&st_local, sizeof(st_local), pMapInfo, nPtrSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
case TDH_INTYPE_SYSTEMTIME:
|
||||||
|
assert(nDataSize >= sizeof(SYSTEMTIME));
|
||||||
|
switch (OutType) {
|
||||||
|
case TDH_OUTTYPE_CULTURE_INSENSITIVE_DATETIME: return tstring_printf(_T("%04d-%02d-%02d %02d:%02d:%02d.%03u"), ((PSYSTEMTIME)pData)->wYear, ((PSYSTEMTIME)pData)->wMonth, ((PSYSTEMTIME)pData)->wDay, ((PSYSTEMTIME)pData)->wHour, ((PSYSTEMTIME)pData)->wMinute, ((PSYSTEMTIME)pData)->wSecond, ((PSYSTEMTIME)pData)->wMilliseconds);
|
||||||
|
default: {
|
||||||
|
tstring out;
|
||||||
|
return GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, (PSYSTEMTIME)pData, NULL, out) ? out : tstring(_T("<time>"));
|
||||||
|
}}
|
||||||
|
|
||||||
|
case TDH_INTYPE_WBEMSID:
|
||||||
|
// A WBEM SID is actually a TOKEN_USER structure followed
|
||||||
|
// by the SID. The size of the TOKEN_USER structure differs
|
||||||
|
// depending on whether the events were generated on a 32-bit
|
||||||
|
// or 64-bit architecture. Also the structure is aligned
|
||||||
|
// on an 8-byte boundary, so its size is 8 bytes on a
|
||||||
|
// 32-bit computer and 16 bytes on a 64-bit computer.
|
||||||
|
// Doubling the pointer size handles both cases.
|
||||||
|
assert(nDataSize >= (SIZE_T)nPtrSize * 2);
|
||||||
|
return (PULONG)pData > 0 ? DataToString(TDH_INTYPE_SID, OutType, pData + nPtrSize * 2, nDataSize - nPtrSize * 2, pMapInfo, nPtrSize) : _T("<WBEM SID>");
|
||||||
|
|
||||||
|
case TDH_INTYPE_SID: {
|
||||||
|
assert(nDataSize >= sizeof(SID));
|
||||||
|
tstring user_name, domain_name;
|
||||||
|
SID_NAME_USE eNameUse;
|
||||||
|
if (LookupAccountSid(NULL, (PSID)pData, &user_name, &domain_name, &eNameUse))
|
||||||
|
return tstring_printf(_T("%s\\%s"), domain_name.c_str(), user_name.c_str());
|
||||||
|
else {
|
||||||
|
unique_ptr<TCHAR[], LocalFree_delete<TCHAR[]> > sid;
|
||||||
|
if (GetLastError() == ERROR_NONE_MAPPED &&
|
||||||
|
ConvertSidToStringSid((PSID)pData, (LPTSTR*)&sid))
|
||||||
|
return tstring_printf(_T("%s"), sid.get());
|
||||||
|
else
|
||||||
|
return _T("<SID>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
// It is not actually an error if we do not understand the given data type.
|
||||||
|
assert(0);
|
||||||
|
return _T("<unknown data type>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static ULONG GetArraySize(PEVENT_RECORD pEvent, PTRACE_EVENT_INFO pInfo, ULONG i, ULONG *pulArraySize)
|
||||||
|
{
|
||||||
|
if (pInfo->EventPropertyInfoArray[i].Flags & PropertyParamCount) {
|
||||||
|
ULONG ulResult;
|
||||||
|
|
||||||
|
// Get array count property.
|
||||||
|
PROPERTY_DATA_DESCRIPTOR data_desc = { (ULONGLONG)((LPBYTE)pInfo + pInfo->EventPropertyInfoArray[pInfo->EventPropertyInfoArray[i].countPropertyIndex].NameOffset), ULONG_MAX };
|
||||||
|
vector<unsigned char> count;
|
||||||
|
if ((ulResult = TdhGetProperty(pEvent, 0, NULL, 1, &data_desc, count)) != ERROR_SUCCESS)
|
||||||
|
return ulResult;
|
||||||
|
|
||||||
|
// Copy count value to output.
|
||||||
|
switch (count.size()) {
|
||||||
|
case sizeof(BYTE ): *pulArraySize = *(const BYTE* )count.data(); break;
|
||||||
|
case sizeof(USHORT): *pulArraySize = *(const USHORT*)count.data(); break;
|
||||||
|
case sizeof(ULONG ): *pulArraySize = *(const ULONG* )count.data(); break;
|
||||||
|
default : return ERROR_MORE_DATA;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
*pulArraySize = pInfo->EventPropertyInfoArray[i].count;
|
||||||
|
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static tstring PropertyToString(PEVENT_RECORD pEvent, PTRACE_EVENT_INFO pInfo, ULONG ulPropIndex, LPWSTR pStructureName, ULONG ulStructIndex, BYTE nPtrSize)
|
||||||
|
{
|
||||||
|
ULONG ulResult;
|
||||||
|
|
||||||
|
// Get the size of the array if the property is an array.
|
||||||
|
ULONG ulArraySize = 0;
|
||||||
|
if ((ulResult = GetArraySize(pEvent, pInfo, ulPropIndex, &ulArraySize)) != ERROR_SUCCESS)
|
||||||
|
return tstring_printf(_T("<Error getting array size (error %u)>"), ulResult);;
|
||||||
|
|
||||||
|
tstring out;
|
||||||
|
bool out_nonfirst = false;
|
||||||
|
|
||||||
|
if (pInfo->EventPropertyInfoArray[ulPropIndex].Flags & PropertyParamCount)
|
||||||
|
out += tstring_printf(_T("[%u]("), ulArraySize);
|
||||||
|
|
||||||
|
for (ULONG k = 0; k < ulArraySize; k++) {
|
||||||
|
if (pInfo->EventPropertyInfoArray[ulPropIndex].Flags & PropertyStruct) {
|
||||||
|
// The property is a structure: print the members of the structure.
|
||||||
|
if (out_nonfirst) out += _T(", "); else out_nonfirst = true;
|
||||||
|
out += _T('(');
|
||||||
|
for (USHORT j = pInfo->EventPropertyInfoArray[ulPropIndex].structType.StructStartIndex, usLastMember = pInfo->EventPropertyInfoArray[ulPropIndex].structType.StructStartIndex + pInfo->EventPropertyInfoArray[ulPropIndex].structType.NumOfStructMembers; j < usLastMember; j++) {
|
||||||
|
out += tstring_printf(_T("%ls: "), (LPBYTE)pInfo + pInfo->EventPropertyInfoArray[j].NameOffset);
|
||||||
|
out += PropertyToString(pEvent, pInfo, j, (LPWSTR)((LPBYTE)(pInfo) + pInfo->EventPropertyInfoArray[ulPropIndex].NameOffset), k, nPtrSize);
|
||||||
|
}
|
||||||
|
out += _T(')');
|
||||||
|
} else {
|
||||||
|
if (pInfo->EventPropertyInfoArray[ulPropIndex].nonStructType.InType == TDH_INTYPE_BINARY &&
|
||||||
|
pInfo->EventPropertyInfoArray[ulPropIndex].nonStructType.OutType == TDH_OUTTYPE_IPV6)
|
||||||
|
{
|
||||||
|
// The TDH API does not support IPv6 addresses. If the output type is TDH_OUTTYPE_IPV6,
|
||||||
|
// you will not be able to consume the rest of the event. If you try to consume the
|
||||||
|
// remainder of the event, you will get ERROR_EVT_INVALID_EVENT_DATA.
|
||||||
|
return _T("<The event contains an IPv6 address. Skipping.>");
|
||||||
|
} else {
|
||||||
|
vector<BYTE> data;
|
||||||
|
if (pStructureName) {
|
||||||
|
// To retrieve a member of a structure, you need to specify an array of descriptors.
|
||||||
|
// The first descriptor in the array identifies the name of the structure and the second
|
||||||
|
// descriptor defines the member of the structure whose data you want to retrieve.
|
||||||
|
PROPERTY_DATA_DESCRIPTOR data_desc[2] = {
|
||||||
|
{ (ULONGLONG)pStructureName , ulStructIndex },
|
||||||
|
{ (ULONGLONG)((LPBYTE)pInfo + pInfo->EventPropertyInfoArray[ulPropIndex].NameOffset), k }
|
||||||
|
};
|
||||||
|
ulResult = TdhGetProperty(pEvent, 0, NULL, _countof(data_desc), data_desc, data);
|
||||||
|
} else {
|
||||||
|
PROPERTY_DATA_DESCRIPTOR data_desc = { (ULONGLONG)((LPBYTE)pInfo + pInfo->EventPropertyInfoArray[ulPropIndex].NameOffset), k };
|
||||||
|
ulResult = TdhGetProperty(pEvent, 0, NULL, 1, &data_desc, data);
|
||||||
|
}
|
||||||
|
if (ulResult == ERROR_EVT_INVALID_EVENT_DATA) {
|
||||||
|
// This happens with empty/NULL data. Not an error actually.
|
||||||
|
assert(data.empty());
|
||||||
|
} else if (ulResult != ERROR_SUCCESS)
|
||||||
|
return tstring_printf(_T("<Error getting property (error %u)>"), ulResult);
|
||||||
|
|
||||||
|
// Get the name/value mapping if the property specifies a value map.
|
||||||
|
unique_ptr<EVENT_MAP_INFO> map_info;
|
||||||
|
ulResult = TdhGetEventMapInformation(pEvent, (LPWSTR)((LPBYTE)pInfo + pInfo->EventPropertyInfoArray[ulPropIndex].nonStructType.MapNameOffset), map_info);
|
||||||
|
if (ulResult == ERROR_NOT_FOUND) {
|
||||||
|
// name/value mapping not found. Not an error actually.
|
||||||
|
assert(!map_info);
|
||||||
|
} else if (ulResult != ERROR_SUCCESS)
|
||||||
|
return tstring_printf(_T("<Error getting map information (error %u)>"), ulResult);
|
||||||
|
else if (pInfo->DecodingSource == DecodingSourceXMLFile) {
|
||||||
|
// The mapped string values defined in a manifest will contain a trailing space
|
||||||
|
// in the EVENT_MAP_ENTRY structure. Replace the trailing space with a null-
|
||||||
|
// terminating character, so that the bit mapped strings are correctly formatted.
|
||||||
|
for (ULONG i = 0; i < map_info->EntryCount; i++) {
|
||||||
|
SIZE_T len = _tcslen((LPCTSTR)((PBYTE)map_info.get() + map_info->MapEntryArray[i].OutputOffset)) - 1;
|
||||||
|
((LPWSTR)((PBYTE)map_info.get() + map_info->MapEntryArray[i].OutputOffset))[len] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (out_nonfirst) out += _T(", "); else out_nonfirst = true;
|
||||||
|
out += !data.empty() ? DataToString(
|
||||||
|
pInfo->EventPropertyInfoArray[ulPropIndex].nonStructType.InType,
|
||||||
|
pInfo->EventPropertyInfoArray[ulPropIndex].nonStructType.OutType,
|
||||||
|
data.data(),
|
||||||
|
data.size(),
|
||||||
|
map_info.get(),
|
||||||
|
nPtrSize) : _T("<null>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pInfo->EventPropertyInfoArray[ulPropIndex].Flags & PropertyParamCount)
|
||||||
|
out += _T(')');
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
136
EventMonitor/ETWLog.h
Normal file
136
EventMonitor/ETWLog.h
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 G<>ANT
|
||||||
|
|
||||||
|
This file is part of G<>ANTLink.
|
||||||
|
|
||||||
|
G<>ANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
G<>ANTLink 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 G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <wx/event.h>
|
||||||
|
|
||||||
|
///
|
||||||
|
/// ETW event
|
||||||
|
///
|
||||||
|
class wxETWEvent;
|
||||||
|
wxDECLARE_EVENT(wxEVT_ETW_EVENT, wxETWEvent);
|
||||||
|
#define wxETWEventHandler(func) wxEVENT_HANDLER_CAST(wxETWEventFunction, func)
|
||||||
|
#define EVT_ETW_EVENT(func) wx__DECLARE_EVT0(wxEVT_ETW_EVENT, wxETWEventHandler(func))
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Event list control
|
||||||
|
///
|
||||||
|
class wxETWListCtrl;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Event trace processor
|
||||||
|
///
|
||||||
|
class wxEventTraceProcessorThread;
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <wx/listctrl.h>
|
||||||
|
#include <wx/thread.h>
|
||||||
|
|
||||||
|
#include <WinStd/ETW.h>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
class wxETWEvent : public wxEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxETWEvent(wxEventType type = wxEVT_NULL, const EVENT_RECORD &record = s_record_null);
|
||||||
|
wxETWEvent(const wxETWEvent& event);
|
||||||
|
virtual ~wxETWEvent();
|
||||||
|
virtual wxEvent *Clone() const { return new wxETWEvent(*this); }
|
||||||
|
|
||||||
|
inline const EVENT_RECORD& GetRecord() const { return m_record; }
|
||||||
|
inline EVENT_RECORD& GetRecord() { return m_record; }
|
||||||
|
|
||||||
|
inline const EVENT_HEADER& GetHeader() const { return m_record.EventHeader; }
|
||||||
|
|
||||||
|
inline const ETW_BUFFER_CONTEXT& GetBufferContext() const { return m_record.BufferContext; }
|
||||||
|
|
||||||
|
bool SetExtendedData(size_t extended_data_count, const EVENT_HEADER_EXTENDED_DATA_ITEM *extended_data);
|
||||||
|
inline size_t GetExtendedDataCount() const { return m_record.ExtendedDataCount; }
|
||||||
|
inline const EVENT_HEADER_EXTENDED_DATA_ITEM& GetExtendedData(size_t index) const { wxASSERT(index < m_record.ExtendedDataCount); return m_record.ExtendedData[index]; }
|
||||||
|
|
||||||
|
bool SetUserData(size_t user_data_length, const void *user_data);
|
||||||
|
inline size_t GetUserDataLength() const { return m_record.UserDataLength; }
|
||||||
|
inline void *GetUserData() const { return m_record.UserData; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool DoSetExtendedData(size_t extended_data_count, const EVENT_HEADER_EXTENDED_DATA_ITEM *extended_data);
|
||||||
|
bool DoSetUserData(size_t user_data_length, const void *user_data);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxETWEvent)
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const EVENT_RECORD s_record_null;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EVENT_RECORD m_record; ///< ETW event record
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
typedef void (wxEvtHandler::*wxETWEventFunction)(wxETWEvent&);
|
||||||
|
|
||||||
|
|
||||||
|
class wxEventTraceProcessorThread : public wxThread
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxEventTraceProcessorThread(wxEvtHandler *parent, const wxArrayString &sessions);
|
||||||
|
virtual ~wxEventTraceProcessorThread();
|
||||||
|
|
||||||
|
void Abort();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ExitCode Entry();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static VOID WINAPI EventRecordCallback(PEVENT_RECORD pEvent);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<TRACEHANDLE> m_traces; ///< An array of tracing sessions this thread is monitoring
|
||||||
|
wxEvtHandler *m_parent; ///< Pointer to the event handler this thread is sending record notifications
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class wxETWListCtrl : public wxListCtrl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxETWListCtrl(
|
||||||
|
wxWindow *parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint &pos = wxDefaultPosition,
|
||||||
|
const wxSize &size = wxDefaultSize,
|
||||||
|
long style = wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxNO_BORDER,
|
||||||
|
const wxValidator &validator = wxDefaultValidator,
|
||||||
|
const wxString &name = wxListCtrlNameStr);
|
||||||
|
virtual ~wxETWListCtrl();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void OnETWEvent(wxETWEvent& event);
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const GUID s_provider_eaphost; ///< EAPHost event provider ID
|
||||||
|
|
||||||
|
protected:
|
||||||
|
winstd::event_session m_session; ///< Event session
|
||||||
|
wxEventTraceProcessorThread *m_proc; ///< Processor thread
|
||||||
|
long m_item_id; ///< Next free list item ID
|
||||||
|
};
|
17
EventMonitor/EventMonitor.props
Normal file
17
EventMonitor/EventMonitor.props
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Label="PropertySheets" />
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>..\lib\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\lib\WinStd\include;..\lib\wxExtend\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
</Project>
|
BIN
EventMonitor/EventMonitor.rc
Normal file
BIN
EventMonitor/EventMonitor.rc
Normal file
Binary file not shown.
128
EventMonitor/EventMonitor.vcxproj
Normal file
128
EventMonitor/EventMonitor.vcxproj
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>EventMonitor</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\include\Win32.props" />
|
||||||
|
<Import Project="..\include\Debug.props" />
|
||||||
|
<Import Project="EventMonitor.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\include\x64.props" />
|
||||||
|
<Import Project="..\include\Debug.props" />
|
||||||
|
<Import Project="EventMonitor.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\include\Win32.props" />
|
||||||
|
<Import Project="..\include\Release.props" />
|
||||||
|
<Import Project="EventMonitor.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\include\x64.props" />
|
||||||
|
<Import Project="..\include\Release.props" />
|
||||||
|
<Import Project="EventMonitor.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="EventMonitor.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="App.h" />
|
||||||
|
<ClInclude Include="ETWLog.h" />
|
||||||
|
<ClInclude Include="Frame.h" />
|
||||||
|
<ClInclude Include="LogPanel.h" />
|
||||||
|
<ClInclude Include="StdAfx.h" />
|
||||||
|
<ClInclude Include="wxEventMonitor_UI.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="App.cpp" />
|
||||||
|
<ClCompile Include="ETWLog.cpp" />
|
||||||
|
<ClCompile Include="Frame.cpp" />
|
||||||
|
<ClCompile Include="LogPanel.cpp" />
|
||||||
|
<ClCompile Include="StdAfx.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="wxEventMonitor_UI.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\lib\Events\build\Events.vcxproj">
|
||||||
|
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
|
||||||
|
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\lib\wxExtend\build\wxExtendLib.vcxproj">
|
||||||
|
<Project>{d3e29951-d9f5-486d-a167-20ae8e90b1fa}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="locale\EventMonitor.pot" />
|
||||||
|
<None Include="res\EventMonitor.ico" />
|
||||||
|
<None Include="wxEventMonitor_UI.fbp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
77
EventMonitor/EventMonitor.vcxproj.filters
Normal file
77
EventMonitor/EventMonitor.vcxproj.filters
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files\Localization">
|
||||||
|
<UniqueIdentifier>{e43059ae-37ac-4b28-84fb-18d1b3972b30}</UniqueIdentifier>
|
||||||
|
<Extensions>po;pot</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="EventMonitor.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="StdAfx.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="App.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="wxEventMonitor_UI.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Frame.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="LogPanel.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ETWLog.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="StdAfx.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="App.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="wxEventMonitor_UI.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Frame.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="LogPanel.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="ETWLog.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="wxEventMonitor_UI.fbp">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="locale\EventMonitor.pot">
|
||||||
|
<Filter>Resource Files\Localization</Filter>
|
||||||
|
</None>
|
||||||
|
<None Include="res\EventMonitor.ico">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
86
EventMonitor/Frame.cpp
Normal file
86
EventMonitor/Frame.cpp
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 G<>ANT
|
||||||
|
|
||||||
|
This file is part of G<>ANTLink.
|
||||||
|
|
||||||
|
G<>ANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
G<>ANTLink 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 G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// wxEventMonitorFrame
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
wxBEGIN_EVENT_TABLE(wxEventMonitorFrame, wxEventMonitorFrameBase)
|
||||||
|
EVT_MENU(wxID_EXIT, wxEventMonitorFrame::OnExit)
|
||||||
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
wxEventMonitorFrame::wxEventMonitorFrame() : wxEventMonitorFrameBase(NULL)
|
||||||
|
{
|
||||||
|
// Load main window icons.
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
wxIcon icon_small(wxT("00_EventMonitor.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON));
|
||||||
|
wxIconBundle icons;
|
||||||
|
icons.AddIcon(icon_small);
|
||||||
|
icons.AddIcon(wxIcon(wxT("00_EventMonitor.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON), ::GetSystemMetrics(SM_CYICON)));
|
||||||
|
SetIcons(icons);
|
||||||
|
#else
|
||||||
|
wxIcon icon_small(wxICON(00_EventMonitor.ico));
|
||||||
|
SetIcon(icon_small);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Restore persistent state of wxAuiManager manually, since m_mgr is not on the heap.
|
||||||
|
wxPersistentAuiManager(&m_mgr).Restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxEventMonitorFrame::OnExit(wxCommandEvent& /*event*/)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// wxPersistentEventMonitorFrame
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
wxPersistentEventMonitorFrame::wxPersistentEventMonitorFrame(wxEventMonitorFrame *wnd) : wxPersistentTLW(wnd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxPersistentEventMonitorFrame::Save() const
|
||||||
|
{
|
||||||
|
const wxEventMonitorFrame * const wnd = static_cast<const wxEventMonitorFrame*>(GetWindow());
|
||||||
|
|
||||||
|
wxPersistentEventMonitorLogPanel(wnd->m_panel).Save();
|
||||||
|
|
||||||
|
wxPersistentTLW::Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wxPersistentEventMonitorFrame::Restore()
|
||||||
|
{
|
||||||
|
const bool r = wxPersistentTLW::Restore();
|
||||||
|
|
||||||
|
wxEventMonitorFrame * const wnd = static_cast<wxEventMonitorFrame*>(GetWindow());
|
||||||
|
|
||||||
|
wxPersistentEventMonitorLogPanel(wnd->m_panel).Restore();
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
63
EventMonitor/Frame.h
Normal file
63
EventMonitor/Frame.h
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 G<>ANT
|
||||||
|
|
||||||
|
This file is part of G<>ANTLink.
|
||||||
|
|
||||||
|
G<>ANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
G<>ANTLink 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 G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
///
|
||||||
|
/// EventMonitor main frame
|
||||||
|
///
|
||||||
|
class wxEventMonitorFrame;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Supports saving/restoring wxEventMonitorFrame GUI state
|
||||||
|
///
|
||||||
|
class wxPersistentEventMonitorFrame;
|
||||||
|
|
||||||
|
#pragma once;
|
||||||
|
|
||||||
|
#include "wxEventMonitor_UI.h"
|
||||||
|
#include <wx/persist/toplevel.h>
|
||||||
|
|
||||||
|
|
||||||
|
class wxEventMonitorFrame : public wxEventMonitorFrameBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxEventMonitorFrame();
|
||||||
|
|
||||||
|
friend class wxPersistentEventMonitorFrame;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void OnExit(wxCommandEvent& event);
|
||||||
|
wxDECLARE_EVENT_TABLE();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class wxPersistentEventMonitorFrame : public wxPersistentTLW
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxPersistentEventMonitorFrame(wxEventMonitorFrame *wnd);
|
||||||
|
|
||||||
|
virtual void Save() const;
|
||||||
|
virtual bool Restore();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline wxPersistentObject *wxCreatePersistentObject(wxEventMonitorFrame *wnd)
|
||||||
|
{
|
||||||
|
return new wxPersistentEventMonitorFrame(wnd);
|
||||||
|
}
|
80
EventMonitor/LogPanel.cpp
Normal file
80
EventMonitor/LogPanel.cpp
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 G<>ANT
|
||||||
|
|
||||||
|
This file is part of G<>ANTLink.
|
||||||
|
|
||||||
|
G<>ANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
G<>ANTLink 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 G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// wxEventMonitorLogPanel
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
wxEventMonitorLogPanel::wxEventMonitorLogPanel(wxWindow* parent) : wxEventMonitorLogPanelBase(parent)
|
||||||
|
{
|
||||||
|
// Set focus.
|
||||||
|
m_log->SetFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// wxPersistentEventMonitorLogPanel
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
wxPersistentEventMonitorLogPanel::wxPersistentEventMonitorLogPanel(wxEventMonitorLogPanel *wnd) : wxPersistentWindow<wxEventMonitorLogPanel>(wnd)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString wxPersistentEventMonitorLogPanel::GetKind() const
|
||||||
|
{
|
||||||
|
return wxT(wxPERSIST_TLW_KIND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxPersistentEventMonitorLogPanel::Save() const
|
||||||
|
{
|
||||||
|
const wxEventMonitorLogPanel * const wnd = static_cast<const wxEventMonitorLogPanel*>(GetWindow());
|
||||||
|
|
||||||
|
// Save log's column widths.
|
||||||
|
wxListItem col;
|
||||||
|
col.SetMask(wxLIST_MASK_TEXT | wxLIST_MASK_WIDTH);
|
||||||
|
for (int i = 0, n = wnd->m_log->GetColumnCount(); i < n; i++) {
|
||||||
|
wnd->m_log->GetColumn(i, col);
|
||||||
|
SaveValue(wxString::Format(wxT("Column%sWidth"), col.GetText().c_str()), col.GetWidth());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool wxPersistentEventMonitorLogPanel::Restore()
|
||||||
|
{
|
||||||
|
wxEventMonitorLogPanel * const wnd = static_cast<wxEventMonitorLogPanel*>(GetWindow());
|
||||||
|
|
||||||
|
// Restore log's column widths.
|
||||||
|
wxListItem col;
|
||||||
|
col.SetMask(wxLIST_MASK_TEXT);
|
||||||
|
for (int i = 0, n = wnd->m_log->GetColumnCount(); i < n; i++) {
|
||||||
|
wnd->m_log->GetColumn(i, col);
|
||||||
|
|
||||||
|
int width;
|
||||||
|
if (RestoreValue(wxString::Format(wxT("Column%sWidth"), col.GetText().c_str()), &width))
|
||||||
|
wnd->m_log->SetColumnWidth(i, width);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
60
EventMonitor/LogPanel.h
Normal file
60
EventMonitor/LogPanel.h
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 G<>ANT
|
||||||
|
|
||||||
|
This file is part of G<>ANTLink.
|
||||||
|
|
||||||
|
G<>ANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
G<>ANTLink 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 G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
///
|
||||||
|
/// EventMonitor trace log panel
|
||||||
|
///
|
||||||
|
class wxEventMonitorLogPanel;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Supports saving/restoring wxEventMonitorLogPanel state
|
||||||
|
///
|
||||||
|
class wxPersistentEventMonitorLogPanel;
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "wxEventMonitor_UI.h"
|
||||||
|
#include <wx/persist/window.h>
|
||||||
|
|
||||||
|
|
||||||
|
class wxEventMonitorLogPanel : public wxEventMonitorLogPanelBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxEventMonitorLogPanel(wxWindow* parent);
|
||||||
|
|
||||||
|
friend class wxPersistentEventMonitorLogPanel; // Allow saving/restoring window state.
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class wxPersistentEventMonitorLogPanel : public wxPersistentWindow<wxEventMonitorLogPanel>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxPersistentEventMonitorLogPanel(wxEventMonitorLogPanel *wnd);
|
||||||
|
|
||||||
|
virtual wxString GetKind() const;
|
||||||
|
virtual void Save() const;
|
||||||
|
virtual bool Restore();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
inline wxPersistentObject *wxCreatePersistentObject(wxEventMonitorLogPanel *wnd)
|
||||||
|
{
|
||||||
|
return new wxPersistentEventMonitorLogPanel(wnd);
|
||||||
|
}
|
9
EventMonitor/MSIBuild/.gitignore
vendored
Normal file
9
EventMonitor/MSIBuild/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/*-1.idt
|
||||||
|
/*-2.idt
|
||||||
|
/*-2.idtx
|
||||||
|
/*.Binary-1
|
||||||
|
/*.Binary-2
|
||||||
|
/*.Icon-1
|
||||||
|
/*.Icon-2
|
||||||
|
/*.lst
|
||||||
|
/*.msm
|
BIN
EventMonitor/MSIBuild/Makefile
Normal file
BIN
EventMonitor/MSIBuild/Makefile
Normal file
Binary file not shown.
21
EventMonitor/StdAfx.cpp
Normal file
21
EventMonitor/StdAfx.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
48
EventMonitor/StdAfx.h
Normal file
48
EventMonitor/StdAfx.h
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "App.h"
|
||||||
|
#include "ETWLog.h"
|
||||||
|
#include "Frame.h"
|
||||||
|
#include "LogPanel.h"
|
||||||
|
|
||||||
|
#include "../include/Version.h"
|
||||||
|
|
||||||
|
#include <wxex/common.h>
|
||||||
|
#include <wxex/persist/auimanager.h>
|
||||||
|
|
||||||
|
#include <WinStd/COM.h>
|
||||||
|
#include <WinStd/ETW.h>
|
||||||
|
#include <WinStd/Win.h>
|
||||||
|
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <Msi.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include <in6addr.h>
|
||||||
|
#include <MSTcpIP.h>
|
||||||
|
#include <Sddl.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <EventsETW.h> // Must include after <Windows.h>
|
47
EventMonitor/locale/EventMonitor.pot
Normal file
47
EventMonitor/locale/EventMonitor.pot
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: EventMonitor\n"
|
||||||
|
"POT-Creation-Date: 2016-07-15 13:05+0200\n"
|
||||||
|
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
|
||||||
|
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||||
|
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 1.8.8\n"
|
||||||
|
"X-Poedit-Basepath: ..\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"Language: en_US\n"
|
||||||
|
"X-Poedit-SourceCharset: UTF-8\n"
|
||||||
|
"X-Poedit-KeywordsList: _\n"
|
||||||
|
"X-Poedit-SearchPath-0: .\n"
|
||||||
|
|
||||||
|
#: App.cpp:69 wxEventMonitor_UI.h:54
|
||||||
|
msgid "Event Monitor"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: LogPanel.cpp:30
|
||||||
|
msgid "Time"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: LogPanel.cpp:31
|
||||||
|
msgid "Source"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: wxEventMonitor_UI.cpp:23
|
||||||
|
msgid "E&xit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: wxEventMonitor_UI.cpp:23
|
||||||
|
msgid "Quit this program"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: wxEventMonitor_UI.cpp:26
|
||||||
|
#, fuzzy
|
||||||
|
msgid "&Program"
|
||||||
|
msgstr "You don't have %s subscription yet."
|
||||||
|
|
||||||
|
#: wxEventMonitor_UI.cpp:32
|
||||||
|
msgid "Log Trace"
|
||||||
|
msgstr ""
|
BIN
EventMonitor/res/EventMonitor.ico
Normal file
BIN
EventMonitor/res/EventMonitor.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 121 KiB |
1233
EventMonitor/res/EventMonitor.pdf
Normal file
1233
EventMonitor/res/EventMonitor.pdf
Normal file
File diff suppressed because one or more lines are too long
74
EventMonitor/wxEventMonitor_UI.cpp
Normal file
74
EventMonitor/wxEventMonitor_UI.cpp
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||||
|
// http://www.wxformbuilder.org/
|
||||||
|
//
|
||||||
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
#include "ETWLog.h"
|
||||||
|
|
||||||
|
#include "wxEventMonitor_UI.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
wxEventMonitorFrameBase::wxEventMonitorFrameBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxFrame( parent, id, title, pos, size, style, name )
|
||||||
|
{
|
||||||
|
this->SetSizeHints( wxSize( 150,150 ), wxDefaultSize );
|
||||||
|
m_mgr.SetManagedWindow(this);
|
||||||
|
m_mgr.SetFlags(wxAUI_MGR_DEFAULT);
|
||||||
|
|
||||||
|
m_menubar = new wxMenuBar( 0 );
|
||||||
|
m_menuProgram = new wxMenu();
|
||||||
|
wxMenuItem* m_menuItemExit;
|
||||||
|
m_menuItemExit = new wxMenuItem( m_menuProgram, wxID_EXIT, wxString( _("E&xit") ) + wxT('\t') + wxT("Alt+F4"), _("Quit this program"), wxITEM_NORMAL );
|
||||||
|
m_menuProgram->Append( m_menuItemExit );
|
||||||
|
|
||||||
|
m_menubar->Append( m_menuProgram, _("&Program") );
|
||||||
|
|
||||||
|
this->SetMenuBar( m_menubar );
|
||||||
|
|
||||||
|
m_panel = new wxEventMonitorLogPanel( this );
|
||||||
|
|
||||||
|
m_mgr.AddPane( m_panel, wxAuiPaneInfo() .Name( wxT("LogPanel") ).Center() .Caption( _("Log Trace") ).CaptionVisible( false ).CloseButton( false ).PaneBorder( false ).Dock().Resizable().FloatingSize( wxDefaultSize ).Floatable( false ) );
|
||||||
|
|
||||||
|
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
|
||||||
|
|
||||||
|
m_mgr.Update();
|
||||||
|
this->Centre( wxBOTH );
|
||||||
|
|
||||||
|
// Connect Events
|
||||||
|
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( wxEventMonitorFrameBase::OnClose ) );
|
||||||
|
this->Connect( wxEVT_ICONIZE, wxIconizeEventHandler( wxEventMonitorFrameBase::OnIconize ) );
|
||||||
|
this->Connect( wxEVT_IDLE, wxIdleEventHandler( wxEventMonitorFrameBase::OnIdle ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxEventMonitorFrameBase::~wxEventMonitorFrameBase()
|
||||||
|
{
|
||||||
|
// Disconnect Events
|
||||||
|
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( wxEventMonitorFrameBase::OnClose ) );
|
||||||
|
this->Disconnect( wxEVT_ICONIZE, wxIconizeEventHandler( wxEventMonitorFrameBase::OnIconize ) );
|
||||||
|
this->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxEventMonitorFrameBase::OnIdle ) );
|
||||||
|
|
||||||
|
m_mgr.UnInit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
wxEventMonitorLogPanelBase::wxEventMonitorLogPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||||
|
{
|
||||||
|
wxBoxSizer* bSizerMain;
|
||||||
|
bSizerMain = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
m_log = new wxETWListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxNO_BORDER );
|
||||||
|
bSizerMain->Add( m_log, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
this->SetSizer( bSizerMain );
|
||||||
|
this->Layout();
|
||||||
|
bSizerMain->Fit( this );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxEventMonitorLogPanelBase::~wxEventMonitorLogPanelBase()
|
||||||
|
{
|
||||||
|
}
|
449
EventMonitor/wxEventMonitor_UI.fbp
Normal file
449
EventMonitor/wxEventMonitor_UI.fbp
Normal file
@@ -0,0 +1,449 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
|
<wxFormBuilder_Project>
|
||||||
|
<FileVersion major="1" minor="13" />
|
||||||
|
<object class="Project" expanded="1">
|
||||||
|
<property name="class_decoration"></property>
|
||||||
|
<property name="code_generation">C++</property>
|
||||||
|
<property name="disconnect_events">1</property>
|
||||||
|
<property name="disconnect_mode">source_name</property>
|
||||||
|
<property name="disconnect_php_events">0</property>
|
||||||
|
<property name="disconnect_python_events">0</property>
|
||||||
|
<property name="embedded_files_path">.</property>
|
||||||
|
<property name="encoding">UTF-8</property>
|
||||||
|
<property name="event_generation">connect</property>
|
||||||
|
<property name="file">wxEventMonitor_UI</property>
|
||||||
|
<property name="first_id">1000</property>
|
||||||
|
<property name="help_provider">none</property>
|
||||||
|
<property name="internationalize">1</property>
|
||||||
|
<property name="name">wxEventMonitor_UI</property>
|
||||||
|
<property name="namespace"></property>
|
||||||
|
<property name="path">.</property>
|
||||||
|
<property name="precompiled_header">#include "StdAfx.h"</property>
|
||||||
|
<property name="relative_path">1</property>
|
||||||
|
<property name="skip_lua_events">1</property>
|
||||||
|
<property name="skip_php_events">1</property>
|
||||||
|
<property name="skip_python_events">1</property>
|
||||||
|
<property name="ui_table">UI</property>
|
||||||
|
<property name="use_enum">1</property>
|
||||||
|
<property name="use_microsoft_bom">1</property>
|
||||||
|
<object class="Frame" expanded="1">
|
||||||
|
<property name="aui_managed">1</property>
|
||||||
|
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="center">wxBOTH</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="event_handler">impl_virtual</property>
|
||||||
|
<property name="extra_style"></property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="minimum_size">150,150</property>
|
||||||
|
<property name="name">wxEventMonitorFrameBase</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="size">600,400</property>
|
||||||
|
<property name="style">wxDEFAULT_FRAME_STYLE</property>
|
||||||
|
<property name="subclass"></property>
|
||||||
|
<property name="title">Event Monitor</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name">EventMonitor</property>
|
||||||
|
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||||
|
<property name="xrc_skip_sizer">1</property>
|
||||||
|
<event name="OnActivate"></event>
|
||||||
|
<event name="OnActivateApp"></event>
|
||||||
|
<event name="OnAuiFindManager"></event>
|
||||||
|
<event name="OnAuiPaneButton"></event>
|
||||||
|
<event name="OnAuiPaneClose"></event>
|
||||||
|
<event name="OnAuiPaneMaximize"></event>
|
||||||
|
<event name="OnAuiPaneRestore"></event>
|
||||||
|
<event name="OnAuiRender"></event>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnClose">OnClose</event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnHibernate"></event>
|
||||||
|
<event name="OnIconize">OnIconize</event>
|
||||||
|
<event name="OnIdle">OnIdle</event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
<object class="wxMenuBar" expanded="1">
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="label">Menu</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">m_menubar</property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="style"></property>
|
||||||
|
<property name="subclass"></property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
<object class="wxMenu" expanded="1">
|
||||||
|
<property name="label">&Program</property>
|
||||||
|
<property name="name">m_menuProgram</property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<object class="wxMenuItem" expanded="0">
|
||||||
|
<property name="bitmap"></property>
|
||||||
|
<property name="checked">0</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="help">Quit this program</property>
|
||||||
|
<property name="id">wxID_EXIT</property>
|
||||||
|
<property name="kind">wxITEM_NORMAL</property>
|
||||||
|
<property name="label">E&xit</property>
|
||||||
|
<property name="name">m_menuItemExit</property>
|
||||||
|
<property name="permission">none</property>
|
||||||
|
<property name="shortcut">Alt+F4</property>
|
||||||
|
<property name="unchecked_bitmap"></property>
|
||||||
|
<event name="OnMenuSelection"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="CustomControl" expanded="0">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer"></property>
|
||||||
|
<property name="aui_name">LogPanel</property>
|
||||||
|
<property name="aui_position"></property>
|
||||||
|
<property name="aui_row"></property>
|
||||||
|
<property name="best_size"></property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="caption">Log Trace</property>
|
||||||
|
<property name="caption_visible">0</property>
|
||||||
|
<property name="center_pane">0</property>
|
||||||
|
<property name="class">wxEventMonitorLogPanel</property>
|
||||||
|
<property name="close_button">0</property>
|
||||||
|
<property name="construction">m_panel = new wxEventMonitorLogPanel( this );
</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="declaration">wxEventMonitorLogPanel* m_panel;</property>
|
||||||
|
<property name="default_pane">0</property>
|
||||||
|
<property name="dock">Dock</property>
|
||||||
|
<property name="dock_fixed">0</property>
|
||||||
|
<property name="docking">Center</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="floatable">0</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="include">class wxEventMonitorLogPanel;</property>
|
||||||
|
<property name="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">m_panel</property>
|
||||||
|
<property name="pane_border">0</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
|
<property name="permission">public</property>
|
||||||
|
<property name="pin_button">0</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="settings"></property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="subclass"></property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
<object class="wxStatusBar" expanded="0">
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="fields">1</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">m_statusBar</property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="style">wxST_SIZEGRIP</property>
|
||||||
|
<property name="subclass"></property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="Panel" expanded="1">
|
||||||
|
<property name="aui_managed">0</property>
|
||||||
|
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="event_handler">impl_virtual</property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">wxEventMonitorLogPanelBase</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="size">-1,-1</property>
|
||||||
|
<property name="subclass"></property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name">EventMonitorLogPanel</property>
|
||||||
|
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||||
|
<event name="OnAuiFindManager"></event>
|
||||||
|
<event name="OnAuiPaneButton"></event>
|
||||||
|
<event name="OnAuiPaneClose"></event>
|
||||||
|
<event name="OnAuiPaneMaximize"></event>
|
||||||
|
<event name="OnAuiPaneRestore"></event>
|
||||||
|
<event name="OnAuiRender"></event>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnInitDialog"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
<object class="wxBoxSizer" expanded="1">
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">bSizerMain</property>
|
||||||
|
<property name="orient">wxVERTICAL</property>
|
||||||
|
<property name="permission">none</property>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxEXPAND</property>
|
||||||
|
<property name="proportion">1</property>
|
||||||
|
<object class="wxListCtrl" expanded="1">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer"></property>
|
||||||
|
<property name="aui_name"></property>
|
||||||
|
<property name="aui_position"></property>
|
||||||
|
<property name="aui_row"></property>
|
||||||
|
<property name="best_size"></property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="caption"></property>
|
||||||
|
<property name="caption_visible">1</property>
|
||||||
|
<property name="center_pane">0</property>
|
||||||
|
<property name="close_button">1</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="default_pane">0</property>
|
||||||
|
<property name="dock">Dock</property>
|
||||||
|
<property name="dock_fixed">0</property>
|
||||||
|
<property name="docking">Left</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="floatable">1</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">m_log</property>
|
||||||
|
<property name="pane_border">1</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="pin_button">1</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="style">wxLC_NO_SORT_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL</property>
|
||||||
|
<property name="subclass">wxETWListCtrl; ETWLog.h</property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="validator_data_type"></property>
|
||||||
|
<property name="validator_style">wxFILTER_NONE</property>
|
||||||
|
<property name="validator_type">wxDefaultValidator</property>
|
||||||
|
<property name="validator_variable"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style">wxNO_BORDER</property>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnListBeginDrag"></event>
|
||||||
|
<event name="OnListBeginLabelEdit"></event>
|
||||||
|
<event name="OnListBeginRDrag"></event>
|
||||||
|
<event name="OnListCacheHint"></event>
|
||||||
|
<event name="OnListColBeginDrag"></event>
|
||||||
|
<event name="OnListColClick"></event>
|
||||||
|
<event name="OnListColDragging"></event>
|
||||||
|
<event name="OnListColEndDrag"></event>
|
||||||
|
<event name="OnListColRightClick"></event>
|
||||||
|
<event name="OnListDeleteAllItems"></event>
|
||||||
|
<event name="OnListDeleteItem"></event>
|
||||||
|
<event name="OnListEndLabelEdit"></event>
|
||||||
|
<event name="OnListInsertItem"></event>
|
||||||
|
<event name="OnListItemActivated"></event>
|
||||||
|
<event name="OnListItemDeselected"></event>
|
||||||
|
<event name="OnListItemFocused"></event>
|
||||||
|
<event name="OnListItemMiddleClick"></event>
|
||||||
|
<event name="OnListItemRightClick"></event>
|
||||||
|
<event name="OnListItemSelected"></event>
|
||||||
|
<event name="OnListKeyDown"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</wxFormBuilder_Project>
|
80
EventMonitor/wxEventMonitor_UI.h
Normal file
80
EventMonitor/wxEventMonitor_UI.h
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++ code generated with wxFormBuilder (version Jun 17 2015)
|
||||||
|
// http://www.wxformbuilder.org/
|
||||||
|
//
|
||||||
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __WXEVENTMONITOR_UI_H__
|
||||||
|
#define __WXEVENTMONITOR_UI_H__
|
||||||
|
|
||||||
|
#include <wx/artprov.h>
|
||||||
|
#include <wx/xrc/xmlres.h>
|
||||||
|
#include <wx/intl.h>
|
||||||
|
class wxETWListCtrl;
|
||||||
|
|
||||||
|
#include <wx/string.h>
|
||||||
|
#include <wx/bitmap.h>
|
||||||
|
#include <wx/image.h>
|
||||||
|
#include <wx/icon.h>
|
||||||
|
#include <wx/menu.h>
|
||||||
|
#include <wx/gdicmn.h>
|
||||||
|
#include <wx/font.h>
|
||||||
|
#include <wx/colour.h>
|
||||||
|
#include <wx/settings.h>
|
||||||
|
class wxEventMonitorLogPanel;
|
||||||
|
#include <wx/statusbr.h>
|
||||||
|
#include <wx/frame.h>
|
||||||
|
#include <wx/aui/aui.h>
|
||||||
|
#include <wx/listctrl.h>
|
||||||
|
#include <wx/sizer.h>
|
||||||
|
#include <wx/panel.h>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Class wxEventMonitorFrameBase
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
class wxEventMonitorFrameBase : public wxFrame
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxMenuBar* m_menubar;
|
||||||
|
wxMenu* m_menuProgram;
|
||||||
|
wxStatusBar* m_statusBar;
|
||||||
|
|
||||||
|
// Virtual event handlers, overide them in your derived class
|
||||||
|
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnIconize( wxIconizeEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnIdle( wxIdleEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
wxEventMonitorLogPanel* m_panel;
|
||||||
|
|
||||||
|
wxEventMonitorFrameBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Event Monitor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,400 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL, const wxString& name = wxT("EventMonitor") );
|
||||||
|
wxAuiManager m_mgr;
|
||||||
|
|
||||||
|
~wxEventMonitorFrameBase();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Class wxEventMonitorLogPanelBase
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
class wxEventMonitorLogPanelBase : public wxPanel
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxETWListCtrl* m_log;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
wxEventMonitorLogPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxT("EventMonitorLogPanel") );
|
||||||
|
~wxEventMonitorLogPanelBase();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__WXEVENTMONITOR_UI_H__
|
Binary file not shown.
41
MSI/Base/locale/GEANTLink.pot
Normal file
41
MSI/Base/locale/GEANTLink.pot
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: GÉANTLink MSI\n"
|
||||||
|
"POT-Creation-Date: 2016-07-15 10:51+0200\n"
|
||||||
|
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
|
||||||
|
"Last-Translator: Simon Rozman <simon.rozman@amebis.si>\n"
|
||||||
|
"Language-Team: Amebis, d. o. o., Kamnik <info@amebis.si>\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 1.8.8\n"
|
||||||
|
"X-Poedit-Basepath: ../Main\n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"Language: en_US\n"
|
||||||
|
"X-Poedit-SourceCharset: UTF-8\n"
|
||||||
|
"X-Poedit-KeywordsList: _\n"
|
||||||
|
"X-Poedit-SearchPath-0: .\n"
|
||||||
|
|
||||||
|
#: En.Win32.Release.Property-2.idtx:6 En.x64.Release.Property-2.idtx:6
|
||||||
|
msgid "+386 1 8311 035"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: En.Win32.Release.Property-2.idtx:3 En.x64.Release.Property-2.idtx:3
|
||||||
|
#, fuzzy
|
||||||
|
msgid "1252"
|
||||||
|
msgstr "1250"
|
||||||
|
|
||||||
|
#: En.Win32.Release.Property-2.idtx:5 En.x64.Release.Property-2.idtx:5
|
||||||
|
msgid "Amebis, p. p. 69, SI-1241 Kamnik, Slovenia, E.U."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: En.Win32.Release.Property-2.idtx:4 En.x64.Release.Property-2.idtx:4
|
||||||
|
msgid "Amebis, Slovenia, E.U."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: En.Win32.Release.Property-2.idtx:7 En.Win32.Release.Property-2.idtx:8
|
||||||
|
#: En.Win32.Release.Property-2.idtx:9 En.x64.Release.Property-2.idtx:7
|
||||||
|
#: En.x64.Release.Property-2.idtx:8 En.x64.Release.Property-2.idtx:9
|
||||||
|
msgid "http://www.amebis.si/"
|
||||||
|
msgstr ""
|
Submodule MSI/MSIBuild updated: 74c5814a13...7a459c8c6c
2
MsiUseFeature/.gitignore
vendored
Normal file
2
MsiUseFeature/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/temp
|
||||||
|
/*.user
|
69
MsiUseFeature/Main.cpp
Normal file
69
MsiUseFeature/Main.cpp
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
#pragma comment(lib, "Msi.lib")
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace winstd;
|
||||||
|
|
||||||
|
|
||||||
|
static int MsiUseFeature()
|
||||||
|
{
|
||||||
|
int nArgs;
|
||||||
|
unique_ptr<LPWSTR[], LocalFree_delete<LPWSTR[]> > pwcArglist(CommandLineToArgvW(GetCommandLineW(), &nArgs));
|
||||||
|
if (pwcArglist == NULL) {
|
||||||
|
OutputDebugStr(_T("CommandLineToArgvW failed (error %u).\n"), GetLastError());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nArgs < 2) {
|
||||||
|
OutputDebugStr(_T("Not enough parameters.\n"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query the feature state.
|
||||||
|
if (MsiQueryFeatureStateW(_L(PRODUCT_VERSION_GUID), pwcArglist[1]) == INSTALLSTATE_UNKNOWN) {
|
||||||
|
OutputDebugStr(_T("The product is not installed or feature state is unknown.\n"));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform the Microsoft Installer's feature completeness check.
|
||||||
|
if (MsiUseFeatureW(_L(PRODUCT_VERSION_GUID), pwcArglist[1]) != INSTALLSTATE_LOCAL) {
|
||||||
|
OutputDebugStr(_T("The feature is not installed locally.\n"));
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(hInstance);
|
||||||
|
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||||
|
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||||
|
UNREFERENCED_PARAMETER(nCmdShow);
|
||||||
|
|
||||||
|
int res = MsiUseFeature();
|
||||||
|
assert(!_CrtDumpMemoryLeaks());
|
||||||
|
return res;
|
||||||
|
}
|
14
MsiUseFeature/MsiUseFeature.props
Normal file
14
MsiUseFeature/MsiUseFeature.props
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Label="PropertySheets" />
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutDir>..\output\$(Platform).$(Configuration)\</OutDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
</Project>
|
BIN
MsiUseFeature/MsiUseFeature.rc
Normal file
BIN
MsiUseFeature/MsiUseFeature.rc
Normal file
Binary file not shown.
106
MsiUseFeature/MsiUseFeature.vcxproj
Normal file
106
MsiUseFeature/MsiUseFeature.vcxproj
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{679D03C5-CD70-4FFA-93F8-A4AB3637509B}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>MsiUseFeature</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\include\Win32.props" />
|
||||||
|
<Import Project="..\include\Debug.props" />
|
||||||
|
<Import Project="MsiUseFeature.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\include\x64.props" />
|
||||||
|
<Import Project="..\include\Debug.props" />
|
||||||
|
<Import Project="MsiUseFeature.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\include\Win32.props" />
|
||||||
|
<Import Project="..\include\Release.props" />
|
||||||
|
<Import Project="MsiUseFeature.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\include\x64.props" />
|
||||||
|
<Import Project="..\include\Release.props" />
|
||||||
|
<Import Project="MsiUseFeature.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="StdAfx.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="Main.cpp" />
|
||||||
|
<ClCompile Include="StdAfx.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="README.md" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="MsiUseFeature.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
38
MsiUseFeature/MsiUseFeature.vcxproj.filters
Normal file
38
MsiUseFeature/MsiUseFeature.vcxproj.filters
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="StdAfx.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="StdAfx.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="README.md" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="MsiUseFeature.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
17
MsiUseFeature/README.md
Normal file
17
MsiUseFeature/README.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#MsiUseFeature
|
||||||
|
Checks the installation state of the given feature of G<>ANTLink product
|
||||||
|
|
||||||
|
##Usage
|
||||||
|
```
|
||||||
|
MsiUseFeature <feature name>
|
||||||
|
```
|
||||||
|
|
||||||
|
- `feature name` - The name of the feature to check (i.e. "featEAPTTLS"; see Feature table of product MSI file)
|
||||||
|
|
||||||
|
Note: The MSI product code changes on every release. Therefore, `MsiUseFeature` utility with identical version should be used.
|
||||||
|
|
||||||
|
Return codes:
|
||||||
|
- -1 = Invalid parameters
|
||||||
|
- 0 = Success
|
||||||
|
- 1 = The product is not installed or feature state is unknown
|
||||||
|
- 2 = The feature is not installed locally
|
21
MsiUseFeature/StdAfx.cpp
Normal file
21
MsiUseFeature/StdAfx.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
32
MsiUseFeature/StdAfx.h
Normal file
32
MsiUseFeature/StdAfx.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../include/Version.h"
|
||||||
|
|
||||||
|
#include <WinStd/Common.h>
|
||||||
|
#include <WinStd/Win.h>
|
||||||
|
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <Msi.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include <memory>
|
129
VS10Solution.sln
129
VS10Solution.sln
@@ -8,7 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EAP Methods", "EAP Methods", "{60BAAC3D-DC98-4C19-BC40-1A86963DE86C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EAP Methods", "EAP Methods", "{60BAAC3D-DC98-4C19-BC40-1A86963DE86C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPTTLS", "EAPMethods\build\EAPTTLS.vcxproj", "{331B6077-E3E2-4867-B93E-9D3F57280DE7}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPTTLS", "EAPMethods\EAPTTLS\EAPTTLS.vcxproj", "{331B6077-E3E2-4867-B93E-9D3F57280DE7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{E66A3FE1-4EE4-401F-8EAD-BE518B230393}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{E66A3FE1-4EE4-401F-8EAD-BE518B230393}"
|
||||||
EndProject
|
EndProject
|
||||||
@@ -18,9 +18,31 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utilities", "Utilities", "{
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CredWrite", "CredWrite\CredWrite.vcxproj", "{2D3CE079-7EB1-4F47-B79E-F0310671ECCB}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CredWrite", "CredWrite\CredWrite.vcxproj", "{2D3CE079-7EB1-4F47-B79E-F0310671ECCB}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPMethodEvents", "EAPMethods\build\EAPMethodEvents.vcxproj", "{D63F24BD-92A0-4D6B-8B69-ED947E4D2B1B}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Events", "lib\Events\build\Events.vcxproj", "{D63F24BD-92A0-4D6B-8B69-ED947E4D2B1B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPTTLSUI", "EAPMethods\build\EAPTTLSUI.vcxproj", "{DD7A97CA-F18E-43B7-95C4-D06E6A291624}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPTTLSUI", "EAPMethods\EAPTTLSUI\EAPTTLSUI.vcxproj", "{DD7A97CA-F18E-43B7-95C4-D06E6A291624}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPBase", "lib\EAPBase\build\EAPBase.vcxproj", "{AD6816A0-9600-4E01-8C49-39D03D1E791F}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EAPBase_UI", "lib\EAPBase_UI\build\EAPBase_UI.vcxproj", "{D4B54856-BE1F-4937-A8F7-495125BE76BE}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PAP", "lib\PAP\build\PAP.vcxproj", "{36B0CF8A-7794-46C3-8099-825BA962B4C7}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLS", "lib\TLS\build\TLS.vcxproj", "{4D40CB8A-812E-4F12-B23A-31AF743878E8}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TTLS", "lib\TTLS\build\TTLS.vcxproj", "{EE0EF0D9-A475-4038-8637-5754724F65B0}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PAP_UI", "lib\PAP_UI\build\PAP_UI.vcxproj", "{3D309C2E-64AB-4BC4-A16D-468571A2BC1A}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TLS_UI", "lib\TLS_UI\build\TLS_UI.vcxproj", "{9A25C261-8ADE-4938-8393-E857EF0E37E9}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TTLS_UI", "lib\TTLS_UI\build\TTLS_UI.vcxproj", "{42F0F0F4-C928-4860-A4E4-94991C2C3D90}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MsiUseFeature", "MsiUseFeature\MsiUseFeature.vcxproj", "{679D03C5-CD70-4FFA-93F8-A4AB3637509B}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EventMonitor", "EventMonitor\EventMonitor.vcxproj", "{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxExtendLib", "lib\wxExtend\build\wxExtendLib.vcxproj", "{D3E29951-D9F5-486D-A167-20AE8E90B1FA}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -70,15 +92,114 @@ Global
|
|||||||
{DD7A97CA-F18E-43B7-95C4-D06E6A291624}.Release|Win32.Build.0 = Release|Win32
|
{DD7A97CA-F18E-43B7-95C4-D06E6A291624}.Release|Win32.Build.0 = Release|Win32
|
||||||
{DD7A97CA-F18E-43B7-95C4-D06E6A291624}.Release|x64.ActiveCfg = Release|x64
|
{DD7A97CA-F18E-43B7-95C4-D06E6A291624}.Release|x64.ActiveCfg = Release|x64
|
||||||
{DD7A97CA-F18E-43B7-95C4-D06E6A291624}.Release|x64.Build.0 = Release|x64
|
{DD7A97CA-F18E-43B7-95C4-D06E6A291624}.Release|x64.Build.0 = Release|x64
|
||||||
|
{AD6816A0-9600-4E01-8C49-39D03D1E791F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{AD6816A0-9600-4E01-8C49-39D03D1E791F}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{AD6816A0-9600-4E01-8C49-39D03D1E791F}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{AD6816A0-9600-4E01-8C49-39D03D1E791F}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{AD6816A0-9600-4E01-8C49-39D03D1E791F}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{AD6816A0-9600-4E01-8C49-39D03D1E791F}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{AD6816A0-9600-4E01-8C49-39D03D1E791F}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{AD6816A0-9600-4E01-8C49-39D03D1E791F}.Release|x64.Build.0 = Release|x64
|
||||||
|
{D4B54856-BE1F-4937-A8F7-495125BE76BE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{D4B54856-BE1F-4937-A8F7-495125BE76BE}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{D4B54856-BE1F-4937-A8F7-495125BE76BE}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{D4B54856-BE1F-4937-A8F7-495125BE76BE}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{D4B54856-BE1F-4937-A8F7-495125BE76BE}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{D4B54856-BE1F-4937-A8F7-495125BE76BE}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{D4B54856-BE1F-4937-A8F7-495125BE76BE}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{D4B54856-BE1F-4937-A8F7-495125BE76BE}.Release|x64.Build.0 = Release|x64
|
||||||
|
{36B0CF8A-7794-46C3-8099-825BA962B4C7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{36B0CF8A-7794-46C3-8099-825BA962B4C7}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{36B0CF8A-7794-46C3-8099-825BA962B4C7}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{36B0CF8A-7794-46C3-8099-825BA962B4C7}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{36B0CF8A-7794-46C3-8099-825BA962B4C7}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{36B0CF8A-7794-46C3-8099-825BA962B4C7}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{36B0CF8A-7794-46C3-8099-825BA962B4C7}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{36B0CF8A-7794-46C3-8099-825BA962B4C7}.Release|x64.Build.0 = Release|x64
|
||||||
|
{4D40CB8A-812E-4F12-B23A-31AF743878E8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{4D40CB8A-812E-4F12-B23A-31AF743878E8}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{4D40CB8A-812E-4F12-B23A-31AF743878E8}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{4D40CB8A-812E-4F12-B23A-31AF743878E8}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{4D40CB8A-812E-4F12-B23A-31AF743878E8}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{4D40CB8A-812E-4F12-B23A-31AF743878E8}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{4D40CB8A-812E-4F12-B23A-31AF743878E8}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{4D40CB8A-812E-4F12-B23A-31AF743878E8}.Release|x64.Build.0 = Release|x64
|
||||||
|
{EE0EF0D9-A475-4038-8637-5754724F65B0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{EE0EF0D9-A475-4038-8637-5754724F65B0}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{EE0EF0D9-A475-4038-8637-5754724F65B0}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{EE0EF0D9-A475-4038-8637-5754724F65B0}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{EE0EF0D9-A475-4038-8637-5754724F65B0}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{EE0EF0D9-A475-4038-8637-5754724F65B0}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{EE0EF0D9-A475-4038-8637-5754724F65B0}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{EE0EF0D9-A475-4038-8637-5754724F65B0}.Release|x64.Build.0 = Release|x64
|
||||||
|
{3D309C2E-64AB-4BC4-A16D-468571A2BC1A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{3D309C2E-64AB-4BC4-A16D-468571A2BC1A}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{3D309C2E-64AB-4BC4-A16D-468571A2BC1A}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{3D309C2E-64AB-4BC4-A16D-468571A2BC1A}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{3D309C2E-64AB-4BC4-A16D-468571A2BC1A}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{3D309C2E-64AB-4BC4-A16D-468571A2BC1A}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{3D309C2E-64AB-4BC4-A16D-468571A2BC1A}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{3D309C2E-64AB-4BC4-A16D-468571A2BC1A}.Release|x64.Build.0 = Release|x64
|
||||||
|
{9A25C261-8ADE-4938-8393-E857EF0E37E9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{9A25C261-8ADE-4938-8393-E857EF0E37E9}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{9A25C261-8ADE-4938-8393-E857EF0E37E9}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{9A25C261-8ADE-4938-8393-E857EF0E37E9}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{9A25C261-8ADE-4938-8393-E857EF0E37E9}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{9A25C261-8ADE-4938-8393-E857EF0E37E9}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{9A25C261-8ADE-4938-8393-E857EF0E37E9}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{9A25C261-8ADE-4938-8393-E857EF0E37E9}.Release|x64.Build.0 = Release|x64
|
||||||
|
{42F0F0F4-C928-4860-A4E4-94991C2C3D90}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{42F0F0F4-C928-4860-A4E4-94991C2C3D90}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{42F0F0F4-C928-4860-A4E4-94991C2C3D90}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{42F0F0F4-C928-4860-A4E4-94991C2C3D90}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{42F0F0F4-C928-4860-A4E4-94991C2C3D90}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{42F0F0F4-C928-4860-A4E4-94991C2C3D90}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{42F0F0F4-C928-4860-A4E4-94991C2C3D90}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{42F0F0F4-C928-4860-A4E4-94991C2C3D90}.Release|x64.Build.0 = Release|x64
|
||||||
|
{679D03C5-CD70-4FFA-93F8-A4AB3637509B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{679D03C5-CD70-4FFA-93F8-A4AB3637509B}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{679D03C5-CD70-4FFA-93F8-A4AB3637509B}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{679D03C5-CD70-4FFA-93F8-A4AB3637509B}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{679D03C5-CD70-4FFA-93F8-A4AB3637509B}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{679D03C5-CD70-4FFA-93F8-A4AB3637509B}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{679D03C5-CD70-4FFA-93F8-A4AB3637509B}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{679D03C5-CD70-4FFA-93F8-A4AB3637509B}.Release|x64.Build.0 = Release|x64
|
||||||
|
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}.Release|x64.Build.0 = Release|x64
|
||||||
|
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{D3E29951-D9F5-486D-A167-20AE8E90B1FA}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{331B6077-E3E2-4867-B93E-9D3F57280DE7} = {60BAAC3D-DC98-4C19-BC40-1A86963DE86C}
|
{331B6077-E3E2-4867-B93E-9D3F57280DE7} = {60BAAC3D-DC98-4C19-BC40-1A86963DE86C}
|
||||||
{D63F24BD-92A0-4D6B-8B69-ED947E4D2B1B} = {60BAAC3D-DC98-4C19-BC40-1A86963DE86C}
|
|
||||||
{DD7A97CA-F18E-43B7-95C4-D06E6A291624} = {60BAAC3D-DC98-4C19-BC40-1A86963DE86C}
|
{DD7A97CA-F18E-43B7-95C4-D06E6A291624} = {60BAAC3D-DC98-4C19-BC40-1A86963DE86C}
|
||||||
{47399D91-7EB9-41DE-B521-514BA5DB0C43} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
{47399D91-7EB9-41DE-B521-514BA5DB0C43} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{D63F24BD-92A0-4D6B-8B69-ED947E4D2B1B} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{AD6816A0-9600-4E01-8C49-39D03D1E791F} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{D4B54856-BE1F-4937-A8F7-495125BE76BE} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{36B0CF8A-7794-46C3-8099-825BA962B4C7} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{4D40CB8A-812E-4F12-B23A-31AF743878E8} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{EE0EF0D9-A475-4038-8637-5754724F65B0} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{3D309C2E-64AB-4BC4-A16D-468571A2BC1A} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{9A25C261-8ADE-4938-8393-E857EF0E37E9} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{42F0F0F4-C928-4860-A4E4-94991C2C3D90} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
|
{D3E29951-D9F5-486D-A167-20AE8E90B1FA} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||||
{2D3CE079-7EB1-4F47-B79E-F0310671ECCB} = {7B5EC9B7-208C-426A-941D-DAF9271BD4A4}
|
{2D3CE079-7EB1-4F47-B79E-F0310671ECCB} = {7B5EC9B7-208C-426A-941D-DAF9271BD4A4}
|
||||||
|
{679D03C5-CD70-4FFA-93F8-A4AB3637509B} = {7B5EC9B7-208C-426A-941D-DAF9271BD4A4}
|
||||||
|
{E0D0725B-B2FC-4225-9481-CA9B1B6306F2} = {7B5EC9B7-208C-426A-941D-DAF9271BD4A4}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@@ -24,13 +24,15 @@
|
|||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IntDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
|
<IntDir>temp\$(MSBuildProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
|
||||||
<OutDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</OutDir>
|
<OutDir>temp\$(MSBuildProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</OutDir>
|
||||||
|
<IncludePath>$(WXWIN)\include\msvc;$(WXWIN)\include;$(IncludePath)</IncludePath>
|
||||||
|
<SourcePath>$(WXWIN)\src\aui;$(WXWIN)\src\cocoa;$(WXWIN)\src\common;$(WXWIN)\src\dfb;$(WXWIN)\src\expat;$(WXWIN)\src\generic;$(WXWIN)\src\gtk;$(WXWIN)\src\gtk1;$(WXWIN)\src\html;$(WXWIN)\src\jpeg;$(WXWIN)\src\motif;$(WXWIN)\src\msdos;$(WXWIN)\src\msw;$(WXWIN)\src\os2;$(WXWIN)\src\osx;$(WXWIN)\src\png;$(WXWIN)\src\propgrid;$(WXWIN)\src\regex;$(WXWIN)\src\ribbon;$(WXWIN)\src\richtext;$(WXWIN)\src\stc;$(WXWIN)\src\tiff;$(WXWIN)\src\univ;$(WXWIN)\src\unix;$(WXWIN)\src\x11;$(WXWIN)\src\xml;$(WXWIN)\src\xrc;$(WXWIN)\src\zlib;$(SourcePath)</SourcePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_WIN32_WINNT=0x0600;ISOLATION_AWARE_ENABLED=1;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
Binary file not shown.
@@ -29,7 +29,7 @@
|
|||||||
// Product version as a single DWORD
|
// Product version as a single DWORD
|
||||||
// Note: Used for version comparison within C/C++ code.
|
// Note: Used for version comparison within C/C++ code.
|
||||||
//
|
//
|
||||||
#define PRODUCT_VERSION 0x00ff0000
|
#define PRODUCT_VERSION 0x00ff0700
|
||||||
|
|
||||||
//
|
//
|
||||||
// Product version by components
|
// Product version by components
|
||||||
@@ -39,26 +39,26 @@
|
|||||||
//
|
//
|
||||||
#define PRODUCT_VERSION_MAJ 0
|
#define PRODUCT_VERSION_MAJ 0
|
||||||
#define PRODUCT_VERSION_MIN 255
|
#define PRODUCT_VERSION_MIN 255
|
||||||
#define PRODUCT_VERSION_REV 0
|
#define PRODUCT_VERSION_REV 7
|
||||||
#define PRODUCT_VERSION_BUILD 0
|
#define PRODUCT_VERSION_BUILD 0
|
||||||
|
|
||||||
//
|
//
|
||||||
// Human readable product version and build year for UI
|
// Human readable product version and build year for UI
|
||||||
//
|
//
|
||||||
#define PRODUCT_VERSION_STR "1.0-alpha0"
|
#define PRODUCT_VERSION_STR "1.0-alpha7"
|
||||||
#define PRODUCT_BUILD_YEAR_STR "2016"
|
#define PRODUCT_BUILD_YEAR_STR "2016"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Numerical version presentation for ProductVersion propery in
|
// Numerical version presentation for ProductVersion propery in
|
||||||
// MSI packages (syntax: N.N[.N[.N]])
|
// MSI packages (syntax: N.N[.N[.N]])
|
||||||
//
|
//
|
||||||
#define PRODUCT_VERSION_INST "0.255.0"
|
#define PRODUCT_VERSION_INST "0.255.7"
|
||||||
|
|
||||||
//
|
//
|
||||||
// The product code for ProductCode property in MSI packages
|
// The product code for ProductCode property in MSI packages
|
||||||
// Replace with new on every version change, regardless how minor it is.
|
// Replace with new on every version change, regardless how minor it is.
|
||||||
//
|
//
|
||||||
#define PRODUCT_VERSION_GUID "{415EC33A-C266-4E7A-A96C-AAE72E42E6C8}"
|
#define PRODUCT_VERSION_GUID "{54C2BA4B-EFC8-4F3E-A838-28744134A136}"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Since the product name is not finally confirmed at the time of
|
// Since the product name is not finally confirmed at the time of
|
||||||
|
@@ -23,6 +23,9 @@
|
|||||||
<Import Project="Common.props" />
|
<Import Project="Common.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<LibraryPath>$(WXWIN)\lib\vc_lib;$(LibraryPath)</LibraryPath>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<Lib>
|
<Lib>
|
||||||
<TargetMachine>MachineX86</TargetMachine>
|
<TargetMachine>MachineX86</TargetMachine>
|
||||||
|
@@ -23,6 +23,9 @@
|
|||||||
<Import Project="Common.props" />
|
<Import Project="Common.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<LibraryPath>$(WXWIN)\lib\vc_x64_lib;$(LibraryPath)</LibraryPath>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup>
|
<ItemDefinitionGroup>
|
||||||
<Lib>
|
<Lib>
|
||||||
<TargetMachine>MachineX64</TargetMachine>
|
<TargetMachine>MachineX64</TargetMachine>
|
||||||
|
66
include/xgettext.targets
Normal file
66
include/xgettext.targets
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 1991-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml" />
|
||||||
|
<AvailableItemName Include="POCompile">
|
||||||
|
<Targets>POCompile</Targets>
|
||||||
|
</AvailableItemName>
|
||||||
|
</ItemGroup>
|
||||||
|
<UsingTask TaskName="POCompile" TaskFactory="XamlTaskFactory" AssemblyName="Microsoft.Build.Tasks.v4.0">
|
||||||
|
<Task>$(MSBuildThisFileDirectory)$(MSBuildThisFileName).xml</Task>
|
||||||
|
</UsingTask>
|
||||||
|
<Target
|
||||||
|
Name="POCompile"
|
||||||
|
BeforeTargets="$(POCompileBeforeTargets)"
|
||||||
|
AfterTargets="$(POCompileAfterTargets)"
|
||||||
|
DependsOnTargets="$(POCompilationDependsOn)"
|
||||||
|
Inputs="@(POCompile);$(MSBuildProjectFile)"
|
||||||
|
Outputs="%(POCompile.OutputFile)"
|
||||||
|
>
|
||||||
|
<ItemGroup Condition="'@(SelectedFiles)' != ''">
|
||||||
|
<POCompile Remove="@(POCompile)" Condition="'%(Identity)' != '@(SelectedFiles)'" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Message Text="Compiling localization catalogues..." />
|
||||||
|
<POCompile
|
||||||
|
Condition="'@(POCompile)' != '' and '%(POCompile.ExcludedFromBuild)' != 'true'"
|
||||||
|
Inputs="@(POCompile)"
|
||||||
|
OperationMode="%(POCompile.OperationMode)"
|
||||||
|
Strict="%(POCompile.Strict)"
|
||||||
|
CheckFormat="%(POCompile.CheckFormat)"
|
||||||
|
CheckHeader="%(POCompile.CheckHeader)"
|
||||||
|
CheckDomain="%(POCompile.CheckDomain)"
|
||||||
|
CheckCompat="%(POCompile.CheckCompat)"
|
||||||
|
CheckAccel="%(POCompile.CheckAccel)"
|
||||||
|
OutputFile="%(POCompile.OutputFile)"
|
||||||
|
UseFuzzy="%(POCompile.UseFuzzy)"
|
||||||
|
Alignment="%(POCompile.Alignment)"
|
||||||
|
Endianess="%(POCompile.Endianess)"
|
||||||
|
AdditionalOptions="%(POCompile.AdditionalOptions)"
|
||||||
|
CommandLineTemplate="%(POCompile.CommandLineTemplate)" />
|
||||||
|
</Target>
|
||||||
|
<Target Name="POCompilationClean">
|
||||||
|
<Delete Files="%(POCompile.OutputFile)" ContinueOnError="true" />
|
||||||
|
</Target>
|
||||||
|
<PropertyGroup>
|
||||||
|
<CleanDependsOn>POCompilationClean;$(CleanDependsOn);</CleanDependsOn>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
84
include/xgettext.xml
Normal file
84
include/xgettext.xml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 1991-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:transformCallback="Microsoft.Cpp.Dev10.ConvertPropertyCallback">
|
||||||
|
<Rule Name="POCompile" PageTemplate="tool" DisplayName="PO Compiler" SwitchPrefix="--" Order="200">
|
||||||
|
<Rule.DataSource>
|
||||||
|
<DataSource Persistence="ProjectFile" ItemType="POCompile" />
|
||||||
|
</Rule.DataSource>
|
||||||
|
<Rule.Categories>
|
||||||
|
<Category Name="General" DisplayName="General" />
|
||||||
|
<Category Name="Input" DisplayName="Input" />
|
||||||
|
<Category Name="Output" DisplayName="Output" />
|
||||||
|
<Category Name="Command Line" DisplayName="Command Line" Subtype="CommandLine" />
|
||||||
|
</Rule.Categories>
|
||||||
|
<EnumProperty Category="General" Name="OperationMode" DisplayName="Operation Mode" Description="Specifies the operation mode.">
|
||||||
|
<EnumValue Name="MO" DisplayName="Default" Description="Generate MO file (default)." />
|
||||||
|
<EnumValue Name="Java" Switch="java" DisplayName="Java" Description="Generate a Java ResourceBundle class." />
|
||||||
|
<EnumValue Name="Java2" Switch="java2" DisplayName="Java2" Description="Like Java, and assume Java2 (JDK 1.2 or higher)." />
|
||||||
|
<EnumValue Name="Csharp" Switch="csharp" DisplayName="C#" Description="Generate a .NET .dll file." />
|
||||||
|
<EnumValue Name="CsharpRes" Switch="csharp-resources" DisplayName="C# Resource" Description="Generate a .NET .resources file." />
|
||||||
|
<EnumValue Name="Tcl" Switch="tcl" DisplayName="Tcl" Description="Generate a tcl/msgcat .msg file." />
|
||||||
|
<EnumValue Name="Qt" Switch="qt" DisplayName="Qt" Description="Generate a Qt .qm file." />
|
||||||
|
<EnumValue Name="Desktop" Switch="desktop" DisplayName="Desktop Entry" Description="Generate a .desktop file." />
|
||||||
|
</EnumProperty>
|
||||||
|
<BoolProperty Category="General" Name="Strict" Switch="strict" DisplayName="Enable strict mode" Description="Enable strict Uniforum mode." />
|
||||||
|
<BoolProperty Category="Input" Name="CheckFormat" Switch="check-format" DisplayName="Check Format" Description="Check language dependent format strings." />
|
||||||
|
<BoolProperty Category="Input" Name="CheckHeader" Switch="check-header" DisplayName="Check Header" Description="Verify presence and contents of the header entry." />
|
||||||
|
<BoolProperty Category="Input" Name="CheckDomain" Switch="check-domain" DisplayName="Check Domain" Description="Check for conflicts between domain directives and the --output-file option." />
|
||||||
|
<BoolProperty Category="Input" Name="CheckCompat" Switch="check-compatibility" DisplayName="Check Compatibility" Description="Check that GNU msgfmt behaves like X/Open msgfmt." />
|
||||||
|
<EnumProperty Category="Input" Name="CheckAccel" DisplayName="Check Accelerators" Description="Check presence of keyboard accelerators for menu items.">
|
||||||
|
<EnumValue Name="None" DisplayName="None" Description="No check" />
|
||||||
|
<EnumValue Name="Amperstand" Switch="check-accelerators="&"" DisplayName="Amperstand" Description="Check keyborad accellerator marked with an amperstand &." />
|
||||||
|
</EnumProperty>
|
||||||
|
<StringProperty Category="Output" Name="OutputFile" Switch="output-file=" DisplayName="Output File" Description="The name and location of the output file that compiler creates." Subtype="file" />
|
||||||
|
<BoolProperty Category="Output" Name="UseFuzzy" Switch="use-fuzzy" DisplayName="Use Fuzzy Entries" Description="Use fuzzy entries in output." />
|
||||||
|
<IntProperty Category="Output" Name="Alignment" Switch="alignment=" DisplayName="Align Strings" Description="Align strings to given bytes (default: 1)." />
|
||||||
|
<EnumProperty Category="Output" Name="Endianess" DisplayName="Endianess" Description="Write out 32-bit numbers in the given byte order (default: platform specific).">
|
||||||
|
<EnumValue Name="LSB" Switch="endianness=little" DisplayName="LSB" Description="Least significant byte first" />
|
||||||
|
<EnumValue Name="MSB" Switch="endianness=big" DisplayName="MSB" Description="Most significant byte first" />
|
||||||
|
</EnumProperty>
|
||||||
|
<StringListProperty Category="Command Line" Name="Inputs" Subtype="file" IsRequired="true" >
|
||||||
|
<StringListProperty.DataSource>
|
||||||
|
<DataSource Persistence="ProjectFile" ItemType="POCompile" SourceType="Item" />
|
||||||
|
</StringListProperty.DataSource>
|
||||||
|
</StringListProperty>
|
||||||
|
<StringProperty Category="Command Line" Name="AdditionalOptions" Subtype="AdditionalOptions" DisplayName="Additional Options" Description="Additional Options" />
|
||||||
|
<DynamicEnumProperty Category="Command Line" Name="POCompileBeforeTargets" EnumProvider="Targets" DisplayName="Execute Before" Description="Specifies the targets for the build customization to run before." IncludeInCommandLine="False">
|
||||||
|
<DynamicEnumProperty.ProviderSettings>
|
||||||
|
<NameValuePair Name="Exclude" Value="^POCompileBeforeTargets|^Compute" />
|
||||||
|
</DynamicEnumProperty.ProviderSettings>
|
||||||
|
<DynamicEnumProperty.DataSource>
|
||||||
|
<DataSource Persistence="ProjectFile" HasConfigurationCondition="true" />
|
||||||
|
</DynamicEnumProperty.DataSource>
|
||||||
|
</DynamicEnumProperty>
|
||||||
|
<DynamicEnumProperty Category="Command Line" Name="POCompileAfterTargets" EnumProvider="Targets" DisplayName="Execute After" Description="Specifies the targets for the build customization to run after." IncludeInCommandLine="False">
|
||||||
|
<DynamicEnumProperty.ProviderSettings>
|
||||||
|
<NameValuePair Name="Exclude" Value="^POCompileAfterTargets|^Compute" />
|
||||||
|
</DynamicEnumProperty.ProviderSettings>
|
||||||
|
<DynamicEnumProperty.DataSource>
|
||||||
|
<DataSource Persistence="ProjectFile" ItemType="" HasConfigurationCondition="true" />
|
||||||
|
</DynamicEnumProperty.DataSource>
|
||||||
|
</DynamicEnumProperty>
|
||||||
|
</Rule>
|
||||||
|
<ItemType Name="POCompile" DisplayName="PO Compiler" />
|
||||||
|
<FileExtension Name="*.po" ContentType="POCompile" />
|
||||||
|
<ContentType Name="POCompile" DisplayName="PO Compiler" ItemType="POCompile" />
|
||||||
|
</ProjectSchemaDefinitions>
|
2
lib/EAPBase/build/.gitignore
vendored
Normal file
2
lib/EAPBase/build/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/temp
|
||||||
|
/*.user
|
12
lib/EAPBase/build/EAPBase.props
Normal file
12
lib/EAPBase/build/EAPBase.props
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Label="PropertySheets" />
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup />
|
||||||
|
<ItemDefinitionGroup>
|
||||||
|
<ClCompile>
|
||||||
|
<AdditionalIncludeDirectories>..\..\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\..\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup />
|
||||||
|
</Project>
|
110
lib/EAPBase/build/EAPBase.vcxproj
Normal file
110
lib/EAPBase/build/EAPBase.vcxproj
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{AD6816A0-9600-4E01-8C49-39D03D1E791F}</ProjectGuid>
|
||||||
|
<RootNamespace>EAPBase</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\include\Win32.props" />
|
||||||
|
<Import Project="..\..\..\include\Debug.props" />
|
||||||
|
<Import Project="EAPBase.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\include\x64.props" />
|
||||||
|
<Import Project="..\..\..\include\Debug.props" />
|
||||||
|
<Import Project="EAPBase.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\include\Win32.props" />
|
||||||
|
<Import Project="..\..\..\include\Release.props" />
|
||||||
|
<Import Project="EAPBase.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\include\x64.props" />
|
||||||
|
<Import Project="..\..\..\include\Release.props" />
|
||||||
|
<Import Project="EAPBase.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\include\Config.h" />
|
||||||
|
<ClInclude Include="..\include\Credentials.h" />
|
||||||
|
<ClInclude Include="..\include\EAP.h" />
|
||||||
|
<ClInclude Include="..\include\EAPXML.h" />
|
||||||
|
<ClInclude Include="..\include\Method.h" />
|
||||||
|
<ClInclude Include="..\include\Module.h" />
|
||||||
|
<ClInclude Include="..\src\StdAfx.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\Config.cpp" />
|
||||||
|
<ClCompile Include="..\src\Credentials.cpp" />
|
||||||
|
<ClCompile Include="..\src\Module.cpp" />
|
||||||
|
<ClCompile Include="..\src\Method.cpp" />
|
||||||
|
<ClCompile Include="..\src\StdAfx.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\Events\build\Events.vcxproj">
|
||||||
|
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
53
lib/EAPBase/build/EAPBase.vcxproj.filters
Normal file
53
lib/EAPBase/build/EAPBase.vcxproj.filters
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\src\StdAfx.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\EAP.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\EAPXML.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\Method.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\Config.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\Module.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\Credentials.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\StdAfx.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\Config.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\Credentials.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\Method.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\Module.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
574
lib/EAPBase/include/Config.h
Normal file
574
lib/EAPBase/include/Config.h
Normal file
@@ -0,0 +1,574 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "EAP.h"
|
||||||
|
|
||||||
|
#include <sal.h>
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// Base class for configuration storage
|
||||||
|
///
|
||||||
|
class config;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Base class for method configuration storage
|
||||||
|
///
|
||||||
|
class config_method;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Base class for method with credentials
|
||||||
|
///
|
||||||
|
class config_method_with_cred;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Base class for single provider configuration storage
|
||||||
|
///
|
||||||
|
class config_provider;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Base class for the list of providers configuration storage
|
||||||
|
///
|
||||||
|
class config_provider_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val Configuration to pack
|
||||||
|
///
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a configuration
|
||||||
|
///
|
||||||
|
/// \param[in] val Configuration to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
inline size_t pksizeof(const eap::config &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val Configuration to unpack to
|
||||||
|
///
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val);
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Module.h"
|
||||||
|
#include "EAPXML.h"
|
||||||
|
|
||||||
|
#include "../../../include/Version.h"
|
||||||
|
|
||||||
|
#include <WinStd/COM.h>
|
||||||
|
#include <WinStd/Common.h>
|
||||||
|
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <eaptypes.h> // Must include after <Windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <string>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
class config
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs configuration
|
||||||
|
///
|
||||||
|
/// \param[in] mod EAP module to use for global services
|
||||||
|
///
|
||||||
|
config(_In_ module &mod);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
config(_In_ const config &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
config(_Inout_ config &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config& operator=(_In_ const config &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config& operator=(_Inout_ config &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Clones this configuration
|
||||||
|
///
|
||||||
|
/// \returns Pointer to cloned configuration
|
||||||
|
///
|
||||||
|
virtual config* clone() const = 0;
|
||||||
|
|
||||||
|
/// \name XML configuration management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Save to XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pDoc XML document
|
||||||
|
/// \param[in] pConfigRoot Suggested root element for saving
|
||||||
|
///
|
||||||
|
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Load from XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pConfigRoot Root element for loading
|
||||||
|
///
|
||||||
|
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/// \name BLOB management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a configuration
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
virtual size_t get_pk_size() const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
public:
|
||||||
|
module &m_module; ///< EAP module
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class config_method : public config
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs configuration
|
||||||
|
///
|
||||||
|
/// \param[in] mod EAP module to use for global services
|
||||||
|
///
|
||||||
|
config_method(_In_ module &mod);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
config_method(_In_ const config_method &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
config_method(_Inout_ config_method &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config_method& operator=(_In_ const config_method &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config_method& operator=(_Inout_ config_method &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns EAP method type of this configuration
|
||||||
|
///
|
||||||
|
/// \returns One of `winstd::eap_type_t` constants.
|
||||||
|
///
|
||||||
|
virtual winstd::eap_type_t get_method_id() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class credentials;
|
||||||
|
|
||||||
|
|
||||||
|
class config_method_with_cred : public config_method
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs configuration
|
||||||
|
///
|
||||||
|
/// \param[in] mod EAP module to use for global services
|
||||||
|
///
|
||||||
|
config_method_with_cred(_In_ module &mod);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
config_method_with_cred(_In_ const config_method_with_cred &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
config_method_with_cred(_Inout_ config_method_with_cred &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config_method_with_cred& operator=(_In_ const config_method_with_cred &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config_method_with_cred& operator=(_Inout_ config_method_with_cred &&other);
|
||||||
|
|
||||||
|
/// \name XML configuration management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Save to XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pDoc XML document
|
||||||
|
/// \param[in] pConfigRoot Suggested root element for saving
|
||||||
|
///
|
||||||
|
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Load from XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pConfigRoot Root element for loading
|
||||||
|
///
|
||||||
|
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/// \name BLOB management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a configuration
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
virtual size_t get_pk_size() const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool m_allow_save; ///< Are credentials allowed to be saved to Windows Credential Manager?
|
||||||
|
bool m_use_preshared; ///< Use pre-shared credentials
|
||||||
|
std::unique_ptr<credentials> m_preshared; ///< Pre-shared credentials
|
||||||
|
bool m_cred_failed; ///< Did credential fail last time?
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class config_provider : public config
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs configuration
|
||||||
|
///
|
||||||
|
/// \param[in] mod EAP module to use for global services
|
||||||
|
///
|
||||||
|
config_provider(_In_ module &mod);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
config_provider(_In_ const config_provider &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
config_provider(_Inout_ config_provider &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config_provider& operator=(_In_ const config_provider &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config_provider& operator=(_Inout_ config_provider &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Clones configuration
|
||||||
|
///
|
||||||
|
/// \returns Pointer to cloned configuration
|
||||||
|
///
|
||||||
|
virtual config* clone() const;
|
||||||
|
|
||||||
|
/// \name XML configuration management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Save to XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pDoc XML document
|
||||||
|
/// \param[in] pConfigRoot Suggested root element for saving
|
||||||
|
///
|
||||||
|
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Load from XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pConfigRoot Root element for loading
|
||||||
|
///
|
||||||
|
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/// \name BLOB management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a configuration
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
virtual size_t get_pk_size() const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool m_read_only; ///< Is profile read-only
|
||||||
|
std::wstring m_id; ///< Profile ID
|
||||||
|
winstd::tstring m_name; ///< Provider name
|
||||||
|
winstd::tstring m_help_email; ///< Helpdesk e-mail
|
||||||
|
winstd::tstring m_help_web; ///< Helpdesk website URL
|
||||||
|
winstd::tstring m_help_phone; ///< Helpdesk phone
|
||||||
|
winstd::tstring m_lbl_alt_credential; ///< Alternative label for credential prompt
|
||||||
|
winstd::tstring m_lbl_alt_identity; ///< Alternative label for identity prompt
|
||||||
|
winstd::tstring m_lbl_alt_password; ///< Alternative label for password prompt
|
||||||
|
std::list<std::unique_ptr<config_method> > m_methods; ///< List of method configurations
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class config_provider_list : public config
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs configuration
|
||||||
|
///
|
||||||
|
/// \param[in] mod EAP module to use for global services
|
||||||
|
///
|
||||||
|
config_provider_list(_In_ module &mod);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
config_provider_list(_In_ const config_provider_list &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
config_provider_list(_Inout_ config_provider_list &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to copy from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config_provider_list& operator=(_In_ const config_provider_list &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves configuration
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
config_provider_list& operator=(_Inout_ config_provider_list &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Clones configuration
|
||||||
|
///
|
||||||
|
/// \returns Pointer to cloned configuration
|
||||||
|
///
|
||||||
|
virtual config* clone() const;
|
||||||
|
|
||||||
|
/// \name XML configuration management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Save to XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pDoc XML document
|
||||||
|
/// \param[in] pConfigRoot Suggested root element for saving
|
||||||
|
///
|
||||||
|
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Load from XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pConfigRoot Root element for loading
|
||||||
|
///
|
||||||
|
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/// \name BLOB management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a configuration
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
virtual size_t get_pk_size() const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::list<eap::config_provider> m_providers; ///< List of provider configurations
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::config &val)
|
||||||
|
{
|
||||||
|
val.operator<<(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline size_t pksizeof(const eap::config &val)
|
||||||
|
{
|
||||||
|
return val.get_pk_size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::config &val)
|
||||||
|
{
|
||||||
|
val.operator>>(cursor);
|
||||||
|
}
|
319
lib/EAPBase/include/Credentials.h
Normal file
319
lib/EAPBase/include/Credentials.h
Normal file
@@ -0,0 +1,319 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sal.h>
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// Base class for method credential storage
|
||||||
|
///
|
||||||
|
class credentials;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Password based method credentials
|
||||||
|
///
|
||||||
|
class credentials_pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Module.h"
|
||||||
|
|
||||||
|
#include "../../../include/Version.h"
|
||||||
|
|
||||||
|
#include <WinStd/Common.h>
|
||||||
|
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <eaptypes.h> // Must include after <Windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
#include <wincred.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
class credentials : public config
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs credentials
|
||||||
|
///
|
||||||
|
/// \param[in] mod EAP module to use for global services
|
||||||
|
///
|
||||||
|
credentials(_In_ module &mod);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies credentials
|
||||||
|
///
|
||||||
|
/// \param[in] other Credentials to copy from
|
||||||
|
///
|
||||||
|
credentials(_In_ const credentials &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves credentials
|
||||||
|
///
|
||||||
|
/// \param[in] other Credentials to move from
|
||||||
|
///
|
||||||
|
credentials(_Inout_ credentials &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies credentials
|
||||||
|
///
|
||||||
|
/// \param[in] other Credentials to copy from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
credentials& operator=(_In_ const credentials &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves credentials
|
||||||
|
///
|
||||||
|
/// \param[in] other Configuration to move from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
credentials& operator=(_Inout_ credentials &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Resets credentials
|
||||||
|
///
|
||||||
|
virtual void clear();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Test credentials if blank
|
||||||
|
///
|
||||||
|
/// \returns
|
||||||
|
/// - \c true if blank
|
||||||
|
/// - \c false otherwise
|
||||||
|
///
|
||||||
|
virtual bool empty() const;
|
||||||
|
|
||||||
|
/// \name Storage
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Save credentials to Windows Credential Manager
|
||||||
|
///
|
||||||
|
/// \param[in] pszTargetName The name in Windows Credential Manager to store credentials as
|
||||||
|
///
|
||||||
|
virtual void store(_In_z_ LPCTSTR pszTargetName) const = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Retrieve credentials from Windows Credential Manager
|
||||||
|
///
|
||||||
|
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from
|
||||||
|
///
|
||||||
|
virtual void retrieve(_In_z_ LPCTSTR pszTargetName) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns target name for Windows Credential Manager credential name
|
||||||
|
///
|
||||||
|
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from
|
||||||
|
///
|
||||||
|
/// \returns Final target name to store/retrieve credentials in Windows Credential Manager
|
||||||
|
///
|
||||||
|
inline winstd::tstring target_name(_In_z_ LPCTSTR pszTargetName) const
|
||||||
|
{
|
||||||
|
winstd::tstring target_name(_T(PRODUCT_NAME_STR) _T("/"));
|
||||||
|
target_name += pszTargetName;
|
||||||
|
target_name += _T('/');
|
||||||
|
target_name += target_suffix();
|
||||||
|
assert(target_name.length() < CRED_MAX_GENERIC_TARGET_NAME_LENGTH);
|
||||||
|
return target_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Return target suffix for Windows Credential Manager credential name
|
||||||
|
///
|
||||||
|
virtual LPCTSTR target_suffix() const = 0;
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns credential identity.
|
||||||
|
///
|
||||||
|
virtual std::wstring get_identity() const = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns credential name (for GUI display).
|
||||||
|
///
|
||||||
|
virtual winstd::tstring get_name() const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Combine credentials in the following order:
|
||||||
|
///
|
||||||
|
/// 1. Cached credentials
|
||||||
|
/// 2. Pre-configured credentials
|
||||||
|
/// 3. Stored credentials
|
||||||
|
///
|
||||||
|
/// \param[in] cred_cached Cached credentials (optional, can be \c NULL)
|
||||||
|
/// \param[in] cfg Method configuration
|
||||||
|
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL)
|
||||||
|
///
|
||||||
|
/// \returns
|
||||||
|
/// - \c true if credentials were set;
|
||||||
|
/// - \c false otherwise
|
||||||
|
///
|
||||||
|
virtual bool combine(
|
||||||
|
_In_ const credentials *cred_cached,
|
||||||
|
_In_ config_method_with_cred &cfg,
|
||||||
|
_In_opt_z_ LPCTSTR pszTargetName);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class credentials_pass : public credentials
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs credentials
|
||||||
|
///
|
||||||
|
/// \param[in] mod EAP module to use for global services
|
||||||
|
///
|
||||||
|
credentials_pass(_In_ module &mod);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies credentials
|
||||||
|
///
|
||||||
|
/// \param[in] other Credentials to copy from
|
||||||
|
///
|
||||||
|
credentials_pass(_In_ const credentials_pass &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves credentials
|
||||||
|
///
|
||||||
|
/// \param[in] other Credentials to move from
|
||||||
|
///
|
||||||
|
credentials_pass(_Inout_ credentials_pass &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies credentials
|
||||||
|
///
|
||||||
|
/// \param[in] other Credentials to copy from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
credentials_pass& operator=(_In_ const credentials_pass &other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves credentials
|
||||||
|
///
|
||||||
|
/// \param[in] other Credentials to move from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
credentials_pass& operator=(_Inout_ credentials_pass &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Resets credentials
|
||||||
|
///
|
||||||
|
virtual void clear();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Test credentials if blank
|
||||||
|
///
|
||||||
|
/// \returns
|
||||||
|
/// - \c true if blank
|
||||||
|
/// - \c false otherwise
|
||||||
|
///
|
||||||
|
virtual bool empty() const;
|
||||||
|
|
||||||
|
/// \name XML configuration management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Save to XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pDoc XML document
|
||||||
|
/// \param[in] pConfigRoot Suggested root element for saving
|
||||||
|
///
|
||||||
|
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Load from XML document
|
||||||
|
///
|
||||||
|
/// \param[in] pConfigRoot Root element for loading
|
||||||
|
///
|
||||||
|
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/// \name BLOB management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator<<(_Inout_ cursor_out &cursor) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a configuration
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
virtual size_t get_pk_size() const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a configuration
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
///
|
||||||
|
virtual void operator>>(_Inout_ cursor_in &cursor);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/// \name Storage
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Save credentials to Windows Credential Manager
|
||||||
|
///
|
||||||
|
/// \param[in] pszTargetName The name in Windows Credential Manager to store credentials as
|
||||||
|
///
|
||||||
|
virtual void store(_In_z_ LPCTSTR pszTargetName) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Retrieve credentials from Windows Credential Manager
|
||||||
|
///
|
||||||
|
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from
|
||||||
|
///
|
||||||
|
virtual void retrieve(_In_z_ LPCTSTR pszTargetName);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns credential identity.
|
||||||
|
///
|
||||||
|
virtual std::wstring get_identity() const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::wstring m_identity; ///< Identity (username\@domain, certificate name etc.)
|
||||||
|
winstd::sanitizing_wstring m_password; ///< Password
|
||||||
|
|
||||||
|
private:
|
||||||
|
/// \cond internal
|
||||||
|
static const unsigned char s_entropy[1024];
|
||||||
|
/// \endcond
|
||||||
|
};
|
||||||
|
}
|
989
lib/EAPBase/include/EAP.h
Normal file
989
lib/EAPBase/include/EAP.h
Normal file
@@ -0,0 +1,989 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define IDR_EAP_KEY_PUBLIC 1
|
||||||
|
#define IDR_EAP_KEY_PRIVATE 2
|
||||||
|
|
||||||
|
#ifndef EAP_ENCRYPT_BLOBS
|
||||||
|
#define EAP_ENCRYPT_BLOBS 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _HOST_LOW_ENDIAN
|
||||||
|
|
||||||
|
#if !defined(RC_INVOKED) && !defined(MIDL_PASS)
|
||||||
|
|
||||||
|
#include <WinStd/Common.h>
|
||||||
|
#include <WinStd/Crypt.h>
|
||||||
|
#include <WinStd/EAP.h>
|
||||||
|
|
||||||
|
#include <sal.h>
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// Output BLOB cursor
|
||||||
|
///
|
||||||
|
struct cursor_out;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Input BLOB cursor
|
||||||
|
///
|
||||||
|
struct cursor_in;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sanitizing dynamically allocated BLOB
|
||||||
|
///
|
||||||
|
typedef std::vector<unsigned char, winstd::sanitizing_allocator<unsigned char> > sanitizing_blob;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sanitizing BLOB of fixed size
|
||||||
|
///
|
||||||
|
template<size_t N> struct sanitizing_blob_f;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sanitizing BLOB of fixed size (zero initialized)
|
||||||
|
///
|
||||||
|
template<size_t N> struct sanitizing_blob_zf;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sanitizing BLOB of fixed size (zero initialized in _DEBUG version)
|
||||||
|
///
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define sanitizing_blob_xf sanitizing_blob_zf
|
||||||
|
#else
|
||||||
|
#define sanitizing_blob_xf sanitizing_blob_f
|
||||||
|
#endif
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Diameter AVP flags
|
||||||
|
///
|
||||||
|
enum diameter_avp_flags_t;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Diameter AVP
|
||||||
|
///
|
||||||
|
struct diameter_avp;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a boolean
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val Variable with data to pack
|
||||||
|
///
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const bool &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a boolean
|
||||||
|
///
|
||||||
|
/// \param[in] val Data to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
inline size_t pksizeof(_In_ const bool &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a boolean
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val Variable to receive unpacked value
|
||||||
|
///
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ bool &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a byte
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val Variable with data to pack
|
||||||
|
///
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned char &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a byte
|
||||||
|
///
|
||||||
|
/// \param[in] val Data to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
inline size_t pksizeof(_In_ const unsigned char &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a byte
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val Variable to receive unpacked value
|
||||||
|
///
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned char &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs an unsigned int
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val Variable with data to pack
|
||||||
|
///
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned int &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of an unsigned int
|
||||||
|
///
|
||||||
|
/// \param[in] val Data to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
inline size_t pksizeof(_In_ const unsigned int &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks an unsigned int
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val Variable to receive unpacked value
|
||||||
|
///
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned int &val);
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
///
|
||||||
|
/// Packs a size_t
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val Variable with data to pack
|
||||||
|
///
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const size_t &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a size_t
|
||||||
|
///
|
||||||
|
/// \param[in] val Data to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
inline size_t pksizeof(_In_ const size_t &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a size_t
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val Variable to receive unpacked value
|
||||||
|
///
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ size_t &val);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a string
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val String to pack
|
||||||
|
///
|
||||||
|
template<class _Elem, class _Traits, class _Ax> inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a string
|
||||||
|
///
|
||||||
|
/// \param[in] val String to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
template<class _Elem, class _Traits, class _Ax> inline size_t pksizeof(const std::basic_string<_Elem, _Traits, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a string
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val String to unpack to
|
||||||
|
///
|
||||||
|
template<class _Elem, class _Traits, class _Ax> inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a wide string
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val String to pack
|
||||||
|
///
|
||||||
|
template<class _Traits, class _Ax> inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a wide string
|
||||||
|
///
|
||||||
|
/// \param[in] val String to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
template<class _Traits, class _Ax> inline size_t pksizeof(const std::basic_string<wchar_t, _Traits, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a wide string
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val String to unpack to
|
||||||
|
///
|
||||||
|
template<class _Traits, class _Ax> inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a vector
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val Vector to pack
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Ax> inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::vector<_Ty, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a vector
|
||||||
|
///
|
||||||
|
/// \param[in] val Vector to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Ax> inline size_t pksizeof(const std::vector<_Ty, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a vector
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val Vector to unpack to
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Ax> inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::vector<_Ty, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a list
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val List to pack
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Ax> inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::list<_Ty, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a list
|
||||||
|
///
|
||||||
|
/// \param[in] val List to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Ax> inline size_t pksizeof(const std::list<_Ty, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a list
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val List to unpack to
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Ax> inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::list<_Ty, _Ax> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a std::unique_ptr
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val std::unique_ptr to pack
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Dx> inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::unique_ptr<_Ty, _Dx> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a std::unique_ptr
|
||||||
|
///
|
||||||
|
/// \param[in] val std::unique_ptr to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Dx> inline size_t pksizeof(const std::unique_ptr<_Ty, _Dx> &val);
|
||||||
|
|
||||||
|
/////
|
||||||
|
///// Unpacks a std::unique_ptr
|
||||||
|
/////
|
||||||
|
///// \note Not generally unpackable, since we do not know, how to create a new instance of unique_ptr.
|
||||||
|
/////
|
||||||
|
///// \param[inout] cursor Memory cursor
|
||||||
|
///// \param[out] val std::unique_ptr to unpack to
|
||||||
|
/////
|
||||||
|
//template<class _Ty, class _Dx> inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::unique_ptr<_Ty, _Dx> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a certificate context
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val Certificate context to pack
|
||||||
|
///
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::cert_context &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a certificate context
|
||||||
|
///
|
||||||
|
/// \param[in] val Certificate context to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
inline size_t pksizeof(const winstd::cert_context &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a certificate context
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val Certificate context to unpack to
|
||||||
|
///
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::cert_context &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs an EAP method type
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val EAP method type to pack
|
||||||
|
///
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::eap_type_t &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of an EAP method type
|
||||||
|
///
|
||||||
|
/// \param[in] val EAP method type to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
inline size_t pksizeof(const winstd::eap_type_t &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks an EAP method type
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val EAP method type to unpack to
|
||||||
|
///
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::eap_type_t &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs a BLOB
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[in] val Variable with data to pack
|
||||||
|
///
|
||||||
|
template<size_t N> inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::sanitizing_blob_f<N> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns packed size of a BLOB
|
||||||
|
///
|
||||||
|
/// \param[in] val Data to pack
|
||||||
|
///
|
||||||
|
/// \returns Size of data when packed (in bytes)
|
||||||
|
///
|
||||||
|
template<size_t N> inline size_t pksizeof(_In_ const eap::sanitizing_blob_f<N> &val);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unpacks a BLOB
|
||||||
|
///
|
||||||
|
/// \param[inout] cursor Memory cursor
|
||||||
|
/// \param[out] val Variable to receive unpacked value
|
||||||
|
///
|
||||||
|
template<size_t N> inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::sanitizing_blob_f<N> &val);
|
||||||
|
|
||||||
|
#ifndef htonll
|
||||||
|
///
|
||||||
|
/// Convert host converts an unsigned __int64 from host to TCP/IP network byte order.
|
||||||
|
///
|
||||||
|
/// \param[in] val A 64-bit unsigned number in host byte order.
|
||||||
|
///
|
||||||
|
/// \returns The value in TCP/IP's network byte order.
|
||||||
|
///
|
||||||
|
inline unsigned __int64 htonll(unsigned __int64 val);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
struct cursor_out
|
||||||
|
{
|
||||||
|
typedef unsigned char *ptr_type;
|
||||||
|
|
||||||
|
ptr_type ptr; ///< Pointer to first data unwritten
|
||||||
|
ptr_type ptr_end; ///< Pointer to the end of available memory
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct cursor_in
|
||||||
|
{
|
||||||
|
typedef const unsigned char *ptr_type;
|
||||||
|
|
||||||
|
ptr_type ptr; ///< Pointer to first data unread
|
||||||
|
ptr_type ptr_end; ///< Pointer to the end of BLOB
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
template<size_t N>
|
||||||
|
struct __declspec(novtable) sanitizing_blob_f<N>
|
||||||
|
{
|
||||||
|
unsigned char data[N]; ///< BLOB data
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
inline sanitizing_blob_f()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies a BLOB
|
||||||
|
///
|
||||||
|
/// \param[in] other BLOB to copy from
|
||||||
|
///
|
||||||
|
inline sanitizing_blob_f(_In_ const sanitizing_blob_f<N> &other)
|
||||||
|
{
|
||||||
|
memcpy(data, other.data, N);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves the BLOB
|
||||||
|
///
|
||||||
|
/// \param[inout] other Zero-initialized BLOB to move from
|
||||||
|
///
|
||||||
|
inline sanitizing_blob_f(_Inout_ sanitizing_blob_zf<N> &&other)
|
||||||
|
{
|
||||||
|
memcpy(data, other.data, N);
|
||||||
|
memset(other.data, 0, N);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Destructor
|
||||||
|
///
|
||||||
|
inline ~sanitizing_blob_f()
|
||||||
|
{
|
||||||
|
SecureZeroMemory(data, N);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies a BLOB
|
||||||
|
///
|
||||||
|
/// \param[in] other BLOB to copy from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
inline sanitizing_blob_f& operator=(_In_ const sanitizing_blob_f<N> &other)
|
||||||
|
{
|
||||||
|
if (this != std::addressof(other))
|
||||||
|
memcpy(data, other.data, N);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves the BLOB
|
||||||
|
///
|
||||||
|
/// \param[inout] other Zero-initialized BLOB to copy from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
inline sanitizing_blob_f& operator=(_Inout_ sanitizing_blob_zf<N> &&other)
|
||||||
|
{
|
||||||
|
if (this != std::addressof(other)) {
|
||||||
|
memcpy(data, other.data, N);
|
||||||
|
memset(other.data, 0, N);
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Is BLOB not equal to?
|
||||||
|
///
|
||||||
|
/// \param[in] other BLOB to compare against
|
||||||
|
///
|
||||||
|
/// \returns
|
||||||
|
/// - \c true when BLOBs are not equal;
|
||||||
|
/// - \c false otherwise
|
||||||
|
///
|
||||||
|
inline bool operator!=(_In_ const sanitizing_blob_f<N> &other) const
|
||||||
|
{
|
||||||
|
return !operator==(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Is BLOB equal to?
|
||||||
|
///
|
||||||
|
/// \param[in] other BLOB to compare against
|
||||||
|
///
|
||||||
|
/// \returns
|
||||||
|
/// - \c true when BLOBs are equal;
|
||||||
|
/// - \c false otherwise
|
||||||
|
///
|
||||||
|
inline bool operator==(_In_ const sanitizing_blob_f<N> &other) const
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < N; i++)
|
||||||
|
if (data[i] != other.data[i]) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Is BLOB empty?
|
||||||
|
///
|
||||||
|
/// \returns
|
||||||
|
/// - \c true when BLOB is all-zero;
|
||||||
|
/// - \c false otherwise
|
||||||
|
///
|
||||||
|
inline bool empty() const
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < N; i++)
|
||||||
|
if (data[i]) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Zero the BLOB
|
||||||
|
///
|
||||||
|
inline void clear()
|
||||||
|
{
|
||||||
|
memset(data, 0, N);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<size_t N>
|
||||||
|
struct __declspec(novtable) sanitizing_blob_zf<N> : sanitizing_blob_f<N>
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// Constructor
|
||||||
|
///
|
||||||
|
inline sanitizing_blob_zf() : sanitizing_blob_f<N>()
|
||||||
|
{
|
||||||
|
memset(data, 0, N);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Copies a BLOB
|
||||||
|
///
|
||||||
|
/// \param[in] other BLOB to copy from
|
||||||
|
///
|
||||||
|
inline sanitizing_blob_zf(_In_ const sanitizing_blob_f<N> &other) :
|
||||||
|
sanitizing_blob_f<N>(other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves the BLOB
|
||||||
|
///
|
||||||
|
/// \param[inout] other Zero-initialized BLOB to move from
|
||||||
|
///
|
||||||
|
inline sanitizing_blob_zf(_Inout_ sanitizing_blob_zf<N> &&other) :
|
||||||
|
sanitizing_blob_f<N>(std::move(other))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
|
||||||
|
#pragma warning(suppress: 4480)
|
||||||
|
enum diameter_avp_flags_t : unsigned char {
|
||||||
|
diameter_avp_flag_vendor = 0x80, ///< Vendor-ID present
|
||||||
|
diameter_avp_flag_mandatory = 0x40, ///< Mandatory
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
|
#pragma pack(1)
|
||||||
|
struct diameter_avp
|
||||||
|
{
|
||||||
|
unsigned char code[4]; ///< AVP Code
|
||||||
|
unsigned char flags; ///< AVP Flags
|
||||||
|
unsigned char length[3]; ///< AVP Length
|
||||||
|
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable: 4201)
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
|
unsigned char vendor[4]; ///< Vendor-ID
|
||||||
|
unsigned char v_data[1]; ///< Data (when Vendor-ID present)
|
||||||
|
};
|
||||||
|
unsigned char data[1]; ///< Data (when Vendor-ID absent)
|
||||||
|
};
|
||||||
|
#pragma warning(pop)
|
||||||
|
};
|
||||||
|
#pragma pack(pop)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const bool &val)
|
||||||
|
{
|
||||||
|
eap::cursor_out::ptr_type ptr_end = cursor.ptr + 1;
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
*cursor.ptr = val ? 1 : 0;
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline size_t pksizeof(_In_ const bool &val)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(val);
|
||||||
|
return sizeof(unsigned char);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ bool &val)
|
||||||
|
{
|
||||||
|
eap::cursor_in::ptr_type ptr_end = cursor.ptr + 1;
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
val = *cursor.ptr ? true : false;
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned char &val)
|
||||||
|
{
|
||||||
|
eap::cursor_out::ptr_type ptr_end = cursor.ptr + 1;
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
*cursor.ptr = val;
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline size_t pksizeof(_In_ const unsigned char &val)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(val);
|
||||||
|
return sizeof(unsigned char);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned char &val)
|
||||||
|
{
|
||||||
|
eap::cursor_in::ptr_type ptr_end = cursor.ptr + 1;
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
val = *cursor.ptr;
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const unsigned int &val)
|
||||||
|
{
|
||||||
|
eap::cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(unsigned int);
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
*(unsigned int*)cursor.ptr = val;
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline size_t pksizeof(_In_ const unsigned int &val)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(val);
|
||||||
|
return sizeof(unsigned int);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ unsigned int &val)
|
||||||
|
{
|
||||||
|
eap::cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(unsigned int);
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
val = *(unsigned int*)cursor.ptr;
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN64
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const size_t &val)
|
||||||
|
{
|
||||||
|
eap::cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(size_t);
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
*(size_t*)cursor.ptr = val;
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline size_t pksizeof(_In_ const size_t &val)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(val);
|
||||||
|
return sizeof(size_t);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ size_t &val)
|
||||||
|
{
|
||||||
|
eap::cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(size_t);
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
val = *(size_t*)cursor.ptr;
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||||
|
{
|
||||||
|
std::basic_string<_Elem, _Traits, _Ax>::size_type count = val.length();
|
||||||
|
assert(strlen(val.c_str()) == count); // String should not contain zero terminators.
|
||||||
|
size_t size = sizeof(_Elem)*(count + 1);
|
||||||
|
eap::cursor_out::ptr_type ptr_end = cursor.ptr + size;
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
memcpy(cursor.ptr, (const _Elem*)val.c_str(), size);
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
|
inline size_t pksizeof(const std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||||
|
{
|
||||||
|
return sizeof(_Elem)*(val.length() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||||
|
{
|
||||||
|
size_t count_max = cursor.ptr_end - cursor.ptr;
|
||||||
|
std::basic_string<_Elem, _Traits, _Ax>::size_type count = strnlen((const _Elem*&)cursor.ptr, count_max);
|
||||||
|
assert(count < count_max); // String should be zero terminated.
|
||||||
|
val.assign((const _Elem*&)cursor.ptr, count);
|
||||||
|
cursor.ptr += sizeof(_Elem)*(count + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Traits, class _Ax>
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||||
|
{
|
||||||
|
std::string val_utf8;
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), val_utf8, NULL, NULL);
|
||||||
|
cursor << val_utf8;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Traits, class _Ax>
|
||||||
|
inline size_t pksizeof(const std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||||
|
{
|
||||||
|
return sizeof(char)*(WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), NULL, 0, NULL, NULL) + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Traits, class _Ax>
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||||
|
{
|
||||||
|
std::string val_utf8;
|
||||||
|
cursor >> val_utf8;
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, val_utf8.c_str(), (int)val_utf8.length(), val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::vector<_Ty, _Ax> &val)
|
||||||
|
{
|
||||||
|
std::vector<_Ty, _Ax>::size_type count = val.size();
|
||||||
|
cursor << count;
|
||||||
|
|
||||||
|
// Since we do not know wheter vector elements are primitives or objects, iterate instead of memcpy.
|
||||||
|
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||||
|
for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++)
|
||||||
|
cursor << val[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
inline size_t pksizeof(const std::vector<_Ty, _Ax> &val)
|
||||||
|
{
|
||||||
|
// Since we do not know wheter vector elements are primitives or objects, iterate instead of sizeof().
|
||||||
|
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||||
|
std::vector<_Ty, _Ax>::size_type count = val.size();
|
||||||
|
size_t size = pksizeof(count);
|
||||||
|
for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++)
|
||||||
|
size += pksizeof(val[i]);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::vector<_Ty, _Ax> &val)
|
||||||
|
{
|
||||||
|
std::vector<_Ty, _Ax>::size_type count;
|
||||||
|
cursor >> count;
|
||||||
|
|
||||||
|
// Since we do not know wheter vector elements are primitives or objects, iterate instead of assign().
|
||||||
|
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||||
|
val.clear();
|
||||||
|
val.reserve(count);
|
||||||
|
for (std::vector<_Ty, _Ax>::size_type i = 0; i < count; i++) {
|
||||||
|
_Ty el;
|
||||||
|
cursor >> el;
|
||||||
|
val.push_back(el);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::list<_Ty, _Ax> &val)
|
||||||
|
{
|
||||||
|
std::list<_Ty, _Ax>::size_type count = val.size();
|
||||||
|
cursor << count;
|
||||||
|
|
||||||
|
// Since we do not know wheter list elements are primitives or objects, iterate instead of memcpy.
|
||||||
|
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||||
|
for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i)
|
||||||
|
cursor << *i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
inline size_t pksizeof(const std::list<_Ty, _Ax> &val)
|
||||||
|
{
|
||||||
|
// Since we do not know wheter list elements are primitives or objects, iterate instead of sizeof().
|
||||||
|
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||||
|
std::list<_Ty, _Ax>::size_type count = val.size();
|
||||||
|
size_t size = pksizeof(count);
|
||||||
|
for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i)
|
||||||
|
size += pksizeof(*i);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ std::list<_Ty, _Ax> &val)
|
||||||
|
{
|
||||||
|
std::list<_Ty, _Ax>::size_type count;
|
||||||
|
cursor >> count;
|
||||||
|
|
||||||
|
// Since we do not know wheter list elements are primitives or objects, iterate instead of assign().
|
||||||
|
// For performance critical vectors of flat opaque data types write specialized template instantiation.
|
||||||
|
val.clear();
|
||||||
|
for (std::list<_Ty, _Ax>::size_type i = 0; i < count; i++) {
|
||||||
|
_Ty el;
|
||||||
|
cursor >> el;
|
||||||
|
val.push_back(el);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Dx>
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const std::unique_ptr<_Ty, _Dx> &val)
|
||||||
|
{
|
||||||
|
if (val) {
|
||||||
|
cursor << true;
|
||||||
|
cursor << *val;
|
||||||
|
} else
|
||||||
|
cursor << false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Dx>
|
||||||
|
inline size_t pksizeof(const std::unique_ptr<_Ty, _Dx> &val)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
val ?
|
||||||
|
pksizeof(true) +
|
||||||
|
pksizeof(*val) :
|
||||||
|
pksizeof(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::cert_context &val)
|
||||||
|
{
|
||||||
|
if (val) {
|
||||||
|
cursor << (unsigned int)val->dwCertEncodingType;
|
||||||
|
cursor << (unsigned int)val->cbCertEncoded ;
|
||||||
|
eap::cursor_out::ptr_type ptr_end = cursor.ptr + val->cbCertEncoded;
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
memcpy(cursor.ptr, val->pbCertEncoded, val->cbCertEncoded);
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
} else {
|
||||||
|
cursor << (unsigned int)0;
|
||||||
|
cursor << (unsigned int)0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline size_t pksizeof(const winstd::cert_context &val)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
val ?
|
||||||
|
pksizeof((unsigned int)val->dwCertEncodingType) +
|
||||||
|
pksizeof((unsigned int)val->cbCertEncoded ) +
|
||||||
|
val->cbCertEncoded :
|
||||||
|
pksizeof((unsigned int)0) +
|
||||||
|
pksizeof((unsigned int)0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::cert_context &val)
|
||||||
|
{
|
||||||
|
DWORD dwCertEncodingType;
|
||||||
|
cursor >> (unsigned int&)dwCertEncodingType;
|
||||||
|
|
||||||
|
DWORD dwCertEncodedSize;
|
||||||
|
cursor >> (unsigned int&)dwCertEncodedSize;
|
||||||
|
|
||||||
|
if (dwCertEncodedSize) {
|
||||||
|
eap::cursor_in::ptr_type ptr_end = cursor.ptr + dwCertEncodedSize;
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
val.create(dwCertEncodingType, (BYTE*)cursor.ptr, dwCertEncodedSize);
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
} else
|
||||||
|
val.free();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const winstd::eap_type_t &val)
|
||||||
|
{
|
||||||
|
cursor << (unsigned char)val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline size_t pksizeof(_In_ const winstd::eap_type_t &val)
|
||||||
|
{
|
||||||
|
return pksizeof((unsigned char)val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ winstd::eap_type_t &val)
|
||||||
|
{
|
||||||
|
cursor >> (unsigned char&)val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<size_t N>
|
||||||
|
inline void operator<<(_Inout_ eap::cursor_out &cursor, _In_ const eap::sanitizing_blob_f<N> &val)
|
||||||
|
{
|
||||||
|
eap::cursor_out::ptr_type ptr_end = cursor.ptr + sizeof(eap::sanitizing_blob_f<N>);
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
memcpy(cursor.ptr, val.data, sizeof(eap::sanitizing_blob_f<N>));
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<size_t N>
|
||||||
|
inline size_t pksizeof(_In_ const eap::sanitizing_blob_f<N> &val)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(val);
|
||||||
|
return sizeof(eap::sanitizing_blob_f<N>);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<size_t N>
|
||||||
|
inline void operator>>(_Inout_ eap::cursor_in &cursor, _Out_ eap::sanitizing_blob_f<N> &val)
|
||||||
|
{
|
||||||
|
eap::cursor_in::ptr_type ptr_end = cursor.ptr + sizeof(eap::sanitizing_blob_f<N>);
|
||||||
|
assert(ptr_end <= cursor.ptr_end);
|
||||||
|
memcpy(val.data, cursor.ptr, sizeof(eap::sanitizing_blob_f<N>));
|
||||||
|
cursor.ptr = ptr_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef htonll
|
||||||
|
|
||||||
|
inline unsigned __int64 htonll(unsigned __int64 val)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(unsigned __int64)htonl((u_long)((val >> 32) & 0xffffffff)) |
|
||||||
|
(unsigned __int64)htonl((u_long)((val ) & 0xffffffff)) << 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
399
lib/EAPBase/include/EAPXML.h
Normal file
399
lib/EAPBase/include/EAPXML.h
Normal file
@@ -0,0 +1,399 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <MsXml.h>
|
||||||
|
#include <msxml6.h>
|
||||||
|
#include <sal.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace eapxml
|
||||||
|
{
|
||||||
|
inline HRESULT get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ IXMLDOMDocument2 **ppXmlDoc);
|
||||||
|
inline HRESULT select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNode **ppXmlNode);
|
||||||
|
inline HRESULT select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNodeList **ppXmlNodes);
|
||||||
|
inline HRESULT select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ IXMLDOMElement **ppXmlElement);
|
||||||
|
inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement);
|
||||||
|
inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement);
|
||||||
|
inline bool has_parent(_In_ IXMLDOMNode *pXmlNode);
|
||||||
|
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ BSTR *pbstrValue);
|
||||||
|
template<class _Traits, class _Ax> inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue);
|
||||||
|
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD *pdwValue);
|
||||||
|
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool *pbValue);
|
||||||
|
template<class _Ty, class _Ax> inline HRESULT get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||||
|
template<class _Ty, class _Ax> inline HRESULT get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||||
|
inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ BSTR *pbstrValue);
|
||||||
|
template<class _Traits, class _Ax> inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue);
|
||||||
|
inline HRESULT put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement);
|
||||||
|
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue);
|
||||||
|
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue);
|
||||||
|
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue);
|
||||||
|
inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
|
||||||
|
inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
|
||||||
|
inline std::wstring get_xpath(_In_ IXMLDOMNode *pXmlNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <WinStd/Base64.h>
|
||||||
|
#include <WinStd/COM.h>
|
||||||
|
#include <WinStd/Hex.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace eapxml
|
||||||
|
{
|
||||||
|
inline HRESULT get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ IXMLDOMDocument2 **ppXmlDoc)
|
||||||
|
{
|
||||||
|
assert(pXmlNode);
|
||||||
|
assert(ppXmlDoc);
|
||||||
|
|
||||||
|
HRESULT hr;
|
||||||
|
winstd::com_obj<IXMLDOMDocument> doc;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = pXmlNode->get_ownerDocument(&doc)) &&
|
||||||
|
SUCCEEDED(hr = doc.query_interface(ppXmlDoc)) ? S_OK : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNode **ppXmlNode)
|
||||||
|
{
|
||||||
|
assert(pXmlParent);
|
||||||
|
assert(ppXmlNode);
|
||||||
|
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = pXmlParent->selectSingleNode(bstrNodeName, ppXmlNode)) ?
|
||||||
|
*ppXmlNode ? S_OK : E_NOT_SET : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNodeList **ppXmlNodes)
|
||||||
|
{
|
||||||
|
assert(pXmlParent);
|
||||||
|
assert(ppXmlNodes);
|
||||||
|
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = pXmlParent->selectNodes(bstrNodeName, ppXmlNodes)) ?
|
||||||
|
*ppXmlNodes ? S_OK : E_NOT_SET : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ IXMLDOMElement **ppXmlElement)
|
||||||
|
{
|
||||||
|
assert(ppXmlElement);
|
||||||
|
|
||||||
|
HRESULT hr;
|
||||||
|
winstd::com_obj<IXMLDOMNode> pXmlNode;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = select_node(pXmlParent, bstrElementName, &pXmlNode)) ?
|
||||||
|
SUCCEEDED(hr = pXmlNode.query_interface(ppXmlElement)) ?
|
||||||
|
*ppXmlElement ? S_OK : E_NOT_SET : hr : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement)
|
||||||
|
{
|
||||||
|
assert(pDoc);
|
||||||
|
assert(ppXmlElement);
|
||||||
|
|
||||||
|
static const winstd::variant varNodeTypeEl(NODE_ELEMENT);
|
||||||
|
HRESULT hr;
|
||||||
|
winstd::com_obj<IXMLDOMNode> pXmlNode;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = pDoc->createNode(varNodeTypeEl, bstrElementName, bstrNamespace, &pXmlNode)) ?
|
||||||
|
SUCCEEDED(hr = pXmlNode.query_interface(ppXmlElement)) ?
|
||||||
|
*ppXmlElement ? S_OK : E_NOT_SET : hr : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT create_element(_In_ IXMLDOMDocument *pDoc, IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementNameSelect, _In_z_ const BSTR bstrElementNameCreate, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement)
|
||||||
|
{
|
||||||
|
assert(pDoc);
|
||||||
|
assert(pXmlParent);
|
||||||
|
assert(ppXmlElement);
|
||||||
|
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = select_element(pXmlParent, bstrElementNameSelect, ppXmlElement)) ? S_OK :
|
||||||
|
SUCCEEDED(hr = create_element(pDoc, bstrElementNameCreate, bstrNamespace, ppXmlElement)) ?
|
||||||
|
SUCCEEDED(hr = pXmlParent->appendChild(*ppXmlElement, NULL)) ? S_OK : hr : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool has_parent(_In_ IXMLDOMNode *pXmlNode)
|
||||||
|
{
|
||||||
|
assert(pXmlNode);
|
||||||
|
|
||||||
|
winstd::com_obj<IXMLDOMNode> pXmlNodeParent;
|
||||||
|
|
||||||
|
return SUCCEEDED(pXmlNode->get_parentNode(&pXmlNodeParent)) && pXmlNodeParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ BSTR *pbstrValue)
|
||||||
|
{
|
||||||
|
assert(pbstrValue);
|
||||||
|
|
||||||
|
HRESULT hr;
|
||||||
|
winstd::com_obj<IXMLDOMElement> pXmlElement;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = select_element(pXmlParent, bstrElementName, &pXmlElement)) ?
|
||||||
|
SUCCEEDED(hr = pXmlElement->get_text(pbstrValue)) ?
|
||||||
|
*pbstrValue ? S_OK : E_NOT_SET : hr : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Traits, class _Ax>
|
||||||
|
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
|
||||||
|
{
|
||||||
|
winstd::bstr bstr;
|
||||||
|
HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
sValue.assign(bstr, bstr.length());
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD *pdwValue)
|
||||||
|
{
|
||||||
|
assert(pdwValue);
|
||||||
|
|
||||||
|
winstd::bstr bstr;
|
||||||
|
HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
*pdwValue = wcstoul(bstr, NULL, 10);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool *pbValue)
|
||||||
|
{
|
||||||
|
assert(pbValue);
|
||||||
|
|
||||||
|
winstd::bstr bstr;
|
||||||
|
HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"true" , -1, NULL, NULL, 0) == CSTR_EQUAL ||
|
||||||
|
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"1" , -1, NULL, NULL, 0) == CSTR_EQUAL)
|
||||||
|
*pbValue = true;
|
||||||
|
else if (
|
||||||
|
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"false", -1, NULL, NULL, 0) == CSTR_EQUAL ||
|
||||||
|
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"0" , -1, NULL, NULL, 0) == CSTR_EQUAL)
|
||||||
|
*pbValue = false;
|
||||||
|
else
|
||||||
|
hr = E_NOT_VALID_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
inline HRESULT get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||||
|
{
|
||||||
|
winstd::bstr bstr;
|
||||||
|
HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
winstd::base64_dec dec;
|
||||||
|
bool is_last;
|
||||||
|
dec.decode(aValue, is_last, (BSTR)bstr, bstr.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
inline HRESULT get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||||
|
{
|
||||||
|
winstd::bstr bstr;
|
||||||
|
HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||||
|
if (SUCCEEDED(hr)) {
|
||||||
|
winstd::hex_dec dec;
|
||||||
|
bool is_last;
|
||||||
|
dec.decode(aValue, is_last, (BSTR)bstr, bstr.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ BSTR *pbstrValue)
|
||||||
|
{
|
||||||
|
assert(pbstrValue);
|
||||||
|
|
||||||
|
HRESULT hr;
|
||||||
|
winstd::com_obj<IXMLDOMElement> pXmlElement;
|
||||||
|
|
||||||
|
if (FAILED(hr = select_element(pXmlParent, bstrElementName, &pXmlElement)))
|
||||||
|
return hr;
|
||||||
|
|
||||||
|
winstd::com_obj<IXMLDOMNodeList> pXmlListLocalizedText;
|
||||||
|
long lCount = 0;
|
||||||
|
if (FAILED(select_nodes(pXmlElement, winstd::bstr(L"eap-metadata:localized-text"), &pXmlListLocalizedText)) ||
|
||||||
|
FAILED(pXmlListLocalizedText->get_length(&lCount)) ||
|
||||||
|
lCount <= 0)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = pXmlElement->get_text(pbstrValue)) ?
|
||||||
|
*pbstrValue ? S_OK : E_NOT_SET : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
winstd::bstr bstrDefault, bstrEn;
|
||||||
|
for (long i = 0; ; i++) {
|
||||||
|
if (i >= lCount) {
|
||||||
|
if (bstrDefault != NULL) {
|
||||||
|
// Return "C" localization.
|
||||||
|
*pbstrValue = bstrDefault.detach();
|
||||||
|
return S_OK;
|
||||||
|
} else if (bstrEn != NULL) {
|
||||||
|
// Return "en" localization.
|
||||||
|
*pbstrValue = bstrEn.detach();
|
||||||
|
return S_OK;
|
||||||
|
} else
|
||||||
|
return ERROR_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
winstd::com_obj<IXMLDOMNode> pXmlElLocalizedText;
|
||||||
|
pXmlListLocalizedText->get_item(i, &pXmlElLocalizedText);
|
||||||
|
|
||||||
|
{
|
||||||
|
// Read <lang>.
|
||||||
|
winstd::bstr bstrLang;
|
||||||
|
if (FAILED(get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:lang"), &bstrLang)) ||
|
||||||
|
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrLang, bstrLang.length(), L"C" , -1, NULL, NULL, 0) == CSTR_EQUAL)
|
||||||
|
{
|
||||||
|
// <lang> is missing or "C" language found.
|
||||||
|
winstd::bstr bstr;
|
||||||
|
if (SUCCEEDED(hr = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), &bstr)))
|
||||||
|
bstrDefault.attach(bstr.detach());
|
||||||
|
} else if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrLang, bstrLang.length(), pszLang, -1, NULL, NULL, 0) == CSTR_EQUAL) {
|
||||||
|
// Found an exact match.
|
||||||
|
return get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), pbstrValue);
|
||||||
|
} else if (CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstrLang, bstrLang.length(), L"en", -1, NULL, NULL, 0) == CSTR_EQUAL) {
|
||||||
|
// "en" language found.
|
||||||
|
winstd::bstr bstr;
|
||||||
|
if (SUCCEEDED(hr = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), &bstr)))
|
||||||
|
bstrEn.attach(bstr.detach());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class _Traits, class _Ax>
|
||||||
|
inline HRESULT get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
|
||||||
|
{
|
||||||
|
winstd::bstr bstr;
|
||||||
|
HRESULT hr = get_element_localized(pXmlParent, bstrElementName, pszLang, &bstr);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
sValue.assign(bstr, bstr.length());
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement)
|
||||||
|
{
|
||||||
|
assert(pDoc);
|
||||||
|
assert(pCurrentDOMNode);
|
||||||
|
assert(ppXmlElement);
|
||||||
|
|
||||||
|
static const VARIANT varNodeTypeEl = { VT_I4, 0, 0, 0, { NODE_ELEMENT } };
|
||||||
|
HRESULT hr;
|
||||||
|
winstd::com_obj<IXMLDOMNode> pXmlEl;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = pDoc->createNode(varNodeTypeEl, bstrElementName, bstrNamespace, &pXmlEl)) &&
|
||||||
|
SUCCEEDED(hr = pCurrentDOMNode->appendChild(pXmlEl, NULL)) &&
|
||||||
|
SUCCEEDED(hr = pXmlEl.query_interface(ppXmlElement)) ? S_OK : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_z_ const BSTR bstrValue)
|
||||||
|
{
|
||||||
|
assert(pDoc);
|
||||||
|
|
||||||
|
static const VARIANT varNodeTypeEl = { VT_I4, 0, 0, 0, { NODE_ELEMENT } };
|
||||||
|
HRESULT hr;
|
||||||
|
winstd::com_obj<IXMLDOMNode> pXmlEl;
|
||||||
|
winstd::com_obj<IXMLDOMText> pXmlElText;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(hr = pDoc->createNode(varNodeTypeEl, bstrElementName, bstrNamespace, &pXmlEl)) &&
|
||||||
|
SUCCEEDED(hr = pDoc->createTextNode(bstrValue, &pXmlElText)) &&
|
||||||
|
SUCCEEDED(hr = pXmlEl->appendChild(pXmlElText, NULL)) &&
|
||||||
|
SUCCEEDED(hr = pCurrentDOMNode->appendChild(pXmlEl, NULL)) ? S_OK : hr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue)
|
||||||
|
{
|
||||||
|
return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(winstd::wstring_printf(L"%d", dwValue)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue)
|
||||||
|
{
|
||||||
|
return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(bValue ? L"true": L"false"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT put_element_base64(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
|
||||||
|
{
|
||||||
|
std::wstring sBase64;
|
||||||
|
winstd::base64_enc enc;
|
||||||
|
enc.encode(sBase64, pValue, nValueLen);
|
||||||
|
return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(sBase64));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline HRESULT put_element_hex(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
|
||||||
|
{
|
||||||
|
std::wstring sHex;
|
||||||
|
winstd::hex_enc enc;
|
||||||
|
enc.encode(sHex, pValue, nValueLen);
|
||||||
|
return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(sHex));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline std::wstring get_xpath(_In_ IXMLDOMNode *pXmlNode)
|
||||||
|
{
|
||||||
|
if (pXmlNode) {
|
||||||
|
winstd::bstr bstr;
|
||||||
|
winstd::com_obj<IXMLDOMNode> pXmlNodeParent;
|
||||||
|
|
||||||
|
return
|
||||||
|
SUCCEEDED(pXmlNode->get_nodeName(&bstr)) ?
|
||||||
|
SUCCEEDED(pXmlNode->get_parentNode(&pXmlNodeParent)) ? get_xpath(pXmlNodeParent) + L"/" + (LPCWSTR)bstr : (LPCWSTR)bstr : L"?";
|
||||||
|
} else
|
||||||
|
return L"";
|
||||||
|
}
|
||||||
|
}
|
137
lib/EAPBase/include/Method.h
Normal file
137
lib/EAPBase/include/Method.h
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// EAP method base class
|
||||||
|
///
|
||||||
|
class method;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
|
#include "Credentials.h"
|
||||||
|
#include "Module.h"
|
||||||
|
|
||||||
|
#include <WinStd/EAP.h>
|
||||||
|
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <eaptypes.h> // Must include after <Windows.h>
|
||||||
|
extern "C" {
|
||||||
|
#include <eapmethodpeerapis.h>
|
||||||
|
}
|
||||||
|
#include <sal.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
class method
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs an EAP method
|
||||||
|
///
|
||||||
|
/// \param[in] mod EAP module to use for global services
|
||||||
|
/// \param[in] cfg Providers configuration
|
||||||
|
/// \param[in] cred User credentials
|
||||||
|
///
|
||||||
|
method(_In_ module &module, _In_ config_provider_list &cfg, _In_ credentials &cred);
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves an EAP method
|
||||||
|
///
|
||||||
|
/// \param[in] other EAP method to move from
|
||||||
|
///
|
||||||
|
method(_Inout_ method &&other);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Moves an EAP method
|
||||||
|
///
|
||||||
|
/// \param[in] other EAP method to move from
|
||||||
|
///
|
||||||
|
/// \returns Reference to this object
|
||||||
|
///
|
||||||
|
method& operator=(_Inout_ method &&other);
|
||||||
|
|
||||||
|
/// \name Packet processing
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Starts an EAP authentication session on the peer EAPHost using the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
|
||||||
|
///
|
||||||
|
virtual void begin_session(
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ const EapAttributes *pAttributeArray,
|
||||||
|
_In_ HANDLE hTokenImpersonateUser,
|
||||||
|
_In_ DWORD dwMaxSendPacketSize);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Ends an EAP authentication session for the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerEndSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363604.aspx)
|
||||||
|
///
|
||||||
|
virtual void end_session();
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Processes a packet received by EAPHost from a supplicant.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||||
|
///
|
||||||
|
virtual void process_request_packet(
|
||||||
|
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
|
||||||
|
_In_ DWORD dwReceivedPacketSize,
|
||||||
|
_Inout_ EapPeerMethodOutput *pEapOutput) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Obtains a response packet from the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
||||||
|
///
|
||||||
|
virtual void get_response_packet(
|
||||||
|
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
|
||||||
|
_Inout_ DWORD *pdwSendPacketSize) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Obtains the result of an authentication session from the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
|
||||||
|
///
|
||||||
|
virtual void get_result(
|
||||||
|
_In_ EapPeerMethodResultReason reason,
|
||||||
|
_Inout_ EapPeerMethodResult *ppResult) = 0;
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// This class is noncopyable.
|
||||||
|
method(_In_ const method &other);
|
||||||
|
method& operator=(_In_ const method &other);
|
||||||
|
|
||||||
|
public:
|
||||||
|
module &m_module; ///< EAP module
|
||||||
|
config_provider_list &m_cfg; ///< Providers configuration
|
||||||
|
credentials &m_cred; ///< User credentials
|
||||||
|
};
|
||||||
|
}
|
782
lib/EAPBase/include/Module.h
Normal file
782
lib/EAPBase/include/Module.h
Normal file
@@ -0,0 +1,782 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
///
|
||||||
|
/// EAP module base class
|
||||||
|
///
|
||||||
|
/// Provides basic services to EAP methods.
|
||||||
|
///
|
||||||
|
class module;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// EAP peer base class
|
||||||
|
///
|
||||||
|
/// A group of methods all EAP peers must or should implement.
|
||||||
|
///
|
||||||
|
class peer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "EAP.h"
|
||||||
|
|
||||||
|
#include <WinStd/Crypt.h>
|
||||||
|
#include <WinStd/ETW.h>
|
||||||
|
#include <WinStd/Win.h>
|
||||||
|
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <eaptypes.h> // Must include after <Windows.h>
|
||||||
|
extern "C" {
|
||||||
|
#include <eapmethodpeerapis.h>
|
||||||
|
}
|
||||||
|
#include <sal.h>
|
||||||
|
#include <tchar.h>
|
||||||
|
|
||||||
|
#include <EventsETW.h> // Must include after <Windows.h>
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
|
|
||||||
|
namespace eap
|
||||||
|
{
|
||||||
|
class module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs a module for the given EAP type
|
||||||
|
///
|
||||||
|
/// \param[in] eap_method EAP method type ID
|
||||||
|
///
|
||||||
|
module(_In_ winstd::eap_type_t eap_method = winstd::eap_type_undefined);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Destructs the module
|
||||||
|
///
|
||||||
|
virtual ~module();
|
||||||
|
|
||||||
|
/// \name Memory management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Allocate a EAP_ERROR and fill it according to dwErrorCode
|
||||||
|
///
|
||||||
|
EAP_ERROR* make_error(_In_ DWORD dwErrorCode, _In_opt_z_ LPCWSTR pszRootCauseString = NULL, _In_opt_z_ LPCWSTR pszRepairString = NULL, _In_opt_ DWORD dwReasonCode = 0, _In_opt_ LPCGUID pRootCauseGuid = NULL, _In_opt_ LPCGUID pRepairGuid = NULL, _In_opt_ LPCGUID pHelpLinkGuid = NULL) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Allocate a EAP_ERROR and fill it according to exception
|
||||||
|
///
|
||||||
|
EAP_ERROR* make_error(_In_ std::exception &err) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Allocate BLOB
|
||||||
|
///
|
||||||
|
BYTE* alloc_memory(_In_ size_t size);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Free BLOB allocated with this peer
|
||||||
|
///
|
||||||
|
void free_memory(_In_ BYTE *ptr);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Free EAP_ERROR allocated with `make_error()` method
|
||||||
|
///
|
||||||
|
void free_error_memory(_In_ EAP_ERROR *err);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Makes a new method config
|
||||||
|
///
|
||||||
|
virtual config_method* make_config_method();
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/// \name Logging
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Writes EAPMETHOD_TRACE_EVT_FN_CALL and returns auto event writer class
|
||||||
|
///
|
||||||
|
/// \param[in] pszFnName Function name
|
||||||
|
///
|
||||||
|
/// \returns A new auto event writer that writes EAPMETHOD_TRACE_EVT_FN_RETURN event on destruction
|
||||||
|
///
|
||||||
|
inline winstd::event_fn_auto get_event_fn_auto(_In_z_ LPCSTR pszFnName) const
|
||||||
|
{
|
||||||
|
return winstd::event_fn_auto(m_ep, &EAPMETHOD_TRACE_EVT_FN_CALL, &EAPMETHOD_TRACE_EVT_FN_RETURN, pszFnName);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Writes EAPMETHOD_TRACE_EVT_FN_CALL and returns auto event writer class
|
||||||
|
///
|
||||||
|
/// \param[in] pszFnName Function name
|
||||||
|
///
|
||||||
|
/// \returns A new auto event writer that writes EAPMETHOD_TRACE_EVT_FN_RETURN_DWORD event on destruction
|
||||||
|
///
|
||||||
|
inline winstd::event_fn_auto_ret<DWORD> get_event_fn_auto(_In_z_ LPCSTR pszFnName, _In_ DWORD &result) const
|
||||||
|
{
|
||||||
|
return winstd::event_fn_auto_ret<DWORD>(m_ep, &EAPMETHOD_TRACE_EVT_FN_CALL, &EAPMETHOD_TRACE_EVT_FN_RETURN_DWORD, pszFnName, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Logs error
|
||||||
|
///
|
||||||
|
void log_error(_In_ const EAP_ERROR *err) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Logs Unicode string config value
|
||||||
|
///
|
||||||
|
inline void log_config(_In_z_ LPCWSTR name, _In_z_ LPCWSTR value) const
|
||||||
|
{
|
||||||
|
m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_UNICODE_STRING, winstd::event_data(name), winstd::event_data(value), winstd::event_data::blank);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Logs string list config value
|
||||||
|
///
|
||||||
|
template<class _Traits, class _Ax, class _Ax_list>
|
||||||
|
inline void log_config(_In_z_ LPCWSTR name, _In_z_ const std::list<std::basic_string<char, _Traits, _Ax>, _Ax_list> &value) const
|
||||||
|
{
|
||||||
|
// Prepare a table of event data descriptors.
|
||||||
|
std::vector<EVENT_DATA_DESCRIPTOR> desc;
|
||||||
|
size_t count = value.size();
|
||||||
|
desc.reserve(count + 2);
|
||||||
|
desc.push_back(winstd::event_data( name ));
|
||||||
|
desc.push_back(winstd::event_data((unsigned int)count));
|
||||||
|
for (std::list<std::basic_string<char, _Traits, _Ax>, _Ax_list>::const_iterator v = value.cbegin(), v_end = value.cend(); v != v_end; ++v)
|
||||||
|
desc.push_back(winstd::event_data(*v));
|
||||||
|
|
||||||
|
m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_ANSI_STRING_ARRAY, (ULONG)desc.size(), desc.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Logs Unicode string list config value
|
||||||
|
///
|
||||||
|
template<class _Traits, class _Ax, class _Ax_list>
|
||||||
|
inline void log_config(_In_z_ LPCWSTR name, _In_z_ const std::list<std::basic_string<wchar_t, _Traits, _Ax>, _Ax_list> &value) const
|
||||||
|
{
|
||||||
|
// Prepare a table of event data descriptors.
|
||||||
|
std::vector<EVENT_DATA_DESCRIPTOR> desc;
|
||||||
|
size_t count = value.size();
|
||||||
|
desc.reserve(count + 2);
|
||||||
|
desc.push_back(winstd::event_data( name ));
|
||||||
|
desc.push_back(winstd::event_data((unsigned int)count));
|
||||||
|
for (std::list<std::basic_string<wchar_t, _Traits, _Ax>, _Ax_list>::const_iterator v = value.cbegin(), v_end = value.cend(); v != v_end; ++v)
|
||||||
|
desc.push_back(winstd::event_data(*v));
|
||||||
|
|
||||||
|
m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_UNICODE_STRING_ARRAY, (ULONG)desc.size(), desc.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Logs boolean config value
|
||||||
|
///
|
||||||
|
inline void log_config(_In_z_ LPCWSTR name, _In_ bool value) const
|
||||||
|
{
|
||||||
|
m_ep.write(&EAPMETHOD_TRACE_EVT_CFG_VALUE_BOOL, winstd::event_data(name), winstd::event_data((int)value), winstd::event_data::blank);
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Logs event
|
||||||
|
///
|
||||||
|
inline void log_event(_In_ PCEVENT_DESCRIPTOR EventDescriptor, ...) const
|
||||||
|
{
|
||||||
|
va_list arg;
|
||||||
|
va_start(arg, EventDescriptor);
|
||||||
|
m_ep.write(EventDescriptor, arg);
|
||||||
|
va_end(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/// \name Encryption
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Encrypts data
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] data Pointer to data to encrypt
|
||||||
|
/// \param[in ] size Size of \p data in bytes
|
||||||
|
/// \param[out] enc Encrypted data
|
||||||
|
/// \param[out] hHash Handle of hashing object
|
||||||
|
///
|
||||||
|
/// \returns Encrypted data
|
||||||
|
///
|
||||||
|
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash = NULL) const;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Encrypts a string
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] val String to encrypt
|
||||||
|
/// \param[out] hHash Handle of hashing object
|
||||||
|
///
|
||||||
|
/// \returns Encrypted data
|
||||||
|
///
|
||||||
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
|
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val, _Out_opt_ HCRYPTHASH hHash = NULL) const
|
||||||
|
{
|
||||||
|
return encrypt(hProv, val.c_str(), val.length()*sizeof(_Elem), hHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Encrypts a wide string
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] val String to encrypt
|
||||||
|
/// \param[out] hHash Handle of hashing object
|
||||||
|
///
|
||||||
|
/// \returns Encrypted data
|
||||||
|
///
|
||||||
|
template<class _Traits, class _Ax>
|
||||||
|
std::vector<unsigned char> encrypt(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val, _Out_opt_ HCRYPTHASH hHash = NULL) const
|
||||||
|
{
|
||||||
|
winstd::sanitizing_string val_utf8;
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), val_utf8, NULL, NULL);
|
||||||
|
return encrypt(hProv, val_utf8, hHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Encrypts data and add MD5 hash for integrity check
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] data Pointer to data to encrypt
|
||||||
|
/// \param[in ] size Size of \p data in bytes
|
||||||
|
///
|
||||||
|
/// \returns Encrypted data with 16B MD5 hash appended
|
||||||
|
///
|
||||||
|
std::vector<unsigned char> encrypt_md5(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size) const;
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Encrypts a string and add MD5 hash for integrity check
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] val String to encrypt
|
||||||
|
///
|
||||||
|
/// \returns Encrypted data with 16B MD5 hash appended
|
||||||
|
///
|
||||||
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
|
std::vector<unsigned char> encrypt_md5(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val) const
|
||||||
|
{
|
||||||
|
return encrypt_md5(hProv, val.c_str(), val.length()*sizeof(_Elem));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Encrypts a wide string and add MD5 hash for integrity check
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] val String to encrypt
|
||||||
|
///
|
||||||
|
/// \returns Encrypted data with 16B MD5 hash appended
|
||||||
|
///
|
||||||
|
template<class _Traits, class _Ax>
|
||||||
|
std::vector<unsigned char> encrypt_md5(_In_ HCRYPTPROV hProv, _In_ const std::basic_string<wchar_t, _Traits, _Ax> &val) const
|
||||||
|
{
|
||||||
|
winstd::sanitizing_string val_utf8;
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), val_utf8, NULL, NULL);
|
||||||
|
return encrypt_md5(hProv, val_utf8);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Decrypts data
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] data Pointer to data to decrypt
|
||||||
|
/// \param[in ] size Size of \p data in bytes
|
||||||
|
/// \param[out] hHash Handle of hashing object
|
||||||
|
///
|
||||||
|
/// \returns Decrypted data
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
std::vector<_Ty, _Ax> decrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash = NULL) const
|
||||||
|
{
|
||||||
|
// Import the private RSA key.
|
||||||
|
HRSRC res = FindResource(m_instance, MAKEINTRESOURCE(IDR_EAP_KEY_PRIVATE), RT_RCDATA);
|
||||||
|
assert(res);
|
||||||
|
HGLOBAL res_handle = LoadResource(m_instance, res);
|
||||||
|
assert(res_handle);
|
||||||
|
winstd::crypt_key key_rsa;
|
||||||
|
std::unique_ptr<unsigned char[], winstd::LocalFree_delete<unsigned char[]> > keyinfo_data;
|
||||||
|
DWORD keyinfo_size = 0;
|
||||||
|
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, PKCS_RSA_PRIVATE_KEY, (const BYTE*)::LockResource(res_handle), ::SizeofResource(m_instance, res), CRYPT_DECODE_ALLOC_FLAG, NULL, &keyinfo_data, &keyinfo_size))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptDecodeObjectEx failed.");
|
||||||
|
if (!key_rsa.import(hProv, keyinfo_data.get(), keyinfo_size, NULL, 0))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " Private key import failed.");
|
||||||
|
|
||||||
|
// Import the 256-bit AES session key.
|
||||||
|
winstd::crypt_key key_aes;
|
||||||
|
if (!CryptImportKey(hProv, (LPCBYTE)data, 268, key_rsa, 0, &key_aes))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptImportKey failed.");
|
||||||
|
|
||||||
|
// Decrypt the data using AES session key.
|
||||||
|
std::vector<unsigned char, winstd::sanitizing_allocator<unsigned char> > buf;
|
||||||
|
buf.assign((const unsigned char*)data + 268, (const unsigned char*)data + size);
|
||||||
|
if (!CryptDecrypt(key_aes, hHash, TRUE, 0, buf))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptDecrypt failed.");
|
||||||
|
|
||||||
|
return std::vector<_Ty, _Ax>(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Decrypts a string
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] data Pointer to data to decrypt
|
||||||
|
/// \param[in ] size Size of \p data in bytes
|
||||||
|
/// \param[out] hHash Handle of hashing object
|
||||||
|
///
|
||||||
|
/// \returns Decrypted string
|
||||||
|
///
|
||||||
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
|
std::basic_string<_Elem, _Traits, _Ax> decrypt_str(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash = NULL) const
|
||||||
|
{
|
||||||
|
std::vector<_Elem, sanitizing_allocator<_Elem> > buf(std::move(decrypt(hProv, data, size, hHash)));
|
||||||
|
return std::basic_string<_Elem, _Traits, _Ax>(buf.data(), buf.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Decrypts a wide string
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] data Pointer to data to decrypt
|
||||||
|
/// \param[in ] size Size of \p data in bytes
|
||||||
|
/// \param[out] hHash Handle of hashing object
|
||||||
|
///
|
||||||
|
/// \returns Decrypted string
|
||||||
|
///
|
||||||
|
template<class _Traits, class _Ax>
|
||||||
|
std::basic_string<wchar_t, _Traits, _Ax> decrypt_str(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash = NULL) const
|
||||||
|
{
|
||||||
|
winstd::sanitizing_string buf(std::move(decrypt_str(hProv, data, size, hHash)));
|
||||||
|
std::basic_string<wchar_t, _Traits, _Ax> dec;
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, buf.data(), (int)buf.size(), dec);
|
||||||
|
return dec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Decrypts data with MD5 integrity check
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] data Pointer to data with 16B MD5 hash appended to decrypt
|
||||||
|
/// \param[in ] size Size of \p data in bytes
|
||||||
|
///
|
||||||
|
/// \returns Decrypted data
|
||||||
|
///
|
||||||
|
template<class _Ty, class _Ax>
|
||||||
|
std::vector<_Ty, _Ax> decrypt_md5(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size) const
|
||||||
|
{
|
||||||
|
// Create hash.
|
||||||
|
winstd::crypt_hash hash;
|
||||||
|
if (!hash.create(hProv, CALG_MD5))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " Creating MD5 hash failed.");
|
||||||
|
DWORD dwHashSize;
|
||||||
|
CryptGetHashParam(hash, HP_HASHSIZE, dwHashSize, 0);
|
||||||
|
if (size < dwHashSize)
|
||||||
|
throw invalid_argument(__FUNCTION__ " Encrypted data too short.");
|
||||||
|
size_t enc_size = size - dwHashSize;
|
||||||
|
|
||||||
|
// Decrypt data.
|
||||||
|
std::vector<_Ty, _Ax> dec(std::move(decrypt<_Ty, _Ax>(hProv, data, enc_size, hash)));
|
||||||
|
|
||||||
|
// Calculate MD5 hash and verify it.
|
||||||
|
std::vector<unsigned char> hash_bin;
|
||||||
|
if (!CryptGetHashParam(hash, HP_HASHVAL, hash_bin, 0))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " Calculating MD5 hash failed.");
|
||||||
|
if (memcmp((unsigned char*)data + enc_size, hash_bin.data(), dwHashSize) != 0)
|
||||||
|
throw invalid_argument(__FUNCTION__ " Invalid encrypted data.");
|
||||||
|
|
||||||
|
return dec;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Decrypts a string with MD5 integrity check
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] data Pointer to data with 16B MD5 hash appended to decrypt
|
||||||
|
/// \param[in ] size Size of \p data in bytes
|
||||||
|
///
|
||||||
|
/// \returns Decrypted string
|
||||||
|
///
|
||||||
|
template<class _Elem, class _Traits, class _Ax>
|
||||||
|
std::basic_string<_Elem, _Traits, _Ax> decrypt_str_md5(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size) const
|
||||||
|
{
|
||||||
|
std::vector<_Elem, sanitizing_allocator<_Elem> > buf(std::move(decrypt_md5(hProv, data, size)));
|
||||||
|
return std::basic_string<_Elem, _Traits, _Ax>(buf.data(), buf.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Decrypts a wide string with MD5 integrity check
|
||||||
|
///
|
||||||
|
/// \param[in ] hProv Handle of cryptographics provider
|
||||||
|
/// \param[in ] data Pointer to data with 16B MD5 hash appended to decrypt
|
||||||
|
/// \param[in ] size Size of \p data in bytes
|
||||||
|
///
|
||||||
|
/// \returns Decrypted string
|
||||||
|
///
|
||||||
|
template<class _Traits, class _Ax>
|
||||||
|
std::basic_string<wchar_t, _Traits, _Ax> decrypt_str_md5(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size) const
|
||||||
|
{
|
||||||
|
winstd::sanitizing_string buf(std::move(decrypt_str_md5(hProv, data, size)));
|
||||||
|
std::basic_string<wchar_t, _Traits, _Ax> dec;
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, buf.data(), (int)buf.size(), dec);
|
||||||
|
return dec;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
/// \name BLOB management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Unencrypts and unpacks the BLOB
|
||||||
|
///
|
||||||
|
/// \param[inout] record Object to unpack to
|
||||||
|
/// \param[in ] pDataIn Pointer to encrypted BLOB
|
||||||
|
/// \param[in ] dwDataInSize Size of \p pDataIn
|
||||||
|
/// \param[out ] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||||
|
///
|
||||||
|
/// \returns
|
||||||
|
/// - \c true if succeeded
|
||||||
|
/// - \c false otherwise. See \p ppEapError for details.
|
||||||
|
///
|
||||||
|
template<class T>
|
||||||
|
void unpack(
|
||||||
|
_Inout_ T &record,
|
||||||
|
_In_count_(dwDataInSize) const BYTE *pDataIn,
|
||||||
|
_In_ DWORD dwDataInSize)
|
||||||
|
{
|
||||||
|
#if EAP_ENCRYPT_BLOBS
|
||||||
|
// Prepare cryptographics provider.
|
||||||
|
winstd::crypt_prov cp;
|
||||||
|
if (!cp.create(NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptAcquireContext failed.");
|
||||||
|
|
||||||
|
// Decrypt data.
|
||||||
|
std::vector<unsigned char, winstd::sanitizing_allocator<unsigned char> > data(std::move(decrypt_md5<unsigned char, winstd::sanitizing_allocator<unsigned char> >(cp, pDataIn, dwDataInSize)));
|
||||||
|
|
||||||
|
cursor_in cursor = { data.data(), data.data() + data.size() };
|
||||||
|
#else
|
||||||
|
cursor_in cursor = { pDataIn, pDataIn + dwDataInSize };
|
||||||
|
#endif
|
||||||
|
cursor >> record;
|
||||||
|
assert(cursor.ptr == cursor.ptr_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Packs and encrypts to the BLOB
|
||||||
|
///
|
||||||
|
/// \param[in ] record Object to pack
|
||||||
|
/// \param[out] ppDataOut Pointer to pointer to receive encrypted BLOB. Pointer must be freed using `module::free_memory()`.
|
||||||
|
/// \param[out] pdwDataOutSize Pointer to \p ppDataOut size
|
||||||
|
///
|
||||||
|
template<class T>
|
||||||
|
void pack(
|
||||||
|
_In_ const T &record,
|
||||||
|
_Out_ BYTE **ppDataOut,
|
||||||
|
_Out_ DWORD *pdwDataOutSize)
|
||||||
|
{
|
||||||
|
assert(ppDataOut);
|
||||||
|
assert(pdwDataOutSize);
|
||||||
|
|
||||||
|
#if EAP_ENCRYPT_BLOBS
|
||||||
|
// Allocate BLOB.
|
||||||
|
std::vector<unsigned char, winstd::sanitizing_allocator<unsigned char> > data;
|
||||||
|
data.resize(pksizeof(record));
|
||||||
|
|
||||||
|
// Pack to BLOB.
|
||||||
|
cursor_out cursor = { data.data(), data.data() + data.size() };
|
||||||
|
cursor << record;
|
||||||
|
assert(cursor.ptr == cursor.ptr_end);
|
||||||
|
|
||||||
|
// Prepare cryptographics provider.
|
||||||
|
winstd::crypt_prov cp;
|
||||||
|
if (!cp.create(NULL, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptAcquireContext failed.");
|
||||||
|
|
||||||
|
// Encrypt BLOB.
|
||||||
|
std::vector<unsigned char> data_enc(std::move(encrypt_md5(cp, data.data(), data.size())));
|
||||||
|
|
||||||
|
// Copy encrypted BLOB to output.
|
||||||
|
*pdwDataOutSize = (DWORD)data_enc.size();
|
||||||
|
*ppDataOut = alloc_memory(*pdwDataOutSize);
|
||||||
|
memcpy(*ppDataOut, data_enc.data(), *pdwDataOutSize);
|
||||||
|
#else
|
||||||
|
// Allocate BLOB.
|
||||||
|
*pdwDataOutSize = (DWORD)pksizeof(record);
|
||||||
|
*ppDataOut = alloc_memory(*pdwDataOutSize);
|
||||||
|
|
||||||
|
// Pack to BLOB.
|
||||||
|
cursor_out cursor = { *ppDataOut, *ppDataOut + *pdwDataOutSize };
|
||||||
|
cursor << record;
|
||||||
|
assert(cursor.ptr == cursor.ptr_end);
|
||||||
|
*pdwDataOutSize = cursor.ptr - *ppDataOut;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
|
||||||
|
public:
|
||||||
|
HINSTANCE m_instance; ///< Windows module instance
|
||||||
|
const winstd::eap_type_t m_eap_method; ///< EAP method type
|
||||||
|
|
||||||
|
protected:
|
||||||
|
winstd::heap m_heap; ///< Heap
|
||||||
|
mutable winstd::event_provider m_ep; ///< Event Provider
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class peer : public module
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
///
|
||||||
|
/// Constructs a EAP peer module for the given EAP type
|
||||||
|
///
|
||||||
|
/// \param[in] eap_method EAP method type ID
|
||||||
|
///
|
||||||
|
peer(_In_ winstd::eap_type_t eap_method);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Initializes an EAP peer method for EAPHost.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerGetInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363613.aspx)
|
||||||
|
///
|
||||||
|
virtual void initialize() = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Shuts down the EAP method and prepares to unload its corresponding DLL.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerShutdown function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363627.aspx)
|
||||||
|
///
|
||||||
|
virtual void shutdown() = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Returns the user data and user identity after being called by EAPHost.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerGetIdentity function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363607.aspx)
|
||||||
|
///
|
||||||
|
virtual void get_identity(
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||||
|
_In_ DWORD dwUserDataSize,
|
||||||
|
_Inout_ BYTE **ppUserDataOut,
|
||||||
|
_Inout_ DWORD *pdwUserDataOutSize,
|
||||||
|
_In_ HANDLE hTokenImpersonateUser,
|
||||||
|
_Inout_ BOOL *pfInvokeUI,
|
||||||
|
_Inout_ WCHAR **ppwszIdentity) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Defines the implementation of an EAP method-specific function that retrieves the properties of an EAP method given the connection and user data.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerGetMethodProperties function](https://msdn.microsoft.com/en-us/library/windows/desktop/hh706636.aspx)
|
||||||
|
///
|
||||||
|
virtual void get_method_properties(
|
||||||
|
_In_ DWORD dwVersion,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ HANDLE hUserImpersonationToken,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||||
|
_In_ DWORD dwUserDataSize,
|
||||||
|
_Inout_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Converts XML into the configuration BLOB. The XML based credentials can come from group policy or from a system administrator.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerCredentialsXml2Blob function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363603.aspx)
|
||||||
|
///
|
||||||
|
virtual void credentials_xml2blob(
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ IXMLDOMNode *pConfigRoot,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_Inout_ BYTE **ppCredentialsOut,
|
||||||
|
_Inout_ DWORD *pdwCredentialsOutSize) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Defines the implementation of an EAP method-specific function that obtains the EAP Single-Sign-On (SSO) credential input fields for an EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerQueryCredentialInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363622.aspx)
|
||||||
|
///
|
||||||
|
virtual void query_credential_input_fields(
|
||||||
|
_In_ HANDLE hUserImpersonationToken,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_Inout_ EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldsArray) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Defines the implementation of an EAP method function that obtains the user BLOB data provided in an interactive Single-Sign-On (SSO) UI raised on the supplicant.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerQueryUserBlobFromCredentialInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204697.aspx)
|
||||||
|
///
|
||||||
|
virtual void query_user_blob_from_credential_input_fields(
|
||||||
|
_In_ HANDLE hUserImpersonationToken,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_In_ const EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldArray,
|
||||||
|
_Inout_ DWORD *pdwUsersBlobSize,
|
||||||
|
_Inout_ BYTE **ppUserBlob) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Defines the implementation of an EAP method API that provides the input fields for interactive UI components to be raised on the supplicant.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerQueryInteractiveUIInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204695.aspx)
|
||||||
|
///
|
||||||
|
virtual void query_interactive_ui_input_fields(
|
||||||
|
_In_ DWORD dwVersion,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwUIContextDataSize,
|
||||||
|
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||||
|
_Inout_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Converts user information into a user BLOB that can be consumed by EAPHost run-time functions.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerQueryUIBlobFromInteractiveUIInputFields function](https://msdn.microsoft.com/en-us/library/windows/desktop/bb204696.aspx)
|
||||||
|
///
|
||||||
|
virtual void query_ui_blob_from_interactive_ui_input_fields(
|
||||||
|
_In_ DWORD dwVersion,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwUIContextDataSize,
|
||||||
|
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||||
|
_In_ const EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
|
||||||
|
_Inout_ DWORD *pdwDataFromInteractiveUISize,
|
||||||
|
_Inout_ BYTE **ppDataFromInteractiveUI) const;
|
||||||
|
|
||||||
|
/// \name Session management
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Starts an EAP authentication session on the peer EAPHost using the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerBeginSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363600.aspx)
|
||||||
|
///
|
||||||
|
/// \returns Session handle
|
||||||
|
///
|
||||||
|
virtual EAP_SESSION_HANDLE begin_session(
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ const EapAttributes *pAttributeArray,
|
||||||
|
_In_ HANDLE hTokenImpersonateUser,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||||
|
_In_ DWORD dwUserDataSize,
|
||||||
|
_In_ DWORD dwMaxSendPacketSize) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Ends an EAP authentication session for the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerEndSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363604.aspx)
|
||||||
|
///
|
||||||
|
virtual void end_session(_In_ EAP_SESSION_HANDLE hSession) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Processes a packet received by EAPHost from a supplicant.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||||
|
///
|
||||||
|
virtual void process_request_packet(
|
||||||
|
_In_ EAP_SESSION_HANDLE hSession,
|
||||||
|
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
|
||||||
|
_In_ DWORD dwReceivedPacketSize,
|
||||||
|
_Inout_ EapPeerMethodOutput *pEapOutput) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Obtains a response packet from the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
||||||
|
///
|
||||||
|
virtual void get_response_packet(
|
||||||
|
_In_ EAP_SESSION_HANDLE hSession,
|
||||||
|
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
|
||||||
|
_Inout_ DWORD *pdwSendPacketSize) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Obtains the result of an authentication session from the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
|
||||||
|
///
|
||||||
|
virtual void get_result(
|
||||||
|
_In_ EAP_SESSION_HANDLE hSession,
|
||||||
|
_In_ EapPeerMethodResultReason reason,
|
||||||
|
_Inout_ EapPeerMethodResult *ppResult) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Obtains the user interface context from the EAP method.
|
||||||
|
///
|
||||||
|
/// \note This function is always followed by the `EapPeerInvokeInteractiveUI()` function, which is followed by the `EapPeerSetUIContext()` function.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerGetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363612.aspx)
|
||||||
|
///
|
||||||
|
virtual void get_ui_context(
|
||||||
|
_In_ EAP_SESSION_HANDLE hSession,
|
||||||
|
_Inout_ BYTE **ppUIContextData,
|
||||||
|
_Inout_ DWORD *pdwUIContextDataSize) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Provides a user interface context to the EAP method.
|
||||||
|
///
|
||||||
|
/// \note This function is called after the UI has been raised through the `EapPeerGetUIContext()` function.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerSetUIContext function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363626.aspx)
|
||||||
|
///
|
||||||
|
virtual void set_ui_context(
|
||||||
|
_In_ EAP_SESSION_HANDLE hSession,
|
||||||
|
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||||
|
_In_ DWORD dwUIContextDataSize,
|
||||||
|
_In_ const EapPeerMethodOutput *pEapOutput) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Obtains an array of EAP response attributes from the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerGetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363609.aspx)
|
||||||
|
///
|
||||||
|
virtual void get_response_attributes(
|
||||||
|
_In_ EAP_SESSION_HANDLE hSession,
|
||||||
|
_Inout_ EapAttributes *pAttribs) = 0;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Provides an updated array of EAP response attributes to the EAP method.
|
||||||
|
///
|
||||||
|
/// \sa [EapPeerSetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363625.aspx)
|
||||||
|
///
|
||||||
|
virtual void set_response_attributes(
|
||||||
|
_In_ EAP_SESSION_HANDLE hSession,
|
||||||
|
_In_ const EapAttributes *pAttribs,
|
||||||
|
_Inout_ EapPeerMethodOutput *pEapOutput) = 0;
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
};
|
||||||
|
}
|
742
lib/EAPBase/src/Config.cpp
Normal file
742
lib/EAPBase/src/Config.cpp
Normal file
@@ -0,0 +1,742 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace winstd;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::config
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::config::config(_In_ module &mod) :
|
||||||
|
m_module(mod)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config::config(_In_ const config &other) :
|
||||||
|
m_module(other.m_module)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config::config(_Inout_ config &&other) :
|
||||||
|
m_module(other.m_module)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config& eap::config::operator=(_In_ const config &other)
|
||||||
|
{
|
||||||
|
if (this != &other)
|
||||||
|
assert(&m_module == &other.m_module);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config& eap::config::operator=(_Inout_ config &&other)
|
||||||
|
{
|
||||||
|
if (this != &other)
|
||||||
|
assert(&m_module == &other.m_module);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(pDoc);
|
||||||
|
UNREFERENCED_PARAMETER(pConfigRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config::load(_In_ IXMLDOMNode *pConfigRoot)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(pConfigRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config::operator<<(_Inout_ cursor_out &cursor) const
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t eap::config::get_pk_size() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config::operator>>(_Inout_ cursor_in &cursor)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::config_method
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::config_method::config_method(_In_ module &mod) : config(mod)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_method::config_method(_In_ const config_method &other) : config(other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_method::config_method(_Inout_ config_method &&other) : config(std::move(other))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_method& eap::config_method::operator=(_In_ const config_method &other)
|
||||||
|
{
|
||||||
|
if (this != &other)
|
||||||
|
(config&)*this = other;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_method& eap::config_method::operator=(_Inout_ config_method &&other)
|
||||||
|
{
|
||||||
|
if (this != &other)
|
||||||
|
(config&&)*this = std::move(other);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::config_method_with_cred
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::config_method_with_cred::config_method_with_cred(_In_ module &mod) :
|
||||||
|
m_allow_save(true),
|
||||||
|
m_use_preshared(false),
|
||||||
|
m_cred_failed(false),
|
||||||
|
config_method(mod)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_method_with_cred::config_method_with_cred(_In_ const config_method_with_cred &other) :
|
||||||
|
m_allow_save(other.m_allow_save),
|
||||||
|
m_use_preshared(other.m_use_preshared),
|
||||||
|
m_preshared(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr),
|
||||||
|
m_cred_failed(other.m_cred_failed),
|
||||||
|
config_method(other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_method_with_cred::config_method_with_cred(_Inout_ config_method_with_cred &&other) :
|
||||||
|
m_allow_save(std::move(other.m_allow_save)),
|
||||||
|
m_use_preshared(std::move(other.m_use_preshared)),
|
||||||
|
m_preshared(std::move(other.m_preshared)),
|
||||||
|
m_cred_failed(std::move(other.m_cred_failed)),
|
||||||
|
config_method(std::move(other))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_method_with_cred& eap::config_method_with_cred::operator=(_In_ const config_method_with_cred &other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
(config_method&)*this = other;
|
||||||
|
m_allow_save = other.m_allow_save;
|
||||||
|
m_use_preshared = other.m_use_preshared;
|
||||||
|
m_preshared.reset(other.m_preshared ? (credentials*)other.m_preshared->clone() : nullptr);
|
||||||
|
m_cred_failed = other.m_cred_failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_method_with_cred& eap::config_method_with_cred::operator=(_Inout_ config_method_with_cred &&other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
(config_method&)*this = std::move(other );
|
||||||
|
m_allow_save = std::move(other.m_allow_save );
|
||||||
|
m_use_preshared = std::move(other.m_use_preshared);
|
||||||
|
m_preshared = std::move(other.m_preshared );
|
||||||
|
m_cred_failed = std::move(other.m_cred_failed );
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_method_with_cred::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||||
|
{
|
||||||
|
assert(pDoc);
|
||||||
|
assert(pConfigRoot);
|
||||||
|
|
||||||
|
const winstd::bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
// <ClientSideCredential>
|
||||||
|
winstd::com_obj<IXMLDOMElement> pXmlElClientSideCredential;
|
||||||
|
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), winstd::bstr(L"ClientSideCredential"), bstrNamespace, &pXmlElClientSideCredential)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <ClientSideCredential> element.");
|
||||||
|
|
||||||
|
// <ClientSideCredential>/<allow-save>
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElClientSideCredential, winstd::bstr(L"allow-save"), bstrNamespace, m_allow_save)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <allow-save> element.");
|
||||||
|
|
||||||
|
if (m_use_preshared)
|
||||||
|
m_preshared->save(pDoc, pXmlElClientSideCredential);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_method_with_cred::load(_In_ IXMLDOMNode *pConfigRoot)
|
||||||
|
{
|
||||||
|
assert(pConfigRoot);
|
||||||
|
|
||||||
|
m_allow_save = true;
|
||||||
|
m_use_preshared = false;
|
||||||
|
m_preshared->clear();
|
||||||
|
|
||||||
|
// <ClientSideCredential>
|
||||||
|
winstd::com_obj<IXMLDOMElement> pXmlElClientSideCredential;
|
||||||
|
if (SUCCEEDED(eapxml::select_element(pConfigRoot, winstd::bstr(L"eap-metadata:ClientSideCredential"), &pXmlElClientSideCredential))) {
|
||||||
|
std::wstring xpath(eapxml::get_xpath(pXmlElClientSideCredential));
|
||||||
|
|
||||||
|
// <allow-save>
|
||||||
|
eapxml::get_element_value(pXmlElClientSideCredential, winstd::bstr(L"eap-metadata:allow-save"), &m_allow_save);
|
||||||
|
m_module.log_config((xpath + L"/allow-save").c_str(), m_allow_save);
|
||||||
|
|
||||||
|
try {
|
||||||
|
m_preshared->load(pXmlElClientSideCredential);
|
||||||
|
m_use_preshared = true;
|
||||||
|
} catch (...) {
|
||||||
|
// This is not really an error - merely an indication pre-shared credentials are unavailable.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_method_with_cred::operator<<(_Inout_ cursor_out &cursor) const
|
||||||
|
{
|
||||||
|
config_method::operator<<(cursor);
|
||||||
|
cursor << m_allow_save;
|
||||||
|
cursor << m_use_preshared;
|
||||||
|
cursor << *m_preshared;
|
||||||
|
cursor << m_cred_failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t eap::config_method_with_cred::get_pk_size() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
config_method::get_pk_size() +
|
||||||
|
pksizeof(m_allow_save ) +
|
||||||
|
pksizeof(m_use_preshared) +
|
||||||
|
pksizeof(*m_preshared ) +
|
||||||
|
pksizeof(m_cred_failed );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_method_with_cred::operator>>(_Inout_ cursor_in &cursor)
|
||||||
|
{
|
||||||
|
config_method::operator>>(cursor);
|
||||||
|
cursor >> m_allow_save;
|
||||||
|
cursor >> m_use_preshared;
|
||||||
|
cursor >> *m_preshared;
|
||||||
|
cursor >> m_cred_failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::config_provider
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::config_provider::config_provider(_In_ module &mod) :
|
||||||
|
m_read_only(false),
|
||||||
|
config(mod)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_provider::config_provider(_In_ const config_provider &other) :
|
||||||
|
m_read_only(other.m_read_only),
|
||||||
|
m_id(other.m_id),
|
||||||
|
m_name(other.m_name),
|
||||||
|
m_help_email(other.m_help_email),
|
||||||
|
m_help_web(other.m_help_web),
|
||||||
|
m_help_phone(other.m_help_phone),
|
||||||
|
m_lbl_alt_credential(other.m_lbl_alt_credential),
|
||||||
|
m_lbl_alt_identity(other.m_lbl_alt_identity),
|
||||||
|
m_lbl_alt_password(other.m_lbl_alt_password),
|
||||||
|
config(other)
|
||||||
|
{
|
||||||
|
for (list<unique_ptr<config_method> >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method)
|
||||||
|
m_methods.push_back(std::move(unique_ptr<config_method>(*method ? (config_method*)method->get()->clone() : nullptr)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_provider::config_provider(_Inout_ config_provider &&other) :
|
||||||
|
m_read_only(std::move(other.m_read_only)),
|
||||||
|
m_id(std::move(other.m_id)),
|
||||||
|
m_name(std::move(other.m_name)),
|
||||||
|
m_help_email(std::move(other.m_help_email)),
|
||||||
|
m_help_web(std::move(other.m_help_web)),
|
||||||
|
m_help_phone(std::move(other.m_help_phone)),
|
||||||
|
m_lbl_alt_credential(std::move(other.m_lbl_alt_credential)),
|
||||||
|
m_lbl_alt_identity(std::move(other.m_lbl_alt_identity)),
|
||||||
|
m_lbl_alt_password(std::move(other.m_lbl_alt_password)),
|
||||||
|
m_methods(std::move(other.m_methods)),
|
||||||
|
config(std::move(other))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_provider& eap::config_provider::operator=(_In_ const config_provider &other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
(config&)*this = other;
|
||||||
|
m_read_only = other.m_read_only;
|
||||||
|
m_id = other.m_id;
|
||||||
|
m_name = other.m_name;
|
||||||
|
m_help_email = other.m_help_email;
|
||||||
|
m_help_web = other.m_help_web;
|
||||||
|
m_help_phone = other.m_help_phone;
|
||||||
|
m_lbl_alt_credential = other.m_lbl_alt_credential;
|
||||||
|
m_lbl_alt_identity = other.m_lbl_alt_identity;
|
||||||
|
m_lbl_alt_password = other.m_lbl_alt_password;
|
||||||
|
|
||||||
|
m_methods.clear();
|
||||||
|
for (list<unique_ptr<config_method> >::const_iterator method = other.m_methods.cbegin(), method_end = other.m_methods.cend(); method != method_end; ++method)
|
||||||
|
m_methods.push_back(std::move(unique_ptr<config_method>(*method ? (config_method*)method->get()->clone() : nullptr)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_provider& eap::config_provider::operator=(_Inout_ config_provider &&other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
(config&&)*this = std::move(other);
|
||||||
|
m_read_only = std::move(m_read_only);
|
||||||
|
m_id = std::move(other.m_id);
|
||||||
|
m_name = std::move(other.m_name);
|
||||||
|
m_help_email = std::move(other.m_help_email);
|
||||||
|
m_help_web = std::move(other.m_help_web);
|
||||||
|
m_help_phone = std::move(other.m_help_phone);
|
||||||
|
m_lbl_alt_credential = std::move(other.m_lbl_alt_credential);
|
||||||
|
m_lbl_alt_identity = std::move(other.m_lbl_alt_identity);
|
||||||
|
m_lbl_alt_password = std::move(other.m_lbl_alt_password);
|
||||||
|
m_methods = std::move(other.m_methods);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config* eap::config_provider::clone() const
|
||||||
|
{
|
||||||
|
return new config_provider(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_provider::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||||
|
{
|
||||||
|
config::save(pDoc, pConfigRoot);
|
||||||
|
|
||||||
|
const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
// <read-only>
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"read-only"), bstrNamespace, m_read_only)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <read-only> element.");
|
||||||
|
|
||||||
|
// <ID>
|
||||||
|
if (!m_id.empty())
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"ID"), bstrNamespace, bstr(m_id))))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <ID> element.");
|
||||||
|
|
||||||
|
// <ProviderInfo>
|
||||||
|
com_obj<IXMLDOMElement> pXmlElProviderInfo;
|
||||||
|
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ProviderInfo"), bstr(L"ProviderInfo"), bstrNamespace, &pXmlElProviderInfo)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <ProviderInfo> element.");
|
||||||
|
|
||||||
|
// <ProviderInfo>/<DisplayName>
|
||||||
|
if (!m_name.empty())
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElProviderInfo, bstr(L"DisplayName"), bstrNamespace, bstr(m_name))))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <DisplayName> element.");
|
||||||
|
|
||||||
|
// <ProviderInfo>/<Helpdesk>
|
||||||
|
com_obj<IXMLDOMElement> pXmlElHelpdesk;
|
||||||
|
if (FAILED(hr = eapxml::create_element(pDoc, pXmlElProviderInfo, bstr(L"eap-metadata:Helpdesk"), bstr(L"Helpdesk"), bstrNamespace, &pXmlElHelpdesk)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <Helpdesk> element.");
|
||||||
|
|
||||||
|
// <ProviderInfo>/<Helpdesk>/<EmailAddress>
|
||||||
|
if (!m_help_email.empty())
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElHelpdesk, bstr(L"EmailAddress"), bstrNamespace, bstr(m_help_email))))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <EmailAddress> element.");
|
||||||
|
|
||||||
|
// <ProviderInfo>/<Helpdesk>/<WebAddress>
|
||||||
|
if (!m_help_web.empty())
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElHelpdesk, bstr(L"WebAddress"), bstrNamespace, bstr(m_help_web))))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <WebAddress> element.");
|
||||||
|
|
||||||
|
// <ProviderInfo>/<Helpdesk>/<Phone>
|
||||||
|
if (!m_help_phone.empty())
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElHelpdesk, bstr(L"Phone"), bstrNamespace, bstr(m_help_phone))))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <Phone> element.");
|
||||||
|
|
||||||
|
// <ProviderInfo>/<CredentialPrompt>
|
||||||
|
if (!m_lbl_alt_credential.empty())
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElProviderInfo, bstr(L"CredentialPrompt"), bstrNamespace, bstr(m_lbl_alt_credential))))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <CredentialPrompt> element.");
|
||||||
|
|
||||||
|
// <ProviderInfo>/<UserNameLabel>
|
||||||
|
if (!m_lbl_alt_identity.empty())
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElProviderInfo, bstr(L"UserNameLabel"), bstrNamespace, bstr(m_lbl_alt_identity))))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <UserNameLabel> element.");
|
||||||
|
|
||||||
|
// <ProviderInfo>/<PasswordLabel>
|
||||||
|
if (!m_lbl_alt_password.empty())
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pXmlElProviderInfo, bstr(L"PasswordLabel"), bstrNamespace, bstr(m_lbl_alt_password))))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <PasswordLabel> element.");
|
||||||
|
|
||||||
|
// <AuthenticationMethods>
|
||||||
|
com_obj<IXMLDOMElement> pXmlElAuthenticationMethods;
|
||||||
|
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods"), bstr(L"AuthenticationMethods"), bstrNamespace, &pXmlElAuthenticationMethods)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <AuthenticationMethods> element.");
|
||||||
|
|
||||||
|
for (list<unique_ptr<config_method> >::const_iterator method = m_methods.cbegin(), method_end = m_methods.cend(); method != method_end; ++method) {
|
||||||
|
// <AuthenticationMethod>
|
||||||
|
com_obj<IXMLDOMElement> pXmlElAuthenticationMethod;
|
||||||
|
if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"AuthenticationMethod"), bstrNamespace, &pXmlElAuthenticationMethod)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <AuthenticationMethod> element.");
|
||||||
|
|
||||||
|
// <AuthenticationMethod>/...
|
||||||
|
method->get()->save(pDoc, pXmlElAuthenticationMethod);
|
||||||
|
|
||||||
|
if (FAILED(hr = pXmlElAuthenticationMethods->appendChild(pXmlElAuthenticationMethod, NULL)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error appending <AuthenticationMethod> element.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_provider::load(_In_ IXMLDOMNode *pConfigRoot)
|
||||||
|
{
|
||||||
|
assert(pConfigRoot);
|
||||||
|
HRESULT hr;
|
||||||
|
wstring xpath(eapxml::get_xpath(pConfigRoot));
|
||||||
|
|
||||||
|
config::load(pConfigRoot);
|
||||||
|
|
||||||
|
// <read-only>
|
||||||
|
if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:read-only"), &m_read_only)))
|
||||||
|
m_read_only = true;
|
||||||
|
m_module.log_config((xpath + L"/read-only").c_str(), m_read_only);
|
||||||
|
|
||||||
|
// <ID>
|
||||||
|
m_id.clear();
|
||||||
|
eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:ID"), m_id);
|
||||||
|
m_module.log_config((xpath + L"/ID").c_str(), m_id.c_str());
|
||||||
|
|
||||||
|
// <ProviderInfo>
|
||||||
|
m_name.clear();
|
||||||
|
m_help_email.clear();
|
||||||
|
m_help_web.clear();
|
||||||
|
m_help_phone.clear();
|
||||||
|
m_lbl_alt_credential.clear();
|
||||||
|
m_lbl_alt_identity.clear();
|
||||||
|
m_lbl_alt_password.clear();
|
||||||
|
com_obj<IXMLDOMElement> pXmlElProviderInfo;
|
||||||
|
if (SUCCEEDED(eapxml::select_element(pConfigRoot, bstr(L"eap-metadata:ProviderInfo"), &pXmlElProviderInfo))) {
|
||||||
|
wstring lang;
|
||||||
|
LoadString(m_module.m_instance, 2, lang);
|
||||||
|
wstring xpathProviderInfo(xpath + L"/ProviderInfo");
|
||||||
|
|
||||||
|
// <DisplayName>
|
||||||
|
eapxml::get_element_localized(pXmlElProviderInfo, bstr(L"eap-metadata:DisplayName"), lang.c_str(), m_name);
|
||||||
|
m_module.log_config((xpathProviderInfo + L"/DisplayName").c_str(), m_name.c_str());
|
||||||
|
|
||||||
|
com_obj<IXMLDOMElement> pXmlElHelpdesk;
|
||||||
|
if (SUCCEEDED(eapxml::select_element(pXmlElProviderInfo, bstr(L"eap-metadata:Helpdesk"), &pXmlElHelpdesk))) {
|
||||||
|
wstring xpathHelpdesk(xpathProviderInfo + L"/Helpdesk");
|
||||||
|
|
||||||
|
// <Helpdesk>/<EmailAddress>
|
||||||
|
eapxml::get_element_localized(pXmlElHelpdesk, bstr(L"eap-metadata:EmailAddress"), lang.c_str(), m_help_email);
|
||||||
|
m_module.log_config((xpathHelpdesk + L"/EmailAddress").c_str(), m_help_email.c_str());
|
||||||
|
|
||||||
|
// <Helpdesk>/<WebAddress>
|
||||||
|
eapxml::get_element_localized(pXmlElHelpdesk, bstr(L"eap-metadata:WebAddress"), lang.c_str(), m_help_web);
|
||||||
|
m_module.log_config((xpathHelpdesk + L"/WebAddress").c_str(), m_help_web.c_str());
|
||||||
|
|
||||||
|
// <Helpdesk>/<Phone>
|
||||||
|
eapxml::get_element_localized(pXmlElHelpdesk, bstr(L"eap-metadata:Phone"), lang.c_str(), m_help_phone);
|
||||||
|
m_module.log_config((xpathHelpdesk + L"/Phone").c_str(), m_help_phone.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// <CredentialPrompt>
|
||||||
|
eapxml::get_element_localized(pXmlElProviderInfo, bstr(L"eap-metadata:CredentialPrompt"), lang.c_str(), m_lbl_alt_credential);
|
||||||
|
m_module.log_config((xpathProviderInfo + L"/CredentialPrompt").c_str(), m_lbl_alt_credential.c_str());
|
||||||
|
|
||||||
|
// <UserNameLabel>
|
||||||
|
eapxml::get_element_localized(pXmlElProviderInfo, bstr(L"eap-metadata:UserNameLabel"), lang.c_str(), m_lbl_alt_identity);
|
||||||
|
m_module.log_config((xpathProviderInfo + L"/UserNameLabel").c_str(), m_lbl_alt_identity.c_str());
|
||||||
|
|
||||||
|
// <PasswordLabel>
|
||||||
|
eapxml::get_element_localized(pXmlElProviderInfo, bstr(L"eap-metadata:PasswordLabel"), lang.c_str(), m_lbl_alt_password);
|
||||||
|
m_module.log_config((xpathProviderInfo + L"/PasswordLabel").c_str(), m_lbl_alt_password.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate authentication methods (<AuthenticationMethods>).
|
||||||
|
m_methods.clear();
|
||||||
|
com_obj<IXMLDOMNodeList> pXmlListMethods;
|
||||||
|
if (FAILED(hr = eapxml::select_nodes(pConfigRoot, bstr(L"eap-metadata:AuthenticationMethods/eap-metadata:AuthenticationMethod"), &pXmlListMethods)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error selecting <AuthenticationMethods>/<AuthenticationMethod> elements.");
|
||||||
|
long lCount = 0;
|
||||||
|
pXmlListMethods->get_length(&lCount);
|
||||||
|
for (long i = 0; i < lCount; i++) {
|
||||||
|
com_obj<IXMLDOMNode> pXmlElMethod;
|
||||||
|
pXmlListMethods->get_item(i, &pXmlElMethod);
|
||||||
|
|
||||||
|
unique_ptr<config_method> cfg(m_module.make_config_method());
|
||||||
|
|
||||||
|
// Check EAP method type (<EAPMethod>).
|
||||||
|
DWORD dwMethodID;
|
||||||
|
if (SUCCEEDED(eapxml::get_element_value(pXmlElMethod, bstr(L"eap-metadata:EAPMethod"), &dwMethodID))) {
|
||||||
|
if ((eap_type_t)dwMethodID != cfg->get_method_id()) {
|
||||||
|
// Wrong type.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load configuration.
|
||||||
|
cfg->load(pXmlElMethod);
|
||||||
|
|
||||||
|
// Add configuration to the list.
|
||||||
|
m_methods.push_back(std::move(cfg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_provider::operator<<(_Inout_ cursor_out &cursor) const
|
||||||
|
{
|
||||||
|
config::operator<<(cursor);
|
||||||
|
cursor << m_read_only ;
|
||||||
|
cursor << m_id ;
|
||||||
|
cursor << m_name ;
|
||||||
|
cursor << m_help_email ;
|
||||||
|
cursor << m_help_web ;
|
||||||
|
cursor << m_help_phone ;
|
||||||
|
cursor << m_lbl_alt_credential;
|
||||||
|
cursor << m_lbl_alt_identity ;
|
||||||
|
cursor << m_lbl_alt_password ;
|
||||||
|
cursor << m_methods ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t eap::config_provider::get_pk_size() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
config::get_pk_size() +
|
||||||
|
pksizeof(m_read_only ) +
|
||||||
|
pksizeof(m_id ) +
|
||||||
|
pksizeof(m_name ) +
|
||||||
|
pksizeof(m_help_email ) +
|
||||||
|
pksizeof(m_help_web ) +
|
||||||
|
pksizeof(m_help_phone ) +
|
||||||
|
pksizeof(m_lbl_alt_credential) +
|
||||||
|
pksizeof(m_lbl_alt_identity ) +
|
||||||
|
pksizeof(m_lbl_alt_password ) +
|
||||||
|
pksizeof(m_methods );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_provider::operator>>(_Inout_ cursor_in &cursor)
|
||||||
|
{
|
||||||
|
config::operator>>(cursor);
|
||||||
|
cursor >> m_read_only ;
|
||||||
|
cursor >> m_id ;
|
||||||
|
cursor >> m_name ;
|
||||||
|
cursor >> m_help_email ;
|
||||||
|
cursor >> m_help_web ;
|
||||||
|
cursor >> m_help_phone ;
|
||||||
|
cursor >> m_lbl_alt_credential;
|
||||||
|
cursor >> m_lbl_alt_identity ;
|
||||||
|
cursor >> m_lbl_alt_password ;
|
||||||
|
|
||||||
|
list<config_method>::size_type count;
|
||||||
|
bool is_nonnull;
|
||||||
|
cursor >> count;
|
||||||
|
m_methods.clear();
|
||||||
|
for (list<config_method>::size_type i = 0; i < count; i++) {
|
||||||
|
cursor >> is_nonnull;
|
||||||
|
if (is_nonnull) {
|
||||||
|
unique_ptr<config_method> el(m_module.make_config_method());
|
||||||
|
cursor >> *el;
|
||||||
|
m_methods.push_back(std::move(el));
|
||||||
|
} else
|
||||||
|
m_methods.push_back(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::config_provider_list
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::config_provider_list::config_provider_list(_In_ module &mod) : config(mod)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_provider_list::config_provider_list(_In_ const config_provider_list &other) :
|
||||||
|
m_providers(other.m_providers),
|
||||||
|
config(other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_provider_list::config_provider_list(_Inout_ config_provider_list &&other) :
|
||||||
|
m_providers(std::move(other.m_providers)),
|
||||||
|
config(std::move(other))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_provider_list& eap::config_provider_list::operator=(_In_ const config_provider_list &other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
(config&)*this = other;
|
||||||
|
m_providers = other.m_providers;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_provider_list& eap::config_provider_list::operator=(_Inout_ config_provider_list &&other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
(config&&)*this = std::move(other);
|
||||||
|
m_providers = std::move(other.m_providers);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config* eap::config_provider_list::clone() const
|
||||||
|
{
|
||||||
|
return new config_provider_list(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_provider_list::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||||
|
{
|
||||||
|
config::save(pDoc, pConfigRoot);
|
||||||
|
|
||||||
|
const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
// Select <EAPIdentityProviderList> node.
|
||||||
|
com_obj<IXMLDOMNode> pXmlElIdentityProviderList;
|
||||||
|
if (FAILED(hr = eapxml::select_node(pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList"), &pXmlElIdentityProviderList)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error selecting <EAPIdentityProviderList> element.");
|
||||||
|
|
||||||
|
for (list<config_provider>::const_iterator provider = m_providers.cbegin(), provider_end = m_providers.cend(); provider != provider_end; ++provider) {
|
||||||
|
// <EAPIdentityProvider>
|
||||||
|
com_obj<IXMLDOMElement> pXmlElIdentityProvider;
|
||||||
|
if (FAILED(hr = eapxml::create_element(pDoc, bstr(L"EAPIdentityProvider"), bstrNamespace, &pXmlElIdentityProvider)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <EAPIdentityProvider> element.");
|
||||||
|
|
||||||
|
// <EAPIdentityProvider>/...
|
||||||
|
provider->save(pDoc, pXmlElIdentityProvider);
|
||||||
|
|
||||||
|
if (FAILED(hr = pXmlElIdentityProviderList->appendChild(pXmlElIdentityProvider, NULL)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error appending <EAPIdentityProvider> element.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_provider_list::load(_In_ IXMLDOMNode *pConfigRoot)
|
||||||
|
{
|
||||||
|
assert(pConfigRoot);
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
config::load(pConfigRoot);
|
||||||
|
|
||||||
|
// Iterate authentication providers (<EAPIdentityProvider>).
|
||||||
|
com_obj<IXMLDOMNodeList> pXmlListProviders;
|
||||||
|
if (FAILED(hr = eapxml::select_nodes(pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList/eap-metadata:EAPIdentityProvider"), &pXmlListProviders)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error selecting <EAPIdentityProviderList><EAPIdentityProvider> elements.");
|
||||||
|
long lCount = 0;
|
||||||
|
pXmlListProviders->get_length(&lCount);
|
||||||
|
for (long i = 0; i < lCount; i++) {
|
||||||
|
com_obj<IXMLDOMNode> pXmlElProvider;
|
||||||
|
pXmlListProviders->get_item(i, &pXmlElProvider);
|
||||||
|
|
||||||
|
config_provider prov(m_module);
|
||||||
|
|
||||||
|
// Load provider.
|
||||||
|
prov.load(pXmlElProvider);
|
||||||
|
|
||||||
|
// Add provider to the list.
|
||||||
|
m_providers.push_back(std::move(prov));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_provider_list::operator<<(_Inout_ cursor_out &cursor) const
|
||||||
|
{
|
||||||
|
config::operator<<(cursor);
|
||||||
|
cursor << m_providers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t eap::config_provider_list::get_pk_size() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
config::get_pk_size() +
|
||||||
|
pksizeof(m_providers);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::config_provider_list::operator>>(_Inout_ cursor_in &cursor)
|
||||||
|
{
|
||||||
|
config::operator>>(cursor);
|
||||||
|
|
||||||
|
list<config_provider>::size_type count;
|
||||||
|
cursor >> count;
|
||||||
|
m_providers.clear();
|
||||||
|
for (list<config_provider>::size_type i = 0; i < count; i++) {
|
||||||
|
config_provider el(m_module);
|
||||||
|
cursor >> el;
|
||||||
|
m_providers.push_back(std::move(el));
|
||||||
|
}
|
||||||
|
}
|
387
lib/EAPBase/src/Credentials.cpp
Normal file
387
lib/EAPBase/src/Credentials.cpp
Normal file
@@ -0,0 +1,387 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
#pragma comment(lib, "Crypt32.lib")
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace winstd;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::credentials
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::credentials::credentials(_In_ module &mod) : config(mod)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::credentials::credentials(_In_ const credentials &other) :
|
||||||
|
config(other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::credentials::credentials(_Inout_ credentials &&other) :
|
||||||
|
config(std::move(other))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::credentials& eap::credentials::operator=(_In_ const credentials &other)
|
||||||
|
{
|
||||||
|
if (this != &other)
|
||||||
|
(config&)*this = other;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::credentials& eap::credentials::operator=(_Inout_ credentials &&other)
|
||||||
|
{
|
||||||
|
if (this != &other)
|
||||||
|
(config&)*this = std::move(other);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::credentials::clear()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool eap::credentials::empty() const
|
||||||
|
{
|
||||||
|
// Base class always report empty credentials.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tstring eap::credentials::get_name() const
|
||||||
|
{
|
||||||
|
return !empty() ? get_identity() : _T("<blank>");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool eap::credentials::combine(
|
||||||
|
_In_ const credentials *cred_cached,
|
||||||
|
_In_ config_method_with_cred &cfg,
|
||||||
|
_In_opt_z_ LPCTSTR pszTargetName)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(cred_cached);
|
||||||
|
UNREFERENCED_PARAMETER(cfg);
|
||||||
|
UNREFERENCED_PARAMETER(pszTargetName);
|
||||||
|
|
||||||
|
// When there's nothing to combine...
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::credentials_pass
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::credentials_pass::credentials_pass(_In_ module &mod) : credentials(mod)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::credentials_pass::credentials_pass(_In_ const credentials_pass &other) :
|
||||||
|
m_identity(other.m_identity),
|
||||||
|
m_password(other.m_password),
|
||||||
|
credentials(other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::credentials_pass::credentials_pass(_Inout_ credentials_pass &&other) :
|
||||||
|
m_identity(std::move(other.m_identity)),
|
||||||
|
m_password(std::move(other.m_password)),
|
||||||
|
credentials(std::move(other))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::credentials_pass& eap::credentials_pass::operator=(_In_ const credentials_pass &other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
(credentials&)*this = other;
|
||||||
|
m_identity = other.m_identity;
|
||||||
|
m_password = other.m_password;
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::credentials_pass& eap::credentials_pass::operator=(_Inout_ credentials_pass &&other)
|
||||||
|
{
|
||||||
|
if (this != &other) {
|
||||||
|
(credentials&)*this = std::move(other);
|
||||||
|
m_identity = std::move(other.m_identity);
|
||||||
|
m_password = std::move(other.m_password);
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::credentials_pass::clear()
|
||||||
|
{
|
||||||
|
credentials::clear();
|
||||||
|
m_identity.clear();
|
||||||
|
m_password.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool eap::credentials_pass::empty() const
|
||||||
|
{
|
||||||
|
return credentials::empty() && m_identity.empty() && m_password.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::credentials_pass::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||||
|
{
|
||||||
|
assert(pDoc);
|
||||||
|
assert(pConfigRoot);
|
||||||
|
|
||||||
|
credentials::save(pDoc, pConfigRoot);
|
||||||
|
|
||||||
|
const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
// <UserName>
|
||||||
|
if (FAILED(hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"UserName"), bstrNamespace, bstr(m_identity))))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <UserName> element.");
|
||||||
|
|
||||||
|
// <Password>
|
||||||
|
bstr pass(m_password);
|
||||||
|
hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"Password"), bstrNamespace, pass);
|
||||||
|
SecureZeroMemory((BSTR)pass, sizeof(OLECHAR)*pass.length());
|
||||||
|
if (FAILED(hr))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error creating <Password> element.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::credentials_pass::load(_In_ IXMLDOMNode *pConfigRoot)
|
||||||
|
{
|
||||||
|
assert(pConfigRoot);
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
credentials::load(pConfigRoot);
|
||||||
|
|
||||||
|
std::wstring xpath(eapxml::get_xpath(pConfigRoot));
|
||||||
|
|
||||||
|
if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:UserName"), m_identity)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error reading <UserName> element.");
|
||||||
|
|
||||||
|
m_module.log_config((xpath + L"/UserName").c_str(), m_identity.c_str());
|
||||||
|
|
||||||
|
bstr pass;
|
||||||
|
if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:Password"), &pass)))
|
||||||
|
throw com_runtime_error(hr, __FUNCTION__ " Error reading <Password> element.");
|
||||||
|
m_password = pass;
|
||||||
|
SecureZeroMemory((BSTR)pass, sizeof(OLECHAR)*pass.length());
|
||||||
|
|
||||||
|
m_module.log_config((xpath + L"/Password").c_str(),
|
||||||
|
#ifdef _DEBUG
|
||||||
|
m_password.c_str()
|
||||||
|
#else
|
||||||
|
L"********"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::credentials_pass::operator<<(_Inout_ cursor_out &cursor) const
|
||||||
|
{
|
||||||
|
credentials::operator<<(cursor);
|
||||||
|
cursor << m_identity;
|
||||||
|
cursor << m_password;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t eap::credentials_pass::get_pk_size() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
credentials::get_pk_size() +
|
||||||
|
pksizeof(m_identity) +
|
||||||
|
pksizeof(m_password);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::credentials_pass::operator>>(_Inout_ cursor_in &cursor)
|
||||||
|
{
|
||||||
|
credentials::operator>>(cursor);
|
||||||
|
cursor >> m_identity;
|
||||||
|
cursor >> m_password;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::credentials_pass::store(_In_z_ LPCTSTR pszTargetName) const
|
||||||
|
{
|
||||||
|
assert(pszTargetName);
|
||||||
|
|
||||||
|
// Convert password to UTF-8.
|
||||||
|
sanitizing_string cred_utf8;
|
||||||
|
WideCharToMultiByte(CP_UTF8, 0, m_password.c_str(), (int)m_password.length(), cred_utf8, NULL, NULL);
|
||||||
|
|
||||||
|
// Encrypt the password using user's key.
|
||||||
|
DATA_BLOB cred_blob = { (DWORD)cred_utf8.size() , (LPBYTE)cred_utf8.data() };
|
||||||
|
DATA_BLOB entropy_blob = { sizeof(s_entropy), (LPBYTE)s_entropy };
|
||||||
|
data_blob cred_enc;
|
||||||
|
if (!CryptProtectData(&cred_blob, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN, &cred_enc))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptProtectData failed.");
|
||||||
|
|
||||||
|
tstring target(target_name(pszTargetName));
|
||||||
|
|
||||||
|
// Write credentials.
|
||||||
|
assert(cred_enc.cbData < CRED_MAX_CREDENTIAL_BLOB_SIZE);
|
||||||
|
assert(m_identity.length() < CRED_MAX_USERNAME_LENGTH );
|
||||||
|
CREDENTIAL cred = {
|
||||||
|
0, // Flags
|
||||||
|
CRED_TYPE_GENERIC, // Type
|
||||||
|
(LPTSTR)target.c_str(), // TargetName
|
||||||
|
_T(""), // Comment
|
||||||
|
{ 0, 0 }, // LastWritten
|
||||||
|
cred_enc.cbData, // CredentialBlobSize
|
||||||
|
cred_enc.pbData, // CredentialBlob
|
||||||
|
CRED_PERSIST_ENTERPRISE, // Persist
|
||||||
|
0, // AttributeCount
|
||||||
|
NULL, // Attributes
|
||||||
|
NULL, // TargetAlias
|
||||||
|
(LPTSTR)m_identity.c_str() // UserName
|
||||||
|
};
|
||||||
|
if (!CredWrite(&cred, 0))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CredWrite failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::credentials_pass::retrieve(_In_z_ LPCTSTR pszTargetName)
|
||||||
|
{
|
||||||
|
assert(pszTargetName);
|
||||||
|
|
||||||
|
// Read credentials.
|
||||||
|
unique_ptr<CREDENTIAL, CredFree_delete<CREDENTIAL> > cred;
|
||||||
|
if (!CredRead(target_name(pszTargetName).c_str(), CRED_TYPE_GENERIC, 0, (PCREDENTIAL*)&cred))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CredRead failed.");
|
||||||
|
|
||||||
|
// Decrypt the password using user's key.
|
||||||
|
DATA_BLOB cred_enc = { cred->CredentialBlobSize, cred->CredentialBlob };
|
||||||
|
DATA_BLOB entropy_blob = { sizeof(s_entropy) , (LPBYTE)s_entropy };
|
||||||
|
data_blob cred_int;
|
||||||
|
if (!CryptUnprotectData(&cred_enc, NULL, &entropy_blob, NULL, NULL, CRYPTPROTECT_UI_FORBIDDEN | CRYPTPROTECT_VERIFY_PROTECTION, &cred_int))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptUnprotectData failed.");
|
||||||
|
|
||||||
|
// Convert password from UTF-8.
|
||||||
|
MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)cred_int.pbData, (int)cred_int.cbData, m_password);
|
||||||
|
SecureZeroMemory(cred_int.pbData, cred_int.cbData);
|
||||||
|
|
||||||
|
if (cred->UserName)
|
||||||
|
m_identity = cred->UserName;
|
||||||
|
else
|
||||||
|
m_identity.clear();
|
||||||
|
|
||||||
|
wstring xpath(pszTargetName);
|
||||||
|
m_module.log_config((xpath + L"/Username").c_str(), m_identity.c_str());
|
||||||
|
m_module.log_config((xpath + L"/Password").c_str(),
|
||||||
|
#ifdef _DEBUG
|
||||||
|
m_password.c_str()
|
||||||
|
#else
|
||||||
|
L"********"
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::wstring eap::credentials_pass::get_identity() const
|
||||||
|
{
|
||||||
|
return m_identity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const unsigned char eap::credentials_pass::s_entropy[1024] = {
|
||||||
|
0x40, 0x88, 0xd3, 0x13, 0x81, 0x8a, 0xf6, 0x74, 0x55, 0x8e, 0xcc, 0x73, 0x2c, 0xf8, 0x93, 0x37,
|
||||||
|
0x4f, 0xeb, 0x1d, 0x66, 0xb7, 0xfb, 0x47, 0x75, 0xb4, 0xfd, 0x07, 0xbb, 0xf6, 0xb3, 0x05, 0x30,
|
||||||
|
0x4a, 0xc0, 0xff, 0x05, 0xbd, 0x1e, 0x2f, 0x55, 0xc8, 0x77, 0x70, 0x47, 0xc9, 0x85, 0x57, 0x22,
|
||||||
|
0x8e, 0x54, 0x0b, 0x4d, 0x26, 0x80, 0x11, 0x0c, 0x52, 0x55, 0xc2, 0x3b, 0x9b, 0xd2, 0x19, 0x61,
|
||||||
|
0xf1, 0x71, 0xf5, 0x4b, 0x49, 0x73, 0xf9, 0x6d, 0x44, 0xd2, 0x90, 0x92, 0x2d, 0xae, 0xc6, 0xbb,
|
||||||
|
0x3d, 0xfe, 0x52, 0x47, 0x82, 0xc1, 0xa9, 0xe1, 0x6a, 0xd1, 0xd2, 0x4e, 0x3d, 0x9b, 0x4e, 0xc0,
|
||||||
|
0x40, 0x36, 0x79, 0xd3, 0x88, 0xfc, 0x0b, 0x79, 0x8c, 0xb2, 0x9d, 0x74, 0x13, 0x29, 0x59, 0x0c,
|
||||||
|
0xe0, 0x87, 0x34, 0x7d, 0xc1, 0x30, 0xd4, 0xe9, 0x98, 0xd1, 0x3f, 0x82, 0xcb, 0x8b, 0x44, 0x09,
|
||||||
|
0x2d, 0xc5, 0x9e, 0x3d, 0x66, 0xe5, 0x1a, 0x9d, 0xa6, 0x87, 0x20, 0x7f, 0x55, 0xd7, 0x89, 0xf2,
|
||||||
|
0xbb, 0x5f, 0x00, 0xf9, 0x38, 0xd3, 0x49, 0x10, 0x6f, 0x3a, 0xab, 0x5d, 0x8f, 0x73, 0x8c, 0xbc,
|
||||||
|
0x6f, 0xf1, 0xef, 0x83, 0x43, 0xcb, 0xc9, 0xb7, 0x9f, 0x24, 0xe4, 0x91, 0x3a, 0xe6, 0xab, 0x6c,
|
||||||
|
0xf2, 0xfd, 0x66, 0xf0, 0xb1, 0x1a, 0xc8, 0xc4, 0x6b, 0x9d, 0xa7, 0x10, 0x7d, 0x30, 0x29, 0x1b,
|
||||||
|
0xe5, 0xfe, 0x1c, 0x97, 0x86, 0x1e, 0x80, 0xe5, 0x12, 0x0a, 0x2a, 0x0d, 0xd9, 0x4a, 0x35, 0xe5,
|
||||||
|
0xab, 0xdf, 0x61, 0x76, 0x4e, 0x36, 0xff, 0xb1, 0x26, 0x5e, 0x12, 0x7f, 0xdf, 0xd7, 0x98, 0x55,
|
||||||
|
0xf9, 0x89, 0x30, 0xcc, 0xe9, 0xf6, 0xd0, 0xc0, 0x69, 0xf4, 0x78, 0x81, 0x10, 0xeb, 0x34, 0xf3,
|
||||||
|
0x5a, 0x8a, 0x62, 0xd4, 0x97, 0xe6, 0xb7, 0x98, 0x86, 0x5f, 0xb6, 0xcb, 0x9c, 0xab, 0xd6, 0xe9,
|
||||||
|
0xda, 0x2b, 0x41, 0xbb, 0xa3, 0x37, 0x1f, 0x7d, 0x4e, 0x19, 0x13, 0xc3, 0xab, 0x23, 0x4d, 0xa6,
|
||||||
|
0x51, 0xa9, 0x07, 0x60, 0xb9, 0x0c, 0x49, 0xce, 0x40, 0x29, 0x15, 0x0d, 0x10, 0xde, 0xc9, 0x0c,
|
||||||
|
0x11, 0x91, 0xdc, 0xdf, 0xc8, 0xac, 0x13, 0xe5, 0xe9, 0x11, 0xdc, 0x47, 0xb7, 0xb3, 0xf5, 0xd0,
|
||||||
|
0xc4, 0x38, 0x10, 0x17, 0xf7, 0x93, 0x93, 0x6b, 0x56, 0x10, 0xc6, 0xa6, 0x4c, 0xf8, 0x9c, 0x52,
|
||||||
|
0xb7, 0xbd, 0x87, 0xe8, 0xff, 0x84, 0x01, 0xbb, 0x40, 0x84, 0x03, 0x19, 0x6f, 0xf7, 0x46, 0x6f,
|
||||||
|
0x10, 0xc0, 0x85, 0xdf, 0xfd, 0xad, 0x00, 0xf6, 0xd5, 0x05, 0x22, 0xf4, 0x28, 0x87, 0xf6, 0x0c,
|
||||||
|
0xca, 0xda, 0x9a, 0x67, 0x63, 0xa4, 0x2d, 0x4d, 0xa5, 0x06, 0xa1, 0x8b, 0x32, 0x9b, 0xb0, 0xed,
|
||||||
|
0x05, 0x8e, 0x36, 0xa4, 0xbe, 0xa0, 0x9c, 0x78, 0xfa, 0x2c, 0x9e, 0x99, 0x02, 0x50, 0x63, 0xd4,
|
||||||
|
0xd5, 0x4a, 0x9b, 0xc3, 0x81, 0x95, 0xab, 0x18, 0x47, 0x3d, 0x44, 0x15, 0x33, 0x79, 0xd0, 0x53,
|
||||||
|
0x4e, 0xfc, 0x2f, 0x66, 0xc9, 0x7c, 0xb9, 0xda, 0xa2, 0xce, 0xfa, 0x39, 0xea, 0x72, 0x2c, 0xe2,
|
||||||
|
0x5c, 0x1f, 0x7e, 0xcd, 0x2a, 0x3e, 0x11, 0x19, 0x06, 0xc7, 0x03, 0x89, 0x4c, 0xd3, 0x73, 0xea,
|
||||||
|
0xa5, 0x69, 0x1e, 0x68, 0x04, 0xcd, 0xbb, 0xc4, 0x74, 0x7b, 0x1e, 0x75, 0x6f, 0xf1, 0x89, 0xea,
|
||||||
|
0x21, 0xdf, 0x9e, 0x1b, 0x27, 0x4a, 0x20, 0xb4, 0x5b, 0x72, 0x68, 0x8e, 0x47, 0xe2, 0x18, 0x75,
|
||||||
|
0x36, 0x82, 0xae, 0xa9, 0xa9, 0x40, 0xe5, 0x19, 0xa7, 0xea, 0x48, 0xad, 0x26, 0x7c, 0x93, 0x3e,
|
||||||
|
0xbf, 0x48, 0x6c, 0x3e, 0x66, 0xf7, 0x3c, 0x8f, 0x3c, 0x0e, 0x77, 0xc8, 0xb5, 0x56, 0x3b, 0x3a,
|
||||||
|
0x25, 0x13, 0x49, 0xb4, 0xcc, 0xbb, 0x8e, 0x94, 0x73, 0xa4, 0x35, 0x16, 0x95, 0x74, 0xa5, 0x98,
|
||||||
|
0xa4, 0x61, 0xa2, 0x36, 0xaf, 0x7f, 0xdf, 0x04, 0xce, 0x34, 0xd3, 0xfc, 0x09, 0x83, 0x43, 0xc1,
|
||||||
|
0x7a, 0x22, 0xc7, 0xfa, 0x3d, 0x97, 0xce, 0xc0, 0xcd, 0x15, 0xa4, 0x97, 0xb4, 0xd4, 0x55, 0x51,
|
||||||
|
0xf1, 0xef, 0x81, 0x1a, 0xce, 0x1f, 0x5a, 0x2d, 0xba, 0xce, 0xec, 0xbd, 0x85, 0x57, 0x53, 0xc6,
|
||||||
|
0x2f, 0x2a, 0x84, 0xab, 0xf3, 0x6e, 0x3b, 0xac, 0xf8, 0x73, 0xf2, 0x20, 0x42, 0x6f, 0xc4, 0xe2,
|
||||||
|
0x20, 0xb7, 0xf8, 0x5e, 0xbd, 0xe7, 0xd2, 0x2b, 0xe6, 0x10, 0xc2, 0x66, 0xe7, 0x25, 0xf9, 0xb9,
|
||||||
|
0xcb, 0xe4, 0x85, 0xbd, 0xf9, 0x62, 0x10, 0xfd, 0x67, 0x8f, 0x3f, 0x15, 0x4b, 0x10, 0x9e, 0xde,
|
||||||
|
0x8a, 0x9c, 0xb5, 0x46, 0xb7, 0x96, 0xa8, 0x9d, 0xe8, 0xf1, 0xde, 0x34, 0xcf, 0x4c, 0xa4, 0xe6,
|
||||||
|
0x35, 0x24, 0xcf, 0x47, 0xc5, 0x2d, 0xf2, 0xe3, 0x15, 0xf3, 0x39, 0xb7, 0x45, 0x2c, 0x92, 0x23,
|
||||||
|
0x37, 0x28, 0xfa, 0x7b, 0x7b, 0xe9, 0xc3, 0x04, 0x57, 0x0c, 0x30, 0xab, 0x52, 0x3a, 0x1d, 0xf7,
|
||||||
|
0x3a, 0x7b, 0xa0, 0xf0, 0x22, 0x14, 0xa8, 0xc7, 0x4e, 0xd5, 0x8b, 0x9a, 0xac, 0x67, 0x33, 0x0a,
|
||||||
|
0xa2, 0xa4, 0x76, 0x65, 0x45, 0x48, 0x7d, 0x92, 0xd7, 0xdb, 0xb1, 0x51, 0xae, 0x5f, 0x95, 0x1c,
|
||||||
|
0x8c, 0xe0, 0xaa, 0x28, 0x72, 0xbb, 0x2d, 0x97, 0x65, 0xfb, 0x3f, 0x41, 0x06, 0x46, 0xd1, 0x8c,
|
||||||
|
0x99, 0x64, 0x0e, 0xc7, 0xf0, 0x82, 0x1f, 0x1e, 0x5e, 0x8a, 0xc8, 0x6e, 0x29, 0xf0, 0xa8, 0x38,
|
||||||
|
0xa5, 0x38, 0x12, 0xaa, 0x9d, 0x60, 0x3d, 0x40, 0xfc, 0x29, 0x17, 0xc5, 0xe1, 0x1d, 0xba, 0x14,
|
||||||
|
0x45, 0xf0, 0x16, 0x32, 0x8f, 0x37, 0x88, 0xad, 0x7c, 0x77, 0x57, 0x06, 0x89, 0x70, 0x1f, 0x0e,
|
||||||
|
0x88, 0x9d, 0x2b, 0x5f, 0x83, 0x69, 0xb0, 0x48, 0x03, 0x86, 0xe4, 0x2e, 0x1c, 0xfb, 0x85, 0xb1,
|
||||||
|
0xce, 0x1c, 0x0e, 0xe0, 0xd4, 0x17, 0x0f, 0xb2, 0xf1, 0x79, 0xde, 0x8f, 0xd2, 0x0a, 0xa5, 0x10,
|
||||||
|
0xee, 0x9e, 0x05, 0x57, 0x0d, 0x42, 0x21, 0xaa, 0x53, 0xb1, 0x53, 0xd9, 0x59, 0x8b, 0x43, 0x22,
|
||||||
|
0x82, 0xbe, 0xa3, 0x2a, 0x79, 0x89, 0x46, 0xc4, 0x18, 0x31, 0x3e, 0xd4, 0x3d, 0x79, 0x9b, 0x06,
|
||||||
|
0xde, 0x7e, 0xe5, 0x20, 0xdd, 0xae, 0x34, 0xa8, 0x31, 0xc2, 0xdf, 0x61, 0x6d, 0x1b, 0x47, 0xc4,
|
||||||
|
0xae, 0x25, 0x44, 0xa8, 0x79, 0x5c, 0x2b, 0x4a, 0x17, 0x6e, 0x7a, 0xe5, 0xf1, 0x48, 0x3f, 0x82,
|
||||||
|
0x24, 0x6a, 0xc5, 0xc1, 0xfc, 0x65, 0x61, 0xca, 0xe4, 0x89, 0x52, 0x14, 0xe4, 0xb3, 0x7a, 0x24,
|
||||||
|
0xc2, 0xe5, 0x59, 0x1d, 0x55, 0xa3, 0x95, 0x16, 0xe2, 0xcf, 0x07, 0xd8, 0xad, 0x9c, 0x30, 0xbe,
|
||||||
|
0x96, 0xee, 0x80, 0x54, 0x63, 0xe7, 0xd4, 0xa6, 0xac, 0xe8, 0x15, 0xd4, 0xfc, 0x7b, 0xf8, 0xee,
|
||||||
|
0x0e, 0x88, 0x51, 0xd9, 0xad, 0x6f, 0x0d, 0xea, 0x19, 0x3a, 0x1a, 0x20, 0xbc, 0x99, 0x59, 0xcc,
|
||||||
|
0xba, 0x19, 0xc8, 0x26, 0x79, 0x79, 0xe8, 0xf6, 0x3f, 0xa0, 0xdb, 0xa6, 0x52, 0x4d, 0xc0, 0x98,
|
||||||
|
0x22, 0xcf, 0x30, 0xae, 0xdf, 0x22, 0x94, 0x5c, 0x19, 0x01, 0xe3, 0xf0, 0x44, 0x23, 0xe5, 0xeb,
|
||||||
|
0x70, 0x1a, 0xd2, 0x7f, 0xe8, 0x91, 0x1b, 0x55, 0xe7, 0xcb, 0x0d, 0xc2, 0x53, 0xa0, 0xe6, 0x7a,
|
||||||
|
0x48, 0xab, 0x05, 0xbb, 0x55, 0x28, 0x98, 0x12, 0xe5, 0xd1, 0xd9, 0x44, 0xe9, 0xa8, 0x8d, 0xa4,
|
||||||
|
0x68, 0xc8, 0x21, 0xa8, 0xe9, 0x49, 0x46, 0x22, 0xce, 0x81, 0xfe, 0x4a, 0xe3, 0xa0, 0x1c, 0xb0,
|
||||||
|
0x30, 0x29, 0x39, 0x9a, 0xd6, 0xab, 0x2e, 0xc6, 0x42, 0x47, 0x5e, 0x54, 0xbb, 0x90, 0xe6, 0x98,
|
||||||
|
0xe6, 0x52, 0x58, 0x58, 0x1e, 0xd0, 0x00, 0x9c, 0x8f, 0x4a, 0x17, 0x7e, 0x8a, 0x5a, 0xef, 0x3e,
|
||||||
|
};
|
74
lib/EAPBase/src/Method.cpp
Normal file
74
lib/EAPBase/src/Method.cpp
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 G<>ANT
|
||||||
|
|
||||||
|
This file is part of G<>ANTLink.
|
||||||
|
|
||||||
|
G<>ANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
G<>ANTLink 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 G<>ANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace winstd;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::method
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::method::method(_In_ module &module, _In_ config_provider_list &cfg, _In_ credentials &cred) :
|
||||||
|
m_module(module),
|
||||||
|
m_cfg(cfg),
|
||||||
|
m_cred(cred)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::method::method(_Inout_ method &&other) :
|
||||||
|
m_module(other.m_module),
|
||||||
|
m_cfg(other.m_cfg),
|
||||||
|
m_cred(other.m_cred)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::method& eap::method::operator=(_Inout_ method &&other)
|
||||||
|
{
|
||||||
|
if (this != std::addressof(other)) {
|
||||||
|
assert(std::addressof(m_module) == std::addressof(other.m_module)); // Move method within same module only!
|
||||||
|
assert(std::addressof(m_cfg ) == std::addressof(other.m_cfg )); // Move method with same configuration only!
|
||||||
|
assert(std::addressof(m_cred ) == std::addressof(other.m_cred )); // Move method with same credentials only!
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::method::begin_session(
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ const EapAttributes *pAttributeArray,
|
||||||
|
_In_ HANDLE hTokenImpersonateUser,
|
||||||
|
_In_ DWORD dwMaxSendPacketSize)
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(dwFlags);
|
||||||
|
UNREFERENCED_PARAMETER(pAttributeArray);
|
||||||
|
UNREFERENCED_PARAMETER(hTokenImpersonateUser);
|
||||||
|
UNREFERENCED_PARAMETER(dwMaxSendPacketSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::method::end_session()
|
||||||
|
{
|
||||||
|
}
|
316
lib/EAPBase/src/Module.cpp
Normal file
316
lib/EAPBase/src/Module.cpp
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace winstd;
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::module
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::module::module(eap_type_t eap_method) :
|
||||||
|
m_eap_method(eap_method),
|
||||||
|
m_instance(NULL)
|
||||||
|
{
|
||||||
|
m_ep.create(&EAPMETHOD_TRACE_EVENT_PROVIDER);
|
||||||
|
m_ep.write(&EAPMETHOD_TRACE_EVT_MODULE_LOAD, event_data((unsigned int)m_eap_method), event_data::blank);
|
||||||
|
|
||||||
|
m_heap.create(0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::module::~module()
|
||||||
|
{
|
||||||
|
m_ep.write(&EAPMETHOD_TRACE_EVT_MODULE_UNLOAD, event_data((unsigned int)m_eap_method), event_data::blank);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EAP_ERROR* eap::module::make_error(_In_ DWORD dwErrorCode, _In_opt_z_ LPCWSTR pszRootCauseString, _In_opt_z_ LPCWSTR pszRepairString, _In_opt_ DWORD dwReasonCode, _In_opt_ LPCGUID pRootCauseGuid, _In_opt_ LPCGUID pRepairGuid, _In_opt_ LPCGUID pHelpLinkGuid) const
|
||||||
|
{
|
||||||
|
// Calculate memory size requirement.
|
||||||
|
SIZE_T
|
||||||
|
nRootCauseSize = pszRootCauseString != NULL && pszRootCauseString[0] ? (wcslen(pszRootCauseString) + 1)*sizeof(WCHAR) : 0,
|
||||||
|
nRepairStringSize = pszRepairString != NULL && pszRepairString [0] ? (wcslen(pszRepairString ) + 1)*sizeof(WCHAR) : 0,
|
||||||
|
nEapErrorSize = sizeof(EAP_ERROR) + nRootCauseSize + nRepairStringSize;
|
||||||
|
|
||||||
|
EAP_ERROR *pError = (EAP_ERROR*)HeapAlloc(m_heap, 0, nEapErrorSize);
|
||||||
|
if (!pError)
|
||||||
|
return NULL;
|
||||||
|
BYTE *p = (BYTE*)(pError + 1);
|
||||||
|
|
||||||
|
// Fill the error descriptor.
|
||||||
|
pError->dwWinError = dwErrorCode;
|
||||||
|
pError->type.eapType.type = (BYTE)m_eap_method;
|
||||||
|
pError->type.eapType.dwVendorId = 0;
|
||||||
|
pError->type.eapType.dwVendorType = 0;
|
||||||
|
pError->type.dwAuthorId = 67532;
|
||||||
|
pError->dwReasonCode = dwReasonCode;
|
||||||
|
pError->rootCauseGuid = pRootCauseGuid != NULL ? *pRootCauseGuid : GUID_NULL;
|
||||||
|
pError->repairGuid = pRepairGuid != NULL ? *pRepairGuid : GUID_NULL;
|
||||||
|
pError->helpLinkGuid = pHelpLinkGuid != NULL ? *pHelpLinkGuid : GUID_NULL;
|
||||||
|
if (nRootCauseSize) {
|
||||||
|
pError->pRootCauseString = (LPWSTR)p;
|
||||||
|
memcpy(pError->pRootCauseString, pszRootCauseString, nRootCauseSize);
|
||||||
|
p += nRootCauseSize;
|
||||||
|
} else
|
||||||
|
pError->pRootCauseString = NULL;
|
||||||
|
if (nRepairStringSize) {
|
||||||
|
pError->pRepairString = (LPWSTR)p;
|
||||||
|
memcpy(pError->pRepairString, pszRepairString, nRepairStringSize);
|
||||||
|
p += nRepairStringSize;
|
||||||
|
} else
|
||||||
|
pError->pRepairString = NULL;
|
||||||
|
|
||||||
|
return pError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EAP_ERROR* eap::module::make_error(_In_ std::exception &err) const
|
||||||
|
{
|
||||||
|
wstring what;
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, err.what(), -1, what);
|
||||||
|
|
||||||
|
{
|
||||||
|
win_runtime_error &e(dynamic_cast<win_runtime_error&>(err));
|
||||||
|
if (&e)
|
||||||
|
return make_error(e.number(), what.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
com_runtime_error &e(dynamic_cast<com_runtime_error&>(err));
|
||||||
|
if (&e)
|
||||||
|
return make_error(HRESULT_CODE(e.number()), what.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
invalid_argument &e(dynamic_cast<invalid_argument&>(err));
|
||||||
|
if (&e)
|
||||||
|
return make_error(ERROR_INVALID_PARAMETER, what.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
wstring name;
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, typeid(err).name(), -1, name);
|
||||||
|
name += L": ";
|
||||||
|
name += what;
|
||||||
|
return make_error(ERROR_INVALID_DATA, name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BYTE* eap::module::alloc_memory(_In_ size_t size)
|
||||||
|
{
|
||||||
|
BYTE *p = (BYTE*)HeapAlloc(m_heap, 0, size);
|
||||||
|
if (!p)
|
||||||
|
throw win_runtime_error(winstd::string_printf(__FUNCTION__ " Error allocating memory for BLOB (%uB).", size));
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::module::free_memory(_In_ BYTE *ptr)
|
||||||
|
{
|
||||||
|
#if !EAP_ENCRYPT_BLOBS
|
||||||
|
// Since we do security here and some of the BLOBs contain credentials, sanitize every memory block before freeing.
|
||||||
|
SecureZeroMemory(ptr, HeapSize(m_heap, 0, ptr));
|
||||||
|
#endif
|
||||||
|
HeapFree(m_heap, 0, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::module::free_error_memory(_In_ EAP_ERROR *err)
|
||||||
|
{
|
||||||
|
// pRootCauseString and pRepairString always trail the ppEapError to reduce number of (de)allocations.
|
||||||
|
HeapFree(m_heap, 0, err);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::module::log_error(_In_ const EAP_ERROR *err) const
|
||||||
|
{
|
||||||
|
assert(err);
|
||||||
|
|
||||||
|
// Write trace event.
|
||||||
|
vector<EVENT_DATA_DESCRIPTOR> evt_desc;
|
||||||
|
evt_desc.reserve(8);
|
||||||
|
evt_desc.push_back(event_data(err->dwWinError));
|
||||||
|
DWORD dwType = err->type.eapType.type;
|
||||||
|
evt_desc.push_back(event_data(dwType));
|
||||||
|
evt_desc.push_back(event_data(err->dwReasonCode));
|
||||||
|
evt_desc.push_back(event_data(&(err->rootCauseGuid), sizeof(GUID)));
|
||||||
|
evt_desc.push_back(event_data(&(err->repairGuid), sizeof(GUID)));
|
||||||
|
evt_desc.push_back(event_data(&(err->helpLinkGuid), sizeof(GUID)));
|
||||||
|
evt_desc.push_back(event_data(err->pRootCauseString));
|
||||||
|
evt_desc.push_back(event_data(err->pRepairString));
|
||||||
|
m_ep.write(&EAPMETHOD_TRACE_EVT_EAP_ERROR, (ULONG)evt_desc.size(), evt_desc.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
eap::config_method* eap::module::make_config_method()
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<unsigned char> eap::module::encrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_opt_ HCRYPTHASH hHash) const
|
||||||
|
{
|
||||||
|
// Generate 256-bit AES session key.
|
||||||
|
crypt_key key_aes;
|
||||||
|
if (!CryptGenKey(hProv, CALG_AES_256, MAKELONG(CRYPT_EXPORTABLE, 256), &key_aes))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptGenKey failed.");
|
||||||
|
|
||||||
|
// Import the public RSA key.
|
||||||
|
HRSRC res = FindResource(m_instance, MAKEINTRESOURCE(IDR_EAP_KEY_PUBLIC), RT_RCDATA);
|
||||||
|
assert(res);
|
||||||
|
HGLOBAL res_handle = LoadResource(m_instance, res);
|
||||||
|
assert(res_handle);
|
||||||
|
crypt_key key_rsa;
|
||||||
|
unique_ptr<CERT_PUBLIC_KEY_INFO, LocalFree_delete<CERT_PUBLIC_KEY_INFO> > keyinfo_data;
|
||||||
|
DWORD keyinfo_size = 0;
|
||||||
|
if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_PUBLIC_KEY_INFO, (const BYTE*)::LockResource(res_handle), ::SizeofResource(m_instance, res), CRYPT_DECODE_ALLOC_FLAG, NULL, &keyinfo_data, &keyinfo_size))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptDecodeObjectEx failed.");
|
||||||
|
if (!key_rsa.import_public(hProv, X509_ASN_ENCODING, keyinfo_data.get()))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " Public key import failed.");
|
||||||
|
|
||||||
|
// Export AES session key encrypted with public RSA key.
|
||||||
|
vector<unsigned char, sanitizing_allocator<unsigned char> > buf;
|
||||||
|
if (!CryptExportKey(key_aes, key_rsa, SIMPLEBLOB, 0, buf))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptExportKey failed.");
|
||||||
|
std::vector<unsigned char> enc(buf.begin(), buf.end());
|
||||||
|
|
||||||
|
// Pre-allocate memory to allow space, as encryption will grow the data.
|
||||||
|
buf.assign((const unsigned char*)data, (const unsigned char*)data + size);
|
||||||
|
DWORD dwBlockLen;
|
||||||
|
if (!CryptGetKeyParam(key_aes, KP_BLOCKLEN, dwBlockLen, 0)) dwBlockLen = 0;
|
||||||
|
buf.reserve((size + dwBlockLen) / dwBlockLen * dwBlockLen);
|
||||||
|
|
||||||
|
// Encrypt the data using AES key.
|
||||||
|
if (!CryptEncrypt(key_aes, hHash, TRUE, 0, buf))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " CryptEncrypt failed.");
|
||||||
|
|
||||||
|
// Append encrypted data.
|
||||||
|
enc.insert(enc.cend(), buf.begin(), buf.end());
|
||||||
|
return enc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<unsigned char> eap::module::encrypt_md5(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size) const
|
||||||
|
{
|
||||||
|
// Create hash.
|
||||||
|
crypt_hash hash;
|
||||||
|
if (!hash.create(hProv, CALG_MD5))
|
||||||
|
throw win_runtime_error(__FUNCTION__ " Creating MD5 hash failed.");
|
||||||
|
|
||||||
|
// Encrypt data.
|
||||||
|
std::vector<unsigned char> enc(std::move(encrypt(hProv, data, size, hash)));
|
||||||
|
|
||||||
|
// Calculate MD5 hash.
|
||||||
|
vector<unsigned char> hash_bin;
|
||||||
|
if (!CryptGetHashParam(hash, HP_HASHVAL, hash_bin, 0))
|
||||||
|
throw invalid_argument(__FUNCTION__ " Calculating MD5 hash failed.");
|
||||||
|
|
||||||
|
// Append hash.
|
||||||
|
enc.insert(enc.end(), hash_bin.begin(), hash_bin.end());
|
||||||
|
return enc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// eap::peer
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
eap::peer::peer(_In_ eap_type_t eap_method) : module(eap_method)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::peer::query_credential_input_fields(
|
||||||
|
_In_ HANDLE hUserImpersonationToken,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_Inout_ EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldsArray) const
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(hUserImpersonationToken);
|
||||||
|
UNREFERENCED_PARAMETER(dwFlags);
|
||||||
|
UNREFERENCED_PARAMETER(dwConnectionDataSize);
|
||||||
|
UNREFERENCED_PARAMETER(pConnectionData);
|
||||||
|
UNREFERENCED_PARAMETER(pEapConfigInputFieldsArray);
|
||||||
|
|
||||||
|
throw win_runtime_error(ERROR_NOT_SUPPORTED, __FUNCTION__ " Not supported.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::peer::query_user_blob_from_credential_input_fields(
|
||||||
|
_In_ HANDLE hUserImpersonationToken,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwConnectionDataSize,
|
||||||
|
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||||
|
_In_ const EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldArray,
|
||||||
|
_Inout_ DWORD *pdwUsersBlobSize,
|
||||||
|
_Inout_ BYTE **ppUserBlob) const
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(hUserImpersonationToken);
|
||||||
|
UNREFERENCED_PARAMETER(dwFlags);
|
||||||
|
UNREFERENCED_PARAMETER(dwConnectionDataSize);
|
||||||
|
UNREFERENCED_PARAMETER(pConnectionData);
|
||||||
|
UNREFERENCED_PARAMETER(pEapConfigInputFieldArray);
|
||||||
|
UNREFERENCED_PARAMETER(pdwUsersBlobSize);
|
||||||
|
UNREFERENCED_PARAMETER(ppUserBlob);
|
||||||
|
|
||||||
|
throw win_runtime_error(ERROR_NOT_SUPPORTED, __FUNCTION__ " Not supported.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::peer::query_interactive_ui_input_fields(
|
||||||
|
_In_ DWORD dwVersion,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwUIContextDataSize,
|
||||||
|
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||||
|
_Inout_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData) const
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(dwVersion);
|
||||||
|
UNREFERENCED_PARAMETER(dwFlags);
|
||||||
|
UNREFERENCED_PARAMETER(dwUIContextDataSize);
|
||||||
|
UNREFERENCED_PARAMETER(pUIContextData);
|
||||||
|
UNREFERENCED_PARAMETER(pEapInteractiveUIData);
|
||||||
|
|
||||||
|
throw win_runtime_error(ERROR_NOT_SUPPORTED, __FUNCTION__ " Not supported.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void eap::peer::query_ui_blob_from_interactive_ui_input_fields(
|
||||||
|
_In_ DWORD dwVersion,
|
||||||
|
_In_ DWORD dwFlags,
|
||||||
|
_In_ DWORD dwUIContextDataSize,
|
||||||
|
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||||
|
_In_ const EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
|
||||||
|
_Inout_ DWORD *pdwDataFromInteractiveUISize,
|
||||||
|
_Inout_ BYTE **ppDataFromInteractiveUI) const
|
||||||
|
{
|
||||||
|
UNREFERENCED_PARAMETER(dwVersion);
|
||||||
|
UNREFERENCED_PARAMETER(dwFlags);
|
||||||
|
UNREFERENCED_PARAMETER(dwUIContextDataSize);
|
||||||
|
UNREFERENCED_PARAMETER(pUIContextData);
|
||||||
|
UNREFERENCED_PARAMETER(pEapInteractiveUIData);
|
||||||
|
UNREFERENCED_PARAMETER(pdwDataFromInteractiveUISize);
|
||||||
|
UNREFERENCED_PARAMETER(ppDataFromInteractiveUI);
|
||||||
|
|
||||||
|
throw win_runtime_error(ERROR_NOT_SUPPORTED, __FUNCTION__ " Not supported.");
|
||||||
|
}
|
21
lib/EAPBase/src/StdAfx.cpp
Normal file
21
lib/EAPBase/src/StdAfx.cpp
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015-2016 Amebis
|
||||||
|
Copyright 2016 GÉANT
|
||||||
|
|
||||||
|
This file is part of GÉANTLink.
|
||||||
|
|
||||||
|
GÉANTLink 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
GÉANTLink 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 GÉANTLink. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user