Beispiel #1
0
        private void RetrievePpiInfo()
        {
            WriteConsoleDebug("Creating TBS context ...");
            var tbsContextParams = new TBS_CONTEXT_PARAMS2 {
                flags = TBS_CONTEXT_PARAMS2_FLAGS.includeTpm12 | TBS_CONTEXT_PARAMS2_FLAGS.includeTpm20
            };

            CheckTbsResult(Tbsi_Context_Create(tbsContextParams, out var tbsContext));

            WriteConsoleVerbose("Retrieving PPI version ...");
            var ppiVersionCommand = new byte[] { 0x01, 0x00, 0x00, 0x00 };
            var ppiVersionOutput  = new byte[16];
            var ppiVersionLength  = (uint)ppiVersionOutput.Length;

            CheckTbsResult(Tbsi_Physical_Presence_Command(tbsContext,
                                                          ppiVersionCommand,
                                                          (uint)ppiVersionCommand.Length,
                                                          ppiVersionOutput,
                                                          ref ppiVersionLength));
            PhysicalPresenceVersion = Encoding.ASCII.GetString(ppiVersionOutput).Trim('\0').Trim();

            WriteConsoleDebug("Closing TBS context ...");
            CheckTbsResult(Tbsip_Context_Close(tbsContext));
        }
Beispiel #2
0
 internal static extern TBS_RESULT Tbsi_Context_Create(TBS_CONTEXT_PARAMS2 pContextParams, out IntPtr phContext);