1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 15:53:55 +00:00

Fixed windows installer for 32 bit

This commit is contained in:
Bryan Roe
2022-01-21 10:32:15 -08:00
parent 6eab5afe39
commit e4c4d39a92
4 changed files with 113 additions and 81 deletions

View File

@@ -251,7 +251,7 @@ char* crashMemory = ILib_POSIX_InstallCrashHandler(argv[0]);
#endif #endif
printf("Agent ARCHID: %d\n", MESH_AGENTID); printf("Agent ARCHID: %d\n", MESH_AGENTID);
char script[] = "var _tmp = 'Detected OS: ' + require('os').Name; try{_tmp += (' - ' + require('os').arch());}catch(x){}console.log(_tmp);process.exit();"; char script[] = "var _tmp = 'Detected OS: ' + require('os').Name; try{_tmp += (' - ' + require('os').arch());}catch(x){}console.log(_tmp);if(process.platform=='win32'){ _tmp=require('win-authenticode-opus')(process.execPath); if(_tmp!=null && _tmp.url!=null){ _tmp=require('win-authenticode-opus').locked(_tmp.url); if(_tmp!=null) { console.log('LOCKED to: ' + _tmp.dns); console.log(' => ' + _tmp.id); } } } process.exit();";
integratedJavaScript = ILibString_Copy(script, sizeof(script) - 1); integratedJavaScript = ILibString_Copy(script, sizeof(script) - 1);
integratedJavaScriptLen = (int)sizeof(script) - 1; integratedJavaScriptLen = (int)sizeof(script) - 1;
} }

View File

