chsvlib
chsv helper source code

◆ AllocateUniqueTempFileNameW()

wchar_t* Chusov::String::AllocateUniqueTempFileNameW ( const wchar_t *  lpszExtension)
noexcept

Allocates and returns an absolute a unique file name based on UUID and that is to be located in the system temporary directory.

Parameters
[in]lpszExtensionis an optional string specifying an extension for the file name. If the parameter is NULL the file name is generated without extension.
Returns
On success the function returns an absolute path to a unique file that is to be located in the temporary directory returned by the AllocateTempPathA function. The file itself is not created, but only its name, which is based on UUID is returned. When the returned value is no longer needed, free the returned buffer using the FreeStringW, SecureFreeStringW or any other free function of the chsvmem.h header. If the function fails it returns NULL. Use GetLastChsvError to get extended error information.
Remarks
The string is returned in format "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.lpszExtension" plus the terminating zero as the last wide character.
The function does not try to create file or to check validity of its name.
See also
AllocateTempPathW;
FreeStringW;
AllocateStringW;
AllocateUniqueStringW;
AllocateAndFormatStringW.