Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Linux: Implement prefix-counted BSTR allocation in SysAllocStringLen (#…
…3250) While this prefix may be an implementation detail the BSTR type guarantees to be able to store NULL values without accidentally truncating the string, hence its length must be available to replace the usual NULL terminator. This string length in bytes is stored in the four bytes preceding a BSTR pointer [1], whose value can be retrieved using SysStringLen. This commit implements the type in the same way in WinAdapter such that users of the functions returning a BSTR (currently only in dxcisense) can expect and use the type in the same way on Linux as they would on Windows. While this function and type currently only seem to be involved in names and logging where NULLs are unlikely, it is good practice to mirror the Windows type exactly for future-proofing. Besides, SysAllocStringLen does not specify anything about taking ownership of strIn so the realloc here is wrong either way. [1]: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/automat/bstr
- Loading branch information