Skip to content

Commit

Permalink
ExtendedTools TPM editor
Browse files Browse the repository at this point in the history
  • Loading branch information
jxy-s committed Oct 21, 2024
1 parent f08098c commit b32df76
Show file tree
Hide file tree
Showing 7 changed files with 597 additions and 26 deletions.
14 changes: 14 additions & 0 deletions plugins/ExtendedTools/ExtendedTools.rc
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,20 @@ BEGIN
COMBOBOX IDC_FIRMWARE_BYTESPERROW,114,249,86,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END

IDD_TPM_EDIT DIALOGEX 0, 0, 441, 269
STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
EXSTYLE WS_EX_APPWINDOW
CAPTION "TPM Data"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_TPM_HEXEDIT,"PhHexEdit",WS_CLIPSIBLINGS | WS_VSCROLL | WS_TABSTOP,7,7,427,239
PUSHBUTTON "Re-read",IDC_TPM_REREAD,7,248,50,14
PUSHBUTTON "Write",IDC_TPM_WRITE,60,248,50,14
PUSHBUTTON "Save...",IDC_TPM_SAVE,331,248,50,14
PUSHBUTTON "Close",IDOK,384,248,50,14
COMBOBOX IDC_TPM_BYTESPERROW,114,249,86,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END

IDD_OBJMGR DIALOGEX 0, 0, 699, 364
STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Object Manager"
Expand Down
1 change: 1 addition & 0 deletions plugins/ExtendedTools/ExtendedTools.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
<ClCompile Include="reparse.c" />
<ClCompile Include="svcext.c" />
<ClCompile Include="tpm.c" />
<ClCompile Include="tpm_editor.c" />
<ClCompile Include="treeext.c" />
<ClCompile Include="etwstat.c" />
<ClCompile Include="etwprprp.c" />
Expand Down
3 changes: 3 additions & 0 deletions plugins/ExtendedTools/ExtendedTools.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@
<ClCompile Include="npusys.c">
<Filter>Source Files\Neural</Filter>
</ClCompile>
<ClCompile Include="tpm_editor.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h">
Expand Down
34 changes: 34 additions & 0 deletions plugins/ExtendedTools/exttools.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "resource.h"

#include "framemon.h"
#include "tpm.h"

// d3dkmddi requires the WDK (dmex)
#if defined(NTDDI_WIN10_CO) && (NTDDI_VERSION >= NTDDI_WIN10_CO)
Expand All @@ -45,6 +46,7 @@ __has_include (<d3dkmthk.h>)
#endif

#include <cfgmgr32.h>
#include <tbs.h>

// Undocumented device properties (Win10 only)
DEFINE_DEVPROPKEY(DEVPKEY_Gpu_Luid, 0x60b193cb, 0x5276, 0x4d0f, 0x96, 0xfc, 0xf1, 0x73, 0xab, 0xad, 0x3e, 0xc6, 2); // DEVPROP_TYPE_UINT64
Expand Down Expand Up @@ -1646,4 +1648,36 @@ VOID EtShowTpmDialog(
_In_ HWND ParentWindowHandle
);

_Must_inspect_result_
NTSTATUS EtTpmOpen(
_Out_ PTBS_HCONTEXT TbsContextHandle
);

NTSTATUS EtTpmClose(
_In_ TBS_HCONTEXT TbsContextHandle
);

_Must_inspect_result_
NTSTATUS EtTpmReadPublic(
_In_ TBS_HCONTEXT TbsContextHandle,
_In_ TPM_NV_INDEX Index,
_Out_ TPMA_NV* Attributes,
_Out_ PUSHORT DataSize
);

_Must_inspect_result_
NTSTATUS EtTpmRead(
_In_ TBS_HCONTEXT TbsContextHandle,
_In_ TPM_NV_INDEX Index,
_Out_writes_bytes_all_(DataSize) PBYTE Data,
_In_ USHORT DataSize
);

// tpm_editor

VOID EtShowTpmEditDialog(
_In_ HWND ParentWindowHandle,
_In_ TPM_NV_INDEX Index
);

#endif
7 changes: 7 additions & 0 deletions plugins/ExtendedTools/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
#define IDD_TPM 50002
#define IDC_TPM_LIST 50003
#define IDC_TPM_LIST_REFRESH 50004
#define IDD_TPM_EDIT 50005
#define IDC_TPM_HEXEDIT 50006
#define IDC_TPM_REREAD 50007
#define IDC_TPM_WRITE 50008
#define IDC_TPM_SAVE 50009
#define IDC_TPM_BYTESPERROW 50010


// Next default values for new objects
//
Expand Down
Loading

0 comments on commit b32df76

Please sign in to comment.