imap/src/osdep/nt/env_nt.c
/* Return Windows home directory
 * Accepts: user name
 * Returns: home directory
 */
Return Windows home directory
Accepts: user name
Returns: home directory
Return Windows home directory Accepts : user name Returns : home directory
char *win_homedir (char *user)
{
  char *s,*t,tmp[MAILTMPLEN];
  PUSER_INFO_1 ui;
  if (!check_nt ()) sprintf (tmp,"%s\\My Documents",defaultDrive ());
  else if ((netapi || (netapi = LoadLibrary ("netapi32.dll"))) &&
	   (getinfo ||
	    (getinfo = (GETINFO) GetProcAddress (netapi,"NetUserGetInfo"))) &&
	   MultiByteToWideChar (CP_ACP,0,user,strlen (user) + 1,
				(WCHAR *) tmp,MAILTMPLEN) &&
	   !(*getinfo) (NIL,(LPWSTR) &tmp,1,(LPBYTE *) &ui) &&
	   WideCharToMultiByte (CP_ACP,0,ui->usri1_home_dir,-1,
				tmp,MAILTMPLEN,NIL,NIL) && tmp[0]) {
    if ((*(s = tmp + strlen (tmp) - 1) == '\\') || (*s == '/')) *s = '\0';
  }
  else if ((s = getenv ("USERPROFILE")) && (t = strrchr (s,'\\'))) {      
    strncpy (tmp,s,t-s);	
    sprintf (tmp+(t-s),"\\%.100s\\My Documents",user);
  }
  else sprintf (tmp,"%s\\users\\default",defaultDrive ());
  return cpystr (tmp);
}
char * win_homedir ( char * user ) { char * s , * t , tmp [ MAILTMPLEN ] ; PUSER_INFO_1 ui ; if ( ! check_nt ( ) ) sprintf ( tmp , " \\ " , defaultDrive ( ) ) ; else if ( ( netapi || ( netapi = LoadLibrary ( " " ) ) ) && ( getinfo || ( getinfo = ( GETINFO ) GetProcAddress ( netapi , " " ) ) ) && MultiByteToWideChar ( CP_ACP , 0 , user , strlen ( user ) + 1 , ( WCHAR * ) tmp , MAILTMPLEN ) && ! ( * getinfo ) ( NIL , ( LPWSTR ) & tmp , 1 , ( LPBYTE * ) & ui ) && WideCharToMultiByte ( CP_ACP , 0 , ui -> usri1_home_dir , -1 , tmp , MAILTMPLEN , NIL , NIL ) && tmp [ 0 ] ) { if ( ( * ( s = tmp + strlen ( tmp ) - 1 ) == ' \\ ' ) || ( * s == ' ' ) ) * s = ' \0 ' ; } else if ( ( s = getenv ( " " ) ) && ( t = strrchr ( s , ' \\ ' ) ) ) { strncpy ( tmp , s , t - s ) ; sprintf ( tmp + ( t - s ) , " \\ \\ " , user ) ; } else sprintf ( tmp , " \\ \\ " , defaultDrive ( ) ) ; return cpystr ( tmp ) ; }
Return Windows home directory
 Accepts: user name
 Returns: home directory
Return Windows home directory Accepts : user name Returns : home directory
/* Win9x default */ /* get from user info on NT */ /* make sure doesn't end with delimiter */ /* no home dir, found Win2K user profile? */ /* copy up to user name */ /* last resort NT default */