diff --git a/BranchTraceExe/BrachTraceExe.vcxproj b/BranchTraceExe/BrachTraceExe.vcxproj
new file mode 100644
index 0000000..1bdaca2
--- /dev/null
+++ b/BranchTraceExe/BrachTraceExe.vcxproj
@@ -0,0 +1,150 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ {8D95F0D0-2975-4A8B-9499-317C50E55264}
+ BrachTraceExe
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ true
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ MultiThreaded
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ MultiThreadedDebug
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ MultiThreadedDebug
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+ MultiThreaded
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BranchTraceExe/BrachTraceExe.vcxproj.filters b/BranchTraceExe/BrachTraceExe.vcxproj.filters
new file mode 100644
index 0000000..93b404b
--- /dev/null
+++ b/BranchTraceExe/BrachTraceExe.vcxproj.filters
@@ -0,0 +1,22 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+
\ No newline at end of file
diff --git a/BranchTraceExe/BrachTraceExe.vcxproj.user b/BranchTraceExe/BrachTraceExe.vcxproj.user
new file mode 100644
index 0000000..cb74406
--- /dev/null
+++ b/BranchTraceExe/BrachTraceExe.vcxproj.user
@@ -0,0 +1,27 @@
+
+
+
+ WindowsRemoteDebugger
+ $(TargetPath)
+ 192.168.3.7
+ RemoteWithoutAuthentication
+
+
+ $(TargetPath)
+ WindowsRemoteDebugger
+ 192.168.3.7
+ RemoteWithoutAuthentication
+
+
+ $(TargetPath)
+ WindowsRemoteDebugger
+ 192.168.3.7
+ RemoteWithoutAuthentication
+
+
+ $(TargetPath)
+ WindowsRemoteDebugger
+ 192.168.3.7
+ RemoteWithoutAuthentication
+
+
\ No newline at end of file
diff --git a/BranchTraceExe/brach-trace-exe.cpp b/BranchTraceExe/brach-trace-exe.cpp
new file mode 100644
index 0000000..de721ed
--- /dev/null
+++ b/BranchTraceExe/brach-trace-exe.cpp
@@ -0,0 +1,87 @@
+#include
+#include "..\BranchTracerSys\ioctls.h"
+#include
+
+
+
+typedef struct _BTS_RECORD64
+{
+ ULONG64 from; // ¼Ç¼·ÖÖ§µÄÔ´µØÖ·
+ ULONG64 to; // ¼Ç¼·ÖÖ§µÄÄ¿±êµØÖ·
+ ULONG64 branchPredicted;
+}BTS_RECORD64, * PBTS_RECORD64;
+
+
+
+int main() {
+ HANDLE hDevice = CreateFileA("\\\\.\\Branch-Trace", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+
+ ULONG ThreadId = 0;
+ printf("Enter thread id:");
+ scanf_s("%d", &ThreadId);
+
+ START_THREAD_TRACE_PARAM StartRequest = { 0 };
+ StartRequest.ThreadId = ThreadId;
+
+ DWORD BytesReturned = 0;
+ if (!DeviceIoControl(hDevice, IOCTL_START_THREAD_TRACE,
+ (LPVOID)&StartRequest, sizeof(StartRequest),
+ (LPVOID)&StartRequest, sizeof(StartRequest),
+ &BytesReturned, NULL))
+ {
+ printf("Start Trace failed!\n");
+ return -1;
+ }
+
+ printf("Press Enter to conttinue\n");
+ system("pause");
+
+#define BIFFER_SIZE 0x2000
+ PVOID Buffer = VirtualAlloc(NULL, BIFFER_SIZE, MEM_COMMIT, PAGE_READWRITE);
+ STOP_THREAD_TRACE_PARAM StopRequest = { 0 };
+ StopRequest.ThreadId = ThreadId;
+ StopRequest.Buffer = Buffer;
+ StopRequest.BufferSize = BIFFER_SIZE;
+ StopRequest.FilterStart = 0x00400000;
+ StopRequest.FilterEnd = 0x00D4C000+0x4000;
+
+
+ if (!DeviceIoControl(hDevice, IOCTL_STOP_THREAD_TRACE,
+ (LPVOID)&StopRequest, sizeof(StopRequest),
+ (LPVOID)&StopRequest, sizeof(StopRequest),
+ &BytesReturned, NULL))
+ {
+ printf("Stop Trace failed!\n");
+ getchar();
+ return -1;
+ }
+
+ printf("Successful Buffer:%p ReadSize:%x\n", StopRequest.Buffer, StopRequest.ReadSize);
+
+
+ PBTS_RECORD64 RecordStart = (PBTS_RECORD64)Buffer;
+ PBTS_RECORD64 RecordEnd = (PBTS_RECORD64)((ULONG_PTR)Buffer + StopRequest.ReadSize);
+
+
+ // ÄæÅÅ, ´ÓÇý¶¯À»ØÀ´µÄ¼Ç¼˳Ðò¸úÖ´ÐÐ˳ÐòµÄÏà·´.
+ for (PBTS_RECORD64 p1 = RecordStart, p2 = RecordEnd - 1;
+ p1 < p2;
+ p1++, p2--)
+ {
+ BTS_RECORD64 temp = *p1;
+ *p1 = *p2;
+ *p2 = temp;
+ }
+
+ PBTS_RECORD64 pRecord = RecordStart;
+ while (pRecord < RecordEnd)
+ {
+ printf("%llx-> %llx\n", pRecord->from, pRecord->to);
+ pRecord++;
+ }
+
+ system("pause");
+ getchar();
+
+
+}
\ No newline at end of file