Skip to content

Commit

Permalink
Added workaround for 32 bit windows agent on 64 bit windows, to injec…
Browse files Browse the repository at this point in the history
…t sysnative when callind readdirSync() on %windir%

Updated documentation for windows terminal.
  • Loading branch information
krayon007 committed Oct 14, 2022
1 parent 601d5e5 commit 06ec0ca
Show file tree
Hide file tree
Showing 3 changed files with 262 additions and 74 deletions.
21 changes: 21 additions & 0 deletions agents/meshcore.js
Expand Up @@ -47,6 +47,27 @@ var MESHRIGHT_NODESKTOP = 65536;

var pendingSetClip = false; // This is a temporary hack to prevent multiple setclips at the same time to stop the agent from crashing.

function __readdirSync_fix(path)
{
var sysnative = false;
pathstr = require('fs')._fixwinpath(path);
if (pathstr.split('\\*').join('').toLowerCase() == process.env['windir'].toLowerCase()) { sysnative = true; }
var ret = __readdirSync_old(path);
if (sysnative) { ret.push('sysnative'); }
return (ret);
}

if (process.platform == 'win32' && require('_GenericMarshal').PointerSize == 4 && require('os').arch() == 'x64')
{
if(require('fs').readdirSync.version == null)
{
require('fs').__readdirSync_old = require('fs').readdirSync;
require('fs').readdirSync = __readdirSync_fix;
}
}



function bcdOK() {
if (process.platform != 'win32') { return (false); }
if (require('os').arch() == 'x64') {
Expand Down

0 comments on commit 06ec0ca

Please sign in to comment.