Skip to content

Commit

Permalink
error enum in FormatMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
evmar committed Sep 23, 2024
1 parent 3eddb09 commit f35eccb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions win32/src/winapi/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions win32/src/winapi/kernel32/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!();
Expand Down

0 comments on commit f35eccb

Please sign in to comment.