Funzione NtQueryInformationByName (ntifs.h)

NtQueryInformationByName restituisce le informazioni richieste su un file specificato dal nome del file.

Sintassi

__kernel_entry NTSYSCALLAPI NTSTATUS NtQueryInformationByName(
  [in]  POBJECT_ATTRIBUTES     ObjectAttributes,
  [out] PIO_STATUS_BLOCK       IoStatusBlock,
  [out] PVOID                  FileInformation,
  [in]  ULONG                  Length,
  [in]  FILE_INFORMATION_CLASS FileInformationClass
);

Parametri

[in] ObjectAttributes

Puntatore a una struttura OBJECT_ATTRIBUTES contenente gli attributi del file, incluso il nome del file.

[out] IoStatusBlock

Puntatore una struttura IO_STATUS_BLOCK contenente lo stato di I/O del chiamante.

[out] FileInformation

Puntatore al buffer fornito dal chiamante in cui restituire le informazioni richieste sul file. La struttura del buffer è determinata dal parametro FileInformationClass .

[in] Length

Lunghezza, in byte, del buffer a cui Punta FileInformation .

[in] FileInformationClass

Valore FILE_INFORMATION_CLASS che identifica il tipo di informazioni sui file da restituire nel buffer a cui punta FileInformation . FileInformationClass può essere uno dei valori seguenti.

valore FILE_INFORMATION_CLASS Tipo di informazioni da restituire
FileStatInformation (68) FILE_STAT_INFORMATION. Disponibile a partire da Windows 10 versione 1709.
FileStatLxInformation (70) FILE_STAT_LX_INFORMATION. Disponibile a partire da Windows 10 aggiornamento di aprile 2018.
FileCaseSensitiveInformation (71) FILE_CASE_SENSITIVE_INFORMATION. Disponibile a partire da Windows 10 aggiornamento di aprile 2018.
FileStatBasicInformation (77) FILE_STAT_BASIC_INFORMATION. Disponibile a partire da Windows 11, build 26048.

Valore restituito

NtQueryInformationByName restituisce STATUS_SUCCESS al completamento positivo; in caso contrario, restituisce un codice di errore, ad esempio uno dei seguenti.

Codice di errore Significato
STATUS_INVALID_PARAMETER Il parametro FileInformationClass contiene un valore non valido.
STATUS_INFO_LENGTH_MISMATCH Le dimensioni del buffer specificate da Length non sono sufficienti per contenere le informazioni richieste.

Commenti

Query NtQueryInformationByName e restituisce le informazioni richieste sul file. Lo fa senza aprire il file effettivo, rendendolo più efficiente di NtQueryInformationFile, che richiede un file aperto (e una chiusura del file successiva).

I chiamanti di NtQueryInformationByName devono essere eseguiti in IRQL = PASSIVE_LEVEL e con API kernel speciali abilitate.

Requisiti

Requisito Valore
Client minimo supportato Windows 10 versione 1703
Intestazione ntifs.h
Libreria NtosKrnl.lib
DLL NtosKrnl.exe
IRQL PASSIVE_LEVEL (vedere la sezione Osservazioni)

Vedi anche

FILE_CASE_SENSITIVE_INFORMATION

FILE_INFORMATION_CLASS

FILE_STAT_INFORMATION

FILE_STAT_LX_INFORMATION

IO_STATUS_BLOCK

NtQueryInformationFile

OBJECT_ATTRIBUTES