From 179cae11d7cf4415e1edb906d90105b2921f666d Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 27 Jun 2002 20:44:27 +0000 Subject: * cygheap.cc (cfree_and_set): New function. (cygheap_user::set_name): Use cfree_and_set to reset members. * cygheap.h (cygheap_user): Delete static members. (cygheap_user::puserprof): New member. (cfree_and_set): Declare. * dcrt0.cc (almost_null): Define. * winsup.h (almost_null): Declare. * syscalls.cc (cfree_and_set): Remove unused variable. * uinfo.cc (cygheap_user::homepath_env_buf): Eliminate. (cygheap_user::homedrive_env_buf): Ditto. (cygheap_user::userprofile_env_buf): Ditto. (cygheap_user::ontherange): YA change to try to preserve existing HOMEPATH and HOMEDRIVE. Return almost_null values when variables should not actually exist. (cygheap_user::env_logsrv): Ditto. (cygheap_user::env_domain): Ditto. (cygheap_user::env_userprofile): Ditto. --- winsup/cygwin/cygheap.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'winsup/cygwin/cygheap.h') diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index ff598e548..e2fcaec31 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -104,15 +104,9 @@ class cygheap_user char *homedrive; /* User's home drive */ char *homepath; /* User's home path */ char *winname; /* User's name as far as Windows knows it */ + char *puserprof; /* User profile */ PSID psid; /* buffer for user's SID */ PSID orig_psid; /* Remains intact even after impersonation */ - static char homedrive_env_buf[3]; /* Where the HOMEDRIVE environment variable - info may live. */ - static char homepath_env_buf[MAX_PATH + 1]; /* Where the HOMEPATH environment - variable info may live. */ - static char userprofile_env_buf[MAX_PATH + 1]; /* Where the USERPROFILE - environment variable info - may live. */ public: __uid32_t orig_uid; /* Remains intact even after impersonation */ __gid32_t orig_gid; /* Ditto */ @@ -124,9 +118,17 @@ public: HANDLE token; BOOL impersonated; + /* CGF 2002-06-27. I removed the initializaton from this constructor + since this class is always allocated statically. That means that everything + is zero anyway so there is no need to initialize it to zero. Since the + token initialization is always handled during process startup as well, + I've removed the constructor entirely. Please reinstate this f this + situation ever changes. cygheap_user () : pname (NULL), plogsrv (NULL), pdomain (NULL), - homedrive (NULL), homepath (NULL), - psid (NULL), token (INVALID_HANDLE_VALUE) {} + homedrive (NULL), homepath (NULL), psid (NULL), + token (INVALID_HANDLE_VALUE) {} + */ + ~cygheap_user (); void set_name (const char *new_name); @@ -289,5 +291,6 @@ void *__stdcall crealloc (void *, DWORD) __attribute__ ((regparm(2))); void *__stdcall ccalloc (cygheap_types, DWORD, DWORD) __attribute__ ((regparm(3))); char *__stdcall cstrdup (const char *) __attribute__ ((regparm(1))); char *__stdcall cstrdup1 (const char *) __attribute__ ((regparm(1))); +void __stdcall cfree_and_set (char *&, char * = NULL) __attribute__ ((regparm(2))); void __stdcall cygheap_init (); } -- cgit v1.2.3