24fe949ebbad6fe36902a0946f4c9ac18133ba12
[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 void _wsearchenv(const wchar_t* file,const wchar_t* var,wchar_t* path)
10 {
11     wchar_t* env = _wgetenv(var);
12     wchar_t* x;
13     wchar_t* y;
14     wchar_t* FilePart;
15
16     DPRINT("_wsearchenv()\n");
17     x = wcschr(env,L'=');
18     if ( x != NULL ) {
19         *x = 0;
20         x++;
21     }
22     y = wcschr(env,L';');
23     while ( y != NULL ) {
24         *y = 0;
25         if ( SearchPathW(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
26             return;
27         }
28         x = y+1;
29         y = wcschr(env,L';');
30     }
31     return;
32 }