diff --git a/meshservice/MeshService.aps b/meshservice/MeshService.aps index f3eceed..2efaa80 100644 Binary files a/meshservice/MeshService.aps and b/meshservice/MeshService.aps differ diff --git a/meshservice/MeshService.rc b/meshservice/MeshService.rc index abda4a4..7a55595 100644 --- a/meshservice/MeshService.rc +++ b/meshservice/MeshService.rc @@ -6,11 +6,8 @@ ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. - +// #include "afxres.h" -//if using VS2019 pro edition, you will get error when try to build, so place "//" infront of the top line then add the following lines: -// #include "WinResrc.h" -// #define IDC_STATIC -1 ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -72,7 +69,7 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,2,1,3 + FILEVERSION 0,0,0,0 PRODUCTVERSION 0,0,0,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG @@ -88,12 +85,8 @@ BEGIN BEGIN BLOCK "040904b0" BEGIN - VALUE "FileDescription", "Mesh Agent Service" - VALUE "FileVersion", "0.2.1.3" - VALUE "InternalName", "MeshAgent" + VALUE "FileVersion", "0.0.0.0" VALUE "LegalCopyright", "Apache 2.0 License" - VALUE "OriginalFilename", "MeshAgent.exe" - VALUE "ProductName", "Mesh Agent Service" VALUE "ProductVersion", "0, 0, 0, 0" END END diff --git a/meshservice/MeshService.vcxproj b/meshservice/MeshService.vcxproj index 17d2ce4..1f1cd89 100644 --- a/meshservice/MeshService.vcxproj +++ b/meshservice/MeshService.vcxproj @@ -180,6 +180,7 @@ false $(ProjectName)64 + false false diff --git a/meshservice/ServiceMain.c b/meshservice/ServiceMain.c index 59e3db2..e1b25d9 100644 --- a/meshservice/ServiceMain.c +++ b/meshservice/ServiceMain.c @@ -38,12 +38,6 @@ limitations under the License. #include "microscript/ILibDuktape_Commit.h" #include -#ifndef _MINCORE -// #include "../kvm/kvm.h" -int SetupWindowsFirewall(wchar_t* processname); -int ClearWindowsFirewall(wchar_t* processname); -#endif - #if defined(WIN32) && defined (_DEBUG) && !defined(_MINCORE) #include #define _CRTDBG_MAP_ALLOC @@ -167,7 +161,7 @@ void GdiPlusFlat_Release() BOOL IsAdmin() { - BOOL admin; + BOOL admin = 0; PSID AdministratorsGroup; SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY; @@ -805,40 +799,10 @@ int wmain(int argc, char* wargv[]) int len = MeshInfo_GetSystemInformation(&data); if (len > 0) { printf_s(data); } } - else if (argc > 1 && (strcasecmp(argv[1], "-setfirewall") == 0)) - { - // Reset the firewall rules - GetModuleFileNameW(NULL, str, _MAX_PATH); - if (IsAdmin() == FALSE) { printf("Must run as administrator"); } - else { ClearWindowsFirewall(str); SetupWindowsFirewall(str); printf("Done"); } - } - else if (argc > 1 && (strcasecmp(argv[1], "-clearfirewall") == 0)) - { - // Clear the firewall rules - GetModuleFileNameW(NULL, str, _MAX_PATH); - if (IsAdmin() == FALSE) { printf("Must run as administrator"); } - else { ClearWindowsFirewall(str); printf("Done"); } - } #endif else if (argc == 2 && (strcasecmp(argv[1], "-resetnodeid") == 0)) { // Set "resetnodeid" in registry - HKEY hKey; -#ifndef _WIN64 - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Open Source\\MeshAgent2", 0, KEY_WRITE | KEY_WOW64_32KEY, &hKey) == ERROR_SUCCESS) -#else - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Open Source\\MeshAgent2", 0, KEY_WRITE, &hKey) == ERROR_SUCCESS) -#endif - { - i = 1; - DWORD err = RegSetValueEx(hKey, "ResetNodeId", 0, REG_DWORD, (BYTE*)&i, (DWORD)4); - if (err == ERROR_SUCCESS) { printf("NodeID will be reset next time the Mesh Agent service is started."); } - RegCloseKey(hKey); - } - else - { - printf("Error writing to registry, try running as administrator."); - } wmain_free(argv); return 0; }