If the current working directory was changed, the
return value is non-zero. If the server handle and client ID do not
specify a valid client session, or the directory is invalid, this
function will return zero.
The FtpChangeClientDirectory function will change the
current working directory for the specified client session. This
function is called internally when the client sends the CWD or CDUP
commands, however it may be explicitly used by the application to
change the client's working directory in response to a server event.
This function cannot be used to change the current working
directory for a client to an arbitrary directory outside of the server
root directory. If the lpszDirectory parameter specifies a
relative path (i.e.: a path that does not begin with a drive letter
or leading path delimiter) then the new working directory will be
relative to the current working directory. If an absolute path is
specified, the absolute path must include the complete path to either
the server root directory or the user's home directory, based on the
permissions granted to the client session. If a path outside of the
server root directory is specified, this function will fail with an
access denied error.
Use caution when calling this function to override the directory
specified by the client when it sends the CWD or CDUP commands. If
your application changes the current working directory to one not specified by
the client, it may cause unpredictable behavior in the client
application because the actual path of the current working directory
will not match the directory that was requested.
If this function is used to change the current working directory in
response to the CWD command, you should not call the FtpGetCommandParam
function and pass the command parameter as an argument to this function.
You must use the FtpGetCommandFile function to obtain the directory
name provided by the client prior to calling this function.
The application should never call the SetCurrentDirectory
function in the Windows API to change the current directory for the
process to the working directory of a client session. Because the server is
multithreaded and each client session is managed in its own thread, an
application using this library should avoid using relative paths.