> Windows Syscalls
ntoskrnl.exeT1486T1491.001T1106

NtSetVolumeInformationFile

Modifies writable volume properties — primarily the volume label — for the volume backing a file handle.

Prototype

NTSTATUS NtSetVolumeInformationFile(
  HANDLE                 FileHandle,
  PIO_STATUS_BLOCK       IoStatusBlock,
  PVOID                  FsInformation,
  ULONG                  Length,
  FS_INFORMATION_CLASS   FsInformationClass
);

Arguments

NameTypeDirDescription
FileHandleHANDLEinHandle to the volume root or a file on it; opened with FILE_WRITE_ATTRIBUTES.
IoStatusBlockPIO_STATUS_BLOCKoutReceives the completion status of the set operation.
FsInformationPVOIDinCaller-supplied input buffer holding the structure matching FsInformationClass (e.g. FILE_FS_LABEL_INFORMATION).
LengthULONGinSize in bytes of the FsInformation buffer.
FsInformationClassFS_INFORMATION_CLASSinClass to set; almost always FileFsLabelInformation (2) or FileFsControlInformation (6) in practice.

Syscall IDs by Windows version

Windows versionSyscall IDBuild
Win10 15070x196win10-1507
Win10 16070x19Fwin10-1607
Win10 17030x1A5win10-1703
Win10 17090x1A8win10-1709
Win10 18030x1AAwin10-1803
Win10 18090x1ABwin10-1809
Win10 19030x1ACwin10-1903
Win10 19090x1ACwin10-1909
Win10 20040x1B2win10-2004
Win10 20H20x1B2win10-20h2
Win10 21H10x1B2win10-21h1
Win10 21H20x1B4win10-21h2
Win10 22H20x1B4win10-22h2
Win11 21H20x1BDwin11-21h2
Win11 22H20x1C1win11-22h2
Win11 23H20x1C1win11-23h2
Win11 24H20x1C4win11-24h2
Server 20160x19Fwinserver-2016
Server 20190x1ABwinserver-2019
Server 20220x1BAwinserver-2022
Server 20250x1C4winserver-2025

Kernel module

ntoskrnl.exeNtSetVolumeInformationFile

Related APIs

SetVolumeLabelWGetVolumeInformationWNtQueryVolumeInformationFileFSCTL_SET_OBJECT_IDNtSetInformationFile

Syscall stub

4C 8B D1            mov r10, rcx
B8 C4 01 00 00      mov eax, 0x1C4
F6 04 25 08 03 FE 7F 01   test byte ptr [0x7FFE0308], 1
75 03               jne short +3
0F 05               syscall
C3                  ret
CD 2E               int 2Eh
C3                  ret

Undocumented notes

Far rarer than its `Query` sibling because the FS_INFORMATION_CLASS values that filesystems actually accept on the `Set` path are limited: `FileFsLabelInformation` (rename the volume), `FileFsControlInformation` (quota policy on NTFS), and `FileFsObjectIdInformation` (NTFS object-id assignment). Most other classes return `STATUS_INVALID_INFO_CLASS`. The IRP routes through `IRP_MJ_SET_VOLUME_INFORMATION` and reaches NTFS at `NtfsFsdSetVolumeInformation`. Renaming a volume requires `SE_MANAGE_VOLUME_NAME` privilege, which is held by interactive administrators and `LocalSystem` — not by standard users — so use of this syscall from a non-admin context is itself unusual telemetry.

Common malware usage

Niche but visible. A handful of ransomware families — most notoriously **Petya/NotPetya** (2017, MBR-encrypter) and some **Babuk** / **DarkSide** affiliates — issue `FileFsLabelInformation` to overwrite the volume name with their brand or a `READ_ME_*` string, so that any pre-boot recovery screen or `dir C:\` shows the ransom marker before the user opens the note. **BlackMatter** (2021) renamed labels to a short hash matching its ransom ID. Beyond ransomware the call is essentially unused by commodity malware — there is no offensive primitive here, only branding.

Detection opportunities

Microsoft Defender for Endpoint surfaces label changes via `DeviceEvents` ActionType `VolumeMounted` / `VolumeRenamed`. Sysmon does *not* cover this directly but ETW `Microsoft-Windows-Kernel-File` IRP traces show `IRP_MJ_SET_VOLUME_INFORMATION` with class 2 (`FileFsLabelInformation`). Because the privileged path is so narrow, *any* `NtSetVolumeInformationFile(FileFsLabelInformation)` from a non-trusted process — anything that is not `explorer.exe`, `cmd.exe label`, `format.com`, or a known backup product — should be considered high-confidence ransomware indication, especially when chained with `NtQueryVolumeInformationFile` enumeration of all drive letters seconds earlier.

Direct syscall examples

asmx64 direct stub (Win11 24H2)

; Direct syscall stub for NtSetVolumeInformationFile (SSN 0x1C4 on Win11 24H2 / Server 2025)
NtSetVolumeInformationFile PROC
    mov  r10, rcx          ; syscall convention
    mov  eax, 1C4h         ; SSN — drifts; resolve dynamically for portability
    syscall
    ret
NtSetVolumeInformationFile ENDP

cPetya-style volume relabel

// Requires SE_MANAGE_VOLUME_NAME privilege. Petya/NotPetya stamped
// volume labels with their ransom marker — visible in pre-boot UI.
#include <ntstatus.h>

typedef struct _FILE_FS_LABEL_INFORMATION {
    ULONG VolumeLabelLength;        // bytes, not chars
    WCHAR VolumeLabel[1];
} FILE_FS_LABEL_INFORMATION;

WCHAR  label[] = L"READ_ME_NOW";
SIZE_T bytes   = sizeof(label) - sizeof(WCHAR);
BYTE   buf[sizeof(FILE_FS_LABEL_INFORMATION) + sizeof(label)];
FILE_FS_LABEL_INFORMATION* p = (FILE_FS_LABEL_INFORMATION*)buf;
p->VolumeLabelLength = (ULONG)bytes;
memcpy(p->VolumeLabel, label, bytes);

IO_STATUS_BLOCK iosb;
NTSTATUS st = NtSetVolumeInformationFile(
    hVolumeRoot, &iosb, p,
    (ULONG)(sizeof(FILE_FS_LABEL_INFORMATION) + bytes),
    2 /* FileFsLabelInformation */);

rustSetVolumeLabelW wrapper (windows-sys)

// Cargo: windows-sys = "0.59" (Win32_Storage_FileSystem)
use windows_sys::Win32::Storage::FileSystem::SetVolumeLabelW;
use std::ffi::OsStr;
use std::os::windows::ffi::OsStrExt;

// Internally calls NtSetVolumeInformationFile(FileFsLabelInformation).
fn relabel(root: &str, label: &str) -> bool {
    let to_wide = |s: &str| -> Vec<u16> { OsStr::new(s).encode_wide().chain(Some(0)).collect() };
    let r = to_wide(root);
    let l = to_wide(label);
    unsafe { SetVolumeLabelW(r.as_ptr(), l.as_ptr()) != 0 }
}

MITRE ATT&CK mappings

Last verified: 2026-05-20