@@ -94,21 +94,21 @@ extern DWORD WINAPI kvm_server_mainloop(LPVOID Param);
HMODULE _gdip = NULL; HMODULE _gdip = NULL;
HMODULE _shm = NULL; HMODULE _shm = NULL;
typedef int(*_GdipCreateBitmapFromStream)(void *stream, void **bitmap); typedef int(__stdcall *_GdipCreateBitmapFromStream)(void *stream, void **bitmap);
typedef int(*_GdiplusStartup)(void **token, void *input, void *obj); typedef int(__stdcall *_GdiplusStartup)(void **token, void *input, void *obj);
typedef int(*_GdiplusShutdown)(void *token); typedef int(__stdcall *_GdiplusShutdown)(void *token);
typedef IStream*(*_SHCreateMemStream)(void *buffer, uint32_t bufferLen); typedef IStream*(__stdcall *_SHCreateMemStream)(void *buffer, uint32_t bufferLen);
typedef int(*_GdipCreateHBITMAPFromBitmap)(void *bitmap, HBITMAP *hbReturn, int background); typedef int(__stdcall *_GdipCreateHBITMAPFromBitmap)(void *bitmap, HBITMAP *hbReturn, int background);
typedef int(*_GdipGetImagePixelFormat)(void *image, int *format); typedef int(__stdcall *_GdipGetImagePixelFormat)(void *image, int *format);
typedef int(*_GdipCreateBitmapFromScan0)(int width, int height, int stride, int format, BYTE* scan0, void** bitmap); typedef int(__stdcall *_GdipCreateBitmapFromScan0)(int width, int height, int stride, int format, BYTE* scan0, void** bitmap);
typedef int(*_GdipGetImageHorizontalResolution)(void *image, float *resolution); typedef int(__stdcall *_GdipGetImageHorizontalResolution)(void *image, float *resolution);
typedef int(*_GdipGetImageVerticalResolution)(void *image, float *resolution); typedef int(__stdcall *_GdipGetImageVerticalResolution)(void *image, float *resolution);
typedef int(*_GdipBitmapSetResolution)(void* bitmap, float xdpi, float ydpi); typedef int(__stdcall *_GdipBitmapSetResolution)(void* bitmap, float xdpi, float ydpi);
typedef int(*_GdipGetImageGraphicsContext)(void *image, void **graphics); typedef int(__stdcall *_GdipGetImageGraphicsContext)(void *image, void **graphics);
typedef int(*_GdipSetSmoothingMode)(void *graphics, int smoothingMode); typedef int(__stdcall *_GdipSetSmoothingMode)(void *graphics, int smoothingMode);
typedef int(*_GdipSetInterpolationMode)(void *graphics, int interpolationMode); typedef int(__stdcall *_GdipSetInterpolationMode)(void *graphics, int interpolationMode);
typedef int(*_GdipDrawImageRectI)(void *graphics, void *image, int x, int y, int width, int height); typedef int(__stdcall *_GdipDrawImageRectI)(void *graphics, void *image, int x, int y, int width, int height);
typedef int(*_GdipDisposeImage)(void *image); typedef int(__stdcall *_GdipDisposeImage)(void *image);
typedef HRESULT(__stdcall *DpiAwarenessFunc)(PROCESS_DPI_AWARENESS); typedef HRESULT(__stdcall *DpiAwarenessFunc)(PROCESS_DPI_AWARENESS);
_GdipCreateBitmapFromStream GdipCreateBitmapFromStream; _GdipCreateBitmapFromStream GdipCreateBitmapFromStream;
@@ -531,7 +531,7 @@ int wmain(int argc, char* wargv[])
printf("Using %s\n", SSLeay_version(SSLEAY_VERSION)); printf("Using %s\n", SSLeay_version(SSLEAY_VERSION));
#endif #endif
printf("Agent ARCHID: %d\n", MESH_AGENTID); printf("Agent ARCHID: %d\n", MESH_AGENTID);
char script[] = "console.log('Detected OS: ' + require('os').Name + ' - ' + require('os').arch());process.exit();"; char script[] = "var _tmp = 'Detected OS: ' + require('os').Name; try{_tmp += (' - ' + require('os').arch());}catch(x){}console.log(_tmp);if(process.platform=='win32'){ _tmp=require('win-authenticode-opus')(process.execPath); if(_tmp!=null && _tmp.url!=null){ _tmp=require('win-authenticode-opus').locked(_tmp.url); if(_tmp!=null) { console.log('LOCKED to: ' + _tmp.dns); console.log(' => ' + _tmp.id); } } } process.exit();";
integratedJavaScript = ILibString_Copy(script, sizeof(script) - 1); integratedJavaScript = ILibString_Copy(script, sizeof(script) - 1);
integragedJavaScriptLen = (int)sizeof(script) - 1; integragedJavaScriptLen = (int)sizeof(script) - 1;
} }
@@ -938,6 +938,8 @@ int wmain(int argc, char* wargv[])
void *dialogchain = ILibCreateChain(); void *dialogchain = ILibCreateChain();
ILibChain_PartialStart(dialogchain); ILibChain_PartialStart(dialogchain);
duk_context *ctx = ILibDuktape_ScriptContainer_InitializeJavaScriptEngineEx(0, 0, dialogchain, NULL, NULL, selfexe, NULL, NULL, dialogchain); duk_context *ctx = ILibDuktape_ScriptContainer_InitializeJavaScriptEngineEx(0, 0, dialogchain, NULL, NULL, selfexe, NULL, NULL, dialogchain);
if (duk_peval_string(ctx, "require('win-authenticode-opus').checkMSH();") == 0)
{
if (duk_peval_string(ctx, "require('util-language').current.toLowerCase().split('_').join('-');") == 0) { lang = (char*)duk_safe_to_string(ctx, -1); } if (duk_peval_string(ctx, "require('util-language').current.toLowerCase().split('_').join('-');") == 0) { lang = (char*)duk_safe_to_string(ctx, -1); }
if (duk_peval_string(ctx, "(function foo(){return(JSON.parse(_MSH().translation));})()") != 0 || !duk_has_prop_string(ctx, -1, "en")) if (duk_peval_string(ctx, "(function foo(){return(JSON.parse(_MSH().translation));})()") != 0 || !duk_has_prop_string(ctx, -1, "en"))
{ {
@@ -1005,7 +1007,11 @@ int wmain(int argc, char* wargv[])
DialogBoxW(NULL, MAKEINTRESOURCEW(IDD_INSTALLDIALOG), NULL, DialogHandler); DialogBoxW(NULL, MAKEINTRESOURCEW(IDD_INSTALLDIALOG), NULL, DialogHandler);
GdiPlusFlat_Release(); GdiPlusFlat_Release();
}
else
{
printf("%s", duk_safe_to_string(ctx, -1));
}
Duktape_SafeDestroyHeap(ctx); Duktape_SafeDestroyHeap(ctx);
ILibStopChain(dialogchain); ILibStopChain(dialogchain);
ILibStartChain(dialogchain); ILibStartChain(dialogchain);

File diff suppressed because one or more lines are too long

View File

@@ -111,5 +111,31 @@ function locked(uri)
} }
return (null); return (null);
} }
function checkMSH()
{
var value = module.exports(process.execPath);
if (value != null) { value = module.exports.locked(value.url); }
if(value!=null)
{
var msh = _MSH();
if(msh!=null)
{
if(msh.MeshServer && msh.ServerID)
{
var res1 = require('http').parseUri(msh.MeshServer);
if(res1!=null)
{
if(res1.host.toLowerCase() != value.dns.toLowerCase() || msh.ServerID.toLowerCase() != value.id.toLowerCase())
{
throw ('Server Configuration MISMATCH');
}
}
}
}
}
}
module.exports = read; module.exports = read;
module.exports.locked = locked; module.exports.locked = locked;
module.exports.checkMSH = checkMSH;