|
- static HRESULT HexString (const BYTE value, LPTSTR pszBuffer, const DWORD cbBufferSize, DWORD *pcbAdded)
- {
- static const TCHAR HexLookup[16] = {_T('0'), _T('1'), _T('2'), _T('3'),
- _T('4'), _T('5'), _T('6'), _T('7'),
- _T('8'), _T('9'), _T('A'), _T('B'),
- _T('C'), _T('D'), _T('E'), _T('F')
- };
- HRESULT hr;
- if (cbBufferSize < 3)
- {
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- }
- else
- {
- *pszBuffer++ = HexLookup[(value >> 4) & 0x0F];
- *pszBuffer++ = HexLookup[value & 0x0F];
- *pszBuffer = _T('\0');
- *pcbAdded = 2;
- hr = S_OK;
- }
- return hr;
- }
复制代码
MS的 |
|