SIGNER_SUBJECT_INFO (Structures)
Last changed: -82.25.9.9

.
Summary

C# Definition:

struct SIGNER_SUBJECT_INFO
{
   [StructLayoutAttribute(LayoutKind.Sequential)]
   internal struct SIGNER_SUBJECT_INFO
   {
      /// DWORD->unsigned int
      public uint cbSize;

      /// DWORD*
      public System.IntPtr pdwIndex;

      /// DWORD->unsigned int
      public uint dwSubjectChoice;

      /// SubjectChoiceUnion
      public SubjectChoiceUnion Union1;
   }

   [StructLayoutAttribute(LayoutKind.Explicit)]
   internal struct SubjectChoiceUnion
   {

      /// SIGNER_FILE_INFO*
      [FieldOffsetAttribute(0)]
      public System.IntPtr pSignerFileInfo;

      /// SIGNER_BLOB_INFO*
      [FieldOffsetAttribute(0)]
      public System.IntPtr pSignerBlobInfo;
   }
}

VB Definition:

Structure SIGNER_SUBJECT_INFO
   Public TODO
End Structure

User-Defined Field Types:

None.

C# Example Usage:

This example creates and populates a new SIGNER_SUBJECT_INFO structure.

private static SIGNER_SUBJECT_INFO CreateSignerSubjectInfo(string pathToAssembly)
{
    SIGNER_SUBJECT_INFO info = new SIGNER_SUBJECT_INFO();
    info.cbSize = (uint)Marshal.SizeOf(typeof(SIGNER_SUBJECT_INFO));

    //Create pointer to the pdwIndex. This should be a value of zero as suggested by msdn.
    info.pdwIndex = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(uint)));
    uint index = 0;
    Marshal.StructureToPtr(index, info.pdwIndex, false);

    //specify that the subject choice is a SUBJECT_FILE_INFO and not a SUBJECT_BLOB_INFO.
    info.dwSubjectChoice = SIGNER_SUBJECT_FILE; //0x1

    //create a pointer to the string containing the assembly file path
    IntPtr assemblyFilePtr = Marshal.StringToHGlobalUni(pathToAssembly);

    //create the SIGNER_FILE_INFO and populate ready to assign to the union.pSingerFileInfo            
    SIGNER_FILE_INFO fileInfo = new SIGNER_FILE_INFO();
    fileInfo.cbSize = (uint)Marshal.SizeOf(typeof(SIGNER_FILE_INFO));
    fileInfo.pwszFileName = assemblyFilePtr;
    fileInfo.hFile = IntPtr.Zero;

    //create and allocate the SIGNER_FILE_INFO to the union.
    info.Union1 = new SubjectChoiceUnion();            
    info.Union1.pSignerFileInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(SIGNER_FILE_INFO)));
    Marshal.StructureToPtr(fileInfo, info.Union1.pSignerFileInfo, false);

    return info;
}

Notes:

Ensure that you Free the pointer references used i.e. SUBJECT_SIGNER_INFO.pdwIndex

Documentation