Actual behavior
This P/Invoke wrapper is sending a pointer to a fixed address of the out'd ACL variable when this P/Invoke expects a buffer allocated with LocalAlloc be allocated and sent through first.
internal static unsafe winmdroot.Foundation.BOOL InitializeAcl(out winmdroot.Security.ACL pAcl, uint nAclLength, winmdroot.Security.ACE_REVISION dwAclRevision)
{
fixed (winmdroot.Security.ACL* pAclLocal = &pAcl)
{
winmdroot.Foundation.BOOL __result = PInvoke.InitializeAcl(pAclLocal, nAclLength, dwAclRevision);
return __result;
}
}
Expected behavior
This wrapper should be doing a LocalAlloc() allocation to the specified size of nAclLength, sending a pointer for this through to InitializeAcl(), then the pAcl parameter should be out'ing a LocalFreeSafeHandle type to work with.
Repro steps
NativeMethods.txt content:
-
NativeMethods.json content (if present):
N/A
-
Any of your own code that should be shared?
Context
- CsWin32 version: Latest
- Win32Metadata version: N/A
- Target Framework: net472
LangVersion: N/A
Actual behavior
This P/Invoke wrapper is sending a pointer to a fixed address of the out'd ACL variable when this P/Invoke expects a buffer allocated with LocalAlloc be allocated and sent through first.
Expected behavior
This wrapper should be doing a
LocalAlloc()allocation to the specified size ofnAclLength, sending a pointer for this through toInitializeAcl(), then thepAclparameter should be out'ing aLocalFreeSafeHandletype to work with.Repro steps
NativeMethods.txtcontent:NativeMethods.jsoncontent (if present):N/A
Any of your own code that should be shared?
Context
LangVersion: N/A