casting issue Please advice
I see weird things which not make science:
void Primary::PatBlt(rdpContext ctx, PATBLT_ORDER po) { HCLRCONV hclrconv = reinterpret_cast<wsgContext *>(ctx)->clrconv; }
If you look at wsgContext you will see that rdpContext is one of its params:
typedef struct { /** * FreeRDP's original portion. _/ rdpContext p; /* * Pointer to the main RDP handler. / RDP *pRDP; /* * Pointer to the corresponding Update API module. / Update *pUpdate; /* * Pointer to the corresponding Primary API module. / Primary *pPrimary; /* * The current color space conversion parameter. */ HCLRCONV clrconv; } wsgContext;
So HOW you can cast struct A to struct B when struct B include A ???!!!!
simply cast small struct A (lets say 100 bytes) to bigger struct B (lets say 1000 bytes), mean the only first 100 bytes in struct B will have data but all the other 900 byes will be garbage or zero, correct?
this mean hclrconv will be garbage as reinterpret_cast(ctx)->clrconv is garbage, right?
To help in troubleshooting, can you please add a link to the code on github where you saw the issue?
Pasting directly the code here does not help much.
Thanks!