| |
| INT WINAPI FtpSetFilePermissions(
|
| |
HCLIENT hClient, |
|
| |
LPCTSTR lpszFileName, |
|
| |
DWORD dwPermissions |
|
| );
|
The FtpSetFilePermissions function returns information
about the access permissions for a specific file on the server.
Parameters
- hClient
- Handle to the client session.
- lpszFileName
- A pointer to a string which contains the name of the file to be
updated. The filename cannot contain any wildcard characters.
- dwPermissions
- An unsigned long integer which will specify the new access
permissions for the file. The file permissions are represented as
bit flags, and may be one or more of the following values combined
with a bitwise Or operator:
| Constant |
Description |
| FILE_OWNER_READ |
The owner has permission to open the file for reading. If the
current user is the owner of the file, this grants the user the
right to download the file to the local system. |
| FILE_OWNER_WRITE |
The owner has permission to open the file for writing. If the
current user is the owner of the file, this grants the user the
right to replace the file. If this permission is set for a
directory, this grants the user the right to create and delete
files. |
| FILE_OWNER_EXECUTE |
The owner has permission to execute the contents of the file.
The file is typically either a binary executable, script or batch
file. If this permission is set for a directory, this may also
grant the user the right to open that directory and search for
files in that directory. |
| FILE_GROUP_READ |
Users in the specified group have permission to open the file
for reading. If the current user is in the same group as the file
owner, this grants the user the right to download the file. |
| FILE_GROUP_WRITE |
Users in the specified group have permission to open the file
for writing. On some platforms, this may also imply permission to
delete the file. If the current user is in the same group as the
file owner, this grants the user the right to replace the file. If
this permission is set for a directory, this grants the user the
right to create and delete files. |
| FILE_GROUP_EXECUTE |
Users in the specified group have permission to execute the
contents of the file. If this permission is set for a directory,
this may also grant the user the right to open that directory and
search for files in that directory. |
| FILE_WORLD_READ |
All users have permission to open the file for reading. This
permission grants any user the right to download the file to the
local system. |
| FILE_WORLD_WRITE |
All users have permission to open the file for writing. This
permission grants any user the right to replace the file. If this
permission is set for a directory, this grants any user the right
to create and delete files. |
| FILE_WORLD_EXECUTE |
All users have permission to execute the contents of the file.
If this permission is set for a directory, this may also grant all
users the right to open that directory and search for files in that
directory. |
Return Value
If the function succeeds, the return value is a result code. If
the function fails, the return value is FTP_ERROR. To get extended
error information, call FtpGetLastError.
Remarks
This function uses the SITE CHMOD command to set the permissions
for the file. This command is typically only supported on servers
that are hosted on UNIX based systems. If the command is not
supported, an error will be returned.
Users who are familiar with the UNIX operating system will
recognize the chmod command used to change the file
permissions. However, it should be noted that the numeric value
used as an argument to the command is in octal, not decimal. For
example, issuing the command chmod 644 filename.txt on a
UNIX based system will make the file readable and writable by the
owner, and readable by other users in the owner's group as well as
all other users. The value 644 is an octal value, which is
equivalent to the decimal value 420. If you were to mistakenly
specify 644 as the value for the dwPermissions parameter,
rather than the decimal value of 420, the permissions on the file
would be incorrect. It is strongly recommended that you use the
pre-defined constants to prevent this sort of error.
Requirements
Client: Requires Windows 7, Windows Vista or Windows
XP.
Server: Requires Windows Server 2008 or Windows Server
2003.
Header: Include cstools7.h.
Library: Use csftpav7.lib.
Unicode: Implemented as Unicode and ANSI versions.
See Also
FtpGetFilePermissions,
FtpGetFileStatus
|
|