S
strongburn
Unregistered / Unconfirmed
GUEST, unregistred user!
const WORD kwBaseOffset = 0xAC00; // Hangul char range (AC00-D7AF)<br>LPWSTR EncodeID(ULONG cbEID, LPENTRYID rgbID)<br>{<br> ULONG i = 0;<br> LPWSTR pwzDst = NULL;<br> LPBYTE pbSrc = NULL;<br> LPWSTR pwzIDEncoded = NULL;<br><br> // rgbID is the item Entry ID or the attachment ID<br> // cbID is the size in bytes of rgbID<br><br> // Allocate memory for pwzIDEncoded<br> pwzIDEncoded = new WCHAR[cbEID];<br> if (!pwzIDEncoded) return NULL;<br><br> for (i = 0, pbSrc = (LPBYTE)rgbID, pwzDst = pwzIDEncoded;<br> i < cbEID;<br> i++, pbSrc++, pwzDst++)<br> {<br> *pwzDst = (WCHAR) (*pbSrc + kwBaseOffset);<br> }<br><br> // Ensure NULL terminated<br> *pwzDst = L'/0';<br><br> // pwzIDEncoded now contains the entry ID encoded.<br> return pwzIDEncoded;<br>}