update for HEAD-2003091401
[reactos.git] / lib / msvcrt / stdio / wtempnam.c
1 #include <windows.h>
2 #include <msvcrt/stdio.h>
3 #include <msvcrt/stdlib.h>
4
5
6 /*
7  * @implemented
8  */
9 wchar_t* _wtempnam(const wchar_t* dir, const wchar_t* prefix)
10 {
11     wchar_t* TempFileName = malloc(MAX_PATH);
12     wchar_t* d;
13
14     if (dir == NULL)
15         d = _wgetenv(L"TMP");
16     else
17         d = (wchar_t*)dir;
18
19     if (GetTempFileNameW(d, prefix, 1, TempFileName) == 0) {
20         free(TempFileName);
21         return NULL;
22     }
23
24     return TempFileName;
25 }