anshdadhich commited on
Commit
776e190
·
verified ·
1 Parent(s): 1ff5f5b

FIX CRITICAL BUG: Correct FSCTL hex constants. Was 0x900B03/0x900F44, correct is 0x900B3/0x900F4. This caused DeviceIoControl to return ERROR_INVALID_FUNCTION(1), making MFT scan return 0 records.

Browse files
FastSeekWpf/NativeInterop/Win32Api.cs CHANGED
@@ -33,11 +33,15 @@ internal static class Win32Api
33
  public const uint FILE_FLAG_NO_BUFFERING = 0x20000000;
34
  public const uint FILE_ATTRIBUTE_NORMAL = 0x00000080;
35
 
36
- // IOCTL codes
37
- public const uint FSCTL_ENUM_USN_DATA = 0x900B03;
38
- public const uint FSCTL_QUERY_USN_JOURNAL = 0x900F44;
39
- public const uint FSCTL_READ_USN_JOURNAL = 0x900BB;
40
- public const uint FSCTL_READ_FILE_USN_DATA = 0x900EB;
 
 
 
 
41
 
42
  // USN reasons
43
  public const uint USN_REASON_FILE_CREATE = 0x00000100;
 
33
  public const uint FILE_FLAG_NO_BUFFERING = 0x20000000;
34
  public const uint FILE_ATTRIBUTE_NORMAL = 0x00000080;
35
 
36
+ // ── IOCTL codes ──
37
+ // CRITICAL: These must match the Windows SDK exactly. Previous versions had
38
+ // typos (0x900B03 instead of 0x900B3, 0x900F44 instead of 0x900F4) which
39
+ // caused DeviceIoControl to return ERROR_INVALID_FUNCTION.
40
+ // Verified against windows-rs crate and Windows SDK winioctl.h.
41
+ public const uint FSCTL_ENUM_USN_DATA = 0x000900B3;
42
+ public const uint FSCTL_QUERY_USN_JOURNAL = 0x000900F4;
43
+ public const uint FSCTL_READ_USN_JOURNAL = 0x000900BB;
44
+ public const uint FSCTL_READ_FILE_USN_DATA = 0x000900EB;
45
 
46
  // USN reasons
47
  public const uint USN_REASON_FILE_CREATE = 0x00000100;