Răsfoiți Sursa

抄写工具:后台升级工具

Jeff 5 ani în urmă
părinte
comite
bd777b33e7

+ 20 - 0
TCL Copy Tool/rename/rename.sln

@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rename", "rename\rename.vcproj", "{889A2468-BAB7-4A76-A84A-D5825146B34C}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{889A2468-BAB7-4A76-A84A-D5825146B34C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{889A2468-BAB7-4A76-A84A-D5825146B34C}.Debug|Win32.Build.0 = Debug|Win32
+		{889A2468-BAB7-4A76-A84A-D5825146B34C}.Release|Win32.ActiveCfg = Release|Win32
+		{889A2468-BAB7-4A76-A84A-D5825146B34C}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

+ 12 - 0
TCL Copy Tool/rename/rename/PARAMETERS.cpp

@@ -0,0 +1,12 @@
+#include "StdAfx.h"
+#include "PARAMETERS.h"
+
+PARAMETERS::PARAMETERS(void)
+{
+	killproc = false;
+	dwProcId = 0;
+}
+
+PARAMETERS::~PARAMETERS(void)
+{
+}

+ 14 - 0
TCL Copy Tool/rename/rename/PARAMETERS.h

@@ -0,0 +1,14 @@
+#pragma once
+
+class PARAMETERS
+{
+public:
+	PARAMETERS(void);
+	~PARAMETERS(void);
+
+public:
+	bool			killproc;
+	DWORD			dwProcId;
+	std::string		OldVerPath;
+	std::string		NewVerPath;
+};

+ 40 - 0
TCL Copy Tool/rename/rename/ReadMe.txt

@@ -0,0 +1,40 @@
+========================================================================
+    控制台应用程序:rename 项目概述
+========================================================================
+
+应用程序向导已为您创建了此 rename 应用程序。
+
+本文件概要介绍组成 rename 应用程序的
+的每个文件的内容。
+
+
+rename.vcproj
+    这是使用应用程序向导生成的 VC++ 项目的主项目文件,
+    其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
+
+rename.cpp
+    这是主应用程序源文件。
+
+/////////////////////////////////////////////////////////////////////////////
+应用程序向导创建了下列资源:
+
+rename.rc
+这是程序使用的所有 Microsoft Windows 资源的列表。它包括 RES 子目录中存储的图标、位图和光标。
+此文件可以直接在 Microsoft Visual C++ 中进行编辑。
+
+Resource.h
+    这是标准头文件,可用于定义新的资源 ID。
+    Microsoft Visual C++ 将读取并更新此文件。
+
+/////////////////////////////////////////////////////////////////////////////
+其他标准文件:
+
+StdAfx.h, StdAfx.cpp
+    这些文件用于生成名为 rename.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。
+
+/////////////////////////////////////////////////////////////////////////////
+其他注释:
+
+应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。
+
+/////////////////////////////////////////////////////////////////////////////

+ 439 - 0
TCL Copy Tool/rename/rename/rename.cpp

@@ -0,0 +1,439 @@
+// lyfzRename.cpp : 定义控制台应用程序的入口点。
+//
+
+#include "stdafx.h"
+#include "rename.h"
+#include <Shlwapi.h>
+#include <io.h>
+#include "PARAMETERS.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+HMODULE g_hCurModule = NULL;
+TCHAR g_szCurModulePath[MAX_PATH] = {0};
+TCHAR g_szFna[MAX_PATH] = {0};
+
+BOOL GetDebugPriv();
+void WriteTextLog(const TCHAR *format, ...);
+string GetFileVersion(const string &strFilePath);
+bool GetFileVersion(IN const TCHAR *fname, IN HMODULE hModule, OUT WORD *pBuffer);
+bool GetProductVersion(IN const TCHAR *fname, IN HMODULE hModule, OUT WORD *pBuffer);
+void getopt(PARAMETERS & params, int argc, char ** argv);
+// 唯一的应用程序对象
+
+CWinApp theApp;
+
+using namespace std;
+
+int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
+{
+	int nRetCode = 0;
+	TCHAR szDrive[_MAX_DRIVE] = { 0 };
+	TCHAR szDir[_MAX_DIR] = { 0 };
+	TCHAR szFna[_MAX_DIR] = { 0 };
+	TCHAR szExt[_MAX_DIR] = { 0 };
+	::GetModuleFileName(NULL, g_szCurModulePath, sizeof(g_szCurModulePath) / sizeof(TCHAR));
+	_tsplitpath_s(g_szCurModulePath, szDrive, szDir, g_szFna, szExt);
+	_tcscpy_s(g_szCurModulePath, szDrive);
+	_tcscat_s(g_szCurModulePath, szDir);
+
+	GetDebugPriv();
+	// 初始化 MFC 并在失败时显示错误
+	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
+	{
+		// TODO: 更改错误代码以符合您的需要
+		_tprintf(_T("错误: MFC 初始化失败\n"));
+		nRetCode = 1;
+	}
+	else
+	{
+		// 获取参数;
+		PARAMETERS params;
+		getopt(params, argc, argv);
+#ifdef _DEBUG
+		WriteTextLog(_T("%ld, %ld,%s,%s"),params.dwProcId, params.killproc, params.NewVerPath.c_str(), params.OldVerPath.c_str());
+#endif
+		if ( params.dwProcId != 0)
+		{	
+			// 等待进程退出;
+			DWORD dwTargetProId = 0;
+			HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, params.dwProcId);
+			if ( hProc != NULL)
+			{
+				if ( params.killproc )
+				{//结束进程;
+					TerminateProcess(hProc, 0);
+					Sleep(500);
+				}
+				else
+				{
+					// 等待线程结束;
+					WaitForSingleObject(hProc, INFINITE);
+					CloseHandle(hProc);
+				}
+			}
+
+			if (!PathFileExists(params.NewVerPath.c_str()))
+			{
+				exit(0);
+			}
+#if 0//以主程序为升级包的处理方法;
+			// 删除旧版本文件;
+			DeleteFile(params.OldVerPath.c_str());
+			// 移动文件;
+			MoveFile(params.NewVerPath.c_str(), params.OldVerPath.c_str());	
+
+			if ( params.killproc )
+			{
+				// 启动程序;
+				CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);//某些情况下要初始化COM才能使用ShellExecuteEx;
+				SHELLEXECUTEINFO stuExecInfo = { 0 };
+				DWORD dwExitCode = STILL_ACTIVE;
+				stuExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
+				stuExecInfo.lpFile = params.OldVerPath.c_str();
+				stuExecInfo.nShow = SW_SHOW;
+				stuExecInfo.lpVerb = _T("open");
+				stuExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
+
+				if (!ShellExecuteEx(&stuExecInfo))
+				{
+					DWORD dwError = GetLastError();
+					WriteTextLog(_T("ShellExecuteEx Error=%ld"), dwError);
+					return -1;
+				}
+
+				HANDLE hProcess = stuExecInfo.hProcess;
+				if ( hProcess != NULL )
+				{
+					//WaitForSingleObject(hProcess,INFINITE);//不等待结束;
+					CloseHandle(hProcess);
+				}
+			}
+#else//以安装包为升级包的处理方法;//可以选择静默安装安装包;
+			if ( params.killproc )
+			{
+				// 启动程序;
+				CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);//某些情况下要初始化COM才能使用ShellExecuteEx;
+				SHELLEXECUTEINFO stuExecInfo = { 0 };
+				DWORD dwExitCode = STILL_ACTIVE;
+				CString strParameters = _T("/S");
+				stuExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
+				stuExecInfo.lpFile = params.NewVerPath.c_str();
+				stuExecInfo.nShow = SW_SHOW;
+				//stuExecInfo.lpParameters = strParameters;//不静默安装;
+				stuExecInfo.lpVerb = _T("open");
+				stuExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI;
+
+				if (!ShellExecuteEx(&stuExecInfo))
+				{
+					DWORD dwError = GetLastError();
+					WriteTextLog(_T("ShellExecuteEx Error=%ld"), dwError);
+					return -1;
+				}
+
+				HANDLE hProcess = stuExecInfo.hProcess;
+				if ( hProcess != NULL )
+				{
+					CloseHandle(hProcess);
+				}
+			}
+#endif
+		}
+	}
+
+	return nRetCode;
+}
+
+void getopt(PARAMETERS & params, int argc, char ** argv)
+{
+	std::string cmd = "";
+	for ( argc > 0; argc--; argv++ )
+	{
+		if ( _tcsicmp(*argv, _T("--pid")) == 0)
+		{
+			cmd = _T("--pid");
+		}
+		else if (_tcsicmp(*argv, _T("--oldpath")) == 0)
+		{
+			cmd = _T("--oldpath");
+		}
+		else if (_tcsicmp(*argv, _T("--newpath")) == 0)
+		{
+			cmd = _T("--newpath");
+		}
+		else if (_tcsicmp(*argv, _T("--killproc")) == 0)
+		{
+			cmd = _T("--killproc");
+		}
+		else
+		{
+			if ( _tcsicmp(cmd.c_str(), _T("--pid")) == 0)
+			{
+				params.dwProcId = atoi(*argv);
+			}
+			else if (_tcsicmp(cmd.c_str(), _T("--oldpath")) == 0)
+			{
+				params.OldVerPath = *argv;
+			}
+			else if (_tcsicmp(cmd.c_str(), _T("--newpath")) == 0)
+			{
+				params.NewVerPath = *argv;
+			}
+			else if (_tcsicmp(cmd.c_str(), _T("--killproc")) == 0)
+			{
+				params.killproc = atoi(*argv);
+			}
+
+			cmd = "";
+		}
+	}
+}
+
+//2.获得其他exe或dll的版本信息
+string GetFileVersion(const string &strFilePath) 
+{
+	DWORD dwSize; 
+	DWORD dwRtn; 
+	string szVersion;
+	//获取版本信息大小
+	dwSize = GetFileVersionInfoSize(strFilePath.c_str(),NULL); 
+	DWORD dwErr = GetLastError();
+	if (dwSize == 0) 
+	{ 
+		return ""; 
+	}
+	char *pBuf; 
+	pBuf= new char[dwSize + 1]; 
+	if(pBuf == NULL)
+		return "";
+	memset(pBuf, 0, dwSize + 1);
+	//获取版本信息
+	dwRtn = GetFileVersionInfo(strFilePath.c_str(),NULL, dwSize, pBuf); 
+	if(dwRtn == 0) 
+	{ 
+		return ""; 
+	}
+	LPVOID lpBuffer = NULL;
+	UINT uLen = 0;
+	//版本资源中获取信息
+	dwRtn = VerQueryValue(pBuf, 
+		TEXT("\\StringFileInfo\\080404b0\\FileVersion"), //0804中文
+		//04b0即1252,ANSI
+		//可以从ResourceView中的Version中BlockHeader中看到
+		//可以测试的属性
+		/*
+		CompanyName 
+		FileDescription 
+		FileVersion 
+		InternalName 
+		LegalCopyright
+		OriginalFilename
+		ProductName 
+		ProductVersion 
+		Comments
+		LegalTrademarks 
+		PrivateBuild 
+		SpecialBuild 
+		*/ 
+		&lpBuffer, 
+		&uLen); 
+	if(dwRtn == 0) 
+	{ 
+		return ""; 
+	}
+	szVersion = (char*)lpBuffer;
+	delete pBuf; 
+	return szVersion; 
+}
+
+
+// hModule 模块句柄 NULL表示当前模块;
+bool GetFileVersion(IN const TCHAR *fname, IN HMODULE hModule, OUT WORD *pBuffer)
+{
+	//TCHAR fname[MAX_PATH];
+	VS_FIXEDFILEINFO *pVi = NULL;
+	DWORD dwHandle = 0;
+	string str;
+
+
+	int size = GetFileVersionInfoSize(fname, &dwHandle);
+
+	if (size > 0) 
+	{
+		BYTE *buffer = new BYTE[size];
+		memset(buffer,0,size);
+
+		if (GetFileVersionInfo(fname, dwHandle, size, buffer)) 
+		{
+			if (VerQueryValue(buffer, _T("\\"), (LPVOID *)&pVi, (PUINT)&size)) 
+			{
+				pBuffer[0] = HIWORD(pVi->dwFileVersionMS);
+				pBuffer[1] = LOWORD(pVi->dwFileVersionMS);
+				pBuffer[2] = HIWORD(pVi->dwFileVersionLS);
+				pBuffer[3] = LOWORD(pVi->dwFileVersionLS);
+
+				delete []buffer;
+				return true;
+			}
+		}
+
+		delete []buffer;
+	}
+
+	return false;
+}
+
+bool GetProductVersion(IN const TCHAR *fname, IN HMODULE hModule, OUT WORD *pBuffer)
+{
+	//TCHAR fname[MAX_PATH];
+	VS_FIXEDFILEINFO *pVi = NULL;
+	DWORD dwHandle = 0;
+	string str;
+
+
+	int size = GetFileVersionInfoSize(fname, &dwHandle);
+
+	if (size > 0) 
+	{
+		BYTE *buffer = new BYTE[size];
+		memset(buffer,0,size);
+
+		if (GetFileVersionInfo(fname, dwHandle, size, buffer)) 
+		{
+			if (VerQueryValue(buffer, _T("\\"), (LPVOID *)&pVi, (PUINT)&size)) 
+			{
+				pBuffer[0] = HIWORD(pVi->dwProductVersionMS);
+				pBuffer[1] = LOWORD(pVi->dwProductVersionMS);
+				pBuffer[2] = HIWORD(pVi->dwProductVersionLS);
+				pBuffer[3] = LOWORD(pVi->dwProductVersionLS);
+
+				delete []buffer;
+				return true;
+			}
+		}
+
+		delete []buffer;
+	}
+
+	return false;
+}
+
+
+BOOL GetDebugPriv()
+{
+	// 返回的访问令牌指针;
+	HANDLE	hToken;
+	// 接收所返回的制定特权名称的信息;
+	LUID	sedebugnameValue;
+	// 新特权信息的指针(结构体);
+	TOKEN_PRIVILEGES tkp;
+	DWORD	dwCurProcId = GetCurrentProcessId(); 
+	// 要修改访问权限的进程句柄;
+	HANDLE	hCurProc;	
+	hCurProc = ::OpenProcess( PROCESS_ALL_ACCESS, FALSE, dwCurProcId ); 
+
+	if ( !::OpenProcessToken( hCurProc,TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken ) )
+	{
+		DWORD dwError = GetLastError();
+		//CString strError;
+		//strError.Format("升级包提权失败,错误码=%d",dwError);
+		//AfxMessageBox(strError);
+		return FALSE;
+	}
+
+	if ( ! ::LookupPrivilegeValue( NULL, SE_DEBUG_NAME, &sedebugnameValue ) )
+	{
+		DWORD dwError = GetLastError();
+		//CString strError;
+	///	strError.Format("升级包提权失败,错误码=%d",dwError);
+		//AfxMessageBox(strError);
+		CloseHandle( hToken );
+		return FALSE;
+	}
+
+	tkp.PrivilegeCount = 1;
+	tkp.Privileges[0].Luid = sedebugnameValue;
+	tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+
+	if (!::AdjustTokenPrivileges( hToken, FALSE, &tkp, sizeof tkp, NULL, NULL ) )
+	{
+		DWORD dwError = GetLastError();
+		//CString strError;
+		//strError.Format("升级包提权失败,错误码=%d",dwError);
+		//AfxMessageBox(strError);
+		CloseHandle( hToken );
+		return FALSE;
+	}
+
+	CloseHandle(hCurProc);
+	CloseHandle(hToken);
+	return TRUE;
+}
+
+/************************************************************************/
+/*  函数:WriteTextLog[7/28/2009 Jeff];
+/*  描述:写文本日志;
+/*  参数:;
+/*  	[IN] :;
+/*  返回:void;
+/*  注意:;
+/*  示例:;
+/*
+/*  修改:;
+/*  日期:;
+/*  内容:;
+/************************************************************************/
+void WriteTextLog(const TCHAR *format, ...)
+{
+	// 解析出日志路径;
+	TCHAR szlogpath[MAX_PATH] = { 0 };
+	_stprintf_s(szlogpath, _T("%s%s.txt"), g_szCurModulePath, g_szFna);
+	// 打开或创建文件;
+	FILE *fp = NULL;
+	//if (_taccess(szlogpath, 0) != -1)
+#ifndef UNICODE
+	if (_access(szlogpath, 0) != -1)
+#else
+	if (_taccess(szlogpath, 0) != -1)
+#endif
+	{// 存在;
+		fp = _tfopen(szlogpath, _T("a+"));
+		// 移动到末尾;
+		fseek(fp, 0, SEEK_END);
+	}
+	else
+	{// 不存在;
+		fp = _tfopen(szlogpath, _T("w+"));
+	}
+
+	if ( fp == NULL )
+		return;
+
+	// 格式化前设置语言区域;
+	TCHAR* old_locale = _tcsdup(_tsetlocale(LC_CTYPE, NULL));
+	_tsetlocale(LC_CTYPE, _T("chs"));//设定中文;
+
+	// 格式化日志内容;
+	va_list		args = NULL;
+	int			len = 0;
+	TCHAR		*buffer = NULL;
+	va_start(args, format);
+	// _vscprintf doesn't count. terminating '\0'
+	len = _vsctprintf(format, args) + 1;
+	buffer = (TCHAR*)malloc(len * sizeof(TCHAR));
+	_vstprintf_s(buffer, len, format, args);
+	// 将日志内容输入到文件中;
+	// 获取今年年份;
+	__time64_t gmt = time(NULL);// 获取当前日历时间(1900-01-01开始的Unix时间戳);
+	struct tm gmtm = {0};
+	localtime_s(&gmtm, &gmt); // 时间戳转成本地时间;
+	_ftprintf(fp, _T("%04d-%02d-%02d %02d:%02d:%02d %s\n"), gmtm.tm_year+1990, gmtm.tm_mon+1, gmtm.tm_mday, gmtm.tm_hour, gmtm.tm_min, gmtm.tm_sec, buffer);
+
+	// 关闭文件,释放资源并设置回原语言区域;
+	free(buffer);
+	fclose(fp);
+	_tsetlocale(LC_CTYPE, old_locale);
+	free(old_locale);//还原区域设定;
+}

