Replies: 1 comment
-
|
So the headers contain: HANDLE
WINAPI
AddPrinterA(
_In_opt_ LPSTR pName,
_In_range_(1, 2)
DWORD Level,
_When_(Level == 1, _In_reads_bytes_(sizeof(PRINTER_INFO_1)))
_When_(Level == 2, _In_reads_bytes_(sizeof(PRINTER_INFO_2)))
LPBYTE pPrinter
);Currently, the metadata system lacks the capability to indicate that ExamplesC#: public static unsafe IntPtr AddPrinter(string? printerName, PRINTER_INFO_2 info)
{
return AddPrinter(printerName, 2, (byte*)&info);
}Rust: pub fn add_printer(name: Option<&str>, info: &PRINTER_INFO_2A) -> Result<HANDLE> {
unsafe {
let handle = AddPrinterA(
name,
2,
info as *const _ as *mut u8, // LPBYTE is projected as *const u8
);
// ...
}
}Errata
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We've got a bunch of APIs in the printer space which have pretty funky parameters. The SAL annotations theoretically express the buffer size (
win32metadata/generation/WinSDK/RecompiledIdlHeaders/um/winspool.h
Line 1479 in ad21d24
Does anyone have a suggestion for how to make sure that a byte* parameter is carried through to the projection as a byte array?
@riverar any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions