Tidy and document structures, document more fields from Consent/AppInfo

This commit is contained in:
James Spencer
2023-12-17 15:19:44 +11:00
parent 6dd9a185a9
commit 2499c4acbd
9 changed files with 141 additions and 27 deletions
@@ -34,14 +34,25 @@ namespace Lithnet.CredentialProvider
/// <summary>
/// Gets a value indicating the consent prompt type
/// </summary>
public int PromptType => this.header.PromptType;
public ConsentUIPromptType PromptType => this.header.PromptType;
/// <summary>
/// Gets a handle to the Window that was responsible for invoking the ConsentUI prompt
/// </summary>
public IntPtr HWnd => this.header.hWnd;
public IntPtr HWnd => this.header.hWindow;
public ElevationType ElevationType => this.header.elevationType;
/// <summary>
/// Gets the method that ConsentUI has been told to fetch approval.
/// In the case where a Credential Provider is initialised, this should always be `Credentials`.
/// </summary>
public ConsentUIElevationType ElevationType => this.header.ElevationType;
/// <summary>
/// A series of flags that AppInfo passes to ConsentUI to signifiy actions that need to
/// take place on the UI side.
/// This includes specifics around the UI that should be presented & signature verification settings.
/// </summary>
public ConsentUIFlags Flags => this.header.Flags;
/// <summary>
/// Gets the ID of the session where the ConsentUI prompt was originally invoked
@@ -9,6 +9,9 @@ namespace Lithnet.CredentialProvider
/// </summary>
public class ConsentUIDataExe : ConsentUIData
{
/// <summary>
/// A file handle pointing to the EXE in question
/// </summary>
private IntPtr hFile;
/// <summary>
@@ -9,6 +9,11 @@ namespace Lithnet.CredentialProvider
/// </summary>
public class ConsentUIDataMsi : ConsentUIData
{
/// <summary>
/// The action being performed, such as Install, Uninstall or Repair
/// </summary>
public ConsentUIMsiAction Action { get; set; }
/// <summary>
/// The name of the product being installed
/// </summary>
@@ -39,16 +44,6 @@ namespace Lithnet.CredentialProvider
/// </summary>
public string OriginalMsi { get; }
/// <summary>
/// A currently unknown parameter
/// </summary>
public string Unknown1 { get; }
/// <summary>
/// A currently unknown parameter
/// </summary>
public string Unknown2 { get; }
internal ConsentUIDataMsi(IntPtr pData, int expectedSize) : base(pData, expectedSize)
{
if (this.header.Type != ConsentUIType.Msi)
@@ -58,14 +53,13 @@ namespace Lithnet.CredentialProvider
var s = Marshal.PtrToStructure<ConsentUIStructureMsi>(pData);
this.Action = s.MsiAction;
this.ProductName = this.GetStringValueIfValid(pData, (int)s.oProductName);
this.Version = this.GetStringValueIfValid(pData, (int)s.oVersion);
this.Locale = this.GetStringValueIfValid(pData, (int)s.oLocale);
this.Publisher = this.GetStringValueIfValid(pData, (int)s.oPublisher);
this.ExecutionPath = this.GetStringValueIfValid(pData, (int)s.oExecutionPath);
this.OriginalMsi = this.GetStringValueIfValid(pData, (int)s.oOriginalMsi);
this.Unknown1 = this.GetStringValueIfValid(pData, (int)s.oUnknown1);
this.Unknown2 = this.GetStringValueIfValid(pData, (int)s.oUnknown2);
this.ExecutionPath = this.GetStringValueIfValid(pData, (int)s.oExecutionPath);
this.OriginalMsi = this.GetStringValueIfValid(pData, (int)s.oOriginalMsi);
}
}
}
@@ -1,10 +0,0 @@
namespace Lithnet.CredentialProvider
{
public enum ElevationType
{
Unknown1 = 0,
Unknown2 = 1,
Consent = 2,
Credentials = 3
}
}