| ... | ... | @@ -267,7 +267,11 @@ pub const FILE = struct { |
| 267 | 267 | |
| 268 | 268 | pub fn toBuffer(fri: *const RENAME_INFORMATION) []const u8 { |
| 269 | 269 | const start: [*]const u8 = @ptrCast(fri); |
| 270 | | return start[0 .. @offsetOf(RENAME_INFORMATION, "FileName") + fri.FileNameLength]; |
| 270 | // The ABI size of the documented struct is 24 bytes, and attempting to use any size |
| 271 | // less than that will trigger INFO_LENGTH_MISMATCH, so enforce a minimum in cases where, |
| 272 | // for example, FileNameLength is 1 so only 22 bytes are technically needed. |
| 273 | const size = @max(24, @offsetOf(RENAME_INFORMATION, "FileName") + fri.FileNameLength); |
| 274 | return start[0..size]; |
| 271 | 275 | } |
| 272 | 276 | }; |
| 273 | 277 | |