|
Lines 38-43
RCSID("$Id: bsd-cygwin_util.c,v 1.12 200
Link Here
|
| 38 |
#include <sys/utsname.h> |
38 |
#include <sys/utsname.h> |
| 39 |
#include <sys/vfs.h> |
39 |
#include <sys/vfs.h> |
| 40 |
#include <windows.h> |
40 |
#include <windows.h> |
|
|
41 |
#include "xmalloc.h" |
| 41 |
#define is_winnt (GetVersion() < 0x80000000) |
42 |
#define is_winnt (GetVersion() < 0x80000000) |
| 42 |
|
43 |
|
| 43 |
#define ntsec_on(c) ((c) && strstr((c),"ntsec") && !strstr((c),"nontsec")) |
44 |
#define ntsec_on(c) ((c) && strstr((c),"ntsec") && !strstr((c),"nontsec")) |
|
Lines 96-102
has_capability(int what)
Link Here
|
| 96 |
*/ |
97 |
*/ |
| 97 |
if (!inited) { |
98 |
if (!inited) { |
| 98 |
struct utsname uts; |
99 |
struct utsname uts; |
| 99 |
char *c; |
|
|
| 100 |
|
100 |
|
| 101 |
if (!uname(&uts)) { |
101 |
if (!uname(&uts)) { |
| 102 |
int major_high = 0, major_low = 0, minor = 0; |
102 |
int major_high = 0, major_low = 0, minor = 0; |
|
Lines 234-239
register_9x_service(void)
Link Here
|
| 234 |
GetProcAddress(kerneldll, "RegisterServiceProcess"))) |
234 |
GetProcAddress(kerneldll, "RegisterServiceProcess"))) |
| 235 |
return; |
235 |
return; |
| 236 |
RegisterServiceProcess(0, 1); |
236 |
RegisterServiceProcess(0, 1); |
|
|
237 |
} |
| 238 |
|
| 239 |
#define NL(x) x, (sizeof (x) - 1) |
| 240 |
#define WENV_SIZ (sizeof (wenv_arr) / sizeof (wenv_arr[0])) |
| 241 |
|
| 242 |
static struct wenv { |
| 243 |
const char *name; |
| 244 |
size_t namelen; |
| 245 |
} wenv_arr[] = { |
| 246 |
{ NL("ALLUSERSPROFILE=") }, |
| 247 |
{ NL("COMMONPROGRAMFILES=") }, |
| 248 |
{ NL("COMPUTERNAME=") }, |
| 249 |
{ NL("COMSPEC=") }, |
| 250 |
{ NL("NUMBER_OF_PROCESSORS=") }, |
| 251 |
{ NL("OS=") }, |
| 252 |
{ NL("PATH=") }, |
| 253 |
{ NL("PATHEXT=") }, |
| 254 |
{ NL("PROCESSOR_ARCHITECTURE=") }, |
| 255 |
{ NL("PROCESSOR_IDENTIFIER=") }, |
| 256 |
{ NL("PROCESSOR_LEVEL=") }, |
| 257 |
{ NL("PROCESSOR_REVISION=") }, |
| 258 |
{ NL("PROGRAMFILES=") }, |
| 259 |
{ NL("SYSTEMDRIVE=") }, |
| 260 |
{ NL("SYSTEMROOT=") }, |
| 261 |
{ NL("TMP=") }, |
| 262 |
{ NL("TEMP=") }, |
| 263 |
{ NL("WINDIR=") }, |
| 264 |
}; |
| 265 |
|
| 266 |
char ** |
| 267 |
fetch_windows_environment(void) |
| 268 |
{ |
| 269 |
char **e, **p; |
| 270 |
int i, idx = 0; |
| 271 |
|
| 272 |
p = xmalloc(WENV_SIZ * sizeof(char *)); |
| 273 |
p[idx] = NULL; |
| 274 |
for (e = environ; *e; ++e) { |
| 275 |
for (i = 0; i < WENV_SIZ; ++i) { |
| 276 |
if (!strncmp(*e, wenv_arr[i].name, |
| 277 |
wenv_arr[i].namelen)) { |
| 278 |
p[idx] = *e; |
| 279 |
p[++idx] = NULL; |
| 280 |
} |
| 281 |
} |
| 282 |
} |
| 283 |
return p; |
| 284 |
} |
| 285 |
|
| 286 |
void |
| 287 |
free_windows_environment(char **p) |
| 288 |
{ |
| 289 |
xfree(p); |
| 237 |
} |
290 |
} |
| 238 |
|
291 |
|
| 239 |
#endif /* HAVE_CYGWIN */ |
292 |
#endif /* HAVE_CYGWIN */ |