diff --git a/win32/src/winapi/error.rs b/win32/src/winapi/error.rs index def5fbb28..bc53e49d3 100644 --- a/win32/src/winapi/error.rs +++ b/win32/src/winapi/error.rs @@ -10,6 +10,7 @@ pub enum ERROR { INVALID_HANDLE = 6, INVALID_ACCESS = 12, INVALID_DATA = 13, + OUT_OF_PAPER = 28, FILE_EXISTS = 80, OPEN_FAILED = 110, MOD_NOT_FOUND = 126, diff --git a/win32/src/winapi/kernel32/misc.rs b/win32/src/winapi/kernel32/misc.rs index dd236b9e8..22c36eb18 100644 --- a/win32/src/winapi/kernel32/misc.rs +++ b/win32/src/winapi/kernel32/misc.rs @@ -261,9 +261,10 @@ pub fn FormatMessageW( todo!(); } let msg = if flags.contains(FormatMessageFlags::FROM_SYSTEM) { - match dwMessageId { - 0x1c => "The printer is out of paper.", - id => todo!("system message {:x}", id), + match ERROR::try_from(dwMessageId) { + Ok(ERROR::FILE_NOT_FOUND) => "The system cannot find the file specified.", + Ok(ERROR::OUT_OF_PAPER) => "The printer is out of paper.", + err => todo!("system error {err:x?}"), } } else { todo!();