Skip to content

The SafeHandle overload for InitializeAcl() is incorrect. #1456

@mjr4077au

Description

@mjr4077au

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

  1. NativeMethods.txt content:
InitializeAcl
  1. NativeMethods.json content (if present):
    N/A

  2. Any of your own code that should be shared?

Context

  • CsWin32 version: Latest
  • Win32Metadata version: N/A
  • Target Framework: net472
  • LangVersion: N/A

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions