");
- ILibWebServer_StreamHeader_Raw(sender, 200, "OK", RESPONSE_HEADER_TEMPLATE_HTML, ILibAsyncSocket_MemoryOwnership_STATIC);
- ILibWebServer_StreamBody(sender, ILibScratchPad2, ptr, ILibAsyncSocket_MemoryOwnership_USER, 1);
- responseSent = 1;
- }
-
- if (responseSent == 0 && module->WebDir != NULL)
- {
-#if !defined(WIN32)
- int i;
-#endif
- int len = (int)strnlen_s(module->WebDir, sizeof(ILibScratchPad));
- //int SessionAuth = 0;
- char* HeaderTemplate = RESPONSE_HEADER_TEMPLATE_BIN;
- char* tmp;
-
- if (header->DirectiveObjLength == 15 && strncasecmp(header->DirectiveObj, "/authindex.html", 15) == 0 && ILibLMS_HttpServerPerformDigestAuth(sender) == 1) {
- // Send authentication required response if the auth page is requested.
- ILibWebServer_Digest_SendUnauthorized(sender, "MicroLMS", 8, "Authentication failed. Retry here.", 151);
- return;
- }
-
- memcpy_s(ILibScratchPad, sizeof(ILibScratchPad), module->WebDir, len);
- if (header->DirectiveObjLength == 1 || (header->DirectiveObjLength == 11 && strncasecmp(header->DirectiveObj, "/index.html", 11) == 0) || (header->DirectiveObjLength == 15 && strncasecmp(header->DirectiveObj, "/authindex.html", 15) == 0))
- {
- memcpy_s(ILibScratchPad + len, sizeof(ILibScratchPad), "\\index.html", 11);
- len += 11;
- }
- else
- {
- memcpy_s(ILibScratchPad + len, sizeof(ILibScratchPad) - len, header->DirectiveObj, header->DirectiveObjLength);
- len += header->DirectiveObjLength;
- }
- ILibScratchPad[len] = 0;
-
-#if !defined(WIN32)
- // Replace all "\" for "/" to make this a correct Linux path. Windows does not seem to mind about this.
- for (i = 0; i < len; i++) { if (ILibScratchPad[i] == '\\') ILibScratchPad[i] = '/'; }
-#endif
-
- // Send normal response
- tmp = strrchr(ILibScratchPad, '.');
- if (tmp != NULL)
- {
- // Check the file type
- if (strncasecmp(tmp, ".html", 5) == 0) HeaderTemplate = RESPONSE_HEADER_TEMPLATE_HTML;
- if (strncasecmp(tmp, ".txt", 4) == 0) HeaderTemplate = RESPONSE_HEADER_TEMPLATE_TEXT;
- if (strncasecmp(tmp, ".json", 5) == 0) HeaderTemplate = RESPONSE_HEADER_TEMPLATE_JSON;
- if (strncasecmp(tmp, ".js", 3) == 0) HeaderTemplate = RESPONSE_HEADER_TEMPLATE_JS;
- if (strncasecmp(tmp, ".gz", 3) == 0) HeaderTemplate = RESPONSE_HEADER_TEMPLATE_HTML_GZ;
-
- // Read the file in the /web folder
- tmp = NULL;
- len = (int)util_readfile(ILibScratchPad, &tmp, 2000000);
- if (len > 0 && tmp != NULL)
- {
- // Send the matching file in the /web folder
- ILibWebServer_StreamHeader_Raw(sender, 200, "200 - OK", HeaderTemplate, ILibAsyncSocket_MemoryOwnership_STATIC);
- ILibWebServer_StreamBody(sender, tmp, (int)len, ILibAsyncSocket_MemoryOwnership_CHAIN, 1);
- responseSent = 1;
- }
- }
- }
-
- if (responseSent == 0 && ((header->DirectiveObjLength == 1 && strncasecmp(header->DirectiveObj, "/", 1) == 0) || (header->DirectiveObjLength == 11 && strncasecmp(header->DirectiveObj, "/index.html", 11) == 0) || (header->DirectiveObjLength == 15 && strncasecmp(header->DirectiveObj, "/authindex.html", 15) == 0)))
- {
- char* etag = ILibGetHeaderLine(header, "if-none-match", 13);
- if (etag != NULL && strnlen_s(etag, 1024) == strnlen_s(IntelAmtWebApp_etag, 1023) && memcmp(etag, IntelAmtWebApp_etag, strnlen_s(IntelAmtWebApp_etag, 1024)) == 0)
- {
- // ETag match, send "NOT MODIFIED" response
- ILibWebServer_StreamHeader_Raw(sender, 304, "NOT MODIFIED", RESPONSE_HEADER_SERVER, ILibAsyncSocket_MemoryOwnership_STATIC);
- ILibWebServer_StreamBody(sender, NULL, 0, ILibAsyncSocket_MemoryOwnership_STATIC, 1);
- }
- else
- {
- // Send the built-in web site
- char temp[2000];
- snprintf(temp, 2000, RESPONSE_HEADER_TEMPLATE_HTML_GZ_ETAG, IntelAmtWebApp_etag);
- ILibWebServer_StreamHeader_Raw(sender, 200, "OK", temp, ILibAsyncSocket_MemoryOwnership_USER);
- ILibWebServer_StreamBody(sender, (char*)IntelAmtWebApp, sizeof(IntelAmtWebApp), ILibAsyncSocket_MemoryOwnership_STATIC, 1);
- }
- }
-
- if (responseSent == 0)
- {
- // Unknown URL, 404 error
- ILibWebServer_StreamHeader_Raw(sender, 404, "404 - File not found", RESPONSE_HEADER_TEMPLATE_HTML, ILibAsyncSocket_MemoryOwnership_STATIC);
- ILibWebServer_StreamBody(sender, "404 - File not found", 20, ILibAsyncSocket_MemoryOwnership_STATIC, 1);
- }
-}
-
-// Called when an HTTP session is disconnected.
-void ILibLMS_HttpServerSessionDisconnect(struct ILibWebServer_Session *session)
-{
- UNREFERENCED_PARAMETER(session);
-}
-
-// Called when a new HTTP session connects
-void ILibLMS_WebServer_OnSession(struct ILibWebServer_Session *SessionToken, void *User)
-{
- SessionToken->OnReceive = &ILibLMS_HttpServerSessionReceiveSink;
- SessionToken->OnDisconnect = &ILibLMS_HttpServerSessionDisconnect;
- SessionToken->User = User;
-}
-#endif
-
-// Create a new MicroLMS module.
-void *ILibLMS_CreateEx(void *Chain, char* SelfExe, ILibLMS_OnNotification callback, int extraMemorySize)
-{
- struct ILibLMS_StateModule *module;
-
- // Allocate the new module
- module = ILibMemory_Allocate(sizeof(struct ILibLMS_StateModule), extraMemorySize, NULL, NULL);
-
- // Setup the web folder
- if (SelfExe != NULL) {
-#if defined(WIN32)
- char* tmp = strrchr(SelfExe, '\\');
- memcpy_s(ILibScratchPad, sizeof(ILibScratchPad), SelfExe, tmp - SelfExe);
- memcpy_s(ILibScratchPad, sizeof(ILibScratchPad) - (tmp - SelfExe) + (tmp - SelfExe), "\\lmsweb", 7);
- if ((module->WebDir = (char*)malloc(strnlen_s(ILibScratchPad, sizeof(ILibScratchPad)) + 1)) == NULL) ILIBCRITICALEXIT(254);
- memcpy_s(module->WebDir, strnlen_s(ILibScratchPad, sizeof(ILibScratchPad)) + 1, ILibScratchPad, strnlen_s(ILibScratchPad, sizeof(ILibScratchPad)) + 1);
-#else
- char* tmp = strrchr(SelfExe, '/');
- memcpy_s(ILibScratchPad, sizeof(ILibScratchPad), SelfExe, tmp - SelfExe);
- memcpy_s(ILibScratchPad + (tmp - SelfExe), sizeof(ILibScratchPad) - (tmp - SelfExe), "/lmsweb", 7);
-#endif
- }
-
- {
- char localName[256] = "\0";
- struct hostent* s = NULL;
-
- // Setup MEI normal commands and set the local FQDN
- if (heci_Init(NULL, 0) == 0)
- {
- if (module->WebDir != NULL) { free(module->WebDir); }
- free(module);
- return NULL;
- }
- gethostname(localName, sizeof(localName));
- s = gethostbyname(localName);
- if (s != NULL) pthi_SetHostFQDN(s->h_name);
- }
-
- // Setup MEI with LMS interface, if we can't return null
- if (LME_Init(&(module->MeConnection), &ILibLMS_MEICallback, module) == 0) {
- free(module);
- return NULL;
- }
-
- // Setup the module
- module->chainLink.DestroyHandler = &ILibLMS_Destroy;
- module->chainLink.ParentChain = Chain;
- module->Callback = callback;
- sem_init(&(module->Lock), 0, 1);
-
- // TCP servers
- module->Server1 = ILibCreateAsyncServerSocketModule(Chain, LMS_MAX_CONNECTIONS, 16992, 4096, 2, &ILibLMS_OnConnect, &ILibLMS_OnDisconnect, &ILibLMS_OnReceive, NULL, &ILibLMS_OnSendOK);
- ILibAsyncServerSocket_SetTag(module->Server1, module);
- module->Server2 = ILibCreateAsyncServerSocketModule(Chain, LMS_MAX_CONNECTIONS, 16993, 4096, 2, &ILibLMS_OnConnect, &ILibLMS_OnDisconnect, &ILibLMS_OnReceive, NULL, &ILibLMS_OnSendOK);
- ILibAsyncServerSocket_SetTag(module->Server2, module);
-
-#ifndef NOLMSCOMMANDER
- // Web Server on port 16994
- module->WebServer = ILibWebServer_CreateEx(Chain, 8, 16994, 2, &ILibLMS_WebServer_OnSession, module);
-#endif
-
- IlibExternLMS = module; // Set the global reference to the LMS module.
- ILibAddToChain(Chain, module); // Add this module to the chain.
- return module;
-}
-
-#endif
diff --git a/microlms/lms/ILibLMS.h b/microlms/lms/ILibLMS.h
deleted file mode 100644
index f5815f3..0000000
--- a/microlms/lms/ILibLMS.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-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
diff --git a/microlms/service/MeshController.ico b/microlms/service/MeshController.ico
deleted file mode 100644
index 913b70e..0000000
Binary files a/microlms/service/MeshController.ico and /dev/null differ
diff --git a/microlms/service/MicroLMSService.aps b/microlms/service/MicroLMSService.aps
deleted file mode 100644
index e5badfd..0000000
Binary files a/microlms/service/MicroLMSService.aps and /dev/null differ
diff --git a/microlms/service/MicroLMSService.axps b/microlms/service/MicroLMSService.axps
deleted file mode 100644
index 02ae78f..0000000
Binary files a/microlms/service/MicroLMSService.axps and /dev/null differ
diff --git a/microlms/service/MicroLMSService.rc b/microlms/service/MicroLMSService.rc
deleted file mode 100644
index 5bede79..0000000
--- a/microlms/service/MicroLMSService.rc
+++ /dev/null
@@ -1,108 +0,0 @@
-// 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
-
diff --git a/microlms/service/MicroLMSService.vcxproj b/microlms/service/MicroLMSService.vcxproj
deleted file mode 100644
index 7ec6809..0000000
--- a/microlms/service/MicroLMSService.vcxproj
+++ /dev/null
@@ -1,266 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
- {CE5AD78C-DBDF-4D81-9A69-41B1DF683115}
- MeshConsole
- Win32Proj
- MicroLMSService
- 8.1
-
-
-
- Application
- Unicode
- true
- v140_xp
-
-
- Application
- Unicode
- v140_xp
-
-
- Application
- Unicode
- true
- v140_xp
-
-
- Application
- Unicode
- v140
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <_ProjectFileVersion>10.0.30319.1
- $(SolutionDir)$(Configuration)\
- $(Configuration)\
- true
- $(SolutionDir)$(Platform)\$(Configuration)\
- $(Platform)\$(Configuration)\
- false
- $(SolutionDir)$(Configuration)\
- $(Configuration)\
- false
- $(SolutionDir)$(Platform)\$(Configuration)\
- $(Platform)\$(Configuration)\
- false
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- AllRules.ruleset
-
-
- false
- $(ProjectName)
- true
-
-
- true
-
-
-
- Disabled
- %(AdditionalIncludeDirectories)
- WIN32;_WINSERVICE;_DEBUG;_CONSOLE;MEMORY_CHECK;__STDC__;WINSOCK2;ILibWebServer_SESSION_TRACKING;_MSC_PLATFORM_TOOLSET_$(PlatformToolset);%(PreprocessorDefinitions);MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;NOCOMMANDER;_XLMSDEBUG
- true
- EnableFastChecks
- MultiThreadedDebug
-
-
- Level4
- EditAndContinue
-
-
- ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;%(AdditionalDependencies)
- true
- Console
- MachineX86
- false
- true
-
-
-
-
- true
-
-
-
-
-
-
- $(ProjectDir)dpiaware.manifest %(AdditionalManifestFiles)
-
-
-
-
- X64
-
-
- Disabled
- %(AdditionalIncludeDirectories)
- WIN32;WIN64;_DEBUG;_CONSOLE;MEMORY_CHECK;MICROSTACK_NO_STDAFX;__STDC__;_CRT_SECURE_NO_WARNINGS;WINSOCK2;MICROSTACK_NOTLS;ILibWebServer_SESSION_TRACKING;%(PreprocessorDefinitions)
- true
- EnableFastChecks
- MultiThreadedDebug
-
-
- Level3
- ProgramDatabase
-
-
- ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;%(AdditionalDependencies)
- true
- Console
- MachineX64
- true
-
-
- REM signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshService" /du "http://opentools.homeip.net" "$(TargetPath)"
-
-
-
-
- Full
- true
- %(AdditionalIncludeDirectories)
- WIN32;_WINSERVICE;NDEBUG;_CONSOLE;WINSOCK2;_MSC_PLATFORM_TOOLSET_$(PlatformToolset);%(PreprocessorDefinitions);_LINKVM;_XDEBUGLMS;MICROSTACK_NO_STDAFX;MICROSTACK_NOTLS;NOCOMMANDER
- MultiThreaded
- true
-
-
- Level3
- ProgramDatabase
- Cdecl
- true
-
-
- ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;%(AdditionalDependencies)
- $(OutDir)$(TargetName)$(TargetExt)
- true
- Console
- true
- true
- MachineX86
-
-
-
-
-
-
- $(ProjectDir)dpiaware.manifest %(AdditionalManifestFiles)
-
-
-
-
- X64
-
-
- MinSpace
- true
- %(AdditionalIncludeDirectories)
- WIN32;WIN64;_WINSERVICE;NDEBUG;_CONSOLE;MICROSTACK_NO_STDAFX;WINSOCK2;MICROSTACK_NOTLS;%(PreprocessorDefinitions)
- MultiThreaded
- true
-
-
- Level3
- ProgramDatabase
-
-
- ws2_32.lib;DbgHelp.lib;Setupapi.lib;Iphlpapi.lib;%(AdditionalDependencies)
- true
- Console
- true
- true
- MachineX64
-
-
- signtool.exe sign /sha1 fd5940d8fd585545614fea6da455f25d224b00c9 /d "MeshService" /du "http://opentools.homeip.net" /t http://timestamp.comodoca.com/authenticode "$(TargetPath)"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/microlms/service/MicroLMSService.vcxproj.filters b/microlms/service/MicroLMSService.vcxproj.filters
deleted file mode 100644
index a51f10c..0000000
--- a/microlms/service/MicroLMSService.vcxproj.filters
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
-
-
- {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
- cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
-
-
- {93995380-89BD-4b04-88EB-625FBE52EBFB}
- h;hpp;hxx;hm;inl;inc;xsd
-
-
- {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
- rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
-
-
- {1b4b4360-c108-47a8-80ae-f3dfa0a7812e}
-
-
- {a455730f-2a1c-4da6-97db-902d9bd2ab59}
-
-
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- Source Files
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- LMS
-
-
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- Header Files
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- microstack
-
-
- LMS
-
-
- LMS
-
-
-
-
- Resource Files
-
-
-
-
- Resource Files
-
-
- Resource Files
-
-
-
\ No newline at end of file
diff --git a/microlms/service/MicroLMSService64.rc b/microlms/service/MicroLMSService64.rc
deleted file mode 100644
index 6f4e0ac..0000000
--- a/microlms/service/MicroLMSService64.rc
+++ /dev/null
@@ -1,153 +0,0 @@
-// 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
-
diff --git a/microlms/service/ServiceMain.c b/microlms/service/ServiceMain.c
deleted file mode 100644
index 2f69390..0000000
--- a/microlms/service/ServiceMain.c
+++ /dev/null
@@ -1,622 +0,0 @@
-/*
-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
-#include
-#elif defined(WINSOCK1)
-#include
-#include
-#endif
-
-#include
-#include
-#include
-#include
-#include "resource.h"
-#include "../../microstack/ILibParsers.h"
-#include "../lms/ILibLMS.h"
-
-#if defined(WIN32) && defined (_DEBUG) && !defined(_MINCORE)
-#include
-#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, 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");
- }
- 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, NULL);
- 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;
-}
-
diff --git a/microlms/service/dpiaware.manifest b/microlms/service/dpiaware.manifest
deleted file mode 100644
index f87621e..0000000
--- a/microlms/service/dpiaware.manifest
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- true
-
-
-
\ No newline at end of file
diff --git a/microlms/service/license.txt b/microlms/service/license.txt
deleted file mode 100644
index 715e4bc..0000000
--- a/microlms/service/license.txt
+++ /dev/null
@@ -1,203 +0,0 @@
-
- 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.
-
diff --git a/microlms/service/readme.txt b/microlms/service/readme.txt
deleted file mode 100644
index 6e5f224..0000000
--- a/microlms/service/readme.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-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!
\ No newline at end of file
diff --git a/microlms/service/resource.h b/microlms/service/resource.h
deleted file mode 100644
index 99de45b..0000000
--- a/microlms/service/resource.h
+++ /dev/null
@@ -1,19 +0,0 @@
-//{{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