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