+ 3 - 0
TCL Copy Tool/rename/rename/rename.h

@@ -0,0 +1,3 @@
+#pragma once
+
+#include "resource.h"

BIN
TCL Copy Tool/rename/rename/rename.ico


+ 83 - 0
TCL Copy Tool/rename/rename/rename.rc

@@ -0,0 +1,83 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// 中文(中华人民共和国) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
+#ifdef _WIN32
+LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
+#pragma code_page(936)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1               ICON                    "rename.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE 
+BEGIN
+    IDS_APP_TITLE           "rename"
+END
+
+#endif    // 中文(中华人民共和国) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+

+ 249 - 0
TCL Copy Tool/rename/rename/rename.vcproj

@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="gb2312"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="rename"
+	ProjectGUID="{889A2468-BAB7-4A76-A84A-D5825146B34C}"
+	RootNamespace="lyfzRename"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="..\..\..\..\..\..\bin\$(ProjectName)\"
+			IntermediateDirectory="$(OutDir)$(ConfigurationName)"
+			ConfigurationType="1"
+			UseOfMFC="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="2"
+				UACExecutionLevel="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="..\..\..\..\..\..\bin\$(ProjectName)\"
+			IntermediateDirectory="$(OutDir)$(ConfigurationName)"
+			ConfigurationType="1"
+			UseOfMFC="2"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="2"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkIncremental="1"
+				UACExecutionLevel="2"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Ô´Îļþ"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\PARAMETERS.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\rename.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Í·Îļþ"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\PARAMETERS.h"
+				>
+			</File>
+			<File
+				RelativePath=".\Resource.h"
+				>
+			</File>
+			<File
+				RelativePath=".\stdafx.h"
+				>
+			</File>
+			<File
+				RelativePath=".\targetver.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="×ÊÔ´Îļþ"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+			<File
+				RelativePath=".\rename.ico"
+				>
+			</File>
+			<File
+				RelativePath=".\rename.rc"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\ReadMe.txt"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

