MCPcopy Create free account
hub / github.com/acl-dev/acl / DuplicateString

Function DuplicateString

lib_fiber/cpp/src/detours/image.cpp:314–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314static 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
342static VOID ReleaseString(_In_opt_ LPCSTR psz)
343{

Callers 3

ReadMethod · 0.85
NewBywayMethod · 0.85
EditImportsMethod · 0.85

Calls 1

StringCchCopyAFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…