* environ.cc (_addenv): malloc space for setenv if cygwin1.dll is used in
conjunction with older binaries. (environ_init): Ditto. * external.cc (get_cygdrive_info): New function. * external.cc (get_cygdrive_prefixes): Change to use get_cygdrive_info but toss the user and system flags. * external.cc (cygwin_internal): Add new CW_GET_CYGDRIVE_INFO case. * path.cc (mount_info::get_cygdrive_prefixes): Remove method. * path.cc (mount_info::get_cygdrive_info): New method. Actually, get_cygdrive_info is really an enhanced version of get_cygdrive_prefixes renamed to get_cygdrive_info that also gets the user and system flags. * shared_info.h (get_cygdrive_prefixes): Remove method. * shared_info.h (get_cygdrive_info): New method. * include/cygwin/version.h: Bump minor API version due to adding CW_GET_CYGDRIVE_INFO to cygwin_internal. * include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GET_CYGDRIVE_INFO.
This commit is contained in:
@ -1623,12 +1623,20 @@ mount_info::remove_cygdrive_info_from_registry (const char *cygdrive_prefix, uns
|
||||
}
|
||||
|
||||
int
|
||||
mount_info::get_cygdrive_prefixes (char *user, char *system)
|
||||
mount_info::get_cygdrive_info (char *user, char *system, char* user_flags,
|
||||
char* system_flags)
|
||||
{
|
||||
/* Get the user path prefix from HKEY_CURRENT_USER. */
|
||||
reg_key r;
|
||||
int res = r.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, user, MAX_PATH, "");
|
||||
|
||||
/* Get the user flags, if appropriate */
|
||||
if (res == ERROR_SUCCESS)
|
||||
{
|
||||
int flags = r.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO);
|
||||
strcpy (user_flags, (flags & MOUNT_BINARY) ? "binmode" : "textmode");
|
||||
}
|
||||
|
||||
/* Get the system path prefix from HKEY_LOCAL_MACHINE. */
|
||||
reg_key r2 (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE",
|
||||
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
|
||||
@ -1637,6 +1645,13 @@ mount_info::get_cygdrive_prefixes (char *user, char *system)
|
||||
NULL);
|
||||
int res2 = r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX, system, MAX_PATH, "");
|
||||
|
||||
/* Get the system flags, if appropriate */
|
||||
if (res2 == ERROR_SUCCESS)
|
||||
{
|
||||
int flags = r2.get_int (CYGWIN_INFO_CYGDRIVE_FLAGS, MOUNT_AUTO);
|
||||
strcpy (system_flags, (flags & MOUNT_BINARY) ? "binmode" : "textmode");
|
||||
}
|
||||
|
||||
return (res != ERROR_SUCCESS) ? res : res2;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user