+ 17 - 0
TCL Copy Tool/rename/rename/resource.h

@@ -0,0 +1,17 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by lyfzRename.rc
+//
+#define IDI_ICON1                       101
+#define IDS_APP_TITLE                   103
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        102
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1000
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif

+ 8 - 0
TCL Copy Tool/rename/rename/stdafx.cpp

@@ -0,0 +1,8 @@
+// stdafx.cpp : 只包括标准包含文件的源文件
+// lyfzRename.pch 将作为预编译头
+// stdafx.obj 将包含预编译类型信息
+
+#include "stdafx.h"
+
+// TODO: 在 STDAFX.H 中
+// 引用任何所需的附加头文件,而不是在此文件中引用

+ 34 - 0
TCL Copy Tool/rename/rename/stdafx.h

@@ -0,0 +1,34 @@
+// stdafx.h : 标准系统包含文件的包含文件,
+// 或是经常使用但不常更改的
+// 特定于项目的包含文件
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#include <stdio.h>
+#include <tchar.h>
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 某些 CString 构造函数将是显式的
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include <afx.h>
+#include <afxwin.h>         // MFC 核心组件和标准组件
+#include <afxext.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 <iostream>
+#include <string>
+#pragma comment(lib,"version.lib")
+using namespace std;
+
+
+// TODO: 在此处引用程序需要的其他头文件

