-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
@TooTallNate I have a problem with pointer to pointer of struct.
well, I have the code in c/c++
typedef struct _wfs_ptr_status
{
WORD fwDevice;
WORD fwMedia;
WORD fwPaper[WFS_PTR_SUPPLYSIZE];
WORD fwToner;
WORD fwInk;
WORD fwLamp;
LPWFSPTRRETRACTBINS * lppRetractBins;
USHORT usMediaOnStacker;
LPSTR lpszExtra;
} WFSPTRSTATUS, * LPWFSPTRSTATUS;
typedef struct _wfs_result
{
REQUESTID RequestID;
HSERVICE hService;
SYSTEMTIME tsTimestamp;
HRESULT hResult;
union {
DWORD dwCommandCode;
DWORD dwEventID;
} u;
LPVOID lpBuffer;
} WFSRESULT, * LPWFSRESULT;
WFSRESULT *pResult = 0;
WFSGetInfo (&pResult);
LPWFSPTRSTATUS lpStatus = (LPWFSPTRSTATUS)pResult->lpBuffer;
in node-ffi, I've the code:
var WFSRESULT = Struct({
'RequestID': 'ulong',
'hService': 'ushort',
'tsTimestamp': SYSTEMTIME,
'hResult': 'long',
'u': union,
'lpBuffer': 'pointer'
})
var LPWFSRESULT = ref.refType(WFSRESULT)
...
...
...
var pResult = ref.alloc(LPWFSRESULT,0)
lib.WFSGetInfo (pResult);
var result = pResult.deref().deref()
//c++ code - LPWFSPTRSTATUS lpStatus = (LPWFSPTRSTATUS)pResult->lpBuffer;
result.lpBuffer.type = ref.refType(LPWFSPTRSTATUS) //is this working?
but I don't know this code is correct. How to access the fields of the WFSPTRSTATUS struct as c++ code?
Metadata
Metadata
Assignees
Labels
No labels