Use free Windows DDK and compile with latest MinGW releases.
[reactos.git] / reactos / lib / msvcrt / stdlib / senv.c
1 #include <msvcrti.h>
2
3 #define NDEBUG
4 #include <msvcrtdbg.h>
5
6
7 void _searchenv(const char *file,const char *var,char *path )
8 {
9 char *env = getenv(var);
10 char *x;
11 char *y;
12 char *FilePart;
13
14 DPRINT("_searchenv()\n");
15 x = strchr(env,'=');
16 if ( x != NULL ) {
17 *x = 0;
18 x++;
19 }
20 y = strchr(env,';');
21 while ( y != NULL ) {
22 *y = 0;
23 if ( SearchPathA(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
24 return;
25 }
26 x = y+1;
27 y = strchr(env,';');
28 }
29 return;
30 }
31
32 void _wsearchenv(const wchar_t *file,const wchar_t *var,wchar_t *path)
33 {
34 wchar_t *env = _wgetenv(var);
35 wchar_t *x;
36 wchar_t *y;
37 wchar_t *FilePart;
38
39 DPRINT("_searchenw()\n");
40 x = wcschr(env,L'=');
41 if ( x != NULL ) {
42 *x = 0;
43 x++;
44 }
45 y = wcschr(env,L';');
46 while ( y != NULL ) {
47 *y = 0;
48 if ( SearchPathW(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) {
49 return;
50 }
51 x = y+1;
52 y = wcschr(env,L';');
53 }
54 return;
55 }