-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VirtualQueryEx 3rd parameter is not an array #284
Comments
Searching the metadata for other uses of Same for The only valid cases of |
It seems like if I find I need to use BytesParamIndex, I should use a different attribute that just means how big in bytes the pointer points to. That would work for any types, including MEMORY_BASIC_INFORMATION*, void*, and byte*. |
This will look like: public unsafe static extern UIntPtr VirtualQueryEx([In] HANDLE hProcess, [Optional][In][Const] void* lpAddress, [Out][MemorySize(BytesParamIndex = 3)] MEMORY_BASIC_INFORMATION* lpBuffer, [In] UIntPtr dwLength); |
The
VirtualQueryEx
method's 3rd parameter isMEMORY_BASIC_INFORMATION*
and is not an array. Per the docs, only one struct is expected.But the metadata attributes it with
[NativeArrayInfo(BytesParamIndex = 3)]
as if it were an array, leading to CsWin32 projecting it asSpan<MEMORY_BASIC_INFORMATION>
.The 4th parameter is supposed to be the length of the struct (just one of them). Capturing this with an attribute (similar to
NativeArrayInfo
but without the array implication) would allow projections to drop the 4th parameter and auto-fill with the calculated size of the struct, as we're doing now while incorrectly treating it like an array.The text was updated successfully, but these errors were encountered: