mirror of https://github.com/dahall/Vanara.git
Finished fixing AuthzReportSecurityEventFromParams. BREAKING CHANGE: removed SafeAUTHZ_SOURCE_SCHEMA_REGISTRATION as all functionality was possible by marshaling AUTHZ_SOURCE_SCHEMA_REGISTRATION correctly.
parent
03bd938b7c
commit
22ec8ba85c
|
@ -137,60 +137,35 @@ namespace Vanara.PInvoke
|
||||||
/// compatibility with any future changes to this structure.
|
/// compatibility with any future changes to this structure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[PInvokeData("adtgen.h")]
|
[PInvokeData("adtgen.h")]
|
||||||
[StructLayout(LayoutKind.Explicit, Size = 32, CharSet = CharSet.Unicode)]
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
|
||||||
public struct AUDIT_PARAM
|
public struct AUDIT_PARAM
|
||||||
{
|
{
|
||||||
/// <summary>Type</summary>
|
/// <summary>Type</summary>
|
||||||
[FieldOffset(0)]
|
|
||||||
public AUDIT_PARAM_TYPE Type;
|
public AUDIT_PARAM_TYPE Type;
|
||||||
|
|
||||||
/// <summary>currently unused</summary>
|
/// <summary>currently unused</summary>
|
||||||
[FieldOffset(4)]
|
|
||||||
public uint Length;
|
public uint Length;
|
||||||
|
|
||||||
/// <summary>currently unused</summary>
|
/// <summary>currently unused</summary>
|
||||||
[FieldOffset(8)]
|
|
||||||
public uint Flags;
|
public uint Flags;
|
||||||
|
|
||||||
/// <summary/>
|
/// <summary/>
|
||||||
[FieldOffset(16)]
|
|
||||||
public IntPtr Data0;
|
public IntPtr Data0;
|
||||||
|
|
||||||
/// <summary/>
|
/// <summary/>
|
||||||
[FieldOffset(16)]
|
|
||||||
public StrPtrUni String;
|
|
||||||
|
|
||||||
/// <summary/>
|
|
||||||
[FieldOffset(16)]
|
|
||||||
public IntPtr u;
|
|
||||||
|
|
||||||
/// <summary/>
|
|
||||||
[FieldOffset(16)]
|
|
||||||
public PSID psid;
|
|
||||||
|
|
||||||
/// <summary/>
|
|
||||||
[FieldOffset(16)]
|
|
||||||
public GuidPtr pguid;
|
|
||||||
|
|
||||||
/// <summary/>
|
|
||||||
[FieldOffset(16)]
|
|
||||||
public uint LogonId_LowPart;
|
|
||||||
|
|
||||||
/// <summary/>
|
|
||||||
[FieldOffset(16)]
|
|
||||||
public IntPtr pObjectTypes;
|
|
||||||
|
|
||||||
/// <summary/>
|
|
||||||
[FieldOffset(16)]
|
|
||||||
public IntPtr pIpAddress;
|
|
||||||
|
|
||||||
/// <summary/>
|
|
||||||
[FieldOffset(24)]
|
|
||||||
public IntPtr Data1;
|
public IntPtr Data1;
|
||||||
|
|
||||||
/// <summary/>
|
/// <summary>Initializes a new instance of the <see cref="AUDIT_PARAM"/> struct.</summary>
|
||||||
[FieldOffset(24)]
|
/// <param name="type">The type.</param>
|
||||||
public int LogonId_HighPart;
|
/// <param name="data0">The data0.</param>
|
||||||
|
/// <param name="data1">The data1.</param>
|
||||||
|
public AUDIT_PARAM(AUDIT_PARAM_TYPE type, IntPtr data0, IntPtr data1 = default)
|
||||||
|
{
|
||||||
|
Type = type;
|
||||||
|
Length = Flags = 0;
|
||||||
|
Data0 = data0;
|
||||||
|
Data1 = data1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Audit parameters passed to LsaGenAuditEvent.</summary>
|
/// <summary>Audit parameters passed to LsaGenAuditEvent.</summary>
|
||||||
|
|
|
@ -304,9 +304,11 @@ namespace Vanara.PInvoke.Tests
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using SafeCoTaskMemString data = new("Testing");
|
using SafeCoTaskMemString data = new("Testing");
|
||||||
//using SafeCoTaskMemString name = new("MyName");
|
using SafeNativeArray<AUDIT_PARAM> mem = new(new[] {
|
||||||
using SafeNativeArray<AUDIT_PARAM> mem = new(new[] { new AUDIT_PARAM { Type = AUDIT_PARAM_TYPE.APT_String, Data0 = data/*, Data1 = name*/ } });
|
new AUDIT_PARAM(AUDIT_PARAM_TYPE.APT_String, data),
|
||||||
AUDIT_PARAMS ap = new() { Count = 1, Parameters = mem };
|
new AUDIT_PARAM(AUDIT_PARAM_TYPE.APT_Ulong, new IntPtr(123)),
|
||||||
|
});
|
||||||
|
AUDIT_PARAMS ap = new() { Count = (ushort)mem.Count, Parameters = mem };
|
||||||
Assert.That(AuthzReportSecurityEventFromParams(0, hEvtProv, eventId, PSID.NULL, ap), ResultIs.Successful);
|
Assert.That(AuthzReportSecurityEventFromParams(0, hEvtProv, eventId, PSID.NULL, ap), ResultIs.Successful);
|
||||||
}
|
}
|
||||||
finally { Assert.That(() => hEvtProv.Dispose(), Throws.Nothing); }
|
finally { Assert.That(() => hEvtProv.Dispose(), Throws.Nothing); }
|
||||||
|
|
Loading…
Reference in New Issue