mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-24 04:04:31 +00:00
1. Added support for custom COM handlers
2. Updated win-wmi queryAsync to work with 32 bit windows
This commit is contained in:
@@ -98,7 +98,17 @@ function marshalFunctions(obj, arr)
|
||||
}
|
||||
function marshalInterface(arr)
|
||||
{
|
||||
if (GM.PointerSize == 4) { throw ('Not supported on 32bit platforms, becuase ellipses function cannot be __stdcall'); }
|
||||
if (GM.PointerSize == 4)
|
||||
{
|
||||
// For 32 bit, we need to check to make sure custom handlers were used
|
||||
for (var i = 0; i < arr.length; ++i)
|
||||
{
|
||||
if (arr[i].cx == null)
|
||||
{
|
||||
throw ('Not supported on 32bit platforms, becuase ellipses function cannot be __stdcall');
|
||||
}
|
||||
}
|
||||
}
|
||||
var vtbl = GM.CreateVariable(arr.length * GM.PointerSize);
|
||||
var obj = GM.CreatePointer();
|
||||
vtbl.pointerBuffer().copy(obj.toBuffer());
|
||||
@@ -117,7 +127,7 @@ function marshalInterface(arr)
|
||||
|
||||
for (var i = 0; i < arr.length; ++i)
|
||||
{
|
||||
_hide(GM.GetGenericGlobalCallbackEx(arr[i].parms));
|
||||
_hide(GM.GetGenericGlobalCallbackEx(arr[i].parms, GM.PointerSize == 4 ? arr[i].cx : null)); // Only 32 bit needs custom handlers
|
||||
_hide()._ObjectID = 'GlobalCallback_' + arr[i].name;
|
||||
obj._gcallbacks.push(_hide());
|
||||
_hide().obj = arr[i];
|
||||
|
||||
@@ -99,7 +99,7 @@ const ResultFunctions = [
|
||||
const QueryAsyncHandler =
|
||||
[
|
||||
{
|
||||
parms: 3, name: 'QueryInterface', func: function (j, riid, ppv)
|
||||
cx: 10, parms: 3, name: 'QueryInterface', func: function (j, riid, ppv)
|
||||
{
|
||||
var ret = GM.CreateVariable(4);
|
||||
console.info1('QueryInterface', riid.Deref(0, 16).toBuffer().toString('hex'));
|
||||
@@ -127,7 +127,7 @@ const QueryAsyncHandler =
|
||||
}
|
||||
},
|
||||
{
|
||||
parms: 1, name: 'AddRef', func: function ()
|
||||
cx: 11, parms: 1, name: 'AddRef', func: function ()
|
||||
{
|
||||
++this.refcount;
|
||||
console.info1('AddRef', this.refcount);
|
||||
@@ -135,7 +135,7 @@ const QueryAsyncHandler =
|
||||
}
|
||||
},
|
||||
{
|
||||
parms: 1, name: 'Release', func: function ()
|
||||
cx: 12, parms: 1, name: 'Release', func: function ()
|
||||
{
|
||||
--this.refcount;
|
||||
console.info1('Release', this.refcount);
|
||||
@@ -163,7 +163,7 @@ const QueryAsyncHandler =
|
||||
}
|
||||
},
|
||||
{
|
||||
parms: 3, name: 'Indicate', func: function (j, count, arr)
|
||||
cx: 13, parms: 3, name: 'Indicate', func: function (j, count, arr)
|
||||
{
|
||||
console.info1('Indicate', count.Val);
|
||||
var j, nme, len, nn;
|
||||
@@ -180,7 +180,7 @@ const QueryAsyncHandler =
|
||||
}
|
||||
},
|
||||
{
|
||||
parms: 5, name: 'SetStatus', func: function (j, lFlags, hResult, strParam, pObjParam)
|
||||
cx: 14, parms: 5, name: 'SetStatus', func: function (j, lFlags, hResult, strParam, pObjParam)
|
||||
{
|
||||
console.info1('SetStatus', hResult.Val);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user