How do I handle SlowBuffer in Node.js?

Now I'm developing a usb-serial application with its dll in Node.js. This dll returns INVALID_HANDLE_VALUE, if it fails to open com port. So I want to handle the ret value in Node.js. In this case, How do I handle below ?

I'm not sure how do I compare the ret value and SlowBuffer.

DLL

#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1
typedef HANDLE  (*OPEN)(int);
__declspec(dllexport) HANDLE opencom(int ncom)

Node.js with node-ffi

var ffi = require('ffi');
var lib = ffi.Library('serialmw.dll', {
  'opencom' : ['pointer', ['int']]
});
var hcom = null;
hcom = lib.opencom(1);
console.log(hcom); // <SlowBuffer@0xFFFFFFFFFFFFFFFF >

A SlowBuffer is just a Buffer which is just a bunch of raw binary bytes. If you want to compare two Buffers byte-for-byte, you will have to use a for-loop or something like the buffertools' compare() with both Buffers.