From 7c0dc07ee31dd536a3e4fd16323c590c2c5b80cf Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Mon, 9 May 2022 22:39:49 -0700 Subject: [PATCH] Updated a few things to help alleviate false positives with AV Vendors --- meshservice/MeshService.aps | Bin 177508 -> 177532 bytes meshservice/MeshService.rc | 13 +++-------- meshservice/MeshService.vcxproj | 1 + meshservice/ServiceMain.c | 38 +------------------------------- 4 files changed, 5 insertions(+), 47 deletions(-) diff --git a/meshservice/MeshService.aps b/meshservice/MeshService.aps index f3eceeddbf881287512e0adef4f001a48de98209..2efaa801811d5c2384b2d01135dafd95bca83086 100644 GIT binary patch delta 1183 zcmZXTTWAwO6hQC2dDPZwV{Mzpv`K7?k6JZptQHj^uA!N<*~DgBDk|}TC^V^6Oi=Lw zB8Wetj5r7d{qRG7-j&ljgmx|`j=H2 zOv!BM)3l`84xwPM9jbT@y6R_^o3LS4LN(u>b~ny4Oi{>uNp5W7PpNrr zvl+25npS#QO8Yau6Fer@A{&g-+e6^}3(_X=@n?PRw)rMz30Z@|!_Z<9<6AK$)5Fvf zUkQHTzWzp90DNAr2V417i;tE9U*GS+HhyGN6E4%qdN9flvAy;=R)7T{#*5_P*0|ID zZ)KL`ra?f$&0ry z;?q|+Af649S9ae9X+?#MH=6KgDL{8o#Iw|b7ep>g&P6SN@=#zOpL5&PvWO)!3(d2FQx6ZeYbwGAP_R`FI!{2@>$ zuYFfk7Pg6>O?hmeUm~0mOj5ieUg*>;S_i4t)*u7ko6qAqHCWoRBx(l9ExzkiYabwh zR94u>$b*kXV2r$$qX$TIA0U_5K1No{%RGq_d5Yi-aow=b3nVTV$hGHM0N`hV+&z&{tIz}9Pap253_xry4 z&AIo?hu76FUswO#!a7Elg*~lP2D^e!!((UXR$?KW*m2h=!tkCN#rfg7Qg z-(lXyI)~~@_Uh`M61fRHWa1T`i&**Jf;>a>u zni|mKq>yFs0$2KdxD@z-{zlfo$I%~abc6{l(~~ungk~!@fbT0*k86ghck5c(<~pE> zzs10LzoUq288xlFRJk2m;p4{*d|RT)MX&-_cHVMBXRToGX6D8w`Nc%U1=ZZ1 zx3p~mioDZk=f4=u)@dWntpAf9#!~!QUzo`jOYLPfif-sMSdiryp!I8dPW|K1=**!} zHv5oG2sw`-N~t`qt3&{hfQdiz*oKJWW*(Qb=i)&g8zci3i@E}~g%gm2Q!qeRsK8OG zhoDGxhN_b=49DOw!v)`S4`05z8Mt3X$-PkV#_q`IwJPl>0fbf8dY{h+_hK#h!@l7 zKOdp(?CfiMN|| H@eDozi|00Y 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; }