1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-07 02:53:58 +00:00

First commit of MeshAgent for MeshCentral

This commit is contained in:
Ylian Saint-Hilaire
2017-10-12 14:28:03 -07:00
commit 75d86eb4c8
349 changed files with 210459 additions and 0 deletions

View File

@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MicroLMS", "console\MicroLMS.vcxproj", "{03A09084-0576-45C5-97CA-B83B1A8688B8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Debug|x64.ActiveCfg = Debug|x64
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Debug|x64.Build.0 = Debug|x64
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Debug|x86.ActiveCfg = Debug|Win32
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Debug|x86.Build.0 = Debug|Win32
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Release|x64.ActiveCfg = Release|x64
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Release|x64.Build.0 = Release|x64
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Release|x86.ActiveCfg = Release|Win32
{03A09084-0576-45C5-97CA-B83B1A8688B8}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MicroLMSService", "service\MicroLMSService.vcxproj", "{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}.Debug|Win32.ActiveCfg = Debug|Win32
{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}.Debug|Win32.Build.0 = Debug|Win32
{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}.Debug|x64.ActiveCfg = Debug|x64
{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}.Debug|x64.Build.0 = Debug|x64
{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}.Release|Win32.ActiveCfg = Release|Win32
{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}.Release|Win32.Build.0 = Release|Win32
{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}.Release|x64.ActiveCfg = Release|x64
{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,98 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,0,0,1
PRODUCTVERSION 0,0,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Mesh Messenger"
VALUE "FileVersion", "0.0.0.1"
VALUE "InternalName", "MeshConsole"
VALUE "OriginalFilename", "MeshMessenger.exe"
VALUE "ProductName", "Mesh Messenger"
VALUE "ProductVersion", "0, 0, 0, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,249 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>
<ItemGroup>
<ClCompile Include="..\..\microstack\ILibCrypto.c" />
<ClCompile Include="..\heci\HECIWin.c" />
<ClCompile Include="..\heci\LMEConnection.c" />
<ClCompile Include="..\heci\PTHICommand.c" />
<ClCompile Include="..\..\microstack\ILibAsyncServerSocket.c" />
<ClCompile Include="..\..\microstack\ILibAsyncSocket.c" />
<ClCompile Include="..\..\microstack\ILibParsers.c" />
<ClCompile Include="..\..\microstack\ILibWebClient.c" />
<ClCompile Include="..\..\microstack\ILibWebServer.c" />
<ClCompile Include="..\..\microstack\md5.c" />
<ClCompile Include="..\..\microstack\sha1.c" />
<ClCompile Include="..\lms\ILibLMS.c" />
<ClCompile Include="main.c" />
<ClCompile Include="stdafx.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\microstack\ILibCrypto.h" />
<ClInclude Include="..\heci\HECIWin.h" />
<ClInclude Include="..\heci\HECI_if.h" />
<ClInclude Include="..\heci\LMEConnection.h" />
<ClInclude Include="..\heci\LMS_if.h" />
<ClInclude Include="..\heci\LMS_if_constants.h" />
<ClInclude Include="..\heci\PTHICommand.h" />
<ClInclude Include="..\heci\StatusCodeDefinitions.h" />
<ClInclude Include="..\..\microstack\ILibAsyncServerSocket.h" />
<ClInclude Include="..\..\microstack\ILibAsyncSocket.h" />
<ClInclude Include="..\..\microstack\ILibParsers.h" />
<ClInclude Include="..\..\microstack\ILibWebClient.h" />
<ClInclude Include="..\..\microstack\ILibWebServer.h" />
<ClInclude Include="..\..\microstack\md5.h" />
<ClInclude Include="..\..\microstack\sha1.h" />
<ClInclude Include="..\lms\ILibLMS-WebSite.h" />
<ClInclude Include="..\lms\ILibLMS.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{03A09084-0576-45C5-97CA-B83B1A8688B8}</ProjectGuid>
<RootNamespace>MeshConsole</RootNamespace>
<Keyword>Win32Proj</Keyword>
<ProjectName>MicroLMS</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</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" />
</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" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</PostBuildEventUseInBuild>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../openssl/include;../../openssl/include/openssl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;MEMORY_CHECK;__STDC__;WINSOCK2;ILibWebServer_SESSION_TRACKING;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;MICROSTACK_PROXY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CallingConvention>Cdecl</CallingConvention>
<AssemblerOutput>NoListing</AssemblerOutput>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<Profile>false</Profile>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateMapFile>
</GenerateMapFile>
<MapExports>
</MapExports>
<AssemblyDebug>true</AssemblyDebug>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../openssl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;MEMORY_CHECK;__STDC__;_CRT_SECURE_NO_WARNINGS;WINSOCK2;ILibWebServer_SESSION_TRACKING;NOCOMMANDER;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;MICROSTACK_PROXY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>Iphlpapi.lib;DbgHelp.lib;ws2_32.lib;Setupapi.lib;Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../openssl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WINSOCK2;NOCOMMANDER;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;MICROSTACK_PROXY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>Iphlpapi.lib;DbgHelp.lib;Setupapi.lib;ws2_32.lib;Psapi.lib;Crypt32.lib;Wintrust.lib;Version.lib;Wtsapi32.lib;%(AdditionalDependencies);Gdiplus.lib</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshConsole" /du "http://opentools.homeip.net" "$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>../../openssl/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;WINSOCK2;NOCOMMANDER;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;MICROSTACK_PROXY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>ws2_32.lib;DbgHelp.lib;Setupapi.lib;Psapi.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="main.c" />
<ClCompile Include="stdafx.cpp" />
<ClCompile Include="..\heci\HECIWin.c">
<Filter>MEI</Filter>
</ClCompile>
<ClCompile Include="..\heci\PTHICommand.c">
<Filter>MEI</Filter>
</ClCompile>
<ClCompile Include="..\heci\LMEConnection.c">
<Filter>MEI</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibAsyncSocket.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibParsers.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibWebClient.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibWebServer.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibAsyncServerSocket.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\sha1.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\md5.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibCrypto.c">
<Filter>Microstack</Filter>
</ClCompile>
<ClCompile Include="..\lms\ILibLMS.c">
<Filter>LMS</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="..\heci\HECI_if.h">
<Filter>MEI</Filter>
</ClInclude>
<ClInclude Include="..\heci\HECIWin.h">
<Filter>MEI</Filter>
</ClInclude>
<ClInclude Include="..\heci\PTHICommand.h">
<Filter>MEI</Filter>
</ClInclude>
<ClInclude Include="..\heci\StatusCodeDefinitions.h">
<Filter>MEI</Filter>
</ClInclude>
<ClInclude Include="..\heci\LMEConnection.h">
<Filter>MEI</Filter>
</ClInclude>
<ClInclude Include="..\heci\LMS_if.h">
<Filter>MEI</Filter>
</ClInclude>
<ClInclude Include="..\heci\LMS_if_constants.h">
<Filter>MEI</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibWebServer.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibAsyncServerSocket.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibAsyncSocket.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibParsers.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibWebClient.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\sha1.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\md5.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibCrypto.h">
<Filter>Microstack</Filter>
</ClInclude>
<ClInclude Include="..\lms\ILibLMS.h">
<Filter>LMS</Filter>
</ClInclude>
<ClInclude Include="..\lms\ILibLMS-WebSite.h">
<Filter>LMS</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<Filter Include="MEI">
<UniqueIdentifier>{5878a0ef-e109-42f4-a6d2-8e20a623b275}</UniqueIdentifier>
</Filter>
<Filter Include="Microstack">
<UniqueIdentifier>{24205618-7a0a-4260-916f-f08e93a87031}</UniqueIdentifier>
</Filter>
<Filter Include="LMS">
<UniqueIdentifier>{83d6353d-960a-4869-9928-e164bcfa5c22}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,7 @@
Micro LMS
------------------------------------------
Introduction
A implementation of Intel AMT LMS using Microstack.

140
microlms/console/main.c Normal file
View File

@@ -0,0 +1,140 @@
/*
Copyright 2006 - 2013 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#if defined(WIN32) || defined (_WIN32_WCE)
#ifndef MICROSTACK_NO_STDAFX
#include "stdafx.h"
#endif
#endif
#if defined(WIN32)
#define _CRTDBG_MAP_ALLOC
#ifdef _DEBUG
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#define new DEBUG_NEW
#endif
#endif
#if defined(WINSOCK2)
#include <winsock2.h>
#include <ws2tcpip.h>
#elif defined(WINSOCK1)
#include <winsock.h>
#include <wininet.h>
#endif
#include <signal.h>
#include "../../microstack/ILibParsers.h"
#include "../lms/ILibLMS.h"
#if defined(WIN32) & !defined(_CONSOLE)
#include "resource.h"
#endif
#if defined(WIN32) && defined (_DEBUG)
#include <crtdbg.h>
#endif
// The following macros set and clear, respectively, given bits
// of the C runtime library debug flag, as specified by a bitmask.
#ifdef _DEBUG
#define SET_CRT_DEBUG_FIELD(a) \
_CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
#define CLEAR_CRT_DEBUG_FIELD(a) \
_CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
#else
#define SET_CRT_DEBUG_FIELD(a) ((void) 0)
#define CLEAR_CRT_DEBUG_FIELD(a) ((void) 0)
#endif
#ifdef MEMORY_CHECK
#ifdef WIN32
// This routine place comments at the head of a section of debug output
void OutputHeading( const char * explanation )
{
_RPT1( _CRT_WARN, "\n\n%s:\n**************************************************************************\n", explanation );
}
#endif
#endif
void *Chain = NULL;
struct ILibLMS_StateModule *MicroLMS = NULL;
extern void ctrl_SendSubscriptionEvent(char *data, int datalen);
void BreakSink(int s)
{
UNREFERENCED_PARAMETER( s );
signal(SIGINT, SIG_IGN); // To ignore any more ctrl-c interrupts
ILibStopChain(Chain);
}
#if defined(_POSIX) || defined (_CONSOLE)
int main(int argc, char **argv)
#else
DWORD WINAPI GPMain(LPVOID lpParameter)
#endif
{
// Shutdown on Ctrl + C
signal(SIGINT, BreakSink);
#ifdef _POSIX
signal(SIGPIPE, SIG_IGN);
#ifdef _DEBUG
//mtrace();
#endif
#endif
#ifdef MEMORY_CHECK
#ifdef WIN32
//SET_CRT_DEBUG_FIELD( _CRTDBG_DELAY_FREE_MEM_DF );
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF);
#endif
#endif
Chain = ILibCreateChain();
MicroLMS = ILibLMS_Create(Chain, NULL);
if (MicroLMS != NULL)
{
printf("Starting MicroLMS.\r\n");
ILibStartChain(Chain);
printf("Stopping MicroLMS.\r\n");
}
else
{
printf("Unable to launch MicroLMS. Check that Intel ME is present, MEI driver installed and run this executable as administrator.\r\n");
}
#ifdef MEMORY_CHECK
#ifdef WIN32
OutputHeading("Generating the final memory leak report\r\n");
_CrtCheckMemory();
_CrtDumpMemoryLeaks();
#endif
#endif
#ifdef _POSIX
#ifdef _DEBUG
//muntrace();
#endif
#endif
#ifdef _POSIX
exit(EXIT_SUCCESS);
#else
return 0;
#endif
}

58
microlms/console/makefile Normal file
View File

@@ -0,0 +1,58 @@
SOURCES = main.c ../microstack/ILibLMS.c
SOURCES += ../microstack/ILibAsyncServerSocket.c ../microstack/ILibAsyncSocket.c ../microstack/ILibWebServer.c ../microstack/ILibWebClient.c ../microstack/ILibParsers.c ../microstack/md5.c ../microstack/sha1.c
SOURCES += ../heci/HECILinux.c ../heci/LMEConnection.c ../heci/PTHICommand.c
SOURCES += $(ADDITIONALSOURCES)
OBJECTS = $(patsubst %.c,%.o, $(SOURCES))
EXENAME = microlms
# Compiler command name
CC = gcc
# need to be separate for dependency generation
INCDIRS = -I. -I../../microstack -I../../core
CFLAGS ?= -g -Wall -D_POSIX -D_DEBUG -DMICROSTACK_NOTLS -fno-strict-aliasing $(INCDIRS)
LDFLAGS ?= -g -L. -lpthread -ldl -lutil -lrt
.PHONY: all clean
all: $(EXENAME)
$(EXENAME): $(OBJECTS)
$(V)$(CC) $^ $(LDFLAGS) -o $@
release:
$(MAKE) $(MAKEFILE) CFLAGS="-O2 -Wall -D_POSIX -D_DEBUG -DMICROSTACK_NOTLS -D_DEBUGLMS -fno-strict-aliasing $(INCDIRS)" LDFLAGS="-L. -lpthread -ldl -lutil"
strip ./$(EXENAME)
linux32:
$(MAKE) $(MAKEFILE) CFLAGS="-m32 -O2 -Wall -D_POSIX -D_DEBUG -DMICROSTACK_NOTLS -D_DEBUGLMS -fno-strict-aliasing $(INCDIRS)" LDFLAGS="-L. -lpthread -ldl -lutil -lrt -m32"
strip ./$(EXENAME)
linux64:
$(MAKE) $(MAKEFILE) CFLAGS="-O2 -Wall -D_POSIX -D_DEBUG -DMICROSTACK_NOTLS -D_DEBUGLMS -fno-strict-aliasing $(INCDIRS)" LDFLAGS="-L. -lpthread -ldl -lrt -lutil"
strip ./$(EXENAME)
clean:
rm -f *.o
rm -f *.o *~ microlms
rm -f ../heci/*.o
rm -f ../microstack/*.o
depend: $(SOURCES)
$(CC) -M $(CFLAGS) $(SOURCES) $(HEADERS) > depend
run:all
rm -f mtrax
set MALLOC_TRACE=mtrax
export MALLOC_TRACE;
./$(EXENAME)
mtrace ./$(EXENAME) mtrax
vrun:all
valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --num-callers=20 --track-fds=yes --track-origins=yes ./signer_linux
trace:
mtrace ./$(EXENAME) mtrax

View File

@@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by MeshMessenger.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,8 @@
// stdafx.cpp : source file that includes just the standard includes
// TinyMesh.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file

15
microlms/console/stdafx.h Normal file
View File

@@ -0,0 +1,15 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here

View File

@@ -0,0 +1,13 @@
#pragma once
// The following macros define the minimum required platform. The minimum required platform
// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
#endif

437
microlms/heci/HECILinux.c Normal file
View File

@@ -0,0 +1,437 @@
/******************************************************************************
* Intel Management Engine Interface (Intel MEI) Linux driver
* Intel MEI Interface Header
*
* This file is provided under a dual BSD/GPLv2 license. When using or
* redistributing this file, you may do so under either license.
*
* GPL LICENSE SUMMARY
*
* Copyright(c) 2012 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
* USA
*
* The full GNU General Public License is included in this distribution
* in the file called LICENSE.GPL.
*
* Contact Information:
* Intel Corporation.
* linux-mei@linux.intel.com
* http://www.intel.com
*
* BSD LICENSE
*
* Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
#include "HECILinux.h"
//#include "../core/utils.h"
/*****************************************************************************
* Intel Management Engine Interface
*****************************************************************************/
#ifdef _HECIDEBUG
#define mei_msg(_me, fmt, ARGS...) do { printf(fmt, ##ARGS); } while (0)
#define mei_err(_me, fmt, ARGS...) do { printf(fmt, ##ARGS); } while (0)
#else
#define mei_msg(_me, fmt, ARGS...)
#define mei_err(_me, fmt, ARGS...)
#endif
static void mei_deinit(struct mei *cl)
{
// mei_err(cl, "mei_deinit()\n");
if (cl->initialized == false) return;
cl->initialized = false;
if (cl->fd != -1) close(cl->fd);
cl->fd = -1;
cl->buf_size = 0;
cl->prot_ver = 0;
sem_destroy(&(cl->Lock));
}
static bool mei_init(struct mei *me, const uuid_le *guid, unsigned char req_protocol_version, bool verbose)
{
int result;
struct mei_client *cl;
struct mei_connect_client_data data;
mei_deinit(me);
me->verbose = verbose;
me->fd = open("/dev/mei", O_RDWR);
if (me->fd == -1) {
me->fd = open("/dev/mei0", O_RDWR);
if (me->fd == -1) {
// mei_err(me, "Cannot establish a handle to the Intel MEI driver\n");
goto err;
}
}
memcpy(&me->guid, guid, sizeof(*guid));
memset(&data, 0, sizeof(data));
me->initialized = true;
memcpy(&data.in_client_uuid, &me->guid, sizeof(me->guid));
result = ioctl(me->fd, IOCTL_MEI_CONNECT_CLIENT, &data);
if (result) {
mei_err(me, "IOCTL_MEI_CONNECT_CLIENT receive message. err=%d,%d\n", result, errno);
goto err;
}
cl = &data.out_client_properties;
//mei_msg(me, "max_message_length %d\n", cl->max_msg_length);
//mei_msg(me, "protocol_version %d\n", cl->protocol_version);
if ((req_protocol_version > 0) && (cl->protocol_version != req_protocol_version)) {
mei_err(me, "Intel MEI protocol version not supported\n");
goto err;
}
me->buf_size = cl->max_msg_length;
me->prot_ver = cl->protocol_version;
sem_init(&(me->Lock), 0, 1);
mei_msg(me, "mei init succ");
return true;
err:
mei_deinit(me);
return false;
}
static ssize_t mei_recv_msg(struct mei *me, unsigned char *buffer, ssize_t len, unsigned long timeout)
{
ssize_t rc;
mei_msg(me, "call read length = %zd\n", len);
rc = read(me->fd, buffer, len);
if (rc < 0) {
mei_err(me, "read failed with status %zd %s\n", rc, strerror(errno));
mei_deinit(me);
} else {
mei_msg(me, "read succeeded with result %zd\n", rc);
}
return rc;
}
static ssize_t mei_send_msg(struct mei *me, const unsigned char *buffer, ssize_t len, unsigned long timeout)
{
// struct timeval tv;
ssize_t written;
ssize_t rc;
// fd_set set;
// tv.tv_sec = timeout / 1000;
// tv.tv_usec = (timeout % 1000) * 1000000;
mei_msg(me, "call write length = %zd, cmd=%d\n", len, (int)buffer[0]);
sem_wait(&(me->Lock));
written = write(me->fd, buffer, len);
if (written < 0) {
rc = -errno;
mei_err(me, "write failed with status %zd %s\n", written, strerror(errno));
goto out;
}
/*
FD_ZERO(&set);
FD_SET(me->fd, &set);
rc = select(me->fd + 1 , &set, NULL, NULL, &tv);
if (rc > 0 && FD_ISSET(me->fd, &set)) {
mei_msg(me, "write success\n");
} else if (rc == 0) {
mei_err(me, "write failed on timeout with status 0, timeout = %ld, written=%ld, cmd=%d\n", timeout, written, (int)buffer[0]);
goto out;
} else { // rc < 0
mei_err(me, "write failed on select with status %zd\n", rc);
goto out;
}
*/
rc = written;
out:
sem_post(&(me->Lock));
mei_msg(me, "call write written = %zd\n", written);
if (rc < 0) mei_deinit(me);
return rc;
}
/***************************************************************************
* Intel Advanced Management Technology Host Interface
***************************************************************************/
struct amt_host_if_msg_header {
struct amt_version version;
uint16_t _reserved;
uint32_t command;
uint32_t length;
} __attribute__((packed));
struct amt_host_if_resp_header {
struct amt_host_if_msg_header header;
uint32_t status;
unsigned char data[0];
} __attribute__((packed));
const uuid_le MEI_IAMTHIF = {.b={0x28, 0x00, 0xf8, 0x12, 0xb7, 0xb4, 0x2d, 0x4b, 0xac, 0xa8, 0x46, 0xe0, 0xff, 0x65, 0x81, 0x4c}};
const uuid_le MEI_LMEIF = {.b={0xdb, 0xa4, 0x33, 0x67, 0x76, 0x04, 0x7b, 0x4e, 0xb3, 0xaf, 0xbc, 0xfc, 0x29, 0xbe, 0xe7, 0xa7}};
#define AMT_HOST_IF_CODE_VERSIONS_REQUEST 0x0400001A
#define AMT_HOST_IF_CODE_VERSIONS_RESPONSE 0x0480001A
const struct amt_host_if_msg_header CODE_VERSION_REQ = {
.version = {AMT_MAJOR_VERSION, AMT_MINOR_VERSION},
._reserved = 0,
.command = AMT_HOST_IF_CODE_VERSIONS_REQUEST,
.length = 0
};
static bool amt_host_if_init(struct amt_host_if *acmd, unsigned long send_timeout, bool verbose, int client)
{
acmd->send_timeout = (send_timeout) ? send_timeout : 20000;
if (client == 0) { acmd->initialized = mei_init(&acmd->mei_cl, &MEI_IAMTHIF, 0, verbose); }
else if (client == 1) { acmd->initialized = mei_init(&acmd->mei_cl, &MEI_LMEIF, 0, verbose); }
return acmd->initialized;
}
static void amt_host_if_deinit(struct amt_host_if *acmd)
{
mei_deinit(&acmd->mei_cl);
acmd->initialized = false;
}
static uint32_t amt_verify_code_versions(const struct amt_host_if_resp_header *resp)
{
uint32_t status = AMT_STATUS_SUCCESS;
struct amt_code_versions *code_ver;
size_t code_ver_len;
uint32_t ver_type_cnt;
uint32_t len;
uint32_t i;
code_ver = (struct amt_code_versions *)resp->data;
/* length - sizeof(status) */
code_ver_len = resp->header.length - sizeof(uint32_t);
ver_type_cnt = code_ver_len -
sizeof(code_ver->bios) -
sizeof(code_ver->count);
if (code_ver->count != ver_type_cnt / sizeof(struct amt_version_type)) {
status = AMT_STATUS_INTERNAL_ERROR;
goto out;
}
for (i = 0; i < code_ver->count; i++) {
len = code_ver->versions[i].description.length;
if (len > AMT_UNICODE_STRING_LEN) {
status = AMT_STATUS_INTERNAL_ERROR;
goto out;
}
len = code_ver->versions[i].version.length;
if (code_ver->versions[i].version.string[len] != '\0' ||
len != strlen(code_ver->versions[i].version.string)) {
status = AMT_STATUS_INTERNAL_ERROR;
goto out;
}
}
out:
return status;
}
static uint32_t amt_verify_response_header(uint32_t command, const struct amt_host_if_msg_header *resp_hdr, uint32_t response_size)
{
if (response_size < sizeof(struct amt_host_if_resp_header)) {
return AMT_STATUS_INTERNAL_ERROR;
} else if (response_size != (resp_hdr->length +
sizeof(struct amt_host_if_msg_header))) {
return AMT_STATUS_INTERNAL_ERROR;
} else if (resp_hdr->command != command) {
return AMT_STATUS_INTERNAL_ERROR;
} else if (resp_hdr->_reserved != 0) {
return AMT_STATUS_INTERNAL_ERROR;
} else if (resp_hdr->version.major != AMT_MAJOR_VERSION ||
resp_hdr->version.minor < AMT_MINOR_VERSION) {
return AMT_STATUS_INTERNAL_ERROR;
}
return AMT_STATUS_SUCCESS;
}
static uint32_t amt_host_if_call(struct amt_host_if *acmd, const unsigned char *command, ssize_t command_sz, uint8_t **read_buf, uint32_t rcmd, unsigned int expected_sz)
{
uint32_t in_buf_sz;
uint32_t out_buf_sz;
ssize_t written;
uint32_t status;
struct amt_host_if_resp_header *msg_hdr;
in_buf_sz = acmd->mei_cl.buf_size;
*read_buf = (uint8_t *)malloc(sizeof(uint8_t) * in_buf_sz);
if (*read_buf == NULL) return AMT_STATUS_SDK_RESOURCES;
memset(*read_buf, 0, in_buf_sz);
msg_hdr = (struct amt_host_if_resp_header *)*read_buf;
written = mei_send_msg(&acmd->mei_cl, command, command_sz, acmd->send_timeout);
if (written != command_sz)
return AMT_STATUS_INTERNAL_ERROR;
out_buf_sz = mei_recv_msg(&acmd->mei_cl, *read_buf, in_buf_sz, 2000);
if (out_buf_sz <= 0)
return AMT_STATUS_HOST_IF_EMPTY_RESPONSE;
status = msg_hdr->status;
if (status != AMT_STATUS_SUCCESS)
return status;
status = amt_verify_response_header(rcmd, &msg_hdr->header, out_buf_sz);
if (status != AMT_STATUS_SUCCESS)
return status;
if (expected_sz && expected_sz != out_buf_sz)
return AMT_STATUS_INTERNAL_ERROR;
return AMT_STATUS_SUCCESS;
}
static uint32_t amt_get_code_versions(struct amt_host_if *cmd, struct amt_code_versions *versions)
{
struct amt_host_if_resp_header *response = NULL;
uint32_t status;
status = amt_host_if_call(cmd,
(const unsigned char *)&CODE_VERSION_REQ,
sizeof(CODE_VERSION_REQ),
(uint8_t **)&response,
AMT_HOST_IF_CODE_VERSIONS_RESPONSE, 0);
if (status != AMT_STATUS_SUCCESS)
goto out;
status = amt_verify_code_versions(response);
if (status != AMT_STATUS_SUCCESS)
goto out;
memcpy(versions, response->data, sizeof(struct amt_code_versions));
out:
if (response != NULL)
free(response);
return status;
}
/************************** end of amt_host_if_command ***********************/
int MEI_globalSetup = 0;
struct MEImodule MEI_global;
bool heci_Init(struct MEImodule* module, int client)
{
if (module == NULL && client != 0) return false;
if (module == NULL) { module = &MEI_global; if (MEI_globalSetup == 1) return true; }
memset(module, 0 , sizeof(struct MEImodule));
if (!amt_host_if_init(&(module->acmd), 5000, module->verbose, client)) return false;
if (module == &MEI_global) MEI_globalSetup = 1;
module->inited = true;
if (client == 0) module->status = amt_get_code_versions(&(module->acmd), &(module->ver));
return true;
}
void heci_Deinit(struct MEImodule* module)
{
if (module == NULL) { module = &MEI_global; MEI_globalSetup = 0; }
amt_host_if_deinit(&(module->acmd));
memset(module, 0, sizeof(struct MEImodule));
}
int heci_ReceiveMessage(struct MEImodule* module, unsigned char *buffer, int len, unsigned long timeout) // Timeout default is 2000
{
if (module == NULL) module = &MEI_global;
return mei_recv_msg(&(module->acmd.mei_cl), buffer, len, timeout);
}
int heci_SendMessage(struct MEImodule* module, const unsigned char *buffer, int len, unsigned long timeout) // Timeout default is 2000
{
if (module == NULL) module = &MEI_global;
return mei_send_msg(&(module->acmd.mei_cl), buffer, len, timeout);
}
unsigned int heci_GetBufferSize(struct MEImodule* module)
{
if (module == NULL) module = &MEI_global;
if (module->inited) return module->acmd.mei_cl.buf_size;
return -1;
}
unsigned char heci_GetProtocolVersion(struct MEImodule* module)
{
if (module == NULL) module = &MEI_global;
if (module->inited) return module->acmd.mei_cl.prot_ver;
return 0;
}
// Get the version of MEI from the last MEI init.
bool heci_GetHeciVersion(struct MEImodule* module, HECI_VERSION *version)
{
version->major = AMT_MAJOR_VERSION;
version->minor = AMT_MINOR_VERSION;
return true;
}
bool heci_IsInitialized(struct MEImodule* module)
{
return module->inited;
}

120
microlms/heci/HECILinux.h Normal file
View File

@@ -0,0 +1,120 @@
/*******************************************************************************
* Copyright (C) 2004-2008 Intel Corp. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Intel Corp. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef __HECI_LINUX_H__
#define __HECI_LINUX_H__
#include "HECI_if.h"
#include "mei.h"
#include <semaphore.h>
#include <stdint.h>
#ifndef bool
#define bool int
#endif
/***************************************************************************
* Intel Advanced Management Technology ME Client
***************************************************************************/
#define AMT_MAJOR_VERSION 1
#define AMT_MINOR_VERSION 1
#define AMT_STATUS_SUCCESS 0x0
#define AMT_STATUS_INTERNAL_ERROR 0x1
#define AMT_STATUS_NOT_READY 0x2
#define AMT_STATUS_INVALID_AMT_MODE 0x3
#define AMT_STATUS_INVALID_MESSAGE_LENGTH 0x4
#define AMT_STATUS_HOST_IF_EMPTY_RESPONSE 0x4000
#define AMT_STATUS_SDK_RESOURCES 0x1004
#define AMT_BIOS_VERSION_LEN 65
#define AMT_VERSIONS_NUMBER 50
#define AMT_UNICODE_STRING_LEN 20
struct amt_unicode_string {
uint16_t length;
char string[AMT_UNICODE_STRING_LEN];
} __attribute__((packed));
struct amt_version_type {
struct amt_unicode_string description;
struct amt_unicode_string version;
} __attribute__((packed));
struct amt_version {
uint8_t major;
uint8_t minor;
} __attribute__((packed));
struct amt_code_versions {
uint8_t bios[AMT_BIOS_VERSION_LEN];
uint32_t count;
struct amt_version_type versions[AMT_VERSIONS_NUMBER];
} __attribute__((packed));
struct mei {
uuid_le guid;
bool initialized;
bool verbose;
unsigned int buf_size;
unsigned char prot_ver;
int fd;
sem_t Lock;
};
struct amt_host_if {
struct mei mei_cl;
unsigned long send_timeout;
bool initialized;
};
struct MEImodule
{
struct amt_code_versions ver;
struct amt_host_if acmd;
unsigned int i;
unsigned int status;
bool verbose;
bool inited;
};
bool heci_Init(struct MEImodule* module, int client);
void heci_Deinit(struct MEImodule* module);
int heci_ReceiveMessage(struct MEImodule* module, unsigned char *buffer, int len, unsigned long timeout); // Timeout default is 2000
int heci_SendMessage(struct MEImodule* module, const unsigned char *buffer, int len, unsigned long timeout); // Timeout default is 2000
unsigned int heci_GetBufferSize(struct MEImodule* module);
unsigned char heci_GetProtocolVersion(struct MEImodule* module);
bool heci_GetHeciVersion(struct MEImodule* module, HECI_VERSION *version);
bool heci_IsInitialized(struct MEImodule* module);
#endif // __HECI_LINUX_H__

399
microlms/heci/HECIWin.c Normal file
View File

@@ -0,0 +1,399 @@
/*******************************************************************************
* Copyright (C) 2004-2008 Intel Corp. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Intel Corp. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef _MINCORE
#include <windows.h>
#include <setupapi.h>
#include <initguid.h>
#include <winioctl.h>
#include "HECIWin.h"
#include "heci_if.h"
#define false 0
#define true 1
#define HECI_MAX_LINE_LEN 300
DEFINE_GUID(GUID_DEVINTERFACE_HECI, 0xE2D1FF34, 0x3458, 0x49A9, 0x88, 0xDA, 0x8E, 0x69, 0x15, 0xCE, 0x9B, 0xE5);
DEFINE_GUID(HECI_PTHI_GUID , 0x12F80028, 0xB4B7, 0x4b2d, 0xAC, 0xA8, 0x46, 0xE0, 0xFF, 0x65, 0x81, 0x4c);
DEFINE_GUID(LME_GUID , 0x6733a4db, 0x0476, 0x4e7b, 0xb3, 0xaf, 0xbc, 0xfc, 0x29, 0xbe, 0xe7, 0xa7);
//VOID _displayHECIError(UINT32 errorCode,DWORD lastError);
//VOID _displayHECIData(UINT32 messageId);
int heci_doIoctl(struct MEImodule* module, DWORD code, void *inbuf, int inlen, void *outbuf, int outlen);
struct MEImodule MEI_global;
/***************************** public functions *****************************/
unsigned int heci_GetBufferSize(struct MEImodule* module) { if (module != NULL) return module->_bufSize; else return MEI_global._bufSize; }
unsigned char heci_GetProtocolVersion(struct MEImodule* module) { if (module != NULL) return module->_protocolVersion; else return MEI_global._protocolVersion; }
bool heci_IsInitialized(struct MEImodule* module) { if (module != NULL) return module->_initialized; else return MEI_global._initialized; }
bool heci_GetHeciVersion(struct MEImodule* module, HECI_VERSION *version)
{
if (module == NULL) module = &MEI_global;
if (module->m_haveHeciVersion)
{
memcpy_s(version, sizeof(HECI_VERSION), &(module->m_heciVersion), sizeof(HECI_VERSION));
return true;
}
return false;
}
bool heci_Init(struct MEImodule* module, int client)
{
PSP_DEVICE_INTERFACE_DETAIL_DATA deviceDetail = NULL;
HDEVINFO hDeviceInfo;
DWORD bufferSize;
SP_DEVICE_INTERFACE_DATA interfaceData;
LONG ii = 0;
int result;
HECI_CLIENT properties;
GUID guid;
if (client == 0) guid = HECI_PTHI_GUID;
if (client == 1) guid = LME_GUID;
if (module == NULL) module = &MEI_global;
module->_verbose = false;
if (module->_initialized) {
heci_Deinit(module);
}
// Find all devices that have our interface
hDeviceInfo = SetupDiGetClassDevs((LPGUID)&GUID_DEVINTERFACE_HECI, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if (hDeviceInfo == INVALID_HANDLE_VALUE) {
if (module->_verbose) {
//_displayHECIError(GET_CLASS_DEVS,GetLastError());
}
return false; //GET_CLASS_DEVS;
}
// Setup the interface data struct
interfaceData.cbSize = sizeof(interfaceData);
for (ii = 0;
SetupDiEnumDeviceInterfaces(hDeviceInfo, NULL, (LPGUID)&GUID_DEVINTERFACE_HECI, ii, &interfaceData);
++ii) {
// Found our device instance
if (!SetupDiGetDeviceInterfaceDetail(hDeviceInfo, &interfaceData, NULL, 0, &bufferSize, NULL)) {
DWORD err = GetLastError();
if (err != ERROR_INSUFFICIENT_BUFFER) {
if (module->_verbose) {
//_displayHECIError(GET_INTERFACE_DETAIL,err);
}
continue;
}
}
// Allocate a big enough buffer to get detail data
deviceDetail = (PSP_DEVICE_INTERFACE_DETAIL_DATA) malloc(bufferSize);
if (deviceDetail == NULL) {
if (module->_verbose) {
//_displayHECIError(ALLOCATE_MEMORY_ERROR,0);
}
continue;
}
// Setup the device interface struct
deviceDetail->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
// Try again to get the device interface detail info
if (!SetupDiGetDeviceInterfaceDetail(hDeviceInfo, &interfaceData, deviceDetail, bufferSize, NULL, NULL))
{
/*
if (_verbose)
{
DWORD err = GetLastError();
_displayHECIError(GET_INTERFACE_DETAIL,err);
}
*/
free(deviceDetail);
deviceDetail = NULL;
continue;
}
break;
}
SetupDiDestroyDeviceInfoList(hDeviceInfo);
if (deviceDetail == NULL) {
if (module->_verbose) {
//_displayHECIError(FIND_HECI_FAILURE,0);
}
return false; //FIND_HECI_FAILURE;
}
module->_handle = CreateFile(deviceDetail->DevicePath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
free(deviceDetail);
if (module->_handle == INVALID_HANDLE_VALUE) {
if (module->_verbose) {
//_displayHECIError(CREATE_HECI_FILE_FAILURE,GetLastError());
}
return false; //CREATE_HECI_FILE_FAILURE;
}
module->_initialized = true;
result = heci_doIoctl(module, (DWORD)IOCTL_HECI_GET_VERSION, NULL, 0, &(module->m_heciVersion), sizeof(HECI_VERSION));
if (result != sizeof(HECI_VERSION)) {
if (module->_verbose) {
//_displayHECIError(GET_HECI_DRIVER_VERSION_FAILURE,0);
}
heci_Deinit(module);
return false; //GET_HECI_DRIVER_VERSION_FAILURE;
}
module->m_haveHeciVersion = true;
if (module->_verbose) {
//_displayHECIData(HECI_DRIVER_VERSION);
//_ftprintf(stdout,_T("%d.%d.%d.%d\n"), (m_heciVersion).major, (m_heciVersion).minor, (m_heciVersion).hotfix, (m_heciVersion).build);
}
memset(&properties, 0, sizeof(properties));
result = heci_doIoctl(module, (DWORD)IOCTL_HECI_CONNECT_CLIENT, (void*)(&guid), sizeof(GUID), &properties, sizeof(properties));
if (result != sizeof(properties))
{
if (module->_verbose) {
//_displayHECIError(HECI_CONNECT_TO_PTHI_CLIENT_FAILURE,0);
}
//Deinit();
return false; //HECI_CONNECT_TO_PTHI_CLIENT_FAILURE;
}
module->_bufSize = properties.MaxMessageLength;
return true;
}
void heci_Deinit(struct MEImodule* module)
{
if (module == NULL) module = &MEI_global;
if (module->_initialized == false) return;
module->_initialized = false;
module->_bufSize = 0;
if (module->_handle != INVALID_HANDLE_VALUE)
{
CloseHandle(module->_handle);
module->_handle = INVALID_HANDLE_VALUE;
}
}
int heci_ReceiveMessage(struct MEImodule* module, unsigned char *buffer, int len, unsigned long timeout) // Timeout default is 2000
{
DWORD bytesRead = 0;
int res;
HANDLE h_event = NULL;
OVERLAPPED overlapped;
DWORD error;
DWORD eventRes;
if (module == NULL) module = &MEI_global;
if ((h_event = CreateEvent(NULL, FALSE, FALSE, NULL)) == 0) goto out;
overlapped.hEvent = h_event;
overlapped.Offset = 0;
overlapped.OffsetHigh = 0;
res = ReadFile(module->_handle, buffer, len, &bytesRead, &overlapped);
error = GetLastError();
if ((0 == res) && (ERROR_IO_PENDING != error)) {
if (module->_verbose) {
//_displayHECIError(READ_FILE,GetLastError());
}
bytesRead = (DWORD)-1;
goto out;
}
eventRes = WaitForSingleObject(h_event, timeout);
if (eventRes == WAIT_TIMEOUT) {
bytesRead = 0;
goto out;
}
res = GetOverlappedResult(module->_handle, &overlapped, &bytesRead, true);
if (res == 0) {
if (module->_verbose) {
//_displayHECIError(READ_FILE,GetLastError());
}
bytesRead = (DWORD)-1;
goto out;
}
out:
if (h_event != NULL) CloseHandle(h_event);
if (bytesRead <= 0) heci_Deinit(module);
return bytesRead;
}
int heci_SendMessage(struct MEImodule* module, const unsigned char *buffer, int len, unsigned long timeout) // Timeout default is 2000
{
DWORD bytesWritten = 0;
int res;
HANDLE h_event = NULL;
OVERLAPPED overlapped;
DWORD lastError;
DWORD eventRes;
if (module == NULL) module = &MEI_global;
if ((h_event = CreateEvent(NULL, FALSE, FALSE, NULL)) == 0) goto out;
overlapped.hEvent = h_event;
overlapped.Offset = 0;
overlapped.OffsetHigh = 0;
res = WriteFile(module->_handle, buffer, len, &bytesWritten, &overlapped);
lastError = GetLastError();
if ((0 == res) && (ERROR_IO_PENDING !=lastError )) {
if (module->_verbose) {
//_displayHECIError(WRITE_FILE,GetLastError());
}
bytesWritten = (DWORD)-1;
goto out;
}
eventRes = WaitForSingleObject(h_event, timeout);
if (eventRes == WAIT_TIMEOUT) {
if (module->_verbose) {
//_displayHECIError(WRITE_FILE_TIME_OUT,0);
}
bytesWritten = 0;
goto out;
}
res = GetOverlappedResult(module->_handle, &overlapped, &bytesWritten, false);
if (res == 0) {
if (module->_verbose) {
//_displayHECIError(WRITE_FILE,GetLastError());
}
bytesWritten = (DWORD)-1;
goto out;
}
out:
if (h_event != NULL) CloseHandle(h_event);
if (bytesWritten <= 0) heci_Deinit(module);
return bytesWritten;
}
int heci_doIoctl(struct MEImodule* module, DWORD code, void *inbuf, int inlen, void *outbuf, int outlen)
{
int res;
DWORD bytesRead = 0;
HANDLE h_event = NULL;
OVERLAPPED overlapped;
if (module == NULL) module = &MEI_global;
if (!module->_initialized) return -1;
if ((h_event = CreateEvent(NULL, FALSE, FALSE, NULL)) == 0) goto out;
overlapped.hEvent = h_event;
overlapped.Offset = 0;
overlapped.OffsetHigh = 0;
res = DeviceIoControl(module->_handle, code, inbuf, inlen, outbuf, outlen, &bytesRead, &overlapped);
if ((0 == res) && (ERROR_IO_PENDING != GetLastError())) {
if (module->_verbose) {
//_displayHECIError(IOCTL_COMMAND,GetLastError());
}
bytesRead = (DWORD)-1;
goto out;
}
WaitForSingleObject(h_event, INFINITE);
res = GetOverlappedResult(module->_handle, &overlapped, &bytesRead, true);
if (res == 0) {
if (module->_verbose) {
//_displayHECIError(IOCTL_COMMAND,GetLastError());
}
bytesRead = (DWORD)-1;
goto out;
}
out:
if (h_event != NULL) CloseHandle(h_event);
if (bytesRead == (DWORD)-1) heci_Deinit(module);
return bytesRead;
}
TCHAR *_getErrMsg(DWORD err)
{
static TCHAR buffer[1024];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
err,
0,
buffer,
sizeof(buffer) - 1,
0);
return buffer;
}
/*
// Display a HECI error message
void _displayHECIError(UINT32 errorCode, DWORD lastError)
{
TCHAR str[HECI_MAX_LINE_LEN];
TCHAR *msg;
LoadString(GetModuleHandle(NULL), HECI_ERROR_MESSAGE, str, sizeof(str)/sizeof(TCHAR));
_ftprintf(stderr, _T("%s"), str);
_ftprintf(stderr, _T("%s"), L" ");
LoadString(GetModuleHandle(NULL), errorCode , str, sizeof(str)/sizeof(TCHAR));
if(0!= lastError)
{
msg = _getErrMsg(lastError);
_ftprintf(stderr, _T("%s (%d): %s\n"),str, lastError, msg);
}
else
{
_ftprintf(stderr, _T("%s\n"),str);
}
}
// Display a HECI data message
void _displayHECIData(UINT32 messageId)
{
TCHAR str[HECI_MAX_LINE_LEN];
LoadString(GetModuleHandle(NULL), messageId , str, sizeof(str)/sizeof(TCHAR));
_ftprintf(stdout,_T("%s"),str);
_ftprintf(stdout,_T("%s"),L" ");
}
*/
#endif

66
microlms/heci/HECIWin.h Normal file
View File

@@ -0,0 +1,66 @@
/*******************************************************************************
* Copyright (C) 2004-2008 Intel Corp. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Intel Corp. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef _MINCORE
#ifndef __HECI_WIN_H__
#define __HECI_WIN_H__
#include "HECI_if.h"
#include <stdio.h>
#include <windows.h>
#define bool int
struct MEImodule
{
bool _initialized;
bool _verbose;
unsigned int _bufSize;
unsigned char _protocolVersion;
int _fd;
bool m_haveHeciVersion;
HECI_VERSION m_heciVersion;
HANDLE _handle;
OVERLAPPED overlapped;
};
bool heci_Init(struct MEImodule* module, int client);
void heci_Deinit(struct MEImodule* module);
int heci_ReceiveMessage(struct MEImodule* module, unsigned char *buffer, int len, unsigned long timeout); // Timeout default is 2000
int heci_SendMessage(struct MEImodule* module, const unsigned char *buffer, int len, unsigned long timeout); // Timeout default is 2000
unsigned int heci_GetBufferSize(struct MEImodule* module);
unsigned char heci_GetProtocolVersion(struct MEImodule* module);
bool heci_GetHeciVersion(struct MEImodule* module, HECI_VERSION *version);
bool heci_IsInitialized(struct MEImodule* module);
#endif // __HECI_WIN_H__
#endif

223
microlms/heci/HECI_if.h Normal file
View File

@@ -0,0 +1,223 @@
/*******************************************************************************
* Copyright (C) 2004-2008 Intel Corp. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Intel Corp. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef _MINCORE
#ifndef __HECI_INTRFACE_H__
#define __HECI_INTRFACE_H__
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef char CHAR;
typedef unsigned long ULONG;
typedef UINT32 AMT_STATUS;
typedef UINT32 AMT_BOOLEAN;
typedef enum _HECI_STATUS {
HECI_STATUS_OK = 0x0,
HECI_STATUS_GENERAL_ERROR = 0x2000,
HECI_STATUS_LOCATE_DEVICE_ERROR,
HECI_STATUS_MEMORY_ACCESS_ERROR,
HECI_STATUS_WRITE_REGISTER_ERROR,
HECI_STATUS_MEMORY_ALLOCATION_ERROR,
HECI_STATUS_BUFFER_OVEREFLOW_ERROR,
HECI_STATUS_NOT_ENOUGH_MEMORY,
HECI_STATUS_MSG_TRANSMISSION_ERROR,
HECI_STATUS_VERSION_MISMATCH,
HECI_STATUS_UNEXPECTED_INTERRUPT_REASON,
HECI_STATUS_TIMEOUT_ERROR,
HECI_STATUS_UNEXPECTED_RESPONSE,
HECI_STATUS_UNKNOWN_MESSAGE,
HECI_STATUS_CANNOT_FOUND_HOST_CLIENT,
HECI_STATUS_CANNOT_FOUND_ME_CLIENT,
HECI_STATUS_CLIENT_ALREADY_CONNECTED,
HECI_STATUS_NO_FREE_CONNECTION,
HECI_STATUS_ILLEGAL_PARAMETER,
HECI_STATUS_FLOW_CONTROL_ERROR,
HECI_STATUS_NO_MESSAGE,
HECI_STATUS_BUFFER_TOO_LARGE,
HECI_STATUS_BUFFER_TOO_SMALL,
HECI_STATUS_BUFFER_NOT_EMPTY,
NUM_OF_HECI_STATUSES
} HECI_STATUS;
#ifdef WIN32
// Win32 code
#define AMT_LOCAL_AGENT_STATUS_SUCCESS 0
#define USAGE 1
#define ERROR_MESSAGE 2
#define VERSION_MESSAGE 3
#define HECI_ERROR_MESSAGE 4
#define UNKNOWN 5
#define HECI_CONNECT_TO_FWU_CLIENT_FAILURE 6
#define WRITE_FILE_TIME_OUT 7
#define ME_FW_INFO 8
#define ME_MODE 9
#define IOCTL_COMMAND 10
#define WRITE_FILE 11
#define READ_FILE 12
#define GET_CLASS_DEVS 13
#define GET_INTERFACE_DETAIL 14
#define ICH_VERSION 15
#define FIND_HECI_FAILURE 16
#define CREATE_HECI_FILE 17
#define CREATE_HECI_FILE_FAILURE 17
#define GET_HECI_DRIVER_VERSION_FAILURE 18
#define LA_STATUS_INTERNAL_ERROR 19
#define HECI_CONNECT_TO_PTHI_CLIENT_FAILURE 20
#define LA_HECI_ERROR 21
#define ALLOCATE_MEMORY_ERROR 22
#define LA_HECI_NOT_INSTALLED_ERROR 23
#define FW_BUFFER_IS_TO_SMALL 24
#define SEND_DATA_TO_FW_FAILURE 25
#define RECEIVE_DATA_FROM_FW_FAILURE 26
#define GET_INFO_FROM_HECI_FAILURE 27
#define MCH_VERSION 28
#define OEM_VENDOR 29
#define HECI_DRIVER_VERSION 30
#define CODE_MAJOR_VERSION 31
#define CODE_MINOR_VERSION 32
#define CODE_HOTFIX_VERSION 33
#define CODE_BUID_VERSION 34
#define BIOS_VERSION 35
#define AMT_CODE_VERSION 36
#define AMT_MODE 37
#define AMT_MODE_1 38
#define IDS_STRING39 39
#define AMT_MODE_2 39
#define PROVISIONING_STATE 40
#define STATE_PRE 41
#define STATE_IN 42
#define STATE_POST 43
#define IDS_STRING44 44
#define PARSE_KEYWORD_DISCOVERY_TEST 44
#define DISCOVERY_PASS 45
#define IDS_STRING46 46
#define DISCOVERY_FAILED 46
#define IDS_STRING47 47
#define PARSE_KEYWORD_ACTIVATE 47
#define PARSE_KEYWORD_OTP 48
#define PARSE_KEYWORD_DNS 49
#define PARSE_KEYWORD_VERBOSE 50
#define INVALID_PARAM_INPUT 51
#define USAGE_LOCAL_AGENT 52
#define USAGE_OPTIONS 53
#define USAGE_OPTIONS_OTP 54
#define USAGE_OPTIONS_DNS 55
#define USAGE_OPTIONS_DISCOVERY 56
#define USAGE_OPTIONS_ACTIVATE 57
#define USAGE_OPTIONS_VERBOSE 58
#define WORD_ZTC 59
#define WORD_ENABLED 60
#define WORD_DISABLED 61
#define WORD_PROVISIONING_TLS_MODE 62
#define WORD_PKI 63
#define WORD_PSK 64
#define WORD_RNG_SEED_STATUS 65
#define WORD_EXIST 66
#define WORD_IN_PROGRESS 67
#define WORD_NOT_EXIST 68
#define WORD_AMT_CONFIG_ACTIVATE 69
#define WORD_SUCCESS 70
#define IDS_STRING71 71
#define WORD_FAILURE 71
#define WORD_NOT_READY 72
#define IDS_STRING73 73
#define HASH_ENTRY 73
#define HECI_CONNECT_TO_WD_CLIENT_FAILURE 74
#define CHANGE_TO_AMT_FAILURE 75
#define IDS_STRING76 76
#define WORD_CHANGE_TO_AMT 76
#define FOUND 77
#define CERT_HASHES_IN_FW 78
#define NO_HANDLES_FOUND 79
#define CERT_HASH 80
#define FRIENDLY_NAME 81
#define FILE_DEVICE_HECI 0x8000
#define HECI_IOCTL(index) CTL_CODE(FILE_DEVICE_HECI, index, METHOD_BUFFERED, FILE_READ_DATA)
#define IOCTL_HECI_GET_VERSION CTL_CODE(FILE_DEVICE_HECI, 0x800, METHOD_BUFFERED, FILE_READ_ACCESS|FILE_WRITE_ACCESS)
#define IOCTL_HECI_CONNECT_CLIENT CTL_CODE(FILE_DEVICE_HECI, 0x801, METHOD_BUFFERED, FILE_READ_ACCESS|FILE_WRITE_ACCESS)
#define IOCTL_HECI_WD CTL_CODE(FILE_DEVICE_HECI, 0x802, METHOD_BUFFERED, FILE_READ_ACCESS|FILE_WRITE_ACCESS)
#endif
#pragma pack(1)
typedef struct _HECI_VERSION {
UINT8 major;
UINT8 minor;
UINT8 hotfix;
UINT16 build;
} HECI_VERSION;
typedef struct _HECI_CLIENT {
UINT32 MaxMessageLength;
UINT8 ProtocolVersion;
} HECI_CLIENT;
typedef union _MEFWCAPS_SKU
{
UINT32 Data;
struct {
UINT32 Reserved :1; //Legacy
UINT32 Qst :1; //QST
UINT32 Asf :1; //ASF2
UINT32 Amt :1; //AMT Professional
UINT32 AmtFund :1; //AMT Fundamental
UINT32 Tpm :1; //TPM
UINT32 Dt :1;
UINT32 Fps :1; //Fingerprint Sensor
UINT32 HomeIT :1; //Home IT
UINT32 Mctp :1; //MCTP
UINT32 WoX :1;
UINT32 PmcPatch :1; //PMC Patch
UINT32 Ve :1; //VE
UINT32 Tdt :1; //Theft Deterrent Technology
UINT32 Corp :1; //Corporate
UINT32 Reserved2 :17;
} Fields;
} MEFWCAPS_SKU;
typedef enum _MEFWCAPS_MANAGEABILITY_SUPP
{
MEFWCAPS_MANAGEABILITY_SUPP_NONE = 0,
MEFWCAPS_MANAGEABILITY_SUPP_AMT,
MEFWCAPS_MANAGEABILITY_SUPP_ASF,
MEFWCAPS_MANAGEABILITY_SUPP_CP
} MEFWCAPS_MANAGEABILITY_SUPP;
#pragma pack()
#endif // __HECI_INTRFACE_H__
#endif

View File

@@ -0,0 +1,559 @@
/*
Copyright 2006 - 2015 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _MINCORE
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "LMEConnection.h"
#include "LMS_if.h"
#include "../../microstack/ILibParsers.h"
#define MEI_IO_TIMEOUT 1000
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
const unsigned int LME_RX_WINDOW_SIZE = 4096;
int LME_sendMessage(struct LMEConnection* module, unsigned char *buffer, int len);
void LME_doRX(struct LMEConnection* module, unsigned char *rxBuffer, unsigned int bytesRead);
void LME_apfGlobalRequest(struct LMEConnection* module, unsigned char *rxBuffer, unsigned int bytesRead, int *status);
void LME_Deinit(struct LMEConnection* module);
bool LME_IsInitialized(struct LMEConnection* module)
{
// Lock il(_initLock);
bool ret = (bool)(module->initState == INIT_STATE_CONNECTED);
return ret;
}
#ifdef WIN32
DWORD WINAPI LME_Thread(void* obj)
#else
void LME_Thread(void* obj)
#endif
{
#ifdef WIN32
HECI_VERSION version;
#endif
int len = 0;
int bufsize = 0;
unsigned char* data = NULL;
struct LMEConnection* module = (struct LMEConnection*)obj;
//printf("LMS THREAD START\r\n");
do {
bufsize = heci_GetBufferSize(&(module->mei));
if ((data = (unsigned char*)malloc(bufsize)) == NULL) ILIBCRITICALEXIT(254);
do {
len = heci_ReceiveMessage(&(module->mei), data, bufsize, 0xFFFFFFFF);
//printf("LMS THREAD READ LEN=%d\r\n", len);
if (len > 0 && data != NULL) LME_doRX(module, data, len);
} while (len >= 0);
module->cb(module, module->cbParam, NULL, 0);
module->initState = INIT_STATE_DISCONNECTED;
free(data);
// printf("LMS TRYING RECONNECT\r\n");
while (module->exit == 0 && module->initState == INIT_STATE_DISCONNECTED)
{
// Setup the MEI interface with the LME GUID
#ifdef WIN32
if (heci_Init(&(module->mei), 1) == TRUE && heci_GetHeciVersion(&(module->mei), &version) == TRUE && version.major >= LMS_PROTOCOL_VERSION) { module->initState = INIT_STATE_CONNECTED; }
#else
if (heci_Init(&(module->mei), 1) == TRUE && heci_GetProtocolVersion(&(module->mei)) >= LMS_PROTOCOL_VERSION) { module->initState = INIT_STATE_CONNECTED; }
#endif
if (module->exit == 0 && module->initState == INIT_STATE_DISCONNECTED)
{
// printf("LMS THREAD SLEEP\r\n");
#ifdef WIN32
Sleep(2000);
#else
sleep(2);
#endif
}
//if (module->initState == INIT_STATE_CONNECTED) printf("LMS THREAD RECONNECT\r\n");
}
}
while (module->exit == 0);
// printf("LMS THREAD QUIT\r\n");
module->exit = 2;
#ifdef WIN32
return 0;
#endif
}
// Setup the LME connection
bool LME_Init(struct LMEConnection* module, MEICallback cb, void *param)
{
#ifdef WIN32
HECI_VERSION version;
#endif
// Setup the state object
memset(module, 0, sizeof(struct LMEConnection));
module->initState = INIT_STATE_DISCONNECTED;
module->cb = cb;
module->cbParam = param;
// Setup the MEI interface with the LME GUID
#ifdef WIN32
if (heci_Init(&(module->mei), 1) == FALSE || heci_GetHeciVersion(&(module->mei), &version) == FALSE || version.major < LMS_PROTOCOL_VERSION) { module->initState = INIT_STATE_DISCONNECTED; return FALSE; }
#else
if (heci_Init(&(module->mei), 1) == FALSE || heci_GetProtocolVersion(&(module->mei)) < LMS_PROTOCOL_VERSION) { module->initState = INIT_STATE_DISCONNECTED; return FALSE; }
#endif
module->initState = INIT_STATE_CONNECTED;
if ((module->txBuffer = (unsigned char*)malloc(LME_GetMeiBufferSize(module))) == NULL) ILIBCRITICALEXIT(254);
// Create the thread that will read the MEI/LME stream
ILibSpawnNormalThread((voidfp1)(&LME_Thread), module);
return TRUE;
}
// Disconnect the LME connection
void LME_Deinit(struct LMEConnection* module)
{
//printf("LME_Deinit()\r\n");
if (module == NULL) return;
if (module->initState == INIT_STATE_CONNECTED) { heci_Deinit(&(module->mei)); }
module->initState = INIT_STATE_DISCONNECTED;
}
// Exit LME
void LME_Exit(struct LMEConnection* module)
{
int l = 0;
//printf("LME_Exit()\r\n");
if (module == NULL) return;
if (module->exit == 0) module->exit = 1;
LME_Deinit(module);
#ifdef WIN32
while (module->exit != 2 && l < 40) { Sleep(100); l++; }
#else
/*
while (module->exit != 2 && l < 4)
{
printf("LME_Holding %d\r\n", l);
Sleep(1);
l++;
}
*/
#endif
if (module->txBuffer != NULL && l < 40) { free(module->txBuffer); module->txBuffer = NULL; }
}
// Send the APF disconnect message to the MEI
bool LME_Disconnect(struct LMEConnection* module, APF_DISCONNECT_REASON_CODE reasonCode)
{
unsigned char buf[sizeof(APF_DISCONNECT_MESSAGE)];
APF_DISCONNECT_MESSAGE *disconnectMessage = (APF_DISCONNECT_MESSAGE *)buf;
memset(disconnectMessage, 0, sizeof(buf));
disconnectMessage->MessageType = APF_DISCONNECT;
disconnectMessage->ReasonCode = htonl(reasonCode);
return (LME_sendMessage(module, buf, sizeof(buf)) == sizeof(buf));
}
// Send the AFP service accept message to the MEI
bool LME_ServiceAccept(struct LMEConnection* module, char* serviceName)
{
int len;
int res;
int servicenamelen = (int)strnlen_s(serviceName, 65535);
unsigned char *buf;
unsigned char *pCurrent;
if (!LME_IsInitialized(module)) return FALSE;
if ((buf = (unsigned char*)malloc(sizeof(APF_SERVICE_ACCEPT_MESSAGE) + servicenamelen)) == NULL) ILIBCRITICALEXIT(254);
pCurrent = buf;
*pCurrent = APF_SERVICE_ACCEPT;
++pCurrent;
*((unsigned int *)pCurrent) = htonl(servicenamelen);
pCurrent += 4;
memcpy_s(pCurrent, servicenamelen, serviceName, servicenamelen);
pCurrent += servicenamelen;
len = (int)(pCurrent - buf);
res = LME_sendMessage(module, buf, len);
free(buf);
return (res == len);
}
bool LME_ProtocolVersion(struct LMEConnection* module, unsigned int majorversion, unsigned int minorversion, unsigned int triggerreason)
{
APF_PROTOCOL_VERSION_MESSAGE protVersion;
memset(&protVersion, 0, sizeof(protVersion));
protVersion.MessageType = APF_PROTOCOLVERSION;
protVersion.MajorVersion = htonl(majorversion);
protVersion.MinorVersion = htonl(minorversion);
protVersion.TriggerReason = htonl(triggerreason);
return (LME_sendMessage(module, (unsigned char *)&protVersion, sizeof(protVersion)) == sizeof(protVersion));
}
bool LME_TcpForwardReplySuccess(struct LMEConnection* module, unsigned int port)
{
APF_TCP_FORWARD_REPLY_MESSAGE message;
memset(&message, 0, sizeof(message));
message.MessageType = APF_REQUEST_SUCCESS;
message.PortBound = htonl(port);
return (LME_sendMessage(module, (unsigned char *)&message, sizeof(message)) == sizeof(message));
}
bool LME_SendShortMessage(struct LMEConnection* module, unsigned char buf)
{
return (LME_sendMessage(module, &buf, sizeof(buf)) == sizeof(buf));
}
bool LME_ChannelOpenForwardedRequest(struct LMEConnection* module, unsigned int senderChannel, char* connectedIP, unsigned int connectedPort, char* originatorIP, unsigned int originatorPort)
{
int res;
int connectedIPlen = (int)strnlen_s(connectedIP, 65535);
int originatorIPlen = (int)strnlen_s(originatorIP, 65535);
unsigned char *buf;
unsigned char *pCurrent;
if (!LME_IsInitialized(module)) return FALSE;
if ((buf = (unsigned char*)malloc(5 + APF_STR_SIZE_OF(APF_OPEN_CHANNEL_REQUEST_FORWARDED) + 16 + connectedIPlen + 8 + originatorIPlen + 4)) == NULL) ILIBCRITICALEXIT(254);
pCurrent = buf;
if (strnlen_s(originatorIP, 65535) > 63) { free(buf); return FALSE; }
*pCurrent = APF_CHANNEL_OPEN;
++pCurrent;
*((unsigned int *)pCurrent) = htonl(APF_STR_SIZE_OF(APF_OPEN_CHANNEL_REQUEST_FORWARDED));
pCurrent += sizeof(unsigned int);
memcpy_s(pCurrent, APF_STR_SIZE_OF(APF_OPEN_CHANNEL_REQUEST_FORWARDED), APF_OPEN_CHANNEL_REQUEST_FORWARDED, APF_STR_SIZE_OF(APF_OPEN_CHANNEL_REQUEST_FORWARDED));
pCurrent += APF_STR_SIZE_OF(APF_OPEN_CHANNEL_REQUEST_FORWARDED);
*((unsigned int *)pCurrent) = htonl(senderChannel);
pCurrent += sizeof(unsigned int);
*((unsigned int *)pCurrent) = htonl(LME_RX_WINDOW_SIZE);
pCurrent += sizeof(unsigned int);
*((unsigned int *)pCurrent) = 0xFFFFFFFF;
pCurrent += sizeof(unsigned int);
*((unsigned int *)pCurrent) = htonl(connectedIPlen);
pCurrent += sizeof(unsigned int);
memcpy_s(pCurrent, connectedIPlen, connectedIP, connectedIPlen);
pCurrent += connectedIPlen;
*((unsigned int *)pCurrent) = htonl(connectedPort);
pCurrent += sizeof(unsigned int);
*((unsigned int *)pCurrent) = htonl((unsigned int)originatorIPlen);
pCurrent += sizeof(unsigned int);
memcpy_s(pCurrent, originatorIPlen, originatorIP, originatorIPlen);
pCurrent += originatorIPlen;
*((unsigned int *)pCurrent) = htonl(originatorPort);
pCurrent += sizeof(unsigned int);
res = LME_sendMessage(module, buf, (int)(pCurrent - buf));
free(buf);
return (res == pCurrent - buf);
}
bool LME_ChannelOpenReplySuccess(struct LMEConnection* module, unsigned int recipientChannel, unsigned int senderChannel)
{
APF_CHANNEL_OPEN_CONFIRMATION_MESSAGE message;
message.MessageType = APF_CHANNEL_OPEN_CONFIRMATION;
message.RecipientChannel = htonl(recipientChannel);
message.SenderChannel = htonl(senderChannel);
message.InitialWindowSize = htonl(LME_RX_WINDOW_SIZE);
message.Reserved = 0xFFFFFFFF;
return (LME_sendMessage(module, (unsigned char*)&message, sizeof(message)) == sizeof(message));
}
bool LME_ChannelOpenReplyFailure(struct LMEConnection* module, unsigned int recipientChannel, unsigned int reason)
{
APF_CHANNEL_OPEN_FAILURE_MESSAGE message;
message.MessageType = APF_CHANNEL_OPEN_FAILURE;
message.RecipientChannel = htonl(recipientChannel);
message.ReasonCode = htonl(reason);
message.Reserved = 0x00000000;
message.Reserved2 = 0x00000000;
return (LME_sendMessage(module, (unsigned char*)&message, sizeof(message)) == sizeof(message));
}
bool LME_ChannelClose(struct LMEConnection* module, unsigned int recipientChannel, unsigned int senderChannel )
{
APF_CHANNEL_CLOSE_MESSAGE message;
UNREFERENCED_PARAMETER( senderChannel );
message.MessageType = APF_CHANNEL_CLOSE;
message.RecipientChannel = htonl(recipientChannel);
return (LME_sendMessage(module, (unsigned char*)&message, sizeof(message)) == sizeof(message));
}
int LME_ChannelData(struct LMEConnection* module, unsigned int recipientChannel, unsigned int len, unsigned char *buffer)
{
APF_CHANNEL_DATA_MESSAGE *message;
if (len > (LME_GetMeiBufferSize(module) - sizeof(APF_CHANNEL_DATA_MESSAGE)) || module->txBuffer == NULL) return -1;
message = (APF_CHANNEL_DATA_MESSAGE*)module->txBuffer;
message->MessageType = APF_CHANNEL_DATA;
message->RecipientChannel = htonl(recipientChannel);
message->DataLength = htonl(len);
memcpy_s(module->txBuffer + sizeof(APF_CHANNEL_DATA_MESSAGE), len, buffer, len);
return LME_sendMessage(module, (unsigned char *)message, sizeof(APF_CHANNEL_DATA_MESSAGE) + len) - sizeof(APF_CHANNEL_DATA_MESSAGE);
}
bool LME_ChannelWindowAdjust(struct LMEConnection* module, unsigned int recipientChannel, unsigned int len)
{
APF_WINDOW_ADJUST_MESSAGE message;
message.MessageType = APF_CHANNEL_WINDOW_ADJUST;
message.RecipientChannel = htonl(recipientChannel);
message.BytesToAdd = htonl(len);
return (LME_sendMessage(module, (unsigned char *)&message, sizeof(message)) == sizeof(message));
}
int LME_sendMessage(struct LMEConnection* module, unsigned char *buffer, int len)
{
int result;
if (!LME_IsInitialized(module)) { return -1; }
result = heci_SendMessage(&(module->mei), buffer, len, MEI_IO_TIMEOUT);
if (result < 0) LME_Deinit(module);
return result;
}
bool LME_checkMinMsgSize(unsigned char *buf, unsigned int bytesRead)
{
switch (buf[0]) {
case APF_DISCONNECT:
if (bytesRead < sizeof(APF_DISCONNECT_MESSAGE)) { return FALSE; }
break;
case APF_SERVICE_REQUEST:
if (bytesRead < sizeof(APF_SERVICE_REQUEST)) { return FALSE; }
if (bytesRead < (sizeof(APF_SERVICE_REQUEST) + ntohl(((APF_SERVICE_REQUEST_MESSAGE *)buf)->ServiceNameLength))) { return FALSE; }
break;
case APF_USERAUTH_REQUEST:
if (bytesRead < (3 * sizeof(unsigned int))) { return FALSE; }
break;
case APF_GLOBAL_REQUEST:
if (bytesRead < (sizeof(APF_GENERIC_HEADER) + sizeof(UINT8))) { return FALSE; }
if (bytesRead < (sizeof(APF_GENERIC_HEADER) + sizeof(UINT8) + ntohl(((APF_GENERIC_HEADER *)buf)->StringLength))) { return FALSE; }
break;
case APF_CHANNEL_OPEN:
if (bytesRead < sizeof(APF_GENERIC_HEADER)) { return FALSE; }
if (bytesRead < (sizeof(APF_GENERIC_HEADER) + ntohl(((APF_GENERIC_HEADER *)buf)->StringLength))) { return FALSE; }
break;
case APF_CHANNEL_OPEN_CONFIRMATION:
if (bytesRead < sizeof(APF_CHANNEL_OPEN_CONFIRMATION_MESSAGE)) { return FALSE; }
break;
case APF_CHANNEL_OPEN_FAILURE:
if (bytesRead < sizeof(APF_CHANNEL_OPEN_FAILURE_MESSAGE)) { return FALSE; }
break;
case APF_CHANNEL_CLOSE:
if (bytesRead < sizeof(APF_CHANNEL_CLOSE_MESSAGE)) { return FALSE; }
break;
case APF_CHANNEL_DATA:
if (bytesRead < sizeof(APF_CHANNEL_DATA_MESSAGE)) { return FALSE; }
if (bytesRead < (sizeof(APF_CHANNEL_DATA_MESSAGE) + ntohl(((APF_CHANNEL_DATA_MESSAGE *)buf)->DataLength))) { return FALSE; }
break;
case APF_CHANNEL_WINDOW_ADJUST:
if (bytesRead < sizeof(APF_WINDOW_ADJUST_MESSAGE)) { return FALSE; }
break;
case APF_PROTOCOLVERSION:
if (bytesRead < sizeof(APF_PROTOCOL_VERSION_MESSAGE)) { return FALSE; }
break;
default:
return FALSE;
}
return TRUE;
}
void LME_doRX(struct LMEConnection* module, unsigned char *rxBuffer, unsigned int bytesRead)
{
if (bytesRead == 0) return;
if (!LME_checkMinMsgSize(rxBuffer, bytesRead)) { LME_Deinit(module); return; }
module->cb(module, module->cbParam, rxBuffer, bytesRead);
}
/*
void LME_apfChannelOpen(struct LMEConnection* module, unsigned char *rxBuffer, unsigned int bytesRead, int *status)
{
APF_GENERIC_HEADER *pHeader = (APF_GENERIC_HEADER *)rxBuffer;
if (_strnicmp((char *)pHeader->String, APF_OPEN_CHANNEL_REQUEST_DIRECT, APF_STR_SIZE_OF(APF_OPEN_CHANNEL_REQUEST_DIRECT)) == 0)
{
unsigned int senderChannel = 0;
LME_apfChannelOpenDirect(module, rxBuffer, bytesRead, &senderChannel, status);
if (LME_IsInitialized(module) && (*status == 1)) {
if (plugin.retry(rxBuffer, bytesRead) != LMS_DROPPED) { LME_apfChannelOpenDirect(module, rxBuffer, bytesRead, NULL, status); }
}
if (LME_IsInitialized(module) && (*status == 1)) {
LME_ChannelOpenReplyFailure(module, senderChannel, OPEN_FAILURE_REASON_CONNECT_FAILED);
}
}
}
void LME_apfChannelOpenDirect(struct LMEConnection* module, unsigned char *rxBuffer, unsigned int bytesRead, unsigned int *senderChannel, int *status)
{
unsigned char *pCurrent;
APF_GENERIC_HEADER *pHeader = (APF_GENERIC_HEADER *)rxBuffer;
if (bytesRead < sizeof(APF_GENERIC_HEADER) +
ntohl(pHeader->StringLength) +
7 + (5 * sizeof(unsigned int))) {
ILIBMESSAGE("apfChannelOpenDirect: Error receiving data from MEI\n");
LME_Deinit(module);
return;
}
pCurrent = rxBuffer + sizeof(APF_GENERIC_HEADER) +
APF_STR_SIZE_OF(APF_OPEN_CHANNEL_REQUEST_DIRECT);
LMEChannelOpenRequestMessage channelOpenRequest;
channelOpenRequest.ChannelType = APF_CHANNEL_DIRECT;
channelOpenRequest.SenderChannel = ntohl(*((unsigned int *)pCurrent));
if (senderChannel) {
*senderChannel = channelOpenRequest.SenderChannel;
}
pCurrent += sizeof(unsigned int);
channelOpenRequest.InitialWindow = ntohl(*((unsigned int *)pCurrent));
pCurrent += 2 * sizeof(unsigned int);
unsigned int len = ntohl(*((unsigned int *)pCurrent));
pCurrent += sizeof(unsigned int);
channelOpenRequest.Address.append((char *)pCurrent, len);
pCurrent += len;
channelOpenRequest.Port = ntohl(*((unsigned int *)pCurrent));
pCurrent += sizeof(unsigned int);
module->_cb(module, module->_cbParam, &channelOpenRequest, sizeof(channelOpenRequest), status);
}
*/
/*
void LME_apfUserAuthRequest(struct LMEConnection* module, unsigned char *rxBuffer, unsigned int bytesRead, int *status)
{
unsigned char *pCurrent = rxBuffer;
++pCurrent;
LMEUserAuthRequestMessage userAuthRequest;
unsigned int len = ntohl(*((unsigned int *)pCurrent));
pCurrent += sizeof(unsigned int);
if ((bytesRead - (pCurrent - rxBuffer)) < len) {
ILIBMESSAGE("_apfUserAuthRequest1: Error receiving data from MEI\n");
LME_Deinit(module);
return;
}
userAuthRequest.Username.append((char *)pCurrent, len);
pCurrent += len;
if ((unsigned int)(bytesRead - (pCurrent - rxBuffer)) < sizeof(unsigned int)) {
ILIBMESSAGE("_apfUserAuthRequest2: Error receiving data from MEI\n");
LME_Deinit(module);
return;
}
len = ntohl(*((unsigned int *)pCurrent));
pCurrent += sizeof(unsigned int);
if ((bytesRead - (pCurrent - rxBuffer)) < len) {
ILIBMESSAGE("_apfUserAuthRequest3: Error receiving data from MEI\n");
LME_Deinit(module);
return;
}
userAuthRequest.ServiceName.append((char *)pCurrent, len);
pCurrent += len;
if ((unsigned int)(bytesRead - (pCurrent - rxBuffer)) < sizeof(unsigned int)) {
ILIBMESSAGE("_apfUserAuthRequest4: Error receiving data from MEI\n");
LME_Deinit(module);
return;
}
len = ntohl(*((unsigned int *)pCurrent));
pCurrent += sizeof(unsigned int);
if ((bytesRead - (pCurrent - rxBuffer)) < len) {
ILIBMESSAGE("_apfUserAuthRequest5: Error receiving data from MEI\n");
LME_Deinit(module);
return;
}
userAuthRequest.MethodName.append((char *)pCurrent, len);
pCurrent += len;
if (_strnicmp(userAuthRequest.MethodName.c_str(), APF_AUTH_PASSWORD,
userAuthRequest.MethodName.size()) == 0) {
if ((unsigned int)(bytesRead - (pCurrent - rxBuffer)) < sizeof(unsigned int) + 1) {
ILIBMESSAGE("_apfUserAuthRequest6: Error receiving data from MEI\n");
LME_Deinit(module);
return;
}
++pCurrent;
len = ntohl(*((unsigned int *)pCurrent));
pCurrent += sizeof(unsigned int);
if ((bytesRead - (pCurrent - rxBuffer)) < len) {
ILIBMESSAGE("_apfUserAuthRequest7: Error receiving data from MEI\n");
LME_Deinit(module);
return;
}
AuthPasswordData authData;
authData.Password.append((char *)pCurrent, len);
pCurrent += len;
userAuthRequest.MethodData = &authData;
}
module->_cb(module, module->_cbParam, &userAuthRequest, sizeof(userAuthRequest), status);
}
*/
unsigned int LME_GetMeiBufferSize(struct LMEConnection* module)
{
return heci_GetBufferSize(&(module->mei));
}
#endif

View File

@@ -0,0 +1,195 @@
/*
Copyright 2006 - 2015 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef _MINCORE
#ifndef __LME_CONNECTION_H__
#define __LME_CONNECTION_H__
#ifdef WIN32
#include "HECIWin.h"
#else
#include "HECILinux.h"
#endif
#include "LMS_if.h"
enum INIT_STATES {
INIT_STATE_DISCONNECTED = 0,
INIT_STATE_CONNECTING,
INIT_STATE_CONNECTED
};
struct LMEConnection;
typedef void (*MEICallback)(struct LMEConnection* module, void *param, void *buffer, unsigned int len);
struct LMEConnection
{
unsigned char reqID;
unsigned char *txBuffer;
MEICallback cb;
void* cbParam;
enum INIT_STATES initState;
unsigned char protocolVer;
struct MEImodule mei;
unsigned char exit;
};
struct LMEDisconnectMessage
{
APF_MESSAGE_TYPE MessageType;
APF_DISCONNECT_REASON_CODE ReasonCode;
};
struct LMEServiceRequestMessage
{
APF_MESSAGE_TYPE MessageType;
char* ServiceName;
};
typedef enum APF_REQUEST_ENUM {
TCP_FORWARD_REQUEST,
TCP_FORWARD_CANCEL_REQUEST,
UDP_SEND_TO
} APF_REQUEST_TYPE;
struct LMEGlobalRequestMessage
{
APF_MESSAGE_TYPE MessageType;
APF_REQUEST_TYPE RequestType;
};
struct LMEProtocolVersionMessage
{
APF_MESSAGE_TYPE MessageType;
unsigned int MajorVersion;
unsigned int MinorVersion;
APF_TRIGGER_REASON TriggerReason;
};
struct LMEUserAuthRequestMessage
{
APF_MESSAGE_TYPE MessageType;
char* Username;
char* ServiceName;
char* MethodName;
char* MethodData;
};
struct LMETcpForwardRequestMessage
{
APF_MESSAGE_TYPE MessageType;
APF_REQUEST_TYPE RequestType;
char* Address;
unsigned int Port;
};
struct LMETcpForwardCancelRequestMessage {
APF_MESSAGE_TYPE MessageType;
APF_REQUEST_TYPE RequestType;
char* Address;
unsigned int Port;
};
struct LMEUdpSendToMessage
{
APF_MESSAGE_TYPE MessageType;
APF_REQUEST_TYPE RequestType;
char* Address;
unsigned int Port;
unsigned int DataLength;
unsigned char *Data;
};
typedef enum APF_CHANNEL_ENUM {
APF_CHANNEL_FORWARDED,
APF_CHANNEL_DIRECT
} APF_CHANNEL_TYPE;
struct LMEChannelOpenRequestMessage
{
APF_MESSAGE_TYPE MessageType;
APF_CHANNEL_TYPE ChannelType;
unsigned int SenderChannel;
unsigned int InitialWindow;
char* Address;
unsigned int Port;
};
struct LMEChannelOpenReplySuccessMessage
{
APF_MESSAGE_TYPE MessageType;
unsigned int RecipientChannel;
unsigned int SenderChannel;
unsigned int InitialWindow;
};
struct LMEChannelOpenReplyFailureMessage
{
APF_MESSAGE_TYPE MessageType;
unsigned int RecipientChannel;
OPEN_FAILURE_REASON ReasonCode;
};
struct LMEChannelCloseMessage
{
APF_MESSAGE_TYPE MessageType;
unsigned int RecipientChannel;
};
struct LMEChannelDataMessage
{
APF_MESSAGE_TYPE MessageType;
unsigned int RecipientChannel;
unsigned int DataLength;
unsigned char *Data;
};
struct LMEChannelWindowAdjustMessage
{
APF_MESSAGE_TYPE MessageType;
unsigned int RecipientChannel;
unsigned int BytesToAdd;
};
bool LME_Init(struct LMEConnection* module, MEICallback cb, void *param);
void LME_Deinit(struct LMEConnection* module);
bool LME_IsInitialized(struct LMEConnection* module);
bool LME_Disconnect(struct LMEConnection* module, APF_DISCONNECT_REASON_CODE reasonCode);
bool LME_ServiceAccept(struct LMEConnection* module, char* serviceName);
bool LME_ProtocolVersion(struct LMEConnection* module, unsigned int majorversion, unsigned int minorversion, unsigned int triggerreason);
bool LME_TcpForwardReplySuccess(struct LMEConnection* module, unsigned int port);
bool LME_SendShortMessage(struct LMEConnection* module, unsigned char buf);
bool LME_ChannelOpenForwardedRequest(struct LMEConnection* module, unsigned int sender, char* connectedIP, unsigned int connectedPort, char* originatorIP, unsigned int originatorPort);
bool LME_ChannelOpenReplySuccess(struct LMEConnection* module, unsigned int recipient, unsigned int sender);
bool LME_ChannelOpenReplyFailure(struct LMEConnection* module, unsigned int recipient, unsigned int reason);
bool LME_ChannelClose(struct LMEConnection* module, unsigned int recipient, unsigned int sender);
int LME_ChannelData(struct LMEConnection* module, unsigned int recipient, unsigned int len, unsigned char *buffer);
bool LME_ChannelWindowAdjust(struct LMEConnection* module, unsigned int recipient, unsigned int len);
void LME_Deinit(struct LMEConnection* module);
void LME_Exit(struct LMEConnection* module);
unsigned int LME_GetMeiBufferSize(struct LMEConnection* module);
#define LME_UserAuthSuccess(module) LME_SendShortMessage(module, APF_USERAUTH_SUCCESS)
#define LME_TcpForwardReplyFailure(module) LME_SendShortMessage(module, APF_REQUEST_FAILURE)
#define LME_TcpForwardCancelReplySuccess(module) LME_SendShortMessage(module, APF_REQUEST_SUCCESS)
#define LME_TcpForwardCancelReplyFailure(module) LME_SendShortMessage(module, APF_REQUEST_FAILURE)
#endif
#endif

197
microlms/heci/LMS_if.h Normal file
View File

@@ -0,0 +1,197 @@
/*******************************************************************************
* Copyright (C) 2004-2011 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Intel Corporation. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef _MINCORE
#ifndef _LMS_IF_H_
#define _LMS_IF_H_
#include "LMS_if_constants.h"
#pragma pack(1)
typedef struct {
unsigned char MessageType;
} APF_MESSAGE_HEADER;
/**
* APF_GENERIC_HEADER - generic request header (note that its not complete header per protocol (missing WantReply)
*
* @MessageType:
* @RequestStringLength: length of the string identifies the request
* @RequestString: the string that identifies the request
**/
typedef struct {
unsigned char MessageType;
unsigned int StringLength;
unsigned char String[0];
} APF_GENERIC_HEADER;
/**
* TCP forward reply message
* @MessageType - Protocol's Major version
* @PortBound - the TCP port was bound on the server
**/
typedef struct {
unsigned char MessageType;
unsigned int PortBound;
} APF_TCP_FORWARD_REPLY_MESSAGE;
/**
* response to ChannelOpen when channel open succeed
* @MessageType - APF_CHANNEL_OPEN_CONFIRMATION
* @RecipientChannel - channel number given in the open request
* @SenderChannel - channel number assigned by the sender
* @InitialWindowSize - Number of bytes in the window
* @Reserved - Reserved
**/
typedef struct {
unsigned char MessageType;
unsigned int RecipientChannel;
unsigned int SenderChannel;
unsigned int InitialWindowSize;
unsigned int Reserved;
} APF_CHANNEL_OPEN_CONFIRMATION_MESSAGE;
/**
* response to ChannelOpen when a channel open failed
* @MessageType - APF_CHANNEL_OPEN_FAILURE
* @RecipientChannel - channel number given in the open request
* @ReasonCode - code for the reason channel could not be open
* @Reserved - Reserved
**/
typedef struct {
unsigned char MessageType;
unsigned int RecipientChannel;
unsigned int ReasonCode;
unsigned int Reserved;
unsigned int Reserved2;
} APF_CHANNEL_OPEN_FAILURE_MESSAGE;
/**
* close channel message
* @MessageType - APF_CHANNEL_CLOSE
* @RecipientChannel - channel number given in the open request
**/
typedef struct {
unsigned char MessageType;
unsigned int RecipientChannel;
} APF_CHANNEL_CLOSE_MESSAGE;
/**
* used to send/receive data.
* @MessageType - APF_CHANNEL_DATA
* @RecipientChannel - channel number given in the open request
* @Length - Length of the data in the message
* @Data - The data in the message
**/
typedef struct {
unsigned char MessageType;
unsigned int RecipientChannel;
unsigned int DataLength;
// unsigned char Data[0];
} APF_CHANNEL_DATA_MESSAGE;
/**
* used to adjust receive window size.
* @MessageType - APF_WINDOW_ADJUST
* @RecipientChannel - channel number given in the open request
* @BytesToAdd - number of bytes to add to current window size value
**/
typedef struct {
unsigned char MessageType;
unsigned int RecipientChannel;
unsigned int BytesToAdd;
} APF_WINDOW_ADJUST_MESSAGE;
/**
* This message causes immediate termination of the connection with AMT.
* @ReasonCode - A Reason code for the disconnection event
* @Reserved - Reserved must be set to 0
**/
typedef struct {
unsigned char MessageType;
unsigned int ReasonCode;
unsigned short Reserved;
} APF_DISCONNECT_MESSAGE;
/**
* Used to request a service identified by name
* @ServiceNameLength - The length of the service name string.
* @ServiceName - The name of the service being requested.
**/
typedef struct {
unsigned char MessageType;
unsigned int ServiceNameLength;
unsigned char ServiceName[0];
} APF_SERVICE_REQUEST_MESSAGE;
/**
* Used to send a service accept identified by name
* @ServiceNameLength - The length of the service name string.
* @ServiceName - The name of the service being requested.
**/
typedef struct {
unsigned char MessageType;
unsigned int ServiceNameLength;
unsigned char ServiceName[0];
} APF_SERVICE_ACCEPT_MESSAGE;
/**
* holds the protocl major and minor version implemented by AMT.
* @MajorVersion - Protocol's Major version
* @MinorVersion - Protocol's Minor version
* @Trigger - The open session reason
* @UUID - System Id
**/
typedef struct {
unsigned char MessageType;
unsigned int MajorVersion;
unsigned int MinorVersion;
unsigned int TriggerReason;
unsigned char UUID[16];
unsigned char Reserved[64];
} APF_PROTOCOL_VERSION_MESSAGE;
/**
* holds the user authentication request success reponse.
**/
typedef struct {
unsigned char MessageType;
} APF_USERAUTH_SUCCESS_MESSAGE;
#pragma pack()
#endif
#endif

View File

@@ -0,0 +1,116 @@
/*******************************************************************************
* Copyright (C) 2004-2011 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Intel Corporation. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corporation. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef _MINCORE
#ifndef _LMS_IF_CONSTANTS_H_
#define _LMS_IF_CONSTANTS_H_
#define LMS_PROTOCOL_VERSION 4
//
// messages opcodes
//
typedef enum {
APF_DISCONNECT = 1,
APF_SERVICE_REQUEST = 5,
APF_SERVICE_ACCEPT = 6,
APF_USERAUTH_REQUEST = 50,
APF_USERAUTH_FAILURE = 51,
APF_USERAUTH_SUCCESS = 52,
APF_GLOBAL_REQUEST = 80,
APF_REQUEST_SUCCESS = 81,
APF_REQUEST_FAILURE = 82,
APF_CHANNEL_OPEN = 90,
APF_CHANNEL_OPEN_CONFIRMATION = 91,
APF_CHANNEL_OPEN_FAILURE = 92,
APF_CHANNEL_WINDOW_ADJUST = 93,
APF_CHANNEL_DATA = 94,
APF_CHANNEL_CLOSE = 97,
APF_PROTOCOLVERSION = 192
} APF_MESSAGE_TYPE;
typedef enum {
APF_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT = 1,
APF_DISCONNECT_PROTOCOL_ERROR = 2,
APF_DISCONNECT_KEY_EXCHANGE_FAILED = 3,
APF_DISCONNECT_RESERVED = 4,
APF_DISCONNECT_MAC_ERROR = 5,
APF_DISCONNECT_COMPRESSION_ERROR = 6,
APF_DISCONNECT_SERVICE_NOT_AVAILABLE = 7,
APF_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED = 8,
APF_DISCONNECT_HOST_KEY_NOT_VERIFIABLE = 9,
APF_DISCONNECT_CONNECTION_LOST = 10,
APF_DISCONNECT_BY_APPLICATION = 11,
APF_DISCONNECT_TOO_MANY_CONNECTIONS = 12,
APF_DISCONNECT_AUTH_CANCELLED_BY_USER = 13,
APF_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE = 14,
APF_DISCONNECT_ILLEGAL_USER_NAME = 15
} APF_DISCONNECT_REASON_CODE;
//
//strings used in global messages
//
#define APF_GLOBAL_REQUEST_STR_TCP_FORWARD_REQUEST "tcpip-forward"
#define APF_GLOBAL_REQUEST_STR_TCP_FORWARD_CANCEL_REQUEST "cancel-tcpip-forward"
#define APF_GLOBAL_REQUEST_STR_UDP_SEND_TO "udp-send-to@amt.intel.com"
#define APF_OPEN_CHANNEL_REQUEST_FORWARDED "forwarded-tcpip"
#define APF_OPEN_CHANNEL_REQUEST_DIRECT "direct-tcpip"
// APF service names
#define APF_SERVICE_PFWD "pfwd@amt.intel.com"
#define APF_SERVICE_AUTH "auth@amt.intel.com"
// APF Authentication method
#define APF_AUTH_NONE "none"
#define APF_AUTH_PASSWORD "password"
//calculate string length without the NULL terminator
#define APF_STR_SIZE_OF(s) (sizeof(s)-1)
// Trigger reason code
typedef enum {
USER_INITIATED_REQUEST = 1,
ALERT_REQUEST = 2,
HIT_PROVISIONING_REQUEST = 3,
PERIODIC_REQUEST = 4,
LME_REQUEST = 254
} APF_TRIGGER_REASON;
typedef enum {
OPEN_FAILURE_REASON_ADMINISTRATIVELY_PROHIBITED = 1,
OPEN_FAILURE_REASON_CONNECT_FAILED = 2,
OPEN_FAILURE_REASON_UNKNOWN_CHANNEL_TYPE = 3,
OPEN_FAILURE_REASON_RESOURCE_SHORTAGE = 4
} OPEN_FAILURE_REASON;
#endif
#endif

1440
microlms/heci/PTHICommand.c Normal file

File diff suppressed because it is too large Load Diff

825
microlms/heci/PTHICommand.h Normal file
View File

@@ -0,0 +1,825 @@
/*******************************************************************************
* Copyright (C) 2004-2008 Intel Corp. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Intel Corp. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef _MINCORE
//----------------------------------------------------------------------------
//
// File: PTHICommand.h
//
// Contents: header file of PTHICommand class
//
//----------------------------------------------------------------------------
#ifndef __PTHI_COMMAND_H__
#define __PTHI_COMMAND_H__
#include "StatusCodeDefinitions.h"
#ifdef WIN32
#include <windows.h>
#include "HECIwin.h"
#endif
#ifdef _POSIX
#include "HECILinux.h"
#endif
#define CERT_HASH_MAX_LENGTH 64
#define CERT_HASH_MAX_NUMBER 23
#define NET_TLS_CERT_PKI_MAX_SERIAL_NUMS 3
#define NET_TLS_CERT_PKI_MAX_SERIAL_NUM_LENGTH 16
#define MPS_HOSTNAME_LENGTH 256
#define CFG_MAX_ACL_USER_LENGTH 33
#define CFG_MAX_ACL_PWD_LENGTH 33
#pragma pack(1)
typedef struct _LOCAL_SYSTEM_ACCOUNT
{
// contain null terminated string
char username[CFG_MAX_ACL_USER_LENGTH];
// contain null terminated string
char password[CFG_MAX_ACL_PWD_LENGTH];
}LOCAL_SYSTEM_ACCOUNT;
#pragma pack()
/*
* Constants
*/
/*
static #define IDER_LOG_ENTRIES = 16;
const UINT8 MAJOR_VERSION = 1;
const UINT8 MINOR_VERSION = 1;
const UINT8 AMT_MAJOR_VERSION = 1;
const UINT8 AMT_MINOR_VERSION = 1;
*/
#define IDER_LOG_ENTRIES 16
#define MAJOR_VERSION 1
#define MINOR_VERSION 1
#define AMT_MAJOR_VERSION 1
#define AMT_MINOR_VERSION 1
typedef enum _CFG_PROVISIONING_MODE
{
CFG_PROVISIONING_MODE_NONE = 0,
CFG_PROVISIONING_MODE_ENTERPRISE,
CFG_PROVISIONING_MODE_SMALL_BUSINESS,
CFG_PROVISIONING_MODE_REMOTE_ASSISTANCE
} CFG_PROVISIONING_MODE;
typedef enum _AMT_PROVISIONING_STATE
{
PROVISIONING_STATE_PRE = 0,
PROVISIONING_STATE_IN = 1,
PROVISIONING_STATE_POST = 2
} AMT_PROVISIONING_STATE;
typedef enum _AMT_EHBC_STATE
{
EHBC_STATE_DISABLED = 0,
EHBC_STATE_ENABLED = 1
} AMT_EHBC_STATE;
typedef enum _AMT_FEATURE_STATE_REQUEST
{
REDIRECTION_SESSION = 0,
SYSTEM_DEFENSE = 1,
WEB_UI = 2
} AMT_FEATURE_STATE_REQUEST;
typedef enum _AMT_LAST_HOST_RESET_REASON
{
RemoteControl = 0,
Other = 1
} AMT_LAST_HOST_RESET_REASON;
typedef enum _AMT_INTERFACE_INDEX
{
WIRED = 0,
WIRELESS = 1
} AMT_INTERFACE_INDEX;
typedef enum _AMT_DHCP_IP_ADDRESS
{
ACTIVE = 1,
PASSIVE = 2
} AMT_DHCP_IP_MODE;
//typedef UINT32 CFG_IPv4_ADDRESS
#define CFG_IPv4_ADDRESS UINT32
/*
static #define BIOS_VERSION_LEN = 65;
static #define VERSIONS_NUMBER = 50;
static #define UNICODE_STRING_LEN = 20;
*/
#define BIOS_VERSION_LEN 65
#define VERSIONS_NUMBER 50
#define UNICODE_STRING_LEN 20
typedef enum _AMT_PROVISIONING_TLS_MODE
{
NOT_READY = 0,
PSK = 1,
PKI = 2
} AMT_PROVISIONING_TLS_MODE;
typedef enum _AMT_RNG_STATUS
{
RNG_STATUS_EXIST = 0,
RNG_STATUS_IN_PROGRESS = 1,
RNG_STATUS_NOT_EXIST = 2
} AMT_RNG_STATUS;
#pragma pack(1)
typedef struct _AMT_UNICODE_STRING
{
UINT16 Length;
UINT8 String[UNICODE_STRING_LEN];
} AMT_UNICODE_STRING;
typedef struct _AMT_VERSION_TYPE
{
AMT_UNICODE_STRING Description;
AMT_UNICODE_STRING Version;
} AMT_VERSION_TYPE;
typedef struct _PTHI_VERSION
{
UINT8 MajorNumber;
UINT8 MinorNumber;
} PTHI_VERSION;
typedef struct _CODE_VERSIONS
{
UINT8 BiosVersion[BIOS_VERSION_LEN];
UINT32 VersionsCount;
AMT_VERSION_TYPE Versions[VERSIONS_NUMBER];
} CODE_VERSIONS;
typedef struct _COMMAND_FMT
{
union
{
UINT32 val;
struct
{
UINT32 Operation : 23;
UINT32 IsResponse : 1;
UINT32 Class : 8;
} fields;
} cmd;
} COMMAND_FMT;
typedef struct _AMT_ANSI_STRING
{
UINT16 Length;
CHAR *Buffer;
} AMT_ANSI_STRING;
typedef struct _PTHI_MESSAGE_HEADER
{
PTHI_VERSION Version;
UINT16 Reserved;
COMMAND_FMT Command;
UINT32 Length;
} PTHI_MESSAGE_HEADER;
typedef struct _PTHI_RESPONSE_MESSAGE_HEADER
{
PTHI_MESSAGE_HEADER Header;
AMT_STATUS Status;
} PTHI_RESPONSE_MESSAGE_HEADER;
typedef struct _CFG_GET_CODE_VERSIONS_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
CODE_VERSIONS CodeVersions;
} CFG_GET_CODE_VERSIONS_RESPONSE;
typedef struct _CFG_GET_PROVISIONING_MODE_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
CFG_PROVISIONING_MODE ProvisioningMode;
AMT_BOOLEAN LegacyMode;
} CFG_GET_PROVISIONING_MODE_RESPONSE;
typedef struct _CFG_GET_PROVISIONING_STATE_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_PROVISIONING_STATE ProvisioningState;
} CFG_GET_PROVISIONING_STATE_RESPONSE;
typedef struct _CFG_GET_MAC_ADDRESSES_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
UINT8 DedicatedMac[6];
UINT8 HostMac[6];
} CFG_GET_MAC_ADDRESSES_RESPONSE;
typedef struct _CFG_GET_FEATURES_STATE_REQUEST
{
PTHI_MESSAGE_HEADER Header;
UINT32 RequestID;
} CFG_GET_FEATURES_STATE_REQUEST;
typedef struct _GET_FEATURES_REDIRECTION_SESSION_STATUS
{
AMT_BOOLEAN IderOpen;
AMT_BOOLEAN SolOpen;
AMT_BOOLEAN Reserved;
} GET_FEATURES_REDIRECTION_SESSION_STATUS;
typedef struct _GET_FEATURES_SYSTEM_DEFENSE_STATE_RESPONSE
{
AMT_BOOLEAN SystemDefenseActivated;
} GET_FEATURES_SYSTEM_DEFENSE_STATUS_RESPONSE;
typedef struct _GET_FEATURES_WEB_UI_STATE_RESPONSE
{
AMT_BOOLEAN WebUiEnabled;
} GET_FEATURES_WEB_UI_STATUS_RESPONSE;
typedef union _FEATURES_STATUS_DATA
{
GET_FEATURES_REDIRECTION_SESSION_STATUS rs;
GET_FEATURES_SYSTEM_DEFENSE_STATUS_RESPONSE sd;
GET_FEATURES_WEB_UI_STATUS_RESPONSE webUI;
} FEATURES_STATUS_DATA;
typedef struct _CFG_GET_FEATURES_STATE_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
UINT32 RequestID;
FEATURES_STATUS_DATA Data;
} CFG_GET_FEATURES_STATE_RESPONSE;
typedef struct _CFG_GET_CURRENT_POWER_POLICY_REQUEST
{
PTHI_MESSAGE_HEADER Header;
} CFG_GET_CURRENT_POWER_POLICY_REQUEST;
typedef struct _CFG_GET_CURRENT_POWER_POLICY_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_ANSI_STRING PolicyName;
} CFG_GET_CURRENT_POWER_POLICY_RESPONSE;
typedef struct _CFG_GET_LAST_HOST_RESET_REASON_REQUEST
{
PTHI_MESSAGE_HEADER Header;
} CFG_GET_LAST_HOST_RESET_REASON_REQUEST;
typedef struct _CFG_GET_LAST_HOST_RESET_REASON_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
UINT32 Reason;
UINT32 RemoteControlTimeStamp;
} CFG_GET_LAST_HOST_RESET_REASON_RESPONSE;
typedef struct _LAN_SETTINGS
{
AMT_BOOLEAN Enabled;
CFG_IPv4_ADDRESS Ipv4Address;
AMT_BOOLEAN DhcpEnabled;
UINT8 DhcpIpMode;
UINT8 LinkStatus;
UINT8 MacAddress[6];
} LAN_SETTINGS;
typedef struct _CFG_GET_LAN_INTERFACE_SETTINGS_REQUEST
{
PTHI_MESSAGE_HEADER Header;
UINT32 InterfaceIndex;
} CFG_GET_LAN_INTERFACE_SETTINGS_REQUEST;
typedef struct _CFG_GET_LAN_INTERFACE_SETTINGS_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_BOOLEAN Enabled;
CFG_IPv4_ADDRESS Ipv4Address;
AMT_BOOLEAN DhcpEnabled;
UINT8 DhcpIpMode;
UINT8 LinkStatus;
UINT8 MacAddress[6];
} CFG_GET_LAN_INTERFACE_SETTINGS_RESPONSE;
typedef struct _CFG_GET_SECURITY_PARAMETERS_REQUEST
{
PTHI_MESSAGE_HEADER Header;
} CFG_GET_SECURITY_PARAMETERS_REQUEST;
typedef struct _CFG_GET_SECURITY_PARAMETERS_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_BOOLEAN EnterpriseMode;
AMT_BOOLEAN TLSEnabled;
AMT_BOOLEAN HWCryptoEnabled;
AMT_PROVISIONING_STATE ProvisioningState;
AMT_BOOLEAN NetworkInterfaceEnabled;
AMT_BOOLEAN SOLEnabled;
AMT_BOOLEAN IDEREnabled;
AMT_BOOLEAN FWUpdateEnabled;
AMT_BOOLEAN LinkIsUp;
AMT_BOOLEAN Reserved[8];
} CFG_GET_SECURITY_PARAMETERS_RESPONSE;
typedef struct _CFG_GET_DNS_SUFFIX_LIST_REQUEST
{
PTHI_MESSAGE_HEADER Header;
} CFG_GET_DNS_SUFFIX_LIST_REQUEST;
typedef struct _CFG_GET_DNS_SUFFIX_LIST_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
UINT16 DataLength;
UINT8 Data[0];
} CFG_GET_DNS_SUFFIX_LIST_RESPONSE;
/**
* CFG_SET_ENTERPRISE_ACCESS_REQUEST
*
* Flags Bit 0 - If this bit is set then HostIPAddress is IPv6, otherwise HostIPAddress is IPv4 address.
* Bits 1..7 - Reserved, should be zero.
* HostIPAddress IPv4 / IPv6 address
* EnterpriseAccess 1 if LMS has access to enterprise network, otherwise 0.
*/
typedef struct _CFG_SET_ENTERPRISE_ACCESS_REQUEST
{
PTHI_MESSAGE_HEADER Header;
UINT8 Flags;
UINT8 HostIPAddress[16];
UINT8 EnterpriseAccess;
} CFG_SET_ENTERPRISE_ACCESS_REQUEST;
typedef struct _CFG_SET_ENTERPRISE_ACCESS_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
} CFG_SET_ENTERPRISE_ACCESS_RESPONSE;
typedef struct _CFG_OPEN_USER_INITIATED_CONNECTION_REQUEST
{
PTHI_MESSAGE_HEADER Header;
} CFG_OPEN_USER_INITIATED_CONNECTION_REQUEST;
typedef struct _CFG_OPEN_USER_INITIATED_CONNECTION_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
} CFG_OPEN_USER_INITIATED_CONNECTION_RESPONSE;
typedef struct _CFG_CLOSE_USER_INITIATED_CONNECTION_REQUEST
{
PTHI_MESSAGE_HEADER Header;
} CFG_CLOSE_USER_INITIATED_CONNECTION_REQUEST;
typedef struct _CFG_CLOSE_USER_INITIATED_CONNECTION_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
} CFG_CLOSE_USER_INITIATED_CONNECTION_RESPONSE;
typedef enum
{
AMT_NETWORK_CONNECTION_DIRECT = 0,
AMT_NETWORK_CONNECTION_VPN,
AMT_NETWORK_CONNECTION_OUTSIDE_ENTERPRISE
} AMT_NETWORK_CONNECTION_STATUS;
typedef enum
{
REMOTE_ACCESS_CONNECTION_STATUS_NOT_CONNECTED = 0,
REMOTE_ACCESS_CONNECTION_STATUS_CONNECTING,
REMOTE_ACCESS_CONNECTION_STATUS_CONNECTED
} REMOTE_ACCESS_CONNECTION_STATUS;
typedef enum
{
REMOTE_ACCESS_CONNECTION_TRIGGER_USER_INITIATED = 0,
REMOTE_ACCESS_CONNECTION_TRIGGER_ALERT,
REMOTE_ACCESS_CONNECTION_TRIGGER_PROVISIONING,
REMOTE_ACCESS_CONNECTION_TRIGGER_PERIODIC
} REMOTE_ACCESS_CONNECTION_TRIGGER;
typedef struct _CFG_GET_REMOTE_ACCESS_CONNECTION_STATUS_REQUEST
{
PTHI_MESSAGE_HEADER Header;
} CFG_GET_REMOTE_ACCESS_CONNECTION_STATUS_REQUEST;
typedef struct _CFG_GET_REMOTE_ACCESS_CONNECTION_STATUS_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_NETWORK_CONNECTION_STATUS AmtNetworkConnectionStatus;
REMOTE_ACCESS_CONNECTION_STATUS RemoteAccessConnectionStatus;
REMOTE_ACCESS_CONNECTION_TRIGGER RemoteAccessConnectionTrigger;
AMT_ANSI_STRING MpsHostname;
} CFG_GET_REMOTE_ACCESS_CONNECTION_STATUS_RESPONSE;
typedef struct _REMOTE_ACCESS_STATUS
{
AMT_NETWORK_CONNECTION_STATUS AmtNetworkConnectionStatus;
REMOTE_ACCESS_CONNECTION_STATUS RemoteAccessConnectionStatus;
REMOTE_ACCESS_CONNECTION_TRIGGER RemoteAccessConnectionTrigger;
AMT_ANSI_STRING MpsHostname;
} REMOTE_ACCESS_STATUS;
typedef UINT8 AMT_UUID[16];
//const AMT_UUID AMT_UUID_LINK_STATE;
typedef struct _STATE_DATA
{
UINT8 LinkStatus; // (0 - down; 1 - up)
UINT8 HardSKU;
UINT8 CryptoFuse; // (0 - disabled; 1 - enabled)
UINT8 FlashProtaction; // (0 - disabled; 1 - enabled)
UINT8 LastMEResetReason;
} STATE_DATA;
typedef struct _STATE_GET_AMT_STATE_REQUEST
{
PTHI_MESSAGE_HEADER Header;
AMT_UUID StateVariableIdentifier;
} STATE_GET_AMT_STATE_REQUEST;
typedef struct _STATE_GET_AMT_STATE_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_UUID StateDataIdentifier;
UINT32 ByteCount;
STATE_DATA StateData;
} STATE_GET_AMT_STATE_RESPONSE;
typedef struct _AMT_HASH_HANDLES
{
UINT32 Length;
UINT32 Handles[CERT_HASH_MAX_NUMBER];
} AMT_HASH_HANDLES;
typedef struct _CERTHASH_ENTRY
{
AMT_BOOLEAN IsDefault;
AMT_BOOLEAN IsActive;
UINT8 CertificateHash[CERT_HASH_MAX_LENGTH];
UINT8 HashAlgorithm;
AMT_ANSI_STRING Name;
} CERTHASH_ENTRY;
typedef enum
{
CERT_HASH_ALGORITHM_MD5 = 0, // 16 bytes
CERT_HASH_ALGORITHM_SHA1, // 20 bytes
CERT_HASH_ALGORITHM_SHA256, // 32 bytes
CERT_HASH_ALGORITHM_SHA512, // 64 bytes
} CERT_HASH_ALGORITHM;
typedef struct
{
UINT16 Year;
UINT16 Month;
UINT16 DayOfWeek;
UINT16 Day;
UINT16 Hour;
UINT16 Minute;
UINT16 Second;
} TIME_DATE;
typedef struct _AMT_PROV_AUDIT_RECORD
{
UINT8 ProvisioningTLSMode;
AMT_BOOLEAN SecureDNS;
AMT_BOOLEAN HostInitiated;
CERT_HASH_ALGORITHM SelectedHashType;
UINT8 SelectedHashData[CERT_HASH_MAX_LENGTH];
UINT8 CaCertificateSerials[NET_TLS_CERT_PKI_MAX_SERIAL_NUMS*NET_TLS_CERT_PKI_MAX_SERIAL_NUM_LENGTH];
AMT_BOOLEAN AdditionalCaSerialNums;
AMT_BOOLEAN IsOemDefault;
AMT_BOOLEAN IsTimeValid;
UINT32 ProvServerIP;
TIME_DATE TlsStartTime;
AMT_ANSI_STRING ProvServerFQDN;
} AMT_PROV_AUDIT_RECORD;
typedef struct _CFG_GENERATE_RNG_SEED_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
} CFG_GENERATE_RNG_SEED_RESPONSE;
typedef struct _CFG_GET_RNG_SEED_STATUS_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_RNG_STATUS RngStatus;
} CFG_GET_RNG_SEED_STATUS_RESPONSE;
typedef struct _CFG_GET_ZERO_TOUCH_ENABLED_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_BOOLEAN ZeroTouchEnabled;
} CFG_GET_ZERO_TOUCH_ENABLED_RESPONSE;
typedef struct _CFG_GET_PROVISIONING_TLS_MODE_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_PROVISIONING_TLS_MODE ProvisioningTlsMode;
} CFG_GET_PROVISIONING_TLS_MODE_RESPONSE;
typedef struct _CFG_START_CONFIGURATION_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
} CFG_START_CONFIGURATION_RESPONSE;
typedef struct _CFG_STOP_CONFIGURATION_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
} CFG_STOP_CONFIGURATION_RESPONSE;
typedef struct _CFG_SET_PROVISIONING_SERVER_OTP_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
} CFG_SET_PROVISIONING_SERVER_OTP_RESPONSE;
typedef struct _CFG_SET_DNS_SUFFIX_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
} CFG_SET_DNS_SUFFIX_RESPONSE;
typedef struct _CFG_GET_HASH_HANDLES_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_HASH_HANDLES HashHandles;
} CFG_GET_HASH_HANDLES_RESPONSE;
typedef struct _CFG_GET_CERTHASH_ENTRY_REQUEST
{
PTHI_MESSAGE_HEADER Header;
UINT32 HashHandle;
} CFG_GET_CERTHASH_ENTRY_REQUEST;
typedef struct _CFG_GET_CERTHASH_ENTRY_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
CERTHASH_ENTRY Hash;
} CFG_GET_CERTHASH_ENTRY_RESPONSE;
typedef struct _CFG_GET_PKI_FQDN_SUFFIX_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_ANSI_STRING Suffix;
} CFG_GET_PKI_FQDN_SUFFIX_RESPONSE;
typedef struct CFG_SET_HOST_FQDN_REQUEST
{
PTHI_MESSAGE_HEADER Header;
UINT16 FQDNL;
char FQDN[256];
}CFG_SET_HOST_FQDN_REQUEST;
typedef struct _CFG_SET_HOST_FQDN_RESPONSE
{
PTHI_MESSAGE_HEADER Header;
AMT_STATUS Status;
} CFG_SET_HOST_FQDN_RESPONSE;
typedef struct _CFG_GET_LOCAL_SYSTEM_ACCOUNT_RESPONSE
{
PTHI_MESSAGE_HEADER Header;
AMT_STATUS Status;
LOCAL_SYSTEM_ACCOUNT Account;
} CFG_GET_LOCAL_SYSTEM_ACCOUNT_RESPONSE;
typedef struct _CFG_GET_LOCAL_SYSTEM_ACCOUNT_REQUEST
{
PTHI_MESSAGE_HEADER Header;
UINT8 Reserved[40];
} CFG_GET_LOCAL_SYSTEM_ACCOUNT_REQUEST;
typedef struct _CFG_UNPROVISION_RESPONSE
{
PTHI_MESSAGE_HEADER Header;
AMT_STATUS Status;
} CFG_UNPROVISION_RESPONSE;
typedef struct _CFG_UNPROVISION_REQUEST
{
PTHI_MESSAGE_HEADER Header;
UINT32 Mode;
} CFG_UNPROVISION_REQUEST;
typedef struct _CFG_GETEHBPSTATE_REQUEST
{
PTHI_MESSAGE_HEADER Header;
} CFG_GETEHBPSTATE_REQUEST;
typedef struct _CFG_GETEHBPSTATE_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
AMT_EHBC_STATE EHBCState;
} CFG_GETEHBPSTATE_RESPONSE;
typedef struct _CFG_GET_CONTROL_MODE_REQUEST
{
PTHI_MESSAGE_HEADER Header;
} CFG_GET_CONTROL_MODE_REQUEST;
typedef struct _CFG_GET_CONTROL_MODE_RESPONSE
{
PTHI_RESPONSE_MESSAGE_HEADER Header;
int state;
} CFG_GET_CONTROL_MODE_RESPONSE;
#pragma pack()
AMT_STATUS pthi_GetCodeVersions(CODE_VERSIONS *codeVersions);
AMT_STATUS pthi_GetProvisioningMode(CFG_PROVISIONING_MODE *provisioningMode, AMT_BOOLEAN *legacy);
AMT_STATUS pthi_GetProvisioningState(AMT_PROVISIONING_STATE *state);
AMT_STATUS pthi_GetMacAddresses(UINT8 DedicatedMac[6], UINT8 HostMac[6]);
AMT_STATUS pthi_GetFeaturesState(UINT32 requestID, AMT_BOOLEAN (*requestStatus)[2]);
AMT_STATUS pthi_GetLastHostResetReason(UINT32 *Reason, UINT32 *RemoteControlTimeStamp);
AMT_STATUS pthi_GetCurrentPowerPolicy(AMT_ANSI_STRING *policyName);
AMT_STATUS pthi_GetLanInterfaceSettings(UINT32 interfaceSettings, LAN_SETTINGS *lanSettings);
AMT_STATUS pthi_GetHeciVersion(HECI_VERSION *hecVersion);
AMT_STATUS pthi_GetTLSEnabled(AMT_BOOLEAN *tlsEnabled);
//AMT_STATUS pthi_GetDNSSuffixList(std::list<std::string> *dnsSuffixList);
AMT_STATUS pthi_SetEnterpriseAccess(UINT8 Flags, UINT8 HostIPAddress[16], UINT8 EnterpriseAccess);
AMT_STATUS pthi_GetFWResetReason(UINT8 *MEResetReason);
AMT_STATUS pthi_OpenUserInitiatedConnection();
AMT_STATUS pthi_CloseUserInitiatedConnection();
AMT_STATUS pthi_GetRemoteAccessConnectionStatus(REMOTE_ACCESS_STATUS *remoteAccessStatus);
AMT_STATUS pthi_GenerateRngKey();
AMT_STATUS pthi_GetRngSeedStatus(AMT_RNG_STATUS *rngStatus);
AMT_STATUS pthi_GetZeroTouchEnabled(AMT_BOOLEAN *zeroTouchEnabled);
AMT_STATUS pthi_GetProvisioningTlsMode(AMT_PROVISIONING_TLS_MODE *provisioningTlsMode);
AMT_STATUS pthi_StartConfiguration();
AMT_STATUS pthi_StopConfiguration();
AMT_STATUS pthi_SetProvisioningServerOTP(AMT_ANSI_STRING passwordOTP);
AMT_STATUS pthi_SetDnsSuffix(AMT_ANSI_STRING dnsSuffix);
AMT_STATUS pthi_EnumerateHashHandles(AMT_HASH_HANDLES *hashHandles);
AMT_STATUS pthi_GetCertificateHashEntry(UINT32 hashHandle, CERTHASH_ENTRY *hashEntry);
AMT_STATUS pthi_GetDnsSuffix(AMT_ANSI_STRING *dnsSuffix);
AMT_STATUS pthi_SetHostFQDN(char* str);
AMT_STATUS pthi_GetLocalSystemAccount(LOCAL_SYSTEM_ACCOUNT *localAccount);
AMT_STATUS pthi_Unprovision(CFG_PROVISIONING_MODE provisionMode);
AMT_STATUS pthi_GetStateEHBC(AMT_EHBC_STATE *state);
AMT_STATUS pthi_GetControlMode(int *state);
#define PROVISIONING_MODE_REQUEST 0x04000008
#define PROVISIONING_MODE_RESPONSE 0x04800008
const PTHI_MESSAGE_HEADER GET_PROVISIONING_MODE_HEADER;
#define UNPROVISION_REQUEST 0x04000010
#define UNPROVISION_RESPONSE 0x04800010
const PTHI_MESSAGE_HEADER UNPROVISION_HEADER;
#define PROVISIONING_STATE_REQUEST 0x04000011
#define PROVISIONING_STATE_RESPONSE 0x04800011
const PTHI_MESSAGE_HEADER GET_PROVISIONING_STATE_HEADER;
#define CODE_VERSIONS_REQUEST 0x0400001A
#define CODE_VERSIONS_RESPONSE 0x0480001A
const PTHI_MESSAGE_HEADER GET_CODE_VERSION_HEADER;
#define GET_SECURITY_PARAMETERS_REQUEST 0x0400001B
#define GET_SECURITY_PARAMETERS_RESPONSE 0x0480001B
//const PTHI_MESSAGE_HEADER GET_SECURITY_PARAMETERS_HEADER;
#define GET_MAC_ADDRESSES_REQUEST 0x04000025
#define GET_MAC_ADDRESSES_RESPONSE 0x04800025
const PTHI_MESSAGE_HEADER GET_MAC_ADDRESSES_HEADER;
#define GENERATE_RNG_SEED_REQUEST 0x04000028
#define GENERATE_RNG_SEED_RESPONSE 0x04800028
//const PTHI_MESSAGE_HEADER GENERATE_RNG_SEED_HEADER;
#define SET_PROVISIONING_SERVER_OTP_REQUEST 0x0400002A
#define SET_PROVISIONING_SERVER_OTP_RESPONSE 0x0480002A
#define SET_DNS_SUFFIX_REQUEST 0x0400002F
#define SET_DNS_SUFFIX_RESPONSE 0x0480002F
#define ENUMERATE_HASH_HANDLES_REQUEST 0x0400002C
#define ENUMERATE_HASH_HANDLES_RESPONSE 0x0480002C
//const PTHI_MESSAGE_HEADER ENUMERATE_HASH_HANDLES_HEADER;
#define GET_RNG_SEED_STATUS_REQUEST 0x0400002E
#define GET_RNG_SEED_STATUS_RESPONSE 0x0480002E
//const PTHI_MESSAGE_HEADER GET_RNG_SEED_STATUS_HEADER;
#define GET_DNS_SUFFIX_LIST_REQUEST 0x0400003E
#define GET_DNS_SUFFIX_LIST_RESPONSE 0x0480003E
//const PTHI_MESSAGE_HEADER GET_DNS_SUFFIX_LIST_HEADER;
#define SET_ENTERPRISE_ACCESS_REQUEST 0x0400003F
#define SET_ENTERPRISE_ACCESS_RESPONSE 0x0480003F
//const PTHI_MESSAGE_HEADER SET_ENTERPRISE_ACCESS_HEADER;
#define OPEN_USER_INITIATED_CONNECTION_REQUEST 0x04000044
#define OPEN_USER_INITIATED_CONNECTION_RESPONSE 0x04800044
//const PTHI_MESSAGE_HEADER OPEN_USER_INITIATED_CONNECTION_HEADER;
#define CLOSE_USER_INITIATED_CONNECTION_REQUEST 0x04000045
#define CLOSE_USER_INITIATED_CONNECTION_RESPONSE 0x04800045
//const PTHI_MESSAGE_HEADER CLOSE_USER_INITIATED_CONNECTION_HEADER;
#define GET_REMOTE_ACCESS_CONNECTION_STATUS_REQUEST 0x04000046
#define GET_REMOTE_ACCESS_CONNECTION_STATUS_RESPONSE 0x04800046
//const PTHI_MESSAGE_HEADER GET_REMOTE_ACCESS_CONNECTION_STATUS_HEADER;
#define GET_CURRENT_POWER_POLICY_REQUEST 0x04000047
#define GET_CURRENT_POWER_POLICY_RESPONSE 0x04800047
const PTHI_MESSAGE_HEADER GET_CURRENT_POWER_POLICY_HEADER;
#define GET_LAN_INTERFACE_SETTINGS_REQUEST 0x04000048
#define GET_LAN_INTERFACE_SETTINGS_RESPONSE 0x04800048
//const PTHI_MESSAGE_HEADER GET_LAN_INTERFACE_SETTINGS_HEADER;
#define GET_FEATURES_STATE_REQUEST 0x04000049
#define GET_FEATURES_STATE_RESPONSE 0x04800049
const PTHI_MESSAGE_HEADER GET_FEATURES_STATE_HEADER;
#define GET_LAST_HOST_RESET_REASON_REQUEST 0x0400004A
#define GET_LAST_HOST_RESET_REASON_RESPONSE 0x0480004A
//const PTHI_MESSAGE_HEADER GET_LAST_HOST_RESET_REASON_HEADER;
#define GET_AMT_STATE_REQUEST 0x01000001
#define GET_AMT_STATE_RESPONSE 0x01800001
//const PTHI_MESSAGE_HEADER GET_AMT_STATE_HEADER;
#define GET_ZERO_TOUCH_ENABLED_REQUEST 0x04000030
#define GET_ZERO_TOUCH_ENABLED_RESPONSE 0x04800030
//const PTHI_MESSAGE_HEADER GET_ZERO_TOUCH_ENABLED_HEADER;
#define GET_PROVISIONING_TLS_MODE_REQUEST 0x0400002B
#define GET_PROVISIONING_TLS_MODE_RESPONSE 0x0480002B
//const PTHI_MESSAGE_HEADER GET_PROVISIONING_TLS_MODE_HEADER;
#define START_CONFIGURATION_REQUEST 0x04000029
#define START_CONFIGURATION_RESPONSE 0x04800029
//const PTHI_MESSAGE_HEADER START_CONFIGURATION_HEADER;
#define GET_CERTHASH_ENTRY_REQUEST 0x0400002D
#define GET_CERTHASH_ENTRY_RESPONSE 0x0480002D
//const PTHI_MESSAGE_HEADER GET_CERTHASH_ENTRY_HEADER;
#define GET_PKI_FQDN_SUFFIX_REQUEST 0x04000036
#define GET_PKI_FQDN_SUFFIX_RESPONSE 0x04800036
//
#define SET_HOST_FQDN_REQUEST 0x0400005b
#define SET_HOST_FQDN_RESPONSE 0x0480005b
//const PTHI_MESSAGE_HEADER GET_PKI_FQDN_SUFFIX_HEADER;
#define GET_LOCAL_SYSTEM_ACCOUNT_REQUEST 0x04000067
#define GET_LOCAL_SYSTEM_ACCOUNT_RESPONSE 0x04800067
//const PTHI_MESSAGE_HEADER GET_LOCAL_SYSTEM_ACCOUNT_HEADER;
#define GET_EHBC_STATE_REQUEST 0x4000084
#define GET_EHBC_STATE_RESPONSE 0x4800084
const PTHI_MESSAGE_HEADER GET_EHBC_STATE_HEADER;
#define GET_CONTROL_MODE_REQUEST 0x400006b
#define GET_CONTROL_MODE_RESPONSE 0x480006b
const PTHI_MESSAGE_HEADER GET_CONTROL_MODE_HEADER;
#define STOP_CONFIGURATION_REQUEST 0x400005e
#define STOP_CONFIGURATION_RESPONSE 0x480005e
#endif
#endif

