CFtpServer::GetClientHomeDirectory Method  
 
INT GetClientHomeDirectory(
  UINT nClientId,  
  LPTSTR lpszDirectory,  
  INT nMaxLength  
);
INT GetClientHomeDirectory(
  UINT nClientId,  
  CString& strDirectory  
);

Returns the home directory for the specified client session.

Parameters

nClientId
An unsigned integer which uniquely identifies the client session.
lpszDirectory
A pointer to a string buffer that will contain the home directory for the specified client session, terminated with a null character. This buffer should be at least MAX_PATH characters in length. This parameter cannot be NULL. An alternate version of this method accepts a CString object if it is available.
nMaxLength
An integer value that specifies the maximum number of characters that can be copied into the string buffer, including the terminating null character. This value must be larger than zero or the method will fail.

Return Value

If the method succeeds, the return value is the number of characters copied into the string buffer, not including the terminating null character. If the client ID does not specify a valid client session, the method will return zero.

Remarks

This method returns the full path to the home working directory assigned to the specified client session. This will be the same path to the home directory specified when the AuthenticateClient method was used to authenticate the client session. If a home directory was not explicitly assigned when the client was authenticated, then this method returns the default home directory that was created for the client, or the server root directory if the FTP_SERVER_MULTIUSER option was not specified when the server was started.

This method should only be used with client sessions that have been authenticated. Unauthenticated clients are not assigned a home directory and this method will return zero, with the last error code set to ST_ERROR_AUTHENTICATION_REQUIRED.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header File: cstools10.h
Import Library: csftsv10.lib
Unicode: Implemented as Unicode and ANSI versions.

See Also

AuthenticateClient, ChangeClientDirectory, GetClientDirectory, GetClientVirtualPath