| 312 | } |
| 313 | |
| 314 | static LPCSTR DuplicateString(_In_ LPCSTR pszIn) |
| 315 | { |
| 316 | if (pszIn == NULL) { |
| 317 | return NULL; |
| 318 | } |
| 319 | |
| 320 | size_t cch; |
| 321 | HRESULT hr = StringCchLengthA(pszIn, 8192, &cch); |
| 322 | if (FAILED(hr)) { |
| 323 | SetLastError(ERROR_INVALID_PARAMETER); |
| 324 | return NULL; |
| 325 | } |
| 326 | |
| 327 | PCHAR pszOut = new NOTHROW CHAR [cch + 1]; |
| 328 | if (pszOut == NULL) { |
| 329 | SetLastError(ERROR_OUTOFMEMORY); |
| 330 | return NULL; |
| 331 | } |
| 332 | |
| 333 | hr = StringCchCopyA(pszOut, cch + 1, pszIn); |
| 334 | if (FAILED(hr)) { |
| 335 | delete[] pszOut; |
| 336 | return NULL; |
| 337 | } |
| 338 | |
| 339 | return pszOut; |
| 340 | } |
| 341 | |
| 342 | static VOID ReleaseString(_In_opt_ LPCSTR psz) |
| 343 | { |
no test coverage detected
searching dependent graphs…