Useful Conversion in C++
BYTE[] to DWORD:
BYTE tzValue[4];
DWORD value = tzValue[3]*16*16*16 + tzValue[2]*16*16 + tzValue[1]*16 + tzValue[0];
Print hexadecimal:
printf(“Value:
BYTE[] to WCHAR:
BYTE tzValue[MAX_PATH];
WCHAR* strDest = (WCHAR*) &tzValue[0];
Merge 2 WORDs into a DWORD:
WORD wLow;
WORD wHigh;
DWORD dw = wLow + 0x1000*wHigh;
BSTR to (char*)
BSTR st;
char* st = (const char*)_bstr_t(st);