Closed zbalkan closed 10 months ago
The
[Out]
attribute of pSecurityDescriptor is ignored, which makes GetKernelObjectSecurity unusable.
Can you help me understand why it's unusable? Have you tried it?
The [Out]
modifier on the pSecurityDescriptor
parameter merely indicates the party that is expected to initialize the buffer pointed to by the one field inside PSECURITY_DESCRIPTOR
. That field itself is initialized by the caller, to point at an existing buffer, which the callee is expected to initialize. The [Out]
modifier, while useful as a SAL annotation, doesn't change the runtime behavior at all in this case AFAIK.
It is possible that in your proposed form, [Out]
is necessary because passing in byte[]
requires the CLR marshaler to get involved, and the modifier allows it to know which direction to copy data. At least in some cases, that's required. But in the declaration that CsWin32 generates, the marshaler doesn't get involved so the attribute isn't needed.
Closing due to no response.
Actual behavior
The signature generated by CsWin32:
The
[Out]
attribute ofpSecurityDescriptor
is ignored, which makesGetKernelObjectSecurity
unusable.Expected behavior
The way to handle
GetKernelObjectSecurity
using conventional P/Invoke calls looks like this:The
CsWin32
should look and behave similar, too.Repro steps
NativeMethods.txt
content:NativeMethods.json
content (if present):Any of your own code that should be shared?
Context
0.3.18-beta
.Net 6.0
LangVersion
(if explicitly set by project):11