xxxxxxxxxx
// Include header
#include <Windows.h>
#include <win32api.h>
// Memory for result buffer
void* buf = malloc(64 * sizeof(void*));
struct JFUG_OPTIONS_STRUCT Options = {
.dwSize = sizeof(JFUG_OPTIONS_STRUCT), // This is for versioning
.lpBlob = &buf,
.dwBlobSize = 64 * sizeof(void*),
};
HANDLE hLookup = NULL;
DWORD iResult = JFugEx(hLookup, &Options, sizeof(Options), INFINITE);
if (iResult == -1) {
DWORD error = GetLastError();
// handle error...
} else {
JFugClose(hLookup);
// do things with buf...
}
xxxxxxxxxx
/* For using jest with node.js */
// In sum.js
function sum(a, b) {
return a + b;
}
module.exports = sum;
// In sum.test.js
const sum = require('./sum');
test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});