| 69 | } |
| 70 | |
| 71 | static bool Alloc(OUT STRING_INFO* StringInfo, size_t Characters) { |
| 72 | if (!StringInfo || !Characters) return false; |
| 73 | *StringInfo = {}; |
| 74 | size_t Size = (Characters + 1) * sizeof(TChar); // Null-terminated buffer |
| 75 | Size = ((Size / AllocationGranularity) + 1) * AllocationGranularity; |
| 76 | TChar* Buffer = StrAllocMem(Size); |
| 77 | if (!Buffer) return false; |
| 78 | Buffer[0] = NullChar; |
| 79 | Buffer[Characters] = NullChar; |
| 80 | StringInfo->Buffer = Buffer; |
| 81 | StringInfo->Length = Characters; |
| 82 | StringInfo->BufferSize = Size; |
| 83 | StringInfo->SsoUsing = FALSE; |
| 84 | return true; |
| 85 | } |
| 86 | |
| 87 | static VOID Free(IN OUT STRING_INFO* StringInfo) { |
| 88 | if (StringInfo && StringInfo->Buffer && !StringInfo->SsoUsing) { |
nothing calls this directly
no outgoing calls
no test coverage detected