mirror of
https://github.com/eliboa/TegraRcmGUI.git
synced 2024-12-28 19:16:02 +00:00
First commit
This commit is contained in:
commit
dfbd89b6a2
27 changed files with 2668 additions and 0 deletions
22
ScopeGuard.h
Normal file
22
ScopeGuard.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
template<typename Func>
|
||||
class ScopeGuard
|
||||
{
|
||||
public:
|
||||
ScopeGuard(Func&& runFunc) : exitFunc(std::forward<Func>(runFunc)), shouldRun(true) {}
|
||||
~ScopeGuard()
|
||||
{
|
||||
if (shouldRun)
|
||||
exitFunc();
|
||||
}
|
||||
|
||||
bool reset() { auto prevRun = shouldRun; shouldRun = false; return prevRun; }
|
||||
bool run() { auto prevRun = shouldRun; if (shouldRun) { exitFunc(); shouldRun = false; } return prevRun; }
|
||||
private:
|
||||
Func exitFunc;
|
||||
bool shouldRun;
|
||||
};
|
||||
|
||||
template<typename Func>
|
||||
ScopeGuard<Func> MakeScopeGuard(Func&& theFunc) { return { std::forward<Func>(theFunc) }; }
|
102
TegraRcmGUI.cpp
Normal file
102
TegraRcmGUI.cpp
Normal file
|
@ -0,0 +1,102 @@
|
|||
|
||||
// TegraRcmGUI.cpp : Defines the class behaviors for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "TegraRcmGUI.h"
|
||||
#include "TegraRcmGUIDlg.h"
|
||||
#include "TegraRcmSmash.h"
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
// CTegraRcmGUIApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTegraRcmGUIApp, CWinApp)
|
||||
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CTegraRcmGUIApp construction
|
||||
|
||||
CTegraRcmGUIApp::CTegraRcmGUIApp()
|
||||
{
|
||||
// support Restart Manager
|
||||
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||
|
||||
// TODO: add construction code here,
|
||||
// Place all significant initialization in InitInstance
|
||||
}
|
||||
|
||||
|
||||
// The one and only CTegraRcmGUIApp object
|
||||
|
||||
CTegraRcmGUIApp theApp;
|
||||
|
||||
// CTegraRcmGUIApp initialization
|
||||
|
||||
BOOL CTegraRcmGUIApp::InitInstance()
|
||||
{
|
||||
// InitCommonControlsEx() is required on Windows XP if an application
|
||||
// manifest specifies use of ComCtl32.dll version 6 or later to enable
|
||||
// visual styles. Otherwise, any window creation will fail.
|
||||
INITCOMMONCONTROLSEX InitCtrls;
|
||||
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||
// Set this to include all the common control classes you want to use
|
||||
// in your application.
|
||||
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||
InitCommonControlsEx(&InitCtrls);
|
||||
|
||||
CWinApp::InitInstance();
|
||||
|
||||
|
||||
AfxEnableControlContainer();
|
||||
|
||||
|
||||
// Standard initialization
|
||||
// If you are not using these features and wish to reduce the size
|
||||
// of your final executable, you should remove from the following
|
||||
// the specific initialization routines you do not need
|
||||
// Change the registry key under which our settings are stored
|
||||
// TODO: You should modify this string to be something appropriate
|
||||
// such as the name of your company or organization
|
||||
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
|
||||
|
||||
CTegraRcmGUIDlg dlg;
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
{
|
||||
// TODO: Place code here to handle when the dialog is
|
||||
// dismissed with OK
|
||||
}
|
||||
else if (nResponse == IDCANCEL)
|
||||
{
|
||||
// TODO: Place code here to handle when the dialog is
|
||||
// dismissed with Cancel
|
||||
|
||||
}
|
||||
else if (nResponse == -1)
|
||||
{
|
||||
TRACE(traceAppMsg, 0, "Warning: dialog creation failed, so application is terminating unexpectedly.\n");
|
||||
}
|
||||
|
||||
|
||||
// Since the dialog has been closed, return FALSE so that we exit the
|
||||
// application, rather than start the application's message pump.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CTegraRcmGUIApp::Run()
|
||||
{
|
||||
int rc = 0;
|
||||
return 0;
|
||||
}
|
||||
|
33
TegraRcmGUI.h
Normal file
33
TegraRcmGUI.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
|
||||
// TegraRcmGUI.h : main header file for the PROJECT_NAME application
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error "include 'stdafx.h' before including this file for PCH"
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
|
||||
// CTegraRcmGUIApp:
|
||||
// See TegraRcmGUI.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CTegraRcmGUIApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CTegraRcmGUIApp();
|
||||
|
||||
// Overrides
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
int Run();
|
||||
|
||||
// Implementation
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CTegraRcmGUIApp theApp;
|
BIN
TegraRcmGUI.rc
Normal file
BIN
TegraRcmGUI.rc
Normal file
Binary file not shown.
249
TegraRcmGUI.vcxproj
Normal file
249
TegraRcmGUI.vcxproj
Normal file
|
@ -0,0 +1,249 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{2C091C5B-378F-44D0-91F2-53489BA7B83C}</ProjectGuid>
|
||||
<RootNamespace>TegraRcmGUI</RootNamespace>
|
||||
<Keyword>MFCProj</Keyword>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<UseOfMfc>Dynamic</UseOfMfc>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>Version.lib;libusbK.lib</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Version.lib;libusbK.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(LIBUSBK_DIR)\includes\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(LIBUSBK_DIR)\bin\lib\$(PlatformShortName.Replace('x64','amd64'))\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>Version.lib;libusbK.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="libusbk_int.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="res\BitmapPicture.h" />
|
||||
<ClInclude Include="ScopeGuard.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="TegraRcmGUI.h" />
|
||||
<ClInclude Include="TegraRcmGUIDlg.h" />
|
||||
<ClInclude Include="TegraRcmSmash.h" />
|
||||
<ClInclude Include="Types.h" />
|
||||
<ClInclude Include="Win32Def.h" />
|
||||
<ClInclude Include="WinHandle.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="res\BitmapPicture.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TegraRcmGUI.cpp" />
|
||||
<ClCompile Include="TegraRcmGUIDlg.cpp" />
|
||||
<ClCompile Include="TegraRcmSmash.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="TegraRcmGUI.rc">
|
||||
<DeploymentContent>false</DeploymentContent>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\TegraRcmGUI.rc2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\driver_ko2.bmp" />
|
||||
<Image Include="res\init_logo_2.bmp" />
|
||||
<Image Include="res\rcm_detected2.bmp" />
|
||||
<Image Include="res\rcm_undetected2.bmp" />
|
||||
<Image Include="res\TegraRcmGUI.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="TegraRcmGUI.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
102
TegraRcmGUI.vcxproj.filters
Normal file
102
TegraRcmGUI.vcxproj.filters
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="TegraRcmGUI.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TegraRcmGUIDlg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="libusbk_int.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ScopeGuard.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TegraRcmSmash.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Types.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Win32Def.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="WinHandle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="res\BitmapPicture.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="TegraRcmGUI.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TegraRcmGUIDlg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TegraRcmSmash.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="res\BitmapPicture.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="TegraRcmGUI.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\TegraRcmGUI.rc2">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\TegraRcmGUI.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="res\driver_ko2.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="res\init_logo_2.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="res\rcm_detected2.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="res\rcm_undetected2.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
4
TegraRcmGUI.vcxproj.user
Normal file
4
TegraRcmGUI.vcxproj.user
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
334
TegraRcmGUIDlg.cpp
Normal file
334
TegraRcmGUIDlg.cpp
Normal file
|
@ -0,0 +1,334 @@
|
|||
|
||||
// TegraRcmGUIDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "TegraRcmGUI.h"
|
||||
#include "TegraRcmGUIDlg.h"
|
||||
#include "TegraRcmSmash.h"
|
||||
#include "res/BitmapPicture.h"
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <array>
|
||||
|
||||
std::string exec(const char* cmd) {
|
||||
std::array<char, 128> buffer;
|
||||
std::string result;
|
||||
std::shared_ptr<FILE> pipe(_popen(cmd, "r"), _pclose);
|
||||
if (!pipe) throw std::runtime_error("_popen() failed!");
|
||||
while (!feof(pipe.get())) {
|
||||
if (fgets(buffer.data(), 128, pipe.get()) != nullptr)
|
||||
result += buffer.data();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
TCHAR* PAYLOAD_FILE;
|
||||
int RCM_STATUS = -10;
|
||||
int LOOP_WAIT = 0;
|
||||
|
||||
// CTegraRcmGUIDlg dialog
|
||||
|
||||
CTegraRcmGUIDlg::CTegraRcmGUIDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(IDD_TEGRARCMGUI_DIALOG, pParent)
|
||||
, STATUS(0)
|
||||
{
|
||||
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||
}
|
||||
|
||||
void CTegraRcmGUIDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, RCM_PIC_1, RCM_BITMAP1);
|
||||
DDX_Control(pDX, RCM_PIC_2, RCM_BITMAP2);
|
||||
DDX_Control(pDX, RCM_PIC_3, RCM_BITMAP3);
|
||||
DDX_Control(pDX, RCM_PIC_4, RCM_BITMAP0);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTegraRcmGUIDlg, CDialog)
|
||||
ON_WM_TIMER()
|
||||
ON_WM_SYSCOMMAND()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_QUERYDRAGICON()
|
||||
ON_EN_CHANGE(PAYLOAD_PATH, &CTegraRcmGUIDlg::OnEnChangePath)
|
||||
ON_BN_CLICKED(IDC_INJECT, &CTegraRcmGUIDlg::OnBnClickedButton)
|
||||
ON_BN_CLICKED(IDC_SHOFEL2, &CTegraRcmGUIDlg::OnBnClickedShofel2)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CTegraRcmGUIDlg message handlers
|
||||
|
||||
BOOL CTegraRcmGUIDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
RCM_BITMAP0.SetBitmap(INIT_LOGO);
|
||||
RCM_BITMAP1.SetBitmap(RCM_NOT_DETECTED);
|
||||
RCM_BITMAP2.SetBitmap(DRIVER_KO);
|
||||
RCM_BITMAP3.SetBitmap(RCM_DETECTED);
|
||||
|
||||
// Add "About..." menu item to system menu.
|
||||
|
||||
// IDM_ABOUTBOX must be in the system command range.
|
||||
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
||||
ASSERT(IDM_ABOUTBOX < 0xF000);
|
||||
|
||||
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
||||
if (pSysMenu != NULL)
|
||||
{
|
||||
BOOL bNameValid;
|
||||
CString strAboutMenu;
|
||||
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
|
||||
ASSERT(bNameValid);
|
||||
if (!strAboutMenu.IsEmpty())
|
||||
{
|
||||
pSysMenu->AppendMenu(MF_SEPARATOR);
|
||||
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the icon for this dialog. The framework does this automatically
|
||||
// when the application's main window is not a dialog
|
||||
SetIcon(m_hIcon, TRUE); // Set big icon
|
||||
SetIcon(m_hIcon, FALSE); // Set small icon
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
CTegraRcmGUIDlg::StartTimer();
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CTegraRcmGUIDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
{
|
||||
CDialog::OnSysCommand(nID, lParam);
|
||||
}
|
||||
|
||||
// If you add a minimize button to your dialog, you will need the code below
|
||||
// to draw the icon. For MFC applications using the document/view model,
|
||||
// this is automatically done for you by the framework.
|
||||
|
||||
void CTegraRcmGUIDlg::OnPaint()
|
||||
{
|
||||
|
||||
if (IsIconic())
|
||||
{
|
||||
CPaintDC dc(this); // device context for painting
|
||||
|
||||
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
||||
|
||||
// Center icon in client rectangle
|
||||
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||||
int cyIcon = GetSystemMetrics(SM_CYICON);
|
||||
CRect rect;
|
||||
GetClientRect(&rect);
|
||||
int x = (rect.Width() - cxIcon + 1) / 2;
|
||||
int y = (rect.Height() - cyIcon + 1) / 2;
|
||||
|
||||
// Draw the icon
|
||||
dc.DrawIcon(x, y, m_hIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
CDialog::OnPaint();
|
||||
}
|
||||
}
|
||||
|
||||
// The system calls this function to obtain the cursor to display while the user drags
|
||||
// the minimized window.
|
||||
HCURSOR CTegraRcmGUIDlg::OnQueryDragIcon()
|
||||
{
|
||||
return static_cast<HCURSOR>(m_hIcon);
|
||||
}
|
||||
|
||||
|
||||
const UINT ID_TIMER_MINUTE = 0x1001;
|
||||
const UINT ID_TIMER_SECONDS = 0x1000;
|
||||
|
||||
// Start the timers.
|
||||
void CTegraRcmGUIDlg::StartTimer()
|
||||
{
|
||||
// Set timer for Minutes.
|
||||
SetTimer(ID_TIMER_MINUTE, 60 * 1000, 0);
|
||||
|
||||
// Set timer for Seconds.
|
||||
SetTimer(ID_TIMER_SECONDS, 1000, 0);
|
||||
}
|
||||
|
||||
// Stop the timers.
|
||||
void CTegraRcmGUIDlg::StopTimer()
|
||||
{
|
||||
// Stop both timers.
|
||||
KillTimer(ID_TIMER_MINUTE);
|
||||
KillTimer(ID_TIMER_SECONDS);
|
||||
}
|
||||
|
||||
// Timer Handler.
|
||||
void CTegraRcmGUIDlg::OnTimer(UINT nIDEvent)
|
||||
{
|
||||
if (nIDEvent == ID_TIMER_SECONDS)
|
||||
{
|
||||
|
||||
TegraRcmSmash device;
|
||||
int rc = device.RcmStatus();
|
||||
|
||||
CStatic*pCtrl1 = (CStatic*)GetDlgItem(RCM_PIC_1);
|
||||
CStatic*pCtrl2 = (CStatic*)GetDlgItem(RCM_PIC_2);
|
||||
CStatic*pCtrl3 = (CStatic*)GetDlgItem(RCM_PIC_3);
|
||||
|
||||
std::string s = "";
|
||||
if (rc >= 0)
|
||||
{
|
||||
pCtrl1->ShowWindow(SW_HIDE);
|
||||
pCtrl2->ShowWindow(SW_HIDE);
|
||||
pCtrl3->ShowWindow(SW_SHOW);
|
||||
this->GetDlgItem(IDC_INJECT)->EnableWindow(TRUE);
|
||||
this->GetDlgItem(IDC_SHOFEL2)->EnableWindow(TRUE);
|
||||
}
|
||||
else if (rc > -5)
|
||||
{
|
||||
pCtrl1->ShowWindow(SW_HIDE);
|
||||
pCtrl2->ShowWindow(SW_SHOW);
|
||||
pCtrl3->ShowWindow(SW_HIDE);
|
||||
this->GetDlgItem(IDC_INJECT)->EnableWindow(FALSE);
|
||||
this->GetDlgItem(IDC_SHOFEL2)->EnableWindow(FALSE);
|
||||
s = "Please Install the lbusbK driver (download Zadig)";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pCtrl1->ShowWindow(SW_SHOW);
|
||||
pCtrl2->ShowWindow(SW_HIDE);
|
||||
pCtrl3->ShowWindow(SW_HIDE);
|
||||
this->GetDlgItem(IDC_INJECT)->EnableWindow(FALSE);
|
||||
this->GetDlgItem(IDC_SHOFEL2)->EnableWindow(FALSE);
|
||||
s = "Waiting for Switch in RCM mode.";
|
||||
}
|
||||
|
||||
if (rc != RCM_STATUS)
|
||||
{
|
||||
CStatic*pCtrl0 = (CStatic*)GetDlgItem(RCM_PIC_4);
|
||||
pCtrl0->ShowWindow(SW_HIDE);
|
||||
CA2T wt(s.c_str());
|
||||
SetDlgItemText(INFO_LABEL, wt);
|
||||
}
|
||||
RCM_STATUS = rc;
|
||||
}
|
||||
}
|
||||
|
||||
void CTegraRcmGUIDlg::OnEnChangePath()
|
||||
{
|
||||
CString file;
|
||||
this->GetDlgItem(PAYLOAD_PATH)->GetWindowTextW(file);
|
||||
PAYLOAD_FILE = _tcsdup(file);
|
||||
|
||||
std::string s = "";
|
||||
CA2T wt(s.c_str());
|
||||
SetDlgItemText(INFO_LABEL, wt);
|
||||
}
|
||||
|
||||
|
||||
void CTegraRcmGUIDlg::OnBnClickedButton()
|
||||
{
|
||||
LOOP_WAIT = 1;
|
||||
TCHAR* args[2];
|
||||
args[0] = TEXT("");
|
||||
args[1] = PAYLOAD_FILE;
|
||||
|
||||
TegraRcmSmash device;
|
||||
int rc = device.SmashMain(2, args);
|
||||
|
||||
string s;
|
||||
if (rc >= 0)
|
||||
{
|
||||
s = "Payload injected !";
|
||||
}
|
||||
else
|
||||
{
|
||||
s = "Error while injecting payload (RC=" + std::to_string(rc) + ")";
|
||||
}
|
||||
CA2T wt(s.c_str());
|
||||
CTegraRcmGUIDlg::SetDlgItemText(INFO_LABEL, wt);
|
||||
LOOP_WAIT = 0;
|
||||
}
|
||||
|
||||
void CTegraRcmGUIDlg::OnBnClickedShofel2()
|
||||
{
|
||||
LOOP_WAIT = 1;
|
||||
|
||||
TCHAR szPath[_MAX_PATH];
|
||||
VERIFY(::GetModuleFileName(AfxGetApp()->m_hInstance, szPath, _MAX_PATH));
|
||||
CString csPath(szPath);
|
||||
int nIndex = csPath.ReverseFind(_T('\\'));
|
||||
if (nIndex > 0) {
|
||||
csPath = csPath.Left(nIndex);
|
||||
}
|
||||
else {
|
||||
csPath.Empty();
|
||||
}
|
||||
|
||||
CString COREBOOT = _T("CBFS+") + csPath + _T("\\shofel2\\coreboot\\coreboot.rom");
|
||||
CString PAYLOAD = csPath + _T("\\shofel2\\coreboot\\cbfs.bin");
|
||||
TCHAR* payload_f = _tcsdup(PAYLOAD);
|
||||
TCHAR* coreboot_f = _tcsdup(COREBOOT);
|
||||
string s;
|
||||
TCHAR* args[5];
|
||||
args[0] = TEXT("");
|
||||
args[1] = TEXT("-w");
|
||||
args[2] = TEXT("--relocator=");
|
||||
args[3] = payload_f;
|
||||
args[4] = coreboot_f;
|
||||
|
||||
TegraRcmSmash device;
|
||||
|
||||
s = "Loading coreboot. Please wait.";
|
||||
CA2T wt(s.c_str());
|
||||
SetDlgItemText(INFO_LABEL, wt);
|
||||
|
||||
int rc = device.SmashMain(5, args);
|
||||
if (rc >= 0 || rc < -7)
|
||||
{
|
||||
s = "Coreboot loaded. Waiting for device...";
|
||||
CA2T wt(s.c_str());
|
||||
SetDlgItemText(INFO_LABEL, wt);
|
||||
Sleep(5000);
|
||||
|
||||
CString usb_loader = csPath + _T("\\shofel2\\imx_usb.bat");
|
||||
PROCESS_INFORMATION pif;
|
||||
STARTUPINFO si;
|
||||
ZeroMemory(&si, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
BOOL bRet = CreateProcess(usb_loader, NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pif);
|
||||
if (bRet == 0)
|
||||
{
|
||||
s = "Error while loading shofel2\\imx_usb.bat.";
|
||||
}
|
||||
else
|
||||
{
|
||||
s = "Payload injected !";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
s = "Error while injecting payload. (RC=" + std::to_string(rc) + ")";
|
||||
}
|
||||
CA2T wt2(s.c_str());
|
||||
SetDlgItemText(INFO_LABEL, wt2);
|
||||
|
||||
LOOP_WAIT = 0;
|
||||
}
|
47
TegraRcmGUIDlg.h
Normal file
47
TegraRcmGUIDlg.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
|
||||
// TegraRcmGUIDlg.h : header file
|
||||
//
|
||||
#pragma once
|
||||
#include "res/BitmapPicture.h"
|
||||
|
||||
// CTegraRcmGUIDlg dialog
|
||||
class CTegraRcmGUIDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CTegraRcmGUIDlg(CWnd* pParent = NULL); // standard constructor
|
||||
CBitmapPicture RCM_BITMAP0;
|
||||
CBitmapPicture RCM_BITMAP1;
|
||||
CBitmapPicture RCM_BITMAP2;
|
||||
CBitmapPicture RCM_BITMAP3;
|
||||
|
||||
|
||||
// Dialog Data
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_TEGRARCMGUI_DIALOG };
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
HICON m_hIcon;
|
||||
// Generated message map functions
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
||||
afx_msg void OnIdle();
|
||||
afx_msg void OnShowWindow();
|
||||
afx_msg void OnPaint();
|
||||
afx_msg HCURSOR OnQueryDragIcon();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
void StartTimer();
|
||||
void StopTimer();
|
||||
void OnTimer(UINT nIDEvent);
|
||||
int STATUS;
|
||||
afx_msg void OnEnChangePath();
|
||||
afx_msg void OnBnClickedButton();
|
||||
afx_msg void OnBnClickedShofel2();
|
||||
};
|
1144
TegraRcmSmash.cpp
Normal file
1144
TegraRcmSmash.cpp
Normal file
File diff suppressed because it is too large
Load diff
24
TegraRcmSmash.h
Normal file
24
TegraRcmSmash.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
#pragma once
|
||||
|
||||
#include "Types.h"
|
||||
#include "ScopeGuard.h"
|
||||
#include "WinHandle.h"
|
||||
#include <assert.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include "libusbk_int.h"
|
||||
|
||||
class TegraRcmSmash
|
||||
{
|
||||
public:
|
||||
TegraRcmSmash();
|
||||
~TegraRcmSmash();
|
||||
static int RcmStatus();
|
||||
static int Smash(TCHAR* payload, CString coreboot = _T(""));
|
||||
static int SmashMain(int argc, TCHAR* argv[]);
|
||||
};
|
||||
|
51
Types.h
Normal file
51
Types.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
using u64 = std::uint64_t;
|
||||
using u32 = std::uint32_t;
|
||||
using u16 = std::uint16_t;
|
||||
using u8 = std::uint8_t;
|
||||
using s64 = std::int64_t;
|
||||
using s32 = std::int32_t;
|
||||
using s16 = std::int16_t;
|
||||
using s8 = std::int8_t;
|
||||
|
||||
using uptr = std::uintptr_t;
|
||||
using sptr = std::intptr_t;
|
||||
|
||||
using uint = unsigned int;
|
||||
using byte = unsigned char;
|
||||
|
||||
using f32 = float;
|
||||
using f64 = double;
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
typedef std::vector<byte> ByteVector;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
using std::array;
|
||||
using std::map;
|
||||
using std::pair;
|
||||
using std::unordered_map;
|
||||
|
||||
template<typename T, size_t ARR_SIZE>
|
||||
size_t array_countof(T(&)[ARR_SIZE]) { return ARR_SIZE; }
|
||||
|
||||
template<typename T, typename Y>
|
||||
T align_up(const T n, const Y align)
|
||||
{
|
||||
const T alignm1 = align - 1;
|
||||
return (n + alignm1) & (~alignm1);
|
||||
}
|
||||
|
||||
template<typename T, typename Y>
|
||||
T align_down(const T n, const Y align)
|
||||
{
|
||||
const T alignm1 = align - 1;
|
||||
return n & (~alignm1);
|
||||
}
|
32
Win32Def.h
Normal file
32
Win32Def.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
|
||||
#ifdef _WIN32_WINNT
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
|
||||
#define _WIN32_WINNT _WIN32_WINNT_WIN7
|
||||
|
||||
#ifdef WINVER
|
||||
#undef WINVER
|
||||
#endif
|
||||
|
||||
#define WINVER _WIN32_WINNT
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef UNICODE
|
||||
typedef std::wstring WinString;
|
||||
#else
|
||||
typedef std::string WinString;
|
||||
#endif
|
30
WinHandle.h
Normal file
30
WinHandle.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include "Win32Def.h"
|
||||
|
||||
class WinHandle
|
||||
{
|
||||
public:
|
||||
WinHandle(HANDLE srcHandle = INVALID_HANDLE_VALUE) noexcept : _handle(srcHandle) {}
|
||||
~WinHandle()
|
||||
{
|
||||
if (_handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
::CloseHandle(_handle);
|
||||
_handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
void swap(WinHandle&& other) noexcept { std::swap(_handle, other._handle); }
|
||||
|
||||
WinHandle(WinHandle&& moved) noexcept : _handle(INVALID_HANDLE_VALUE) { swap(std::move(moved)); }
|
||||
WinHandle(const WinHandle& copied) = delete;
|
||||
|
||||
WinHandle& operator=(WinHandle&& moved) { swap(std::move(moved)); return *this; }
|
||||
WinHandle& operator=(const WinHandle& copied) = delete;
|
||||
|
||||
HANDLE get() const { return _handle; }
|
||||
HANDLE release() { HANDLE retHandle = _handle; _handle = INVALID_HANDLE_VALUE; return retHandle; }
|
||||
protected:
|
||||
HANDLE _handle;
|
||||
};
|
176
libusbk_int.h
Normal file
176
libusbk_int.h
Normal file
|
@ -0,0 +1,176 @@
|
|||
#pragma once
|
||||
|
||||
#include "Win32Def.h"
|
||||
#include <libusbk.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
namespace libusbk
|
||||
{
|
||||
struct interface_request_t
|
||||
{
|
||||
unsigned int interface_number;
|
||||
unsigned int altsetting_number;
|
||||
|
||||
unsigned char intf_use_index: 1; // libusbK Only
|
||||
unsigned char altf_use_index: 1; // libusbK Only
|
||||
unsigned char: 6;
|
||||
|
||||
short interface_index; // libusbK Only
|
||||
short altsetting_index; // libusbK Only
|
||||
};
|
||||
|
||||
struct version_t
|
||||
{
|
||||
unsigned int major;
|
||||
unsigned int minor;
|
||||
unsigned int micro;
|
||||
unsigned int nano;
|
||||
unsigned int mod_value;
|
||||
};
|
||||
|
||||
struct libusb_request
|
||||
{
|
||||
unsigned int timeout;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned int configuration;
|
||||
} configuration;
|
||||
|
||||
interface_request_t intf; // libusbK Only
|
||||
|
||||
version_t version;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int endpoint;
|
||||
unsigned int packet_size;
|
||||
|
||||
unsigned int unused; // max_transfer_size is deprecated; (see pipe policies)
|
||||
unsigned int transfer_flags;
|
||||
unsigned int iso_start_frame_latency;
|
||||
} endpoint;
|
||||
|
||||
struct
|
||||
{
|
||||
UCHAR PipeID;
|
||||
ULONG IsoContextSize;
|
||||
PKISO_CONTEXT IsoContext;
|
||||
} IsoEx;
|
||||
struct
|
||||
{
|
||||
UCHAR PipeID;
|
||||
} AutoIsoEx;
|
||||
struct
|
||||
{
|
||||
unsigned int type;
|
||||
unsigned int recipient;
|
||||
unsigned int request;
|
||||
unsigned int value;
|
||||
unsigned int index;
|
||||
} vendor;
|
||||
struct
|
||||
{
|
||||
unsigned int recipient;
|
||||
unsigned int feature;
|
||||
unsigned int index;
|
||||
} feature;
|
||||
struct
|
||||
{
|
||||
unsigned int recipient;
|
||||
unsigned int index;
|
||||
unsigned int status;
|
||||
} status;
|
||||
struct
|
||||
{
|
||||
unsigned int type;
|
||||
unsigned int index;
|
||||
unsigned int language_id;
|
||||
unsigned int recipient;
|
||||
} descriptor;
|
||||
struct
|
||||
{
|
||||
unsigned int level;
|
||||
} debug;
|
||||
|
||||
struct
|
||||
{
|
||||
unsigned int property;
|
||||
} device_property;
|
||||
struct
|
||||
{
|
||||
unsigned int key_type;
|
||||
unsigned int name_offset;
|
||||
unsigned int value_offset;
|
||||
unsigned int value_length;
|
||||
} device_registry_key;
|
||||
struct
|
||||
{
|
||||
ULONG information_type;
|
||||
} query_device;
|
||||
struct
|
||||
{
|
||||
unsigned int interface_index;
|
||||
unsigned int pipe_id;
|
||||
unsigned int policy_type;
|
||||
} pipe_policy;
|
||||
struct
|
||||
{
|
||||
unsigned int policy_type;
|
||||
} power_policy;
|
||||
|
||||
// WDF_USB_CONTROL_SETUP_PACKET control;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UCHAR RequestType;
|
||||
UCHAR Request;
|
||||
USHORT Value;
|
||||
USHORT Index;
|
||||
USHORT Length;
|
||||
} control;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
constexpr DWORD LIBUSB_IOCTL_GET_VERSION = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x812, METHOD_BUFFERED, FILE_ANY_ACCESS);
|
||||
constexpr DWORD LIBUSB_IOCTL_GET_STATUS = CTL_CODE(FILE_DEVICE_UNKNOWN, 0x807, METHOD_BUFFERED, FILE_ANY_ACCESS);
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
static inline bool libusbk_getInternals(KUSB_HANDLE handle, HANDLE* outMasterHandle=nullptr, HANDLE* outMasterInterfaceHandle=nullptr, LPCSTR* outDevicePath=nullptr, PUSB_CONFIGURATION_DESCRIPTOR* outConfigDescriptor=nullptr)
|
||||
{
|
||||
if (handle == nullptr)
|
||||
return false;
|
||||
|
||||
auto byteHandle = (const unsigned char*)handle;
|
||||
#if !_WIN64
|
||||
memcpy(&byteHandle, &byteHandle[0x1C], sizeof(void*));
|
||||
|
||||
if (outMasterHandle != nullptr)
|
||||
memcpy(outMasterHandle, &byteHandle[0x1C], sizeof(HANDLE));
|
||||
if (outMasterInterfaceHandle != nullptr)
|
||||
memcpy(outMasterInterfaceHandle, &byteHandle[0x20], sizeof(HANDLE));
|
||||
if (outDevicePath != nullptr)
|
||||
memcpy(outDevicePath, &byteHandle[0x24], sizeof(void*));
|
||||
if (outConfigDescriptor != nullptr)
|
||||
memcpy(outConfigDescriptor, &byteHandle[0x28], sizeof(void*));
|
||||
#else
|
||||
memcpy(&byteHandle, &byteHandle[0x30], sizeof(void*));
|
||||
|
||||
if (outMasterHandle != nullptr)
|
||||
memcpy(outMasterHandle, &byteHandle[0x30], sizeof(HANDLE));
|
||||
if (outMasterInterfaceHandle != nullptr)
|
||||
memcpy(outMasterInterfaceHandle, &byteHandle[0x38], sizeof(HANDLE));
|
||||
if (outDevicePath != nullptr)
|
||||
memcpy(outDevicePath, &byteHandle[0x40], sizeof(void*));
|
||||
if (outConfigDescriptor != nullptr)
|
||||
memcpy(outConfigDescriptor, &byteHandle[0x48], sizeof(void*));
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
182
res/BitmapPicture.cpp
Normal file
182
res/BitmapPicture.cpp
Normal file
|
@ -0,0 +1,182 @@
|
|||
// BitmapPicture.cpp : implementation file
|
||||
//
|
||||
// Copyright (c) 1997 Chris Maunder (Chris.Maunder@cbr.clw.csiro.au)
|
||||
// Written 1 December, 1997
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "BitmapPicture.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
// if UPDATE_ENTIRE_CLIENT_AREA is not defined then only the update region of
|
||||
// the bitmap is updated. Otherwise, on each update, the whole client area of
|
||||
// the bitmap is drawn. UPDATE_ENTIRE_CLIENT_AREA is slower, but distortion
|
||||
// of the picture may occur if it is not defined.
|
||||
|
||||
#define UPDATE_ENTIRE_CLIENT_AREA
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBitmapPicture
|
||||
|
||||
CBitmapPicture::CBitmapPicture()
|
||||
{
|
||||
m_hBitmap = NULL;
|
||||
|
||||
m_nResourceID = -1;
|
||||
m_strResourceName.Empty();
|
||||
}
|
||||
|
||||
CBitmapPicture::~CBitmapPicture()
|
||||
{
|
||||
if (m_hBitmap) ::DeleteObject(m_hBitmap);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CBitmapPicture, CStatic)
|
||||
//{{AFX_MSG_MAP(CBitmapPicture)
|
||||
ON_WM_ERASEBKGND()
|
||||
ON_WM_DRAWITEM_REFLECT()
|
||||
ON_WM_SYSCOLORCHANGE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBitmapPicture message handlers
|
||||
|
||||
BOOL CBitmapPicture::SetBitmap(HBITMAP hBitmap)
|
||||
{
|
||||
::DeleteObject(m_hBitmap);
|
||||
m_hBitmap = hBitmap;
|
||||
return ::GetObject(m_hBitmap, sizeof(BITMAP), &m_bmInfo);
|
||||
}
|
||||
|
||||
BOOL CBitmapPicture::SetBitmap(UINT nIDResource)
|
||||
{
|
||||
m_nResourceID = nIDResource;
|
||||
m_strResourceName.Empty();
|
||||
|
||||
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
|
||||
MAKEINTRESOURCE(nIDResource),
|
||||
IMAGE_BITMAP,
|
||||
0,0,
|
||||
LR_LOADMAP3DCOLORS);
|
||||
if (!hBmp) return FALSE;
|
||||
return CBitmapPicture::SetBitmap(hBmp);
|
||||
}
|
||||
|
||||
BOOL CBitmapPicture::SetBitmap(LPCTSTR lpszResourceName)
|
||||
{
|
||||
m_nResourceID = -1;
|
||||
m_strResourceName = lpszResourceName;
|
||||
|
||||
HBITMAP hBmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
|
||||
lpszResourceName,
|
||||
IMAGE_BITMAP,
|
||||
0,0,
|
||||
LR_LOADMAP3DCOLORS);
|
||||
if (!hBmp) return FALSE;
|
||||
return CBitmapPicture::SetBitmap(hBmp);
|
||||
}
|
||||
|
||||
// Suggested by Pål K. Used to reload the bitmap on system colour changes.
|
||||
BOOL CBitmapPicture::ReloadBitmap()
|
||||
{
|
||||
if (m_nResourceID > 0)
|
||||
return SetBitmap(m_nResourceID);
|
||||
else if (!m_strResourceName.IsEmpty())
|
||||
return SetBitmap(m_strResourceName);
|
||||
else // if SetBitmap(HBITMAP hBitmap) was used directly then we can't reload.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CBitmapPicture::PreSubclassWindow()
|
||||
{
|
||||
CStatic::PreSubclassWindow();
|
||||
ModifyStyle(0, SS_OWNERDRAW);
|
||||
}
|
||||
|
||||
BOOL CBitmapPicture::OnEraseBkgnd(CDC* pDC)
|
||||
{
|
||||
CRect rect;
|
||||
GetClientRect(rect);
|
||||
|
||||
// If no bitmap selected, simply erase the background as per normal and return
|
||||
if (!m_hBitmap)
|
||||
{
|
||||
CBrush backBrush(::GetSysColor(COLOR_3DFACE)); // (this is meant for dialogs)
|
||||
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
|
||||
|
||||
pDC->PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
|
||||
pDC->SelectObject(pOldBrush);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// We have a bitmap - draw it.
|
||||
|
||||
// Create compatible memory DC using the controls DC
|
||||
CDC dcMem;
|
||||
VERIFY( dcMem.CreateCompatibleDC(pDC));
|
||||
|
||||
// Select bitmap into memory DC.
|
||||
HBITMAP* pBmpOld = (HBITMAP*) ::SelectObject(dcMem.m_hDC, m_hBitmap);
|
||||
|
||||
// StretchBlt bitmap onto static's client area
|
||||
#ifdef UPDATE_ENTIRE_CLIENT_AREA
|
||||
pDC->StretchBlt(rect.left, rect.top, rect.Width(), rect.Height(),
|
||||
&dcMem, 0, 0, m_bmInfo.bmWidth-1, m_bmInfo.bmHeight-1,
|
||||
SRCCOPY);
|
||||
#else
|
||||
CRect TargetRect; // Region on screen to be updated
|
||||
pDC->GetClipBox(&TargetRect);
|
||||
TargetRect.IntersectRect(TargetRect, rect);
|
||||
|
||||
CRect SrcRect; // Region from bitmap to be painted
|
||||
SrcRect.left = MulDiv(TargetRect.left, m_bmInfo.bmWidth, rect.Width());
|
||||
SrcRect.top = MulDiv(TargetRect.top, m_bmInfo.bmHeight, rect.Height());
|
||||
SrcRect.right = MulDiv(TargetRect.right, m_bmInfo.bmWidth, rect.Width());
|
||||
SrcRect.bottom = MulDiv(TargetRect.bottom, m_bmInfo.bmHeight, rect.Height());
|
||||
|
||||
pDC->StretchBlt(TargetRect.left, TargetRect.top, TargetRect.Width(), TargetRect.Height(),
|
||||
&dcMem,
|
||||
SrcRect.left, SrcRect.top, SrcRect.Width(), SrcRect.Height(),
|
||||
SRCCOPY);
|
||||
#endif
|
||||
|
||||
::SelectObject(dcMem.m_hDC, pBmpOld);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CBitmapPicture::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
|
||||
{
|
||||
ASSERT(lpDrawItemStruct != NULL);
|
||||
|
||||
CString str;
|
||||
GetWindowText(str);
|
||||
if (!str.GetLength()) return;
|
||||
|
||||
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
|
||||
CRect rect = lpDrawItemStruct->rcItem;
|
||||
DWORD dwStyle = GetStyle();
|
||||
int nFormat = DT_NOPREFIX | DT_NOCLIP | DT_WORDBREAK | DT_SINGLELINE;
|
||||
|
||||
if (dwStyle & SS_CENTERIMAGE) nFormat |= DT_VCENTER;
|
||||
if (dwStyle & SS_CENTER) nFormat |= DT_CENTER;
|
||||
else if (dwStyle & SS_RIGHT) nFormat |= DT_RIGHT;
|
||||
else nFormat |= DT_LEFT;
|
||||
|
||||
int nOldMode = pDC->SetBkMode(TRANSPARENT);
|
||||
pDC->DrawText(str, rect, nFormat);
|
||||
pDC->SetBkMode(nOldMode);
|
||||
}
|
||||
|
||||
// Suggested by Pål K. Tønder.
|
||||
void CBitmapPicture::OnSysColorChange()
|
||||
{
|
||||
CStatic::OnSysColorChange();
|
||||
ReloadBitmap();
|
||||
}
|
65
res/BitmapPicture.h
Normal file
65
res/BitmapPicture.h
Normal file
|
@ -0,0 +1,65 @@
|
|||
#if !defined(AFX_BITMAPPICTURE_H__A4BE2021_689E_11D1_ABBA_00A0243D1382__INCLUDED_)
|
||||
#define AFX_BITMAPPICTURE_H__A4BE2021_689E_11D1_ABBA_00A0243D1382__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
|
||||
// BitmapPicture.h : header file
|
||||
//
|
||||
// Copyright (c) Chris Maunder (Chris.Maunder@cbr.clw.csiro.au)
|
||||
// Written 1 December, 1997
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CBitmapPicture window
|
||||
|
||||
class CBitmapPicture : public CStatic
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CBitmapPicture();
|
||||
|
||||
// Operations
|
||||
public:
|
||||
BOOL SetBitmap(HBITMAP hBitmap); // Not recommended
|
||||
BOOL SetBitmap(UINT nIDResource);
|
||||
BOOL SetBitmap(LPCTSTR lpszResourceName);
|
||||
BOOL ReloadBitmap();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CBitmapPicture)
|
||||
protected:
|
||||
virtual void PreSubclassWindow();
|
||||
virtual void DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct );
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CBitmapPicture();
|
||||
|
||||
// Attributes
|
||||
protected:
|
||||
HBITMAP m_hBitmap;
|
||||
BITMAP m_bmInfo;
|
||||
|
||||
private:
|
||||
int m_nResourceID;
|
||||
CString m_strResourceName;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CBitmapPicture)
|
||||
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
||||
afx_msg void OnSysColorChange();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_BITMAPPICTURE_H__A4BE2021_689E_11D1_ABBA_00A0243D1382__INCLUDED_)
|
BIN
res/TegraRcmGUI.ico
Normal file
BIN
res/TegraRcmGUI.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 179 KiB |
BIN
res/TegraRcmGUI.rc2
Normal file
BIN
res/TegraRcmGUI.rc2
Normal file
Binary file not shown.
BIN
res/driver_ko2.bmp
Normal file
BIN
res/driver_ko2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
res/init_logo_2.bmp
Normal file
BIN
res/init_logo_2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
BIN
res/rcm_detected2.bmp
Normal file
BIN
res/rcm_detected2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
res/rcm_undetected2.bmp
Normal file
BIN
res/rcm_undetected2.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
BIN
resource.h
Normal file
BIN
resource.h
Normal file
Binary file not shown.
8
stdafx.cpp
Normal file
8
stdafx.cpp
Normal file
|
@ -0,0 +1,8 @@
|
|||
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// TegraRcmGUI.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
55
stdafx.h
Normal file
55
stdafx.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
#endif
|
||||
|
||||
#include "targetver.h"
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
|
||||
#define _AFX_NO_MFC_CONTROLS_IN_DIALOGS // remove support for MFC controls in dialogs
|
||||
|
||||
// turns off MFC's hiding of some common and often safely ignored warning messages
|
||||
#define _AFX_ALL_WARNINGS
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
|
||||
|
||||
#include <afxdisp.h> // MFC Automation classes
|
||||
|
||||
|
||||
|
||||
#ifndef _AFX_NO_OLE_SUPPORT
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#endif
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxcontrolbars.h> // MFC support for ribbons and control bars
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef _UNICODE
|
||||
#if defined _M_IX86
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#elif defined _M_X64
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#else
|
||||
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
8
targetver.h
Normal file
8
targetver.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <SDKDDKVer.h>
|
Loading…
Reference in a new issue