Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente | |||
prog:lazarus:cas:files:createfile [08/05/2021 14:51] thierry [dwFlagsAndAttributes] |
prog:lazarus:cas:files:createfile [08/05/2021 15:00] (Version actuelle) thierry [dwFlagsAndAttributes] |
||
---|---|---|---|
Ligne 62: | Ligne 62: | ||
* ''TRUNCATE_EXISTING'' ($5) : Opens a file and truncates it so that its size is zero bytes, only if it exists.\\ If the specified file does not exist, the function fails and the last-error code is set to ERROR_FILE_NOT_FOUND (2).\\ The calling process must open the file with the ''GENERIC_WRITE'' bit set as part of the ''dwDesiredAccess'' parameter. | * ''TRUNCATE_EXISTING'' ($5) : Opens a file and truncates it so that its size is zero bytes, only if it exists.\\ If the specified file does not exist, the function fails and the last-error code is set to ERROR_FILE_NOT_FOUND (2).\\ The calling process must open the file with the ''GENERIC_WRITE'' bit set as part of the ''dwDesiredAccess'' parameter. | ||
== dwFlagsAndAttributes == | == dwFlagsAndAttributes == | ||
- | * ''FILE_ATTRIBUTE_ARCHIVE'' (32/$20) : The file should be archived. Applications use this attribute to mark files for backup or removal. | + | * ''FILE_ATTRIBUTE_ARCHIVE'' (32/$20) : The file should be archived. Applications use this attribute to mark files for backup or removal.\\ . |
* ''FILE_ATTRIBUTE_ENCRYPTED'' (16384/$4000) : The file or directory is encrypted. For a file, this means that all data in the file is encrypted. For a directory, this means that encryption is the default for newly created files and subdirectories. For more information, see File Encryption.\\ This flag has no effect if ''FILE_ATTRIBUTE_SYSTEM'' is also specified.\\ This flag is not supported on Home, Home Premium, Starter, or ARM editions of Windows. | * ''FILE_ATTRIBUTE_ENCRYPTED'' (16384/$4000) : The file or directory is encrypted. For a file, this means that all data in the file is encrypted. For a directory, this means that encryption is the default for newly created files and subdirectories. For more information, see File Encryption.\\ This flag has no effect if ''FILE_ATTRIBUTE_SYSTEM'' is also specified.\\ This flag is not supported on Home, Home Premium, Starter, or ARM editions of Windows. | ||
* ''FILE_ATTRIBUTE_HIDDEN'' ($2) : The file is hidden. Do not include it in an ordinary directory listing. | * ''FILE_ATTRIBUTE_HIDDEN'' ($2) : The file is hidden. Do not include it in an ordinary directory listing. | ||
Ligne 70: | Ligne 70: | ||
* ''FILE_ATTRIBUTE_SYSTEM'' ($4) : The file is part of or used exclusively by an operating system. | * ''FILE_ATTRIBUTE_SYSTEM'' ($4) : The file is part of or used exclusively by an operating system. | ||
* ''FILE_ATTRIBUTE_TEMPORARY'' (256/$100) : The file is being used for temporary storage.\\ For more information, see the Caching Behavior section of this topic. | * ''FILE_ATTRIBUTE_TEMPORARY'' (256/$100) : The file is being used for temporary storage.\\ For more information, see the Caching Behavior section of this topic. | ||
- | * ''FILE_FLAG_BACKUP_SEMANTICS'' ($200 0000) : The file is being opened or created for a backup or restore operation. The system ensures that the calling process overrides file security checks when the process has ''SE_BACKUP_NAME'' and ''SE_RESTORE_NAME'' privileges. For more information, see Changing Privileges in a Token.\\ You must set this flag to obtain a handle to a directory. A directory handle can be passed to some functions instead of a file handle. For more information, see the Remarks section. | + | * ''FILE_FLAG_BACKUP_SEMANTICS'' ($200 0000) : Le fichier va être ouvert ou créé pour une opération de sauvegarde ou de restauration.\\ Le système veille à ce que le processus appelant passe outre les contrôles de sécurité des fichiers lorsque le processus dispose des privilèges ''SE_BACKUP_NAME'' et ''SE_RESTORE_NAME''.\\ Pour plus d'informations, voir Modification des privilèges dans un jeton.\\ Vous devez définir cet indicateur pour obtenir un identifiant pour un répertoire.\\ Un identifiant de répertoire peut être transmis à certaines fonctions à la place d'un identifiant de fichier. \\ Pour plus d'informations, [[https://docs.microsoft.com/fr-fr/windows/win32/api/fileapi/nf-fileapi-createfilea#remarks|consultez la section Remarques]]. |
* ''FILE_FLAG_DELETE_ON_CLOSE'' ($400 0000) : The file is to be deleted immediately after all of its handles are closed, which includes the specified handle and any other open or duplicated handles.\\ If there are existing open handles to a file, the call fails unless they were all opened with the ''FILE_SHARE_DELETE'' share mode.\\ Subsequent open requests for the file fail, unless the FILE_SHARE_DELETE share mode is specified. | * ''FILE_FLAG_DELETE_ON_CLOSE'' ($400 0000) : The file is to be deleted immediately after all of its handles are closed, which includes the specified handle and any other open or duplicated handles.\\ If there are existing open handles to a file, the call fails unless they were all opened with the ''FILE_SHARE_DELETE'' share mode.\\ Subsequent open requests for the file fail, unless the FILE_SHARE_DELETE share mode is specified. | ||
* ''FILE_FLAG_NO_BUFFERING'' ($2000 0000) : The file or device is being opened with no system caching for data reads and writes. This flag does not affect hard disk caching or memory mapped files.\\ There are strict requirements for successfully working with files opened with CreateFile using the ''FILE_FLAG_NO_BUFFERING'' flag, for details see File Buffering. | * ''FILE_FLAG_NO_BUFFERING'' ($2000 0000) : The file or device is being opened with no system caching for data reads and writes. This flag does not affect hard disk caching or memory mapped files.\\ There are strict requirements for successfully working with files opened with CreateFile using the ''FILE_FLAG_NO_BUFFERING'' flag, for details see File Buffering. | ||
* ''FILE_FLAG_OPEN_NO_RECALL'' ($10 0000) : The file data is requested, but it should continue to be located in remote storage. It should not be transported back to local storage. This flag is for use by remote storage systems. | * ''FILE_FLAG_OPEN_NO_RECALL'' ($10 0000) : The file data is requested, but it should continue to be located in remote storage. It should not be transported back to local storage. This flag is for use by remote storage systems. | ||
* ''FILE_FLAG_OPEN_REPARSE_POINT'' ($20 0000) : Normal reparse point processing will not occur; CreateFile will attempt to open the reparse point. When a file is opened, a file handle is returned, whether or not the filter that controls the reparse point is operational.\\ This flag cannot be used with the ''CREATE_ALWAYS'' flag.\\ If the file is not a reparse point, then this flag is ignored. | * ''FILE_FLAG_OPEN_REPARSE_POINT'' ($20 0000) : Normal reparse point processing will not occur; CreateFile will attempt to open the reparse point. When a file is opened, a file handle is returned, whether or not the filter that controls the reparse point is operational.\\ This flag cannot be used with the ''CREATE_ALWAYS'' flag.\\ If the file is not a reparse point, then this flag is ignored. | ||
- | * ''FILE_FLAG_OVERLAPPED'' ($4000 0000) : The file or device is being opened or created for asynchronous I/O.\\ When subsequent I/O operations are completed on this handle, the event specified in the OVERLAPPED structure will be set to the signaled state.\\ If this flag is specified, the file can be used for simultaneous read and write operations.\\ If this flag is not specified, then I/O operations are serialized, even if the calls to the read and write functions specify an OVERLAPPED structure.\\For information about considerations when using a file handle created with this flag, see the Synchronous and Asynchronous I/O Handles section of this topic. | + | * ''FILE_FLAG_OVERLAPPED'' ($4000 0000) : Le fichier ou le périphérique est en train d'être ouvert ou créé pour des E/S asynchrones.\\ Lorsque les opérations d'E/S suivantes sont terminées sur ce handle, l'événement spécifié dans la structure OVERLAPPED sera mis à l'état signalé.\\ Si cet indicateur est spécifié, le fichier peut être utilisé pour des opérations de lecture et d'écriture simultanées.\\ Si cet indicateur n'est pas spécifié, les opérations d'E/S sont sérialisées, même si les appels aux fonctions de lecture et d'écriture spécifient une structure OVERLAPPED.\\ Pour plus d'informations sur les considérations relatives à l'utilisation d'un handle de fichier créé avec cet indicateur, reportez-vous à la section Manipulations d'E/S synchrones et asynchrones de cette rubrique. |
* ''FILE_FLAG_POSIX_SEMANTICS'' ($100 0000) : Access will occur according to POSIX rules. This includes allowing multiple files with names, differing only in case, for file systems that support that naming. Use care when using this option, because files created with this flag may not be accessible by applications that are written for MS-DOS or 16-bit Windows. | * ''FILE_FLAG_POSIX_SEMANTICS'' ($100 0000) : Access will occur according to POSIX rules. This includes allowing multiple files with names, differing only in case, for file systems that support that naming. Use care when using this option, because files created with this flag may not be accessible by applications that are written for MS-DOS or 16-bit Windows. | ||
* ''FILE_FLAG_RANDOM_ACCESS'' ($1000 0000) : Access is intended to be random. The system can use this as a hint to optimize file caching.\\ This flag has no effect if the file system does not support cached I/O and FILE_FLAG_NO_BUFFERING.\\ For more information, see the Caching Behavior section of this topic. | * ''FILE_FLAG_RANDOM_ACCESS'' ($1000 0000) : Access is intended to be random. The system can use this as a hint to optimize file caching.\\ This flag has no effect if the file system does not support cached I/O and FILE_FLAG_NO_BUFFERING.\\ For more information, see the Caching Behavior section of this topic. | ||
* ''FILE_FLAG_SESSION_AWARE'' ($80 0000) : The file or device is being opened with session awareness. If this flag is not specified, then per-session devices (such as a device using RemoteFX USB Redirection) cannot be opened by processes running in session 0. This flag has no effect for callers not in session 0. This flag is supported only on server editions of Windows.\\ Windows Server 2008 R2 and Windows Server 2008: This flag is not supported before Windows Server 2012. | * ''FILE_FLAG_SESSION_AWARE'' ($80 0000) : The file or device is being opened with session awareness. If this flag is not specified, then per-session devices (such as a device using RemoteFX USB Redirection) cannot be opened by processes running in session 0. This flag has no effect for callers not in session 0. This flag is supported only on server editions of Windows.\\ Windows Server 2008 R2 and Windows Server 2008: This flag is not supported before Windows Server 2012. | ||
- | * ''FILE_FLAG_SEQUENTIAL_SCAN'' ($800 0000) : Access is intended to be sequential from beginning to end. The system can use this as a hint to optimize file caching. | + | * ''FILE_FLAG_SEQUENTIAL_SCAN'' ($800 0000) : Access is intended to be sequential from beginning to end. The system can use this as a hint to optimize file caching.\\ This flag should not be used if read-behind (that is, reverse scans) will be used.\\ This flag has no effect if the file system does not support cached I/O and ''FILE_FLAG_NO_BUFFERING''.\\ For more information, see the Caching Behavior section of this topic. |
- | This flag should not be used if read-behind (that is, reverse scans) will be used.\\ This flag has no effect if the file system does not support cached I/O and ''FILE_FLAG_NO_BUFFERING''.\\ For more information, see the Caching Behavior section of this topic. | + | |
* ''FILE_FLAG_WRITE_THROUGH'' ($8000 0000) : Write operations will not go through any intermediate cache, they will go directly to disk.\\ For additional information, see the Caching Behavior section of this topic. | * ''FILE_FLAG_WRITE_THROUGH'' ($8000 0000) : Write operations will not go through any intermediate cache, they will go directly to disk.\\ For additional information, see the Caching Behavior section of this topic. | ||
* ''SECURITY_ANONYMOUS'' : Impersonates a client at the Anonymous impersonation level. | * ''SECURITY_ANONYMOUS'' : Impersonates a client at the Anonymous impersonation level. |