View File

@@ -0,0 +1,427 @@
/*******************************************************************************
* Copyright (C) 2004-2008 Intel Corp. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Intel Corp. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Intel Corp. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
#ifndef _MINCORE
//----------------------------------------------------------------------------
//
// File: StatusCodeDefinitions.h
//
// Notes: This file contains the definitions of the status codes
// as defined in the Intel<65> AMT Network Design Guide.
//
//----------------------------------------------------------------------------
#ifndef STATUS_CODE_DEFINITIONS_H
#define STATUS_CODE_DEFINITIONS_H
typedef unsigned int PT_STATUS;
//typedef unsigned int AMT_STATUS;
//Request succeeded
#define PT_STATUS_SUCCESS 0x0
#define AMT_STATUS_SUCCESS 0x0
//An internal error in the Intel<65> AMT device has occurred
#define PT_STATUS_INTERNAL_ERROR 0x1
#define AMT_STATUS_INTERNAL_ERROR 0x1
//Intel<65> AMT device has not progressed far enough in its
//initialization to process the command.
#define PT_STATUS_NOT_READY 0x2
#define AMT_STATUS_NOT_READY 0x2
//Command is not permitted in current operating mode.
#define PT_STATUS_INVALID_PT_MODE 0x3
#define AMT_STATUS_INVALID_PT_MODE 0x3
//Length field of header is invalid.
#define PT_STATUS_INVALID_MESSAGE_LENGTH 0x4
#define AMT_STATUS_INVALID_MESSAGE_LENGTH 0x4
//The requested hardware asset inventory table
//checksum is not available.
#define PT_STATUS_TABLE_FINGERPRINT_NOT_AVAILABLE 0x5
#define AMT_STATUS_TABLE_FINGERPRINT_NOT_AVAILABLE 0x5
//The Integrity Check Value field of the request
//message sent by Intel<65> AMT enabled device is invalid.
#define PT_STATUS_INTEGRITY_CHECK_FAILED 0x6
#define AMT_STATUS_INTEGRITY_CHECK_FAILED 0x6
//The specified ISV version is not supported
#define PT_STATUS_UNSUPPORTED_ISVS_VERSION 0x7
#define AMT_STATUS_UNSUPPORTED_ISVS_VERSION 0x7
//The specified queried application is not registered.
#define PT_STATUS_APPLICATION_NOT_REGISTERED 0x8
#define AMT_STATUS_APPLICATION_NOT_REGISTERED 0x8
//Either an invalid name or a not previously registered
//<2F>Enterprise<73> name was specified
#define PT_STATUS_INVALID_REGISTRATION_DATA 0x9
#define AMT_STATUS_INVALID_REGISTRATION_DATA 0x9
//The application handle provided in the request
//message has never been allocated.
#define PT_STATUS_APPLICATION_DOES_NOT_EXIST 0xA
#define AMT_STATUS_APPLICATION_DOES_NOT_EXIST 0xA
//The requested number of bytes cannot be allocated in ISV storage.
#define PT_STATUS_NOT_ENOUGH_STORAGE 0xB
#define AMT_STATUS_NOT_ENOUGH_STORAGE 0xB
//The specified name is invalid.
#define PT_STATUS_INVALID_NAME 0xC
#define AMT_STATUS_INVALID_NAME 0xC
//The specified block does not exist.
#define PT_STATUS_BLOCK_DOES_NOT_EXIST 0xD
#define AMT_STATUS_BLOCK_DOES_NOT_EXIST 0xD
//The specified byte offset is invalid.
#define PT_STATUS_INVALID_BYTE_OFFSET 0xE
#define AMT_STATUS_INVALID_BYTE_OFFSET 0xE
//The specified byte count is invalid.
#define PT_STATUS_INVALID_BYTE_COUNT 0xF
#define AMT_STATUS_INVALID_BYTE_COUNT 0xF
//The requesting application is not
//permitted to request execution of the specified operation.
#define PT_STATUS_NOT_PERMITTED 0x10
#define AMT_STATUS_NOT_PERMITTED 0x10
//The requesting application is not the owner of the block
//as required for the requested operation.
#define PT_STATUS_NOT_OWNER 0x11
#define AMT_STATUS_NOT_OWNER 0x11
//The specified block is locked by another application.
#define PT_STATUS_BLOCK_LOCKED_BY_OTHER 0x12
#define AMT_STATUS_BLOCK_LOCKED_BY_OTHER 0x12
//The specified block is not locked.
#define PT_STATUS_BLOCK_NOT_LOCKED 0x13
#define AMT_STATUS_BLOCK_NOT_LOCKED 0x13
//The specified group permission bits are invalid.
#define PT_STATUS_INVALID_GROUP_PERMISSIONS 0x14
#define AMT_STATUS_INVALID_GROUP_PERMISSIONS 0x14
//The specified group does not exist.
#define PT_STATUS_GROUP_DOES_NOT_EXIST 0x15
#define AMT_STATUS_GROUP_DOES_NOT_EXIST 0x15
//The specified member count is invalid.
#define PT_STATUS_INVALID_MEMBER_COUNT 0x16
#define AMT_STATUS_INVALID_MEMBER_COUNT 0x16
//The request cannot be satisfied because a maximum
//limit associated with the request has been reached.
#define PT_STATUS_MAX_LIMIT_REACHED 0x17
#define AMT_STATUS_MAX_LIMIT_REACHED 0x17
//specified key algorithm is invalid.
#define PT_STATUS_INVALID_AUTH_TYPE 0x18
#define AMT_STATUS_INVALID_AUTH_TYPE 0x18
//Not Used
#define PT_STATUS_AUTHENTICATION_FAILED 0x19
#define AMT_STATUS_AUTHENTICATION_FAILED 0x19
//The specified DHCP mode is invalid.
#define PT_STATUS_INVALID_DHCP_MODE 0x1A
#define AMT_STATUS_INVALID_DHCP_MODE 0x1A
//The specified IP address is not a valid IP unicast address.
#define PT_STATUS_INVALID_IP_ADDRESS 0x1B
#define AMT_STATUS_INVALID_IP_ADDRESS 0x1B
//The specified domain name is not a valid domain name.
#define PT_STATUS_INVALID_DOMAIN_NAME 0x1C
#define AMT_STATUS_INVALID_DOMAIN_NAME 0x1C
//Not Used
#define PT_STATUS_UNSUPPORTED_VERSION 0x1D
#define AMT_STATUS_UNSUPPORTED_VERSION 0x1D
//The requested operation cannot be performed because a
//prerequisite request message has not been received.
#define PT_STATUS_REQUEST_UNEXPECTED 0x1E
#define AMT_STATUS_REQUEST_UNEXPECTED 0x1E
//Not Used
#define PT_STATUS_INVALID_TABLE_TYPE 0x1F
#define AMT_STATUS_INVALID_TABLE_TYPE 0x1F
//The specified provisioning mode code is undefined.
#define PT_STATUS_INVALID_PROVISIONING_STATE 0x20
#define AMT_STATUS_INVALID_PROVISIONING_STATE 0x20
//Not Used
#define PT_STATUS_UNSUPPORTED_OBJECT 0x21
#define AMT_STATUS_UNSUPPORTED_OBJECT 0x21
//The specified time was not accepted by the Intel<65> AMT device
//since it is earlier than the baseline time set for the device.
#define PT_STATUS_INVALID_TIME 0x22
#define AMT_STATUS_INVALID_TIME 0x22
//StartingIndex is invalid.
#define PT_STATUS_INVALID_INDEX 0x23
#define AMT_STATUS_INVALID_INDEX 0x23
//A parameter is invalid.
#define PT_STATUS_INVALID_PARAMETER 0x24
#define AMT_STATUS_INVALID_PARAMETER 0x24
//An invalid netmask was supplied
//(a valid netmask is an IP address in which all <20>1<EFBFBD>s are before
//the <20>0<EFBFBD> <20> e.g. FFFC0000h is valid, FF0C0000h is invalid).
#define PT_STATUS_INVALID_NETMASK 0x25
#define AMT_STATUS_INVALID_NETMASK 0x25
//The operation failed because the Flash wear-out
//protection mechanism prevented a write to an NVRAM sector.
#define PT_STATUS_FLASH_WRITE_LIMIT_EXCEEDED 0x26
#define AMT_STATUS_FLASH_WRITE_LIMIT_EXCEEDED 0x26
//ME FW did not receive the entire image file.
#define PT_STATUS_INVALID_IMAGE_LENGTH 0x27
#define AMT_STATUS_INVALID_IMAGE_LENGTH 0x27
//ME FW received an image file with an invalid signature.
#define PT_STATUS_INVALID_IMAGE_SIGNATURE 0x28
#define AMT_STATUS_INVALID_IMAGE_SIGNATURE 0x28
//LME can not support the requested version.
#define PT_STATUS_PROPOSE_ANOTHER_VERSION 0x29
#define AMT_STATUS_PROPOSE_ANOTHER_VERSION 0x29
//The PID must be a 64 bit quantity made up of ASCII codes
//of some combination of 8 characters <20>
//capital alphabets (A<>Z), and numbers (0<>9).
#define PT_STATUS_INVALID_PID_FORMAT 0x2A
#define AMT_STATUS_INVALID_PID_FORMAT 0x2A
//The PPS must be a 256 bit quantity made up of ASCII codes
//of some combination of 32 characters <20>
//capital alphabets (A<>Z), and numbers (0<>9).
#define PT_STATUS_INVALID_PPS_FORMAT 0x2B
#define AMT_STATUS_INVALID_PPS_FORMAT 0x2B
//Full BIST test has been blocked
#define PT_STATUS_BIST_COMMAND_BLOCKED 0x2C
#define AMT_STATUS_BIST_COMMAND_BLOCKED 0x2C
//A TCP/IP connection could not be opened on with the selected port.
#define PT_STATUS_CONNECTION_FAILED 0x2D
#define AMT_STATUS_CONNECTION_FAILED 0x2D
//Max number of connection reached.
//LME can not open the requested connection.
#define PT_STATUS_CONNECTION_TOO_MANY 0x2E
#define AMT_STATUS_CONNECTION_TOO_MANY 0x2E
//Random key generation is in progress.
#define PT_STATUS_RNG_GENERATION_IN_PROGRESS 0x2F
#define AMT_STATUS_RNG_GENERATION_IN_PROGRESS 0x2F
//A randomly generated key does not exist.
#define PT_STATUS_RNG_NOT_READY 0x30
#define AMT_STATUS_RNG_NOT_READY 0x30
//Self-generated AMT certificate does not exist.
#define PT_STATUS_CERTIFICATE_NOT_READY 0x31
#define AMT_STATUS_CERTIFICATE_NOT_READY 0x31
//This code establishes a dividing line between
//status codes which are common to host interface and
//network interface and status codes which are used by
//network interface only.
#define PT_STATUS_NETWORK_IF_ERROR_BASE 0x800
#define AMT_STATUS_NETWORK_IF_ERROR_BASE 0x800
//The OEM number specified in the remote control
//command is not supported by the Intel<65> AMT device
#define PT_STATUS_UNSUPPORTED_OEM_NUMBER 0x801
#define AMT_STATUS_UNSUPPORTED_OEM_NUMBER 0x801
//The boot option specified in the remote control command
//is not supported by the Intel<65> AMT device
#define PT_STATUS_UNSUPPORTED_BOOT_OPTION 0x802
#define AMT_STATUS_UNSUPPORTED_BOOT_OPTION 0x802
//The command specified in the remote control command
//is not supported by the Intel<65> AMT device
#define PT_STATUS_INVALID_COMMAND 0x803
#define AMT_STATUS_INVALID_COMMAND 0x803
//The special command specified in the remote control command
//is not supported by the Intel<65> AMT device
#define PT_STATUS_INVALID_SPECIAL_COMMAND 0x804
#define AMT_STATUS_INVALID_SPECIAL_COMMAND 0x804
//The handle specified in the command is invalid
#define PT_STATUS_INVALID_HANDLE 0x805
#define AMT_STATUS_INVALID_HANDLE 0x805
//The password specified in the User ACL is invalid
#define PT_STATUS_INVALID_PASSWORD 0x806
#define AMT_STATUS_INVALID_PASSWORD 0x806
//The realm specified in the User ACL is invalid
#define PT_STATUS_INVALID_REALM 0x807
#define AMT_STATUS_INVALID_REALM 0x807
//The FPACL or EACL entry is used by an active
//registration and cannot be removed or modified.
#define PT_STATUS_STORAGE_ACL_ENTRY_IN_USE 0x808
#define AMT_STATUS_STORAGE_ACL_ENTRY_IN_USE 0x808
//Essential data is missing on CommitChanges command.
#define PT_STATUS_DATA_MISSING 0x809
#define AMT_STATUS_DATA_MISSING 0x809
//The parameter specified is a duplicate of an existing value.
//Returned for a case where duplicate entries are added to FPACL
//(Factory Partner Allocation Control List) or EACL
//(Enterprise Access Control List) lists.
#define PT_STATUS_DUPLICATE 0x80A
#define AMT_STATUS_DUPLICATE 0x80A
//Event Log operation failed due to the current freeze status of the log.
#define PT_STATUS_EVENTLOG_FROZEN 0x80B
#define AMT_STATUS_EVENTLOG_FROZEN 0x80B
//The device is missing private key material.
#define PT_STATUS_PKI_MISSING_KEYS 0x80C
#define AMT_STATUS_PKI_MISSING_KEYS 0x80C
//The device is currently generating a keypair.
//Caller may try repeating this operation at a later time.
#define PT_STATUS_PKI_GENERATING_KEYS 0x80D
#define AMT_STATUS_PKI_GENERATING_KEYS 0x80D
//An invalid Key was entered.
#define PT_STATUS_INVALID_KEY 0x80E
#define AMT_STATUS_INVALID_KEY 0x80E
//An invalid X.509 certificate was entered.
#define PT_STATUS_INVALID_CERT 0x80F
#define AMT_STATUS_INVALID_CERT 0x80F
//Certificate Chain and Private Key do not match.
#define PT_STATUS_CERT_KEY_NOT_MATCH 0x810
#define AMT_STATUS_CERT_KEY_NOT_MATCH 0x810
//The request cannot be satisfied because the maximum
//number of allowed Kerberos domains has been reached.
//(The domain is determined by the first 24 Bytes of the SID.)
#define PT_STATUS_MAX_KERB_DOMAIN_REACHED 0x811
#define AMT_STATUS_MAX_KERB_DOMAIN_REACHED 0x811
// The requested configuration is unsupported
#define PT_STATUS_UNSUPPORTED 0x812
#define AMT_STATUS_UNSUPPORTED 0x812
// A profile with the requested priority already exists
#define PT_STATUS_INVALID_PRIORITY 0x813
#define AMT_STATUS_INVALID_PRIORITY 0x813
// Unable to find specified element
#define PT_STATUS_NOT_FOUND 0x814
#define AMT_STATUS_NOT_FOUND 0x814
// Invalid User credentials
#define PT_STATUS_INVALID_CREDENTIALS 0x815
#define AMT_STATUS_INVALID_CREDENTIALS 0x815
// Passphrase is invalid
#define PT_STATUS_INVALID_PASSPHRASE 0x816
#define AMT_STATUS_INVALID_PASSPHRASE 0x816
// A certificate handle must be chosen before the
// operation can be completed.
#define PT_STATUS_NO_ASSOCIATION 0x818
#define AMT_STATUS_NO_ASSOCIATION 0x818
// The command is defined as Audit Log event and can not be
// logged.
#define PT_STATUS_AUDIT_FAIL 0x81B
#define AMT_STATUS_AUDIT_FAIL 0x81B
// One of the ME components is not ready for unprovisioning.
#define PT_STATUS_BLOCKING_COMPONENT 0x81C
#define AMT_STATUS_BLOCKING_COMPONENT 0x81C
//The application has identified an internal error
#define PTSDK_STATUS_INTERNAL_ERROR 0x1000
//An ISV operation was called while the library is not
//initialized
#define PTSDK_STATUS_NOT_INITIALIZED 0x1001
//The requested library I/F is not supported by the current library
//implementation.
#define PTSDK_STATUS_LIB_VERSION_UNSUPPORTED 0x1002
//One of the parameters is invalid (usually indicates a
//NULL pointer or an invalid session handle is specified)
#define PTSDK_STATUS_INVALID_PARAM 0x1003
//The SDK could not allocate sufficient resources to complete the operation.
#define PTSDK_STATUS_RESOURCES 0x1004
//The Library has identified a HW Internal error.
#define PTSDK_STATUS_HARDWARE_ACCESS_ERROR 0x1005
//The application that sent the request message is not registered.
//Usually indicates the registration timeout has elapsed.
//The caller should reregister with the Intel AMT enabled device.
#define PTSDK_STATUS_REQUESTOR_NOT_REGISTERED 0x1006
//A network error has occurred while processing the call.
#define PTSDK_STATUS_NETWORK_ERROR 0x1007
//Specified container can not hold the requested string
#define PTSDK_STATUS_PARAM_BUFFER_TOO_SHORT 0x1008
//For Windows only.
//ISVS_InitializeCOMinThread was not called by the current thread.
#define PTSDK_STATUS_COM_NOT_INITIALIZED_IN_THREAD 0x1009
//The URL parameter was not optional in current configuration.
#define PTSDK_STATUS_URL_REQUIRED 0x100A
#endif
#endif

57
microlms/heci/mei.h Normal file
View File

@@ -0,0 +1,57 @@
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _LINUX_MEI_H
#define _LINUX_MEI_H
// #include <linux/types.h>
// #include <linux/string.h>
typedef struct {
unsigned char b[16];
} uuid_le;
#define IOCTL_MEI_CONNECT_CLIENT _IOWR('H' , 0x01, struct mei_connect_client_data)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct mei_client {
unsigned int max_msg_length;
unsigned char protocol_version;
unsigned char reserved[3];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
struct mei_connect_client_data {
union {
uuid_le in_client_uuid;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct mei_client out_client_properties;
};
};
#define IOCTL_MEI_SETUP_DMA_BUF _IOWR('H' , 0x02, struct mei_client_dma_data)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define IOCTL_MEI_UNSET_DMA_BUF _IOW('H' , 0x03, struct mei_client_dma_handle)
struct mei_client_dma_data {
union {
unsigned long userptr;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
unsigned int length;
unsigned int handle;
};
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct mei_client_dma_handle {
unsigned int handle;
};
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */

