Condividi tramite


Funzione NtQueryInformationByName (ntifs.h)

NtQueryInformationByName restituisce le informazioni richieste su un file specificato dal nome 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 che contiene gli attributi del file, incluso il nome file.

[out] IoStatusBlock

Puntatore a 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 FileInformation punta.

[in] FileInformationClass

Valore FILE_INFORMATION_CLASS che identifica il tipo di informazioni sul file da restituire nel buffer a cui 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 dall'aggiornamento di Windows 10 di aprile 2018.
FileCaseSensitiveInformation (71) FILE_CASE_SENSITIVE_INFORMATION. Disponibile a partire dall'aggiornamento di Windows 10 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; in caso contrario, restituisce un codice di errore, ad esempio uno dei seguenti.

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

Osservazioni

NtQueryInformationByName query 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 la successiva chiusura del file).

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

Fabbisogno

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)

Vedere anche

FILE_CASE_SENSITIVE_INFORMATION

FILE_INFORMATION_CLASS

FILE_STAT_INFORMATION

FILE_STAT_LX_INFORMATION

IO_STATUS_BLOCK

NtQueryInformationFile

OBJECT_ATTRIBUTES