Skip to content

Commit

Permalink
Fixed the DsFreeSpnArray function signature, as it was corrupting the…
Browse files Browse the repository at this point in the history
… native heap.
  • Loading branch information
mihaicodrean committed Mar 21, 2023
1 parent 153533f commit d701cea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion PInvoke/NTDSApi/NTDSAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ public static DS_NAME_RESULT_ITEM[] DsCrackNames(SafeDsHandle hSafeDs, string[]
// *rpszSpn );
[DllImport(Lib.NTDSApi, SetLastError = false, CharSet = CharSet.Auto)]
[PInvokeData("ntdsapi.h", MSDNShortId = "1c229933-432d-4ded-be3b-3bd339a0abe4")]
public static extern void DsFreeSpnArray(uint cSpn, ref SpnArrayHandle rpszSpn);
public static extern void DsFreeSpnArray(uint cSpn, SpnArrayHandle rpszSpn);

/// <summary>
/// The <c>DsGetDomainControllerInfo</c> function retrieves data about the domain controllers in a domain.
Expand Down
2 changes: 1 addition & 1 deletion UnitTests/PInvoke/NTDSApi/NTDSApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void DsSpnTest()
uint uSpn = 1;
ret = DsGetSpn(DS_SPN_NAME_TYPE.DS_SPN_NB_HOST, "cxhndl", null, 0, 0, null, null, ref uSpn, out var hA);
ret.ThrowIfFailed();
DsFreeSpnArray(uSpn, ref hA);
DsFreeSpnArray(uSpn, hA);
}

[Test]
Expand Down

0 comments on commit d701cea

Please sign in to comment.