Skip to content

Commit

Permalink
Updated 'sysnative' workaround for 32 bit agent on 64 bit windows, to…
Browse files Browse the repository at this point in the history
… include description explaining what is going on.
  • Loading branch information
krayon007 committed Oct 20, 2022
1 parent 06ec0ca commit 3c5bc7e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions agents/meshcore.js
Expand Up @@ -47,6 +47,10 @@ 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.

//
// This is a helper function used by the 32 bit Windows Agent, when running on 64 bit windows. It will check if the agent is already patched for this
// and will use this helper if it is not. This helper will inject 'sysnative' into the results when calling readdirSync() on %windir%.
//
function __readdirSync_fix(path)
{
var sysnative = false;
Expand All @@ -59,15 +63,16 @@ function __readdirSync_fix(path)

if (process.platform == 'win32' && require('_GenericMarshal').PointerSize == 4 && require('os').arch() == 'x64')
{
if(require('fs').readdirSync.version == null)
if (require('fs').readdirSync.version == null)
{
//
// 32 Bit Windows Agent on 64 bit Windows has not been patched for sysnative issue, so lets use our own solution
//
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 3c5bc7e

Please sign in to comment.