You are very familiar with strncpy_s(wszStringBuffer, BUFFER_SIZE, wszSourceBuffer, dwCopyBytes)
But if you declare wszStringBuffer, and call
strncpy_s( wszStringBuffer, ???, wszSourceBuffer, dwCopyBytes)
What value of the second parameter you should use?
Finally, I use (BUFFER_SIZE - 5). I didn't investigate the detail.
you can use _countof() macro instead of BUFFER_SIZE as your 2nd parameter.
However, you can not use pointer in _countof() macro.
The following usages are illegal:
_countof ( pPointerToArray )
_countof ( wszStringBuffer )