+ 26 - 0
TCL Copy Tool/rename/rename/targetver.h

@@ -0,0 +1,26 @@
+#pragma once
+
+// 以下宏定义要求的最低平台。要求的最低平台
+// 是具有运行应用程序所需功能的 Windows、Internet Explorer 等产品的
+// 最早版本。通过在指定版本及更低版本的平台上启用所有可用的功能,宏可以
+// 正常工作。
+
+// 如果必须要针对低于以下指定版本的平台,请修改下列定义。
+// 有关不同平台对应值的最新信息,请参考 MSDN。
+#ifndef WINVER                          // 指定要求的最低平台是 Windows Vista。
+#define WINVER 0x0600           // 将此值更改为相应的值,以适用于 Windows 的其他版本。
+#endif
+
+#ifndef _WIN32_WINNT            // 指定要求的最低平台是 Windows Vista。
+#define _WIN32_WINNT 0x0600     // 将此值更改为相应的值,以适用于 Windows 的其他版本。
+#endif
+
+#ifndef _WIN32_WINDOWS          // 指定要求的最低平台是 Windows 98。
+#define _WIN32_WINDOWS 0x0410 // 将此值更改为适当的值,以适用于 Windows Me 或更高版本。
+#endif
+
+#ifndef _WIN32_IE                       // 指定要求的最低平台是 Internet Explorer 7.0。
+#define _WIN32_IE 0x0700        // 将此值更改为相应的值,以适用于 IE 的其他版本。
+#endif
+
+#pragma comment(linker,"/SUBSYSTEM:Windows  /ENTRY:mainCRTStartup")