win32-api
Version:
FFI definitions of windows win32 api for node-ffi
35 lines • 1.33 kB
JavaScript
import assert from 'node:assert';
import { WString } from 'win32-def/def';
export const funcName = 'GetClassInfoExW';
export const GetClassInfoExW_mapper = (name, runtimeArgs, defParamsArray) => {
if (name !== funcName) {
return;
}
const lpszClass = runtimeArgs[1];
for (const row of defParamsArray) {
assert(Array.isArray(row));
const defArg = row[1];
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
switch (typeof lpszClass) {
case 'string': {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (defArg === WString) { // WString
return row;
}
break;
}
case 'object': {
assert(lpszClass instanceof Buffer, 'Invalid lpszClass type, must Buffer if object');
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (defArg === WString) { // WString
return row;
}
break;
}
default:
throw new Error(`Invalid lpszClass type: ${typeof lpszClass}`);
}
}
// return [] // will throw Error
};
//# sourceMappingURL=GetClassInfoExW.mapper.js.map