private byte[] GetTpmAuth(TBS_OWNERAUTH_TYPE authType) { #if true return(new byte[0]); #else if (TbsHandle == UIntPtr.Zero) { throw new Exception("TBS context not created."); } //Console.WriteLine("GetTpmAuth: Retrieving auth value {0}", authType); var resultBuf = new byte[256]; uint resultByteCount = (uint)resultBuf.Length; TbsWrapper.TBS_RESULT result = TbsWrapper.NativeMethods. Tbsi_Get_OwnerAuth(TbsHandle, (uint)authType, resultBuf, ref resultByteCount); if (result != TbsWrapper.TBS_RESULT.TBS_SUCCESS) { //Console.WriteLine("GetTpmAuth({0}): error 0x{1:X8}", authType, (uint)result); return(new byte[0]); } //Console.WriteLine("GetTpmAuth({0}): size {1}", authType, resultByteCount); return(Globs.CopyData(resultBuf, 0, (int)resultByteCount)); #endif // false }
Tbsi_Get_OwnerAuth( UIntPtr Context, [System.Runtime.InteropServices.MarshalAs(UnmanagedType.U4), In] TBS_OWNERAUTH_TYPE OwnerAuthType, [System.Runtime.InteropServices.MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3), In, Out] byte[] OutBuffer, ref uint OutBufferSize);