File diff suppressed because it is too large Load Diff

2012
microlms/lms/ILibLMS.c Normal file

File diff suppressed because it is too large Load Diff

86
microlms/lms/ILibLMS.h Normal file
View File

@@ -0,0 +1,86 @@
/*
Copyright 2006 - 2017 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#if !defined(_NOHECI)
#ifndef __ILibLMS__
#define __ILibLMS__
#include "../../microstack/ILibAsyncServerSocket.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN32
void __fastcall ILibLMS_setregistryA(char* name, char* value);
int __fastcall ILibLMS_getregistryA(char* name, char** value);
int __fastcall ILibLMS_deleteregistryA(char* name);
#endif
struct cimString {
char *data;
int dataLen;
};
struct cimAlertIndication {
struct cimString MessageID;
struct cimString MessageArguments;
struct cimString IndicationTime;
/*
int AlertType;
struct cimString AlertingManagedElement;
int AlertingElementFormat;
struct cimString CorrelatedIndications;
struct cimString Description;
struct cimString EventID;
struct cimString EventTime;
struct cimString IndicationFilterName;
struct cimString IndicationIdentifier;
struct cimString OtherAlertType;
struct cimString OtherAlertingElementFormat;
struct cimString OtherSeverity;
struct cimString OwningEntity;
int PerceivedSeverity;
int ProbableCause;
struct cimString ProbableCauseDescription;
struct cimString ProviderName;
struct cimString RecommendedActions;
struct cimString SequenceContext;
long SequenceNumber;
struct cimString SystemCreationClassName;
struct cimString SystemName;
int Trending;
struct cimString __any;
struct cimString __anyAttribute;
*/
};
extern int ILibMemory_ILibLMS_CONTAINERSIZE;
typedef void(*ILibLMS_OnNotification)(void *module, struct cimAlertIndication *values, char* xml, int xmllen);
void *ILibLMS_CreateEx(void *Chain, char* SelfExe, ILibLMS_OnNotification callback, int extraMemorySize);
#define ILibLMS_Create(Chain, SelfExe, callback) ILibLMS_CreateEx(Chain, SelfExe, callback, 0)
int ILibLMS_GetMeInformation(char** data, int loginmode);
int ILibLMS_GetAmtVersion();
#ifdef __cplusplus
}
#endif
#endif
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,108 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "MeshController.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,4,4,0
PRODUCTVERSION 0,0,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Mesh Agent Service"
VALUE "FileVersion", "0.4.4.0"
VALUE "InternalName", "MeshAgent"
VALUE "OriginalFilename", "MeshAgent.exe"
VALUE "ProductName", "Mesh Agent Service"
VALUE "ProductVersion", "0, 0, 0, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,266 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.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>{CE5AD78C-DBDF-4D81-9A69-41B1DF683115}</ProjectGuid>
<RootNamespace>MeshConsole</RootNamespace>
<Keyword>Win32Proj</Keyword>
<ProjectName>MicroLMSService</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</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" />
</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" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</PostBuildEventUseInBuild>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)</TargetName>
<PostBuildEventUseInBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</PostBuildEventUseInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINSERVICE;_DEBUG;_CONSOLE;MEMORY_CHECK;__STDC__;WINSOCK2;ILibWebServer_SESSION_TRACKING;_MSC_PLATFORM_TOOLSET_$(PlatformToolset);%(PreprocessorDefinitions);MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;NOCOMMANDER;_XLMSDEBUG</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<Profile>false</Profile>
<OptimizeReferences>true</OptimizeReferences>
<GenerateMapFile>
</GenerateMapFile>
<MapExports>
</MapExports>
<AssemblyDebug>true</AssemblyDebug>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)dpiaware.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;MEMORY_CHECK;MICROSTACK_NO_STDAFX;__STDC__;_CRT_SECURE_NO_WARNINGS;WINSOCK2;MICROSTACK_NOTLS;ILibWebServer_SESSION_TRACKING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
<Profile>true</Profile>
</Link>
<PostBuildEvent>
<Command>REM signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshService" /du "http://opentools.homeip.net" "$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINSERVICE;NDEBUG;_CONSOLE;WINSOCK2;_MSC_PLATFORM_TOOLSET_$(PlatformToolset);%(PreprocessorDefinitions);_LINKVM;_XDEBUGLMS;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;NOCOMMANDER</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CallingConvention>Cdecl</CallingConvention>
<OmitFramePointers>true</OmitFramePointers>
</ClCompile>
<Link>
<AdditionalDependencies>ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>
</Command>
</PostBuildEvent>
<Manifest>
<AdditionalManifestFiles>$(ProjectDir)dpiaware.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<Optimization>MinSpace</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;WIN64;_WINSERVICE;NDEBUG;_CONSOLE;MICROSTACK_NO_STDAFX;WINSOCK2;MICROSTACK_NOTLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshService" /du "http://opentools.homeip.net" /t http://timestamp.comodoca.com/authenticode "$(TargetPath)"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\microstack\ILibCrypto.c" />
<ClCompile Include="..\heci\LMEConnection.c" />
<ClCompile Include="..\..\microstack\ILibAsyncServerSocket.c" />
<ClCompile Include="..\..\microstack\ILibAsyncSocket.c" />
<ClCompile Include="..\..\microstack\ILibParsers.c" />
<ClCompile Include="..\heci\HECIWin.c" />
<ClCompile Include="..\heci\PTHICommand.c" />
<ClCompile Include="..\..\microstack\ILibWebClient.c" />
<ClCompile Include="..\..\microstack\ILibWebServer.c" />
<ClCompile Include="..\..\microstack\md5.c" />
<ClCompile Include="..\..\microstack\sha1.c" />
<ClCompile Include="..\lms\ILibLMS.c" />
<ClCompile Include="ServiceMain.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\microstack\ILibCrypto.h" />
<ClInclude Include="..\heci\LMEConnection.h" />
<ClInclude Include="..\heci\LMS_if.h" />
<ClInclude Include="..\heci\LMS_if_constants.h" />
<ClInclude Include="..\..\microstack\ILibWebClient.h" />
<ClInclude Include="..\..\microstack\ILibWebServer.h" />
<ClInclude Include="..\lms\ILibLMS-WebSite.h" />
<ClInclude Include="..\lms\ILibLMS.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="..\..\microstack\ILibAsyncServerSocket.h" />
<ClInclude Include="..\..\microstack\ILibAsyncSocket.h" />
<ClInclude Include="..\..\microstack\ILibParsers.h" />
<ClInclude Include="..\heci\HECI_if.h" />
<ClInclude Include="..\heci\HECIWin.h" />
<ClInclude Include="..\heci\PTHICommand.h" />
<ClInclude Include="..\heci\StatusCodeDefinitions.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MicroLMSService.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="..\..\media\MeshController.ico" />
<Image Include="MeshController.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,133 @@
<?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</Extensions>
</Filter>
<Filter Include="microstack">
<UniqueIdentifier>{1b4b4360-c108-47a8-80ae-f3dfa0a7812e}</UniqueIdentifier>
</Filter>
<Filter Include="LMS">
<UniqueIdentifier>{a455730f-2a1c-4da6-97db-902d9bd2ab59}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\heci\LMEConnection.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\heci\HECIWin.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\heci\PTHICommand.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ServiceMain.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibAsyncServerSocket.c">
<Filter>microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibAsyncSocket.c">
<Filter>microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibParsers.c">
<Filter>microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibWebClient.c">
<Filter>microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibWebServer.c">
<Filter>microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\md5.c">
<Filter>microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\sha1.c">
<Filter>microstack</Filter>
</ClCompile>
<ClCompile Include="..\..\microstack\ILibCrypto.c">
<Filter>microstack</Filter>
</ClCompile>
<ClCompile Include="..\lms\ILibLMS.c">
<Filter>LMS</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\heci\LMEConnection.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\heci\LMS_if.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\heci\LMS_if_constants.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\heci\HECI_if.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\heci\HECIWin.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\heci\PTHICommand.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\heci\StatusCodeDefinitions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibCrypto.h">
<Filter>microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibAsyncServerSocket.h">
<Filter>microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibAsyncSocket.h">
<Filter>microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibParsers.h">
<Filter>microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibWebClient.h">
<Filter>microstack</Filter>
</ClInclude>
<ClInclude Include="..\..\microstack\ILibWebServer.h">
<Filter>microstack</Filter>
</ClInclude>
<ClInclude Include="..\lms\ILibLMS.h">
<Filter>LMS</Filter>
</ClInclude>
<ClInclude Include="..\lms\ILibLMS-WebSite.h">
<Filter>LMS</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="MicroLMSService.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\media\MeshController.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="MeshController.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,153 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "..\\..\\media\\MeshController.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,1,57,4
PRODUCTVERSION 0,0,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "Mesh Agent Service"
VALUE "FileVersion", "0.1.57.4"
VALUE "InternalName", "MeshAgent"
VALUE "OriginalFilename", "MeshAgent.exe"
VALUE "ProductName", "Mesh Agent Service"
VALUE "ProductVersion", "0, 0, 0, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_INSTALLDIALOG DIALOGEX 0, 100, 316, 133
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION
CAPTION "Mesh Agent Installer"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Close",IDCANCEL,259,112,50,14
LTEXT "Click the buttons below to install or uninstall the peer-to-peer mesh agent. When installed, the mesh agent runs as a background service, linking up to other computers. The agents facilitates computer management and other applications.",IDC_STATIC,7,7,275,28
GROUPBOX "Installation Information",IDC_STATIC,7,38,302,65
PUSHBUTTON "Install / Update",IDC_INSTALLBUTTON,7,112,77,14
PUSHBUTTON "Uninstall",IDC_UNINSTALLBUTTON,87,112,77,14
ICON IDI_ICON1,IDC_STATIC,288,7,21,20
LTEXT "Current Service Status",IDC_STATIC,14,51,74,8
LTEXT "Unknown",IDC_STATUSTEXT,127,51,175,8,0,WS_EX_RIGHT
LTEXT "New Service Version",IDC_STATIC,14,63,66,8
LTEXT "Unknown",IDC_VERSIONTEXT,127,63,175,8,0,WS_EX_RIGHT
LTEXT "New Trusted Hash",IDC_STATIC,14,87,60,8
LTEXT "Unknown",IDC_HASHTEXT,127,87,175,8,0,WS_EX_RIGHT
LTEXT "New Trusted Policy",IDC_STATIC,14,75,62,8
LTEXT "Unknown",IDC_POLICYTEXT,127,75,175,8,0,WS_EX_RIGHT
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_INSTALLDIALOG, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 309
TOPMARGIN, 7
BOTTOMMARGIN, 126
END
END
#endif // APSTUDIO_INVOKED
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,622 @@
/*
Copyright (c) 2016, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/
#if defined(WINSOCK2)
#include <winsock2.h>
#include <ws2tcpip.h>
#elif defined(WINSOCK1)
#include <winsock.h>
#include <wininet.h>
#endif
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <windows.h>
#include "resource.h"
#include "../../microstack/ILibParsers.h"
#include "../lms/ILibLMS.h"
#if defined(WIN32) && defined (_DEBUG) && !defined(_MINCORE)
#include <crtdbg.h>
#define _CRTDBG_MAP_ALLOC
#endif
void *Chain = NULL;
struct ILibLMS_StateModule *MicroLMS = NULL;
#define VERSION "0.4.4" // Remember to change in the resources as well
int serviceId = 0; // 0 = MicroLMS, 1 = IntelLMS
TCHAR* serviceFile[2] = { TEXT("MicroLMS"), TEXT("LMS") };
TCHAR* serviceName[2] = { TEXT("MicroLMS Service for Intel(R) AMT"), TEXT("Intel(R) Management and Security Application Local Management Service") };
TCHAR* serviceDesc[2] = { TEXT("Provides Intel(R) Active Management Technology (Intel AMT) with local network connectivity and services."), TEXT("Intel(R) Management and Security Application Local Management Service - Provides OS-related Intel(R) ME functionality.") };
SERVICE_STATUS serviceStatus;
SERVICE_STATUS_HANDLE serviceStatusHandle = 0;
void BreakSink(int s)
{
UNREFERENCED_PARAMETER(s);
signal(SIGINT, SIG_IGN); // To ignore any more ctrl-c interrupts
ILibStopChain(Chain);
}
BOOL IsAdmin()
{
BOOL admin;
PSID AdministratorsGroup;
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
if ((admin = AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup)) != 0)
{
if (!CheckTokenMembership(NULL, AdministratorsGroup, &admin)) admin = FALSE;
FreeSid(AdministratorsGroup);
}
return admin;
}
void WINAPI ServiceControlHandler(DWORD controlCode)
{
switch (controlCode)
{
case SERVICE_CONTROL_INTERROGATE:
break;
case SERVICE_CONTROL_SHUTDOWN:
case SERVICE_CONTROL_STOP:
serviceStatus.dwCurrentState = SERVICE_STOP_PENDING;
SetServiceStatus(serviceStatusHandle, &serviceStatus);
if (Chain != NULL) ILibStopChain(Chain);
Chain = NULL;
return;
default:
break;
}
SetServiceStatus(serviceStatusHandle, &serviceStatus);
}
void WINAPI ServiceMain(DWORD argc, LPTSTR *argv)
{
char selfexe[_MAX_PATH];
size_t selfexelen = 0;
UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(argv);
// Find directory of our own executable
selfexelen = GetModuleFileNameA(NULL, selfexe, _MAX_PATH);
// Initialise service status
serviceStatus.dwServiceType = SERVICE_WIN32;
serviceStatus.dwCurrentState = SERVICE_STOPPED;
serviceStatus.dwControlsAccepted = 0;
serviceStatus.dwWin32ExitCode = NO_ERROR;
serviceStatus.dwServiceSpecificExitCode = NO_ERROR;
serviceStatus.dwCheckPoint = 0;
serviceStatus.dwWaitHint = 0;
serviceStatusHandle = RegisterServiceCtrlHandler(serviceName[serviceId], ServiceControlHandler);
if (serviceStatusHandle)
{
// Service is starting
serviceStatus.dwCurrentState = SERVICE_START_PENDING;
SetServiceStatus(serviceStatusHandle, &serviceStatus);
// Service running
serviceStatus.dwControlsAccepted |= (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN);
serviceStatus.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus(serviceStatusHandle, &serviceStatus);
// Run the MicroLMS Service
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
Chain = ILibCreateChain();
MicroLMS = ILibLMS_Create(Chain, selfexe);
if (MicroLMS != NULL)
{
printf("Starting MicroLMS.\r\n");
ILibStartChain(Chain);
printf("Stopping MicroLMS.\r\n");
}
else
{
printf("Unable to launch MicroLMS. Check that Intel ME is present, MEI driver installed and run this executable as administrator.\r\n");
}
CoUninitialize();
// Service was stopped
serviceStatus.dwCurrentState = SERVICE_STOP_PENDING;
SetServiceStatus(serviceStatusHandle, &serviceStatus);
// Service is now stopped
serviceStatus.dwControlsAccepted &= ~(SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN);
serviceStatus.dwCurrentState = SERVICE_STOPPED;
SetServiceStatus(serviceStatusHandle, &serviceStatus);
}
}
int RunService()
{
SERVICE_TABLE_ENTRY serviceTable[2];
serviceTable[0].lpServiceName = serviceName[serviceId];
serviceTable[0].lpServiceProc = (LPSERVICE_MAIN_FUNCTION)ServiceMain;
serviceTable[1].lpServiceName = NULL;
serviceTable[1].lpServiceProc = NULL;
return StartServiceCtrlDispatcher(serviceTable);
}
BOOL InstallService()
{
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CREATE_SERVICE);
SERVICE_DESCRIPTION sd;
SERVICE_DELAYED_AUTO_START_INFO as;
SERVICE_FAILURE_ACTIONS fa;
SC_ACTION failactions[3];
BOOL r = FALSE;
if (serviceControlManager)
{
char path[1024];
if (GetModuleFileName(0, (LPTSTR)path, 1024) > 0)
{
// Install the service
SC_HANDLE service = CreateService(
serviceControlManager,
serviceFile[serviceId],
serviceName[serviceId],
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,
SERVICE_AUTO_START,
SERVICE_ERROR_IGNORE,
(LPCTSTR)path,
0, 0, 0, 0, 0);
if (service)
{
// Update the service description
sd.lpDescription = serviceDesc[serviceId];
ChangeServiceConfig2(service, SERVICE_CONFIG_DESCRIPTION, &sd);
// Update the service auto-start
as.fDelayedAutostart = FALSE;
ChangeServiceConfig2(service, SERVICE_CONFIG_DELAYED_AUTO_START_INFO, &as);
// Update the faliure action
failactions[0].Type = SC_ACTION_RESTART;
failactions[0].Delay = 120000; // Wait 2 minutes before faliure restart (milliseconds)
failactions[1].Type = SC_ACTION_RESTART;
failactions[1].Delay = 120000; // Wait 2 minutes before faliure restart (milliseconds)
failactions[2].Type = SC_ACTION_NONE;
failactions[2].Delay = 120000;
memset(&fa, 0, sizeof(SERVICE_FAILURE_ACTIONS));
fa.dwResetPeriod = 86400; // After 1 days, reset the faliure counters (seconds)
fa.cActions = 3;
fa.lpsaActions = failactions;
r = ChangeServiceConfig2(service, SERVICE_CONFIG_FAILURE_ACTIONS, &fa);
// Cleanup
CloseServiceHandle(service);
#ifdef _DEBUG
//ILIBMESSAGE("MicroLMS service installed successfully");
#endif
}
else
{
#ifdef _DEBUG
if (GetLastError() == ERROR_SERVICE_EXISTS)
{
ILIBMESSAGE("MicroLMS service already exists.");
}
else
{
ILIBMESSAGE2("MicroLMS service was not installed successfully.", (int)GetLastError());
}
#endif
}
}
CloseServiceHandle(serviceControlManager);
}
return r;
}
int UninstallService()
{
int r = 0;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
if (serviceControlManager)
{
SC_HANDLE service = OpenService(serviceControlManager, serviceFile[serviceId], SERVICE_QUERY_STATUS | DELETE);
if (service)
{
SERVICE_STATUS serviceStatus;
if (QueryServiceStatus(service, &serviceStatus))
{
if (serviceStatus.dwCurrentState == SERVICE_STOPPED)
{
if (DeleteService(service))
{
#ifdef _DEBUG
//ILIBMESSAGE("MicroLMS service removed successfully");
#endif
r = 1;
}
else
{
#ifdef _DEBUG
DWORD dwError = GetLastError();
if (dwError == ERROR_ACCESS_DENIED) {
ILIBMESSAGE("Access denied while trying to remove MicroLMS service");
}
else if (dwError == ERROR_INVALID_HANDLE) {
ILIBMESSAGE("Handle invalid while trying to remove MicroLMS service");
}
else if (dwError == ERROR_SERVICE_MARKED_FOR_DELETE) {
ILIBMESSAGE("MicroLMS service already marked for deletion");
}
#endif
}
}
else
{
r = 2;
#ifdef _DEBUG
ILIBMESSAGE("MicroLMS service is still running");
#endif
}
}
CloseServiceHandle(service);
}
CloseServiceHandle(serviceControlManager);
}
return r;
}
int GetServiceState(LPCWSTR servicename)
{
int r = 0;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
if (serviceControlManager)
{
SC_HANDLE service = OpenService(serviceControlManager, servicename, SERVICE_QUERY_STATUS | DELETE);
if (service)
{
SERVICE_STATUS serviceStatus;
if (QueryServiceStatus(service, &serviceStatus))
{
r = serviceStatus.dwCurrentState;
}
CloseServiceHandle(service);
}
else
{
r = 100;
}
CloseServiceHandle(serviceControlManager);
}
return r;
}
int LaunchService(LPCWSTR servicename)
{
int r = 0;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SERVICE_QUERY_STATUS | SERVICE_START);
if (serviceControlManager)
{
SC_HANDLE service = OpenService(serviceControlManager, servicename, SERVICE_QUERY_STATUS | SERVICE_START);
if (service)
{
SERVICE_STATUS serviceStatus;
if (QueryServiceStatus(service, &serviceStatus))
{
if (serviceStatus.dwCurrentState == SERVICE_STOPPED) { if (StartService(service, 0, NULL) == TRUE) { r = 1; } }
else { r = 2; }
}
CloseServiceHandle(service);
}
CloseServiceHandle(serviceControlManager);
}
return r;
}
int StopService(LPCWSTR servicename)
{
int r = 0;
SERVICE_STATUS ServiceStatus;
SC_HANDLE serviceControlManager = OpenSCManager(0, 0, SERVICE_QUERY_STATUS | SERVICE_STOP);
if (serviceControlManager)
{
SC_HANDLE service = OpenService(serviceControlManager, servicename, SERVICE_QUERY_STATUS | SERVICE_STOP);
if (service)
{
SERVICE_STATUS serviceStatus;
if (QueryServiceStatus(service, &serviceStatus))
{
if (serviceStatus.dwCurrentState != SERVICE_STOPPED)
{
if (ControlService(service, SERVICE_CONTROL_STOP, &ServiceStatus) == FALSE)
{
// TODO: Unable to stop service
#ifdef _DEBUG
ILIBMESSAGE("Unable to stop service");
#endif
}
else
{
Sleep(3000);
r = 1;
}
}
}
CloseServiceHandle(service);
}
CloseServiceHandle(serviceControlManager);
}
return r;
}
int RunProcess(char* exe)
{
BOOL r;
int count = 50;
DWORD exitcode;
STARTUPINFOA info = { sizeof(info) };
PROCESS_INFORMATION processInfo;
if (CreateProcessA(NULL, exe, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &info, &processInfo) == 0) return 0;
do
{
Sleep(100);
r = GetExitCodeProcess(processInfo.hProcess, &exitcode);
if (exitcode == STILL_ACTIVE) r = 0;
} while (r == 0 && count-- > 0);
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);
return r;
}
#ifdef EXCLUSESERVICE
char *helpString = "MicroLMS v" VERSION " available switches : \r\n -run Run LMS as a console application.\r\n -json Output Intel AMT information in JSON format.\r\n -install Install the service from this location.\r\n -uninstall Remove the service from this location.\r\n start Start the service.\r\n stop Stop the service.\r\n auth [user] [pass] Set LMS authentication.\r\n clearauth Clear LMS authentication.\r\n version Display Intel(R) AMT version.\r\n check Check if Intel(R) AMT requires a firmware update.\r\n";
#else
char *helpString = "MicroLMS v" VERSION " available switches : \r\n -run Run LMS as a console application.\r\n version Display Intel(R) AMT version.\r\n check Check if Intel(R) AMT requires a firmware update.\r\n";
#endif
char *lmsStartStrings[3] = { "Failed to start MicroLMS", "Started MicroLMS", "MicroLMS already running" };
char *lmsUninstallStrings[3] = { "Failed to uninstall MicroLMS", "MicroLMS uninstalled", "MicroLMS still running" };
int main(int argc, char* argv[])
{
int returnCode = 0;
char selfexe[_MAX_PATH];
size_t selfexelen = 0;
//CoInitializeEx(NULL, COINIT_MULTITHREADED);
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
// Find directory of our own executable
selfexelen = GetModuleFileNameA(NULL, selfexe, _MAX_PATH);
if (argc == 2 && ((strcasecmp(argv[1], "-?") == 0) || (strcasecmp(argv[1], "/?") == 0)))
{
printf(helpString);
return 0;
}
#ifdef EXCLUSESERVICE
else if (argc > 1 && (strcasecmp(argv[1], "start") == 0 || strcasecmp(argv[1], "-start") == 0))
{
// Ask the service manager to launch the service
printf(lmsStartStrings[LaunchService(serviceFile[serviceId])]);
}
else if (argc > 1 && (strcasecmp(argv[1], "stop") == 0 || strcasecmp(argv[1], "-stop") == 0))
{
// Ask the service manager to stop the service
if (StopService(serviceFile[serviceId]) == 1) { printf("Stopped MicroLMS"); }
else { printf("Failed to stop MicroLMS"); }
}
else if (argc > 1 && strcasecmp(argv[1], "-install") == 0)
{
// Setup the service
StopService(serviceFile[serviceId]);
UninstallService();
if (InstallService() == TRUE)
{
printf("MicroLMS installed\r\n");
printf(lmsStartStrings[LaunchService(serviceFile[serviceId])]); // Ask the service manager to launch the service
}
else
{
printf("Failed to install MicroLMS");
}
}
else if (argc > 1 && ((strcasecmp(argv[1], "-remove") == 0) || (strcasecmp(argv[1], "-uninstall") == 0)))
{
// Ask the service manager to stop the service
StopService(serviceFile[serviceId]);
// Remove the service
printf(lmsUninstallStrings[UninstallService()]);
}
else if (argc > 1 && (strcasecmp(argv[1], "intelstart") == 0 || strcasecmp(argv[1], "-intelstart") == 0))
{
// Ask the service manager to launch the service
serviceId = 1; // Set to Intel
printf(lmsStartStrings[LaunchService(serviceFile[serviceId])]);
}
else if (argc > 1 && (strcasecmp(argv[1], "intelstop") == 0 || strcasecmp(argv[1], "-intelstop") == 0))
{
// Ask the service manager to stop the service
serviceId = 1; // Set to Intel
if (StopService(serviceFile[serviceId]) == 1) { printf("Stopped MicroLMS"); }
else { printf("Failed to stop MicroLMS"); }
}
else if (argc > 1 && strcasecmp(argv[1], "-intelinstall") == 0)
{
// Setup the service
serviceId = 1; // Set to Intel
StopService(serviceFile[serviceId]);
UninstallService();
if (InstallService() == TRUE)
{
printf("MicroLMS installed\r\n");
printf(lmsStartStrings[LaunchService(serviceFile[serviceId])]); // Ask the service manager to launch the service
}
else
{
printf("Failed to install MicroLMS");
}
}
else if (argc > 1 && ((strcasecmp(argv[1], "-intelremove") == 0) || (strcasecmp(argv[1], "-inteluninstall") == 0)))
{
// Ask the service manager to stop the service
serviceId = 1; // Set to Intel
StopService(serviceFile[serviceId]);
// Remove the service
printf(lmsUninstallStrings[UninstallService()]);
}
else if (argc == 4 && ((strcasecmp(argv[1], "auth") == 0) || (strcasecmp(argv[1], "-auth") == 0)))
{
// Set authentication user/pass
ILibLMS_setregistryA("username", argv[2]);
ILibLMS_setregistryA("password", argv[3]);
printf("Credentials set");
}
else if (argc == 2 && strcasecmp(argv[1], "clearauth") == 0)
{
// Remote authentication user/pass
ILibLMS_deleteregistryA("username");
ILibLMS_deleteregistryA("password");
printf("Credentials cleared");
}
else if (argc > 1 && ((strcasecmp(argv[1], "json") == 0) || (strcasecmp(argv[1], "-json") == 0)))
{
// Ask the service manager to stop the service
char* data;
int len = info_GetMeInformation(&data, 0);
if (len == 2)
{
printf("Unable to launch MicroLMS. Check that Intel ME is present, MEI driver installed and running as administrator.\r\n");
returnCode = 1;
}
else
{
printf(data + 2);
}
free(data);
}
#endif
else if (argc > 1 && ((strcasecmp(argv[1], "version") == 0) || (strcasecmp(argv[1], "-version") == 0)))
{
// Check to see what version of Intel AMT is present and if it needs to be updates
int version = info_GetAmtVersion();
if (version == 0)
{
printf("Unable to launch MicroLMS. Check that Intel ME is present, MEI driver installed and running as administrator.\r\n");
returnCode = 1;
}
else
{
printf("Intel(R) AMT version %d.%d.%d\r\n", (version >> 16), ((version >> 8) & 0xFF), (version & 0xFF));
}
}
else if (argc > 1 && ((strcasecmp(argv[1], "check") == 0) || (strcasecmp(argv[1], "-check") == 0)))
{
// Check to see what version of Intel AMT is present and if it needs to be updates
int version = info_GetAmtVersion();
if (version == 0)
{
printf("Unable to launch MicroLMS. Check that Intel ME is present, MEI driver installed and running as administrator.\r\n");
returnCode = 1;
}
else
{
// Check if this is a correct version of Intel AMT
int v1 = (version >> 16), v2 = (version >> 8) & 0xFF, v3 = version & 0xFF, vx = ((v2 * 1000) + v3), ok = 0;
printf("Intel(R) AMT version %d.%d.%d\r\n", v1, v2, v3);
if ((v1 <= 5) || (v1 >= 12)) { ok = 1; } // Intel AMT less then v5 and v12 and beyond, all ok.
else if ((v1 == 6) && (vx >= 2061)) { ok = 1; } // 1st Gen Core
else if ((v1 == 7) && (vx >= 1091)) { ok = 1; } // 2st Gen Core
else if ((v1 == 8) && (vx >= 1071)) { ok = 1; } // 3st Gen Core
else if ((v1 == 9)) { if ((v2 < 5) && (vx >= 1041)) { ok = 1; } else if (vx >= 5061) { ok = 1; } } // 4st Gen Core
else if ((v1 == 10) && (vx >= 55)) { ok = 1; } // 5st Gen Core
else if (v1 == 11) {
if ((v2 < 5) && (vx >= 25)) { ok = 1; } // 6st Gen Core
else if (vx >= 6027) { ok = 1; } // 7st Gen Core
}
if (ok == 0) {
printf("This computer requires a firmware update.\r\nPlease check: https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00075&languageid=en-fr\r\nExit code 2\r\n");
returnCode = 2;
}
}
}
else if (argc > 1 && (strcasecmp(argv[1], "run") == 0 || strcasecmp(argv[1], "-run") == 0))
{
// Run as an command line application
Chain = ILibCreateChain();
MicroLMS = ILibLMS_Create(Chain, selfexe);
if (MicroLMS != NULL)
{
#ifdef NOCOMMANDER
printf("Starting MicroLMS-lite v" VERSION ", CTRL-C to stop.\r\n");
#elif
printf("Starting MicroLMS v" VERSION ", CTRL-C to stop.\r\nWeb Application at http://127.0.0.1:16994.\r\n");
#endif
ILibStartChain(Chain);
printf("Stopping MicroLMS.\r\n");
}
else
{
printf("Unable to launch MicroLMS. Check that Intel ME is present, MEI driver installed and running as administrator.\r\n");
returnCode = 1;
}
}
#ifdef EXCLUSESERVICE
else
{
if (RunService() == 0 && GetLastError() == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
{
// Shutdown on Ctrl + C
signal(SIGINT, BreakSink);
printf(helpString);
return 0;
}
}
#else
else
{
printf(helpString);
}
#endif
CoUninitialize();
return returnCode;
}

View File

@@ -0,0 +1,8 @@
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"
xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

View File

@@ -0,0 +1,203 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,20 @@
MicroLMS 0.0.7
--------------
This is an alternative "Local Management Service" (LMS) for Intel AMT. If provides the very basic function of relaying localhost port 16992 & 16993 to Intel AMT, but also offers a web server on port 16994 with a local version of Web Commander hosted there. To use:
-run Run LMS as a console application.
-install Install the service from this location.
-uninstall Remove the service from this location.
start Start the service.
stop Stop the service.
Once running, point a browser to
http://localhost:16992 Access Intel AMT web UI, works if Intel AMT is activated.
https://localhost:16993 Access Intel AMT web UI, works if Intel AMT is activated with TLS.
http://localhost:16994 Access Web Commander, will display Intel AMT status even if not activated.
This is an early version of the code, it's released under Apache 2.0 open source license.
Enjoy!

View File

@@ -0,0 +1,19 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by MicroLMSService.rc
//
#define IDI_ICON1 101
#define IDC_BUTTON2 1002
#define IDC_BUTTON3 1004
#define IDC_HASHTEXT2 1008
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif