2 * Selector manipulation functions
4 * Copyright 1993 Robert J. Amstadt
5 * Copyright 1995 Alexandre Julliard
19 /* #define DEBUG_SELECTORS */
23 #define MAX_ENV_SIZE 16384 /* Max. environment size (ought to be dynamic) */
25 static HANDLE EnvironmentHandle
= 0;
28 extern char WindowsPath
[256];
30 extern char **environ
;
34 WNDPROC
GetWndProcEntry16( char *name
)
37 static HMODULE hModule
= 0;
39 if (!hModule
) hModule
= GetModuleHandle( "WINPROCS" );
40 ordinal
= MODULE_GetOrdinal( hModule
, name
);
41 return MODULE_GetEntryPoint( hModule
, ordinal
);
45 /***********************************************************************
46 * GetDOSEnvironment (KERNEL.131)
48 SEGPTR
GetDOSEnvironment(void)
50 return WIN16_GlobalLock( EnvironmentHandle
);
54 /**********************************************************************
57 static HANDLE
CreateEnvironment(void)
63 handle
= GlobalAlloc( GMEM_MOVEABLE
, MAX_ENV_SIZE
);
64 if (!handle
) return 0;
65 p
= (char *) GlobalLock( handle
);
68 * Fill environment with Windows path, the Unix environment,
72 strcat(p
, WindowsPath
);
75 for (e
= environ
; *e
; e
++)
77 if (strncasecmp(*e
, "path", 4))
89 p
= (char *) GlobalLock( handle
);
90 dprintf_selectors(stddeb
, "Environment at %p\n", p
);
91 for (; *p
; p
+= strlen(p
) + 1) dprintf_selectors(stddeb
, " %s\n", p
);
98 /**********************************************************************
101 void CreateSelectors(void)
103 if(!EnvironmentHandle
) EnvironmentHandle
= CreateEnvironment();
107 #endif /* ifndef WINELIB */