parent
45cf8726f6
commit
002365e935
|
@ -0,0 +1,60 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 2013
|
||||||
|
VisualStudioVersion = 12.0.40629.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FakeProcess", "FakeProcess\FakeProcess.vcxproj", "{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FakeProcessDll", "FakeProcessDll\FakeProcessDll.vcxproj", "{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test\Test.vcxproj", "{F3F828D8-CF32-4B18-A359-A47519711575}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Release|Mixed Platforms = Release|Mixed Platforms
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}.Release|x64.Build.0 = Release|x64
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}.Release|x64.Build.0 = Release|x64
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Debug|x64.ActiveCfg = Debug|Win32
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Release|Mixed Platforms.ActiveCfg = Release|Win32
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Release|Mixed Platforms.Build.0 = Release|Win32
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{F3F828D8-CF32-4B18-A359-A47519711575}.Release|x64.ActiveCfg = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,102 @@
|
||||||
|
|
||||||
|
// FakeProcess.cpp : 定义应用程序的类行为。
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "FakeProcess.h"
|
||||||
|
#include "FakeProcessDlg.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// CFakeProcessApp
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CFakeProcessApp, CWinApp)
|
||||||
|
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CFakeProcessApp 构造
|
||||||
|
|
||||||
|
CFakeProcessApp::CFakeProcessApp()
|
||||||
|
{
|
||||||
|
// 支持重新启动管理器
|
||||||
|
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||||
|
|
||||||
|
// TODO: 在此处添加构造代码,
|
||||||
|
// 将所有重要的初始化放置在 InitInstance 中
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 唯一的一个 CFakeProcessApp 对象
|
||||||
|
|
||||||
|
CFakeProcessApp theApp;
|
||||||
|
|
||||||
|
|
||||||
|
// CFakeProcessApp 初始化
|
||||||
|
|
||||||
|
BOOL CFakeProcessApp::InitInstance()
|
||||||
|
{
|
||||||
|
// 如果一个运行在 Windows XP 上的应用程序清单指定要
|
||||||
|
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
|
||||||
|
//则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
|
||||||
|
INITCOMMONCONTROLSEX InitCtrls;
|
||||||
|
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||||
|
// 将它设置为包括所有要在应用程序中使用的
|
||||||
|
// 公共控件类。
|
||||||
|
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||||
|
InitCommonControlsEx(&InitCtrls);
|
||||||
|
|
||||||
|
CWinApp::InitInstance();
|
||||||
|
|
||||||
|
|
||||||
|
AfxEnableControlContainer();
|
||||||
|
|
||||||
|
// 创建 shell 管理器,以防对话框包含
|
||||||
|
// 任何 shell 树视图控件或 shell 列表视图控件。
|
||||||
|
CShellManager *pShellManager = new CShellManager;
|
||||||
|
|
||||||
|
// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
|
||||||
|
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
||||||
|
|
||||||
|
// 标准初始化
|
||||||
|
// 如果未使用这些功能并希望减小
|
||||||
|
// 最终可执行文件的大小,则应移除下列
|
||||||
|
// 不需要的特定初始化例程
|
||||||
|
// 更改用于存储设置的注册表项
|
||||||
|
// TODO: 应适当修改该字符串,
|
||||||
|
// 例如修改为公司或组织名
|
||||||
|
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
|
||||||
|
|
||||||
|
CFakeProcessDlg dlg;
|
||||||
|
m_pMainWnd = &dlg;
|
||||||
|
INT_PTR nResponse = dlg.DoModal();
|
||||||
|
if (nResponse == IDOK)
|
||||||
|
{
|
||||||
|
// TODO: 在此放置处理何时用
|
||||||
|
// “确定”来关闭对话框的代码
|
||||||
|
}
|
||||||
|
else if (nResponse == IDCANCEL)
|
||||||
|
{
|
||||||
|
// TODO: 在此放置处理何时用
|
||||||
|
// “取消”来关闭对话框的代码
|
||||||
|
}
|
||||||
|
else if (nResponse == -1)
|
||||||
|
{
|
||||||
|
TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
|
||||||
|
TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除上面创建的 shell 管理器。
|
||||||
|
if (pShellManager != NULL)
|
||||||
|
{
|
||||||
|
delete pShellManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
|
||||||
|
// 而不是启动应用程序的消息泵。
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
// FakeProcess.h : PROJECT_NAME 应用程序的主头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __AFXWIN_H__
|
||||||
|
#error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "resource.h" // 主符号
|
||||||
|
|
||||||
|
|
||||||
|
// CFakeProcessApp:
|
||||||
|
// 有关此类的实现,请参阅 FakeProcess.cpp
|
||||||
|
//
|
||||||
|
|
||||||
|
class CFakeProcessApp : public CWinApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CFakeProcessApp();
|
||||||
|
|
||||||
|
// 重写
|
||||||
|
public:
|
||||||
|
virtual BOOL InitInstance();
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CFakeProcessApp theApp;
|
Binary file not shown.
|
@ -0,0 +1,223 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="12.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="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{A1F73AD5-B903-4B9C-83F8-D4C49C62183D}</ProjectGuid>
|
||||||
|
<RootNamespace>FakeProcess</RootNamespace>
|
||||||
|
<Keyword>MFCProj</Keyword>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</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 Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<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 Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<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>NotUsing</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_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>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</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>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</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>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="FakeProcess.h" />
|
||||||
|
<ClInclude Include="FakeProcessDlg.h" />
|
||||||
|
<ClInclude Include="ProcessDlg.h" />
|
||||||
|
<ClInclude Include="Resource.h" />
|
||||||
|
<ClInclude Include="stdafx.h" />
|
||||||
|
<ClInclude Include="targetver.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="FakeProcess.cpp" />
|
||||||
|
<ClCompile Include="FakeProcessDlg.cpp" />
|
||||||
|
<ClCompile Include="ProcessDlg.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>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="FakeProcess.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\FakeProcess.rc2" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\demon64X64.ico" />
|
||||||
|
<Image Include="res\FakeProcess.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
<ProjectExtensions>
|
||||||
|
<VisualStudio>
|
||||||
|
<UserProperties RESOURCE_FILE="FakeProcess.rc" />
|
||||||
|
</VisualStudio>
|
||||||
|
</ProjectExtensions>
|
||||||
|
</Project>
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="源文件">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="头文件">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="资源文件">
|
||||||
|
<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="FakeProcess.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="FakeProcessDlg.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="stdafx.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="targetver.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Resource.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ProcessDlg.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="FakeProcess.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="stdafx.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="FakeProcessDlg.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="ProcessDlg.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="FakeProcess.rc">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\FakeProcess.rc2">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\FakeProcess.ico">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</Image>
|
||||||
|
<Image Include="res\demon64X64.ico">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,230 @@
|
||||||
|
|
||||||
|
// FakeProcessDlg.cpp : 实现文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "FakeProcess.h"
|
||||||
|
#include "FakeProcessDlg.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
|
||||||
|
|
||||||
|
class CAboutDlg : public CDialogEx
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAboutDlg();
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
enum { IDD = IDD_ABOUTBOX };
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
protected:
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialogEx::DoDataExchange(pDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CFakeProcessDlg 对话框
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CFakeProcessDlg::CFakeProcessDlg(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialogEx(CFakeProcessDlg::IDD, pParent)
|
||||||
|
{
|
||||||
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFakeProcessDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialogEx::DoDataExchange(pDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CFakeProcessDlg, CDialogEx)
|
||||||
|
ON_WM_SYSCOMMAND()
|
||||||
|
ON_WM_PAINT()
|
||||||
|
ON_WM_QUERYDRAGICON()
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_FAKE, &CFakeProcessDlg::OnBnClickedButtonFake)
|
||||||
|
ON_BN_CLICKED(IDC_BUTTON_PROCESS, &CFakeProcessDlg::OnBnClickedButtonProcess)
|
||||||
|
ON_COMMAND(ID_HELP_ABOUT, &CFakeProcessDlg::OnHelpAbout)
|
||||||
|
ON_COMMAND(IDOK, &CFakeProcessDlg::OnIdok)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CFakeProcessDlg 消息处理程序
|
||||||
|
|
||||||
|
BOOL CFakeProcessDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialogEx::OnInitDialog();
|
||||||
|
|
||||||
|
// 将“关于...”菜单项添加到系统菜单中。
|
||||||
|
|
||||||
|
// IDM_ABOUTBOX 必须在系统命令范围内。
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
|
||||||
|
// 执行此操作
|
||||||
|
SetIcon(m_hIcon, TRUE); // 设置大图标
|
||||||
|
SetIcon(m_hIcon, FALSE); // 设置小图标
|
||||||
|
|
||||||
|
// TODO: 在此添加额外的初始化代码
|
||||||
|
|
||||||
|
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFakeProcessDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||||
|
{
|
||||||
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
||||||
|
{
|
||||||
|
CAboutDlg dlgAbout;
|
||||||
|
dlgAbout.DoModal();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CDialogEx::OnSysCommand(nID, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果向对话框添加最小化按钮,则需要下面的代码
|
||||||
|
// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
|
||||||
|
// 这将由框架自动完成。
|
||||||
|
|
||||||
|
void CFakeProcessDlg::OnPaint()
|
||||||
|
{
|
||||||
|
if (IsIconic())
|
||||||
|
{
|
||||||
|
CPaintDC dc(this); // 用于绘制的设备上下文
|
||||||
|
|
||||||
|
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
||||||
|
|
||||||
|
// 使图标在工作区矩形中居中
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 绘制图标
|
||||||
|
dc.DrawIcon(x, y, m_hIcon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CDialogEx::OnPaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//当用户拖动最小化窗口时系统调用此函数取得光标
|
||||||
|
//显示。
|
||||||
|
HCURSOR CFakeProcessDlg::OnQueryDragIcon()
|
||||||
|
{
|
||||||
|
return static_cast<HCURSOR>(m_hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CFakeProcessDlg::OnHelpAbout()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加命令处理程序代码
|
||||||
|
CAboutDlg dlg;
|
||||||
|
dlg.DoModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CFakeProcessDlg::OnIdok()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加命令处理程序代码
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CFakeProcessDlg::OnBnClickedButtonFake()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
TCHAR szPath[MAX_PATH] = {0};
|
||||||
|
TCHAR szCmd[MAX_PATH] = { 0 };
|
||||||
|
HWND hPathWnd = ::GetDlgItem(m_hWnd, IDC_EDIT_PATH);
|
||||||
|
HWND hCmdWnd = ::GetDlgItem(m_hWnd, IDC_EDIT_CMD);
|
||||||
|
::GetWindowText(hPathWnd, szPath, MAX_PATH);
|
||||||
|
::GetWindowText(hCmdWnd, szCmd, MAX_PATH);
|
||||||
|
|
||||||
|
TCHAR szDllName[MAX_PATH] = L"FakeProcessDll.dll";
|
||||||
|
HMODULE hModule = ::LoadLibrary(szDllName);
|
||||||
|
if (NULL == hModule)
|
||||||
|
{
|
||||||
|
::MessageBox(NULL, L"LoadLibrary Error!", NULL, MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
typedef void(*_FAKE)(DWORD dwPID, TCHAR *lpszPath, TCHAR *lpszCmd);
|
||||||
|
_FAKE Fake = (_FAKE)::GetProcAddress(hModule, "Fake");
|
||||||
|
if (Fake)
|
||||||
|
{
|
||||||
|
Fake(m_dwPID, szPath, szCmd);
|
||||||
|
::MessageBox(NULL, L"Fake OK.", L"DONE", MB_OK | MB_ICONWARNING);
|
||||||
|
// 伪装自身进程
|
||||||
|
// Fake(0, L"C:\\Windows\\explorer.exe", L"explorer.exe");
|
||||||
|
// Fake(GetCurrentProcessId(), L"C:\\Windows\\explorer.exe", L"explorer.exe");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
::MessageBox(NULL, L"GetProcAddress Error!", NULL, MB_OK);
|
||||||
|
}
|
||||||
|
// ::FreeLibrary(hModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CFakeProcessDlg::OnBnClickedButtonProcess()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
CProcessDlg dlg;
|
||||||
|
if (IDOK == dlg.DoModal())
|
||||||
|
{
|
||||||
|
TCHAR szText[MAX_PATH] = { 0 };
|
||||||
|
HWND hWnd = ::GetDlgItem(m_hWnd, IDC_EDIT_PROCESS);
|
||||||
|
::wsprintf(szText, L"[%s]%s", dlg.m_szPID, dlg.m_szName);
|
||||||
|
::SetWindowText(hWnd, szText);
|
||||||
|
|
||||||
|
HWND hPathWnd = ::GetDlgItem(m_hWnd, IDC_EDIT_PATH);
|
||||||
|
HWND hCmdWnd = ::GetDlgItem(m_hWnd, IDC_EDIT_CMD);
|
||||||
|
HWND hFakeWnd = ::GetDlgItem(m_hWnd, IDC_BUTTON_FAKE);
|
||||||
|
::EnableWindow(hPathWnd, TRUE);
|
||||||
|
::EnableWindow(hCmdWnd, TRUE);
|
||||||
|
::EnableWindow(hFakeWnd, TRUE);
|
||||||
|
|
||||||
|
m_dwPID = _wtoi(dlg.m_szPID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
// FakeProcessDlg.h : 头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "ProcessDlg.h"
|
||||||
|
|
||||||
|
|
||||||
|
// CFakeProcessDlg 对话框
|
||||||
|
class CFakeProcessDlg : public CDialogEx
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DWORD m_dwPID;
|
||||||
|
// 构造
|
||||||
|
public:
|
||||||
|
CFakeProcessDlg(CWnd* pParent = NULL); // 标准构造函数
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
enum { IDD = IDD_FAKEPROCESS_DIALOG };
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
protected:
|
||||||
|
HICON m_hIcon;
|
||||||
|
|
||||||
|
// 生成的消息映射函数
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
||||||
|
afx_msg void OnPaint();
|
||||||
|
afx_msg HCURSOR OnQueryDragIcon();
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
public:
|
||||||
|
afx_msg void OnBnClickedButtonFake();
|
||||||
|
afx_msg void OnBnClickedButtonProcess();
|
||||||
|
afx_msg void OnHelpAbout();
|
||||||
|
afx_msg void OnIdok();
|
||||||
|
};
|
|
@ -0,0 +1,114 @@
|
||||||
|
// ProcessDlg.cpp : 实现文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "FakeProcess.h"
|
||||||
|
#include "ProcessDlg.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
|
||||||
|
|
||||||
|
// CProcessDlg 对话框
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC(CProcessDlg, CDialogEx)
|
||||||
|
|
||||||
|
CProcessDlg::CProcessDlg(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialogEx(CProcessDlg::IDD, pParent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CProcessDlg::~CProcessDlg()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProcessDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialogEx::DoDataExchange(pDX);
|
||||||
|
DDX_Control(pDX, IDC_LIST_PROCESS, m_ProcessInfoList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CProcessDlg, CDialogEx)
|
||||||
|
ON_NOTIFY(NM_DBLCLK, IDC_LIST_PROCESS, &CProcessDlg::OnDblclkListProcess)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CProcessDlg 消息处理程序
|
||||||
|
|
||||||
|
|
||||||
|
BOOL CProcessDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialogEx::OnInitDialog();
|
||||||
|
|
||||||
|
// TODO: 在此添加额外的初始化
|
||||||
|
InitListCtrl();
|
||||||
|
RefreshProcessInfo();
|
||||||
|
|
||||||
|
return TRUE; // return TRUE unless you set the focus to a control
|
||||||
|
// 异常: OCX 属性页应返回 FALSE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CProcessDlg::InitListCtrl()
|
||||||
|
{
|
||||||
|
// 初始化列表控件
|
||||||
|
m_ProcessInfoList.InsertColumn(0, L"Name", 0, 200);
|
||||||
|
m_ProcessInfoList.InsertColumn(1, L"PID", 0, 80);
|
||||||
|
m_ProcessInfoList.SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
|
||||||
|
m_ProcessInfoList.SetTextColor(RGB(0, 100, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CProcessDlg::RefreshProcessInfo()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
m_ProcessInfoList.DeleteAllItems();
|
||||||
|
PROCESSENTRY32 pe32 = { 0 };
|
||||||
|
pe32.dwSize = sizeof(PROCESSENTRY32);
|
||||||
|
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
|
||||||
|
if (INVALID_HANDLE_VALUE == hProcessSnap)
|
||||||
|
{
|
||||||
|
::MessageBox(NULL, L"创建进程快照失败!", L"错误", MB_OK);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BOOL bMore = ::Process32First(hProcessSnap, &pe32);
|
||||||
|
int iIndex = 0;
|
||||||
|
CString str;
|
||||||
|
while (bMore)
|
||||||
|
{
|
||||||
|
str.Format(L"%s", pe32.szExeFile);
|
||||||
|
m_ProcessInfoList.InsertItem(iIndex, str);
|
||||||
|
str.Format(L"%d", pe32.th32ProcessID);
|
||||||
|
m_ProcessInfoList.SetItemText(iIndex, 1, str);
|
||||||
|
|
||||||
|
bMore = ::Process32Next(hProcessSnap, &pe32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CProcessDlg::OnDblclkListProcess(NMHDR *pNMHDR, LRESULT *pResult)
|
||||||
|
{
|
||||||
|
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast<LPNMITEMACTIVATE>(pNMHDR);
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
// 获取选中的行
|
||||||
|
int iCurSel = 0, iCount = m_ProcessInfoList.GetItemCount();
|
||||||
|
for (iCurSel = 0; iCurSel < iCount; iCurSel++)
|
||||||
|
{
|
||||||
|
if (LVIS_SELECTED == m_ProcessInfoList.GetItemState(iCurSel, LVIS_SELECTED))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (iCurSel >= iCount)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获取选中行的信息
|
||||||
|
// TCHAR szName[MAX_PATH] = { 0 };
|
||||||
|
// TCHAR szPID[MAX_PATH] = { 0 };
|
||||||
|
m_ProcessInfoList.GetItemText(iCurSel, 0, m_szName, MAX_PATH);
|
||||||
|
m_ProcessInfoList.GetItemText(iCurSel, 1, m_szPID, MAX_PATH);
|
||||||
|
|
||||||
|
CDialog::OnOK();
|
||||||
|
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
#pragma once
|
||||||
|
#include "afxcmn.h"
|
||||||
|
|
||||||
|
#include <Tlhelp32.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// CProcessDlg 对话框
|
||||||
|
|
||||||
|
class CProcessDlg : public CDialogEx
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC(CProcessDlg)
|
||||||
|
private:
|
||||||
|
void InitListCtrl();
|
||||||
|
void RefreshProcessInfo();
|
||||||
|
public:
|
||||||
|
TCHAR m_szName[MAX_PATH];
|
||||||
|
TCHAR m_szPID[MAX_PATH];
|
||||||
|
public:
|
||||||
|
CProcessDlg(CWnd* pParent = NULL); // 标准构造函数
|
||||||
|
virtual ~CProcessDlg();
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
enum { IDD = IDD_DIALOG1 };
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
public:
|
||||||
|
CListCtrl m_ProcessInfoList;
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnDblclkListProcess(NMHDR *pNMHDR, LRESULT *pResult);
|
||||||
|
};
|
|
@ -0,0 +1,70 @@
|
||||||
|
================================================================================
|
||||||
|
MICROSOFT 基础类库 : FakeProcess 项目概述
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
应用程序向导已为您创建了此 FakeProcess 应用程序。此应用程序不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写应用程序的起点。
|
||||||
|
|
||||||
|
本文件概要介绍组成 FakeProcess 应用程序的每个文件的内容。
|
||||||
|
|
||||||
|
FakeProcess.vcxproj
|
||||||
|
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
|
||||||
|
|
||||||
|
FakeProcess.vcxproj.filters
|
||||||
|
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
|
||||||
|
|
||||||
|
FakeProcess.h
|
||||||
|
这是应用程序的主头文件。
|
||||||
|
其中包括其他项目特定的标头(包括 Resource.h),并声明 CFakeProcessApp 应用程序类。
|
||||||
|
|
||||||
|
FakeProcess.cpp
|
||||||
|
这是包含应用程序类 CFakeProcessApp 的主应用程序源文件。
|
||||||
|
|
||||||
|
FakeProcess.rc
|
||||||
|
这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。项目资源包含在 2052 中。
|
||||||
|
|
||||||
|
res\FakeProcess.ico
|
||||||
|
这是用作应用程序图标的图标文件。此图标包括在主资源文件 FakeProcess.rc 中。
|
||||||
|
|
||||||
|
res\FakeProcess.rc2
|
||||||
|
此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
应用程序向导创建一个对话框类:
|
||||||
|
|
||||||
|
FakeProcessDlg.h、FakeProcessDlg.cpp - 对话框
|
||||||
|
这些文件包含 CFakeProcessDlg 类。此类定义应用程序的主对话框的行为。对话框模板包含在 FakeProcess.rc 中,该文件可以在 Microsoft Visual C++ 中编辑。
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
其他功能:
|
||||||
|
|
||||||
|
ActiveX 控件
|
||||||
|
该应用程序包含对使用 ActiveX 控件的支持。
|
||||||
|
|
||||||
|
打印和打印预览支持
|
||||||
|
应用程序向导通过从 MFC 库调用 CView 类中的成员函数生成代码,来处理打印、打印设置和打印预览命令。
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
其他标准文件:
|
||||||
|
|
||||||
|
StdAfx.h, StdAfx.cpp
|
||||||
|
这些文件用于生成名为 FakeProcess.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
|
||||||
|
|
||||||
|
Resource.h
|
||||||
|
这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。
|
||||||
|
|
||||||
|
FakeProcess.manifest
|
||||||
|
Windows XP 使用应用程序清单文件来描述特定版本的并行程序集的应用程序依赖项。加载程序使用这些信息来从程序集缓存中加载相应的程序集,并保护其不被应用程序访问。应用程序清单可能会包含在内,以作为与应用程序可执行文件安装在同一文件夹中的外部 .manifest 文件进行重新分发,它还可能以资源的形式包含在可执行文件中。
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
其他注释:
|
||||||
|
|
||||||
|
应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。
|
||||||
|
|
||||||
|
如果应用程序使用共享 DLL 中的 MFC,您将需要重新分发 MFC DLL。如果应用程序所使用的语言与操作系统的区域设置不同,则还需要重新分发相应的本地化资源 mfc110XXX.DLL。
|
||||||
|
有关上述话题的更多信息,请参见 MSDN 文档中有关重新分发 Visual C++ 应用程序的部分。
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||||
|
// FakeProcess.pch 将作为预编译头
|
||||||
|
// stdafx.obj 将包含预编译类型信息
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
|
||||||
|
// stdafx.h : 标准系统包含文件的包含文件,
|
||||||
|
// 或是经常使用但不常更改的
|
||||||
|
// 特定于项目的包含文件
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef VC_EXTRALEAN
|
||||||
|
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "targetver.h"
|
||||||
|
|
||||||
|
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
|
||||||
|
|
||||||
|
// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
|
||||||
|
#define _AFX_ALL_WARNINGS
|
||||||
|
|
||||||
|
#include <afxwin.h> // MFC 核心组件和标准组件
|
||||||
|
#include <afxext.h> // MFC 扩展
|
||||||
|
|
||||||
|
|
||||||
|
#include <afxdisp.h> // MFC 自动化类
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _AFX_NO_OLE_SUPPORT
|
||||||
|
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
|
||||||
|
#endif
|
||||||
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
|
||||||
|
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
|
||||||
|
#include <afxcontrolbars.h> // 功能区和控件条的 MFC 支持
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// 包括 SDKDDKVer.h 将定义最高版本的可用 Windows 平台。
|
||||||
|
|
||||||
|
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||||
|
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||||
|
|
||||||
|
#include <SDKDDKVer.h>
|
|
@ -0,0 +1,29 @@
|
||||||
|
// FakeProcessDll.cpp : 定义 DLL 应用程序的导出函数。
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "MyFake.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
注意不使用预编译头:
|
||||||
|
C++ -> 预编译头 -> 不适用预编译头
|
||||||
|
*/
|
||||||
|
|
||||||
|
void Fake(DWORD dwPID, TCHAR *lpszPath, TCHAR *lpszCmd)
|
||||||
|
{
|
||||||
|
if (0 == dwPID)
|
||||||
|
{
|
||||||
|
// FakeCurrentProcess(lpszPath, lpszCmd);
|
||||||
|
FakeOtherProcess(GetCurrentProcessId(), lpszPath, lpszCmd);
|
||||||
|
}
|
||||||
|
else if (0 < dwPID)
|
||||||
|
{
|
||||||
|
FakeOtherProcess(dwPID, lpszPath, lpszCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
注意不使用预编译头:
|
||||||
|
C++ -> 预编译头 -> 不适用预编译头
|
||||||
|
*/
|
|
@ -0,0 +1,5 @@
|
||||||
|
LIBRARY
|
||||||
|
|
||||||
|
|
||||||
|
EXPORTS
|
||||||
|
Fake
|
|
@ -0,0 +1,184 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="12.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="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{5696D330-BD35-4AF3-AD7B-4F8EB05A8D2D}</ProjectGuid>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<RootNamespace>FakeProcessDll</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</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 Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||||
|
<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 Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||||
|
<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>NotUsing</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FAKEPROCESSDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<ModuleDefinitionFile>FakeProcessDll.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FAKEPROCESSDLL_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<ModuleDefinitionFile>FakeProcessDll.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
</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;NDEBUG;_WINDOWS;_USRDLL;FAKEPROCESSDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<ModuleDefinitionFile>FakeProcessDll.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FAKEPROCESSDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<ModuleDefinitionFile>FakeProcessDll.def</ModuleDefinitionFile>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="MyFake.h" />
|
||||||
|
<ClInclude Include="ntos.h" />
|
||||||
|
<ClInclude Include="stdafx.h" />
|
||||||
|
<ClInclude Include="targetver.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="dllmain.cpp">
|
||||||
|
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
|
||||||
|
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</CompileAsManaged>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</CompileAsManaged>
|
||||||
|
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</CompileAsManaged>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="FakeProcessDll.c" />
|
||||||
|
<ClCompile Include="MyFake.c" />
|
||||||
|
<ClCompile Include="stdafx.c">
|
||||||
|
<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>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="FakeProcessDll.def" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="源文件">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="头文件">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="资源文件">
|
||||||
|
<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="stdafx.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="targetver.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="MyFake.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="ntos.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="dllmain.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="MyFake.c">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="FakeProcessDll.c">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="stdafx.c">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="FakeProcessDll.def">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,105 @@
|
||||||
|
|
||||||
|
#include "MyFake.h"
|
||||||
|
#include "ntos.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef NTSTATUS(__stdcall *pfnNtQueryInformationProcess) (HANDLE ProcessHandle, ULONG ProcessInformationClass,
|
||||||
|
PVOID ProcessInformation, UINT32 ProcessInformationLength, UINT32* ReturnLength);
|
||||||
|
|
||||||
|
typedef NTSTATUS(__stdcall *pfnNtReadVirtualMemory) (HANDLE ProcessHandle, PVOID BaseAddress,
|
||||||
|
PVOID BufferData, UINT64 BufferLength, PUINT64 ReturnLength);
|
||||||
|
|
||||||
|
typedef NTSTATUS(__stdcall *pfnNtWriteVirtualMemory) (HANDLE ProcessHandle, PVOID BaseAddress,
|
||||||
|
PVOID BufferData, UINT64 BufferLength, PUINT64 ReturnLength);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ShowError(TCHAR *lpszText)
|
||||||
|
{
|
||||||
|
TCHAR szErr[MAX_PATH] = {0};
|
||||||
|
wsprintf(szErr, L"%ls Error!\n Error Code Is:\n", lpszText, GetLastError());
|
||||||
|
MessageBox(NULL, szErr, NULL, MB_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FakeCurrentProcess(TCHAR *szPath, TCHAR *lpszCmd)
|
||||||
|
{
|
||||||
|
PPEB peb = NtCurrentPeb();
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
RtlInitUnicodeString(&peb->ProcessParameters->CommandLine, lpszCmd);
|
||||||
|
RtlInitUnicodeString(&peb->ProcessParameters->ImagePathName, szPath);
|
||||||
|
TCHAR *lpszTemp = wcsrchr(szPath, L'\\');
|
||||||
|
lpszTemp[0] = L'\0';
|
||||||
|
lpszTemp[1] = L'\0';
|
||||||
|
RtlInitUnicodeString(&peb->ProcessParameters->CurrentDirectory.DosPath, szPath);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL FakeOtherProcess(DWORD dwPID, TCHAR *lpszPath, TCHAR *lpszCmd)
|
||||||
|
{
|
||||||
|
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwPID);
|
||||||
|
if (NULL == hProcess)
|
||||||
|
{
|
||||||
|
ShowError(L"OpenProcess");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pfnNtQueryInformationProcess NtQueryInformationProcess = (pfnNtQueryInformationProcess)GetProcAddress(GetModuleHandle(L"ntdll.dll"), "NtQueryInformationProcess");
|
||||||
|
if (NULL == NtQueryInformationProcess)
|
||||||
|
{
|
||||||
|
ShowError(L"GetProcAddress");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
PROCESS_BASIC_INFORMATION pbi = {0};
|
||||||
|
NTSTATUS status = NtQueryInformationProcess(hProcess, 0, &pbi, sizeof(pbi), NULL);
|
||||||
|
if (!NT_SUCCESS(status))
|
||||||
|
{
|
||||||
|
ShowError(L"NtWow64QueryInformationProcess64");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
注意在读写其他进程的时候,注意要使用ReadProcessMemory/WriteProcessMemory进行操作,
|
||||||
|
每个指针指向的内容都需要获取,因为指针只能指向本进程的地址空间,必须要读取到本进程空间。
|
||||||
|
要不然一直提示位置访问错误!
|
||||||
|
*/
|
||||||
|
// 获取其他进程地址空间指针指向的数据内容:PEB, RTL_USER_PROCESS_PARAMETERS
|
||||||
|
PEB peb = {0};
|
||||||
|
ReadProcessMemory(hProcess, pbi.PebBaseAddress, &peb, sizeof(peb), NULL);
|
||||||
|
RTL_USER_PROCESS_PARAMETERS Param = {0};
|
||||||
|
ReadProcessMemory(hProcess, peb.ProcessParameters, &Param, sizeof(Param), NULL);
|
||||||
|
|
||||||
|
// 显示
|
||||||
|
// TCHAR szCmd[MAX_PATH] = { 0 }, szName[MAX_PATH] = { 0 }, szDirec[MAX_PATH] = { 0 };
|
||||||
|
// ReadProcessMemory(hProcess, Param.CommandLine.Buffer, szCmd, MAX_PATH, NULL);
|
||||||
|
// ReadProcessMemory(hProcess, Param.ImagePathName.Buffer, szName, MAX_PATH, NULL);
|
||||||
|
// ReadProcessMemory(hProcess, Param.CurrentDirectory.DosPath.Buffer, szDirec, MAX_PATH, NULL);
|
||||||
|
// MessageBox(NULL,szCmd, L"CMD", MB_OK);
|
||||||
|
// MessageBox(NULL, szName, L"FullName", MB_OK);
|
||||||
|
// MessageBox(NULL, szDirec, L"Direc", MB_OK);
|
||||||
|
|
||||||
|
// 修改
|
||||||
|
WriteProcessMemory(hProcess, Param.CommandLine.Buffer, lpszCmd, (2 + 2 * wcslen(lpszCmd)), NULL);
|
||||||
|
Param.CommandLine.Length = (2 + 2 * wcslen(lpszCmd));
|
||||||
|
WriteProcessMemory(hProcess, Param.ImagePathName.Buffer, lpszPath, (2 + 2 * wcslen(lpszPath)), NULL);
|
||||||
|
Param.ImagePathName.Length = (2 + 2 * wcslen(lpszPath));
|
||||||
|
TCHAR szPath[MAX_PATH] = {0};
|
||||||
|
wcscpy_s(szPath, _countof(szPath), lpszPath);
|
||||||
|
wchar_t *lpszTemp = wcsrchr(szPath, L'\\');
|
||||||
|
lpszTemp[0] = L'\0';
|
||||||
|
lpszTemp[1] = L'\0';
|
||||||
|
WriteProcessMemory(hProcess, Param.CurrentDirectory.DosPath.Buffer, szPath, (2 + 2 * wcslen(szPath)), NULL);
|
||||||
|
Param.CurrentDirectory.DosPath.Length = (2 + 2 * wcslen(szPath));
|
||||||
|
|
||||||
|
// 显示
|
||||||
|
// ReadProcessMemory(hProcess, Param.CommandLine.Buffer, szCmd, MAX_PATH, NULL);
|
||||||
|
// ReadProcessMemory(hProcess, Param.ImagePathName.Buffer, szName, MAX_PATH, NULL);
|
||||||
|
// ReadProcessMemory(hProcess, Param.CurrentDirectory.DosPath.Buffer, szDirec, MAX_PATH, NULL);
|
||||||
|
// MessageBox(NULL, szCmd, L"CMD", MB_OK);
|
||||||
|
// MessageBox(NULL, szName, L"FullName", MB_OK);
|
||||||
|
// MessageBox(NULL, szDirec, L"Direc", MB_OK);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include <Windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
void ShowError(TCHAR *lpszText);
|
||||||
|
BOOL FakeCurrentProcess(TCHAR *lpszPath, TCHAR *lpszCmd);
|
||||||
|
BOOL FakeOtherProcess(DWORD dwPID, TCHAR *lpszPath, TCHAR *lpszCmd);
|
|
@ -0,0 +1,32 @@
|
||||||
|
========================================================================
|
||||||
|
动态链接库:FakeProcessDll 项目概述
|
||||||
|
========================================================================
|
||||||
|
|
||||||
|
应用程序向导已为您创建了此 FakeProcessDll DLL。
|
||||||
|
|
||||||
|
本文件概要介绍组成 FakeProcessDll 应用程序的每个文件的内容。
|
||||||
|
|
||||||
|
|
||||||
|
FakeProcessDll.vcxproj
|
||||||
|
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
|
||||||
|
|
||||||
|
FakeProcessDll.vcxproj.filters
|
||||||
|
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
|
||||||
|
|
||||||
|
FakeProcessDll.cpp
|
||||||
|
这是主 DLL 源文件。
|
||||||
|
|
||||||
|
此 DLL 在创建时不导出任何符号。因此,生成时不会产生 .lib 文件。如果希望此项目成为其他某个项目的项目依赖项,则需要添加代码以从 DLL 导出某些符号,以便产生一个导出库,或者,也可以在项目“属性页”对话框中的“链接器”文件夹中,将“常规”属性页上的“忽略输入库”属性设置为“是”。
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
其他标准文件:
|
||||||
|
|
||||||
|
StdAfx.h, StdAfx.cpp
|
||||||
|
这些文件用于生成名为 FakeProcessDll.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
其他注释:
|
||||||
|
|
||||||
|
应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,19 @@
|
||||||
|
// dllmain.cpp : 定义 DLL 应用程序的入口点。
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||||
|
DWORD ul_reason_for_call,
|
||||||
|
LPVOID lpReserved
|
||||||
|
)
|
||||||
|
{
|
||||||
|
switch (ul_reason_for_call)
|
||||||
|
{
|
||||||
|
case DLL_PROCESS_ATTACH:
|
||||||
|
case DLL_THREAD_ATTACH:
|
||||||
|
case DLL_THREAD_DETACH:
|
||||||
|
case DLL_PROCESS_DETACH:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,8 @@
|
||||||
|
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||||
|
// FakeProcessDll.pch 将作为预编译头
|
||||||
|
// stdafx.obj 将包含预编译类型信息
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
// TODO: 在 STDAFX.H 中
|
||||||
|
// 引用任何所需的附加头文件,而不是在此文件中引用
|
|
@ -0,0 +1,16 @@
|
||||||
|
// stdafx.h : 标准系统包含文件的包含文件,
|
||||||
|
// 或是经常使用但不常更改的
|
||||||
|
// 特定于项目的包含文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "targetver.h"
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的信息
|
||||||
|
// Windows 头文件:
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: 在此处引用程序需要的其他头文件
|
|
@ -0,0 +1,8 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
|
||||||
|
|
||||||
|
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||||
|
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||||
|
|
||||||
|
#include <SDKDDKVer.h>
|
|
@ -0,0 +1,67 @@
|
||||||
|
================================================================================
|
||||||
|
MICROSOFT 基础类库 : Test 项目概述
|
||||||
|
===============================================================================
|
||||||
|
|
||||||
|
应用程序向导已为您创建了此 Test 应用程序。此应用程序不仅演示 Microsoft 基础类的基本使用方法,还可作为您编写应用程序的起点。
|
||||||
|
|
||||||
|
本文件概要介绍组成 Test 应用程序的每个文件的内容。
|
||||||
|
|
||||||
|
Test.vcxproj
|
||||||
|
这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
|
||||||
|
|
||||||
|
Test.vcxproj.filters
|
||||||
|
这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。
|
||||||
|
|
||||||
|
Test.h
|
||||||
|
这是应用程序的主头文件。
|
||||||
|
其中包括其他项目特定的标头(包括 Resource.h),并声明 CTestApp 应用程序类。
|
||||||
|
|
||||||
|
Test.cpp
|
||||||
|
这是包含应用程序类 CTestApp 的主应用程序源文件。
|
||||||
|
|
||||||
|
Test.rc
|
||||||
|
这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。此文件可以直接在 Microsoft Visual C++ 中进行编辑。项目资源包含在 2052 中。
|
||||||
|
|
||||||
|
res\Test.ico
|
||||||
|
这是用作应用程序图标的图标文件。此图标包括在主资源文件 Test.rc 中。
|
||||||
|
|
||||||
|
res\Test.rc2
|
||||||
|
此文件包含不在 Microsoft Visual C++ 中进行编辑的资源。您应该将不可由资源编辑器编辑的所有资源放在此文件中。
|
||||||
|
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
应用程序向导创建一个对话框类:
|
||||||
|
|
||||||
|
TestDlg.h、TestDlg.cpp - 对话框
|
||||||
|
这些文件包含 CTestDlg 类。此类定义应用程序的主对话框的行为。对话框模板包含在 Test.rc 中,该文件可以在 Microsoft Visual C++ 中编辑。
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
其他功能:
|
||||||
|
|
||||||
|
ActiveX 控件
|
||||||
|
该应用程序包含对使用 ActiveX 控件的支持。
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
其他标准文件:
|
||||||
|
|
||||||
|
StdAfx.h, StdAfx.cpp
|
||||||
|
这些文件用于生成名为 Test.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
|
||||||
|
|
||||||
|
Resource.h
|
||||||
|
这是标准头文件,可用于定义新的资源 ID。Microsoft Visual C++ 将读取并更新此文件。
|
||||||
|
|
||||||
|
Test.manifest
|
||||||
|
Windows XP 使用应用程序清单文件来描述特定版本的并行程序集的应用程序依赖项。加载程序使用这些信息来从程序集缓存中加载相应的程序集,并保护其不被应用程序访问。应用程序清单可能会包含在内,以作为与应用程序可执行文件安装在同一文件夹中的外部 .manifest 文件进行重新分发,它还可能以资源的形式包含在可执行文件中。
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
其他注释:
|
||||||
|
|
||||||
|
应用程序向导使用“TODO:”来指示应添加或自定义的源代码部分。
|
||||||
|
|
||||||
|
如果应用程序使用共享 DLL 中的 MFC,您将需要重新分发 MFC DLL。如果应用程序所使用的语言与操作系统的区域设置不同,则还需要重新分发相应的本地化资源 mfc110XXX.DLL。
|
||||||
|
有关上述话题的更多信息,请参见 MSDN 文档中有关重新分发 Visual C++ 应用程序的部分。
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
|
@ -0,0 +1,21 @@
|
||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ 生成的包含文件。
|
||||||
|
// 由 Test.rc 使用
|
||||||
|
//
|
||||||
|
#define IDR_MAINFRAME 128
|
||||||
|
#define IDM_ABOUTBOX 0x0010
|
||||||
|
#define IDD_ABOUTBOX 100
|
||||||
|
#define IDS_ABOUTBOX 101
|
||||||
|
#define IDD_TEST_DIALOG 102
|
||||||
|
|
||||||
|
// 新对象的下一组默认值
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||||
|
#endif
|
||||||
|
#endif
|
Binary file not shown.
|
@ -0,0 +1,102 @@
|
||||||
|
|
||||||
|
// Test.cpp : 定义应用程序的类行为。
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "Test.h"
|
||||||
|
#include "TestDlg.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// CTestApp
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CTestApp, CWinApp)
|
||||||
|
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CTestApp 构造
|
||||||
|
|
||||||
|
CTestApp::CTestApp()
|
||||||
|
{
|
||||||
|
// 支持重新启动管理器
|
||||||
|
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||||
|
|
||||||
|
// TODO: 在此处添加构造代码,
|
||||||
|
// 将所有重要的初始化放置在 InitInstance 中
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 唯一的一个 CTestApp 对象
|
||||||
|
|
||||||
|
CTestApp theApp;
|
||||||
|
|
||||||
|
|
||||||
|
// CTestApp 初始化
|
||||||
|
|
||||||
|
BOOL CTestApp::InitInstance()
|
||||||
|
{
|
||||||
|
// 如果一个运行在 Windows XP 上的应用程序清单指定要
|
||||||
|
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
|
||||||
|
//则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
|
||||||
|
INITCOMMONCONTROLSEX InitCtrls;
|
||||||
|
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||||
|
// 将它设置为包括所有要在应用程序中使用的
|
||||||
|
// 公共控件类。
|
||||||
|
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||||
|
InitCommonControlsEx(&InitCtrls);
|
||||||
|
|
||||||
|
CWinApp::InitInstance();
|
||||||
|
|
||||||
|
|
||||||
|
AfxEnableControlContainer();
|
||||||
|
|
||||||
|
// 创建 shell 管理器,以防对话框包含
|
||||||
|
// 任何 shell 树视图控件或 shell 列表视图控件。
|
||||||
|
CShellManager *pShellManager = new CShellManager;
|
||||||
|
|
||||||
|
// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
|
||||||
|
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
||||||
|
|
||||||
|
// 标准初始化
|
||||||
|
// 如果未使用这些功能并希望减小
|
||||||
|
// 最终可执行文件的大小,则应移除下列
|
||||||
|
// 不需要的特定初始化例程
|
||||||
|
// 更改用于存储设置的注册表项
|
||||||
|
// TODO: 应适当修改该字符串,
|
||||||
|
// 例如修改为公司或组织名
|
||||||
|
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
|
||||||
|
|
||||||
|
CTestDlg dlg;
|
||||||
|
m_pMainWnd = &dlg;
|
||||||
|
INT_PTR nResponse = dlg.DoModal();
|
||||||
|
if (nResponse == IDOK)
|
||||||
|
{
|
||||||
|
// TODO: 在此放置处理何时用
|
||||||
|
// “确定”来关闭对话框的代码
|
||||||
|
}
|
||||||
|
else if (nResponse == IDCANCEL)
|
||||||
|
{
|
||||||
|
// TODO: 在此放置处理何时用
|
||||||
|
// “取消”来关闭对话框的代码
|
||||||
|
}
|
||||||
|
else if (nResponse == -1)
|
||||||
|
{
|
||||||
|
TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
|
||||||
|
TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除上面创建的 shell 管理器。
|
||||||
|
if (pShellManager != NULL)
|
||||||
|
{
|
||||||
|
delete pShellManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
|
||||||
|
// 而不是启动应用程序的消息泵。
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
// Test.h : PROJECT_NAME 应用程序的主头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __AFXWIN_H__
|
||||||
|
#error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "resource.h" // 主符号
|
||||||
|
|
||||||
|
|
||||||
|
// CTestApp:
|
||||||
|
// 有关此类的实现,请参阅 Test.cpp
|
||||||
|
//
|
||||||
|
|
||||||
|
class CTestApp : public CWinApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CTestApp();
|
||||||
|
|
||||||
|
// 重写
|
||||||
|
public:
|
||||||
|
virtual BOOL InitInstance();
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CTestApp theApp;
|
Binary file not shown.
|
@ -0,0 +1,130 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="12.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>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{F3F828D8-CF32-4B18-A359-A47519711575}</ProjectGuid>
|
||||||
|
<RootNamespace>Test</RootNamespace>
|
||||||
|
<Keyword>MFCProj</Keyword>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v120</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</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>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<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>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</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>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Text Include="ReadMe.txt" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="Resource.h" />
|
||||||
|
<ClInclude Include="stdafx.h" />
|
||||||
|
<ClInclude Include="targetver.h" />
|
||||||
|
<ClInclude Include="Test.h" />
|
||||||
|
<ClInclude Include="TestDlg.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="stdafx.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="Test.cpp" />
|
||||||
|
<ClCompile Include="TestDlg.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="Test.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\Test.rc2" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\Test.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,63 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="源文件">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="头文件">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="资源文件">
|
||||||
|
<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="Test.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="TestDlg.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="stdafx.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="targetver.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Resource.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="Test.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="TestDlg.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="stdafx.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="Test.rc">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\Test.rc2">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\Test.ico">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
|
@ -0,0 +1,171 @@
|
||||||
|
|
||||||
|
// TestDlg.cpp : 实现文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include "Test.h"
|
||||||
|
#include "TestDlg.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
|
||||||
|
|
||||||
|
class CAboutDlg : public CDialogEx
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CAboutDlg();
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
enum { IDD = IDD_ABOUTBOX };
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
protected:
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialogEx::DoDataExchange(pDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CTestDlg 对话框
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/)
|
||||||
|
: CDialogEx(CTestDlg::IDD, pParent)
|
||||||
|
{
|
||||||
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTestDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialogEx::DoDataExchange(pDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CTestDlg, CDialogEx)
|
||||||
|
ON_WM_SYSCOMMAND()
|
||||||
|
ON_WM_PAINT()
|
||||||
|
ON_WM_QUERYDRAGICON()
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CTestDlg 消息处理程序
|
||||||
|
|
||||||
|
BOOL CTestDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialogEx::OnInitDialog();
|
||||||
|
|
||||||
|
// 将“关于...”菜单项添加到系统菜单中。
|
||||||
|
|
||||||
|
// IDM_ABOUTBOX 必须在系统命令范围内。
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
|
||||||
|
// 执行此操作
|
||||||
|
SetIcon(m_hIcon, TRUE); // 设置大图标
|
||||||
|
SetIcon(m_hIcon, FALSE); // 设置小图标
|
||||||
|
|
||||||
|
// TODO: 在此添加额外的初始化代码
|
||||||
|
Start();
|
||||||
|
|
||||||
|
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTestDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||||
|
{
|
||||||
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
|
||||||
|
{
|
||||||
|
CAboutDlg dlgAbout;
|
||||||
|
dlgAbout.DoModal();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CDialogEx::OnSysCommand(nID, lParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果向对话框添加最小化按钮,则需要下面的代码
|
||||||
|
// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
|
||||||
|
// 这将由框架自动完成。
|
||||||
|
|
||||||
|
void CTestDlg::OnPaint()
|
||||||
|
{
|
||||||
|
if (IsIconic())
|
||||||
|
{
|
||||||
|
CPaintDC dc(this); // 用于绘制的设备上下文
|
||||||
|
|
||||||
|
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
||||||
|
|
||||||
|
// 使图标在工作区矩形中居中
|
||||||
|
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;
|
||||||
|
|
||||||
|
// 绘制图标
|
||||||
|
dc.DrawIcon(x, y, m_hIcon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CDialogEx::OnPaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//当用户拖动最小化窗口时系统调用此函数取得光标
|
||||||
|
//显示。
|
||||||
|
HCURSOR CTestDlg::OnQueryDragIcon()
|
||||||
|
{
|
||||||
|
return static_cast<HCURSOR>(m_hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CTestDlg::Start()
|
||||||
|
{
|
||||||
|
// 判断64位系统还是32位系统
|
||||||
|
BOOL bWow64 = FALSE;
|
||||||
|
::IsWow64Process(::GetCurrentProcess(), &bWow64);
|
||||||
|
if (bWow64)
|
||||||
|
{
|
||||||
|
// 64位,调用64位程序
|
||||||
|
WinExec("x64\\FakeProcess.exe", SW_NORMAL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 32位,调用32位程序
|
||||||
|
WinExec("x86\\FakeProcess.exe", SW_NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
::ExitProcess(NULL);
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
// TestDlg.h : 头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
// CTestDlg 对话框
|
||||||
|
class CTestDlg : public CDialogEx
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void Start();
|
||||||
|
// 构造
|
||||||
|
public:
|
||||||
|
CTestDlg(CWnd* pParent = NULL); // 标准构造函数
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
enum { IDD = IDD_TEST_DIALOG };
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
protected:
|
||||||
|
HICON m_hIcon;
|
||||||
|
|
||||||
|
// 生成的消息映射函数
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
|
||||||
|
afx_msg void OnPaint();
|
||||||
|
afx_msg HCURSOR OnQueryDragIcon();
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
// stdafx.cpp : 只包括标准包含文件的源文件
|
||||||
|
// Test.pch 将作为预编译头
|
||||||
|
// stdafx.obj 将包含预编译类型信息
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
|
||||||
|
// stdafx.h : 标准系统包含文件的包含文件,
|
||||||
|
// 或是经常使用但不常更改的
|
||||||
|
// 特定于项目的包含文件
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef VC_EXTRALEAN
|
||||||
|
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "targetver.h"
|
||||||
|
|
||||||
|
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
|
||||||
|
|
||||||
|
// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏
|
||||||
|
#define _AFX_ALL_WARNINGS
|
||||||
|
|
||||||
|
#include <afxwin.h> // MFC 核心组件和标准组件
|
||||||
|
#include <afxext.h> // MFC 扩展
|
||||||
|
|
||||||
|
|
||||||
|
#include <afxdisp.h> // MFC 自动化类
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _AFX_NO_OLE_SUPPORT
|
||||||
|
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
|
||||||
|
#endif
|
||||||
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
|
||||||
|
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
|
||||||
|
#include <afxcontrolbars.h> // 功能区和控件条的 MFC 支持
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// 包括 SDKDDKVer.h 将定义最高版本的可用 Windows 平台。
|
||||||
|
|
||||||
|
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||||
|
// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||||
|
|
||||||
|
#include <SDKDDKVer.h>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue