3e405db10e5255fad972815ce634af8b91077167
[reactos.git] / lib / msvcrt / stdlib / wsenv.c
1 #include <windows.h>
2 #include <msvcrt/stdlib.h>
3 #include <msvcrt/string.h>
4
5 #define NDEBUG
6 #include <msvcrt/msvcrtdbg.h>
7
8
9 /*
10  * @implemented
11  */
12 void _wsearchenv(const wchar_t* file,const wchar_t* var,wchar_t* path)
13 {
14     wchar_t* env = _wgetenv(var);
15     wchar_t* x;
16     wchar_t* y;
17     wchar_t* FilePart;
18
19     DPRINT("_wsearchenv()\n");
20     x = wcschr(env,L'=');
21     if ( x != NULL ) {
22         *x = 0;
23         x++;
24     }
25     y = wcschr(env,L';');
26     while ( y != NULL ) {
27         *y = 0;
28         if ( SearchPathW(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
29             return;
30         }
31         x = y+1;
32         y = wcschr(env,L';');
33     }
34     return;
35 }