Compare commits
305 Commits
1.0-alpha5
...
1.0-alpha1
Author | SHA1 | Date | |
---|---|---|---|
3bdab93f04 | |||
1ae92e80d8 | |||
c9b192932b | |||
cbb35ffaef | |||
4076655e2e | |||
e4e9604297 | |||
8ec9f54f62 | |||
765466f535 | |||
c33c8b551b | |||
4ffccaf6b4 | |||
534f234641 | |||
0095ebbff6 | |||
ac3ff2d3ca | |||
7a3d4e0947 | |||
a8070e9bba | |||
bd7f3f4a38 | |||
621669828b | |||
00aee5bb78 | |||
198b9a576e | |||
0a0a28730b | |||
566785192a | |||
7cddd585b7 | |||
1c5f0b5c81 | |||
6c11b23267 | |||
56e2448f71 | |||
1e60d21860 | |||
0959217ee3 | |||
844b185887 | |||
98bd9f1935 | |||
6b2a71cc63 | |||
4d6ac7db3f | |||
ae66af02a2 | |||
2339b6b347 | |||
171e924dcf | |||
281c3ee083 | |||
145c21682e | |||
0d221d4401 | |||
d9bfcc3e49 | |||
60f1b4ccfb | |||
c9be6f4f7b | |||
452fa4b9dc | |||
68aec5dfb4 | |||
3f49f3e975 | |||
04213715b0 | |||
510bbe10f6 | |||
5dfd079686 | |||
858486412e | |||
8b266f086f | |||
c40306c624 | |||
24c10b592b | |||
cafd786e19 | |||
a7c8052ee2 | |||
a33da0d8d5 | |||
91f87aa3c7 | |||
b6ae394eaf | |||
79499d7afd | |||
92f05817fe | |||
a85833d41d | |||
8a8e6d08e0 | |||
aa7c5bebda | |||
ceece01b99 | |||
1d46db348a | |||
48a7ce91c3 | |||
75892b78c0 | |||
7c938fe291 | |||
497f4eca8a | |||
770b56e2cf | |||
df680e74f6 | |||
e66a7eb9ba | |||
6c66862eed | |||
fc5e54db05 | |||
d20aafb3ff | |||
8ce7154a77 | |||
d926ea66b0 | |||
3baa77d3bb | |||
25eb6d8d72 | |||
349508701c | |||
9f770bbb3f | |||
bc1c56174a | |||
db585975e8 | |||
8bf99423c8 | |||
249c4db1de | |||
3dd8f26c94 | |||
4a9d496ba1 | |||
6f5bbeffa2 | |||
f64dbacdbd | |||
2a88c4f2a8 | |||
6ee34cdd47 | |||
65c87bcbc0 | |||
1bdf4a2b8a | |||
a8856b951b | |||
6e58183d16 | |||
9daa5b52a4 | |||
9704046868 | |||
3b8bc90a0f | |||
b5c8b8ee67 | |||
53e31b1be7 | |||
5483368640 | |||
6077063599 | |||
2857b2edd2 | |||
6760287f0d | |||
7973a8d59b | |||
f5d8f653af | |||
e1600e5aba | |||
352d546da1 | |||
d2ff78a613 | |||
10807fad18 | |||
c6d53cd13c | |||
6f25e4c0ad | |||
edac93e115 | |||
d1c24efcf0 | |||
1cb6ca5adb | |||
38e1443276 | |||
6835f5279c | |||
eb9c8a5f7c | |||
5332b538aa | |||
a9baa07227 | |||
387a12ab5e | |||
7b3251a758 | |||
894f19a81e | |||
318ad7f355 | |||
ef2042253c | |||
9b997408a1 | |||
5720524abe | |||
1f1b9b1084 | |||
076c6b77d7 | |||
92460c571f | |||
b79a2f26f6 | |||
373c83dbbe | |||
543dada025 | |||
ce22ec3bfa | |||
a04647b7b5 | |||
df1d431bd0 | |||
16527c8124 | |||
69e6b775f8 | |||
c69316071f | |||
a02d1e7094 | |||
078636eb14 | |||
cabae26e0b | |||
7376693838 | |||
a5b3914a09 | |||
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 |
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -4,3 +4,6 @@
|
||||
[submodule "lib/WinStd"]
|
||||
path = lib/WinStd
|
||||
url = https://github.com/Amebis/WinStd.git
|
||||
[submodule "lib/wxExtend"]
|
||||
path = lib/wxExtend
|
||||
url = https://github.com/Amebis/wxExtend.git
|
||||
|
Binary file not shown.
@@ -107,6 +107,9 @@
|
||||
<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\WinStd\build\WinStd.vcxproj">
|
||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||
</ProjectReference>
|
||||
|
@@ -23,7 +23,7 @@
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
eap::module g_module(eap::type_undefined);
|
||||
eap::module g_module;
|
||||
|
||||
|
||||
static int CredWrite()
|
||||
@@ -40,7 +40,7 @@ static int CredWrite()
|
||||
return -1;
|
||||
}
|
||||
|
||||
eap::credentials_pap cred(g_module);
|
||||
eap::credentials_pap cred_pap(g_module);
|
||||
|
||||
// Prepare identity (user name).
|
||||
{
|
||||
@@ -50,7 +50,7 @@ static int CredWrite()
|
||||
bool is_last;
|
||||
dec.decode(identity_utf8, is_last, pwcArglist[1], (size_t)-1);
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, identity_utf8.data(), (int)identity_utf8.size(), cred.m_identity);
|
||||
MultiByteToWideChar(CP_UTF8, 0, identity_utf8.data(), (int)identity_utf8.size(), cred_pap.m_identity);
|
||||
}
|
||||
|
||||
// Prepare password.
|
||||
@@ -61,7 +61,7 @@ static int CredWrite()
|
||||
bool is_last;
|
||||
dec.decode(password_utf8, is_last, pwcArglist[2], (size_t)-1);
|
||||
|
||||
MultiByteToWideChar(CP_UTF8, 0, password_utf8.data(), (int)password_utf8.size(), cred.m_password);
|
||||
MultiByteToWideChar(CP_UTF8, 0, password_utf8.data(), (int)password_utf8.size(), cred_pap.m_password);
|
||||
}
|
||||
|
||||
// Generate target name (aka realm).
|
||||
@@ -71,39 +71,47 @@ static int CredWrite()
|
||||
target_name = pwcArglist[3];
|
||||
} else {
|
||||
// Get the realm from user name.
|
||||
LPCWSTR _identity = cred.m_identity.c_str(), domain;
|
||||
if ((domain = wcschr(_identity, L'@')) != NULL)
|
||||
target_name = domain + 1;
|
||||
else if ((domain = wcschr(_identity, L'\\')) != NULL)
|
||||
target_name.assign(_identity, domain);
|
||||
else
|
||||
LPCWSTR _identity = cred_pap.m_identity.c_str(), domain;
|
||||
if ((domain = wcschr(_identity, L'@')) != NULL) {
|
||||
target_name = L"urn:RFC4282:realm:";
|
||||
target_name += domain + 1;
|
||||
} else
|
||||
target_name = L"*";
|
||||
}
|
||||
|
||||
// Write credentials.
|
||||
EAP_ERROR *pEapError = NULL;
|
||||
#ifdef _DEBUG
|
||||
{
|
||||
eap::credentials_pap cred_stored(g_module);
|
||||
if (!cred_stored.retrieve(target_name.c_str(), &pEapError)) {
|
||||
if (pEapError) {
|
||||
OutputDebugStr(_T("%ls (error %u)\n"), pEapError->pRootCauseString, pEapError->dwWinError);
|
||||
g_module.free_error_memory(pEapError);
|
||||
pEapError = NULL;
|
||||
} else
|
||||
try {
|
||||
cred_stored.retrieve(target_name.c_str());
|
||||
} catch(win_runtime_error &err) {
|
||||
OutputDebugStr(_T("%hs (error %u)\n"), err.what(), err.number());
|
||||
} catch(...) {
|
||||
OutputDebugStr(_T("Reading credentials failed.\n"));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!cred.store(target_name.c_str(), &pEapError)) {
|
||||
if (pEapError) {
|
||||
OutputDebugStr(_T("%ls (error %u)\n"), pEapError->pRootCauseString, pEapError->dwWinError);
|
||||
g_module.free_error_memory(pEapError);
|
||||
pEapError = NULL;
|
||||
} else
|
||||
OutputDebugStr(_T("Writing credentials failed.\n"));
|
||||
|
||||
try {
|
||||
cred_pap.store(target_name.c_str());
|
||||
} catch(win_runtime_error &err) {
|
||||
OutputDebugStr(_T("%hs (error %u)\n"), err.what(), err.number());
|
||||
return 2;
|
||||
} catch(...) {
|
||||
OutputDebugStr(_T("Writing credentials failed.\n"));
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Store empty TLS credentials.
|
||||
eap::credentials_tls cred_tls(g_module);
|
||||
try {
|
||||
cred_tls.store(target_name.c_str());
|
||||
} catch(win_runtime_error &err) {
|
||||
OutputDebugStr(_T("%hs (error %u)\n"), err.what(), err.number());
|
||||
return 3;
|
||||
} catch(...) {
|
||||
OutputDebugStr(_T("Writing credentials failed.\n"));
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../lib/PAP/include/Credentials.h"
|
||||
#include "../lib/TLS/include/Credentials.h"
|
||||
#include "../lib/EAPBase/include/Module.h"
|
||||
|
||||
#include <WinStd/Common.h>
|
||||
|
Binary file not shown.
@@ -100,6 +100,9 @@
|
||||
<ProjectReference Include="..\..\lib\Events\build\Events.vcxproj">
|
||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\MSCHAPv2\build\MSCHAPv2.vcxproj">
|
||||
<Project>{86a6d6a0-4b7d-4134-be81-a5755c77584d}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\PAP\build\PAP.vcxproj">
|
||||
<Project>{36b0cf8a-7794-46c3-8099-825ba962b4c7}</Project>
|
||||
</ProjectReference>
|
||||
|
@@ -20,5 +20,5 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../lib/TTLS/include/Method.h"
|
||||
#include "../../lib/TTLS/include/Module.h"
|
||||
#include "../../lib/TTLS/include/Session.h"
|
||||
|
Binary file not shown.
@@ -103,6 +103,12 @@
|
||||
<ProjectReference Include="..\..\lib\Events\build\Events.vcxproj">
|
||||
<Project>{d63f24bd-92a0-4d6b-8b69-ed947e4d2b1b}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\MSCHAPv2\build\MSCHAPv2.vcxproj">
|
||||
<Project>{86a6d6a0-4b7d-4134-be81-a5755c77584d}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\MSCHAPv2_UI\build\MSCHAPv2_UI.vcxproj">
|
||||
<Project>{7af5b922-7c17-428a-97e0-09e3b41a684d}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\lib\PAP\build\PAP.vcxproj">
|
||||
<Project>{36b0cf8a-7794-46c3-8099-825ba962b4c7}</Project>
|
||||
</ProjectReference>
|
||||
@@ -127,8 +133,13 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\build\EAPMethodUI.def" />
|
||||
<None Include="..\locale\EAPMethods.pot" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<POCompile Include="..\locale\sl_SI.po" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\..\include\xgettext.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -13,6 +13,10 @@
|
||||
<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>
|
||||
<ClInclude Include="StdAfx.h">
|
||||
@@ -36,5 +40,13 @@
|
||||
<None Include="..\build\EAPMethodUI.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include="..\locale\EAPMethods.pot">
|
||||
<Filter>Resource Files\Localization</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<POCompile Include="..\locale\sl_SI.po">
|
||||
<Filter>Resource Files\Localization</Filter>
|
||||
</POCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Binary file not shown.
1
EAPMethods/locale/.gitignore
vendored
Normal file
1
EAPMethods/locale/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/*.mo
|
@@ -2,7 +2,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: EAPMethods\n"
|
||||
"POT-Creation-Date: 2016-06-10 12:06+0200\n"
|
||||
"POT-Creation-Date: 2016-09-02 19:08+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"
|
||||
@@ -11,8 +11,6 @@ msgstr ""
|
||||
"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"
|
||||
@@ -21,70 +19,242 @@ msgstr ""
|
||||
"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
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:37
|
||||
msgid "+"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:38
|
||||
msgid "Adds new provider"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:42
|
||||
msgid "-"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:43
|
||||
msgid "Removes selected provider"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:47
|
||||
msgid "Advanced..."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:48
|
||||
msgid "Opens dialog with provider settings"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:230 lib/EAPBase_UI/res/wxEAP_UI.cpp:355
|
||||
msgid "Client Credentials"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:134
|
||||
msgid "Manage your credentials stored in Windows Credential Manager."
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:241
|
||||
msgid "Manage credentials used to connect."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:144
|
||||
msgid "Identity:"
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:254
|
||||
msgid "Use &own credentials:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:149
|
||||
msgid "Enter your user name here (user@domain.org, DOMAINUser, etc.)"
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:255
|
||||
msgid "Select this option if you have your unique credentials to connect"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:159
|
||||
msgid "&Set Credentials..."
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:260
|
||||
msgid "Your credentials loaded from Windows Credential Manager"
|
||||
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
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:270
|
||||
msgid "&Clear Credentials"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:165
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:271
|
||||
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
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:275 lib/EAPBase_UI/res/wxEAP_UI.cpp:308
|
||||
msgid "&Set Credentials..."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:276 lib/EAPBase_UI/res/wxEAP_UI.cpp:309
|
||||
msgid "Click here to set or modify your credentials"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:292
|
||||
msgid "Use &pre-shared credentials:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:293
|
||||
msgid "Select this options if all clients connect using the same credentials"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:298
|
||||
msgid "Common (pre-shared) credentials"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:366
|
||||
msgid "Please provide your user ID and password."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:221
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:376
|
||||
msgid "User ID:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:226
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:381
|
||||
msgid "Enter your user name here (user@domain.org, DOMAIN\\User, etc.)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:230
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:385
|
||||
msgid "Password:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:235
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:390
|
||||
msgid "Enter your password here"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:242 lib/TLS_UI/res/wxTLS_UI.cpp:164
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:397 lib/TLS_UI/res/wxTLS_UI.cpp:183
|
||||
msgid "&Remember"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:243
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:398
|
||||
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."
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:420
|
||||
msgid "Your Organization"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:431
|
||||
msgid "Describe your organization to customize user prompts. When organization is introduced, end-users find program messages easier to understand and act."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:438
|
||||
msgid "Your organization &name:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:443
|
||||
msgid "Your organization name as it will appear on helpdesk contact notifications"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:447
|
||||
msgid "(Keep it short, please)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:457
|
||||
msgid "Helpdesk contact &information:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:467
|
||||
msgid "¶"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:474
|
||||
msgid "Your helpdesk website address"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:478
|
||||
msgid "*"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:485
|
||||
msgid "Your helpdesk e-mail address"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:489
|
||||
msgid ")"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:496
|
||||
msgid "Your helpdesk phone number"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:524
|
||||
msgid "Provider Unique Identifier"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:535
|
||||
msgid "Assign your organization a unique ID to allow sharing the same credential set across different network profiles."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:542
|
||||
msgid "&Namespace:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:546
|
||||
msgid "urn:RFC4282:realm"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:546
|
||||
msgid "urn:uuid"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:558
|
||||
msgid "Provider unique &identifier:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:563
|
||||
msgid "Your organization ID to assign same credentials from other profiles"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:588
|
||||
msgid "Configuration Lock"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:599
|
||||
msgid "Your configuration can be locked to prevent accidental modification by end-users. Users will only be allowed to enter credentials."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:606
|
||||
msgid "&Lock this configuration and prevent any further modification via user interface."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:609
|
||||
msgid "(Warning: Once locked, you can not revert using this dialog!)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:98
|
||||
#, c-format
|
||||
msgid "%s Credentials"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:123 lib/EAPBase_UI/include/EAP_UI.h:352
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:362 lib/EAPBase_UI/res/wxEAP_UI.h:119
|
||||
msgid "EAP Credentials"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:166
|
||||
#, c-format
|
||||
msgid "For additional help and instructions, please contact %s at:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:167
|
||||
msgid "your provider"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:186
|
||||
msgid "Open the default web browser"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:197
|
||||
msgid "Open your e-mail program"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:208
|
||||
msgid "Dial the phone number"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:228
|
||||
#, c-format
|
||||
msgid "%s has pre-set parts of this configuration. Those parts are locked to prevent accidental modification."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:229
|
||||
msgid "Your provider"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:249
|
||||
msgid "Previous attempt to connect failed. Please, make sure your credentials are correct, or try again later."
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:17
|
||||
@@ -132,11 +302,11 @@ 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"
|
||||
msgid "A semicolon delimited list of acceptable server FQDN names; blank to skip name check; Unicode characters allowed"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:81
|
||||
msgid "(Example: foo.bar.com;*.domain.org)"
|
||||
msgid "(Example: foo.bar.com;server2.bar.com)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:120
|
||||
@@ -167,48 +337,59 @@ msgstr ""
|
||||
msgid "Client certificate to use for authentication"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:165
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:167
|
||||
msgid "Custom &identity:"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:172
|
||||
msgid "Your identity (username@domain) to override one from certificate; or blank to use one provided in certificate"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:176
|
||||
msgid "(Example: user@contoso.com)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:184
|
||||
msgid "Check if you would like to save certificate selection"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:199
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:118
|
||||
#, c-format
|
||||
msgid "Invalid character in host name found: %c"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:199
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:118
|
||||
msgid "Validation conflict"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:551
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:511
|
||||
msgid "Add Certificate"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:552
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:512
|
||||
msgid "Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:553
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:513
|
||||
msgid "X.509 Certificate Files (*.cer;*.crt;*.der;*.pem)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:554
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:514
|
||||
msgid "PKCS #7 Certificate Files (*.p7b)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:555
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:515
|
||||
msgid "All Files (*.*)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:571
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:531
|
||||
#, c-format
|
||||
msgid "Invalid or unsupported certificate file %s"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:571
|
||||
#, fuzzy
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:531
|
||||
msgid "Error"
|
||||
msgstr "Napaka pri nalaganju knjižnice MSI.DLL (%1!ld!)."
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:17
|
||||
msgid "Outer Identity"
|
||||
@@ -219,7 +400,7 @@ 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"
|
||||
msgid "&True identity"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:36
|
||||
@@ -246,96 +427,101 @@ msgstr ""
|
||||
msgid "Custom outer identity to use"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:92
|
||||
msgid "Outer Authentication"
|
||||
#: lib/TTLS_UI/src/Module.cpp:275 lib/TTLS_UI/src/Module.cpp:285
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:689
|
||||
#, c-format
|
||||
msgid "Error writing credentials to Credential Manager: %hs (error %u)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:105
|
||||
#: lib/TTLS_UI/src/Module.cpp:277 lib/TTLS_UI/src/Module.cpp:287
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:692
|
||||
msgid "Writing credentials failed."
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:108 lib/TTLS_UI/src/TTLS_UI.cpp:235
|
||||
msgid "Inner Authentication"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:111
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:114
|
||||
msgid "Select inner authentication method from the list"
|
||||
msgstr ""
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:112
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:116
|
||||
msgid "PAP"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:217
|
||||
msgid "<blank>"
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:118
|
||||
msgid "MSCHAPv2"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:223
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:123 lib/TTLS_UI/src/TTLS_UI.cpp:256
|
||||
msgid "Outer Authentication"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:289
|
||||
#, c-format
|
||||
msgid "<error %u>"
|
||||
msgid "Are you sure you want to permanently remove %ls provider from configuration?"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:246
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:289
|
||||
msgid "Warning"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:549
|
||||
msgid "Provider Settings"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:705
|
||||
#, c-format
|
||||
msgid "Deleting credentials failed (error %u)."
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:300
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:738
|
||||
#, c-format
|
||||
msgid "Error reading credentials from Credential Manager: %ls (error %u)"
|
||||
msgid "<error %u>"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:303
|
||||
#, c-format
|
||||
msgid "Reading credentials failed (error %u)."
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:742
|
||||
msgid "<error>"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:318
|
||||
#, c-format
|
||||
msgid "Error writing credentials to Credential Manager: %ls (error %u)"
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:753 lib/EAPBase_UI/include/EAP_UI.h:762
|
||||
msgid "<empty>"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:321
|
||||
#, c-format
|
||||
msgid "Writing credentials failed (error %u)."
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:753 lib/EAPBase_UI/include/EAP_UI.h:762
|
||||
msgid "<blank ID>"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.h:56
|
||||
msgid "EAP Method Configuration"
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:962
|
||||
msgid "<Your Organization>"
|
||||
msgstr ""
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.h:81
|
||||
msgid "EAP Credentials"
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.h:69
|
||||
msgid "EAP Connection Configuration"
|
||||
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 "EAP Methods"
|
||||
msgstr ""
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.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 ""
|
||||
|
587
EAPMethods/locale/sl_SI.po
Normal file
587
EAPMethods/locale/sl_SI.po
Normal file
@@ -0,0 +1,587 @@
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: EAPMethods\n"
|
||||
"POT-Creation-Date: 2016-09-02 19:08+0200\n"
|
||||
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
|
||||
"Last-Translator: Simon Rozman <simon@rozman.si>, 2016\n"
|
||||
"Language-Team: Slovenian (Slovenia) (https://www.transifex.com/eduroam_devel/teams/11799/sl_SI/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: sl_SI\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
"X-Generator: Poedit 1.8.8\n"
|
||||
"X-Poedit-Basepath: ../..\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"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:37
|
||||
msgid "+"
|
||||
msgstr "+"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:38
|
||||
msgid "Adds new provider"
|
||||
msgstr "Doda novega ponudnika"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:42
|
||||
msgid "-"
|
||||
msgstr "-"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:43
|
||||
msgid "Removes selected provider"
|
||||
msgstr "Odstrani izbranega ponudnika"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:47
|
||||
msgid "Advanced..."
|
||||
msgstr "Napredno ..."
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:48
|
||||
msgid "Opens dialog with provider settings"
|
||||
msgstr "Odpre dialog z nastavitvami ponudnika"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:230 lib/EAPBase_UI/res/wxEAP_UI.cpp:355
|
||||
msgid "Client Credentials"
|
||||
msgstr "Odjemalčeve poverilnice"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:241
|
||||
msgid "Manage credentials used to connect."
|
||||
msgstr "Upravljajte s poverilnicami za povezovanje."
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:254
|
||||
msgid "Use &own credentials:"
|
||||
msgstr "Uporabi sv&oje poverilnice:"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:255
|
||||
msgid "Select this option if you have your unique credentials to connect"
|
||||
msgstr "Izberite to možnost, če imate svoje lastne poverilnice za povezovanje"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:260
|
||||
msgid "Your credentials loaded from Windows Credential Manager"
|
||||
msgstr "Vaše poverilnice naložene iz upravitelja poverilnic Windows"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:270
|
||||
msgid "&Clear Credentials"
|
||||
msgstr "Počisti poverilni&ce"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:271
|
||||
msgid ""
|
||||
"Click to clear your credentials from Credential Manager.\n"
|
||||
"Note: You will be prompted to enter credentials when connecting."
|
||||
msgstr ""
|
||||
"Kliknite, da počistite svoje poverilnice iz upravitelja poverilnic.\n"
|
||||
"Opomba: Za vnos poverilnic boste pozvani ob povezovanju."
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:275 lib/EAPBase_UI/res/wxEAP_UI.cpp:308
|
||||
msgid "&Set Credentials..."
|
||||
msgstr "Na&stavi poverilnice ..."
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:276 lib/EAPBase_UI/res/wxEAP_UI.cpp:309
|
||||
msgid "Click here to set or modify your credentials"
|
||||
msgstr "Kliknite tukaj, da nastavite ali spremenite svoje poverilnice"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:292
|
||||
msgid "Use &pre-shared credentials:"
|
||||
msgstr "Uporabi sku&pne poverilnice:"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:293
|
||||
msgid "Select this options if all clients connect using the same credentials"
|
||||
msgstr ""
|
||||
"Izberite to možnost, kadar se vsi odjemalci povezujejo z istimi "
|
||||
"poverilnicami"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:298
|
||||
msgid "Common (pre-shared) credentials"
|
||||
msgstr "Skupne (deljene) poverilnice"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:366
|
||||
msgid "Please provide your user ID and password."
|
||||
msgstr "Vnesite svoj uporabniški ID in geslo."
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:376
|
||||
msgid "User ID:"
|
||||
msgstr "Uporabniški ID:"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:381
|
||||
msgid "Enter your user name here (user@domain.org, DOMAIN\\User, etc.)"
|
||||
msgstr "Tukaj vnesite svoje up. ime (up. ime@domena.si, DOMENA\\Uporabnik ipd.)"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:385
|
||||
msgid "Password:"
|
||||
msgstr "Geslo:"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:390
|
||||
msgid "Enter your password here"
|
||||
msgstr "Tukaj vnesite svoje geslo"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:397 lib/TLS_UI/res/wxTLS_UI.cpp:183
|
||||
msgid "&Remember"
|
||||
msgstr "Za&pomni si"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:398
|
||||
msgid "Check if you would like to save username and password"
|
||||
msgstr "Odkljukajte, če želite shraniti up. ime in geslo"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:420
|
||||
msgid "Your Organization"
|
||||
msgstr "Vaša organizacija"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:431
|
||||
msgid ""
|
||||
"Describe your organization to customize user prompts. When organization is "
|
||||
"introduced, end-users find program messages easier to understand and act."
|
||||
msgstr ""
|
||||
"Opišite svojo organizacijo za up. pozive po meri. Kadar se organizacija "
|
||||
"predstavi, uporabniki lažje razumejo sporočila programa in ustrezneje "
|
||||
"reagirajo."
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:438
|
||||
msgid "Your organization &name:"
|
||||
msgstr "Ime vaše orga&nizacije:"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:443
|
||||
msgid ""
|
||||
"Your organization name as it will appear on helpdesk contact notifications"
|
||||
msgstr ""
|
||||
"Ime vaše organizacije, kot bo nastopalo na obvestilih s stikom na center za "
|
||||
"pomoč"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:447
|
||||
msgid "(Keep it short, please)"
|
||||
msgstr "(Naj bo kratko, prosim)"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:457
|
||||
msgid "Helpdesk contact &information:"
|
||||
msgstr "Podatk&i centra za pomoč:"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:467
|
||||
msgid "¶"
|
||||
msgstr "¶"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:474
|
||||
msgid "Your helpdesk website address"
|
||||
msgstr "Naslov spletne strani vašega centra za pomoč"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:478
|
||||
msgid "*"
|
||||
msgstr "*"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:485
|
||||
msgid "Your helpdesk e-mail address"
|
||||
msgstr "E-poštni naslov vašega centra za pomoč"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:489
|
||||
msgid ")"
|
||||
msgstr ")"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:496
|
||||
msgid "Your helpdesk phone number"
|
||||
msgstr "Telefonska številka vašega centra za pomoč"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:524
|
||||
msgid "Provider Unique Identifier"
|
||||
msgstr "Enolični identifikator ponudnika"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:535
|
||||
msgid ""
|
||||
"Assign your organization a unique ID to allow sharing the same credential "
|
||||
"set across different network profiles."
|
||||
msgstr ""
|
||||
"Dodelite svoji organizaciji enoznačen identifikator, da omogočite souporabo "
|
||||
"istih poverilnic različnim omrežnim profilom."
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:542
|
||||
msgid "&Namespace:"
|
||||
msgstr "Ime&nski prostor:"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:546
|
||||
msgid "urn:RFC4282:realm"
|
||||
msgstr "urn:RFC4282:realm"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:546
|
||||
msgid "urn:uuid"
|
||||
msgstr "urn:uuid"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:558
|
||||
msgid "Provider unique &identifier:"
|
||||
msgstr "Enolični &identifikator ponudnika:"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:563
|
||||
msgid "Your organization ID to assign same credentials from other profiles"
|
||||
msgstr ""
|
||||
"Identifikator vaše organizacije za souporabo istih poverilnic različnih "
|
||||
"profilov"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:588
|
||||
msgid "Configuration Lock"
|
||||
msgstr "Zaklep konfiguracije"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:599
|
||||
msgid ""
|
||||
"Your configuration can be locked to prevent accidental modification by end-"
|
||||
"users. Users will only be allowed to enter credentials."
|
||||
msgstr ""
|
||||
"Svojo konfiguracijo lahko zaklenete in preprečite končnim uporabnikom "
|
||||
"nenamerno spreminjanje. Uporabniki bodo lahko vnašali samo poverilnice."
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:606
|
||||
msgid ""
|
||||
"&Lock this configuration and prevent any further modification via user "
|
||||
"interface."
|
||||
msgstr ""
|
||||
"Zak&leni to konfiguracijo in prepreči vse nadaljnje spremembe preko up. "
|
||||
"vmesnika."
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.cpp:609
|
||||
msgid "(Warning: Once locked, you can not revert using this dialog!)"
|
||||
msgstr "(Pozor: Ko zaklenete, vrnitev ne bo več možna preko tega dialoga!)"
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:98
|
||||
#, c-format
|
||||
msgid "%s Credentials"
|
||||
msgstr "Poverilnice za %s"
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:123 lib/EAPBase_UI/include/EAP_UI.h:352
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:362 lib/EAPBase_UI/res/wxEAP_UI.h:119
|
||||
msgid "EAP Credentials"
|
||||
msgstr "Poverilnice EAP"
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:166
|
||||
#, c-format
|
||||
msgid "For additional help and instructions, please contact %s at:"
|
||||
msgstr "Za dodtano pomoč ali navodila se obrnite na %s na:"
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:167
|
||||
msgid "your provider"
|
||||
msgstr "vaš ponudnik"
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:186
|
||||
msgid "Open the default web browser"
|
||||
msgstr "Odpre privzeto nastavljen spletni brskalnik"
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:197
|
||||
msgid "Open your e-mail program"
|
||||
msgstr "Odpre vaš program za e-pošto"
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:208
|
||||
msgid "Dial the phone number"
|
||||
msgstr "Pokliče telefonsko številko"
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:228
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%s has pre-set parts of this configuration. Those parts are locked to "
|
||||
"prevent accidental modification."
|
||||
msgstr ""
|
||||
"%s je prednastavil dele te konfiguracije. Ti deli so zaklenjeni zaradi "
|
||||
"preprečevanja nenamernih sprememb."
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:229
|
||||
msgid "Your provider"
|
||||
msgstr "Vaš ponudnik"
|
||||
|
||||
#: lib/EAPBase_UI/src/EAP_UI.cpp:249
|
||||
msgid ""
|
||||
"Previous attempt to connect failed. Please, make sure your credentials are "
|
||||
"correct, or try again later."
|
||||
msgstr ""
|
||||
"Prejšnji poskus povezave ni uspel. Preverite, ali so vaše poverilnice "
|
||||
"pravilne ali poskusite kasneje."
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:17
|
||||
msgid "Server Trust"
|
||||
msgstr "Zaupanje strežniku"
|
||||
|
||||
#: 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 ""
|
||||
"Opišite strežnike, ki jim zaupate in preprečite prestrezanje poverilnic v "
|
||||
"primeru napada \"vmesnega člena\"."
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:35
|
||||
msgid "Acceptable Certificate Authorities:"
|
||||
msgstr "Sprejemljivi izdajatelji potrdil:"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:40
|
||||
msgid "List of certificate authorities server's certificate must be issued by"
|
||||
msgstr ""
|
||||
"Seznam izdajateljev potrdil, od katerih mora biti izdano strežnikovo "
|
||||
"potrdilo"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:47
|
||||
msgid "Add CA from Store..."
|
||||
msgstr "Dodaj CA iz shrambe ..."
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:48
|
||||
msgid ""
|
||||
"Adds a new certificate authority from the certificate store to the list"
|
||||
msgstr "Doda novega izdajatelja potrdil iz shrambe potrdil na seznam"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:52
|
||||
msgid "Add CA from File..."
|
||||
msgstr "Dodaj CA iz datoteke ..."
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:53
|
||||
msgid "Adds a new certificate authority from the file to the list"
|
||||
msgstr "Doda novega izdajatelja potrdil iz datoteke na seznam"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:57
|
||||
msgid "&Remove CA"
|
||||
msgstr "Odst&rani CA"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:59
|
||||
msgid "Removes selected certificate authorities from the list"
|
||||
msgstr "Odstrani izbrane izdajatelje potrdil s seznama"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:72
|
||||
msgid "Acceptable server &names:"
|
||||
msgstr "Sprejemljiva ime&na strežnika:"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:77
|
||||
msgid ""
|
||||
"A semicolon delimited list of acceptable server FQDN names; blank to skip "
|
||||
"name check; Unicode characters allowed"
|
||||
msgstr ""
|
||||
"S podpičji ločen seznam sprejemljivih strežnikovih imen FQDN; prazno, da "
|
||||
"izpusti preverjanje imena; znaki Unicode dovoljeni"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:81
|
||||
msgid "(Example: foo.bar.com;server2.bar.com)"
|
||||
msgstr "(Primer: vzo.rec.si;streznik2.rec.si)"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:120
|
||||
msgid "TLS Client Certificate"
|
||||
msgstr "Odjemalčevo potrdilo TLS"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:131
|
||||
msgid "Please select your client certificate to use for authentication."
|
||||
msgstr "Izberite svoje odjemalčevo potrdilo za uporabo med overovljanjem."
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:138
|
||||
msgid "Co&nnect without providing a client certificate"
|
||||
msgstr "Poveži brez dostave &odjemalčevega potrdila"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:139
|
||||
msgid ""
|
||||
"Select if your server does not require you to provide a client certificate"
|
||||
msgstr ""
|
||||
"Izberite, če vaš strežnik ne zahteva, da mu dostavite odjemalčevo potrdilo"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:146
|
||||
msgid "Use the following &certificate:"
|
||||
msgstr "Uporabi naslednje &potrdilo:"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:147
|
||||
msgid "Select if you need to provide a client certificate when connecting"
|
||||
msgstr "Izberite, če morate dostaviti odjemalčevo potrdilo ob povezavi"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:154
|
||||
msgid "Client certificate to use for authentication"
|
||||
msgstr "Odjemalčevo potrdilo za overovljanje"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:167
|
||||
msgid "Custom &identity:"
|
||||
msgstr "&Identiteta po meri:"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:172
|
||||
msgid ""
|
||||
"Your identity (username@domain) to override one from certificate; or blank "
|
||||
"to use one provided in certificate"
|
||||
msgstr ""
|
||||
"Vaša identiteta (up. ime@domena), ki bo nadomestila tisto s potrdila; ali "
|
||||
"prazno, če želite uporabiti tisto s potrdila"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:176
|
||||
msgid "(Example: user@contoso.com)"
|
||||
msgstr "(Primer: uporabnik@vzorec.si)"
|
||||
|
||||
#: lib/TLS_UI/res/wxTLS_UI.cpp:184
|
||||
msgid "Check if you would like to save certificate selection"
|
||||
msgstr "Odkljukajte, če želite shraniti izbor potrdila"
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:118
|
||||
#, c-format
|
||||
msgid "Invalid character in host name found: %c"
|
||||
msgstr "Napačen znak v imenu gostitelja: %c"
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:118
|
||||
msgid "Validation conflict"
|
||||
msgstr "Nesoglasje pri preverjanju"
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:511
|
||||
msgid "Add Certificate"
|
||||
msgstr "Dodaj potrdilo"
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:512
|
||||
msgid "Certificate Files (*.cer;*.crt;*.der;*.p7b;*.pem)"
|
||||
msgstr "Datoteke s potrdili (*.cer;*.crt;*.der;*.p7b;*.pem)"
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:513
|
||||
msgid "X.509 Certificate Files (*.cer;*.crt;*.der;*.pem)"
|
||||
msgstr "Datoteke s potrdili X.509 (*.cer;*.crt;*.der;*.pem)"
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:514
|
||||
msgid "PKCS #7 Certificate Files (*.p7b)"
|
||||
msgstr "Datoteke s potrdili PKCS #7 (*.p7b)"
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:515
|
||||
msgid "All Files (*.*)"
|
||||
msgstr "Vse datoteke (*.*)"
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:531
|
||||
#, c-format
|
||||
msgid "Invalid or unsupported certificate file %s"
|
||||
msgstr "Napačna ali nepodprta datoteka s potrdilom %s"
|
||||
|
||||
#: lib/TLS_UI/src/TLS_UI.cpp:531
|
||||
msgid "Error"
|
||||
msgstr "Napaka"
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:17
|
||||
msgid "Outer Identity"
|
||||
msgstr "Zunanja identiteta"
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:28
|
||||
msgid "Select the user ID supplicant introduces itself as to authenticator:"
|
||||
msgstr ""
|
||||
"Izberite uporabniško identiteto, s katerim se prosilec predstavi "
|
||||
"overovitelju:"
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:35
|
||||
msgid "&True identity"
|
||||
msgstr "Prava iden&titeta"
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:36
|
||||
msgid "Use my true user name"
|
||||
msgstr "Uporabi moje pravo uporabniško ime"
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:40
|
||||
msgid "Use &empty outer identity (RFC 4822)"
|
||||
msgstr "Uporabi prazno zunanjo id&entiteto (RFC 4822)"
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:41
|
||||
msgid "Ommit my user name and use @mydomain.org only"
|
||||
msgstr "Izpusti moje uporabniško ime in uporabi samo @mojadomena.si"
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:48
|
||||
msgid "&Custom outer identity:"
|
||||
msgstr "Zunanja identiteta po &meri:"
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:49
|
||||
msgid "Specify custom outer identity"
|
||||
msgstr "Navedite zunanjo identiteto po meri"
|
||||
|
||||
#: lib/TTLS_UI/res/wxTTLS_UI.cpp:54
|
||||
msgid "Custom outer identity to use"
|
||||
msgstr "Zunanja identiteta po meri za uporabo"
|
||||
|
||||
#: lib/TTLS_UI/src/Module.cpp:275 lib/TTLS_UI/src/Module.cpp:285
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:689
|
||||
#, c-format
|
||||
msgid "Error writing credentials to Credential Manager: %hs (error %u)"
|
||||
msgstr ""
|
||||
"Napaka pri zapisovanju poverilnic v upravitelja poverilnic: %hs (napaka %u)"
|
||||
|
||||
#: lib/TTLS_UI/src/Module.cpp:277 lib/TTLS_UI/src/Module.cpp:287
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:692
|
||||
msgid "Writing credentials failed."
|
||||
msgstr "Zapisovanje poverilnic ni uspelo."
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:108 lib/TTLS_UI/src/TTLS_UI.cpp:235
|
||||
msgid "Inner Authentication"
|
||||
msgstr "Notranje overovljanje"
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:114
|
||||
msgid "Select inner authentication method from the list"
|
||||
msgstr "Izberite postopek notranjega overovljanja s seznama"
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:116
|
||||
msgid "PAP"
|
||||
msgstr "PAP"
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:118
|
||||
msgid "MSCHAPv2"
|
||||
msgstr "MSCHAPv2"
|
||||
|
||||
#: lib/TTLS_UI/src/TTLS_UI.cpp:123 lib/TTLS_UI/src/TTLS_UI.cpp:256
|
||||
msgid "Outer Authentication"
|
||||
msgstr "Zunanje overovljanje"
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:289
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Are you sure you want to permanently remove %ls provider from configuration?"
|
||||
msgstr ""
|
||||
"Ali ste prepričani, da želite trajno izbrisati ponudnika %ls iz "
|
||||
"konfiguracije?"
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:289
|
||||
msgid "Warning"
|
||||
msgstr "Opozorilo"
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:549
|
||||
msgid "Provider Settings"
|
||||
msgstr "Nastavitve ponudnika"
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:705
|
||||
#, c-format
|
||||
msgid "Deleting credentials failed (error %u)."
|
||||
msgstr "Izbris poverilnic ni uspel (napaka %u)."
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:738
|
||||
#, c-format
|
||||
msgid "<error %u>"
|
||||
msgstr "<napaka %u>"
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:742
|
||||
msgid "<error>"
|
||||
msgstr "<napaka>"
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:753 lib/EAPBase_UI/include/EAP_UI.h:762
|
||||
msgid "<empty>"
|
||||
msgstr "<napaka>"
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:753 lib/EAPBase_UI/include/EAP_UI.h:762
|
||||
msgid "<blank ID>"
|
||||
msgstr "<prazen ID>"
|
||||
|
||||
#: lib/EAPBase_UI/include/EAP_UI.h:962
|
||||
msgid "<Your Organization>"
|
||||
msgstr "<vaša organizacija>"
|
||||
|
||||
#: lib/EAPBase_UI/res/wxEAP_UI.h:69
|
||||
msgid "EAP Connection Configuration"
|
||||
msgstr "Konfiguracija povezave EAP"
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:3
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:3
|
||||
msgid "1252"
|
||||
msgstr "1250"
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "EAP Methods"
|
||||
msgstr "Postopki EAP"
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "Modules to support individual EAP methods"
|
||||
msgstr "Moduli, ki omogočajo posamezne postopke EAP"
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:5
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:5
|
||||
msgid "TTLS"
|
||||
msgstr "TTLS"
|
||||
|
||||
#: EAPMethods/MSIBuild/En.Win32.Release.Feature-2.idtx:5
|
||||
#: EAPMethods/MSIBuild/En.x64.Release.Feature-2.idtx:5
|
||||
msgid "Tunneled Transport Layer Security"
|
||||
msgstr "Tunneled Transport Layer Security"
|
@@ -23,10 +23,10 @@
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
|
||||
#if EAPMETHOD_TYPE==21
|
||||
#define _EAPMETHOD_PEER eap::peer_ttls
|
||||
#define _EAPMETHOD_SESSION eap::session_ttls
|
||||
#else
|
||||
#error Unknown EAP Method type.
|
||||
#endif
|
||||
@@ -84,7 +84,7 @@ VOID WINAPI EapPeerFreeErrorMemory(_In_ EAP_ERROR *ppEapError)
|
||||
|
||||
|
||||
///
|
||||
/// Obtains a set of function pointers for an implementation of the EAP peer method currently loaded on the EAPHost service.
|
||||
/// Obtains a set of function pointers for an implementation of the EAP peer method currently loaded on the EapHost service.
|
||||
///
|
||||
/// \sa [EapPeerGetInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363608.aspx)
|
||||
///
|
||||
@@ -131,8 +131,11 @@ DWORD WINAPI EapPeerGetInfo(_In_ EAP_TYPE* pEapType, _Out_ EAP_PEER_METHOD_ROUTI
|
||||
}
|
||||
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4702) // Compiler is smart enough to find out the initialize() method is empty => never throws an exception.
|
||||
|
||||
///
|
||||
/// Initializes an EAP peer method for EAPHost.
|
||||
/// Initializes an EAP peer method for EapHost.
|
||||
///
|
||||
/// \sa [EapPeerGetInfo function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363613.aspx)
|
||||
///
|
||||
@@ -150,17 +153,23 @@ DWORD APIENTRY EapPeerInitialize(_Out_ EAP_ERROR **ppEapError)
|
||||
|
||||
assert(!*ppEapError);
|
||||
|
||||
if (!g_peer.initialize(ppEapError)) {
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.initialize();
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4702) // Compiler is smart enough to find out the shutdown() method is empty => never throws an exception.
|
||||
|
||||
///
|
||||
/// Shuts down the EAP method and prepares to unload its corresponding DLL.
|
||||
@@ -181,20 +190,23 @@ DWORD APIENTRY EapPeerShutdown(_Out_ EAP_ERROR **ppEapError)
|
||||
|
||||
assert(!*ppEapError);
|
||||
|
||||
if (!g_peer.shutdown(ppEapError)) {
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.shutdown();
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
|
||||
///
|
||||
/// Returns the user data and user identity after being called by EAPHost.
|
||||
/// 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)
|
||||
///
|
||||
@@ -236,17 +248,12 @@ DWORD APIENTRY EapPeerGetIdentity(
|
||||
else if (!ppwszIdentity)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppwszIdentity is NULL.")));
|
||||
else {
|
||||
_EAPMETHOD_PEER::config_type cfg(g_peer);
|
||||
_EAPMETHOD_PEER::identity_type usr(g_peer);
|
||||
if (!g_peer.unpack(cfg, pConnectionData, dwConnectionDataSize, ppEapError) ||
|
||||
!g_peer.unpack(usr, pUserData, dwUserDataSize, ppEapError) ||
|
||||
!g_peer.get_identity(dwFlags, cfg, usr, hTokenImpersonateUser, pfInvokeUI, ppwszIdentity, ppEapError) ||
|
||||
!g_peer.pack(usr, ppUserDataOut, pdwUserDataOutSize, ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.get_identity(dwFlags, pConnectionData, dwConnectionDataSize, pUserData, dwUserDataSize, ppUserDataOut, pdwUserDataOutSize, hTokenImpersonateUser, pfInvokeUI, ppwszIdentity);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +263,7 @@ DWORD APIENTRY EapPeerGetIdentity(
|
||||
|
||||
|
||||
///
|
||||
/// Starts an EAP authentication session on the peer EAPHost using the EAP method.
|
||||
/// 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)
|
||||
///
|
||||
@@ -291,28 +298,14 @@ DWORD APIENTRY EapPeerBeginSession(
|
||||
else if (!phSession)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" phSession is NULL.")));
|
||||
else {
|
||||
*phSession = NULL;
|
||||
|
||||
// Allocate new session.
|
||||
unique_ptr<_EAPMETHOD_SESSION> session(new _EAPMETHOD_SESSION(g_peer));
|
||||
if (!session) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_OUTOFMEMORY, _T(" Error allocating memory for EAP session.")));
|
||||
return dwResult;
|
||||
try {
|
||||
*phSession = g_peer.begin_session(dwFlags, pAttributeArray, hTokenImpersonateUser, pConnectionData, dwConnectionDataSize, pUserData, dwUserDataSize, dwMaxSendPacketSize);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
// Begin the session.
|
||||
if (!g_peer.unpack(session->m_cfg, pConnectionData, dwConnectionDataSize, ppEapError) ||
|
||||
!g_peer.unpack(session->m_id, pUserData, dwUserDataSize, ppEapError) ||
|
||||
!session->begin(dwFlags, pAttributeArray, hTokenImpersonateUser, dwMaxSendPacketSize, ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
return dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
return dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
*phSession = session.release();
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
@@ -324,7 +317,9 @@ DWORD APIENTRY EapPeerBeginSession(
|
||||
///
|
||||
/// \sa [EapPeerEndSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363604.aspx)
|
||||
///
|
||||
DWORD APIENTRY EapPeerEndSession(_In_ EAP_SESSION_HANDLE hSession, _Out_ EAP_ERROR **ppEapError)
|
||||
DWORD APIENTRY EapPeerEndSession(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
DWORD dwResult = ERROR_SUCCESS;
|
||||
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||
@@ -341,8 +336,14 @@ DWORD APIENTRY EapPeerEndSession(_In_ EAP_SESSION_HANDLE hSession, _Out_ EAP_ERR
|
||||
if (!hSession)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" hSession is NULL.")));
|
||||
else {
|
||||
static_cast<_EAPMETHOD_SESSION*>(hSession)->end(ppEapError);
|
||||
delete static_cast<_EAPMETHOD_SESSION*>(hSession);
|
||||
try {
|
||||
g_peer.end_session(hSession);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
@@ -350,7 +351,7 @@ DWORD APIENTRY EapPeerEndSession(_In_ EAP_SESSION_HANDLE hSession, _Out_ EAP_ERR
|
||||
|
||||
|
||||
///
|
||||
/// Processes a packet received by EAPHost from a supplicant.
|
||||
/// Processes a packet received by EapHost from a supplicant.
|
||||
///
|
||||
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||
///
|
||||
@@ -375,16 +376,19 @@ DWORD APIENTRY EapPeerProcessRequestPacket(
|
||||
|
||||
if (!hSession)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" hSession is NULL.")));
|
||||
else if (!pReceivedPacket && dwReceivedPacketSize)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pReceivedPacket is NULL.")));
|
||||
else if (!pReceivedPacket || dwReceivedPacketSize < 6)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pReceivedPacket is NULL or too short.")));
|
||||
else if (pReceivedPacket->Data[0] != EAPMETHOD_TYPE)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, wstring_printf(_T(__FUNCTION__) _T(" Packet EAP type (%d) does not match the supported EAP type (%d)."), (int)pReceivedPacket->Data[0], (int)EAPMETHOD_TYPE).c_str()));
|
||||
else if (!pEapOutput)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapOutput is NULL.")));
|
||||
else {
|
||||
if (!static_cast<_EAPMETHOD_SESSION*>(hSession)->process_request_packet(dwReceivedPacketSize, pReceivedPacket, pEapOutput, ppEapError)) {
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.process_request_packet(hSession, pReceivedPacket, dwReceivedPacketSize, pEapOutput);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -423,11 +427,12 @@ DWORD APIENTRY EapPeerGetResponsePacket(
|
||||
else if (!pSendPacket && *pdwSendPacketSize)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pSendPacket is NULL.")));
|
||||
else {
|
||||
if (!static_cast<_EAPMETHOD_SESSION*>(hSession)->get_response_packet(pdwSendPacketSize, pSendPacket, ppEapError)) {
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.get_response_packet(hSession, pSendPacket, pdwSendPacketSize);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -441,7 +446,11 @@ DWORD APIENTRY EapPeerGetResponsePacket(
|
||||
///
|
||||
/// \sa [EapPeerGetResult function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363611.aspx)
|
||||
///
|
||||
DWORD APIENTRY EapPeerGetResult(_In_ EAP_SESSION_HANDLE hSession, _In_ EapPeerMethodResultReason reason, _Out_ EapPeerMethodResult *ppResult, _Out_ EAP_ERROR **ppEapError)
|
||||
DWORD APIENTRY EapPeerGetResult(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_In_ EapPeerMethodResultReason reason,
|
||||
_Out_ EapPeerMethodResult *ppResult,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
DWORD dwResult = ERROR_SUCCESS;
|
||||
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||
@@ -460,11 +469,12 @@ DWORD APIENTRY EapPeerGetResult(_In_ EAP_SESSION_HANDLE hSession, _In_ EapPeerMe
|
||||
else if (!ppResult)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppResult is NULL.")));
|
||||
else {
|
||||
if (!static_cast<_EAPMETHOD_SESSION*>(hSession)->get_result(reason, ppResult, ppEapError)) {
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.get_result(hSession, reason, ppResult);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -505,14 +515,12 @@ DWORD APIENTRY EapPeerGetUIContext(
|
||||
else if (!ppUIContextData)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppUIContextData is NULL.")));
|
||||
else {
|
||||
_EAPMETHOD_SESSION::interactive_request_type req;
|
||||
if (!static_cast<_EAPMETHOD_SESSION*>(hSession)->get_ui_context(req, ppEapError) ||
|
||||
!g_peer.pack(req, ppUIContextData, pdwUIContextDataSize, ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.get_ui_context(hSession, ppUIContextData, pdwUIContextDataSize);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -554,14 +562,12 @@ DWORD APIENTRY EapPeerSetUIContext(
|
||||
else if (!pEapOutput)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapOutput is NULL.")));
|
||||
else {
|
||||
_EAPMETHOD_SESSION::interactive_response_type res;
|
||||
if (!g_peer.unpack(res, pUIContextData, dwUIContextDataSize, ppEapError) ||
|
||||
!static_cast<_EAPMETHOD_SESSION*>(hSession)->set_ui_context(res, pEapOutput, ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.set_ui_context(hSession, pUIContextData, dwUIContextDataSize, pEapOutput);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -575,7 +581,10 @@ DWORD APIENTRY EapPeerSetUIContext(
|
||||
///
|
||||
/// \sa [EapPeerGetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363609.aspx)
|
||||
///
|
||||
DWORD APIENTRY EapPeerGetResponseAttributes(_In_ EAP_SESSION_HANDLE hSession, _Out_ EapAttributes *pAttribs, _Out_ EAP_ERROR **ppEapError)
|
||||
DWORD APIENTRY EapPeerGetResponseAttributes(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_Out_ EapAttributes *pAttribs,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
DWORD dwResult = ERROR_SUCCESS;
|
||||
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||
@@ -594,11 +603,12 @@ DWORD APIENTRY EapPeerGetResponseAttributes(_In_ EAP_SESSION_HANDLE hSession, _O
|
||||
else if (!pAttribs)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pAttribs is NULL.")));
|
||||
else {
|
||||
if (!static_cast<_EAPMETHOD_SESSION*>(hSession)->get_response_attributes(pAttribs, ppEapError)) {
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.get_response_attributes(hSession, pAttribs);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -612,7 +622,11 @@ DWORD APIENTRY EapPeerGetResponseAttributes(_In_ EAP_SESSION_HANDLE hSession, _O
|
||||
///
|
||||
/// \sa [EapPeerSetResponseAttributes function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363625.aspx)
|
||||
///
|
||||
DWORD APIENTRY EapPeerSetResponseAttributes(_In_ EAP_SESSION_HANDLE hSession, _In_ /*const*/ EapAttributes *pAttribs, _Out_ EapPeerMethodOutput *pEapOutput, _Out_ EAP_ERROR **ppEapError)
|
||||
DWORD APIENTRY EapPeerSetResponseAttributes(
|
||||
_In_ EAP_SESSION_HANDLE hSession,
|
||||
_In_ /*const*/ EapAttributes *pAttribs,
|
||||
_Out_ EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
DWORD dwResult = ERROR_SUCCESS;
|
||||
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||
@@ -631,11 +645,12 @@ DWORD APIENTRY EapPeerSetResponseAttributes(_In_ EAP_SESSION_HANDLE hSession, _I
|
||||
else if (!pEapOutput)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapOutput is NULL.")));
|
||||
else {
|
||||
if (!static_cast<_EAPMETHOD_SESSION*>(hSession)->set_response_attributes(pAttribs, pEapOutput, ppEapError)) {
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.set_response_attributes(hSession, pAttribs, pEapOutput);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -654,8 +669,8 @@ DWORD WINAPI EapPeerGetMethodProperties(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||
_In_ HANDLE hUserImpersonationToken,
|
||||
_In_ DWORD dwEapConnDataSize,
|
||||
_In_count_(dwEapConnDataSize) const BYTE *pEapConnData,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwUserDataSize,
|
||||
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||
_Out_ EAP_METHOD_PROPERTY_ARRAY *pMethodPropertyArray,
|
||||
@@ -677,30 +692,19 @@ DWORD WINAPI EapPeerGetMethodProperties(
|
||||
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 (!pEapConnData && dwEapConnDataSize)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapConnData is NULL.")));
|
||||
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 (!pMethodPropertyArray)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pMethodPropertyArray is NULL.")));
|
||||
else {
|
||||
_EAPMETHOD_PEER::config_type cfg(g_peer);
|
||||
_EAPMETHOD_PEER::identity_type usr(g_peer);
|
||||
if (!g_peer.unpack(cfg, pEapConnData, dwEapConnDataSize, ppEapError) ||
|
||||
!g_peer.unpack(usr, pUserData, dwUserDataSize, ppEapError) ||
|
||||
!g_peer.get_method_properties(
|
||||
dwVersion,
|
||||
dwFlags,
|
||||
hUserImpersonationToken,
|
||||
cfg,
|
||||
usr,
|
||||
pMethodPropertyArray,
|
||||
ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.get_method_properties(dwVersion, dwFlags, hUserImpersonationToken, pConnectionData, dwConnectionDataSize, pUserData, dwUserDataSize, pMethodPropertyArray);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -718,8 +722,8 @@ DWORD WINAPI EapPeerCredentialsXml2Blob(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||
_In_ IXMLDOMDocument2 *pCredentialsDoc,
|
||||
_In_count_(dwConfigInSize) const BYTE *pConfigIn,
|
||||
_In_ DWORD dwConfigInSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_Out_ BYTE **ppCredentialsOut,
|
||||
_Out_ DWORD *pdwCredentialsOutSize,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
@@ -742,35 +746,29 @@ DWORD WINAPI EapPeerCredentialsXml2Blob(
|
||||
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 (!pCredentialsDoc)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pCredentialsDoc is NULL.")));
|
||||
else if (!pConfigIn && dwConfigInSize)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pConfigIn is NULL.")));
|
||||
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 (!ppCredentialsOut)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppCredentialsOut is NULL.")));
|
||||
else if (!pdwCredentialsOutSize)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pdwCredentialsOutSize is NULL.")));
|
||||
else {
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
UNREFERENCED_PARAMETER(pConfigIn);
|
||||
UNREFERENCED_PARAMETER(dwConfigInSize);
|
||||
|
||||
// <Credentials>
|
||||
com_obj<IXMLDOMNode> pXmlElCredentials;
|
||||
if ((dwResult = eapxml::select_node(pCredentialsDoc, bstr(L"//EapHostUserCredentials/Credentials"), &pXmlElCredentials)) != ERROR_SUCCESS) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting <EapHostUserCredentials><Credentials> element."), _T("Please make sure credential XML is a valid ") _T(PRODUCT_NAME_STR) _T(" credential XML document.")));
|
||||
if (FAILED(eapxml::select_node(pCredentialsDoc, bstr(L"//EapHostUserCredentials/Credentials"), &pXmlElCredentials))) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting <EapHostUserCredentials><Credentials> element.")));
|
||||
return dwResult;
|
||||
}
|
||||
|
||||
// Load credentials.
|
||||
pCredentialsDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eap-metadata=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\""));
|
||||
_EAPMETHOD_PEER::identity_type usr(g_peer);
|
||||
if (!usr.load(pXmlElCredentials, ppEapError) ||
|
||||
!g_peer.pack(usr, ppCredentialsOut, pdwCredentialsOutSize, ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
return dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
return dwResult = ERROR_INVALID_DATA;
|
||||
try {
|
||||
g_peer.credentials_xml2blob(dwFlags, pXmlElCredentials, pConnectionData, dwConnectionDataSize, ppCredentialsOut, pdwCredentialsOutSize);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -787,8 +785,8 @@ DWORD WINAPI EapPeerQueryCredentialInputFields(
|
||||
_In_ HANDLE hUserImpersonationToken,
|
||||
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ DWORD dwEapConnDataSize,
|
||||
_In_count_(dwEapConnDataSize) const BYTE *pEapConnData,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_Out_ EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldsArray,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
@@ -808,23 +806,17 @@ DWORD WINAPI EapPeerQueryCredentialInputFields(
|
||||
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 (!pEapConnData && dwEapConnDataSize)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapConnData is NULL.")));
|
||||
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 (!pEapConfigInputFieldsArray)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapConfigInputFieldsArray is NULL.")));
|
||||
else {
|
||||
if (!g_peer.query_credential_input_fields(
|
||||
hUserImpersonationToken,
|
||||
dwFlags,
|
||||
dwEapConnDataSize,
|
||||
pEapConnData,
|
||||
pEapConfigInputFieldsArray,
|
||||
ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.query_credential_input_fields(hUserImpersonationToken, dwFlags, dwConnectionDataSize, pConnectionData, pEapConfigInputFieldsArray);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -842,8 +834,8 @@ DWORD WINAPI EapPeerQueryUserBlobFromCredentialInputFields(
|
||||
_In_ HANDLE hUserImpersonationToken,
|
||||
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ DWORD dwEapConnDataSize,
|
||||
_In_count_(dwEapConnDataSize) const BYTE *pEapConnData,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ const EAP_CONFIG_INPUT_FIELD_ARRAY *pEapConfigInputFieldArray,
|
||||
_Inout_ DWORD *pdwUsersBlobSize,
|
||||
_Inout_ BYTE **ppUserBlob,
|
||||
@@ -865,8 +857,8 @@ DWORD WINAPI EapPeerQueryUserBlobFromCredentialInputFields(
|
||||
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 (!pEapConnData && dwEapConnDataSize)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapConnData is NULL.")));
|
||||
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 (!pEapConfigInputFieldArray)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapConfigInputFieldArray is NULL.")));
|
||||
else if (!pdwUsersBlobSize)
|
||||
@@ -874,20 +866,12 @@ DWORD WINAPI EapPeerQueryUserBlobFromCredentialInputFields(
|
||||
else if (!ppUserBlob)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppUserBlob is NULL.")));
|
||||
else {
|
||||
if (!g_peer.query_user_blob_from_credential_input_fields(
|
||||
hUserImpersonationToken,
|
||||
dwFlags,
|
||||
dwEapConnDataSize,
|
||||
pEapConnData,
|
||||
pEapConfigInputFieldArray,
|
||||
pdwUsersBlobSize,
|
||||
ppUserBlob,
|
||||
ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
try {
|
||||
g_peer.query_user_blob_from_credential_input_fields(hUserImpersonationToken, dwFlags, dwConnectionDataSize, pConnectionData, pEapConfigInputFieldArray, pdwUsersBlobSize, ppUserBlob);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -908,7 +892,7 @@ DWORD WINAPI EapPeerQueryInteractiveUIInputFields(
|
||||
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||
_Out_ EAP_INTERACTIVE_UI_DATA *pEapInteractiveUIData,
|
||||
_Out_ EAP_ERROR **ppEapError,
|
||||
_Inout_ LPVOID *pvReserved)
|
||||
_Inout_ LPVOID *ppvReserved)
|
||||
{
|
||||
DWORD dwResult = ERROR_SUCCESS;
|
||||
event_fn_auto_ret<DWORD> event_auto(g_peer.get_event_fn_auto(__FUNCTION__, dwResult));
|
||||
@@ -929,19 +913,14 @@ DWORD WINAPI EapPeerQueryInteractiveUIInputFields(
|
||||
else if (!pEapInteractiveUIData)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pEapInteractiveUIData is NULL.")));
|
||||
else {
|
||||
if (!g_peer.query_interactive_ui_input_fields(
|
||||
dwVersion,
|
||||
dwFlags,
|
||||
dwUIContextDataSize,
|
||||
pUIContextData,
|
||||
pEapInteractiveUIData,
|
||||
ppEapError,
|
||||
pvReserved))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
UNREFERENCED_PARAMETER(ppvReserved);
|
||||
|
||||
try {
|
||||
g_peer.query_interactive_ui_input_fields(dwVersion, dwFlags, dwUIContextDataSize, pUIContextData, pEapInteractiveUIData);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
@@ -951,7 +930,7 @@ DWORD WINAPI EapPeerQueryInteractiveUIInputFields(
|
||||
|
||||
|
||||
///
|
||||
/// Converts user information into a user BLOB that can be consumed by EAPHost run-time functions.
|
||||
/// 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)
|
||||
///
|
||||
@@ -987,21 +966,14 @@ DWORD WINAPI EapPeerQueryUIBlobFromInteractiveUIInputFields(
|
||||
else if (!ppDataFromInteractiveUI)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppDataFromInteractiveUI is NULL.")));
|
||||
else {
|
||||
if (!g_peer.query_ui_blob_from_interactive_ui_input_fields(
|
||||
dwVersion,
|
||||
dwFlags,
|
||||
dwUIContextDataSize,
|
||||
pUIContextData,
|
||||
pEapInteractiveUIData,
|
||||
pdwDataFromInteractiveUISize,
|
||||
ppDataFromInteractiveUI,
|
||||
ppEapError,
|
||||
ppvReserved))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
UNREFERENCED_PARAMETER(ppvReserved);
|
||||
|
||||
try {
|
||||
g_peer.query_ui_blob_from_interactive_ui_input_fields(dwVersion, dwFlags, dwUIContextDataSize, pUIContextData, pEapInteractiveUIData, pdwDataFromInteractiveUISize, ppDataFromInteractiveUI);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
@@ -103,8 +103,8 @@ DWORD WINAPI EapPeerConfigXml2Blob(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||
_In_ IXMLDOMDocument2 *pConfigDoc,
|
||||
_Out_ BYTE **ppConfigOut,
|
||||
_Out_ DWORD *pdwConfigOutSize,
|
||||
_Out_ BYTE **pConnectionDataOut,
|
||||
_Out_ DWORD *pdwConnectionDataOutSize,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
DWORD dwResult = ERROR_SUCCESS;
|
||||
@@ -125,32 +125,28 @@ DWORD WINAPI EapPeerConfigXml2Blob(
|
||||
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 (!ppConfigOut)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppConfigOut is NULL.")));
|
||||
else if (!pdwConfigOutSize)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pdwConfigOutSize 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 {
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
|
||||
// <Config>
|
||||
pConfigDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eaphostconfig=\"http://www.microsoft.com/provisioning/EapHostConfig\""));
|
||||
com_obj<IXMLDOMElement> pXmlElConfig;
|
||||
if ((dwResult = eapxml::select_element(pConfigDoc, bstr(L"//eaphostconfig:Config"), &pXmlElConfig)) != ERROR_SUCCESS) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult, _T(__FUNCTION__) _T(" Error reading <Config> element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")));
|
||||
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\""));
|
||||
_EAPMETHOD_PEER_UI::config_type cfg(g_peer);
|
||||
if (!cfg.load(pXmlElConfig, ppEapError) ||
|
||||
!g_peer.pack(cfg, ppConfigOut, pdwConfigOutSize, ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
return dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
return dwResult = ERROR_INVALID_DATA;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,8 +164,8 @@ DWORD WINAPI EapPeerConfigXml2Blob(
|
||||
DWORD WINAPI EapPeerConfigBlob2Xml(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ EAP_METHOD_TYPE eapMethodType,
|
||||
_In_count_(dwConfigInSize) const BYTE *pConfigIn,
|
||||
_In_ DWORD dwConfigInSize,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_Out_ IXMLDOMDocument2 **ppConfigDoc,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
@@ -189,36 +185,25 @@ DWORD WINAPI EapPeerConfigBlob2Xml(
|
||||
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 (!pConfigIn && dwConfigInSize)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" pConfigIn is NULL.")));
|
||||
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 {
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
HRESULT hr;
|
||||
|
||||
// Unpack configuration.
|
||||
_EAPMETHOD_PEER_UI::config_type cfg(g_peer);
|
||||
if (!g_peer.unpack(cfg, pConfigIn, dwConfigInSize, ppEapError)) {
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
return dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
return dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
// Create configuration XML document.
|
||||
com_obj<IXMLDOMDocument2> pDoc;
|
||||
if (FAILED(hr = pDoc.create(CLSID_DOMDocument60, NULL, CLSCTX_INPROC_SERVER))) {
|
||||
com_obj<IXMLDOMDocument2> pConfigDoc;
|
||||
if (FAILED(hr = pConfigDoc.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);
|
||||
pConfigDoc->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)))) {
|
||||
if (FAILED((hr = pConfigDoc->loadXML(L"<Config xmlns=\"http://www.microsoft.com/provisioning/EapHostConfig\"></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;
|
||||
}
|
||||
@@ -229,23 +214,24 @@ DWORD WINAPI EapPeerConfigBlob2Xml(
|
||||
|
||||
// Select <Config> node.
|
||||
com_obj<IXMLDOMNode> pXmlElConfig;
|
||||
pDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eaphostconfig=\"http://www.microsoft.com/provisioning/EapHostConfig\""));
|
||||
if ((dwResult = eapxml::select_node(pDoc, bstr(L"eaphostconfig:Config"), &pXmlElConfig)) != ERROR_SUCCESS) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_NOT_FOUND, _T(__FUNCTION__) _T(" Error selecting <Config> element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document.")));
|
||||
pConfigDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eaphostconfig=\"http://www.microsoft.com/provisioning/EapHostConfig\""));
|
||||
if (FAILED(eapxml::select_node(pConfigDoc, 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 all providers.
|
||||
pDoc->setProperty(bstr(L"SelectionNamespaces"), variant(L"xmlns:eap-metadata=\"urn:ietf:params:xml:ns:yang:ietf-eap-metadata\""));
|
||||
if (!cfg.save(pDoc, pXmlElConfig, ppEapError)) {
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
// Save configuration.
|
||||
pConfigDoc->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, pConfigDoc, pXmlElConfig);
|
||||
} catch (std::exception &err) {
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(err));
|
||||
return dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
} catch (...) {
|
||||
return dwResult = ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
*ppConfigDoc = pDoc.detach();
|
||||
*ppConfigDoc = pConfigDoc.detach();
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
@@ -294,16 +280,13 @@ DWORD WINAPI EapPeerInvokeConfigUI(
|
||||
else if (!ppConnectionDataOut)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppConnectionDataOut is NULL.")));
|
||||
else {
|
||||
_EAPMETHOD_PEER_UI::config_type cfg(g_peer);
|
||||
if (!g_peer.unpack(cfg, pConnectionDataIn, dwConnectionDataInSize, ppEapError) ||
|
||||
!g_peer.invoke_config_ui(hwndParent, cfg, ppEapError) ||
|
||||
!g_peer.pack(cfg, ppConnectionDataOut, pdwConnectionDataOutSize, ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
return dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
return dwResult = ERROR_INVALID_DATA;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,18 +342,13 @@ DWORD WINAPI EapPeerInvokeIdentityUI(
|
||||
else if (!ppwszIdentity)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppwszIdentity is NULL.")));
|
||||
else {
|
||||
_EAPMETHOD_PEER_UI::config_type cfg(g_peer);
|
||||
_EAPMETHOD_PEER_UI::identity_type usr(g_peer);
|
||||
if (!g_peer.unpack(cfg, pConnectionData, dwConnectionDataSize, ppEapError) ||
|
||||
!g_peer.unpack(usr, pUserData, dwUserDataSize, ppEapError) ||
|
||||
!g_peer.invoke_identity_ui(hwndParent, dwFlags, cfg, usr, ppwszIdentity, ppEapError) ||
|
||||
!g_peer.pack(usr, ppUserDataOut, pdwUserDataOutSize, ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
return dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
return dwResult = ERROR_INVALID_DATA;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -418,17 +396,13 @@ DWORD WINAPI EapPeerInvokeInteractiveUI(
|
||||
else if (!ppDataFromInteractiveUI)
|
||||
g_peer.log_error(*ppEapError = g_peer.make_error(dwResult = ERROR_INVALID_PARAMETER, _T(__FUNCTION__) _T(" ppDataFromInteractiveUI is NULL.")));
|
||||
else {
|
||||
_EAPMETHOD_PEER_UI::interactive_request_type req;
|
||||
_EAPMETHOD_PEER_UI::interactive_response_type res;
|
||||
if (!g_peer.unpack(req, pUIContextData, dwUIContextDataSize, ppEapError) ||
|
||||
!g_peer.invoke_interactive_ui(hwndParent, req, res, ppEapError) ||
|
||||
!g_peer.pack(res, ppDataFromInteractiveUI, pdwDataFromInteractiveUISize, ppEapError))
|
||||
{
|
||||
if (*ppEapError) {
|
||||
g_peer.log_error(*ppEapError);
|
||||
return dwResult = (*ppEapError)->dwWinError;
|
||||
} else
|
||||
return dwResult = ERROR_INVALID_DATA;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
78
EventMonitor/App.cpp
Normal file
78
EventMonitor/App.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
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
|
||||
|
||||
wxInitializeConfig();
|
||||
|
||||
if (!wxApp::OnInit())
|
||||
return false;
|
||||
|
||||
if (wxInitializeLocale(m_locale)) {
|
||||
//wxVERIFY(m_locale.AddCatalog(wxT("wxExtend") wxT(wxExtendVersion)));
|
||||
wxVERIFY(m_locale.AddCatalog(wxT("EventMonitor")));
|
||||
}
|
||||
|
||||
#ifdef __WXMSW__
|
||||
// Find EventMonitor window if already running.
|
||||
HWND hWnd = ::FindWindow(_T("wxWindowNR"), _("Event Monitor"));
|
||||
if (hWnd) {
|
||||
if (::IsIconic(hWnd))
|
||||
::SendMessage(hWnd, WM_SYSCOMMAND, SC_RESTORE, 0);
|
||||
::SetActiveWindow(hWnd);
|
||||
::SetForegroundWindow(hWnd);
|
||||
|
||||
// Not an error condition actually; Just nothing else to do...
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_mainWnd = new wxEventMonitorFrame(NULL);
|
||||
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);
|
1130
EventMonitor/ETWLog.cpp
Normal file
1130
EventMonitor/ETWLog.cpp
Normal file
File diff suppressed because it is too large
Load Diff
226
EventMonitor/ETWLog.h
Normal file
226
EventMonitor/ETWLog.h
Normal file
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
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>
|
||||
|
||||
///
|
||||
/// Maximum number of event records kept
|
||||
///
|
||||
#define wxETWEVENT_RECORDS_MAX 1000000
|
||||
|
||||
///
|
||||
/// 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 trace processor
|
||||
///
|
||||
class wxEventTraceProcessorThread;
|
||||
|
||||
///
|
||||
/// Event list control
|
||||
///
|
||||
class wxETWListCtrl;
|
||||
|
||||
///
|
||||
/// Supports saving/restoring wxETWListCtrl state
|
||||
///
|
||||
class wxPersistentETWListCtrl;
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/persist/window.h>
|
||||
#include <wx/thread.h>
|
||||
|
||||
#include <WinStd/ETW.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
|
||||
class wxETWEvent : public wxEvent
|
||||
{
|
||||
public:
|
||||
wxETWEvent(wxEventType type = wxEVT_NULL, const EVENT_RECORD &record = s_record_null);
|
||||
wxETWEvent(const wxETWEvent& event);
|
||||
virtual wxEvent *Clone() const { return new wxETWEvent(*this); }
|
||||
|
||||
inline const winstd::event_rec& GetRecord() const { return m_record; }
|
||||
inline winstd::event_rec& GetRecord() { return m_record; }
|
||||
|
||||
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:
|
||||
winstd::event_rec 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
|
||||
{
|
||||
protected:
|
||||
///
|
||||
/// Functor for GUID comparison
|
||||
///
|
||||
struct less_guid : public std::binary_function<GUID, GUID, bool>
|
||||
{
|
||||
bool operator()(const GUID &a, const GUID &b) const
|
||||
{
|
||||
if (a.Data1 < b.Data1) return true;
|
||||
if (a.Data1 > b.Data1) return false;
|
||||
if (a.Data2 < b.Data2) return true;
|
||||
if (a.Data2 > b.Data2) return false;
|
||||
if (a.Data3 < b.Data3) return true;
|
||||
if (a.Data3 > b.Data3) return false;
|
||||
if (memcmp(a.Data4, b.Data4, sizeof(a.Data4)) < 0) return true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
/// A set of GUIDs
|
||||
///
|
||||
typedef std::set<GUID, less_guid> guidset;
|
||||
|
||||
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_VIRTUAL|wxNO_BORDER,
|
||||
const wxValidator &validator = wxDefaultValidator,
|
||||
const wxString &name = wxListCtrlNameStr);
|
||||
virtual ~wxETWListCtrl();
|
||||
|
||||
inline bool IsEmpty() const { return m_rec_db.empty(); }
|
||||
void CopySelected() const;
|
||||
void CopyAll() const;
|
||||
void ClearAll();
|
||||
void SelectAll();
|
||||
void SelectNone();
|
||||
void RebuildItems();
|
||||
|
||||
inline bool IsSourceEnabled(const GUID &guid) const
|
||||
{
|
||||
return m_sources.find(guid) != m_sources.end();
|
||||
}
|
||||
|
||||
inline void EnableSource(const GUID &guid, bool enable = true)
|
||||
{
|
||||
guidset::iterator s = m_sources.find(guid);
|
||||
if (enable) {
|
||||
if (s == m_sources.end()) {
|
||||
m_sources.insert(guid);
|
||||
RebuildItems();
|
||||
}
|
||||
} else {
|
||||
if (s != m_sources.end()) {
|
||||
m_sources.erase(s);
|
||||
RebuildItems();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
friend class wxPersistentETWListCtrl; // Allow saving/restoring window state.
|
||||
|
||||
protected:
|
||||
bool IsVisible(const EVENT_RECORD &rec) const;
|
||||
void FormatRow(const winstd::event_rec &rec, std::string &rowA, std::wstring &rowW) const;
|
||||
bool CopyToClipboard(const std::string &dataA, const std::wstring &dataW) const;
|
||||
|
||||
virtual wxListItemAttr *OnGetItemAttr(long item) const;
|
||||
virtual wxString OnGetItemText(long item, long column) const;
|
||||
virtual wxString OnGetItemText(const winstd::event_rec &rec, long column) const;
|
||||
void OnETWEvent(wxETWEvent& event);
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
public:
|
||||
bool m_scroll_auto; ///< Is autoscrolling enabled?
|
||||
UCHAR m_level; ///< Shows messages up to this level of verboseness
|
||||
|
||||
static const GUID s_provider_eaphost; ///< EapHost event provider ID
|
||||
static const GUID s_provider_schannel; ///< Schannel event provider ID
|
||||
|
||||
protected:
|
||||
winstd::event_session m_session; ///< Event session
|
||||
wxEventTraceProcessorThread *m_proc; ///< Processor thread
|
||||
|
||||
guidset m_sources; ///< Set of enabled sources
|
||||
|
||||
wxListItemAttr m_item_attr[2][4]; ///< Current item attributes
|
||||
winstd::vector_queue<winstd::event_rec> m_rec_db; ///< Event record database
|
||||
winstd::vector_queue<size_t> m_rec_idx; ///< Event record database indices of shown records
|
||||
|
||||
size_t m_col_format_width[5]; ///< Column widths for pre-formatted row display (0 = unlimited)
|
||||
};
|
||||
|
||||
|
||||
class wxPersistentETWListCtrl : public wxPersistentWindow<wxETWListCtrl>
|
||||
{
|
||||
public:
|
||||
wxPersistentETWListCtrl(wxETWListCtrl *wnd);
|
||||
|
||||
virtual wxString GetKind() const;
|
||||
virtual void Save() const;
|
||||
virtual bool Restore();
|
||||
};
|
||||
|
||||
|
||||
inline wxPersistentObject *wxCreatePersistentObject(wxETWListCtrl *wnd)
|
||||
{
|
||||
return new wxPersistentETWListCtrl(wnd);
|
||||
}
|
@@ -7,11 +7,9 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\lib\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\lib\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\lib\WinStd\include;..\lib\wxExtend\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
Binary file not shown.
@@ -86,19 +86,25 @@
|
||||
<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>
|
||||
<None Include="README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<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">
|
||||
@@ -107,8 +113,20 @@
|
||||
<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>
|
||||
<ItemGroup>
|
||||
<POCompile Include="locale\sl_SI.po" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="..\include\xgettext.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
@@ -13,6 +13,10 @@
|
||||
<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">
|
||||
@@ -23,16 +27,56 @@
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" />
|
||||
<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="Main.cpp">
|
||||
<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>
|
||||
<ItemGroup>
|
||||
<POCompile Include="locale\sl_SI.po">
|
||||
<Filter>Resource Files\Localization</Filter>
|
||||
</POCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
439
EventMonitor/Frame.cpp
Normal file
439
EventMonitor/Frame.cpp
Normal file
@@ -0,0 +1,439 @@
|
||||
/*
|
||||
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
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
wxEventMonitorFrame::wxEventMonitorFrame(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);
|
||||
|
||||
// Load main window icons.
|
||||
#ifdef __WINDOWS__
|
||||
wxIconBundle icons;
|
||||
icons.AddIcon(wxIcon(wxT("00_EventMonitor.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)));
|
||||
icons.AddIcon(wxIcon(wxT("00_EventMonitor.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
|
||||
this->SetIcons(icons);
|
||||
#else
|
||||
this->SetIcon(wxIcon(wxICON(00_EventMonitor.ico)));
|
||||
#endif
|
||||
|
||||
wxString prod_name(wxT(PRODUCT_NAME_STR));
|
||||
wxString prod_status_bar;
|
||||
prod_status_bar.Printf(_("Toggles display of %s records"), wxT(PRODUCT_NAME_STR));
|
||||
|
||||
winstd::library lib_comres;
|
||||
lib_comres.load(_T("comres.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
|
||||
|
||||
winstd::library lib_ieframe;
|
||||
lib_ieframe.load(_T("ieframe.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
|
||||
|
||||
winstd::library lib_shell32;
|
||||
lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
|
||||
|
||||
wxSize size_menu(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
|
||||
wxSize size_tool(size_menu);
|
||||
|
||||
m_menubar = new wxMenuBar(0);
|
||||
m_menuProgram = new wxMenu();
|
||||
wxMenuItem* m_menuItemExit;
|
||||
m_menuItemExit = new wxMenuItem(m_menuProgram, wxID_EXIT, _("E&xit") + wxT('\t') + wxT("Alt+F4"), _("Quits this program"), wxITEM_NORMAL);
|
||||
m_menuItemExit->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(240), size_menu));
|
||||
m_menuProgram->Append(m_menuItemExit);
|
||||
|
||||
m_menubar->Append(m_menuProgram, _("&Program"));
|
||||
|
||||
m_menuEdit = new wxMenu();
|
||||
wxMenuItem* m_menuEditCopy;
|
||||
m_menuEditCopy = new wxMenuItem(m_menuEdit, wxID_COPY, wxEmptyString , wxEmptyString, wxITEM_NORMAL);
|
||||
m_menuEditCopy->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(243), size_menu));
|
||||
m_menuEdit->Append(m_menuEditCopy);
|
||||
|
||||
wxMenuItem* m_menuEditCopyAll;
|
||||
m_menuEditCopyAll = new wxMenuItem(m_menuEdit, wxID_COPY_ALL, _("Copy A&ll") + wxT('\t') + wxT("Ctrl+Shift+C"), _("Copies all records to clipboard (including hidden)"), wxITEM_NORMAL);
|
||||
m_menuEditCopyAll->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(133), size_menu));
|
||||
m_menuEdit->Append(m_menuEditCopyAll);
|
||||
|
||||
wxMenuItem* m_menuEditClear;
|
||||
m_menuEditClear = new wxMenuItem(m_menuEdit, wxID_CLEAR, _("Clear"), _("Clears all records from the log"), wxITEM_NORMAL);
|
||||
m_menuEditClear->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(200), size_menu));
|
||||
m_menuEdit->Append(m_menuEditClear);
|
||||
|
||||
m_menuEdit->AppendSeparator();
|
||||
|
||||
wxMenuItem* m_menuEditSelectAll;
|
||||
m_menuEditSelectAll = new wxMenuItem(m_menuEdit, wxID_SELECT_ALL, _("Select &All") + wxT('\t') + wxT("Ctrl+A"), _("Selects all visible records"), wxITEM_NORMAL);
|
||||
m_menuEdit->Append(m_menuEditSelectAll);
|
||||
|
||||
wxMenuItem* m_menuEditSelectNone;
|
||||
m_menuEditSelectNone = new wxMenuItem(m_menuEdit, wxID_SELECT_NONE, _("Select &None") , _("Clears record selection"), wxITEM_NORMAL);
|
||||
m_menuEdit->Append(m_menuEditSelectNone);
|
||||
|
||||
m_menubar->Append(m_menuEdit, _("&Edit"));
|
||||
|
||||
m_menuView = new wxMenu();
|
||||
wxMenuItem* m_menuViewScrollAuto;
|
||||
m_menuViewScrollAuto = new wxMenuItem(m_menuView, wxID_VIEW_SCROLL_AUTO, _("Auto &Scroll") + wxT('\t') + wxT("Ctrl+S"), _("Automatically scrolls to the most recent records as they come-in"), wxITEM_CHECK);
|
||||
//m_menuViewScrollAuto->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(231), size_menu));
|
||||
m_menuView->Append(m_menuViewScrollAuto);
|
||||
|
||||
m_menuView->AppendSeparator();
|
||||
|
||||
wxMenuItem* m_menuViewSourceEapHost;
|
||||
m_menuViewSourceEapHost = new wxMenuItem(m_menuView, wxID_VIEW_SOURCE_EAPHOST, wxT("EapHost"), wxString::Format(_("Toggles display of %s records"), wxT("EapHost")), wxITEM_CHECK);
|
||||
//m_menuViewSourceEapHost->SetBitmaps(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(273), size_menu));
|
||||
m_menuView->Append(m_menuViewSourceEapHost);
|
||||
|
||||
wxMenuItem* m_menuViewSourceSchannel;
|
||||
m_menuViewSourceSchannel = new wxMenuItem(m_menuView, wxID_VIEW_SOURCE_SCHANNEL, wxT("Schannel"), wxString::Format(_("Toggles display of %s records"), wxT("Schannel")), wxITEM_CHECK);
|
||||
//m_menuViewSourceSchannel->SetBitmaps(wxLoadIconFromResource(lib_ieframe, MAKEINTRESOURCE(36870), size_menu));
|
||||
m_menuView->Append(m_menuViewSourceSchannel);
|
||||
|
||||
m_menuViewSourceProduct = new wxMenuItem(m_menuView, wxID_VIEW_SOURCE_PRODUCT, prod_name , prod_status_bar, wxITEM_CHECK);
|
||||
//m_menuViewSourceProduct->SetBitmaps(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, size_menu.GetWidth(), size_menu.GetHeight()));
|
||||
m_menuView->Append(m_menuViewSourceProduct);
|
||||
|
||||
m_menuView->AppendSeparator();
|
||||
|
||||
m_menuViewLevelVerbose = new wxMenuItem(m_menuView, wxID_VIEW_LEVEL_VERBOSE, _("Verbose") + wxT('\t') + wxT("Ctrl+1"), _("Displays all levels of records"), wxITEM_RADIO);
|
||||
//m_menuViewLevelVerbose->SetBitmaps(wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2863), size_menu));
|
||||
m_menuView->Append(m_menuViewLevelVerbose);
|
||||
|
||||
m_menuViewLevelInformation = new wxMenuItem(m_menuView, wxID_VIEW_LEVEL_INFORMATION, _("Informational") + wxT('\t') + wxT("Ctrl+2"), _("Displays all records up to informational level"), wxITEM_RADIO);
|
||||
//m_menuViewLevelInformation->SetBitmaps(wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2859), size_menu));
|
||||
m_menuView->Append(m_menuViewLevelInformation);
|
||||
|
||||
m_menuViewLevelWarning = new wxMenuItem(m_menuView, wxID_VIEW_LEVEL_WARNING, _("Warning") + wxT('\t') + wxT("Ctrl+3"), _("Displays all records up to warning level"), wxITEM_RADIO);
|
||||
//m_menuViewLevelWarning->SetBitmaps(wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2865), size_menu));
|
||||
m_menuView->Append(m_menuViewLevelWarning);
|
||||
|
||||
m_menuViewLevelError = new wxMenuItem(m_menuView, wxID_VIEW_LEVEL_ERROR, _("Error") + wxT('\t') + wxT("Ctrl+4"), _("Displays error level records only"), wxITEM_RADIO);
|
||||
//m_menuViewLevelError->SetBitmaps(wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2861), size_menu));
|
||||
m_menuView->Append(m_menuViewLevelError);
|
||||
|
||||
m_menuView->AppendSeparator();
|
||||
|
||||
wxMenuItem* m_menuViewToolbarEdit;
|
||||
m_menuViewToolbarEdit = new wxMenuItem(m_menuView, wxID_VIEW_TOOLBAR_EDIT, wxString::Format(_("%s toolbar"), _("&Edit")), wxString::Format(_("Toggles display of %s toolbar"), _("View")), wxITEM_CHECK);
|
||||
m_menuView->Append(m_menuViewToolbarEdit);
|
||||
|
||||
wxMenuItem* m_menuViewToolbarView;
|
||||
m_menuViewToolbarView = new wxMenuItem(m_menuView, wxID_VIEW_TOOLBAR_VIEW, wxString::Format(_("%s toolbar"), _("&View")), wxString::Format(_("Toggles display of %s toolbar"), _("View")), wxITEM_CHECK);
|
||||
m_menuView->Append(m_menuViewToolbarView);
|
||||
|
||||
m_menubar->Append(m_menuView, _("&View"));
|
||||
|
||||
this->SetMenuBar(m_menubar);
|
||||
|
||||
m_toolbarEdit = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT);
|
||||
m_toolEditCopy = m_toolbarEdit->AddTool(wxID_COPY, _("Copy"), wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(243), size_tool), _("Copies selected records to clipboard") + wxT(" (") + wxT("Ctrl+C") + wxT(")"), wxITEM_NORMAL);
|
||||
|
||||
m_toolEditCopyAll = m_toolbarEdit->AddTool(wxID_COPY_ALL, _("Copy All"), wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(133), size_tool), _("Copies all records to clipboard (including hidden)") + wxT(" (") + wxT("Ctrl+Shift+C") + wxT(")"), wxITEM_NORMAL);
|
||||
|
||||
m_toolEditClear = m_toolbarEdit->AddTool(wxID_CLEAR, _("Clear"), wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(200), size_tool), _("Clears all records from the log"), wxITEM_NORMAL);
|
||||
|
||||
m_toolbarEdit->Realize();
|
||||
m_mgr.AddPane(m_toolbarEdit, wxAuiPaneInfo().Name(wxT("ToolbarEdit")).Top().Caption(_("Edit")).PinButton(true).Dock().Resizable().FloatingSize(wxDefaultSize).LeftDockable(false).RightDockable(false).Layer(1).ToolbarPane());
|
||||
|
||||
m_toolbarView = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT);
|
||||
m_toolViewScrollAuto = m_toolbarView->AddTool(wxID_VIEW_SCROLL_AUTO, _("Auto Scroll"), wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(231), size_tool), _("Automatically scrolls to the most recent records as they come-in") + wxT(" (") + wxT("Ctrl+S") + wxT(")"), wxITEM_CHECK);
|
||||
|
||||
m_toolbarView->AddSeparator();
|
||||
|
||||
m_toolViewSourceEapHost = m_toolbarView->AddTool(wxID_VIEW_SOURCE_EAPHOST, "EapHost", wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(273), size_tool), wxString::Format(_("Toggles display of %s records"), wxT("EapHost")), wxITEM_CHECK);
|
||||
|
||||
m_toolViewSourceSchannel = m_toolbarView->AddTool(wxID_VIEW_SOURCE_SCHANNEL, "Schannel", wxLoadIconFromResource(lib_ieframe, MAKEINTRESOURCE(36870), size_tool), wxString::Format(_("Toggles display of %s records"), wxT("Schannel")), wxITEM_CHECK);
|
||||
|
||||
m_toolViewSourceProduct = m_toolbarView->AddTool(wxID_VIEW_SOURCE_PRODUCT, prod_name, wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, size_tool.GetWidth(), size_tool.GetHeight()), prod_status_bar, wxITEM_CHECK);
|
||||
|
||||
m_toolbarView->AddSeparator();
|
||||
|
||||
m_toolViewLevelVerbose = m_toolbarView->AddTool(wxID_VIEW_LEVEL_VERBOSE, _("Verbose"), wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2863), size_tool), _("Displays all levels of records") + wxT(" (") + wxT("Ctrl+1") + wxT(")"), wxITEM_RADIO);
|
||||
|
||||
m_toolViewLevelInformation = m_toolbarView->AddTool(wxID_VIEW_LEVEL_INFORMATION, _("Informational"), wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2859), size_tool), _("Displays all records up to informational level") + wxT(" (") + wxT("Ctrl+2") + wxT(")"), wxITEM_RADIO);
|
||||
|
||||
m_toolViewLevelWarning = m_toolbarView->AddTool(wxID_VIEW_LEVEL_WARNING, _("Warning"), wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2865), size_tool), _("Displays all records up to warning level") + wxT(" (") + wxT("Ctrl+3") + wxT(")"), wxITEM_RADIO);
|
||||
|
||||
m_toolViewLevelError = m_toolbarView->AddTool(wxID_VIEW_LEVEL_ERROR, _("Error"), wxLoadIconFromResource(lib_comres, MAKEINTRESOURCE(2861), size_tool), _("Displays error level records only") + wxT(" (") + wxT("Ctrl+4") + wxT(")"), wxITEM_RADIO);
|
||||
|
||||
m_toolbarView->Realize();
|
||||
m_mgr.AddPane(m_toolbarView, wxAuiPaneInfo().Name(wxT("ToolbarView")).Top().Caption(_("View")).PinButton(true).Dock().Resizable().FloatingSize(wxDefaultSize).LeftDockable(false).RightDockable(false).Layer(1).ToolbarPane());
|
||||
|
||||
m_panel = new wxEventMonitorLogPanel(this);
|
||||
|
||||
m_mgr.AddPane(m_panel, wxAuiPaneInfo() .Name(wxT("LogPanel")).Center() .Caption(_("Trace Log")).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);
|
||||
|
||||
// Restore persistent state of wxAuiManager manually, since m_mgr is not on the heap.
|
||||
wxPersistentAuiManager(&m_mgr).Restore();
|
||||
|
||||
// Connect Events
|
||||
this->Connect(wxID_EXIT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnExit ));
|
||||
this->Connect(wxID_COPY , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditCopyUpdate ));
|
||||
this->Connect(wxID_COPY , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditCopy ));
|
||||
this->Connect(wxID_COPY_ALL , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditCopyAllUpdate ));
|
||||
this->Connect(wxID_COPY_ALL , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditCopyAll ));
|
||||
this->Connect(wxID_CLEAR , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditClearUpdate ));
|
||||
this->Connect(wxID_CLEAR , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditClear ));
|
||||
this->Connect(wxID_SELECT_ALL , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditSelectAllUpdate ));
|
||||
this->Connect(wxID_SELECT_ALL , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditSelectAll ));
|
||||
this->Connect(wxID_SELECT_NONE , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditSelectNoneUpdate));
|
||||
this->Connect(wxID_SELECT_NONE , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditSelectNone ));
|
||||
this->Connect(wxID_VIEW_SCROLL_AUTO , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewScrollUpdate ));
|
||||
this->Connect(wxID_VIEW_SCROLL_AUTO , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewScroll ));
|
||||
this->Connect(wxID_VIEW_SOURCE_EAPHOST , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ), new wxObjectWithData<GUID>(wxETWListCtrl::s_provider_eaphost ));
|
||||
this->Connect(wxID_VIEW_SOURCE_EAPHOST , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ), new wxObjectWithData<GUID>(wxETWListCtrl::s_provider_eaphost ));
|
||||
this->Connect(wxID_VIEW_SOURCE_SCHANNEL, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ), new wxObjectWithData<GUID>(wxETWListCtrl::s_provider_schannel));
|
||||
this->Connect(wxID_VIEW_SOURCE_SCHANNEL, wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ), new wxObjectWithData<GUID>(wxETWListCtrl::s_provider_schannel));
|
||||
this->Connect(wxID_VIEW_SOURCE_PRODUCT , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ), new wxObjectWithData<GUID>(EAPMETHOD_TRACE_EVENT_PROVIDER ));
|
||||
this->Connect(wxID_VIEW_SOURCE_PRODUCT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ), new wxObjectWithData<GUID>(EAPMETHOD_TRACE_EVENT_PROVIDER ));
|
||||
this->Connect(wxID_VIEW_LEVEL_VERBOSE , wxID_VIEW_LEVEL_ERROR, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewLevelUpdate ));
|
||||
this->Connect(wxID_VIEW_LEVEL_VERBOSE , wxID_VIEW_LEVEL_ERROR, wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewLevel ));
|
||||
this->Connect(wxID_VIEW_TOOLBAR_EDIT , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewToolbarUpdate ), new wxObjectWithData<wxAuiPaneInfo*>(&m_mgr.GetPane(m_toolbarEdit)));
|
||||
this->Connect(wxID_VIEW_TOOLBAR_EDIT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewToolbar ), new wxObjectWithData<wxAuiPaneInfo*>(&m_mgr.GetPane(m_toolbarEdit)));
|
||||
this->Connect(wxID_VIEW_TOOLBAR_VIEW , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewToolbarUpdate ), new wxObjectWithData<wxAuiPaneInfo*>(&m_mgr.GetPane(m_toolbarView)));
|
||||
this->Connect(wxID_VIEW_TOOLBAR_VIEW , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewToolbar ), new wxObjectWithData<wxAuiPaneInfo*>(&m_mgr.GetPane(m_toolbarView)));
|
||||
}
|
||||
|
||||
|
||||
wxEventMonitorFrame::~wxEventMonitorFrame()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect(wxID_EXIT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnExit ));
|
||||
this->Disconnect(wxID_COPY , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditCopyUpdate ));
|
||||
this->Disconnect(wxID_COPY , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditCopy ));
|
||||
this->Disconnect(wxID_COPY_ALL , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditCopyAllUpdate ));
|
||||
this->Disconnect(wxID_COPY_ALL , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditCopyAll ));
|
||||
this->Disconnect(wxID_CLEAR , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditClearUpdate ));
|
||||
this->Disconnect(wxID_CLEAR , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditClear ));
|
||||
this->Disconnect(wxID_SELECT_ALL , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditSelectAllUpdate ));
|
||||
this->Disconnect(wxID_SELECT_ALL , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditSelectAll ));
|
||||
this->Disconnect(wxID_SELECT_NONE , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnEditSelectNoneUpdate));
|
||||
this->Disconnect(wxID_SELECT_NONE , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnEditSelectNone ));
|
||||
this->Disconnect(wxID_VIEW_SCROLL_AUTO , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewScrollUpdate ));
|
||||
this->Disconnect(wxID_VIEW_SCROLL_AUTO , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewScroll ));
|
||||
this->Disconnect(wxID_VIEW_SOURCE_EAPHOST , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ));
|
||||
this->Disconnect(wxID_VIEW_SOURCE_EAPHOST , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ));
|
||||
this->Disconnect(wxID_VIEW_SOURCE_SCHANNEL, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ));
|
||||
this->Disconnect(wxID_VIEW_SOURCE_SCHANNEL, wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ));
|
||||
this->Disconnect(wxID_VIEW_SOURCE_PRODUCT , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewSourceUpdate ));
|
||||
this->Disconnect(wxID_VIEW_SOURCE_PRODUCT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewSource ));
|
||||
this->Disconnect(wxID_VIEW_LEVEL_VERBOSE , wxID_VIEW_LEVEL_ERROR, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewLevelUpdate ));
|
||||
this->Disconnect(wxID_VIEW_LEVEL_VERBOSE , wxID_VIEW_LEVEL_ERROR, wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewLevel ));
|
||||
this->Disconnect(wxID_VIEW_TOOLBAR_EDIT , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewToolbarUpdate ));
|
||||
this->Disconnect(wxID_VIEW_TOOLBAR_EDIT , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewToolbar ));
|
||||
this->Disconnect(wxID_VIEW_TOOLBAR_VIEW , wxEVT_UPDATE_UI, wxUpdateUIEventHandler(wxEventMonitorFrame::OnViewToolbarUpdate ));
|
||||
this->Disconnect(wxID_VIEW_TOOLBAR_VIEW , wxEVT_MENU , wxCommandEventHandler (wxEventMonitorFrame::OnViewToolbar ));
|
||||
|
||||
// Save wxAuiManager's state.
|
||||
wxPersistentAuiManager(&m_mgr).Save();
|
||||
|
||||
m_mgr.UnInit();
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnExit(wxCommandEvent& /*event*/)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditCopyUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(m_panel->m_log->GetSelectedItemCount() != 0);
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditCopy(wxCommandEvent& /*event*/)
|
||||
{
|
||||
m_panel->m_log->CopySelected();
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditCopyAllUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(!m_panel->m_log->IsEmpty());
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditCopyAll(wxCommandEvent& /*event*/)
|
||||
{
|
||||
m_panel->m_log->CopyAll();
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditClearUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(!m_panel->m_log->IsEmpty());
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditClear(wxCommandEvent& /*event*/)
|
||||
{
|
||||
m_panel->m_log->ClearAll();
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditSelectAllUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(m_panel->m_log->GetSelectedItemCount() != m_panel->m_log->GetItemCount());
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditSelectAll(wxCommandEvent& /*event*/)
|
||||
{
|
||||
m_panel->m_log->SelectAll();
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditSelectNoneUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Enable(m_panel->m_log->GetSelectedItemCount() != 0);
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnEditSelectNone(wxCommandEvent& /*event*/)
|
||||
{
|
||||
m_panel->m_log->SelectNone();
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnViewScrollUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
event.Check(m_panel->m_log->m_scroll_auto);
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnViewScroll(wxCommandEvent& event)
|
||||
{
|
||||
m_panel->m_log->m_scroll_auto = event.IsChecked();
|
||||
if (m_panel->m_log->m_scroll_auto) {
|
||||
// Scroll to the last record.
|
||||
long count = m_panel->m_log->GetItemCount();
|
||||
if (count)
|
||||
m_panel->m_log->EnsureVisible(count - 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnViewSourceUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
wxObjectWithData<GUID> *source = dynamic_cast<wxObjectWithData<GUID>*>(event.m_callbackUserData);
|
||||
if (source) {
|
||||
// Update GUI control according to event source state.
|
||||
event.Check(m_panel->m_log->IsSourceEnabled(source->m_data));
|
||||
event.Enable(true);
|
||||
} else
|
||||
event.Enable(false);
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnViewSource(wxCommandEvent& event)
|
||||
{
|
||||
wxObjectWithData<GUID> *source = dynamic_cast<wxObjectWithData<GUID>*>(event.m_callbackUserData);
|
||||
if (source) {
|
||||
// Enable event source.
|
||||
m_panel->m_log->EnableSource(source->m_data, event.IsChecked());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnViewLevelUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
// Update GUI control according to log level.
|
||||
event.Check(TRACE_LEVEL_ERROR + wxID_VIEW_LEVEL_ERROR - event.GetId() == m_panel->m_log->m_level);
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnViewLevel(wxCommandEvent& event)
|
||||
{
|
||||
UCHAR state_new = TRACE_LEVEL_ERROR + wxID_VIEW_LEVEL_ERROR - event.GetId();
|
||||
if (m_panel->m_log->m_level != state_new) {
|
||||
// Set new log level.
|
||||
m_panel->m_log->m_level = state_new;
|
||||
m_panel->m_log->RebuildItems();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnViewToolbarUpdate(wxUpdateUIEvent& event)
|
||||
{
|
||||
wxObjectWithData<wxAuiPaneInfo*> *source = dynamic_cast<wxObjectWithData<wxAuiPaneInfo*>*>(event.m_callbackUserData);
|
||||
if (source && source->m_data) {
|
||||
// Update GUI control according to toolbar/panel visibility.
|
||||
event.Check(source->m_data->IsShown());
|
||||
event.Enable(true);
|
||||
} else
|
||||
event.Enable(false);
|
||||
}
|
||||
|
||||
|
||||
void wxEventMonitorFrame::OnViewToolbar(wxCommandEvent& event)
|
||||
{
|
||||
wxObjectWithData<wxAuiPaneInfo*> *source = dynamic_cast<wxObjectWithData<wxAuiPaneInfo*>*>(event.m_callbackUserData);
|
||||
if (source && source->m_data) {
|
||||
// Toggle toolbar/panel visibility.
|
||||
source->m_data->Show(!source->m_data->IsShown());
|
||||
m_mgr.Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// 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;
|
||||
}
|
135
EventMonitor/Frame.h
Normal file
135
EventMonitor/Frame.h
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
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 "LogPanel.h"
|
||||
|
||||
#include "wxEventMonitor_UI.h"
|
||||
|
||||
#include <wx/frame.h>
|
||||
#include <wx/menu.h>
|
||||
#include <wx/statusbr.h>
|
||||
#include <wx/aui/auibar.h>
|
||||
#include <wx/aui/framemanager.h>
|
||||
#include <wx/persist/toplevel.h>
|
||||
|
||||
#include <WinStd/Win.h>
|
||||
|
||||
|
||||
class wxEventMonitorFrame : public wxFrame
|
||||
{
|
||||
protected:
|
||||
enum {
|
||||
wxID_COPY_ALL = 1000,
|
||||
wxID_SELECT_ALL,
|
||||
wxID_SELECT_NONE,
|
||||
wxID_VIEW_SCROLL_AUTO,
|
||||
wxID_VIEW_SOURCE_EAPHOST,
|
||||
wxID_VIEW_SOURCE_SCHANNEL,
|
||||
wxID_VIEW_SOURCE_PRODUCT,
|
||||
wxID_VIEW_LEVEL_VERBOSE,
|
||||
wxID_VIEW_LEVEL_INFORMATION,
|
||||
wxID_VIEW_LEVEL_WARNING,
|
||||
wxID_VIEW_LEVEL_ERROR,
|
||||
wxID_VIEW_TOOLBAR_EDIT,
|
||||
wxID_VIEW_TOOLBAR_VIEW,
|
||||
};
|
||||
|
||||
public:
|
||||
wxEventMonitorFrame(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"));
|
||||
~wxEventMonitorFrame();
|
||||
|
||||
friend class wxPersistentEventMonitorFrame;
|
||||
|
||||
protected:
|
||||
void OnExit(wxCommandEvent& event);
|
||||
void OnEditCopyUpdate(wxUpdateUIEvent& event);
|
||||
void OnEditCopy(wxCommandEvent& event);
|
||||
void OnEditCopyAllUpdate(wxUpdateUIEvent& event);
|
||||
void OnEditCopyAll(wxCommandEvent& event);
|
||||
void OnEditClearUpdate(wxUpdateUIEvent& event);
|
||||
void OnEditClear(wxCommandEvent& event);
|
||||
void OnEditSelectAllUpdate(wxUpdateUIEvent& event);
|
||||
void OnEditSelectAll(wxCommandEvent& event);
|
||||
void OnEditSelectNoneUpdate(wxUpdateUIEvent& event);
|
||||
void OnEditSelectNone(wxCommandEvent& event);
|
||||
void OnViewScrollUpdate(wxUpdateUIEvent& event);
|
||||
void OnViewScroll(wxCommandEvent& event);
|
||||
void OnViewSourceUpdate(wxUpdateUIEvent& event);
|
||||
void OnViewSource(wxCommandEvent& event);
|
||||
void OnViewLevelUpdate(wxUpdateUIEvent& event);
|
||||
void OnViewLevel(wxCommandEvent& event);
|
||||
void OnViewToolbarUpdate(wxUpdateUIEvent& event);
|
||||
void OnViewToolbar(wxCommandEvent& event);
|
||||
|
||||
protected:
|
||||
wxMenuBar* m_menubar;
|
||||
wxMenu* m_menuProgram;
|
||||
wxMenu* m_menuEdit;
|
||||
wxMenu* m_menuView;
|
||||
wxMenuItem* m_menuViewSourceProduct;
|
||||
wxMenuItem* m_menuViewLevelVerbose;
|
||||
wxMenuItem* m_menuViewLevelInformation;
|
||||
wxMenuItem* m_menuViewLevelWarning;
|
||||
wxMenuItem* m_menuViewLevelError;
|
||||
wxAuiToolBar* m_toolbarEdit;
|
||||
wxAuiToolBarItem* m_toolEditCopy;
|
||||
wxAuiToolBarItem* m_toolEditCopyAll;
|
||||
wxAuiToolBarItem* m_toolEditClear;
|
||||
wxAuiToolBar* m_toolbarView;
|
||||
wxAuiToolBarItem* m_toolViewScrollAuto;
|
||||
wxAuiToolBarItem* m_toolViewSourceEapHost;
|
||||
wxAuiToolBarItem* m_toolViewSourceSchannel;
|
||||
wxAuiToolBarItem* m_toolViewSourceProduct;
|
||||
wxAuiToolBarItem* m_toolViewLevelVerbose;
|
||||
wxAuiToolBarItem* m_toolViewLevelInformation;
|
||||
wxAuiToolBarItem* m_toolViewLevelWarning;
|
||||
wxAuiToolBarItem* m_toolViewLevelError;
|
||||
wxStatusBar* m_statusBar;
|
||||
wxEventMonitorLogPanel* m_panel;
|
||||
wxAuiManager m_mgr;
|
||||
};
|
||||
|
||||
|
||||
class wxPersistentEventMonitorFrame : public wxPersistentTLW
|
||||
{
|
||||
public:
|
||||
wxPersistentEventMonitorFrame(wxEventMonitorFrame *wnd);
|
||||
|
||||
virtual void Save() const;
|
||||
virtual bool Restore();
|
||||
};
|
||||
|
||||
|
||||
inline wxPersistentObject *wxCreatePersistentObject(wxEventMonitorFrame *wnd)
|
||||
{
|
||||
return new wxPersistentEventMonitorFrame(wnd);
|
||||
}
|
65
EventMonitor/LogPanel.cpp
Normal file
65
EventMonitor/LogPanel.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
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());
|
||||
|
||||
wxPersistentETWListCtrl(wnd->m_log).Save();
|
||||
}
|
||||
|
||||
|
||||
bool wxPersistentEventMonitorLogPanel::Restore()
|
||||
{
|
||||
wxEventMonitorLogPanel * const wnd = static_cast<wxEventMonitorLogPanel*>(GetWindow());
|
||||
|
||||
wxPersistentETWListCtrl(wnd->m_log).Restore();
|
||||
|
||||
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);
|
||||
}
|
Binary file not shown.
@@ -1,562 +0,0 @@
|
||||
/*
|
||||
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;
|
||||
|
||||
static vector<TRACEHANDLE> g_traces;
|
||||
|
||||
|
||||
static BOOL WINAPI ConsoleHandler(_In_ DWORD dwCtrlType)
|
||||
{
|
||||
switch(dwCtrlType) {
|
||||
case CTRL_C_EVENT:
|
||||
case CTRL_BREAK_EVENT:
|
||||
case CTRL_CLOSE_EVENT:
|
||||
case CTRL_LOGOFF_EVENT:
|
||||
case CTRL_SHUTDOWN_EVENT:
|
||||
for (vector<TRACEHANDLE>::const_iterator trace = g_traces.cbegin(), trace_end = g_traces.cend(); trace != trace_end; ++trace)
|
||||
CloseTrace(*trace);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
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 >= 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;
|
||||
|
||||
if (ulArraySize > 1)
|
||||
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.
|
||||
tstring out;
|
||||
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.empty()) out += _T(", ");
|
||||
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 (ulArraySize > 1)
|
||||
out += _T(')');
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
static VOID WINAPI EventRecordCallback(_In_ PEVENT_RECORD pEvent)
|
||||
{
|
||||
{
|
||||
// Calculate and print event time-stamp.
|
||||
FILETIME ft;
|
||||
ft.dwHighDateTime = pEvent->EventHeader.TimeStamp.HighPart;
|
||||
ft.dwLowDateTime = pEvent->EventHeader.TimeStamp.LowPart;
|
||||
|
||||
SYSTEMTIME st, st_local;
|
||||
FileTimeToSystemTime(&ft, &st);
|
||||
SystemTimeToTzSpecificLocalTime(NULL, &st, &st_local);
|
||||
|
||||
ULONGLONG
|
||||
ts = pEvent->EventHeader.TimeStamp.QuadPart,
|
||||
nanosec = (ts % 10000000) * 100;
|
||||
|
||||
_ftprintf(stdout, _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);
|
||||
}
|
||||
|
||||
{
|
||||
// Get event meta-info.
|
||||
unique_ptr<TRACE_EVENT_INFO> info;
|
||||
ULONG ulResult;
|
||||
if ((ulResult = TdhGetEventInformation(pEvent, 0, NULL, info)) == ERROR_SUCCESS) {
|
||||
if (info->DecodingSource != DecodingSourceWPP) {
|
||||
if (pEvent->EventHeader.Flags & EVENT_HEADER_FLAG_STRING_ONLY) {
|
||||
// This is a string-only event. Print it.
|
||||
_ftprintf(stdout, _T(" %ls"), pEvent->UserData);
|
||||
} else {
|
||||
// This is not a string-only event. Prepare parameters.
|
||||
|
||||
BYTE nPtrSize = (pEvent->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(pEvent, info.get(), i, NULL, 0, nPtrSize)));
|
||||
props_msg.push_back((DWORD_PTR)props[i].c_str());
|
||||
}
|
||||
|
||||
if (info->EventMessageOffset) {
|
||||
// Format the message.
|
||||
_ftprintf(stdout, _T(" %ls"), wstring_msg(0, (LPCTSTR)((LPCBYTE)info.get() + info->EventMessageOffset), props_msg.data()).c_str());
|
||||
}
|
||||
}
|
||||
} else if (info->EventMessageOffset) {
|
||||
// This is a WPP event.
|
||||
_ftprintf(stdout, _T(" %ls"), (LPCBYTE)info.get() + info->EventMessageOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_ftprintf(stdout, _T("\n"));
|
||||
}
|
||||
|
||||
|
||||
#ifdef _UNICODE
|
||||
int wmain(int argc, const wchar_t *argv[])
|
||||
#else
|
||||
int main(int argc, const char *argv[])
|
||||
#endif
|
||||
{
|
||||
UNREFERENCED_PARAMETER(argc);
|
||||
UNREFERENCED_PARAMETER(argv);
|
||||
|
||||
setlocale(LC_ALL, ".OCP");
|
||||
|
||||
// Initialize COM.
|
||||
com_initializer com_init(NULL);
|
||||
|
||||
// Start a new session.
|
||||
ULONG ulResult;
|
||||
event_session session;
|
||||
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]);
|
||||
if (!properties) {
|
||||
_ftprintf(stderr, _T("Error allocating session properties memory.\n"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// 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 = session.create(name.c_str(), properties.get())) == ERROR_SUCCESS) {
|
||||
break;
|
||||
} else if (ulResult == ERROR_ACCESS_DENIED) {
|
||||
_ftprintf(stderr, _T("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.\n"), ulResult);
|
||||
return 1;
|
||||
} else if (ulResult == ERROR_ALREADY_EXISTS) {
|
||||
_ftprintf(stderr, _T("The %s event session already exists.\n"), name.c_str());
|
||||
// Do not despair... Retry with a new session name and ID.
|
||||
continue;
|
||||
} else {
|
||||
_ftprintf(stderr, _T("Error creating event session (error %u).\n"), ulResult);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Enable event provider we are interested in to log events to our session.
|
||||
event_trace_enabler trace_enabler_event(session, &EAPMETHOD_TRACE_EVENT_PROVIDER, TRACE_LEVEL_VERBOSE);
|
||||
if ((ulResult = trace_enabler_event.status()) != ERROR_SUCCESS) {
|
||||
_ftprintf(stderr, _T("Error enabling event provider (error %u).\n"), ulResult);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// {6EB8DB94-FE96-443F-A366-5FE0CEE7FB1C}
|
||||
static const GUID s_provider_eaphost = { 0X6EB8DB94, 0XFE96, 0X443F, { 0XA3, 0X66, 0X5F, 0XE0, 0XCE, 0XE7, 0XFB, 0X1C } };
|
||||
event_trace_enabler trace_enabler_eaphost(session, &s_provider_eaphost, TRACE_LEVEL_INFORMATION);
|
||||
if ((ulResult = trace_enabler_eaphost.status()) != ERROR_SUCCESS) {
|
||||
// If the EAPHost trace provider failed to enable, do not despair.
|
||||
_ftprintf(stderr, _T("Error enabling EAPHost event provider (error %u).\n"), ulResult);
|
||||
}
|
||||
|
||||
// Open trace.
|
||||
EVENT_TRACE_LOGFILE tlf = {};
|
||||
tlf.LoggerName = (LPTSTR)session.name();
|
||||
tlf.ProcessTraceMode = PROCESS_TRACE_MODE_REAL_TIME | PROCESS_TRACE_MODE_EVENT_RECORD;
|
||||
tlf.EventRecordCallback = EventRecordCallback;
|
||||
event_trace trace;
|
||||
if (!trace.create(&tlf)) {
|
||||
_ftprintf(stderr, _T("Error opening event trace (error %u).\n"), GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Process events.
|
||||
g_traces.push_back(trace.detach());
|
||||
SetConsoleCtrlHandler(ConsoleHandler, TRUE);
|
||||
ProcessTrace(g_traces.data(), (ULONG)g_traces.size(), NULL, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,9 +0,0 @@
|
||||
#EventMonitor
|
||||
Output real-time G<>ANTLink events to console
|
||||
|
||||
##Usage
|
||||
```
|
||||
EventMonitor
|
||||
```
|
||||
|
||||
Press Ctrl+C to stop the program.
|
@@ -20,18 +20,34 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "App.h"
|
||||
#include "ETWLog.h"
|
||||
#include "Frame.h"
|
||||
#include "LogPanel.h"
|
||||
|
||||
#include "../lib/EAPBase_UI/include/EAP_UI.h"
|
||||
|
||||
#include "../include/Version.h"
|
||||
|
||||
#include <wxex/common.h>
|
||||
#include <wxex/object.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 <utility>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include <EventsETW.h> // Must include after <Windows.h>
|
||||
|
1
EventMonitor/locale/.gitignore
vendored
Normal file
1
EventMonitor/locale/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/*.mo
|
219
EventMonitor/locale/EventMonitor.pot
Normal file
219
EventMonitor/locale/EventMonitor.pot
Normal file
@@ -0,0 +1,219 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: EventMonitor\n"
|
||||
"POT-Creation-Date: 2016-08-31 02: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: ..\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:61 Frame.h:67 MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "Event Monitor"
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:83
|
||||
#, c-format
|
||||
msgid "Error opening event trace (error %u)."
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:167
|
||||
msgid "Time"
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:168
|
||||
msgid "PID"
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:169
|
||||
msgid "TID"
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:170
|
||||
msgid "Source"
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:171
|
||||
msgid "Event"
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:228
|
||||
msgid "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."
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:231
|
||||
#, c-format
|
||||
msgid "The %s event session already exists."
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:235
|
||||
#, c-format
|
||||
msgid "Error creating event session (error %u)."
|
||||
msgstr ""
|
||||
|
||||
#: ETWLog.cpp:251 ETWLog.cpp:267 ETWLog.cpp:281
|
||||
#, c-format
|
||||
msgid "Error enabling %s event provider (error %u)."
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:48 Frame.cpp:108 Frame.cpp:113 Frame.cpp:168 Frame.cpp:170
|
||||
#, c-format
|
||||
msgid "Toggles display of %s records"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:65
|
||||
msgid "E&xit"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:65
|
||||
msgid "Quits this program"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:69
|
||||
msgid "&Program"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:78
|
||||
msgid "Copy A&ll"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:78 Frame.cpp:156
|
||||
msgid "Copies all records to clipboard (including hidden)"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:83 Frame.cpp:158
|
||||
msgid "Clear"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:83 Frame.cpp:158
|
||||
msgid "Clears all records from the log"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:90
|
||||
msgid "Select &All"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:90
|
||||
msgid "Selects all visible records"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:94
|
||||
msgid "Select &None"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:94
|
||||
msgid "Clears record selection"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:97 Frame.cpp:142
|
||||
msgid "&Edit"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:101
|
||||
msgid "Auto &Scroll"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:101 Frame.cpp:164
|
||||
msgid "Automatically scrolls to the most recent records as they come-in"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:123 Frame.cpp:176
|
||||
msgid "Verbose"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:123 Frame.cpp:176
|
||||
msgid "Displays all levels of records"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:127 Frame.cpp:178
|
||||
msgid "Informational"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:127 Frame.cpp:178
|
||||
msgid "Displays all records up to informational level"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:131 Frame.cpp:180
|
||||
msgid "Warning"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:131 Frame.cpp:180
|
||||
msgid "Displays all records up to warning level"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:135 Frame.cpp:182
|
||||
msgid "Error"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:135 Frame.cpp:182
|
||||
msgid "Displays error level records only"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:142 Frame.cpp:146
|
||||
#, c-format
|
||||
msgid "%s toolbar"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:142 Frame.cpp:146
|
||||
#, c-format
|
||||
msgid "Toggles display of %s toolbar"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:142 Frame.cpp:146 Frame.cpp:185
|
||||
msgid "View"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:146 Frame.cpp:149
|
||||
msgid "&View"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:154
|
||||
msgid "Copy"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:154
|
||||
msgid "Copies selected records to clipboard"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:156
|
||||
msgid "Copy All"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:161
|
||||
msgid "Edit"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:164
|
||||
msgid "Auto Scroll"
|
||||
msgstr ""
|
||||
|
||||
#: Frame.cpp:189
|
||||
msgid "Trace Log"
|
||||
msgstr ""
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:3
|
||||
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:3
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:3
|
||||
#: MSIBuild/En.x64.Release.Shortcut-2.idtx:3
|
||||
msgid "1252"
|
||||
msgstr ""
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Shortcut-2.idtx:4
|
||||
msgid "EVENTM~1|GÉANTLink Event Monitor"
|
||||
msgstr ""
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "Real-time display of internal events"
|
||||
msgstr ""
|
226
EventMonitor/locale/sl_SI.po
Normal file
226
EventMonitor/locale/sl_SI.po
Normal file
@@ -0,0 +1,226 @@
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: EventMonitor\n"
|
||||
"POT-Creation-Date: 2016-08-31 02:51+0200\n"
|
||||
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
|
||||
"Last-Translator: Simon Rozman <simon@rozman.si>, 2016\n"
|
||||
"Language-Team: Slovenian (Slovenia) (https://www.transifex.com/eduroam_devel/teams/11799/sl_SI/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: sl_SI\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
"X-Generator: Poedit 1.8.8\n"
|
||||
"X-Poedit-Basepath: ..\n"
|
||||
"X-Poedit-KeywordsList: _\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
#: App.cpp:61 Frame.h:67 MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "Event Monitor"
|
||||
msgstr "Nadzornik dogodkov"
|
||||
|
||||
#: ETWLog.cpp:83
|
||||
#, c-format
|
||||
msgid "Error opening event trace (error %u)."
|
||||
msgstr "Napaka pri odpiranju sledenja dogodkom (napaka %u)."
|
||||
|
||||
#: ETWLog.cpp:167
|
||||
msgid "Time"
|
||||
msgstr "Čas"
|
||||
|
||||
#: ETWLog.cpp:168
|
||||
msgid "PID"
|
||||
msgstr "PID"
|
||||
|
||||
#: ETWLog.cpp:169
|
||||
msgid "TID"
|
||||
msgstr "TID"
|
||||
|
||||
#: ETWLog.cpp:170
|
||||
msgid "Source"
|
||||
msgstr "Vir"
|
||||
|
||||
#: ETWLog.cpp:171
|
||||
msgid "Event"
|
||||
msgstr "Dogodek"
|
||||
|
||||
#: ETWLog.cpp:228
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
"Dostop pri ustvarjanju seje dogodkov zavrnjen: potrebujete skrbniške pravice"
|
||||
" (Zaženi kot skrbnik) ali biti član skupine »Performance Log Users« za zagon"
|
||||
" seje sledenja dogodkov."
|
||||
|
||||
#: ETWLog.cpp:231
|
||||
#, c-format
|
||||
msgid "The %s event session already exists."
|
||||
msgstr "Seja dogodkov %s že obstaja."
|
||||
|
||||
#: ETWLog.cpp:235
|
||||
#, c-format
|
||||
msgid "Error creating event session (error %u)."
|
||||
msgstr "Napaka pri ustvarjanju seje dogodkov (napaka %u)."
|
||||
|
||||
#: ETWLog.cpp:251 ETWLog.cpp:267 ETWLog.cpp:281
|
||||
#, c-format
|
||||
msgid "Error enabling %s event provider (error %u)."
|
||||
msgstr "Napaka pri omogočanju ponudnika dogodkov %s (napaka %u)."
|
||||
|
||||
#: Frame.cpp:48 Frame.cpp:108 Frame.cpp:113 Frame.cpp:168 Frame.cpp:170
|
||||
#, c-format
|
||||
msgid "Toggles display of %s records"
|
||||
msgstr "Obrne prikaz zapisov %s"
|
||||
|
||||
#: Frame.cpp:65
|
||||
msgid "E&xit"
|
||||
msgstr "I&zhod"
|
||||
|
||||
#: Frame.cpp:65
|
||||
msgid "Quits this program"
|
||||
msgstr "Konča ta program"
|
||||
|
||||
#: Frame.cpp:69
|
||||
msgid "&Program"
|
||||
msgstr "&Program"
|
||||
|
||||
#: Frame.cpp:78
|
||||
msgid "Copy A&ll"
|
||||
msgstr "Kopiraj &vse"
|
||||
|
||||
#: Frame.cpp:78 Frame.cpp:156
|
||||
msgid "Copies all records to clipboard (including hidden)"
|
||||
msgstr "Kopira vse zapise na odložišče (tudi skrite)"
|
||||
|
||||
#: Frame.cpp:83 Frame.cpp:158
|
||||
msgid "Clear"
|
||||
msgstr "Počisti"
|
||||
|
||||
#: Frame.cpp:83 Frame.cpp:158
|
||||
msgid "Clears all records from the log"
|
||||
msgstr "Počisti vse zapise iz dnevnika"
|
||||
|
||||
#: Frame.cpp:90
|
||||
msgid "Select &All"
|
||||
msgstr "Izberi &vse"
|
||||
|
||||
#: Frame.cpp:90
|
||||
msgid "Selects all visible records"
|
||||
msgstr "Izbere vse vidne zapise"
|
||||
|
||||
#: Frame.cpp:94
|
||||
msgid "Select &None"
|
||||
msgstr "Izberi &nič"
|
||||
|
||||
#: Frame.cpp:94
|
||||
msgid "Clears record selection"
|
||||
msgstr "Počisti izbor zapisov"
|
||||
|
||||
#: Frame.cpp:97 Frame.cpp:142
|
||||
msgid "&Edit"
|
||||
msgstr "Ur&edi"
|
||||
|
||||
#: Frame.cpp:101
|
||||
msgid "Auto &Scroll"
|
||||
msgstr "&Samodrsenje"
|
||||
|
||||
#: Frame.cpp:101 Frame.cpp:164
|
||||
msgid "Automatically scrolls to the most recent records as they come-in"
|
||||
msgstr "Samodejno pomikaj do najbolj zadnjega zapisa, ko prihajajo"
|
||||
|
||||
#: Frame.cpp:123 Frame.cpp:176
|
||||
msgid "Verbose"
|
||||
msgstr "Podrobno"
|
||||
|
||||
#: Frame.cpp:123 Frame.cpp:176
|
||||
msgid "Displays all levels of records"
|
||||
msgstr "Prikaže vse ravni zapisov"
|
||||
|
||||
#: Frame.cpp:127 Frame.cpp:178
|
||||
msgid "Informational"
|
||||
msgstr "Informativno"
|
||||
|
||||
#: Frame.cpp:127 Frame.cpp:178
|
||||
msgid "Displays all records up to informational level"
|
||||
msgstr "Prikaže vse zapise do informativne ravni"
|
||||
|
||||
#: Frame.cpp:131 Frame.cpp:180
|
||||
msgid "Warning"
|
||||
msgstr "Opozorilo"
|
||||
|
||||
#: Frame.cpp:131 Frame.cpp:180
|
||||
msgid "Displays all records up to warning level"
|
||||
msgstr "Prikaže vse zapise do opozorilne ravni"
|
||||
|
||||
#: Frame.cpp:135 Frame.cpp:182
|
||||
msgid "Error"
|
||||
msgstr "Napaka"
|
||||
|
||||
#: Frame.cpp:135 Frame.cpp:182
|
||||
msgid "Displays error level records only"
|
||||
msgstr "Prikaže samo zapise ravni napak"
|
||||
|
||||
#: Frame.cpp:142 Frame.cpp:146
|
||||
#, c-format
|
||||
msgid "%s toolbar"
|
||||
msgstr "Orodna vrstica %s"
|
||||
|
||||
#: Frame.cpp:142 Frame.cpp:146
|
||||
#, c-format
|
||||
msgid "Toggles display of %s toolbar"
|
||||
msgstr "Obrne prikaz orodne vrstice %s"
|
||||
|
||||
#: Frame.cpp:142 Frame.cpp:146 Frame.cpp:185
|
||||
msgid "View"
|
||||
msgstr "Pogled"
|
||||
|
||||
#: Frame.cpp:146 Frame.cpp:149
|
||||
msgid "&View"
|
||||
msgstr "Po&gled"
|
||||
|
||||
#: Frame.cpp:154
|
||||
msgid "Copy"
|
||||
msgstr "Kopiraj"
|
||||
|
||||
#: Frame.cpp:154
|
||||
msgid "Copies selected records to clipboard"
|
||||
msgstr "Kopira izbrane zapise na odložišče"
|
||||
|
||||
#: Frame.cpp:156
|
||||
msgid "Copy All"
|
||||
msgstr "Kopiraj vse"
|
||||
|
||||
#: Frame.cpp:161
|
||||
msgid "Edit"
|
||||
msgstr "Uredi"
|
||||
|
||||
#: Frame.cpp:164
|
||||
msgid "Auto Scroll"
|
||||
msgstr "Samodrsenje"
|
||||
|
||||
#: Frame.cpp:189
|
||||
msgid "Trace Log"
|
||||
msgstr "Dnevnik sledenja"
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:3
|
||||
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:3
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:3
|
||||
#: MSIBuild/En.x64.Release.Shortcut-2.idtx:3
|
||||
msgid "1252"
|
||||
msgstr "1250"
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Shortcut-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Shortcut-2.idtx:4
|
||||
msgid "EVENTM~1|GÉANTLink Event Monitor"
|
||||
msgstr "EVENTM~1|Nadzornik dogodkov GÉANTLink"
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "Real-time display of internal events"
|
||||
msgstr "Prikazovalnik notranjih dogodkov v realnem času"
|
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
32
EventMonitor/wxEventMonitor_UI.cpp
Normal file
32
EventMonitor/wxEventMonitor_UI.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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_VIRTUAL|wxNO_BORDER, wxDefaultValidator, wxT("EventMonitorLog") );
|
||||
bSizerMain->Add( m_log, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
}
|
||||
|
||||
wxEventMonitorLogPanelBase::~wxEventMonitorLogPanelBase()
|
||||
{
|
||||
}
|
194
EventMonitor/wxEventMonitor_UI.fbp
Normal file
194
EventMonitor/wxEventMonitor_UI.fbp
Normal file
@@ -0,0 +1,194 @@
|
||||
<?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="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">public</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_VIRTUAL</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">EventMonitorLog</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>
|
44
EventMonitor/wxEventMonitor_UI.h
Normal file
44
EventMonitor/wxEventMonitor_UI.h
Normal file
@@ -0,0 +1,44 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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/listctrl.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEventMonitorLogPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEventMonitorLogPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
wxETWListCtrl* m_log;
|
||||
|
||||
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.
36
MSI/Base/locale/GEANTLink.pot
Normal file
36
MSI/Base/locale/GEANTLink.pot
Normal file
@@ -0,0 +1,36 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: GÉANTLink MSI\n"
|
||||
"POT-Creation-Date: 2016-08-31 14:33+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.LaunchCondition-2.idtx:4
|
||||
#: En.x64.Release.LaunchCondition-2.idtx:4
|
||||
msgid "[ProductName] requires Windows Vista or later version of Windows."
|
||||
msgstr ""
|
||||
|
||||
#: En.Win32.Release.Property-2.idtx:3 En.x64.Release.Property-2.idtx:3
|
||||
msgid "1252"
|
||||
msgstr ""
|
||||
|
||||
#: En.Win32.Release.Property-2.idtx:4 En.Win32.Release.Property-2.idtx:5
|
||||
#: En.x64.Release.Property-2.idtx:4 En.x64.Release.Property-2.idtx:5
|
||||
msgid "http://www.geant.org/"
|
||||
msgstr ""
|
||||
|
||||
#: En.Win32.Release.Property-2.idtx:6 En.x64.Release.Property-2.idtx:6
|
||||
msgid "https://github.com/Amebis/GEANTLink/releases"
|
||||
msgstr ""
|
Submodule MSI/MSIBuild updated: 16655a6871...43f8632406
Binary file not shown.
@@ -42,6 +42,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MsiUseFeature", "MsiUseFeat
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EventMonitor", "EventMonitor\EventMonitor.vcxproj", "{E0D0725B-B2FC-4225-9481-CA9B1B6306F2}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxExtend", "lib\wxExtend\build\wxExtendLib.vcxproj", "{D3E29951-D9F5-486D-A167-20AE8E90B1FA}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WLANManager", "WLANManager\WLANManager.vcxproj", "{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSCHAPv2", "lib\MSCHAPv2\build\MSCHAPv2.vcxproj", "{86A6D6A0-4B7D-4134-BE81-A5755C77584D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MSCHAPv2_UI", "lib\MSCHAPv2_UI\build\MSCHAPv2_UI.vcxproj", "{7AF5B922-7C17-428A-97E0-09E3B41A684D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@@ -170,6 +178,38 @@ Global
|
||||
{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
|
||||
{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}.Debug|x64.Build.0 = Debug|x64
|
||||
{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}.Release|Win32.Build.0 = Release|Win32
|
||||
{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}.Release|x64.ActiveCfg = Release|x64
|
||||
{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}.Release|x64.Build.0 = Release|x64
|
||||
{86A6D6A0-4B7D-4134-BE81-A5755C77584D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{86A6D6A0-4B7D-4134-BE81-A5755C77584D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{86A6D6A0-4B7D-4134-BE81-A5755C77584D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{86A6D6A0-4B7D-4134-BE81-A5755C77584D}.Debug|x64.Build.0 = Debug|x64
|
||||
{86A6D6A0-4B7D-4134-BE81-A5755C77584D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{86A6D6A0-4B7D-4134-BE81-A5755C77584D}.Release|Win32.Build.0 = Release|Win32
|
||||
{86A6D6A0-4B7D-4134-BE81-A5755C77584D}.Release|x64.ActiveCfg = Release|x64
|
||||
{86A6D6A0-4B7D-4134-BE81-A5755C77584D}.Release|x64.Build.0 = Release|x64
|
||||
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Debug|x64.Build.0 = Debug|x64
|
||||
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Release|Win32.Build.0 = Release|Win32
|
||||
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Release|x64.ActiveCfg = Release|x64
|
||||
{7AF5B922-7C17-428A-97E0-09E3B41A684D}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -187,8 +227,12 @@ Global
|
||||
{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}
|
||||
{86A6D6A0-4B7D-4134-BE81-A5755C77584D} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||
{7AF5B922-7C17-428A-97E0-09E3B41A684D} = {E66A3FE1-4EE4-401F-8EAD-BE518B230393}
|
||||
{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}
|
||||
{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC} = {7B5EC9B7-208C-426A-941D-DAF9271BD4A4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
2
WLANManager/.gitignore
vendored
Normal file
2
WLANManager/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/temp
|
||||
/*.user
|
9
WLANManager/MSIBuild/.gitignore
vendored
Normal file
9
WLANManager/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
WLANManager/MSIBuild/Makefile
Normal file
BIN
WLANManager/MSIBuild/Makefile
Normal file
Binary file not shown.
136
WLANManager/Main.cpp
Normal file
136
WLANManager/Main.cpp
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 "StdAfx.h"
|
||||
|
||||
#pragma comment(lib, "Wlanapi.lib")
|
||||
#pragma comment(lib, "Wlanui.lib")
|
||||
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
DWORD (WINAPI *pfnWlanReasonCodeToString)(__in DWORD dwReasonCode, __in DWORD dwBufferSize, __in_ecount(dwBufferSize) PWCHAR pStringBuffer, __reserved PVOID pReserved);
|
||||
|
||||
|
||||
static int DisplayError(_In_z_ _Printf_format_string_ LPCTSTR format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
tstring msg;
|
||||
vsprintf(msg, format, arg);
|
||||
va_end(arg);
|
||||
|
||||
return MessageBox(NULL, msg.c_str(), _T("WLANManager"), MB_OK);
|
||||
}
|
||||
|
||||
|
||||
static int WLANManager()
|
||||
{
|
||||
int nArgs;
|
||||
unique_ptr<LPWSTR[], LocalFree_delete<LPWSTR[]> > pwcArglist(CommandLineToArgvW(GetCommandLineW(), &nArgs));
|
||||
if (pwcArglist == NULL) {
|
||||
DisplayError(_T("%s function failed (error %u)."), _T("CommandLineToArgvW"), GetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (nArgs < 3) {
|
||||
DisplayError(_T("Not enough parameters."));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (_wcsicmp(pwcArglist[1], L"profile") != 0) {
|
||||
DisplayError(_T("Unknown command (%ls)."), pwcArglist[1]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Open WLAN handle.
|
||||
DWORD dwNegotiatedVersion;
|
||||
wlan_handle wlan;
|
||||
if (!wlan.open(WLAN_API_MAKE_VERSION(2, 0), &dwNegotiatedVersion)) {
|
||||
DisplayError(_T("%s function failed (error %u)."), _T("WlanOpenHandle"), GetLastError());
|
||||
return 2;
|
||||
} else if (dwNegotiatedVersion < WLAN_API_MAKE_VERSION(2, 0)) {
|
||||
DisplayError(_T("WlanOpenHandle negotiated unsupported version (expected: %u, negotiated: %u)."), WLAN_API_MAKE_VERSION(2, 0), dwNegotiatedVersion);
|
||||
return 3;
|
||||
}
|
||||
|
||||
unique_ptr<WLAN_INTERFACE_INFO_LIST, WlanFreeMemory_delete<WLAN_INTERFACE_INFO_LIST> > interfaces;
|
||||
{
|
||||
// Get a list of WLAN interfaces.
|
||||
WLAN_INTERFACE_INFO_LIST *pInterfaceList;
|
||||
DWORD dwResult = WlanEnumInterfaces(wlan, NULL, &pInterfaceList);
|
||||
if (dwResult != ERROR_SUCCESS) {
|
||||
DisplayError(_T("%s function failed (error %u)."), _T("WlanEnumInterfaces"), dwResult);
|
||||
return 4;
|
||||
}
|
||||
interfaces.reset(pInterfaceList);
|
||||
}
|
||||
|
||||
for (DWORD i = 0; i < interfaces->dwNumberOfItems; i++) {
|
||||
if (interfaces->InterfaceInfo[i].isState == wlan_interface_state_not_ready) {
|
||||
// This interface is not ready.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Launch WLAN profile config dialog.
|
||||
// Note: When a debugger is attached to this process the WlanUIEditProfile() will raise an exception and fail.
|
||||
WLAN_REASON_CODE wlrc;
|
||||
DWORD dwResult = WlanUIEditProfile(WLAN_UI_API_VERSION, pwcArglist[2], &(interfaces->InterfaceInfo[i].InterfaceGuid), NULL, WLSecurityPage, NULL, &wlrc);
|
||||
if (dwResult != ERROR_SUCCESS) {
|
||||
DisplayError(_T("%s function failed (error %u)."), _T("WlanUIEditProfile"), dwResult);
|
||||
return 5;
|
||||
}
|
||||
if (wlrc != WLAN_REASON_CODE_SUCCESS) {
|
||||
tstring reason;
|
||||
if (WlanReasonCodeToString(wlrc, reason, NULL) == ERROR_SUCCESS)
|
||||
DisplayError(_T("%s function failed: %s"), _T("WlanUIEditProfile"), reason.c_str());
|
||||
else
|
||||
DisplayError(_T("%s function failed (reason code: %u)."), _T("WlanUIEditProfile"), wlrc);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
{
|
||||
// Initialize Windows XP visual styles
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||
icc.dwICC = ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES | ICC_LINK_CLASS;
|
||||
InitCommonControlsEx(&icc);
|
||||
}
|
||||
|
||||
pfnWlanReasonCodeToString = WlanReasonCodeToString;
|
||||
|
||||
int res = WLANManager();
|
||||
|
||||
assert(!_CrtDumpMemoryLeaks());
|
||||
return res;
|
||||
}
|
18
WLANManager/README.md
Normal file
18
WLANManager/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
#WLANManager
|
||||
Invokes standard Windows Wireless Network Properties dialog
|
||||
|
||||
##Usage
|
||||
```
|
||||
WLANManager profile <name>
|
||||
```
|
||||
|
||||
- `name` - The name of the network profile (not neccessarely the same as SSID)
|
||||
|
||||
Return codes:
|
||||
- -1 = Invalid parameters
|
||||
- 0 = Success
|
||||
- 1 = Error parsing command line
|
||||
- 2 = WLAN handle could not be opened
|
||||
- 3 = WLAN provider negotiated unsupported version
|
||||
- 4 = Interface enumeration failed
|
||||
- 5 = Edit profile UI failed
|
21
WLANManager/StdAfx.cpp
Normal file
21
WLANManager/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"
|
33
WLANManager/StdAfx.h
Normal file
33
WLANManager/StdAfx.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
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/EAPBase_UI/include/EAP_UI.h"
|
||||
|
||||
#include <WinStd/Common.h>
|
||||
#include <WinStd/Win.h>
|
||||
#include <WinStd/WLAN.h>
|
||||
|
||||
#include <Windows.h>
|
||||
#include <CommCtrl.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#include <memory>
|
14
WLANManager/WLANManager.props
Normal file
14
WLANManager/WLANManager.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\Events\build\temp\Events.$(Platform).$(Configuration).$(PlatformToolset);..\lib\WinStd\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
BIN
WLANManager/WLANManager.rc
Normal file
BIN
WLANManager/WLANManager.rc
Normal file
Binary file not shown.
112
WLANManager/WLANManager.vcxproj
Normal file
112
WLANManager/WLANManager.vcxproj
Normal file
@@ -0,0 +1,112 @@
|
||||
<?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>{BFCAA3B4-97A9-4EA9-8FE1-F30280142BCC}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>WLANManager</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="WLANManager.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="WLANManager.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="WLANManager.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="WLANManager.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>
|
||||
<ResourceCompile Include="WLANManager.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\lib\WinStd\build\WinStd.vcxproj">
|
||||
<Project>{47399d91-7eb9-41de-b521-514ba5db0c43}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" />
|
||||
<None Include="res\WLANManager.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
41
WLANManager/WLANManager.vcxproj.filters
Normal file
41
WLANManager/WLANManager.vcxproj.filters
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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>
|
||||
<ResourceCompile Include="WLANManager.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" />
|
||||
<None Include="res\WLANManager.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
1
WLANManager/locale/.gitignore
vendored
Normal file
1
WLANManager/locale/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/*.mo
|
32
WLANManager/locale/WLANManager.pot
Normal file
32
WLANManager/locale/WLANManager.pot
Normal file
@@ -0,0 +1,32 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WLANManager\n"
|
||||
"POT-Creation-Date: 2016-08-28 12:03+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"
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:3
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:3
|
||||
msgid "1252"
|
||||
msgstr ""
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "Helper utility to support direct shortcuts to Wireless Network Properties"
|
||||
msgstr ""
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "WLAN Manager"
|
||||
msgstr ""
|
37
WLANManager/locale/sl_SI.po
Normal file
37
WLANManager/locale/sl_SI.po
Normal file
@@ -0,0 +1,37 @@
|
||||
# Translators:
|
||||
# Simon Rozman <simon@rozman.si>, 2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WLANManager\n"
|
||||
"POT-Creation-Date: 2016-08-28 12:03+0200\n"
|
||||
"PO-Revision-Date: 2016-06-02 12:27+0200\n"
|
||||
"Last-Translator: Simon Rozman <simon@rozman.si>, 2016\n"
|
||||
"Language-Team: Slovenian (Slovenia) (https://www.transifex.com/eduroam_devel/teams/11799/sl_SI/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Language: sl_SI\n"
|
||||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"
|
||||
"X-Generator: Poedit 1.8.8\n"
|
||||
"X-Poedit-Basepath: ..\n"
|
||||
"X-Poedit-KeywordsList: _\n"
|
||||
"X-Poedit-SearchPath-0: .\n"
|
||||
"X-Poedit-SourceCharset: UTF-8\n"
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:3
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:3
|
||||
msgid "1252"
|
||||
msgstr "1250"
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid ""
|
||||
"Helper utility to support direct shortcuts to Wireless Network Properties"
|
||||
msgstr ""
|
||||
"Orodje za pomoč, ki omogoča neposredne bližnjice do nastavitev brezžičnega "
|
||||
"omrežja"
|
||||
|
||||
#: MSIBuild/En.Win32.Release.Feature-2.idtx:4
|
||||
#: MSIBuild/En.x64.Release.Feature-2.idtx:4
|
||||
msgid "WLAN Manager"
|
||||
msgstr "Upravitelj WLAN"
|
BIN
WLANManager/res/WLANManager.ico
Normal file
BIN
WLANManager/res/WLANManager.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 KiB |
2
desktop.ini
Normal file
2
desktop.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[.ShellClassInfo]
|
||||
IconResource=include\icon_full.ico,0
|
@@ -24,15 +24,15 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<IntDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
|
||||
<OutDir>temp\$(ProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</OutDir>
|
||||
<IntDir>temp\$(MSBuildProjectName).$(Platform).$(Configuration).$(PlatformToolset)\</IntDir>
|
||||
<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>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0600;ISOLATION_AWARE_ENABLED=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_WIN32_WINNT=0x0600;ISOLATION_AWARE_ENABLED=1;SECURITY_WIN32;CERT_CHAIN_PARA_HAS_EXTRA_FIELDS;EAP_TLS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>StdAfx.h</PrecompiledHeaderFile>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
@@ -43,6 +43,9 @@
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<ResourceCompile />
|
||||
<POCompile>
|
||||
<OutputFile>$(OutDir)..\locale\%(Filename)\$(ProjectName).mo</OutputFile>
|
||||
</POCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
</Project>
|
Binary file not shown.
@@ -29,7 +29,7 @@
|
||||
// Product version as a single DWORD
|
||||
// Note: Used for version comparison within C/C++ code.
|
||||
//
|
||||
#define PRODUCT_VERSION 0x00ff0500
|
||||
#define PRODUCT_VERSION 0x00ff1100
|
||||
|
||||
//
|
||||
// Product version by components
|
||||
@@ -39,26 +39,31 @@
|
||||
//
|
||||
#define PRODUCT_VERSION_MAJ 0
|
||||
#define PRODUCT_VERSION_MIN 255
|
||||
#define PRODUCT_VERSION_REV 5
|
||||
#define PRODUCT_VERSION_REV 17
|
||||
#define PRODUCT_VERSION_BUILD 0
|
||||
|
||||
//
|
||||
// Human readable product version and build year for UI
|
||||
//
|
||||
#define PRODUCT_VERSION_STR "1.0-alpha5"
|
||||
#define PRODUCT_VERSION_STR "1.0-alpha17"
|
||||
#define PRODUCT_BUILD_YEAR_STR "2016"
|
||||
|
||||
//
|
||||
// Numerical version presentation for ProductVersion propery in
|
||||
// MSI packages (syntax: N.N[.N[.N]])
|
||||
//
|
||||
#define PRODUCT_VERSION_INST "0.255.5"
|
||||
#define PRODUCT_VERSION_INST "0.255.17"
|
||||
|
||||
//
|
||||
// The product code for ProductCode property in MSI packages
|
||||
// Replace with new on every version change, regardless how minor it is.
|
||||
//
|
||||
#define PRODUCT_VERSION_GUID "{4A006C27-4001-47C7-B0C2-2A16525A17C3}"
|
||||
#define PRODUCT_VERSION_GUID "{7968E51E-8A49-4316-9444-057295392387}"
|
||||
|
||||
//
|
||||
// Product vendor
|
||||
//
|
||||
#define VENDOR_NAME_STR "GÉANT"
|
||||
|
||||
//
|
||||
// Since the product name is not finally confirmed at the time of
|
||||
|
1598
include/icon.pdf
Normal file
1598
include/icon.pdf
Normal file
File diff suppressed because one or more lines are too long
BIN
include/icon_full.ico
Normal file
BIN
include/icon_full.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 113 KiB |
BIN
include/icon_ui.ico
Normal file
BIN
include/icon_ui.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
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>
|
@@ -82,16 +82,17 @@
|
||||
<ClInclude Include="..\include\Config.h" />
|
||||
<ClInclude Include="..\include\Credentials.h" />
|
||||
<ClInclude Include="..\include\EAP.h" />
|
||||
<ClInclude Include="..\include\EAPSerial.h" />
|
||||
<ClInclude Include="..\include\EAPXML.h" />
|
||||
<ClInclude Include="..\include\Method.h" />
|
||||
<ClInclude Include="..\include\Module.h" />
|
||||
<ClInclude Include="..\include\Session.h" />
|
||||
<ClInclude Include="..\src\StdAfx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\Config.cpp" />
|
||||
<ClCompile Include="..\src\Credentials.cpp" />
|
||||
<ClCompile Include="..\src\EAP.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>
|
||||
|
@@ -17,13 +17,10 @@
|
||||
<ClInclude Include="..\include\EAP.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\EAPSerial.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\EAPXML.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\Session.h">
|
||||
<ClInclude Include="..\include\Method.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\Config.h">
|
||||
@@ -46,8 +43,14 @@
|
||||
<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>
|
||||
<ClCompile Include="..\src\EAP.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
@@ -31,66 +31,17 @@ namespace eap
|
||||
/// Password based method credentials
|
||||
///
|
||||
class credentials_pass;
|
||||
}
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
///
|
||||
/// Packs a method credentials
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Credentials to pack
|
||||
///
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::credentials &val);
|
||||
|
||||
///
|
||||
/// Returns packed size of a method credentials
|
||||
/// Connection credentials
|
||||
///
|
||||
/// \param[in] val Credentials to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t get_pk_size(const eap::credentials &val);
|
||||
|
||||
///
|
||||
/// Unpacks a method credentials
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Credentials to unpack to
|
||||
///
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::credentials &val);
|
||||
|
||||
///
|
||||
/// Packs a password based method credentials
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Credentials to pack
|
||||
///
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::credentials_pass &val);
|
||||
|
||||
///
|
||||
/// Returns packed size of a password based method credentials
|
||||
///
|
||||
/// \param[in] val Credentials to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
inline size_t get_pk_size(const eap::credentials_pass &val);
|
||||
|
||||
///
|
||||
/// Unpacks a password based method credentials
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Credentials to unpack to
|
||||
///
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::credentials_pass &val);
|
||||
class credentials_connection;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Config.h"
|
||||
#include "Module.h"
|
||||
#include "EAPSerial.h"
|
||||
|
||||
#include "../../../include/Version.h"
|
||||
|
||||
@@ -101,6 +52,7 @@ namespace eapserial
|
||||
#include <tchar.h>
|
||||
#include <wincred.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -108,11 +60,23 @@ namespace eap
|
||||
{
|
||||
class credentials : public config
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Credential source when combined
|
||||
///
|
||||
enum source_t {
|
||||
source_unknown = -1, ///< Unknown source
|
||||
source_cache = 0, ///< Credentials were obtained from EapHost cache
|
||||
source_preshared, ///< Credentials were set by method configuration
|
||||
source_storage ///< Credentials were loaded from Windows Credential Manager
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs credentials
|
||||
///
|
||||
/// \param[in] mod Reference of the EAP module to use for global services
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
credentials(_In_ module &mod);
|
||||
|
||||
@@ -156,35 +120,55 @@ namespace eap
|
||||
///
|
||||
/// Test credentials if blank
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if blank
|
||||
/// - \c false otherwise
|
||||
///
|
||||
virtual bool empty() const;
|
||||
|
||||
/// \name XML configuration management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save credentials to XML document
|
||||
/// Save to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving credentials
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const;
|
||||
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||
|
||||
///
|
||||
/// Load credentials from XML document
|
||||
/// Load from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading credentials
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
/// \param[in] pConfigRoot Root element for loading
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
virtual bool load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError);
|
||||
/// 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);
|
||||
|
||||
/// @}
|
||||
|
||||
@@ -195,30 +179,15 @@ namespace eap
|
||||
/// Save credentials to Windows Credential Manager
|
||||
///
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to store credentials as
|
||||
/// \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.
|
||||
///
|
||||
virtual bool store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError) const = 0;
|
||||
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
|
||||
/// \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.
|
||||
///
|
||||
virtual bool retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError) = 0;
|
||||
|
||||
///
|
||||
/// Return target suffix for Windows Credential Manager credential name
|
||||
///
|
||||
virtual LPCTSTR target_suffix() const = 0;
|
||||
virtual void retrieve(_In_z_ LPCTSTR pszTargetName) = 0;
|
||||
|
||||
///
|
||||
/// Returns target name for Windows Credential Manager credential name
|
||||
@@ -227,7 +196,7 @@ namespace eap
|
||||
///
|
||||
/// \returns Final target name to store/retrieve credentials in Windows Credential Manager
|
||||
///
|
||||
inline winstd::tstring target_name(_In_ LPCTSTR pszTargetName) const
|
||||
inline winstd::tstring target_name(_In_z_ LPCTSTR pszTargetName) const
|
||||
{
|
||||
winstd::tstring target_name(_T(PRODUCT_NAME_STR) _T("/"));
|
||||
target_name += pszTargetName;
|
||||
@@ -237,8 +206,44 @@ namespace eap
|
||||
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;
|
||||
|
||||
///
|
||||
/// 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, must be the same type of credentials as `this`)
|
||||
/// \param[in] cfg Method configuration (must be the same type of configuration as `this` credentials belong to)
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to retrieve credentials from (optional, can be \c NULL)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c source_cache Credentials were obtained from EapHost cache
|
||||
/// - \c source_preshared Credentials were set by method configuration
|
||||
/// - \c source_storage Credentials were loaded from Windows Credential Manager
|
||||
///
|
||||
virtual source_t combine(
|
||||
_In_ const credentials *cred_cached,
|
||||
_In_ const config_method_with_cred &cfg,
|
||||
_In_opt_z_ LPCTSTR pszTargetName) = 0;
|
||||
|
||||
public:
|
||||
std::wstring m_identity; ///< Identity (username\@domain, certificate name etc.)
|
||||
};
|
||||
@@ -250,7 +255,7 @@ namespace eap
|
||||
///
|
||||
/// Constructs credentials
|
||||
///
|
||||
/// \param[in] mod Reference of the EAP module to use for global services
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
///
|
||||
credentials_pass(_In_ module &mod);
|
||||
|
||||
@@ -294,35 +299,55 @@ namespace eap
|
||||
///
|
||||
/// Test credentials if blank
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if blank
|
||||
/// - \c false otherwise
|
||||
///
|
||||
virtual bool empty() const;
|
||||
|
||||
/// \name XML configuration management
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Save credentials to XML document
|
||||
/// Save to XML document
|
||||
///
|
||||
/// \param[in] pDoc XML document
|
||||
/// \param[in] pConfigRoot Suggested root element for saving credentials
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
/// \param[in] pConfigRoot Suggested root element for saving
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const;
|
||||
virtual void save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const;
|
||||
|
||||
///
|
||||
/// Load credentials from XML document
|
||||
/// Load from XML document
|
||||
///
|
||||
/// \param[in] pConfigRoot Root element for loading credentials
|
||||
/// \param[out] ppEapError Pointer to error descriptor in case of failure. Free using `module::free_error_memory()`.
|
||||
/// \param[in] pConfigRoot Root element for loading
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
virtual void load(_In_ IXMLDOMNode *pConfigRoot);
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name BLOB management
|
||||
/// @{
|
||||
|
||||
///
|
||||
virtual bool load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError);
|
||||
/// 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);
|
||||
|
||||
/// @}
|
||||
|
||||
@@ -333,25 +358,15 @@ namespace eap
|
||||
/// Save credentials to Windows Credential Manager
|
||||
///
|
||||
/// \param[in] pszTargetName The name in Windows Credential Manager to store credentials as
|
||||
/// \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.
|
||||
///
|
||||
virtual bool store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError) const;
|
||||
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
|
||||
/// \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.
|
||||
///
|
||||
virtual bool retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError);
|
||||
virtual void retrieve(_In_z_ LPCTSTR pszTargetName);
|
||||
|
||||
/// @}
|
||||
|
||||
@@ -363,47 +378,133 @@ namespace eap
|
||||
static const unsigned char s_entropy[1024];
|
||||
/// \endcond
|
||||
};
|
||||
|
||||
|
||||
class credentials_connection : public config
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs credentials
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
/// \param[in] cfg Connection configuration
|
||||
///
|
||||
credentials_connection(_In_ module &mod, _In_ const config_connection &cfg);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
credentials_connection(_In_ const credentials_connection &other);
|
||||
|
||||
///
|
||||
/// Moves credentials
|
||||
///
|
||||
/// \param[in] other Credentials to move from
|
||||
///
|
||||
credentials_connection(_Inout_ credentials_connection &&other);
|
||||
|
||||
///
|
||||
/// Copies credentials
|
||||
///
|
||||
/// \param[in] other Credentials to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
credentials_connection& operator=(_In_ const credentials_connection &other);
|
||||
|
||||
///
|
||||
/// Moves credentials
|
||||
///
|
||||
/// \param[in] other Credentials to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
credentials_connection& operator=(_Inout_ credentials_connection &&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);
|
||||
|
||||
/// @}
|
||||
|
||||
///
|
||||
/// Returns provider namespace and ID concatenated
|
||||
///
|
||||
inline std::wstring get_id() const
|
||||
{
|
||||
if (m_namespace.empty())
|
||||
return m_id;
|
||||
else {
|
||||
std::wstring id(m_namespace);
|
||||
id += L':';
|
||||
id += m_id;
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::credentials &val)
|
||||
{
|
||||
pack(cursor, val.m_identity);
|
||||
}
|
||||
|
||||
|
||||
inline size_t get_pk_size(const eap::credentials &val)
|
||||
{
|
||||
return get_pk_size(val.m_identity);
|
||||
}
|
||||
|
||||
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::credentials &val)
|
||||
{
|
||||
unpack(cursor, val.m_identity);
|
||||
}
|
||||
|
||||
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const eap::credentials_pass &val)
|
||||
{
|
||||
pack(cursor, (const eap::credentials&)val);
|
||||
pack(cursor, val.m_password );
|
||||
}
|
||||
|
||||
|
||||
inline size_t get_pk_size(const eap::credentials_pass &val)
|
||||
///
|
||||
/// Checks if credentials match given provider.
|
||||
///
|
||||
inline bool match(_In_ const config_provider &cfg_provider) const
|
||||
{
|
||||
return
|
||||
get_pk_size((const eap::credentials&)val) +
|
||||
get_pk_size(val.m_password );
|
||||
_wcsicmp(m_namespace.c_str(), cfg_provider.m_namespace.c_str()) == 0 &&
|
||||
_wcsicmp(m_id .c_str(), cfg_provider.m_id .c_str()) == 0;
|
||||
}
|
||||
|
||||
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ eap::credentials_pass &val)
|
||||
{
|
||||
unpack(cursor, (eap::credentials&)val);
|
||||
unpack(cursor, val.m_password );
|
||||
}
|
||||
public:
|
||||
const config_connection& m_cfg; ///< Connection configuration
|
||||
std::wstring m_namespace; ///< Provider namespace URI
|
||||
std::wstring m_id; ///< Provider ID
|
||||
std::unique_ptr<credentials> m_cred; ///< Credentials
|
||||
};
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,395 +0,0 @@
|
||||
/*
|
||||
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 <WinStd/Crypt.h>
|
||||
|
||||
#include <sal.h>
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
///
|
||||
/// Packs a primitive data
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Variable with data to pack
|
||||
///
|
||||
template <class T> inline void pack(_Inout_ unsigned char *&cursor, _In_ const T &val);
|
||||
|
||||
///
|
||||
/// Returns packed size of a primitive data
|
||||
///
|
||||
/// \param[in] val Data to pack
|
||||
///
|
||||
/// \returns Size of data when packed (in bytes)
|
||||
///
|
||||
template <class T> inline size_t get_pk_size(_In_ const T &val);
|
||||
|
||||
///
|
||||
/// Unpacks a primitive data
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Variable to receive unpacked value
|
||||
///
|
||||
template <class T> inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ T &val);
|
||||
|
||||
///
|
||||
/// Packs a string
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val String to pack
|
||||
///
|
||||
template<class _Elem, class _Traits, class _Ax> inline void pack(_Inout_ unsigned char *&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 get_pk_size(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 unpack(_Inout_ const unsigned char *&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 pack(_Inout_ unsigned char *&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 get_pk_size(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 unpack(_Inout_ const unsigned char *&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 pack(_Inout_ unsigned char *&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 get_pk_size(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 unpack(_Inout_ const unsigned char *&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 pack(_Inout_ unsigned char *&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 get_pk_size(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 unpack(_Inout_ const unsigned char *&cursor, _Out_ std::list<_Ty, _Ax> &val);
|
||||
|
||||
///
|
||||
/// Packs a certificate context
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[in] val Certificate context to pack
|
||||
///
|
||||
inline void pack(_Inout_ unsigned char *&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 get_pk_size(const winstd::cert_context &val);
|
||||
|
||||
///
|
||||
/// Unpacks a certificate context
|
||||
///
|
||||
/// \param[inout] cursor Memory cursor
|
||||
/// \param[out] val Certificate context to unpack to
|
||||
///
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ winstd::cert_context &val);
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace eapserial
|
||||
{
|
||||
template <class T>
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const T &val)
|
||||
{
|
||||
memcpy(cursor, &val, sizeof(T));
|
||||
cursor += sizeof(T);
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
inline size_t get_pk_size(_In_ const T &val)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(val);
|
||||
return sizeof(T);
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ T &val)
|
||||
{
|
||||
memcpy(&val, cursor, sizeof(T));
|
||||
cursor += sizeof(T);
|
||||
}
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||
{
|
||||
std::basic_string<_Elem, _Traits, _Ax>::size_type count = val.length();
|
||||
*(std::basic_string<_Elem, _Traits, _Ax>::size_type*&)cursor = count;
|
||||
cursor += sizeof(std::basic_string<_Elem, _Traits, _Ax>::size_type);
|
||||
|
||||
size_t nSize = sizeof(_Elem)*count;
|
||||
memcpy(cursor, (const _Elem*)val.c_str(), nSize);
|
||||
cursor += nSize;
|
||||
}
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline size_t get_pk_size(const std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||
{
|
||||
return sizeof(std::basic_string<_Elem, _Traits, _Ax>::size_type) + sizeof(_Elem)*val.length();
|
||||
}
|
||||
|
||||
|
||||
template<class _Elem, class _Traits, class _Ax>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::basic_string<_Elem, _Traits, _Ax> &val)
|
||||
{
|
||||
std::basic_string<_Elem, _Traits, _Ax>::size_type count = *(const std::basic_string<_Elem, _Traits, _Ax>::size_type*&)cursor;
|
||||
cursor += sizeof(std::basic_string<_Elem, _Traits, _Ax>::size_type);
|
||||
|
||||
val.assign((const _Elem*&)cursor, count);
|
||||
cursor += sizeof(_Elem)*count;
|
||||
}
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline void pack(_Inout_ unsigned char *&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);
|
||||
pack(cursor, val_utf8);
|
||||
}
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline size_t get_pk_size(const std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||
{
|
||||
return sizeof(std::string::size_type) + WideCharToMultiByte(CP_UTF8, 0, val.c_str(), (int)val.length(), NULL, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &val)
|
||||
{
|
||||
std::string val_utf8;
|
||||
unpack(cursor, val_utf8);
|
||||
MultiByteToWideChar(CP_UTF8, 0, val_utf8.c_str(), (int)val_utf8.length(), val);
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::vector<_Ty, _Ax> &val)
|
||||
{
|
||||
std::vector<_Ty, _Ax>::size_type count = val.size();
|
||||
*(std::vector<_Ty, _Ax>::size_type*&)cursor = count;
|
||||
cursor += sizeof(std::vector<_Ty, _Ax>::size_type);
|
||||
|
||||
// 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++)
|
||||
pack(cursor, val[i]);
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline size_t get_pk_size(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.
|
||||
size_t size = sizeof(std::vector<_Ty, _Ax>::size_type);
|
||||
for (std::vector<_Ty, _Ax>::size_type i = 0, count = val.size(); i < count; i++)
|
||||
size += get_pk_size(val[i]);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::vector<_Ty, _Ax> &val)
|
||||
{
|
||||
std::vector<_Ty, _Ax>::size_type count = *(const std::vector<_Ty, _Ax>::size_type*&)cursor;
|
||||
cursor += sizeof(std::vector<_Ty, _Ax>::size_type);
|
||||
|
||||
// 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;
|
||||
unpack(cursor, el);
|
||||
val.push_back(el);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const std::list<_Ty, _Ax> &val)
|
||||
{
|
||||
std::list<_Ty, _Ax>::size_type count = val.size();
|
||||
*(std::list<_Ty, _Ax>::size_type*&)cursor = count;
|
||||
cursor += sizeof(std::list<_Ty, _Ax>::size_type);
|
||||
|
||||
// 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)
|
||||
pack(cursor, *i);
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline size_t get_pk_size(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.
|
||||
size_t size = sizeof(std::list<_Ty, _Ax>::size_type);
|
||||
for (std::list<_Ty, _Ax>::const_iterator i = val.cbegin(), i_end = val.cend(); i != i_end; ++i)
|
||||
size += get_pk_size(*i);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ std::list<_Ty, _Ax> &val)
|
||||
{
|
||||
std::list<_Ty, _Ax>::size_type count = *(const std::list<_Ty, _Ax>::size_type*&)cursor;
|
||||
cursor += sizeof(std::list<_Ty, _Ax>::size_type);
|
||||
|
||||
// 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;
|
||||
unpack(cursor, el);
|
||||
val.push_back(el);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void pack(_Inout_ unsigned char *&cursor, _In_ const winstd::cert_context &val)
|
||||
{
|
||||
if (val) {
|
||||
*(DWORD*&)cursor = val->dwCertEncodingType;
|
||||
cursor += sizeof(DWORD);
|
||||
|
||||
*(DWORD*&)cursor = val->cbCertEncoded;
|
||||
cursor += sizeof(DWORD);
|
||||
|
||||
memcpy(cursor, val->pbCertEncoded, val->cbCertEncoded);
|
||||
cursor += val->cbCertEncoded;
|
||||
} else {
|
||||
*(DWORD*&)cursor = 0;
|
||||
cursor += sizeof(DWORD);
|
||||
|
||||
*(DWORD*&)cursor = 0;
|
||||
cursor += sizeof(DWORD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline size_t get_pk_size(const winstd::cert_context &val)
|
||||
{
|
||||
return sizeof(DWORD) + sizeof(DWORD) + (val ? val->cbCertEncoded : 0);
|
||||
}
|
||||
|
||||
|
||||
inline void unpack(_Inout_ const unsigned char *&cursor, _Out_ winstd::cert_context &val)
|
||||
{
|
||||
DWORD dwCertEncodingType = *(DWORD*&)cursor;
|
||||
cursor += sizeof(DWORD);
|
||||
|
||||
DWORD dwCertEncodedSize = *(DWORD*&)cursor;
|
||||
cursor += sizeof(DWORD);
|
||||
|
||||
if (dwCertEncodedSize) {
|
||||
val.create(dwCertEncodingType, (BYTE*)cursor, dwCertEncodedSize);
|
||||
cursor += dwCertEncodedSize;
|
||||
} else
|
||||
val.free();
|
||||
}
|
||||
}
|
@@ -27,27 +27,39 @@
|
||||
|
||||
namespace eapxml
|
||||
{
|
||||
inline DWORD get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ IXMLDOMDocument2 **ppXmlDoc);
|
||||
inline DWORD select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNode **ppXmlNode);
|
||||
inline DWORD select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNodeList **ppXmlNodes);
|
||||
inline DWORD select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ IXMLDOMElement **ppXmlElement);
|
||||
inline DWORD create_element(_In_ IXMLDOMDocument *pDoc, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement);
|
||||
inline DWORD 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 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 DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ BSTR *pbstrValue);
|
||||
template<class _Traits, class _Ax> inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue);
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ DWORD *pdwValue);
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool *pbValue);
|
||||
template<class _Ty, class _Ax> inline DWORD get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||
template<class _Ty, class _Ax> inline DWORD get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||
inline DWORD get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ BSTR *pbstrValue);
|
||||
template<class _Traits, class _Ax> inline DWORD 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 DWORD put_element(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement);
|
||||
inline DWORD 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 DWORD put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ DWORD dwValue);
|
||||
inline DWORD put_element_value(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _In_ bool bValue);
|
||||
inline DWORD 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 DWORD 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 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 HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ BSTR *pbstrValue);
|
||||
template<class _Traits, class _Ax> inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue);
|
||||
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ DWORD *pdwValue);
|
||||
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ bool *pbValue);
|
||||
template<class _Ty, class _Ax> inline HRESULT get_attrib_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||
template<class _Ty, class _Ax> inline HRESULT get_attrib_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue);
|
||||
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_z_ const BSTR bstrValue);
|
||||
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_ DWORD dwValue);
|
||||
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_ bool bValue);
|
||||
inline HRESULT put_attrib_base64(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_opt_z_ _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
|
||||
inline HRESULT put_attrib_hex(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen);
|
||||
inline std::wstring get_xpath(_In_ IXMLDOMNode *pXmlNode);
|
||||
}
|
||||
|
||||
#pragma once
|
||||
@@ -61,7 +73,7 @@ namespace eapxml
|
||||
|
||||
namespace eapxml
|
||||
{
|
||||
inline DWORD get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ IXMLDOMDocument2 **ppXmlDoc)
|
||||
inline HRESULT get_document(_In_ IXMLDOMNode *pXmlNode, _Out_ IXMLDOMDocument2 **ppXmlDoc)
|
||||
{
|
||||
assert(pXmlNode);
|
||||
assert(ppXmlDoc);
|
||||
@@ -71,11 +83,11 @@ namespace eapxml
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pXmlNode->get_ownerDocument(&doc)) &&
|
||||
SUCCEEDED(hr = doc.query_interface(ppXmlDoc)) ? ERROR_SUCCESS : HRESULT_CODE(hr);
|
||||
SUCCEEDED(hr = doc.query_interface(ppXmlDoc)) ? S_OK : hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNode **ppXmlNode)
|
||||
inline HRESULT select_node(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNode **ppXmlNode)
|
||||
{
|
||||
assert(pXmlParent);
|
||||
assert(ppXmlNode);
|
||||
@@ -84,11 +96,11 @@ namespace eapxml
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pXmlParent->selectSingleNode(bstrNodeName, ppXmlNode)) ?
|
||||
*ppXmlNode ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr);
|
||||
*ppXmlNode ? S_OK : E_NOT_SET : hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNodeList **ppXmlNodes)
|
||||
inline HRESULT select_nodes(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrNodeName, _Out_ IXMLDOMNodeList **ppXmlNodes)
|
||||
{
|
||||
assert(pXmlParent);
|
||||
assert(ppXmlNodes);
|
||||
@@ -97,26 +109,25 @@ namespace eapxml
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pXmlParent->selectNodes(bstrNodeName, ppXmlNodes)) ?
|
||||
*ppXmlNodes ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr);
|
||||
*ppXmlNodes ? S_OK : E_NOT_SET : hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ IXMLDOMElement **ppXmlElement)
|
||||
inline HRESULT select_element(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ IXMLDOMElement **ppXmlElement)
|
||||
{
|
||||
assert(ppXmlElement);
|
||||
|
||||
DWORD dwResult;
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMNode> pXmlNode;
|
||||
|
||||
return
|
||||
(dwResult = select_node(pXmlParent, bstrElementName, &pXmlNode)) == ERROR_SUCCESS ?
|
||||
SUCCEEDED(hr = select_node(pXmlParent, bstrElementName, &pXmlNode)) ?
|
||||
SUCCEEDED(hr = pXmlNode.query_interface(ppXmlElement)) ?
|
||||
*ppXmlElement ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr) : dwResult;
|
||||
*ppXmlElement ? S_OK : E_NOT_SET : hr : hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD 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, _In_z_ const BSTR bstrElementName, _In_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement)
|
||||
{
|
||||
assert(pDoc);
|
||||
assert(ppXmlElement);
|
||||
@@ -128,23 +139,22 @@ namespace eapxml
|
||||
return
|
||||
SUCCEEDED(hr = pDoc->createNode(varNodeTypeEl, bstrElementName, bstrNamespace, &pXmlNode)) ?
|
||||
SUCCEEDED(hr = pXmlNode.query_interface(ppXmlElement)) ?
|
||||
*ppXmlElement ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr) : HRESULT_CODE(hr);
|
||||
*ppXmlElement ? S_OK : E_NOT_SET : hr : hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD 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 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);
|
||||
|
||||
DWORD dwResult;
|
||||
HRESULT hr;
|
||||
|
||||
return
|
||||
(dwResult = select_element(pXmlParent, bstrElementNameSelect, ppXmlElement)) == ERROR_SUCCESS ? ERROR_SUCCESS :
|
||||
(dwResult = create_element(pDoc, bstrElementNameCreate, bstrNamespace, ppXmlElement)) == ERROR_SUCCESS ?
|
||||
SUCCEEDED(hr = pXmlParent->appendChild(*ppXmlElement, NULL)) ? ERROR_SUCCESS : HRESULT_CODE(hr) : dwResult;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -158,51 +168,50 @@ namespace eapxml
|
||||
}
|
||||
|
||||
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ BSTR *pbstrValue)
|
||||
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ BSTR *pbstrValue)
|
||||
{
|
||||
assert(pbstrValue);
|
||||
|
||||
DWORD dwResult;
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMElement> pXmlElement;
|
||||
|
||||
return
|
||||
(dwResult = select_element(pXmlParent, bstrElementName, &pXmlElement)) == ERROR_SUCCESS ?
|
||||
SUCCEEDED(hr = select_element(pXmlParent, bstrElementName, &pXmlElement)) ?
|
||||
SUCCEEDED(hr = pXmlElement->get_text(pbstrValue)) ?
|
||||
*pbstrValue ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr) : dwResult;
|
||||
*pbstrValue ? S_OK : E_NOT_SET : hr : hr;
|
||||
}
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline DWORD 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_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS)
|
||||
HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (SUCCEEDED(hr))
|
||||
sValue.assign(bstr, bstr.length());
|
||||
return dwResult;
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD 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_ DWORD *pdwValue)
|
||||
{
|
||||
assert(pdwValue);
|
||||
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS)
|
||||
HRESULT hr = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (SUCCEEDED(hr))
|
||||
*pdwValue = wcstoul(bstr, NULL, 10);
|
||||
return dwResult;
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool *pbValue)
|
||||
inline HRESULT get_element_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ bool *pbValue)
|
||||
{
|
||||
assert(pbValue);
|
||||
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS) {
|
||||
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;
|
||||
@@ -211,63 +220,62 @@ namespace eapxml
|
||||
CompareStringEx(LOCALE_NAME_INVARIANT, NORM_IGNORECASE, bstr, bstr.length(), L"0" , -1, NULL, NULL, 0) == CSTR_EQUAL)
|
||||
*pbValue = false;
|
||||
else
|
||||
dwResult = ERROR_INVALID_DATA;
|
||||
hr = E_NOT_VALID_STATE;
|
||||
}
|
||||
|
||||
return dwResult;
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline DWORD get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||
inline HRESULT get_element_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS) {
|
||||
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 dwResult;
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
template<class _Ty, class _Ax>
|
||||
inline DWORD get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||
inline HRESULT get_element_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
DWORD dwResult = get_element_value(pXmlParent, bstrElementName, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS) {
|
||||
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 dwResult;
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD get_element_localized(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrElementName, _In_z_ LPCWSTR pszLang, _Out_ BSTR *pbstrValue)
|
||||
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;
|
||||
|
||||
DWORD dwResult = select_element(pXmlParent, bstrElementName, &pXmlElement);
|
||||
if (dwResult != ERROR_SUCCESS)
|
||||
return dwResult;
|
||||
if (FAILED(hr = select_element(pXmlParent, bstrElementName, &pXmlElement)))
|
||||
return hr;
|
||||
|
||||
winstd::com_obj<IXMLDOMNodeList> pXmlListLocalizedText;
|
||||
long lCount = 0;
|
||||
if (select_nodes(pXmlElement, winstd::bstr(L"eap-metadata:localized-text"), &pXmlListLocalizedText) != ERROR_SUCCESS ||
|
||||
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 ? ERROR_SUCCESS : ERROR_NO_DATA : HRESULT_CODE(hr);
|
||||
*pbstrValue ? S_OK : E_NOT_SET : hr;
|
||||
}
|
||||
|
||||
winstd::bstr bstrDefault, bstrEn;
|
||||
@@ -276,11 +284,11 @@ namespace eapxml
|
||||
if (bstrDefault != NULL) {
|
||||
// Return "C" localization.
|
||||
*pbstrValue = bstrDefault.detach();
|
||||
return ERROR_SUCCESS;
|
||||
return S_OK;
|
||||
} else if (bstrEn != NULL) {
|
||||
// Return "en" localization.
|
||||
*pbstrValue = bstrEn.detach();
|
||||
return ERROR_SUCCESS;
|
||||
return S_OK;
|
||||
} else
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
@@ -291,12 +299,12 @@ namespace eapxml
|
||||
{
|
||||
// Read <lang>.
|
||||
winstd::bstr bstrLang;
|
||||
if (get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:lang"), &bstrLang) != ERROR_SUCCESS ||
|
||||
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 ((dwResult = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), &bstr)) == ERROR_SUCCESS)
|
||||
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.
|
||||
@@ -304,7 +312,7 @@ namespace eapxml
|
||||
} 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 ((dwResult = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), &bstr)) == ERROR_SUCCESS)
|
||||
if (SUCCEEDED(hr = get_element_value(pXmlElLocalizedText, winstd::bstr(L"eap-metadata:text"), &bstr)))
|
||||
bstrEn.attach(bstr.detach());
|
||||
}
|
||||
}
|
||||
@@ -313,17 +321,17 @@ namespace eapxml
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline DWORD 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 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;
|
||||
DWORD dwResult = get_element_localized(pXmlParent, bstrElementName, pszLang, &bstr);
|
||||
if (dwResult == ERROR_SUCCESS)
|
||||
HRESULT hr = get_element_localized(pXmlParent, bstrElementName, pszLang, &bstr);
|
||||
if (SUCCEEDED(hr))
|
||||
sValue.assign(bstr, bstr.length());
|
||||
return dwResult;
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD 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(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrElementName, _In_opt_z_ const BSTR bstrNamespace, _Out_ IXMLDOMElement **ppXmlElement)
|
||||
{
|
||||
assert(pDoc);
|
||||
assert(pCurrentDOMNode);
|
||||
@@ -336,11 +344,11 @@ namespace eapxml
|
||||
return
|
||||
SUCCEEDED(hr = pDoc->createNode(varNodeTypeEl, bstrElementName, bstrNamespace, &pXmlEl)) &&
|
||||
SUCCEEDED(hr = pCurrentDOMNode->appendChild(pXmlEl, NULL)) &&
|
||||
SUCCEEDED(hr = pXmlEl.query_interface(ppXmlElement)) ? ERROR_SUCCESS : HRESULT_CODE(hr);
|
||||
SUCCEEDED(hr = pXmlEl.query_interface(ppXmlElement)) ? S_OK : hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD 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_z_ const BSTR bstrValue)
|
||||
{
|
||||
assert(pDoc);
|
||||
|
||||
@@ -353,23 +361,23 @@ namespace eapxml
|
||||
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)) ? ERROR_SUCCESS : HRESULT_CODE(hr);
|
||||
SUCCEEDED(hr = pCurrentDOMNode->appendChild(pXmlEl, NULL)) ? S_OK : hr;
|
||||
}
|
||||
|
||||
|
||||
inline DWORD 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_ DWORD dwValue)
|
||||
{
|
||||
return put_element_value(pDoc, pCurrentDOMNode, bstrElementName, bstrNamespace, winstd::bstr(winstd::wstring_printf(L"%d", dwValue)));
|
||||
}
|
||||
|
||||
|
||||
inline DWORD 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_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 DWORD 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_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;
|
||||
@@ -378,11 +386,163 @@ namespace eapxml
|
||||
}
|
||||
|
||||
|
||||
inline DWORD 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 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 HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ BSTR *pbstrValue)
|
||||
{
|
||||
assert(pbstrValue);
|
||||
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMNamedNodeMap> pXmlAttributes;
|
||||
winstd::com_obj<IXMLDOMNode> pXmlAt;
|
||||
VARIANT varValue;
|
||||
V_VT(&varValue) = VT_EMPTY;
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pXmlParent->get_attributes(&pXmlAttributes)) ?
|
||||
SUCCEEDED(hr = pXmlAttributes->getNamedItem(bstrAttributeName, &pXmlAt)) ?
|
||||
pXmlAt ?
|
||||
SUCCEEDED(hr = pXmlAt->get_nodeValue(&varValue)) ?
|
||||
V_VT(&varValue) == VT_BSTR ? *pbstrValue = V_BSTR(&varValue), S_OK : E_UNEXPECTED : hr : E_NOT_SET : hr : hr;
|
||||
}
|
||||
|
||||
|
||||
template<class _Traits, class _Ax>
|
||||
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::basic_string<wchar_t, _Traits, _Ax> &sValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, &bstr);
|
||||
if (SUCCEEDED(hr))
|
||||
sValue.assign(bstr, bstr.length());
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ DWORD *pdwValue)
|
||||
{
|
||||
assert(pdwValue);
|
||||
|
||||
winstd::bstr bstr;
|
||||
HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, &bstr);
|
||||
if (SUCCEEDED(hr))
|
||||
*pdwValue = wcstoul(bstr, NULL, 10);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT get_attrib_value(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ bool *pbValue)
|
||||
{
|
||||
assert(pbValue);
|
||||
|
||||
winstd::bstr bstr;
|
||||
HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, &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_attrib_base64(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, &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_attrib_hex(_In_ IXMLDOMNode *pXmlParent, _In_z_ const BSTR bstrAttributeName, _Out_ std::vector<_Ty, _Ax> &aValue)
|
||||
{
|
||||
winstd::bstr bstr;
|
||||
HRESULT hr = get_attrib_value(pXmlParent, bstrAttributeName, &bstr);
|
||||
if (SUCCEEDED(hr)) {
|
||||
winstd::hex_dec dec;
|
||||
bool is_last;
|
||||
dec.decode(aValue, is_last, (BSTR)bstr, bstr.length());
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_z_ const BSTR bstrValue)
|
||||
{
|
||||
HRESULT hr;
|
||||
winstd::com_obj<IXMLDOMElement> pXmlEl;
|
||||
VARIANT varValue;
|
||||
V_VT(&varValue) = VT_BSTR;
|
||||
V_BSTR(&varValue) = bstrValue;
|
||||
|
||||
return
|
||||
SUCCEEDED(hr = pCurrentDOMNode->QueryInterface(__uuidof(IXMLDOMElement), (void**)&pXmlEl)) &&
|
||||
SUCCEEDED(hr = pXmlEl->setAttribute(bstrAttributeName, varValue)) ? S_OK : hr;
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_ DWORD dwValue)
|
||||
{
|
||||
return put_attrib_value(pCurrentDOMNode, bstrAttributeName, winstd::bstr(winstd::wstring_printf(L"%d", dwValue)));
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT put_attrib_value(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_ bool bValue)
|
||||
{
|
||||
return put_attrib_value(pCurrentDOMNode, bstrAttributeName, winstd::bstr(bValue ? L"true": L"false"));
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT put_attrib_base64(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
|
||||
{
|
||||
std::wstring sBase64;
|
||||
winstd::base64_enc enc;
|
||||
enc.encode(sBase64, pValue, nValueLen);
|
||||
return put_attrib_value(pCurrentDOMNode, bstrAttributeName, winstd::bstr(sBase64));
|
||||
}
|
||||
|
||||
|
||||
inline HRESULT put_attrib_hex(_In_ IXMLDOMNode *pCurrentDOMNode, _In_z_ const BSTR bstrAttributeName, _In_count_(nValueLen) LPCVOID pValue, _In_ SIZE_T nValueLen)
|
||||
{
|
||||
std::wstring sHex;
|
||||
winstd::hex_enc enc;
|
||||
enc.encode(sHex, pValue, nValueLen);
|
||||
return put_attrib_value(pCurrentDOMNode, bstrAttributeName, 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"";
|
||||
}
|
||||
}
|
||||
|
211
lib/EAPBase/include/Method.h
Normal file
211
lib/EAPBase/include/Method.h
Normal file
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
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 and non-EAP method base class
|
||||
///
|
||||
class method;
|
||||
|
||||
///
|
||||
/// Non-EAP method base class
|
||||
///
|
||||
class method_noneap;
|
||||
}
|
||||
|
||||
#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 Method configuration
|
||||
/// \param[in] cred User credentials
|
||||
///
|
||||
method(_In_ module &module, _In_ config_method_with_cred &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_opt_ DWORD dwMaxSendPacketSize = MAXDWORD);
|
||||
|
||||
///
|
||||
/// 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 void *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) void *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_method_with_cred &m_cfg; ///< Connection configuration
|
||||
credentials &m_cred; ///< User credentials
|
||||
std::vector<winstd::eap_attr> m_eap_attr; ///< EAP attributes
|
||||
};
|
||||
|
||||
|
||||
class method_noneap : public method
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs an EAP method
|
||||
///
|
||||
/// \param[in] mod EAP module to use for global services
|
||||
/// \param[in] cfg Method configuration
|
||||
/// \param[in] cred User credentials
|
||||
///
|
||||
method_noneap(_In_ module &module, _In_ config_method_with_cred &cfg, _In_ credentials &cred);
|
||||
|
||||
///
|
||||
/// Moves an EAP method
|
||||
///
|
||||
/// \param[in] other EAP method to move from
|
||||
///
|
||||
method_noneap(_Inout_ method_noneap &&other);
|
||||
|
||||
///
|
||||
/// Moves an EAP method
|
||||
///
|
||||
/// \param[in] other EAP method to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
method_noneap& operator=(_Inout_ method_noneap &&other);
|
||||
|
||||
/// \name Packet processing
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// 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) void *pSendPacket,
|
||||
_Inout_ DWORD *pdwSendPacketSize);
|
||||
|
||||
/// @}
|
||||
|
||||
protected:
|
||||
///
|
||||
/// Appends Diameter AVP to response packet
|
||||
///
|
||||
/// \param[in] code AVP code
|
||||
/// \param[in] flags AVP flags
|
||||
/// \param[in] data AVP data (<16777212B)
|
||||
/// \param[in] size Size of \p data in bytes
|
||||
///
|
||||
void append_avp(_In_ unsigned int code, _In_ unsigned char flags, _In_bytecount_(size) const void *data, _In_ unsigned int size);
|
||||
|
||||
///
|
||||
/// Appends Diameter AVP to response packet
|
||||
///
|
||||
/// \param[in] code AVP code
|
||||
/// \param[in] vendor_id Vendor-ID
|
||||
/// \param[in] flags AVP flags
|
||||
/// \param[in] data AVP data (<16777212B)
|
||||
/// \param[in] size Size of \p data in bytes
|
||||
///
|
||||
void append_avp(_In_ unsigned int code, _In_ unsigned int vendor_id, _In_ unsigned char flags, _In_bytecount_(size) const void *data, _In_ unsigned int size);
|
||||
|
||||
protected:
|
||||
sanitizing_blob m_packet_res; ///< Response packet
|
||||
};
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,367 +0,0 @@
|
||||
/*
|
||||
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 session
|
||||
///
|
||||
template <class _Tcfg, class _Tid, class _Tint, class _Tintres> class session;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Module.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <eaptypes.h> // Must include after <Windows.h>
|
||||
extern "C" {
|
||||
#include <eapmethodpeerapis.h>
|
||||
}
|
||||
#include <sal.h>
|
||||
|
||||
|
||||
namespace eap
|
||||
{
|
||||
template <class _Tcfg, class _Tid, class _Tint, class _Tintres>
|
||||
class session
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Provider configuration data type
|
||||
///
|
||||
typedef config_provider<_Tcfg> provider_config_type;
|
||||
|
||||
///
|
||||
/// Configuration data type
|
||||
///
|
||||
typedef config_providers<provider_config_type> config_type;
|
||||
|
||||
///
|
||||
/// Identity data type
|
||||
///
|
||||
typedef _Tid identity_type;
|
||||
|
||||
///
|
||||
/// Interactive request data type
|
||||
///
|
||||
typedef _Tint interactive_request_type;
|
||||
|
||||
///
|
||||
/// Interactive response data type
|
||||
///
|
||||
typedef _Tintres interactive_response_type;
|
||||
|
||||
public:
|
||||
///
|
||||
/// Constructs a session
|
||||
///
|
||||
/// \param[in] mod Reference of the EAP module to use for global services
|
||||
///
|
||||
session(_In_ module &mod) :
|
||||
m_module(mod),
|
||||
m_cfg(mod),
|
||||
m_id(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Copies session
|
||||
///
|
||||
/// \param[in] other Session to copy from
|
||||
///
|
||||
session(_In_ const session &other) :
|
||||
m_module(other.m_module),
|
||||
m_cfg(other.m_cfg),
|
||||
m_id(other.m_id)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Moves session
|
||||
///
|
||||
/// \param[in] other Session to move from
|
||||
///
|
||||
session(_Inout_ session &&other) :
|
||||
m_module(other.m_module),
|
||||
m_cfg(std::move(other.m_cfg)),
|
||||
m_id(std::move(other.m_id))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Copies session
|
||||
///
|
||||
/// \param[in] other Session to copy from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
session& operator=(_In_ const session &other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(std::addressof(m_module) ==std::addressof(other.m_module)); // Copy session within same module only!
|
||||
m_cfg = other.m_cfg;
|
||||
m_id = other.m_id;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Moves session
|
||||
///
|
||||
/// \param[in] other Session to move from
|
||||
///
|
||||
/// \returns Reference to this object
|
||||
///
|
||||
session& operator=(_Inout_ session &&other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(std::addressof(m_module) ==std::addressof(other.m_module)); // Move session within same module only!
|
||||
m_cfg = std::move(other.m_cfg);
|
||||
m_id = std::move(other.m_id);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/// \name Session start/end
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// 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
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool begin(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
_In_ HANDLE hTokenImpersonateUser,
|
||||
_In_ DWORD dwMaxSendPacketSize,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
UNREFERENCED_PARAMETER(pAttributeArray);
|
||||
UNREFERENCED_PARAMETER(hTokenImpersonateUser);
|
||||
UNREFERENCED_PARAMETER(dwMaxSendPacketSize);
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Ends an EAP authentication session for the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerEndSession function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363604.aspx)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool end(_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ppEapError);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Packet processing
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// Processes a packet received by EAPHost from a supplicant.
|
||||
///
|
||||
/// \sa [EapPeerProcessRequestPacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363621.aspx)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool process_request_packet(
|
||||
_In_ DWORD dwReceivedPacketSize,
|
||||
_In_bytecount_(dwReceivedPacketSize) const EapPacket *pReceivedPacket,
|
||||
_Out_ EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwReceivedPacketSize);
|
||||
UNREFERENCED_PARAMETER(pReceivedPacket);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Obtains a response packet from the EAP method.
|
||||
///
|
||||
/// \sa [EapPeerGetResponsePacket function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363610.aspx)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_response_packet(
|
||||
_Inout_ DWORD *pdwSendPacketSize,
|
||||
_Inout_bytecap_(*dwSendPacketSize) EapPacket *pSendPacket,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pdwSendPacketSize);
|
||||
UNREFERENCED_PARAMETER(pSendPacket);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_result(_In_ EapPeerMethodResultReason reason, _Out_ EapPeerMethodResult *ppResult, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(reason);
|
||||
UNREFERENCED_PARAMETER(ppResult);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name UI interaction
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_ui_context(
|
||||
_Out_ interactive_request_type &req,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(req);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool set_ui_context(
|
||||
_In_ const interactive_response_type &res,
|
||||
_In_ const EapPeerMethodOutput *pEapOutput,
|
||||
_Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(res);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Response attributes
|
||||
/// @{
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool get_response_attributes(_Out_ EapAttributes *pAttribs, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pAttribs);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \returns
|
||||
/// - \c true if succeeded
|
||||
/// - \c false otherwise. See \p ppEapError for details.
|
||||
///
|
||||
virtual bool set_response_attributes(const _In_ EapAttributes *pAttribs, _Out_ EapPeerMethodOutput *pEapOutput, _Out_ EAP_ERROR **ppEapError)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(pAttribs);
|
||||
UNREFERENCED_PARAMETER(pEapOutput);
|
||||
assert(ppEapError);
|
||||
|
||||
*ppEapError = m_module.make_error(ERROR_NOT_SUPPORTED, _T(__FUNCTION__) _T(" Not supported."));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// @}
|
||||
|
||||
public:
|
||||
module &m_module; ///< Reference of the EAP module
|
||||
config_type m_cfg; ///< Session configuration
|
||||
identity_type m_id; ///< User identity
|
||||
};
|
||||
}
|
@@ -48,15 +48,714 @@ eap::config::config(_Inout_ config &&other) :
|
||||
|
||||
eap::config& eap::config::operator=(_In_ const config &other)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(other);
|
||||
assert(&m_module == &other.m_module); // Copy configuration within same module only!
|
||||
if (this != &other)
|
||||
assert(&m_module == &other.m_module);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::config& eap::config::operator=(_Inout_ config &&other)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(other);
|
||||
assert(&m_module == &other.m_module); // Move configuration within same module only!
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
const bstr eap::config::namespace_eapmetadata(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// 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_auth_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_auth_failed(other.m_auth_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_auth_failed (std::move(other.m_auth_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_auth_failed = other.m_auth_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_auth_failed = std::move(other.m_auth_failed );
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::config_method_with_cred::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||
{
|
||||
assert(pDoc);
|
||||
assert(pConfigRoot);
|
||||
|
||||
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"), namespace_eapmetadata, &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"), namespace_eapmetadata, 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_auth_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_auth_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_auth_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_namespace (other.m_namespace ),
|
||||
m_id (other.m_id ),
|
||||
m_read_only (other.m_read_only ),
|
||||
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 )
|
||||
{
|
||||
m_methods.reserve(other.m_methods.size());
|
||||
for (vector<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_namespace (std::move(other.m_namespace )),
|
||||
m_id (std::move(other.m_id )),
|
||||
m_read_only (std::move(other.m_read_only )),
|
||||
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_namespace = other.m_namespace;
|
||||
m_id = other.m_id;
|
||||
m_read_only = other.m_read_only;
|
||||
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();
|
||||
m_methods.reserve(other.m_methods.size());
|
||||
for (vector<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_namespace = std::move(other.m_namespace );
|
||||
m_id = std::move(other.m_id );
|
||||
m_read_only = std::move(other.m_read_only );
|
||||
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);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
// namespace
|
||||
if (!m_namespace.empty())
|
||||
if (FAILED(hr = eapxml::put_attrib_value(pConfigRoot, bstr(L"namespace"), bstr(m_namespace))))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating namespace attribute.");
|
||||
|
||||
// ID
|
||||
if (!m_id.empty())
|
||||
if (FAILED(hr = eapxml::put_attrib_value(pConfigRoot, bstr(L"ID"), bstr(m_id))))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating ID attribute.");
|
||||
|
||||
// <read-only>
|
||||
if (FAILED(hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"read-only"), namespace_eapmetadata, m_read_only)))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <read-only> element.");
|
||||
|
||||
// <ProviderInfo>
|
||||
com_obj<IXMLDOMElement> pXmlElProviderInfo;
|
||||
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:ProviderInfo"), bstr(L"ProviderInfo"), namespace_eapmetadata, &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"), namespace_eapmetadata, 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"), namespace_eapmetadata, &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"), namespace_eapmetadata, 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"), namespace_eapmetadata, 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"), namespace_eapmetadata, 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"), namespace_eapmetadata, 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"), namespace_eapmetadata, 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"), namespace_eapmetadata, 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"), namespace_eapmetadata, &pXmlElAuthenticationMethods)))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <AuthenticationMethods> element.");
|
||||
|
||||
for (vector<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"), namespace_eapmetadata, &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);
|
||||
|
||||
// namespace
|
||||
m_namespace.clear();
|
||||
eapxml::get_attrib_value(pConfigRoot, bstr(L"namespace"), m_namespace);
|
||||
m_module.log_config((xpath + L" namespace").c_str(), m_namespace.c_str());
|
||||
|
||||
// ID
|
||||
m_id.clear();
|
||||
eapxml::get_attrib_value(pConfigRoot, bstr(L"ID"), m_id);
|
||||
m_module.log_config((xpath + L" ID").c_str(), m_id.c_str());
|
||||
|
||||
// <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);
|
||||
|
||||
// <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_namespace ;
|
||||
cursor << m_id ;
|
||||
cursor << m_read_only ;
|
||||
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_namespace ) +
|
||||
pksizeof(m_id ) +
|
||||
pksizeof(m_read_only ) +
|
||||
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_namespace ;
|
||||
cursor >> m_id ;
|
||||
cursor >> m_read_only ;
|
||||
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_connection
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::config_connection::config_connection(_In_ module &mod) : config(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_connection::config_connection(_In_ const config_connection &other) :
|
||||
m_providers(other.m_providers),
|
||||
config (other )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_connection::config_connection(_Inout_ config_connection &&other) :
|
||||
m_providers(std::move(other.m_providers)),
|
||||
config (std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::config_connection& eap::config_connection::operator=(_In_ const config_connection &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config&)*this = other;
|
||||
m_providers = other.m_providers;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::config_connection& eap::config_connection::operator=(_Inout_ config_connection &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config&&)*this = std::move(other );
|
||||
m_providers = std::move(other.m_providers);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::config* eap::config_connection::clone() const
|
||||
{
|
||||
return new config_connection(*this);
|
||||
}
|
||||
|
||||
|
||||
void eap::config_connection::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||
{
|
||||
config::save(pDoc, pConfigRoot);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
// Create <EAPIdentityProviderList> node.
|
||||
com_obj<IXMLDOMElement> pXmlElIdentityProviderList;
|
||||
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:EAPIdentityProviderList"), bstr(L"EAPIdentityProviderList"), namespace_eapmetadata, &pXmlElIdentityProviderList)))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <EAPIdentityProviderList> element.");
|
||||
|
||||
for (provider_list::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"), namespace_eapmetadata, &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_connection::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_connection::operator<<(_Inout_ cursor_out &cursor) const
|
||||
{
|
||||
config::operator<<(cursor);
|
||||
cursor << m_providers;
|
||||
}
|
||||
|
||||
|
||||
size_t eap::config_connection::get_pk_size() const
|
||||
{
|
||||
return
|
||||
config::get_pk_size() +
|
||||
pksizeof(m_providers);
|
||||
}
|
||||
|
||||
|
||||
void eap::config_connection::operator>>(_Inout_ cursor_in &cursor)
|
||||
{
|
||||
config::operator>>(cursor);
|
||||
|
||||
provider_list::size_type count;
|
||||
cursor >> count;
|
||||
m_providers.clear();
|
||||
for (provider_list::size_type i = 0; i < count; i++) {
|
||||
config_provider el(m_module);
|
||||
cursor >> el;
|
||||
m_providers.push_back(std::move(el));
|
||||
}
|
||||
}
|
||||
|
@@ -83,32 +83,72 @@ bool eap::credentials::empty() const
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const
|
||||
void eap::credentials::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||
{
|
||||
const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||
DWORD dwResult;
|
||||
assert(pDoc);
|
||||
assert(pConfigRoot);
|
||||
|
||||
config::save(pDoc, pConfigRoot);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
// <UserName>
|
||||
if ((dwResult = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"UserName"), bstrNamespace, bstr(m_identity))) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <UserName> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (!m_identity.empty())
|
||||
if (FAILED(hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"UserName"), namespace_eapmetadata, bstr(m_identity))))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <UserName> element.");
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError)
|
||||
void eap::credentials::load(_In_ IXMLDOMNode *pConfigRoot)
|
||||
{
|
||||
assert(pConfigRoot);
|
||||
DWORD dwResult;
|
||||
HRESULT hr;
|
||||
|
||||
if ((dwResult = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:UserName"), m_identity)) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error reading <UserName> element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document."));
|
||||
return false;
|
||||
config::load(pConfigRoot);
|
||||
|
||||
std::wstring xpath(eapxml::get_xpath(pConfigRoot));
|
||||
|
||||
if (FAILED(hr = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:UserName"), m_identity)))
|
||||
m_identity.clear();
|
||||
|
||||
m_module.log_config((xpath + L"/UserName").c_str(), m_identity.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
void eap::credentials::operator<<(_Inout_ cursor_out &cursor) const
|
||||
{
|
||||
config::operator<<(cursor);
|
||||
cursor << m_identity;
|
||||
}
|
||||
|
||||
|
||||
size_t eap::credentials::get_pk_size() const
|
||||
{
|
||||
return
|
||||
config::get_pk_size() +
|
||||
pksizeof(m_identity);
|
||||
}
|
||||
|
||||
|
||||
void eap::credentials::operator>>(_Inout_ cursor_in &cursor)
|
||||
{
|
||||
config::operator>>(cursor);
|
||||
cursor >> m_identity;
|
||||
}
|
||||
|
||||
|
||||
wstring eap::credentials::get_identity() const
|
||||
{
|
||||
return m_identity;
|
||||
}
|
||||
|
||||
|
||||
tstring eap::credentials::get_name() const
|
||||
{
|
||||
tstring identity(std::move(get_identity()));
|
||||
return
|
||||
!identity.empty() ? identity :
|
||||
empty() ? _T("<empty>") : _T("<blank ID>");
|
||||
}
|
||||
|
||||
|
||||
@@ -170,51 +210,74 @@ bool eap::credentials_pass::empty() const
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials_pass::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError) const
|
||||
void eap::credentials_pass::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||
{
|
||||
const bstr bstrNamespace(L"urn:ietf:params:xml:ns:yang:ietf-eap-metadata");
|
||||
DWORD dwResult;
|
||||
assert(pDoc);
|
||||
assert(pConfigRoot);
|
||||
|
||||
if (!credentials::save(pDoc, pConfigRoot, ppEapError))
|
||||
return false;
|
||||
credentials::save(pDoc, pConfigRoot);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
// <Password>
|
||||
bstr pass(m_password);
|
||||
dwResult = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"Password"), bstrNamespace, pass);
|
||||
hr = eapxml::put_element_value(pDoc, pConfigRoot, bstr(L"Password"), namespace_eapmetadata, pass);
|
||||
SecureZeroMemory((BSTR)pass, sizeof(OLECHAR)*pass.length());
|
||||
if (dwResult != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error creating <Password> element."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (FAILED(hr))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <Password> element.");
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials_pass::load(_In_ IXMLDOMNode *pConfigRoot, _Out_ EAP_ERROR **ppEapError)
|
||||
void eap::credentials_pass::load(_In_ IXMLDOMNode *pConfigRoot)
|
||||
{
|
||||
assert(pConfigRoot);
|
||||
DWORD dwResult;
|
||||
HRESULT hr;
|
||||
|
||||
if (!credentials::load(pConfigRoot, ppEapError))
|
||||
return false;
|
||||
credentials::load(pConfigRoot);
|
||||
|
||||
std::wstring xpath(eapxml::get_xpath(pConfigRoot));
|
||||
|
||||
bstr pass;
|
||||
if ((dwResult = eapxml::get_element_value(pConfigRoot, bstr(L"eap-metadata:Password"), &pass)) != ERROR_SUCCESS) {
|
||||
*ppEapError = m_module.make_error(dwResult, _T(__FUNCTION__) _T(" Error reading <Password> element."), _T("Please make sure profile XML is a valid ") _T(PRODUCT_NAME_STR) _T(" profile XML document."));
|
||||
return false;
|
||||
}
|
||||
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());
|
||||
|
||||
return true;
|
||||
m_module.log_config((xpath + L"/Password").c_str(),
|
||||
#ifdef _DEBUG
|
||||
m_password.c_str()
|
||||
#else
|
||||
L"********"
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials_pass::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError) const
|
||||
void eap::credentials_pass::operator<<(_Inout_ cursor_out &cursor) const
|
||||
{
|
||||
credentials::operator<<(cursor);
|
||||
cursor << m_password;
|
||||
}
|
||||
|
||||
|
||||
size_t eap::credentials_pass::get_pk_size() const
|
||||
{
|
||||
return
|
||||
credentials::get_pk_size() +
|
||||
pksizeof(m_password);
|
||||
}
|
||||
|
||||
|
||||
void eap::credentials_pass::operator>>(_Inout_ cursor_in &cursor)
|
||||
{
|
||||
credentials::operator>>(cursor);
|
||||
cursor >> m_password;
|
||||
}
|
||||
|
||||
|
||||
void eap::credentials_pass::store(_In_z_ LPCTSTR pszTargetName) const
|
||||
{
|
||||
assert(pszTargetName);
|
||||
assert(ppEapError);
|
||||
|
||||
// Convert password to UTF-8.
|
||||
sanitizing_string cred_utf8;
|
||||
@@ -224,10 +287,8 @@ bool eap::credentials_pass::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **
|
||||
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)) {
|
||||
*ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptProtectData failed."));
|
||||
return false;
|
||||
}
|
||||
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));
|
||||
|
||||
@@ -248,34 +309,26 @@ bool eap::credentials_pass::store(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **
|
||||
NULL, // TargetAlias
|
||||
(LPTSTR)m_identity.c_str() // UserName
|
||||
};
|
||||
if (!CredWrite(&cred, 0)) {
|
||||
*ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CredWrite failed."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
if (!CredWrite(&cred, 0))
|
||||
throw win_runtime_error(__FUNCTION__ " CredWrite failed.");
|
||||
}
|
||||
|
||||
|
||||
bool eap::credentials_pass::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR **ppEapError)
|
||||
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)) {
|
||||
*ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CredRead failed."));
|
||||
return false;
|
||||
}
|
||||
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)) {
|
||||
*ppEapError = m_module.make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptUnprotectData failed."));
|
||||
return false;
|
||||
}
|
||||
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);
|
||||
@@ -286,7 +339,15 @@ bool eap::credentials_pass::retrieve(_In_ LPCTSTR pszTargetName, _Out_ EAP_ERROR
|
||||
else
|
||||
m_identity.clear();
|
||||
|
||||
return true;
|
||||
wstring xpath(pszTargetName);
|
||||
m_module.log_config((xpath + L"/Identity").c_str(), m_identity.c_str());
|
||||
m_module.log_config((xpath + L"/Password").c_str(),
|
||||
#ifdef _DEBUG
|
||||
m_password.c_str()
|
||||
#else
|
||||
L"********"
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -356,3 +417,179 @@ const unsigned char eap::credentials_pass::s_entropy[1024] = {
|
||||
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,
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::credentials_connection
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::credentials_connection::credentials_connection(_In_ module &mod, _In_ const config_connection &cfg) :
|
||||
m_cfg(cfg),
|
||||
config(mod)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_connection::credentials_connection(_In_ const credentials_connection &other) :
|
||||
m_cfg (other.m_cfg ),
|
||||
m_namespace(other.m_namespace),
|
||||
m_id (other.m_id ),
|
||||
m_cred (other.m_cred ? (credentials*)other.m_cred->clone() : nullptr),
|
||||
config (other )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_connection::credentials_connection(_Inout_ credentials_connection &&other) :
|
||||
m_cfg ( other.m_cfg ),
|
||||
m_namespace(std::move(other.m_namespace)),
|
||||
m_id (std::move(other.m_id )),
|
||||
m_cred (std::move(other.m_cred )),
|
||||
config (std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_connection& eap::credentials_connection::operator=(_In_ const credentials_connection &other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config&)*this = other;
|
||||
m_namespace = other.m_namespace;
|
||||
m_id = other.m_id;
|
||||
m_cred.reset(other.m_cred ? (credentials*)other.m_cred->clone() : nullptr);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::credentials_connection& eap::credentials_connection::operator=(_Inout_ credentials_connection &&other)
|
||||
{
|
||||
if (this != &other) {
|
||||
(config&)*this = std::move(other );
|
||||
m_namespace = std::move(other.m_namespace);
|
||||
m_id = std::move(other.m_id );
|
||||
m_cred = std::move(other.m_cred );
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::config* eap::credentials_connection::clone() const
|
||||
{
|
||||
return new credentials_connection(*this);
|
||||
}
|
||||
|
||||
|
||||
void eap::credentials_connection::save(_In_ IXMLDOMDocument *pDoc, _In_ IXMLDOMNode *pConfigRoot) const
|
||||
{
|
||||
assert(pDoc);
|
||||
assert(pConfigRoot);
|
||||
|
||||
config::save(pDoc, pConfigRoot);
|
||||
|
||||
HRESULT hr;
|
||||
|
||||
// Create <EAPIdentityProvider> node.
|
||||
com_obj<IXMLDOMElement> pXmlElIdentityProvider;
|
||||
if (FAILED(hr = eapxml::create_element(pDoc, pConfigRoot, bstr(L"eap-metadata:EAPIdentityProvider"), bstr(L"EAPIdentityProvider"), namespace_eapmetadata, &pXmlElIdentityProvider)))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating <EAPIdentityProvider> element.");
|
||||
|
||||
// namespace
|
||||
if (!m_namespace.empty())
|
||||
if (FAILED(hr = eapxml::put_attrib_value(pXmlElIdentityProvider, bstr(L"namespace"), bstr(m_namespace))))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating namespace attribute.");
|
||||
|
||||
// ID
|
||||
if (!m_id.empty())
|
||||
if (FAILED(hr = eapxml::put_attrib_value(pXmlElIdentityProvider, bstr(L"ID"), bstr(m_id))))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error creating ID attribute.");
|
||||
|
||||
m_cred->save(pDoc, pXmlElIdentityProvider);
|
||||
}
|
||||
|
||||
|
||||
void eap::credentials_connection::load(_In_ IXMLDOMNode *pConfigRoot)
|
||||
{
|
||||
assert(pConfigRoot);
|
||||
HRESULT hr;
|
||||
|
||||
config::load(pConfigRoot);
|
||||
|
||||
// <EAPIdentityProvider>
|
||||
winstd::com_obj<IXMLDOMElement> pXmlElClientSideCredential;
|
||||
if (FAILED(hr = eapxml::select_element(pConfigRoot, winstd::bstr(L"eap-metadata:EAPIdentityProvider"), &pXmlElClientSideCredential)))
|
||||
throw com_runtime_error(hr, __FUNCTION__ " Error loading <EAPIdentityProvider> element.");
|
||||
|
||||
std::wstring xpath(eapxml::get_xpath(pXmlElClientSideCredential));
|
||||
|
||||
// namespace
|
||||
m_namespace.clear();
|
||||
eapxml::get_attrib_value(pXmlElClientSideCredential, bstr(L"namespace"), m_namespace);
|
||||
m_module.log_config((xpath + L" namespace").c_str(), m_namespace.c_str());
|
||||
|
||||
// ID
|
||||
m_id.clear();
|
||||
eapxml::get_attrib_value(pXmlElClientSideCredential, bstr(L"ID"), m_id);
|
||||
m_module.log_config((xpath + L" ID").c_str(), m_id.c_str());
|
||||
|
||||
// Look-up the provider.
|
||||
for (config_connection::provider_list::const_iterator cfg_prov = m_cfg.m_providers.cbegin(), cfg_prov_end = m_cfg.m_providers.cend(); ; ++cfg_prov) {
|
||||
if (cfg_prov != cfg_prov_end) {
|
||||
if (match(*cfg_prov)) {
|
||||
// Matching provider found. Create matching blank credential set, then load.
|
||||
if (cfg_prov->m_methods.empty())
|
||||
throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()).c_str());
|
||||
const config_method_with_cred *cfg_method = dynamic_cast<const config_method_with_cred*>(cfg_prov->m_methods.front().get());
|
||||
m_cred.reset(cfg_method->make_credentials());
|
||||
m_cred->load(pXmlElClientSideCredential);
|
||||
break;
|
||||
}
|
||||
} else
|
||||
throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void eap::credentials_connection::operator<<(_Inout_ cursor_out &cursor) const
|
||||
{
|
||||
config::operator<<(cursor);
|
||||
cursor << m_namespace;
|
||||
cursor << m_id ;
|
||||
cursor << *m_cred ;
|
||||
}
|
||||
|
||||
|
||||
size_t eap::credentials_connection::get_pk_size() const
|
||||
{
|
||||
return
|
||||
config::get_pk_size() +
|
||||
pksizeof( m_namespace) +
|
||||
pksizeof( m_id ) +
|
||||
pksizeof(*m_cred );
|
||||
}
|
||||
|
||||
|
||||
void eap::credentials_connection::operator>>(_Inout_ cursor_in &cursor)
|
||||
{
|
||||
config::operator>>(cursor);
|
||||
cursor >> m_namespace;
|
||||
cursor >> m_id ;
|
||||
|
||||
// Look-up the provider.
|
||||
for (config_connection::provider_list::const_iterator cfg_prov = m_cfg.m_providers.cbegin(), cfg_prov_end = m_cfg.m_providers.cend(); ; ++cfg_prov) {
|
||||
if (cfg_prov != cfg_prov_end) {
|
||||
if (match(*cfg_prov)) {
|
||||
// Matching provider found. Create matching blank credential set, then read.
|
||||
if (cfg_prov->m_methods.empty())
|
||||
throw invalid_argument(string_printf(__FUNCTION__ " %ls provider has no methods.", cfg_prov->get_id().c_str()).c_str());
|
||||
const config_method_with_cred *cfg_method = dynamic_cast<const config_method_with_cred*>(cfg_prov->m_methods.front().get());
|
||||
m_cred.reset(cfg_method->make_credentials());
|
||||
cursor >> *m_cred;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
throw invalid_argument(string_printf(__FUNCTION__ " Credentials do not match to any provider within this connection configuration (provider: %ls).", get_id().c_str()).c_str());
|
||||
}
|
||||
}
|
||||
|
83
lib/EAPBase/src/EAP.cpp
Normal file
83
lib/EAPBase/src/EAP.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
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::packet
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::packet::packet() :
|
||||
m_code((EapCode)0),
|
||||
m_id(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::packet::packet(_In_ const packet &other) :
|
||||
m_code(other.m_code),
|
||||
m_id (other.m_id ),
|
||||
m_data(other.m_data)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::packet::packet(_Inout_ packet &&other) :
|
||||
m_code(std::move(other.m_code)),
|
||||
m_id (std::move(other.m_id )),
|
||||
m_data(std::move(other.m_data))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::packet& eap::packet::operator=(_In_ const packet &other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
m_code = other.m_code;
|
||||
m_id = other.m_id ;
|
||||
m_data = other.m_data;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
eap::packet& eap::packet::operator=(_Inout_ packet &&other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
m_code = std::move(other.m_code);
|
||||
m_id = std::move(other.m_id );
|
||||
m_data = std::move(other.m_data);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::packet::clear()
|
||||
{
|
||||
m_code = (EapCode)0;
|
||||
m_id = 0;
|
||||
m_data.clear();
|
||||
}
|
174
lib/EAPBase/src/Method.cpp
Normal file
174
lib/EAPBase/src/Method.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
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_method_with_cred &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 ),
|
||||
m_eap_attr(std::move(other.m_eap_attr))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
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!
|
||||
m_eap_attr = std::move(other.m_eap_attr);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::method::begin_session(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ const EapAttributes *pAttributeArray,
|
||||
_In_ HANDLE hTokenImpersonateUser,
|
||||
_In_opt_ DWORD dwMaxSendPacketSize)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwFlags);
|
||||
UNREFERENCED_PARAMETER(pAttributeArray);
|
||||
UNREFERENCED_PARAMETER(hTokenImpersonateUser);
|
||||
UNREFERENCED_PARAMETER(dwMaxSendPacketSize);
|
||||
}
|
||||
|
||||
|
||||
void eap::method::end_session()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::method_noneap
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::method_noneap::method_noneap(_In_ module &module, _In_ config_method_with_cred &cfg, _In_ credentials &cred) : method(module, cfg, cred)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method_noneap::method_noneap(_Inout_ method_noneap &&other) :
|
||||
m_packet_res(std::move(other.m_packet_res)),
|
||||
method (std::move(other ))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
eap::method_noneap& eap::method_noneap::operator=(_Inout_ method_noneap &&other)
|
||||
{
|
||||
if (this != std::addressof(other)) {
|
||||
assert(std::addressof(m_cred) == std::addressof(other.m_cred)); // Move method with same credentials only!
|
||||
(method&)*this = std::move(other );
|
||||
m_packet_res = std::move(other.m_packet_res);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void eap::method_noneap::get_response_packet(
|
||||
_Inout_bytecap_(*dwSendPacketSize) void *pSendPacket,
|
||||
_Inout_ DWORD *pdwSendPacketSize)
|
||||
{
|
||||
assert(pdwSendPacketSize);
|
||||
assert(pSendPacket);
|
||||
|
||||
size_t size_packet = m_packet_res.size();
|
||||
if (size_packet > *pdwSendPacketSize)
|
||||
throw invalid_argument(string_printf(__FUNCTION__ " This method does not support packet fragmentation, but the data size is too big to fit in one packet (packet: %u, maximum: %u).", size_packet, *pdwSendPacketSize).c_str());
|
||||
|
||||
memcpy(pSendPacket, m_packet_res.data(), size_packet);
|
||||
*pdwSendPacketSize = (DWORD)size_packet;
|
||||
m_packet_res.clear();
|
||||
}
|
||||
|
||||
|
||||
void eap::method_noneap::append_avp(_In_ unsigned int code, _In_ unsigned char flags, _In_bytecount_(size) const void *data, _In_ unsigned int size)
|
||||
{
|
||||
unsigned int
|
||||
padding = (unsigned int)((4 - size) % 4),
|
||||
size_outer;
|
||||
|
||||
m_packet_res.reserve(
|
||||
m_packet_res.size() +
|
||||
(size_outer =
|
||||
sizeof(diameter_avp_header) + // Diameter header
|
||||
size) + // Data
|
||||
padding); // Data padding
|
||||
|
||||
// Diameter AVP header
|
||||
diameter_avp_header hdr;
|
||||
*(unsigned int*)hdr.code = htonl(code);
|
||||
hdr.flags = flags;
|
||||
hton24(size_outer, hdr.length);
|
||||
m_packet_res.insert(m_packet_res.end(), (unsigned char*)&hdr, (unsigned char*)(&hdr + 1));
|
||||
|
||||
// Data
|
||||
m_packet_res.insert(m_packet_res.end(), (unsigned char*)data, (unsigned char*)data + size);
|
||||
m_packet_res.insert(m_packet_res.end(), padding, 0);
|
||||
}
|
||||
|
||||
|
||||
void eap::method_noneap::append_avp(_In_ unsigned int code, _In_ unsigned int vendor_id, _In_ unsigned char flags, _In_bytecount_(size) const void *data, _In_ unsigned int size)
|
||||
{
|
||||
unsigned int
|
||||
padding = (unsigned int)((4 - size) % 4),
|
||||
size_outer;
|
||||
|
||||
m_packet_res.reserve(
|
||||
m_packet_res.size() +
|
||||
(size_outer =
|
||||
sizeof(diameter_avp_header_ven) + // Diameter header
|
||||
size) + // Data
|
||||
padding); // Data padding
|
||||
|
||||
// Diameter AVP header
|
||||
diameter_avp_header_ven hdr;
|
||||
*(unsigned int*)hdr.code = htonl(code);
|
||||
hdr.flags = flags | diameter_avp_flag_vendor;
|
||||
hton24(size_outer, hdr.length);
|
||||
*(unsigned int*)hdr.vendor = htonl(vendor_id);
|
||||
m_packet_res.insert(m_packet_res.end(), (unsigned char*)&hdr, (unsigned char*)(&hdr + 1));
|
||||
|
||||
// Data
|
||||
m_packet_res.insert(m_packet_res.end(), (unsigned char*)data, (unsigned char*)data + size);
|
||||
m_packet_res.insert(m_packet_res.end(), padding, 0);
|
||||
}
|
@@ -28,12 +28,12 @@ using namespace winstd;
|
||||
// eap::module
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::module::module(type_t eap_method) :
|
||||
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((DWORD)m_eap_method), event_data::blank);
|
||||
m_ep.write(&EAPMETHOD_TRACE_EVT_MODULE_LOAD, event_data((unsigned int)m_eap_method), event_data::blank);
|
||||
|
||||
m_heap.create(0, 0, 0);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ eap::module::module(type_t eap_method) :
|
||||
|
||||
eap::module::~module()
|
||||
{
|
||||
m_ep.write(&EAPMETHOD_TRACE_EVT_MODULE_UNLOAD, event_data((DWORD)m_eap_method), event_data::blank);
|
||||
m_ep.write(&EAPMETHOD_TRACE_EVT_MODULE_UNLOAD, event_data((unsigned int)m_eap_method), event_data::blank);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,16 +85,58 @@ EAP_ERROR* eap::module::make_error(_In_ DWORD dwErrorCode, _In_opt_z_ LPCWSTR ps
|
||||
}
|
||||
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
{
|
||||
sec_runtime_error *e = dynamic_cast<sec_runtime_error*>(&err);
|
||||
if (e)
|
||||
return make_error(SCODE_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)
|
||||
{
|
||||
return (BYTE*)HeapAlloc(m_heap, 0, 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);
|
||||
}
|
||||
|
||||
@@ -122,20 +164,22 @@ void eap::module::log_error(_In_ const EAP_ERROR *err) const
|
||||
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_EAP_ERROR, (ULONG)evt_desc.size(), evt_desc.data());
|
||||
m_ep.write(&EAPMETHOD_TRACE_EVT_EAP_ERROR, (ULONG)evt_desc.size(), evt_desc.data());
|
||||
}
|
||||
|
||||
|
||||
bool eap::module::encrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_ std::vector<unsigned char> &enc, _Out_ EAP_ERROR **ppEapError, _Out_opt_ HCRYPTHASH hHash) const
|
||||
eap::config_method* eap::module::make_config_method()
|
||||
{
|
||||
assert(ppEapError);
|
||||
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)) {
|
||||
*ppEapError = make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptGenKey failed."));
|
||||
return false;
|
||||
}
|
||||
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);
|
||||
@@ -145,22 +189,16 @@ bool eap::module::encrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void
|
||||
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)) {
|
||||
*ppEapError = make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptDecodeObjectEx failed."));
|
||||
return false;
|
||||
}
|
||||
if (!key_rsa.import_public(hProv, X509_ASN_ENCODING, keyinfo_data.get())) {
|
||||
*ppEapError = make_error(GetLastError(), _T(__FUNCTION__) _T(" Public key import failed."));
|
||||
return false;
|
||||
}
|
||||
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)) {
|
||||
*ppEapError = make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptExportKey failed."));
|
||||
return false;
|
||||
}
|
||||
enc.assign(buf.begin(), buf.end());
|
||||
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);
|
||||
@@ -169,38 +207,116 @@ bool eap::module::encrypt(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void
|
||||
buf.reserve((size + dwBlockLen) / dwBlockLen * dwBlockLen);
|
||||
|
||||
// Encrypt the data using AES key.
|
||||
if (!CryptEncrypt(key_aes, hHash, TRUE, 0, buf)) {
|
||||
*ppEapError = make_error(GetLastError(), _T(__FUNCTION__) _T(" CryptEncrypt failed."));
|
||||
return false;
|
||||
}
|
||||
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 true;
|
||||
return enc;
|
||||
}
|
||||
|
||||
|
||||
bool eap::module::encrypt_md5(_In_ HCRYPTPROV hProv, _In_bytecount_(size) const void *data, _In_ size_t size, _Out_ std::vector<unsigned char> &enc, _Out_ EAP_ERROR **ppEapError) const
|
||||
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)) {
|
||||
*ppEapError = make_error(GetLastError(), _T(__FUNCTION__) _T(" Creating MD5 hash failed."));
|
||||
return false;
|
||||
}
|
||||
if (!hash.create(hProv, CALG_MD5))
|
||||
throw win_runtime_error(__FUNCTION__ " Creating MD5 hash failed.");
|
||||
|
||||
// Encrypt data.
|
||||
if (!encrypt(hProv, data, size, enc, ppEapError, hash))
|
||||
return false;
|
||||
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)) {
|
||||
*ppEapError = make_error(GetLastError(), _T(__FUNCTION__) _T(" Calculating MD5 hash failed."));
|
||||
return false;
|
||||
}
|
||||
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 true;
|
||||
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.");
|
||||
}
|
||||
|
@@ -22,14 +22,14 @@
|
||||
|
||||
#include "../include/Config.h"
|
||||
#include "../include/Credentials.h"
|
||||
#include "../include/Method.h"
|
||||
#include "../include/Module.h"
|
||||
#include "../include/Session.h"
|
||||
|
||||
#include "../include/EAP.h"
|
||||
#include "../include/EAPSerial.h"
|
||||
#include "../include/EAPXML.h"
|
||||
|
||||
#include <WinStd/Cred.h>
|
||||
#include <WinStd/ETW.h>
|
||||
#include <WinStd/Sec.h>
|
||||
|
||||
#include <EventsETW.h>
|
||||
|
@@ -81,12 +81,14 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\include\EAP_UI.h" />
|
||||
<ClInclude Include="..\include\Module.h" />
|
||||
<ClInclude Include="..\include\wxEAP_UIBase.h" />
|
||||
<ClInclude Include="..\res\wxEAP_UI.h" />
|
||||
<ClInclude Include="..\src\StdAfx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\res\wxEAP_UI.cpp" />
|
||||
<ClCompile Include="..\src\EAP_UI.cpp" />
|
||||
<ClCompile Include="..\src\Module.cpp" />
|
||||
<ClCompile Include="..\src\StdAfx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
|
@@ -27,6 +27,9 @@
|
||||
<ClInclude Include="..\include\Module.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\include\wxEAP_UIBase.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\StdAfx.cpp">
|
||||
@@ -38,6 +41,9 @@
|
||||
<ClCompile Include="..\res\wxEAP_UI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\Module.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\res\wxEAP_UI.fbp">
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -21,11 +21,11 @@
|
||||
namespace eap
|
||||
{
|
||||
///
|
||||
/// EAP UI peer base abstract class template
|
||||
/// EAP UI peer base abstract class
|
||||
///
|
||||
/// A group of methods all EAP UI peers must or should implement.
|
||||
///
|
||||
template <class _Tmeth, class _Tid, class _Tint, class _Tintres> class peer_ui;
|
||||
class peer_ui;
|
||||
}
|
||||
|
||||
#pragma once
|
||||
@@ -35,75 +35,79 @@ namespace eap
|
||||
|
||||
namespace eap
|
||||
{
|
||||
template <class _Tcfg, class _Tid, class _Tint, class _Tintres>
|
||||
class peer_ui : public peer_base<_Tcfg, _Tid, _Tint, _Tintres>
|
||||
class peer_ui : public module
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a EAP UI peer module for the given EAP type
|
||||
///
|
||||
peer_ui(_In_ type_t eap_method) : peer_base<_Tcfg, _Tid, _Tint, _Tintres>(eap_method) {}
|
||||
/// \param[in] eap_method EAP method type ID
|
||||
///
|
||||
peer_ui(_In_ winstd::eap_type_t eap_method);
|
||||
|
||||
///
|
||||
/// Converts XML into the configuration BLOB.
|
||||
///
|
||||
/// \sa [EapPeerConfigXml2Blob function](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363602.aspx)
|
||||
///
|
||||
virtual void config_xml2blob(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_ IXMLDOMNode *pConfigRoot,
|
||||
_Inout_ BYTE **pConnectionDataOut,
|
||||
_Inout_ DWORD *pdwConnectionDataOutSize) = 0;
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
virtual void config_blob2xml(
|
||||
_In_ DWORD dwFlags,
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_ IXMLDOMDocument *pDoc,
|
||||
_In_ IXMLDOMNode *pConfigRoot) = 0;
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \param[in] hwndParent Parent window
|
||||
/// \param[inout] cfg Configuration to edit
|
||||
/// \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.
|
||||
///
|
||||
virtual bool invoke_config_ui(
|
||||
virtual void invoke_config_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_Inout_ config_type &cfg,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
_In_count_(dwConnectionDataInSize) const BYTE *pConnectionDataIn,
|
||||
_In_ DWORD dwConnectionDataInSize,
|
||||
_Inout_ BYTE **ppConnectionDataOut,
|
||||
_Inout_ DWORD *pdwConnectionDataOutSize) = 0;
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \param[in] hwndParent Parent window
|
||||
/// \param[in] dwFlags Flags passed to `EapPeerInvokeIdentityUI()` call
|
||||
/// \param[inout] cfg Configuration
|
||||
/// \param[inout] usr User data to edit
|
||||
/// \param[out] ppwszIdentity Pointer to user identity. Free using `module::free_memory()`.
|
||||
/// \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.
|
||||
///
|
||||
virtual bool invoke_identity_ui(
|
||||
virtual void invoke_identity_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_In_ DWORD dwFlags,
|
||||
_Inout_ config_type &cfg,
|
||||
_Inout_ identity_type &usr,
|
||||
_Out_ LPWSTR *ppwszIdentity,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
_In_count_(dwConnectionDataSize) const BYTE *pConnectionData,
|
||||
_In_ DWORD dwConnectionDataSize,
|
||||
_In_count_(dwUserDataSize) const BYTE *pUserData,
|
||||
_In_ DWORD dwUserDataSize,
|
||||
_Inout_ BYTE **ppUserDataOut,
|
||||
_Inout_ DWORD *pdwUserDataOutSize,
|
||||
_Inout_ LPWSTR *ppwszIdentity) = 0;
|
||||
|
||||
///
|
||||
/// 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)
|
||||
///
|
||||
/// \param[in] hwndParent Parent window
|
||||
/// \param[in] req Interactive request
|
||||
/// \param[out] res Interactive response
|
||||
/// \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.
|
||||
///
|
||||
virtual bool invoke_interactive_ui(
|
||||
virtual void invoke_interactive_ui(
|
||||
_In_ HWND hwndParent,
|
||||
_In_ const interactive_request_type &req,
|
||||
_Out_ interactive_response_type &res,
|
||||
_Out_ EAP_ERROR **ppEapError) = 0;
|
||||
_In_count_(dwUIContextDataSize) const BYTE *pUIContextData,
|
||||
_In_ DWORD dwUIContextDataSize,
|
||||
_Inout_ BYTE **ppDataFromInteractiveUI,
|
||||
_Inout_ DWORD *pdwDataFromInteractiveUISize) = 0;
|
||||
};
|
||||
}
|
||||
|
48
lib/EAPBase_UI/include/wxEAP_UIBase.h
Normal file
48
lib/EAPBase_UI/include/wxEAP_UIBase.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/>.
|
||||
*/
|
||||
|
||||
///
|
||||
/// Base class for all credential entry panel that must provide "Remember" credentials checkbox
|
||||
///
|
||||
class wxEAPCredentialsPanelBase;
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/panel.h>
|
||||
|
||||
|
||||
class wxEAPCredentialsPanelBase : public wxPanel
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs a wxPanel with "Remember" credentials checkbox
|
||||
///
|
||||
wxEAPCredentialsPanelBase(wxWindow *parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
const wxString& name = wxPanelNameStr) : wxPanel(parent, winid, pos, size, style, name)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void SetRemember(bool val) = 0;
|
||||
virtual bool GetRemember() const = 0;
|
||||
};
|
@@ -28,6 +28,30 @@ wxEAPConfigDialogBase::wxEAPConfigDialogBase( wxWindow* parent, wxWindowID id, c
|
||||
|
||||
sb_content->Add( m_providers, 1, wxEXPAND|wxALL, 10 );
|
||||
|
||||
wxBoxSizer* sb_bottom_horiz;
|
||||
sb_bottom_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* sb_bottom_horiz_inner;
|
||||
sb_bottom_horiz_inner = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_prov_add = new wxButton( this, wxID_ANY, _("+"), wxDefaultPosition, wxSize( 30,-1 ), 0 );
|
||||
m_prov_add->SetToolTip( _("Adds new provider") );
|
||||
|
||||
sb_bottom_horiz_inner->Add( m_prov_add, 0, wxALL, 5 );
|
||||
|
||||
m_prov_remove = new wxButton( this, wxID_ANY, _("-"), wxDefaultPosition, wxSize( 30,-1 ), 0 );
|
||||
m_prov_remove->SetToolTip( _("Removes selected provider") );
|
||||
|
||||
sb_bottom_horiz_inner->Add( m_prov_remove, 0, wxALL, 5 );
|
||||
|
||||
m_prov_advanced = new wxButton( this, wxID_ANY, _("Advanced..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_prov_advanced->SetToolTip( _("Opens dialog with provider settings") );
|
||||
|
||||
sb_bottom_horiz_inner->Add( m_prov_advanced, 0, wxALL, 5 );
|
||||
|
||||
|
||||
sb_bottom_horiz->Add( sb_bottom_horiz_inner, 1, wxEXPAND, 5 );
|
||||
|
||||
m_buttons = new wxStdDialogButtonSizer();
|
||||
m_buttonsOK = new wxButton( this, wxID_OK );
|
||||
m_buttons->AddButton( m_buttonsOK );
|
||||
@@ -35,7 +59,10 @@ wxEAPConfigDialogBase::wxEAPConfigDialogBase( wxWindow* parent, wxWindowID id, c
|
||||
m_buttons->AddButton( m_buttonsCancel );
|
||||
m_buttons->Realize();
|
||||
|
||||
sb_content->Add( m_buttons, 0, wxEXPAND|wxALL, 5 );
|
||||
sb_bottom_horiz->Add( m_buttons, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
sb_content->Add( sb_bottom_horiz, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_content );
|
||||
@@ -44,16 +71,24 @@ wxEAPConfigDialogBase::wxEAPConfigDialogBase( wxWindow* parent, wxWindowID id, c
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPConfigDialogBase::OnInitDialog ) );
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPConfigDialogBase::OnUpdateUI ) );
|
||||
m_prov_add->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPConfigDialogBase::OnProvAdd ), NULL, this );
|
||||
m_prov_remove->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPConfigDialogBase::OnProvRemove ), NULL, this );
|
||||
m_prov_advanced->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPConfigDialogBase::OnProvAdvanced ), NULL, this );
|
||||
}
|
||||
|
||||
wxEAPConfigDialogBase::~wxEAPConfigDialogBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPConfigDialogBase::OnInitDialog ) );
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPConfigDialogBase::OnUpdateUI ) );
|
||||
m_prov_add->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPConfigDialogBase::OnProvAdd ), NULL, this );
|
||||
m_prov_remove->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPConfigDialogBase::OnProvRemove ), NULL, this );
|
||||
m_prov_advanced->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPConfigDialogBase::OnProvAdvanced ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
wxEAPCredentialsDialogBase::wxEAPCredentialsDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
wxEAPGeneralDialogBase::wxEAPGeneralDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
@@ -84,13 +119,55 @@ wxEAPCredentialsDialogBase::wxEAPCredentialsDialogBase( wxWindow* parent, wxWind
|
||||
sb_content->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPCredentialsDialogBase::OnInitDialog ) );
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPGeneralDialogBase::OnInitDialog ) );
|
||||
}
|
||||
|
||||
wxEAPCredentialsDialogBase::~wxEAPCredentialsDialogBase()
|
||||
wxEAPGeneralDialogBase::~wxEAPGeneralDialogBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPCredentialsDialogBase::OnInitDialog ) );
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPGeneralDialogBase::OnInitDialog ) );
|
||||
|
||||
}
|
||||
|
||||
wxEAPCredentialsConnectionDialogBase::wxEAPCredentialsConnectionDialogBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* sb_content;
|
||||
sb_content = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_banner = new wxEAPBannerPanel( this );
|
||||
|
||||
sb_content->Add( m_banner, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_providers = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_providers->SetExtraStyle( wxWS_EX_VALIDATE_RECURSIVELY );
|
||||
|
||||
|
||||
sb_content->Add( m_providers, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_buttons = new wxStdDialogButtonSizer();
|
||||
m_buttonsOK = new wxButton( this, wxID_OK );
|
||||
m_buttons->AddButton( m_buttonsOK );
|
||||
m_buttonsCancel = new wxButton( this, wxID_CANCEL );
|
||||
m_buttons->AddButton( m_buttonsCancel );
|
||||
m_buttons->Realize();
|
||||
|
||||
sb_content->Add( m_buttons, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_content );
|
||||
this->Layout();
|
||||
sb_content->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPCredentialsConnectionDialogBase::OnInitDialog ) );
|
||||
}
|
||||
|
||||
wxEAPCredentialsConnectionDialogBase::~wxEAPCredentialsConnectionDialogBase()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( wxEAPCredentialsConnectionDialogBase::OnInitDialog ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -99,51 +176,51 @@ wxEAPBannerPanelBase::wxEAPBannerPanelBase( wxWindow* parent, wxWindowID id, con
|
||||
this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) );
|
||||
this->SetMinSize( wxSize( -1,48 ) );
|
||||
|
||||
wxBoxSizer* sc_content;
|
||||
sc_content = new wxBoxSizer( wxVERTICAL );
|
||||
wxBoxSizer* sb_content;
|
||||
sb_content = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_title = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT );
|
||||
m_title->Wrap( -1 );
|
||||
m_title->SetFont( wxFont( 18, 70, 90, 90, false, wxEmptyString ) );
|
||||
m_title->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT ) );
|
||||
|
||||
sc_content->Add( m_title, 0, wxALL|wxEXPAND, 5 );
|
||||
sb_content->Add( m_title, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sc_content );
|
||||
this->SetSizer( sb_content );
|
||||
this->Layout();
|
||||
sc_content->Fit( this );
|
||||
sb_content->Fit( this );
|
||||
}
|
||||
|
||||
wxEAPBannerPanelBase::~wxEAPBannerPanelBase()
|
||||
{
|
||||
}
|
||||
|
||||
wxEAPProviderLockedBase::wxEAPProviderLockedBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
wxEAPNotePanelBase::wxEAPNotePanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_INFOBK ) );
|
||||
|
||||
wxBoxSizer* sb_provider_locked_horiz;
|
||||
sb_provider_locked_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
wxBoxSizer* sb_note_horiz;
|
||||
sb_note_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_provider_locked_icon = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_provider_locked_horiz->Add( m_provider_locked_icon, 0, wxALL, 5 );
|
||||
m_note_icon = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_note_horiz->Add( m_note_icon, 0, wxALL, 5 );
|
||||
|
||||
m_provider_locked_vert = new wxBoxSizer( wxVERTICAL );
|
||||
m_note_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_provider_locked_label = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_locked_label->Wrap( 452 );
|
||||
m_provider_locked_vert->Add( m_provider_locked_label, 0, wxALL|wxEXPAND, 5 );
|
||||
m_note_label = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_note_label->Wrap( 449 );
|
||||
m_note_vert->Add( m_note_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_provider_locked_horiz->Add( m_provider_locked_vert, 1, wxEXPAND, 5 );
|
||||
sb_note_horiz->Add( m_note_vert, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_provider_locked_horiz );
|
||||
this->SetSizer( sb_note_horiz );
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
wxEAPProviderLockedBase::~wxEAPProviderLockedBase()
|
||||
wxEAPNotePanelBase::~wxEAPNotePanelBase()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -162,7 +239,7 @@ wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* pare
|
||||
sb_credentials_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_credentials_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Manage credentials used to connect."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_credentials_label->Wrap( 446 );
|
||||
m_credentials_label->Wrap( 440 );
|
||||
sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sb_cred_radio;
|
||||
@@ -180,7 +257,7 @@ wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* pare
|
||||
sz_own_inner->Add( m_own, 2, wxEXPAND, 5 );
|
||||
|
||||
m_own_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
|
||||
m_own_identity->SetToolTip( _("Enter your user name here (user@domain.org, DOMAINUser, etc.)") );
|
||||
m_own_identity->SetToolTip( _("Your credentials loaded from Windows Credential Manager") );
|
||||
|
||||
sz_own_inner->Add( m_own_identity, 3, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
@@ -218,7 +295,7 @@ wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* pare
|
||||
sz_preshared_inner->Add( m_preshared, 2, wxEXPAND, 5 );
|
||||
|
||||
m_preshared_identity = new wxTextCtrl( sb_credentials->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
|
||||
m_preshared_identity->SetToolTip( _("Enter your user name here (user@domain.org, DOMAINUser, etc.)") );
|
||||
m_preshared_identity->SetToolTip( _("Common (pre-shared) credentials") );
|
||||
|
||||
sz_preshared_inner->Add( m_preshared_identity, 3, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
@@ -251,12 +328,14 @@ wxEAPCredentialsConfigPanelBase::wxEAPCredentialsConfigPanelBase( wxWindow* pare
|
||||
|
||||
this->SetSizer( sb_credentials );
|
||||
this->Layout();
|
||||
m_timer_own.SetOwner( this, wxID_ANY );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( wxEAPCredentialsConfigPanelBase::OnUpdateUI ) );
|
||||
m_own_clear->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearOwn ), NULL, this );
|
||||
m_own_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetOwn ), NULL, this );
|
||||
m_preshared_set->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetPreshared ), NULL, this );
|
||||
this->Connect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerOwn ) );
|
||||
}
|
||||
|
||||
wxEAPCredentialsConfigPanelBase::~wxEAPCredentialsConfigPanelBase()
|
||||
@@ -266,10 +345,11 @@ wxEAPCredentialsConfigPanelBase::~wxEAPCredentialsConfigPanelBase()
|
||||
m_own_clear->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnClearOwn ), NULL, this );
|
||||
m_own_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetOwn ), NULL, this );
|
||||
m_preshared_set->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( wxEAPCredentialsConfigPanelBase::OnSetPreshared ), NULL, this );
|
||||
this->Disconnect( wxID_ANY, wxEVT_TIMER, wxTimerEventHandler( wxEAPCredentialsConfigPanelBase::OnTimerOwn ) );
|
||||
|
||||
}
|
||||
|
||||
wxPasswordCredentialsPanelBase::wxPasswordCredentialsPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
wxEAPCredentialsPassPanelBase::wxEAPCredentialsPassPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxEAPCredentialsPanelBase( parent, id, pos, size, style )
|
||||
{
|
||||
wxStaticBoxSizer* sb_credentials;
|
||||
sb_credentials = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Client Credentials") ), wxVERTICAL );
|
||||
@@ -284,7 +364,7 @@ wxPasswordCredentialsPanelBase::wxPasswordCredentialsPanelBase( wxWindow* parent
|
||||
sb_credentials_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_credentials_label = new wxStaticText( sb_credentials->GetStaticBox(), wxID_ANY, _("Please provide your user ID and password."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_credentials_label->Wrap( 446 );
|
||||
m_credentials_label->Wrap( 440 );
|
||||
sb_credentials_vert->Add( m_credentials_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxFlexGridSizer* sb_credentials_tbl;
|
||||
@@ -330,6 +410,220 @@ wxPasswordCredentialsPanelBase::wxPasswordCredentialsPanelBase( wxWindow* parent
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
wxPasswordCredentialsPanelBase::~wxPasswordCredentialsPanelBase()
|
||||
wxEAPCredentialsPassPanelBase::~wxEAPCredentialsPassPanelBase()
|
||||
{
|
||||
}
|
||||
|
||||
wxEAPProviderContactInfoPanelBase::wxEAPProviderContactInfoPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxStaticBoxSizer* sb_provider_contact;
|
||||
sb_provider_contact = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Your Organization") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* sb_provider_contact_horiz;
|
||||
sb_provider_contact_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_provider_contact_icon = new wxStaticBitmap( sb_provider_contact->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_provider_contact_horiz->Add( m_provider_contact_icon, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_provider_contact_vert;
|
||||
sb_provider_contact_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_provider_contact_label = new wxStaticText( sb_provider_contact->GetStaticBox(), wxID_ANY, _("Describe your organization to customize user prompts. When organization is introduced, end-users find program messages easier to understand and act."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_contact_label->Wrap( 440 );
|
||||
sb_provider_contact_vert->Add( m_provider_contact_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sb_provider_name;
|
||||
sb_provider_name = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_provider_name_label = new wxStaticText( sb_provider_contact->GetStaticBox(), wxID_ANY, _("Your organization &name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_name_label->Wrap( -1 );
|
||||
sb_provider_name->Add( m_provider_name_label, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_provider_name = new wxTextCtrl( sb_provider_contact->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_name->SetToolTip( _("Your organization name as it will appear on helpdesk contact notifications") );
|
||||
|
||||
sb_provider_name->Add( m_provider_name, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_provider_name_note = new wxStaticText( sb_provider_contact->GetStaticBox(), wxID_ANY, _("(Keep it short, please)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_name_note->Wrap( -1 );
|
||||
sb_provider_name->Add( m_provider_name_note, 0, wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
sb_provider_contact_vert->Add( sb_provider_name, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_provider_helpdesk;
|
||||
sb_provider_helpdesk = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_provider_helpdesk_label = new wxStaticText( sb_provider_contact->GetStaticBox(), wxID_ANY, _("Helpdesk contact &information:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_helpdesk_label->Wrap( -1 );
|
||||
sb_provider_helpdesk->Add( m_provider_helpdesk_label, 0, wxBOTTOM, 5 );
|
||||
|
||||
wxFlexGridSizer* sb_provider_helpdesk_inner;
|
||||
sb_provider_helpdesk_inner = new wxFlexGridSizer( 0, 2, 0, 0 );
|
||||
sb_provider_helpdesk_inner->AddGrowableCol( 1 );
|
||||
sb_provider_helpdesk_inner->SetFlexibleDirection( wxBOTH );
|
||||
sb_provider_helpdesk_inner->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_provider_web_icon = new wxStaticText( sb_provider_contact->GetStaticBox(), wxID_ANY, _("¶"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_web_icon->Wrap( -1 );
|
||||
m_provider_web_icon->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Wingdings") ) );
|
||||
|
||||
sb_provider_helpdesk_inner->Add( m_provider_web_icon, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_provider_web = new wxTextCtrl( sb_provider_contact->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_web->SetToolTip( _("Your helpdesk website address") );
|
||||
|
||||
sb_provider_helpdesk_inner->Add( m_provider_web, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
|
||||
|
||||
m_provider_email_icon = new wxStaticText( sb_provider_contact->GetStaticBox(), wxID_ANY, _("*"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_email_icon->Wrap( -1 );
|
||||
m_provider_email_icon->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Wingdings") ) );
|
||||
|
||||
sb_provider_helpdesk_inner->Add( m_provider_email_icon, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
|
||||
|
||||
m_provider_email = new wxTextCtrl( sb_provider_contact->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_email->SetToolTip( _("Your helpdesk e-mail address") );
|
||||
|
||||
sb_provider_helpdesk_inner->Add( m_provider_email, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
|
||||
|
||||
m_provider_phone_icon = new wxStaticText( sb_provider_contact->GetStaticBox(), wxID_ANY, _(")"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_phone_icon->Wrap( -1 );
|
||||
m_provider_phone_icon->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxT("Wingdings") ) );
|
||||
|
||||
sb_provider_helpdesk_inner->Add( m_provider_phone_icon, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
|
||||
|
||||
m_provider_phone = new wxTextCtrl( sb_provider_contact->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_phone->SetToolTip( _("Your helpdesk phone number") );
|
||||
|
||||
sb_provider_helpdesk_inner->Add( m_provider_phone, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sb_provider_helpdesk->Add( sb_provider_helpdesk_inner, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_provider_contact_vert->Add( sb_provider_helpdesk, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
sb_provider_contact_horiz->Add( sb_provider_contact_vert, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_provider_contact->Add( sb_provider_contact_horiz, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_provider_contact );
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
wxEAPProviderContactInfoPanelBase::~wxEAPProviderContactInfoPanelBase()
|
||||
{
|
||||
}
|
||||
|
||||
wxEAPProviderIDPanelBase::wxEAPProviderIDPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxStaticBoxSizer* sb_provider_id;
|
||||
sb_provider_id = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Provider Unique Identifier") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* sb_provider_id_horiz;
|
||||
sb_provider_id_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_provider_id_icon = new wxStaticBitmap( sb_provider_id->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_provider_id_horiz->Add( m_provider_id_icon, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_provider_id_vert;
|
||||
sb_provider_id_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_provider_id_label_outer = new wxStaticText( sb_provider_id->GetStaticBox(), wxID_ANY, _("Assign your organization a unique ID to allow sharing the same credential set across different network profiles."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_id_label_outer->Wrap( 440 );
|
||||
sb_provider_id_vert->Add( m_provider_id_label_outer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sb_provider_namespace;
|
||||
sb_provider_namespace = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_provider_namespace_label = new wxStaticText( sb_provider_id->GetStaticBox(), wxID_ANY, _("&Namespace:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_namespace_label->Wrap( -1 );
|
||||
sb_provider_namespace->Add( m_provider_namespace_label, 0, wxBOTTOM, 5 );
|
||||
|
||||
wxString m_provider_namespaceChoices[] = { _("urn:RFC4282:realm"), _("urn:uuid") };
|
||||
int m_provider_namespaceNChoices = sizeof( m_provider_namespaceChoices ) / sizeof( wxString );
|
||||
m_provider_namespace = new wxChoice( sb_provider_id->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_provider_namespaceNChoices, m_provider_namespaceChoices, 0 );
|
||||
m_provider_namespace->SetSelection( 0 );
|
||||
sb_provider_namespace->Add( m_provider_namespace, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_provider_id_vert->Add( sb_provider_namespace, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_provider_id_inner;
|
||||
sb_provider_id_inner = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_provider_id_label = new wxStaticText( sb_provider_id->GetStaticBox(), wxID_ANY, _("Provider unique &identifier:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_id_label->Wrap( -1 );
|
||||
sb_provider_id_inner->Add( m_provider_id_label, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_provider_id = new wxTextCtrl( sb_provider_id->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_id->SetToolTip( _("Your organization ID to assign same credentials from other profiles") );
|
||||
|
||||
sb_provider_id_inner->Add( m_provider_id, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_provider_id_vert->Add( sb_provider_id_inner, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
sb_provider_id_horiz->Add( sb_provider_id_vert, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_provider_id->Add( sb_provider_id_horiz, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_provider_id );
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
wxEAPProviderIDPanelBase::~wxEAPProviderIDPanelBase()
|
||||
{
|
||||
}
|
||||
|
||||
wxEAPProviderLockPanelBase::wxEAPProviderLockPanelBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
wxStaticBoxSizer* sb_provider_lock;
|
||||
sb_provider_lock = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Configuration Lock") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* sb_provider_lock_horiz;
|
||||
sb_provider_lock_horiz = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_provider_lock_icon = new wxStaticBitmap( sb_provider_lock->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_provider_lock_horiz->Add( m_provider_lock_icon, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sb_provider_lock_vert;
|
||||
sb_provider_lock_vert = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_provider_lock_label = new wxStaticText( sb_provider_lock->GetStaticBox(), wxID_ANY, _("Your configuration can be locked to prevent accidental modification by end-users. Users will only be allowed to enter credentials."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_lock_label->Wrap( 440 );
|
||||
sb_provider_lock_vert->Add( m_provider_lock_label, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sb_provider_lock_inner;
|
||||
sb_provider_lock_inner = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_provider_lock = new wxCheckBox( sb_provider_lock->GetStaticBox(), wxID_ANY, _("&Lock this configuration and prevent any further modification via user interface."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sb_provider_lock_inner->Add( m_provider_lock, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
m_provider_lock_note = new wxStaticText( sb_provider_lock->GetStaticBox(), wxID_ANY, _("(Warning: Once locked, you can not revert using this dialog!)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_provider_lock_note->Wrap( -1 );
|
||||
sb_provider_lock_inner->Add( m_provider_lock_note, 0, wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
sb_provider_lock_vert->Add( sb_provider_lock_inner, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
|
||||
sb_provider_lock_horiz->Add( sb_provider_lock_vert, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sb_provider_lock->Add( sb_provider_lock_horiz, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( sb_provider_lock );
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
wxEAPProviderLockPanelBase::~wxEAPProviderLockPanelBase()
|
||||
{
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,9 @@
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class wxEAPCredentialsPanelBase;
|
||||
|
||||
#include "../include/wxEAP_UIBase.h"
|
||||
class wxEAPBannerPanel;
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
@@ -18,8 +21,8 @@ class wxEAPBannerPanel;
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/panel.h>
|
||||
@@ -30,7 +33,9 @@ class wxEAPBannerPanel;
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/timer.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/choice.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -44,25 +49,32 @@ class wxEAPConfigDialogBase : public wxDialog
|
||||
protected:
|
||||
wxEAPBannerPanel *m_banner;
|
||||
wxNotebook* m_providers;
|
||||
wxButton* m_prov_add;
|
||||
wxButton* m_prov_remove;
|
||||
wxButton* m_prov_advanced;
|
||||
wxStdDialogButtonSizer* m_buttons;
|
||||
wxButton* m_buttonsOK;
|
||||
wxButton* m_buttonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnProvAdd( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnProvRemove( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnProvAdvanced( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
wxEAPConfigDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EAP Method Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
||||
wxEAPConfigDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EAP Connection Configuration"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~wxEAPConfigDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPCredentialsDialogBase
|
||||
/// Class wxEAPGeneralDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPCredentialsDialogBase : public wxDialog
|
||||
class wxEAPGeneralDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -79,8 +91,33 @@ class wxEAPCredentialsDialogBase : public wxDialog
|
||||
|
||||
public:
|
||||
|
||||
wxEAPCredentialsDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EAP Credentials"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~wxEAPCredentialsDialogBase();
|
||||
wxEAPGeneralDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~wxEAPGeneralDialogBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPCredentialsConnectionDialogBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPCredentialsConnectionDialogBase : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxEAPBannerPanel *m_banner;
|
||||
wxStdDialogButtonSizer* m_buttons;
|
||||
wxButton* m_buttonsOK;
|
||||
wxButton* m_buttonsCancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
wxNotebook* m_providers;
|
||||
|
||||
wxEAPCredentialsConnectionDialogBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("EAP Credentials"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~wxEAPCredentialsConnectionDialogBase();
|
||||
|
||||
};
|
||||
|
||||
@@ -102,21 +139,21 @@ class wxEAPBannerPanelBase : public wxPanel
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPProviderLockedBase
|
||||
/// Class wxEAPNotePanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPProviderLockedBase : public wxPanel
|
||||
class wxEAPNotePanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_provider_locked_icon;
|
||||
wxBoxSizer* m_provider_locked_vert;
|
||||
wxStaticText* m_provider_locked_label;
|
||||
wxStaticBitmap* m_note_icon;
|
||||
wxBoxSizer* m_note_vert;
|
||||
wxStaticText* m_note_label;
|
||||
|
||||
public:
|
||||
|
||||
wxEAPProviderLockedBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxSIMPLE_BORDER|wxTAB_TRAVERSAL );
|
||||
~wxEAPProviderLockedBase();
|
||||
wxEAPNotePanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxSIMPLE_BORDER|wxTAB_TRAVERSAL );
|
||||
~wxEAPNotePanelBase();
|
||||
|
||||
};
|
||||
|
||||
@@ -137,12 +174,14 @@ class wxEAPCredentialsConfigPanelBase : public wxPanel
|
||||
wxRadioButton* m_preshared;
|
||||
wxTextCtrl* m_preshared_identity;
|
||||
wxButton* m_preshared_set;
|
||||
wxTimer m_timer_own;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void OnClearOwn( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSetOwn( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnSetPreshared( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnTimerOwn( wxTimerEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
@@ -153,9 +192,9 @@ class wxEAPCredentialsConfigPanelBase : public wxPanel
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxPasswordCredentialsPanelBase
|
||||
/// Class wxEAPCredentialsPassPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxPasswordCredentialsPanelBase : public wxPanel
|
||||
class wxEAPCredentialsPassPanelBase : public wxEAPCredentialsPanelBase
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -170,8 +209,78 @@ class wxPasswordCredentialsPanelBase : public wxPanel
|
||||
|
||||
public:
|
||||
|
||||
wxPasswordCredentialsPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxPasswordCredentialsPanelBase();
|
||||
wxEAPCredentialsPassPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxEAPCredentialsPassPanelBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPProviderContactInfoPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPProviderContactInfoPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_provider_contact_icon;
|
||||
wxStaticText* m_provider_contact_label;
|
||||
wxStaticText* m_provider_name_label;
|
||||
wxTextCtrl* m_provider_name;
|
||||
wxStaticText* m_provider_name_note;
|
||||
wxStaticText* m_provider_helpdesk_label;
|
||||
wxStaticText* m_provider_web_icon;
|
||||
wxTextCtrl* m_provider_web;
|
||||
wxStaticText* m_provider_email_icon;
|
||||
wxTextCtrl* m_provider_email;
|
||||
wxStaticText* m_provider_phone_icon;
|
||||
wxTextCtrl* m_provider_phone;
|
||||
|
||||
public:
|
||||
|
||||
wxEAPProviderContactInfoPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxEAPProviderContactInfoPanelBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPProviderIDPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPProviderIDPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_provider_id_icon;
|
||||
wxStaticText* m_provider_id_label_outer;
|
||||
wxStaticText* m_provider_namespace_label;
|
||||
wxChoice* m_provider_namespace;
|
||||
wxStaticText* m_provider_id_label;
|
||||
wxTextCtrl* m_provider_id;
|
||||
|
||||
public:
|
||||
|
||||
wxEAPProviderIDPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxEAPProviderIDPanelBase();
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class wxEAPProviderLockPanelBase
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class wxEAPProviderLockPanelBase : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticBitmap* m_provider_lock_icon;
|
||||
wxStaticText* m_provider_lock_label;
|
||||
wxCheckBox* m_provider_lock;
|
||||
wxStaticText* m_provider_lock_note;
|
||||
|
||||
public:
|
||||
|
||||
wxEAPProviderLockPanelBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,-1 ), long style = wxTAB_TRAVERSAL );
|
||||
~wxEAPProviderLockPanelBase();
|
||||
|
||||
};
|
||||
|
||||
|
@@ -29,3 +29,581 @@ wxEAPBannerPanel::wxEAPBannerPanel(wxWindow* parent) : wxEAPBannerPanelBase(pare
|
||||
{
|
||||
m_title->SetLabelText(wxT(PRODUCT_NAME_STR));
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPBannerPanel::AcceptsFocusFromKeyboard() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPGeneralDialog
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPGeneralDialog::wxEAPGeneralDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) :
|
||||
wxEAPGeneralDialogBase(parent, id, title, pos, size, style)
|
||||
{
|
||||
// Set extra style here, as wxFormBuilder overrides all default flags.
|
||||
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
|
||||
|
||||
// Load window icons.
|
||||
#ifdef __WINDOWS__
|
||||
wxIconBundle icons;
|
||||
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)));
|
||||
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
|
||||
this->SetIcons(icons);
|
||||
#else
|
||||
this->SetIcon(wxIcon(wxICON(product.ico)));
|
||||
#endif
|
||||
|
||||
m_buttonsOK->SetDefault();
|
||||
}
|
||||
|
||||
|
||||
void wxEAPGeneralDialog::AddContent(wxPanel **contents, size_t content_count)
|
||||
{
|
||||
if (content_count) {
|
||||
for (size_t i = 0; i < content_count; i++)
|
||||
m_panels->Add(contents[i], 0, wxALL|wxEXPAND, 5);
|
||||
|
||||
this->Layout();
|
||||
this->GetSizer()->Fit(this);
|
||||
contents[0]->SetFocusFromKbd();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void wxEAPGeneralDialog::AddContent(wxPanel *content)
|
||||
{
|
||||
AddContent(&content, 1);
|
||||
}
|
||||
|
||||
|
||||
void wxEAPGeneralDialog::OnInitDialog(wxInitDialogEvent& event)
|
||||
{
|
||||
for (wxSizerItemList::compatibility_iterator panel = m_panels->GetChildren().GetFirst(); panel; panel = panel->GetNext())
|
||||
panel->GetData()->GetWindow()->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPCredentialsDialog
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPCredentialsDialog::wxEAPCredentialsDialog(const eap::config_provider &prov, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) :
|
||||
wxEAPGeneralDialog(parent, id, title, pos, size, style)
|
||||
{
|
||||
// Set banner title.
|
||||
m_banner->m_title->SetLabel(wxString::Format(_("%s Credentials"), wxEAPGetProviderName(prov.m_name).c_str()));
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPCredentialsConnectionDialog
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPCredentialsConnectionDialog::wxEAPCredentialsConnectionDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) :
|
||||
wxEAPCredentialsConnectionDialogBase(parent, id, title, pos, size, style)
|
||||
{
|
||||
// Set extra style here, as wxFormBuilder overrides all default flags.
|
||||
this->SetExtraStyle(this->GetExtraStyle() | wxWS_EX_VALIDATE_RECURSIVELY);
|
||||
|
||||
// Load window icons.
|
||||
#ifdef __WINDOWS__
|
||||
wxIconBundle icons;
|
||||
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXSMICON), ::GetSystemMetrics(SM_CYSMICON)));
|
||||
icons.AddIcon(wxIcon(wxT("product.ico"), wxBITMAP_TYPE_ICO_RESOURCE, ::GetSystemMetrics(SM_CXICON ), ::GetSystemMetrics(SM_CYICON )));
|
||||
this->SetIcons(icons);
|
||||
#else
|
||||
this->SetIcon(wxIcon(wxICON(product.ico)));
|
||||
#endif
|
||||
|
||||
// Set banner title.
|
||||
m_banner->m_title->SetLabel(_("EAP Credentials"));
|
||||
|
||||
m_buttonsOK->SetDefault();
|
||||
}
|
||||
|
||||
|
||||
void wxEAPCredentialsConnectionDialog::OnInitDialog(wxInitDialogEvent& event)
|
||||
{
|
||||
// Forward the event to child panels.
|
||||
for (wxWindowList::compatibility_iterator provider = m_providers->GetChildren().GetFirst(); provider; provider = provider->GetNext()) {
|
||||
wxWindow *prov = wxDynamicCast(provider->GetData(), wxWindow);
|
||||
if (prov)
|
||||
prov->GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPNotePanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPNotePanel::wxEAPNotePanel(wxWindow* parent) :
|
||||
m_provider_notice(NULL),
|
||||
m_help_web_label(NULL),
|
||||
m_help_web_value(NULL),
|
||||
m_help_email_label(NULL),
|
||||
m_help_email_value(NULL),
|
||||
m_help_phone_label(NULL),
|
||||
m_help_phone_value(NULL),
|
||||
wxEAPNotePanelBase(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPNotePanel::AcceptsFocusFromKeyboard() const
|
||||
{
|
||||
return m_help_web_value || m_help_email_value || m_help_phone_label;
|
||||
}
|
||||
|
||||
|
||||
void wxEAPNotePanel::CreateContactFields(const eap::config_provider &prov)
|
||||
{
|
||||
if (!prov.m_help_email.empty() || !prov.m_help_web.empty() || !prov.m_help_phone.empty()) {
|
||||
m_provider_notice = new wxStaticText(this, wxID_ANY, wxString::Format(_("For additional help and instructions, please contact %s at:"),
|
||||
!prov.m_name.empty() ? prov.m_name.c_str() : _("your provider")), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_provider_notice->Wrap(449);
|
||||
m_note_vert->Add(m_provider_notice, 0, wxUP|wxLEFT|wxRIGHT|wxEXPAND, 5);
|
||||
|
||||
wxFlexGridSizer* sb_contact_tbl;
|
||||
sb_contact_tbl = new wxFlexGridSizer(0, 2, 5, 5);
|
||||
sb_contact_tbl->AddGrowableCol(1);
|
||||
sb_contact_tbl->SetFlexibleDirection(wxBOTH);
|
||||
sb_contact_tbl->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||
|
||||
wxFont font_wingdings(-1, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("Wingdings"));
|
||||
|
||||
if (!prov.m_help_web.empty()) {
|
||||
m_help_web_label = new wxStaticText(this, wxID_ANY, wxT("\xb6"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_help_web_label->Wrap(-1);
|
||||
m_help_web_label->SetFont(font_wingdings);
|
||||
sb_contact_tbl->Add(m_help_web_label, 0, wxEXPAND|wxALIGN_TOP, 5);
|
||||
|
||||
m_help_web_value = new wxHyperlinkCtrl(this, wxID_ANY, prov.m_help_web, prov.m_help_web, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
||||
m_help_web_value->SetToolTip(_("Open the default web browser"));
|
||||
sb_contact_tbl->Add(m_help_web_value, 0, wxEXPAND|wxALIGN_TOP, 5);
|
||||
}
|
||||
|
||||
if (!prov.m_help_email.empty()) {
|
||||
m_help_email_label = new wxStaticText(this, wxID_ANY, wxT("\x2a"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_help_email_label->Wrap(-1);
|
||||
m_help_email_label->SetFont(font_wingdings);
|
||||
sb_contact_tbl->Add(m_help_email_label, 0, wxEXPAND|wxALIGN_TOP, 5);
|
||||
|
||||
m_help_email_value = new wxHyperlinkCtrl(this, wxID_ANY, prov.m_help_email, wxString(wxT("mailto:")) + prov.m_help_email, wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
||||
m_help_email_value->SetToolTip(_("Open your e-mail program"));
|
||||
sb_contact_tbl->Add(m_help_email_value, 0, wxEXPAND|wxALIGN_TOP, 5);
|
||||
}
|
||||
|
||||
if (!prov.m_help_phone.empty()) {
|
||||
m_help_phone_label = new wxStaticText(this, wxID_ANY, wxT("\x29"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_help_phone_label->Wrap(-1);
|
||||
m_help_phone_label->SetFont(font_wingdings);
|
||||
sb_contact_tbl->Add(m_help_phone_label, 0, wxEXPAND|wxALIGN_TOP, 5);
|
||||
|
||||
m_help_phone_value = new wxHyperlinkCtrl(this, wxID_ANY, prov.m_help_phone, wxString(wxT("tel:")) + GetPhoneNumber(prov.m_help_phone.c_str()), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
||||
m_help_phone_value->SetToolTip(_("Dial the phone number"));
|
||||
sb_contact_tbl->Add(m_help_phone_value, 0, wxEXPAND|wxALIGN_TOP, 5);
|
||||
}
|
||||
|
||||
m_note_vert->Add(sb_contact_tbl, 0, wxLEFT|wxRIGHT|wxDOWN|wxEXPAND, 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPProviderLockedPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPProviderLockedPanel::wxEAPProviderLockedPanel(const eap::config_provider &prov, wxWindow* parent) : wxEAPNotePanel(parent)
|
||||
{
|
||||
// Load and set icon.
|
||||
winstd::library lib_shell32;
|
||||
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(48)));
|
||||
|
||||
m_note_label->SetLabel(wxString::Format(_("%s has pre-set parts of this configuration. Those parts are locked to prevent accidental modification."),
|
||||
!prov.m_name.empty() ? prov.m_name.c_str() : _("Your provider")));
|
||||
m_note_label->Wrap(449);
|
||||
|
||||
CreateContactFields(prov);
|
||||
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPCredentialWarningPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPCredentialWarningPanel::wxEAPCredentialWarningPanel(const eap::config_provider &prov, wxWindow* parent) : wxEAPNotePanel(parent)
|
||||
{
|
||||
// Load and set icon.
|
||||
winstd::library lib_shell32;
|
||||
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
m_note_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(161)));
|
||||
|
||||
m_note_label->SetLabel(_("Previous attempt to connect failed. Please, make sure your credentials are correct, or try again later."));
|
||||
m_note_label->Wrap(449);
|
||||
|
||||
CreateContactFields(prov);
|
||||
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPConfigWindow
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPConfigWindow::wxEAPConfigWindow(eap::config_provider &prov, eap::config_method &cfg, wxWindow* parent) :
|
||||
m_prov(prov),
|
||||
m_cfg(cfg),
|
||||
wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL)
|
||||
{
|
||||
this->SetScrollRate(5, 5);
|
||||
|
||||
// Connect Events
|
||||
this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPConfigWindow::OnInitDialog));
|
||||
}
|
||||
|
||||
|
||||
wxEAPConfigWindow::~wxEAPConfigWindow()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(wxEAPConfigWindow::OnInitDialog));
|
||||
}
|
||||
|
||||
|
||||
void wxEAPConfigWindow::OnInitDialog(wxInitDialogEvent& /*event*/)
|
||||
{
|
||||
// Call TransferDataToWindow() manually, as wxScrolledWindow somehow skips that.
|
||||
TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPProviderContactInfoPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPProviderContactInfoPanel::wxEAPProviderContactInfoPanel(eap::config_provider &prov, wxWindow* parent) :
|
||||
m_prov(prov),
|
||||
wxEAPProviderContactInfoPanelBase(parent)
|
||||
{
|
||||
// Load and set icon.
|
||||
winstd::library lib_shell32;
|
||||
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
m_provider_contact_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(259)));
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPProviderContactInfoPanel::TransferDataToWindow()
|
||||
{
|
||||
m_provider_name ->SetValue(m_prov.m_name );
|
||||
m_provider_web ->SetValue(m_prov.m_help_web );
|
||||
m_provider_email->SetValue(m_prov.m_help_email);
|
||||
m_provider_phone->SetValue(m_prov.m_help_phone);
|
||||
|
||||
return wxEAPProviderContactInfoPanelBase::TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPProviderContactInfoPanel::TransferDataFromWindow()
|
||||
{
|
||||
wxCHECK(wxEAPProviderContactInfoPanelBase::TransferDataFromWindow(), false);
|
||||
|
||||
m_prov.m_name = m_provider_name ->GetValue();
|
||||
m_prov.m_help_web = m_provider_web ->GetValue();
|
||||
m_prov.m_help_email = m_provider_email->GetValue();
|
||||
m_prov.m_help_phone = m_provider_phone->GetValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPProviderIDPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPProviderIDPanel::wxEAPProviderIDPanel(eap::config_provider &prov, wxWindow* parent) :
|
||||
m_prov(prov),
|
||||
wxEAPProviderIDPanelBase(parent)
|
||||
{
|
||||
// Load and set icon.
|
||||
winstd::library lib_shell32;
|
||||
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
m_provider_id_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(29)));
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPProviderIDPanel::TransferDataToWindow()
|
||||
{
|
||||
m_provider_namespace->SetStringSelection(m_prov.m_namespace);
|
||||
m_provider_id ->SetValue(m_prov.m_id);
|
||||
|
||||
return wxEAPProviderIDPanelBase::TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPProviderIDPanel::TransferDataFromWindow()
|
||||
{
|
||||
wxCHECK(wxEAPProviderIDPanelBase::TransferDataFromWindow(), false);
|
||||
|
||||
m_prov.m_namespace = m_provider_namespace->GetStringSelection();
|
||||
m_prov.m_id = m_provider_id ->GetValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPProviderLockPanel
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPProviderLockPanel::wxEAPProviderLockPanel(eap::config_provider &prov, wxWindow* parent) :
|
||||
m_prov(prov),
|
||||
wxEAPProviderLockPanelBase(parent)
|
||||
{
|
||||
// Load and set icon.
|
||||
winstd::library lib_shell32;
|
||||
if (lib_shell32.load(_T("shell32.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE))
|
||||
m_provider_lock_icon->SetIcon(wxLoadIconFromResource(lib_shell32, MAKEINTRESOURCE(1003)));
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPProviderLockPanel::TransferDataToWindow()
|
||||
{
|
||||
m_provider_lock->SetValue(m_prov.m_read_only);
|
||||
|
||||
return wxEAPProviderLockPanelBase::TransferDataToWindow();
|
||||
}
|
||||
|
||||
|
||||
bool wxEAPProviderLockPanel::TransferDataFromWindow()
|
||||
{
|
||||
wxCHECK(wxEAPProviderLockPanelBase::TransferDataFromWindow(), false);
|
||||
|
||||
m_prov.m_read_only = m_provider_lock->GetValue();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// wxEAPConfigProvider
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
wxEAPConfigProvider::wxEAPConfigProvider(eap::config_provider &prov, wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style) :
|
||||
m_prov(prov),
|
||||
wxEAPGeneralDialog(parent, id, title, pos, size, style)
|
||||
{
|
||||
// Set banner title.
|
||||
m_banner->m_title->SetLabel(title);
|
||||
|
||||
m_contact = new wxEAPProviderContactInfoPanel(prov, this);
|
||||
AddContent(m_contact);
|
||||
|
||||
m_identity = new wxEAPProviderIDPanel(prov, this);
|
||||
AddContent(m_identity);
|
||||
|
||||
m_lock = new wxEAPProviderLockPanel(prov, this);
|
||||
AddContent(m_lock);
|
||||
|
||||
m_contact->m_provider_name->SetFocusFromKbd();
|
||||
}
|
||||
|
||||
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::monitor_ui
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::monitor_ui::monitor_ui(_In_ HINSTANCE module, _In_ const GUID &guid) :
|
||||
m_hwnd_popup(NULL)
|
||||
{
|
||||
// Verify if the monitor is already running.
|
||||
const WNDCLASSEX wnd_class_desc = {
|
||||
sizeof(WNDCLASSEX), // cbSize
|
||||
0, // style
|
||||
winproc, // lpfnWndProc
|
||||
0, // cbClsExtra
|
||||
0, // cbWndExtra
|
||||
module, // hInstance
|
||||
NULL, // hIcon
|
||||
NULL, // hCursor
|
||||
NULL, // hbrBackground
|
||||
NULL, // lpszMenuName
|
||||
_T(__FUNCTION__), // lpszClassName
|
||||
NULL // hIconSm
|
||||
};
|
||||
ATOM wnd_class = RegisterClassEx(&wnd_class_desc);
|
||||
if (!wnd_class)
|
||||
throw win_runtime_error(__FUNCTION__ " Error registering master monitor window class.");
|
||||
tstring_guid guid_str(guid);
|
||||
HWND hwnd_master = FindWindowEx(HWND_MESSAGE, NULL, (LPCTSTR)wnd_class, guid_str.c_str());
|
||||
if (hwnd_master) {
|
||||
// Another monitor is already running.
|
||||
m_is_master = false;
|
||||
|
||||
// Register slave windows class slightly different, not to include slaves in FindWindowEx().
|
||||
const WNDCLASSEX wnd_class_desc = {
|
||||
sizeof(WNDCLASSEX), // cbSize
|
||||
0, // style
|
||||
winproc, // lpfnWndProc
|
||||
0, // cbClsExtra
|
||||
0, // cbWndExtra
|
||||
module, // hInstance
|
||||
NULL, // hIcon
|
||||
NULL, // hCursor
|
||||
NULL, // hbrBackground
|
||||
NULL, // lpszMenuName
|
||||
_T(__FUNCTION__) _T("-Slave"), // lpszClassName
|
||||
NULL // hIconSm
|
||||
};
|
||||
wnd_class = RegisterClassEx(&wnd_class_desc);
|
||||
if (!wnd_class)
|
||||
throw win_runtime_error(__FUNCTION__ " Error registering slave monitor window class.");
|
||||
} else {
|
||||
// This is a fresh monitor.
|
||||
m_is_master = true;
|
||||
}
|
||||
|
||||
m_hwnd = CreateWindowEx(
|
||||
0, // dwExStyle
|
||||
(LPCTSTR)wnd_class, // lpClassName
|
||||
guid_str.c_str(), // lpWindowName
|
||||
0, // dwStyle
|
||||
0, // x
|
||||
0, // y
|
||||
0, // nWidth
|
||||
0, // nHeight
|
||||
HWND_MESSAGE, // hWndParent
|
||||
NULL, // hMenu
|
||||
module, // hInstance
|
||||
this); // lpParam
|
||||
|
||||
if (!m_is_master) {
|
||||
// Notify master we are waiting him.
|
||||
SendMessage(hwnd_master, s_msg_attach, 0, (LPARAM)m_hwnd);
|
||||
|
||||
// Slaves must pump message queue until finished.
|
||||
MSG msg;
|
||||
while (GetMessage(&msg, NULL, 0, 0) > 0) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
eap::monitor_ui::~monitor_ui()
|
||||
{
|
||||
if (m_hwnd)
|
||||
DestroyWindow(m_hwnd);
|
||||
}
|
||||
|
||||
|
||||
void eap::monitor_ui::set_popup(_In_ HWND hwnd)
|
||||
{
|
||||
m_hwnd_popup = hwnd;
|
||||
}
|
||||
|
||||
|
||||
void eap::monitor_ui::release_slaves(_In_bytecount_(size) const void *data, _In_ size_t size) const
|
||||
{
|
||||
assert(!size || data);
|
||||
|
||||
for (list<HWND>::const_iterator slave = m_slaves.begin(), slave_end = m_slaves.end(); slave != slave_end; ++slave) {
|
||||
// Get slave's PID.
|
||||
DWORD pid_slave;
|
||||
GetWindowThreadProcessId(*slave, &pid_slave);
|
||||
|
||||
// Get slave's process handle.
|
||||
process proc_slave;
|
||||
if (!proc_slave.open(PROCESS_VM_OPERATION | PROCESS_VM_WRITE, 0, pid_slave))
|
||||
continue;
|
||||
|
||||
// Allocate memory in slave's virtual memory space and save data to it.
|
||||
vmemory mem_slave;
|
||||
if (!mem_slave.alloc(proc_slave, NULL, size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE))
|
||||
continue;
|
||||
if (!WriteProcessMemory(proc_slave, mem_slave, data, size, NULL))
|
||||
continue;
|
||||
|
||||
// Notify slave. Use SendMessage(), not PostMessage(), as memory will get cleaned up.
|
||||
SendMessage(*slave, s_msg_finish, (WPARAM)size, (LPARAM)(LPVOID)mem_slave);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LRESULT eap::monitor_ui::winproc(
|
||||
_In_ UINT msg,
|
||||
_In_ WPARAM wparam,
|
||||
_In_ LPARAM lparam)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(wparam);
|
||||
|
||||
if (msg == s_msg_attach) {
|
||||
// Attach a new slave.
|
||||
assert(m_is_master);
|
||||
m_slaves.push_back((HWND)lparam);
|
||||
|
||||
if (m_hwnd_popup) {
|
||||
// Bring pop-up window up.
|
||||
if (::IsIconic(m_hwnd_popup))
|
||||
::SendMessage(m_hwnd_popup, WM_SYSCOMMAND, SC_RESTORE, 0);
|
||||
::SetActiveWindow(m_hwnd_popup);
|
||||
::SetForegroundWindow(m_hwnd_popup);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} else if (msg == s_msg_finish) {
|
||||
// Master finished.
|
||||
assert(!m_is_master);
|
||||
m_data.assign((const unsigned char*)lparam, (const unsigned char*)lparam + wparam);
|
||||
|
||||
// Finish slave too.
|
||||
DestroyWindow(m_hwnd);
|
||||
return TRUE;
|
||||
} else if (msg == WM_DESTROY) {
|
||||
// Stop the message pump.
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DefWindowProc(m_hwnd, msg, wparam, lparam);
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK eap::monitor_ui::winproc(
|
||||
_In_ HWND hwnd,
|
||||
_In_ UINT msg,
|
||||
_In_ WPARAM wparam,
|
||||
_In_ LPARAM lparam)
|
||||
{
|
||||
if (msg == WM_CREATE) {
|
||||
// Set window's user data to "this" pointer.
|
||||
const CREATESTRUCT *cs = (CREATESTRUCT*)lparam;
|
||||
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams);
|
||||
|
||||
// Forward to our handler.
|
||||
return ((eap::monitor_ui*)cs->lpCreateParams)->winproc(msg, wparam, lparam);
|
||||
} else {
|
||||
// Get "this" pointer from window's user data.
|
||||
eap::monitor_ui *_this = (eap::monitor_ui*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
|
||||
if (_this) {
|
||||
// Forward to our handler.
|
||||
return _this->winproc(msg, wparam, lparam);
|
||||
} else
|
||||
return DefWindowProc(hwnd, msg, wparam, lparam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const UINT eap::monitor_ui::s_msg_attach = RegisterWindowMessage(_T(PRODUCT_NAME_STR) _T("-Attach"));
|
||||
const UINT eap::monitor_ui::s_msg_finish = RegisterWindowMessage(_T(PRODUCT_NAME_STR) _T("-Finish"));
|
||||
|
32
lib/EAPBase_UI/src/Module.cpp
Normal file
32
lib/EAPBase_UI/src/Module.cpp
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/>.
|
||||
*/
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace winstd;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// eap::peer_ui
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
eap::peer_ui::peer_ui(_In_ eap_type_t eap_method) : module(eap_method)
|
||||
{
|
||||
}
|
Binary file not shown.
@@ -10,6 +10,7 @@
|
||||
<ItemDefinitionGroup>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>temp\Events.$(Platform).$(Configuration).$(PlatformToolset);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>AFX_TARG_NEU;AFX_TARG_ENU;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user