base
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,221 @@
|
||||
strPath.Format("%s\\SP-Console.exe",szPath);// ConsoleUpdater.cpp : 응용 프로그램에 대한 클래스 동작을 정의합니다.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ConsoleUpdater.h"
|
||||
#include "ConsoleUpdaterDlg.h"
|
||||
#include "FileVersionInfo.h"
|
||||
#include "../Common/MyPing.h"
|
||||
#include <afxsock.h> // MFC socket extensions
|
||||
|
||||
#include "../Common/RegUtil.h"
|
||||
|
||||
#import <msxml3.dll>
|
||||
using namespace MSXML2;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
#include <afxsock.h>
|
||||
|
||||
// CConsoleUpdaterApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CConsoleUpdaterApp, CWinApp)
|
||||
ON_COMMAND(ID_HELP, CWinApp::OnHelp)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CConsoleUpdaterApp 생성
|
||||
|
||||
CConsoleUpdaterApp::CConsoleUpdaterApp()
|
||||
{
|
||||
// TODO: 여기에 생성 코드를 추가합니다.
|
||||
// InitInstance에 모든 중요한 초기화 작업을 배치합니다.
|
||||
}
|
||||
|
||||
|
||||
// 유일한 CConsoleUpdaterApp 개체입니다.
|
||||
|
||||
CConsoleUpdaterApp theApp;
|
||||
|
||||
|
||||
// CConsoleUpdaterApp 초기화
|
||||
int GetCurrentPath(char* pszPath)
|
||||
{
|
||||
char szPath[MAX_PATH]={0};
|
||||
char* pData;
|
||||
|
||||
GetModuleFileName(NULL,szPath,MAX_PATH);
|
||||
|
||||
pData = strrchr(szPath,'\\');
|
||||
|
||||
strncpy(pszPath,szPath,pData-szPath);
|
||||
return int(strlen(pszPath));
|
||||
}
|
||||
|
||||
BOOL MyCreateDirectory(CString sDirectory)
|
||||
{
|
||||
CString sPath = "";
|
||||
|
||||
int iToken = 0;
|
||||
CString sText = sDirectory.Tokenize("\\", iToken);
|
||||
while (sText != "")
|
||||
{
|
||||
sPath += sText + "\\";
|
||||
|
||||
if (sPath.GetLength() > 3 && !CreateDirectory(sPath, NULL))
|
||||
{
|
||||
DWORD dwError = GetLastError();
|
||||
if (dwError != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
SetLastError(dwError);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
sText = sDirectory.Tokenize("\\", iToken);
|
||||
if(iToken<0)
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CConsoleUpdaterApp::CheckServer()
|
||||
{
|
||||
CMyPing p;
|
||||
|
||||
BOOL bRet = TRUE;
|
||||
bRet = p.Ping(1,"www.ktsystemhosting.com");
|
||||
|
||||
if (!bRet)
|
||||
{
|
||||
MessageBox(NULL,"서버에 연결할수 없습니다. 네트웍 연결상태를 확인하세요","SP-Console 업데이터",MB_OK);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CConsoleUpdaterApp::InitInstance()
|
||||
{
|
||||
HANDLE hMutex = ::CreateMutex(NULL, TRUE, _T("SP-UpdaterXXXXXXXXXXXXXXX"));
|
||||
if (!hMutex && ::GetLastError() == ERROR_ALREADY_EXISTS) {
|
||||
CloseHandle(hMutex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// 응용 프로그램 매니페스트가 ComCtl32.dll 버전 6 이상을 사용하여 비주얼 스타일을
|
||||
// 사용하도록 지정하는 경우, Windows XP 상에서 반드시 InitCommonControls()가 필요합니다.
|
||||
// InitCommonControls()를 사용하지 않으면 창을 만들 수 없습니다.
|
||||
InitCommonControls();
|
||||
|
||||
CWinApp::InitInstance();
|
||||
|
||||
AfxEnableControlContainer();
|
||||
|
||||
if (CheckServer() == FALSE)
|
||||
return FALSE;
|
||||
|
||||
CStringArray saFile;
|
||||
GetUpdateFileList(saFile);
|
||||
|
||||
CString sUpdater="2";
|
||||
|
||||
if (saFile.GetCount() > 0)
|
||||
{
|
||||
CConsoleUpdaterDlg dlg;
|
||||
|
||||
dlg.SetFileList(saFile);
|
||||
if (dlg.DoModal() != IDOK)
|
||||
return FALSE;
|
||||
|
||||
sUpdater = dlg.m_bIsSelfUpdate? "1":"0";
|
||||
}
|
||||
|
||||
char szPath[MAX_PATH]={0};
|
||||
CString strPath;
|
||||
|
||||
GetCurrentPath(szPath);
|
||||
|
||||
#ifdef _OPENDISK
|
||||
strPath.Format("%s\\OD-Console.exe",szPath);
|
||||
#else
|
||||
strPath.Format("%s\\SP-Console.exe",szPath);
|
||||
#endif
|
||||
|
||||
ShellExecute(NULL, NULL, strPath, sUpdater, NULL, SW_SHOW);
|
||||
|
||||
CloseHandle(hMutex);
|
||||
|
||||
// 대화 상자가 닫혔으므로 응용 프로그램의 메시지 펌프를 시작하지 않고
|
||||
// 응용 프로그램을 끝낼 수 있도록 FALSE를 반환합니다.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CConsoleUpdaterApp::GetUpdateFileList(CStringArray& saFile)
|
||||
{
|
||||
CString strPath;
|
||||
CString sURL = DOWN_URL;
|
||||
CString sFileName;
|
||||
CString strTemp;
|
||||
CString LocalVersion;
|
||||
CString RemotVersion;
|
||||
CString strLocalFile;
|
||||
int nIndex=1;
|
||||
char szBuffer[MAX_PATH]={0};
|
||||
char szPath[MAX_PATH]={0};
|
||||
DWORD dwRet;
|
||||
CFileVersionInfo FileInfo;
|
||||
char szVersion[20]={0};
|
||||
|
||||
if(GetCurrentPath(szPath) >0)
|
||||
{
|
||||
strPath.Format("%s\\update\\",szPath);
|
||||
MyCreateDirectory(strPath);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
strPath += "update.ini";
|
||||
if (URLDownloadToFile(NULL, sURL + "/update.ini", strPath, 0, NULL) != S_OK)
|
||||
return;
|
||||
|
||||
do
|
||||
{
|
||||
strTemp.Format("%d",nIndex);
|
||||
|
||||
dwRet = GetPrivateProfileString("FILES",strTemp,NULL,szBuffer,sizeof(szBuffer),strPath);
|
||||
|
||||
if (dwRet)
|
||||
{
|
||||
strLocalFile.Format("%s\\%s",szPath,szBuffer);
|
||||
FileInfo.Create(strLocalFile);
|
||||
LocalVersion = FileInfo.GetFileVersion();
|
||||
GetPrivateProfileString(szBuffer,"Version",NULL,szVersion,sizeof(szVersion),strPath);
|
||||
RemotVersion = szVersion;
|
||||
|
||||
if(LocalVersion < RemotVersion)
|
||||
saFile.Add(strLocalFile);
|
||||
}
|
||||
nIndex ++;
|
||||
}while(dwRet);
|
||||
return;
|
||||
}
|
||||
|
||||
CString GetErrorMessage(DWORD dwError)
|
||||
{
|
||||
CString sError;
|
||||
LPVOID lpBuffer;
|
||||
|
||||
if (!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, dwError, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpBuffer, 0, NULL))
|
||||
sError = "알 수 없는 오류입니다.";
|
||||
else
|
||||
sError = (LPCTSTR)lpBuffer;
|
||||
|
||||
LocalFree(lpBuffer);
|
||||
|
||||
return sError;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// ConsoleUpdater.h : PROJECT_NAME 응용 프로그램에 대한 주 헤더 파일입니다.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error PCH에서 이 파일을 포함하기 전에 'stdafx.h'를 포함하십시오.
|
||||
#endif
|
||||
|
||||
#include "resource.h" // 주 기호
|
||||
|
||||
int GetCurrentPath(char* pszPath);
|
||||
|
||||
// CConsoleUpdaterApp:
|
||||
// 이 클래스의 구현에 대해서는 SP-Updater.cpp을 참조하십시오.
|
||||
//
|
||||
|
||||
class CConsoleUpdaterApp : public CWinApp
|
||||
{
|
||||
public:
|
||||
CConsoleUpdaterApp();
|
||||
|
||||
protected:
|
||||
void GetUpdateFileList(CStringArray& saFile);
|
||||
public:
|
||||
CString m_sPath;
|
||||
CString m_sFile;
|
||||
BOOL CheckServer();
|
||||
|
||||
// 재정의
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
|
||||
// 구현
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
extern CConsoleUpdaterApp theApp;
|
||||
|
||||
|
||||
#define DOWN_URL "http://www.ktsystemhosting.com/update_for_icsdownload"
|
||||
#define REG_KEY "Software\\KT\\SP-Console(ICS_DOWNLOAD)\\FileVer"
|
||||
@@ -0,0 +1,168 @@
|
||||
// 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_KOR)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
|
||||
#pragma code_page(949)
|
||||
#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
|
||||
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||
"\r\n"
|
||||
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)\r\n"
|
||||
"LANGUAGE 18, 1\r\n"
|
||||
"#pragma code_page(949)\r\n"
|
||||
"#include ""res\\ConsoleUpdater.rc2"" // Microsoft Visual C++에서 편집되지 않은 리소스\r\n"
|
||||
"#include ""afxres.rc"" // 표준 구성 요소\r\n"
|
||||
"#endif\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// RT_MANIFEST
|
||||
//
|
||||
|
||||
1 RT_MANIFEST "res\\ConsoleUpdater.manifest"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON "res\\ConsoleUpdater.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_CONSOLE_UPDATER_DIALOG DIALOGEX 0, 0, 199, 34
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
|
||||
WS_VISIBLE | WS_CAPTION
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "SPConsole 자동 업그레이드"
|
||||
FONT 9, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "",IDC_PRG_TOTAL,"msctls_progress32",WS_BORDER,5,15,190,
|
||||
6
|
||||
LTEXT "",IDC_STC_TITLE,5,5,190,8
|
||||
CONTROL "",IDC_PRG_NOW,"msctls_progress32",WS_BORDER,5,22,190,6
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 2,0,0,0
|
||||
PRODUCTVERSION 2,0,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "041203b5"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "KT & Netomi Corporation."
|
||||
VALUE "FileDescription", "System Hosting Client File Updater"
|
||||
VALUE "FileVersion", "2.0.0.0"
|
||||
VALUE "InternalName", "SP-Updater.exe"
|
||||
VALUE "LegalCopyright", "KT & Netomi Corporation. All rights reserved."
|
||||
VALUE "OriginalFilename", "ConsoleUpdater.exe"
|
||||
VALUE "ProductName", "System Hosting"
|
||||
VALUE "ProductVersion", "2.0.0.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x412, 949
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_ABOUTBOX "ConsoleUpdater 정보(&A)..."
|
||||
END
|
||||
|
||||
#endif // 한국어 resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#define _AFX_NO_SPLITTER_RESOURCES
|
||||
#define _AFX_NO_OLE_RESOURCES
|
||||
#define _AFX_NO_TRACKER_RESOURCES
|
||||
#define _AFX_NO_PROPERTY_RESOURCES
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR)
|
||||
LANGUAGE 18, 1
|
||||
#pragma code_page(949)
|
||||
#include "res\ConsoleUpdater.rc2" // Microsoft Visual C++에서 편집되지 않은 리소스
|
||||
#include "afxres.rc" // 표준 구성 요소
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleUpdater", "ConsoleUpdater.vcproj", "{1CD0355A-1D0F-48E1-9F3D-3A2C067526E0}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{1CD0355A-1D0F-48E1-9F3D-3A2C067526E0}.Debug.ActiveCfg = Debug|Win32
|
||||
{1CD0355A-1D0F-48E1-9F3D-3A2C067526E0}.Debug.Build.0 = Debug|Win32
|
||||
{1CD0355A-1D0F-48E1-9F3D-3A2C067526E0}.Release.ActiveCfg = Release|Win32
|
||||
{1CD0355A-1D0F-48E1-9F3D-3A2C067526E0}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Binary file not shown.
@@ -0,0 +1,348 @@
|
||||
<?xml version="1.0" encoding="ks_c_5601-1987"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="ConsoleUpdater"
|
||||
ProjectGUID="{1CD0355A-1D0F-48E1-9F3D-3A2C067526E0}"
|
||||
Keyword="MFCProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Version.lib Ws2_32.lib"
|
||||
OutputFile="../_bin/SPConsole/Debug(DN)/SP-Updater.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="FALSE"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1042"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
|
||||
MinimalRebuild="FALSE"
|
||||
RuntimeLibrary="2"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Version.lib"
|
||||
OutputFile="../_bin/SPConsole/Release(DN)/SP-Updater.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="FALSE"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1042"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug_Opendisk|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_OPENDISK"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Version.lib"
|
||||
OutputFile="../_bin/SPConsole/Debug_OD/SP-Updater.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="FALSE"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1042"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release_Opendisk|Win32"
|
||||
OutputDirectory="$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_OPENDISK"
|
||||
MinimalRebuild="FALSE"
|
||||
RuntimeLibrary="2"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="3"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="Version.lib"
|
||||
OutputFile="../_bin/SPConsole/Release_OD/SP-Updater.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="FALSE"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1042"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="소스 파일"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\ConsoleUpdater.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ConsoleUpdaterDlg.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DownCallback.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileVersionInfo.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Common\MyPing.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Common\RegUtil.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>
|
||||
<FileConfiguration
|
||||
Name="Debug_Opendisk|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release_Opendisk|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\unzip.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="헤더 파일"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath=".\ConsoleUpdater.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ConsoleUpdaterDlg.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\DownCallback.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FileVersionInfo.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Common\MyPing.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Common\RegUtil.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\unzip.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="리소스 파일"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
<File
|
||||
RelativePath=".\res\ConsoleUpdater.ico">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\ConsoleUpdater.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\ConsoleUpdater.rc2">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="..\ConsoleTransfer(DN)\res\ConsoleTransfer.manifest">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\res\ConsoleUpdater.manifest">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
<Global
|
||||
Name="RESOURCE_FILE"
|
||||
Value="ConsoleUpdater.rc"/>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="euc-kr" ?>
|
||||
<systemHosting>
|
||||
<file>
|
||||
<name>SP-Updater.exe</name>
|
||||
<ver>1.0.0.1</ver>
|
||||
</file>
|
||||
<file>
|
||||
<name>SP-Console.exe</name>
|
||||
<ver>1.0.0.1</ver>
|
||||
</file>
|
||||
<file>
|
||||
<name>DWCtrl.dll</name>
|
||||
<ver>1.0.0.1</ver>
|
||||
</file>
|
||||
<file>
|
||||
<name>DWDavLib.dll</name>
|
||||
<ver>1.0.0.1</ver>
|
||||
</file>
|
||||
<file>
|
||||
<name>DWTran.dll</name>
|
||||
<ver>1.0.0.1</ver>
|
||||
</file>
|
||||
</systemHosting>
|
||||
@@ -0,0 +1,139 @@
|
||||
// ConsoleUpdaterDlg.cpp : 구현 파일
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ConsoleUpdater.h"
|
||||
#include "ConsoleUpdaterDlg.h"
|
||||
|
||||
#include "DownCallBack.h"
|
||||
#include "../Common/RegUtil.h"
|
||||
#include "unzip.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
|
||||
CString GetErrorMessage(DWORD dwError);
|
||||
|
||||
// CConsoleUpdaterDlg 대화 상자
|
||||
|
||||
CConsoleUpdaterDlg::CConsoleUpdaterDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CConsoleUpdaterDlg::IDD, pParent)
|
||||
{
|
||||
m_iTerasferring = 0;
|
||||
m_bIsSelfUpdate = FALSE;
|
||||
}
|
||||
|
||||
void CConsoleUpdaterDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_STC_TITLE, m_stcTitle);
|
||||
DDX_Control(pDX, IDC_PRG_TOTAL, m_prgTotal);
|
||||
DDX_Control(pDX, IDC_PRG_NOW, m_prgNow);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CConsoleUpdaterDlg, CDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CConsoleUpdaterDlg 메시지 처리기
|
||||
|
||||
BOOL CConsoleUpdaterDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: 여기에 추가 초기화 작업을 추가합니다.
|
||||
m_prgTotal.SetRange(0, 100);
|
||||
m_prgTotal.SetStep(1);
|
||||
m_prgTotal.SetPos(0);
|
||||
|
||||
m_prgNow.SetRange(0, 100);
|
||||
m_prgNow.SetStep(1);
|
||||
m_prgNow.SetPos(0);
|
||||
|
||||
ShowWindow(SW_SHOW);
|
||||
|
||||
// AfxBeginThread(Transfer, this);
|
||||
Transfer();
|
||||
|
||||
return TRUE; // 컨트롤에 대한 포커스를 설정하지 않을 경우 TRUE를 반환합니다.
|
||||
}
|
||||
|
||||
void CConsoleUpdaterDlg::SetFileList(CStringArray& saFile)
|
||||
{
|
||||
m_saFile.Copy(saFile);
|
||||
|
||||
m_nTotalCount = (int)m_saFile.GetCount();
|
||||
}
|
||||
|
||||
UINT CConsoleUpdaterDlg::Transfer()
|
||||
{
|
||||
CString sTitle, // 전송창 제목
|
||||
srcFile, // 전송 받을 파일명
|
||||
dstFile, // 저장할 파일명
|
||||
strTemp;
|
||||
|
||||
for (m_iTerasferring = 0; m_iTerasferring < m_nTotalCount; m_iTerasferring++)
|
||||
{
|
||||
m_prgNow.SetPos(0);
|
||||
|
||||
// 전송받을 파일명 설정
|
||||
srcFile = DOWN_URL;
|
||||
srcFile += "/" + m_saFile[m_iTerasferring].Mid(m_saFile[m_iTerasferring].ReverseFind('\\') + 1);
|
||||
srcFile = srcFile.Left(srcFile.ReverseFind('.'));
|
||||
srcFile += ".zip";
|
||||
|
||||
char szTemp[MAX_PATH]={0};
|
||||
GetCurrentPath(szTemp);
|
||||
dstFile.Format("%s\\update\\%s",szTemp,srcFile.Mid(srcFile.ReverseFind('/') + 1));
|
||||
|
||||
sTitle.Format("(%d / %d) %s 다운로드 중...", m_iTerasferring + 1, m_nTotalCount, srcFile.Mid(srcFile.ReverseFind('/') + 1));
|
||||
m_stcTitle.SetWindowText(sTitle);
|
||||
|
||||
CDownCallback dcb;
|
||||
dcb.m_pdlg = this;
|
||||
|
||||
if (URLDownloadToFile(NULL, srcFile, dstFile, 0, (IBindStatusCallback*)&dcb) != S_OK)
|
||||
{
|
||||
if (AfxMessageBox("파일 전송 중 에러가 발생했습니다.\n계속 하시겠습니까?", MB_YESNO | MB_ICONQUESTION) != IDYES)
|
||||
{
|
||||
OnCancel();
|
||||
PostMessage(WM_CLOSE);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Unzip
|
||||
HZIP hz = OpenZip(dstFile,0);
|
||||
ZIPENTRY ze;
|
||||
GetZipItem(hz,-1,&ze);
|
||||
int numitems=ze.index;
|
||||
|
||||
strTemp.Format("%s\\update\\",szTemp);
|
||||
SetUnzipBaseDir(hz,strTemp);
|
||||
GetZipItem(hz,0,&ze);
|
||||
UnzipItem(hz,0,ze.name);
|
||||
|
||||
srcFile.Format("%s\\%s",dstFile.Left(dstFile.ReverseFind('\\')),ze.name);
|
||||
dstFile.Format("%s\\%s",szTemp,ze.name);
|
||||
|
||||
if(lstrcmpi(ze.name,_T("SP-Updater.exe")) == 0)
|
||||
m_bIsSelfUpdate = TRUE;
|
||||
else
|
||||
{
|
||||
if(CopyFile(srcFile,dstFile,FALSE))
|
||||
{
|
||||
DeleteFile(srcFile);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CloseZip(hz);
|
||||
//
|
||||
}
|
||||
|
||||
OnOK();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// ConsoleUpdaterDlg.h : 헤더 파일
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include "afxwin.h"
|
||||
#include "afxcmn.h"
|
||||
|
||||
// CSPUpdaterDlg 대화 상자
|
||||
class CConsoleUpdaterDlg : public CDialog
|
||||
{
|
||||
// 생성
|
||||
public:
|
||||
CConsoleUpdaterDlg(CWnd* pParent = NULL); // 표준 생성자
|
||||
|
||||
// 대화 상자 데이터
|
||||
enum { IDD = IDD_CONSOLE_UPDATER_DIALOG };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 지원
|
||||
|
||||
protected:
|
||||
CStringArray m_saFile;
|
||||
|
||||
public:
|
||||
int m_iTerasferring;
|
||||
int m_nTotalCount;
|
||||
BOOL m_bIsSelfUpdate;
|
||||
|
||||
public:
|
||||
void SetFileList(CStringArray& saFile);
|
||||
|
||||
UINT Transfer();
|
||||
|
||||
// 구현
|
||||
protected:
|
||||
// 메시지 맵 함수를 생성했습니다.
|
||||
virtual BOOL OnInitDialog();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
public:
|
||||
CStatic m_stcTitle;
|
||||
CProgressCtrl m_prgTotal;
|
||||
CProgressCtrl m_prgNow;
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
// DownCallback.cpp : ±¸Çö ÆÄÀÏÀÔ´Ï´Ù.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ConsoleUpdater.h"
|
||||
#include "DownCallback.h"
|
||||
|
||||
#include "ConsoleUpdaterDlg.h"
|
||||
|
||||
|
||||
// CDownCallback
|
||||
|
||||
CDownCallback::CDownCallback()
|
||||
{
|
||||
}
|
||||
|
||||
CDownCallback::~CDownCallback()
|
||||
{
|
||||
}
|
||||
|
||||
STDMETHODIMP CDownCallback::OnProgress(ULONG ulProgress, ULONG ulProgressMax,
|
||||
ULONG ulStatusCode, LPCWSTR szStatusText)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(ulStatusCode);
|
||||
|
||||
if (ulProgressMax == 0)
|
||||
return S_OK;
|
||||
|
||||
double nPPercent = (double)1 / m_pdlg->m_nTotalCount * 100;
|
||||
double nBPercent = (double)m_pdlg->m_iTerasferring / m_pdlg->m_nTotalCount * 100;
|
||||
double nPercent = (double)ulProgress / ulProgressMax;
|
||||
|
||||
int nTotalPercent = (int)floor(nBPercent + (nPercent * nPPercent));
|
||||
int nNowPercent = (int)floor(nPercent * 100);
|
||||
|
||||
m_pdlg->m_prgTotal.SetPos(nTotalPercent);
|
||||
m_pdlg->m_prgNow.SetPos(nNowPercent);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CDownCallback
|
||||
|
||||
class CDownCallback : public IBindStatusCallback
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
class CConsoleUpdaterDlg* m_pdlg;
|
||||
|
||||
public:
|
||||
CDownCallback();
|
||||
~CDownCallback();
|
||||
|
||||
STDMETHOD_(ULONG,AddRef)() { return 0; }
|
||||
|
||||
STDMETHOD_(ULONG,Release)() { return 0; }
|
||||
|
||||
STDMETHOD(QueryInterface)(
|
||||
/* [in] */ REFIID riid,
|
||||
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject)
|
||||
{ return E_NOTIMPL; }
|
||||
|
||||
STDMETHOD(OnStartBinding)(
|
||||
/* [in] */ DWORD dwReserved,
|
||||
/* [in] */ IBinding __RPC_FAR *pib)
|
||||
{ return E_NOTIMPL; }
|
||||
|
||||
STDMETHOD(GetPriority)(
|
||||
/* [out] */ LONG __RPC_FAR *pnPriority)
|
||||
{ return E_NOTIMPL; }
|
||||
|
||||
STDMETHOD(OnLowResource)(
|
||||
/* [in] */ DWORD reserved)
|
||||
{ return E_NOTIMPL; }
|
||||
|
||||
STDMETHOD(OnProgress)(
|
||||
/* [in] */ ULONG ulProgress,
|
||||
/* [in] */ ULONG ulProgressMax,
|
||||
/* [in] */ ULONG ulStatusCode,
|
||||
/* [in] */ LPCWSTR wszStatusText);
|
||||
|
||||
STDMETHOD(OnStopBinding)(
|
||||
/* [in] */ HRESULT hresult,
|
||||
/* [unique][in] */ LPCWSTR szError)
|
||||
{ return E_NOTIMPL; }
|
||||
|
||||
STDMETHOD(GetBindInfo)(
|
||||
/* [out] */ DWORD __RPC_FAR *grfBINDF,
|
||||
/* [unique][out][in] */ BINDINFO __RPC_FAR *pbindinfo)
|
||||
{ return E_NOTIMPL; }
|
||||
|
||||
STDMETHOD(OnDataAvailable)(
|
||||
/* [in] */ DWORD grfBSCF,
|
||||
/* [in] */ DWORD dwSize,
|
||||
/* [in] */ FORMATETC __RPC_FAR *pformatetc,
|
||||
/* [in] */ STGMEDIUM __RPC_FAR *pstgmed)
|
||||
{ return E_NOTIMPL; }
|
||||
|
||||
STDMETHOD(OnObjectAvailable)(
|
||||
/* [in] */ REFIID riid,
|
||||
/* [iid_is][in] */ IUnknown __RPC_FAR *punk)
|
||||
{ return E_NOTIMPL; }
|
||||
};
|
||||
@@ -0,0 +1,324 @@
|
||||
/********************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2000 Sven Wiegand
|
||||
* Copyright (C) 2000-2001 ToolsCenter
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or
|
||||
* modify, but leave the headers intact and do not remove any
|
||||
* copyrights from the source.
|
||||
*
|
||||
* If you have further questions, suggestions or bug fixes, visit
|
||||
* our homepage
|
||||
*
|
||||
* http://www.ToolsCenter.org
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FileVersionInfo.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[]=__FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
// CFileVersionInfo
|
||||
//-------------------------------------------------------------------
|
||||
|
||||
CFileVersionInfo::CFileVersionInfo()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
CFileVersionInfo::~CFileVersionInfo()
|
||||
{}
|
||||
|
||||
|
||||
BOOL CFileVersionInfo::GetTranslationId(LPVOID lpData, UINT unBlockSize, WORD wLangId, DWORD &dwId, BOOL bPrimaryEnough/*= FALSE*/)
|
||||
{
|
||||
LPWORD lpwData;
|
||||
|
||||
for (lpwData = (LPWORD)lpData; (LPBYTE)lpwData < ((LPBYTE)lpData)+unBlockSize; lpwData+=2)
|
||||
{
|
||||
if (*lpwData == wLangId)
|
||||
{
|
||||
dwId = *((DWORD*)lpwData);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bPrimaryEnough)
|
||||
return FALSE;
|
||||
|
||||
for (lpwData = (LPWORD)lpData; (LPBYTE)lpwData < ((LPBYTE)lpData)+unBlockSize; lpwData+=2)
|
||||
{
|
||||
if (((*lpwData)&0x00FF) == (wLangId&0x00FF))
|
||||
{
|
||||
dwId = *((DWORD*)lpwData);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL CFileVersionInfo::Create(HMODULE hModule /*= NULL*/)
|
||||
{
|
||||
CString strPath;
|
||||
|
||||
GetModuleFileName(hModule, strPath.GetBuffer(_MAX_PATH), _MAX_PATH);
|
||||
strPath.ReleaseBuffer();
|
||||
return Create(strPath);
|
||||
}
|
||||
|
||||
|
||||
BOOL CFileVersionInfo::Create(LPCTSTR lpszFileName)
|
||||
{
|
||||
Reset();
|
||||
|
||||
DWORD dwHandle;
|
||||
DWORD dwFileVersionInfoSize = GetFileVersionInfoSize((LPTSTR)lpszFileName, &dwHandle);
|
||||
if (!dwFileVersionInfoSize)
|
||||
return FALSE;
|
||||
|
||||
LPVOID lpData = (LPVOID)new BYTE[dwFileVersionInfoSize];
|
||||
if (!lpData)
|
||||
return FALSE;
|
||||
|
||||
try
|
||||
{
|
||||
if (!GetFileVersionInfo((LPTSTR)lpszFileName, dwHandle, dwFileVersionInfoSize, lpData))
|
||||
throw FALSE;
|
||||
|
||||
// catch default information
|
||||
LPVOID lpInfo;
|
||||
UINT unInfoLen;
|
||||
if (VerQueryValue(lpData, _T("\\"), &lpInfo, &unInfoLen))
|
||||
{
|
||||
ASSERT(unInfoLen == sizeof(m_FileInfo));
|
||||
if (unInfoLen == sizeof(m_FileInfo))
|
||||
memcpy(&m_FileInfo, lpInfo, unInfoLen);
|
||||
}
|
||||
|
||||
// find best matching language and codepage
|
||||
VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), &lpInfo, &unInfoLen);
|
||||
|
||||
DWORD dwLangCode = 0;
|
||||
if (!GetTranslationId(lpInfo, unInfoLen, GetUserDefaultLangID(), dwLangCode, FALSE))
|
||||
{
|
||||
if (!GetTranslationId(lpInfo, unInfoLen, GetUserDefaultLangID(), dwLangCode, TRUE))
|
||||
{
|
||||
if (!GetTranslationId(lpInfo, unInfoLen, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), dwLangCode, TRUE))
|
||||
{
|
||||
if (!GetTranslationId(lpInfo, unInfoLen, MAKELANGID(LANG_ENGLISH, SUBLANG_NEUTRAL), dwLangCode, TRUE))
|
||||
// use the first one we can get
|
||||
dwLangCode = *((DWORD*)lpInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CString strSubBlock;
|
||||
strSubBlock.Format(_T("\\StringFileInfo\\%04X%04X\\"), dwLangCode&0x0000FFFF, (dwLangCode&0xFFFF0000)>>16);
|
||||
|
||||
// catch string table
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("CompanyName")), &lpInfo, &unInfoLen))
|
||||
m_strCompanyName = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("FileDescription")), &lpInfo, &unInfoLen))
|
||||
m_strFileDescription = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("FileVersion")), &lpInfo, &unInfoLen))
|
||||
m_strFileVersion = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("InternalName")), &lpInfo, &unInfoLen))
|
||||
m_strInternalName = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("LegalCopyright")), &lpInfo, &unInfoLen))
|
||||
m_strLegalCopyright = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("OriginalFileName")), &lpInfo, &unInfoLen))
|
||||
m_strOriginalFileName = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("ProductName")), &lpInfo, &unInfoLen))
|
||||
m_strProductName = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("ProductVersion")), &lpInfo, &unInfoLen))
|
||||
m_strProductVersion = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("Comments")), &lpInfo, &unInfoLen))
|
||||
m_strComments = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("LegalTrademarks")), &lpInfo, &unInfoLen))
|
||||
m_strLegalTrademarks = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("PrivateBuild")), &lpInfo, &unInfoLen))
|
||||
m_strPrivateBuild = CString((LPCTSTR)lpInfo);
|
||||
if (VerQueryValue(lpData, (LPTSTR)(LPCTSTR)(strSubBlock+_T("SpecialBuild")), &lpInfo, &unInfoLen))
|
||||
m_strSpecialBuild = CString((LPCTSTR)lpInfo);
|
||||
|
||||
delete[] lpData;
|
||||
}
|
||||
catch (BOOL)
|
||||
{
|
||||
delete[] lpData;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
WORD CFileVersionInfo::GetFileVersion(int nIndex) const
|
||||
{
|
||||
if (nIndex == 0)
|
||||
return (WORD)(m_FileInfo.dwFileVersionLS & 0x0000FFFF);
|
||||
else if (nIndex == 1)
|
||||
return (WORD)((m_FileInfo.dwFileVersionLS & 0xFFFF0000) >> 16);
|
||||
else if (nIndex == 2)
|
||||
return (WORD)(m_FileInfo.dwFileVersionMS & 0x0000FFFF);
|
||||
else if (nIndex == 3)
|
||||
return (WORD)((m_FileInfo.dwFileVersionMS & 0xFFFF0000) >> 16);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
WORD CFileVersionInfo::GetProductVersion(int nIndex) const
|
||||
{
|
||||
if (nIndex == 0)
|
||||
return (WORD)(m_FileInfo.dwProductVersionLS & 0x0000FFFF);
|
||||
else if (nIndex == 1)
|
||||
return (WORD)((m_FileInfo.dwProductVersionLS & 0xFFFF0000) >> 16);
|
||||
else if (nIndex == 2)
|
||||
return (WORD)(m_FileInfo.dwProductVersionMS & 0x0000FFFF);
|
||||
else if (nIndex == 3)
|
||||
return (WORD)((m_FileInfo.dwProductVersionMS & 0xFFFF0000) >> 16);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
DWORD CFileVersionInfo::GetFileFlagsMask() const
|
||||
{
|
||||
return m_FileInfo.dwFileFlagsMask;
|
||||
}
|
||||
|
||||
|
||||
DWORD CFileVersionInfo::GetFileFlags() const
|
||||
{
|
||||
return m_FileInfo.dwFileFlags;
|
||||
}
|
||||
|
||||
|
||||
DWORD CFileVersionInfo::GetFileOs() const
|
||||
{
|
||||
return m_FileInfo.dwFileOS;
|
||||
}
|
||||
|
||||
|
||||
DWORD CFileVersionInfo::GetFileType() const
|
||||
{
|
||||
return m_FileInfo.dwFileType;
|
||||
}
|
||||
|
||||
|
||||
DWORD CFileVersionInfo::GetFileSubtype() const
|
||||
{
|
||||
return m_FileInfo.dwFileSubtype;
|
||||
}
|
||||
|
||||
|
||||
CTime CFileVersionInfo::GetFileDate() const
|
||||
{
|
||||
FILETIME ft;
|
||||
ft.dwLowDateTime = m_FileInfo.dwFileDateLS;
|
||||
ft.dwHighDateTime = m_FileInfo.dwFileDateMS;
|
||||
return CTime(ft);
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetCompanyName() const
|
||||
{
|
||||
return m_strCompanyName;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetFileDescription() const
|
||||
{
|
||||
return m_strFileDescription;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetFileVersion() const
|
||||
{
|
||||
return m_strFileVersion;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetInternalName() const
|
||||
{
|
||||
return m_strInternalName;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetLegalCopyright() const
|
||||
{
|
||||
return m_strLegalCopyright;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetOriginalFileName() const
|
||||
{
|
||||
return m_strOriginalFileName;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetProductName() const
|
||||
{
|
||||
return m_strProductName;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetProductVersion() const
|
||||
{
|
||||
return m_strProductVersion;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetComments() const
|
||||
{
|
||||
return m_strComments;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetLegalTrademarks() const
|
||||
{
|
||||
return m_strLegalTrademarks;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetPrivateBuild() const
|
||||
{
|
||||
return m_strPrivateBuild;
|
||||
}
|
||||
|
||||
|
||||
CString CFileVersionInfo::GetSpecialBuild() const
|
||||
{
|
||||
return m_strSpecialBuild;
|
||||
}
|
||||
|
||||
|
||||
void CFileVersionInfo::Reset()
|
||||
{
|
||||
ZeroMemory(&m_FileInfo, sizeof(m_FileInfo));
|
||||
m_strCompanyName.Empty();
|
||||
m_strFileDescription.Empty();
|
||||
m_strFileVersion.Empty();
|
||||
m_strInternalName.Empty();
|
||||
m_strLegalCopyright.Empty();
|
||||
m_strOriginalFileName.Empty();
|
||||
m_strProductName.Empty();
|
||||
m_strProductVersion.Empty();
|
||||
m_strComments.Empty();
|
||||
m_strLegalTrademarks.Empty();
|
||||
m_strPrivateBuild.Empty();
|
||||
m_strSpecialBuild.Empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/********************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2000 Sven Wiegand
|
||||
* Copyright (C) 2000-2001 ToolsCenter
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or
|
||||
* modify, but leave the headers intact and do not remove any
|
||||
* copyrights from the source.
|
||||
*
|
||||
* If you have further questions, suggestions or bug fixes, visit
|
||||
* our homepage
|
||||
*
|
||||
* http://www.ToolsCenter.org
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
#if !defined(AFX_FILEVERSION_H__F828004C_7680_40FE_A08D_7BB4FF05B4CC__INCLUDED_)
|
||||
#define AFX_FILEVERSION_H__F828004C_7680_40FE_A08D_7BB4FF05B4CC__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <winver.h>
|
||||
|
||||
class CFileVersionInfo
|
||||
{
|
||||
// construction/destruction
|
||||
public:
|
||||
CFileVersionInfo();
|
||||
virtual ~CFileVersionInfo();
|
||||
|
||||
// operations
|
||||
public:
|
||||
BOOL Create(HMODULE hModule = NULL);
|
||||
BOOL Create(LPCTSTR lpszFileName);
|
||||
|
||||
// attribute operations
|
||||
public:
|
||||
WORD GetFileVersion(int nIndex) const;
|
||||
WORD GetProductVersion(int nIndex) const;
|
||||
DWORD GetFileFlagsMask() const;
|
||||
DWORD GetFileFlags() const;
|
||||
DWORD GetFileOs() const;
|
||||
DWORD GetFileType() const;
|
||||
DWORD GetFileSubtype() const;
|
||||
CTime GetFileDate() const;
|
||||
|
||||
CString GetCompanyName() const;
|
||||
CString GetFileDescription() const;
|
||||
CString GetFileVersion() const;
|
||||
CString GetInternalName() const;
|
||||
CString GetLegalCopyright() const;
|
||||
CString GetOriginalFileName() const;
|
||||
CString GetProductName() const;
|
||||
CString GetProductVersion() const;
|
||||
CString GetComments() const;
|
||||
CString GetLegalTrademarks() const;
|
||||
CString GetPrivateBuild() const;
|
||||
CString GetSpecialBuild() const;
|
||||
|
||||
// implementation helpers
|
||||
protected:
|
||||
virtual void Reset();
|
||||
BOOL GetTranslationId(LPVOID lpData, UINT unBlockSize, WORD wLangId, DWORD &dwId, BOOL bPrimaryEnough = FALSE);
|
||||
|
||||
// attributes
|
||||
private:
|
||||
VS_FIXEDFILEINFO m_FileInfo;
|
||||
|
||||
CString m_strCompanyName;
|
||||
CString m_strFileDescription;
|
||||
CString m_strFileVersion;
|
||||
CString m_strInternalName;
|
||||
CString m_strLegalCopyright;
|
||||
CString m_strOriginalFileName;
|
||||
CString m_strProductName;
|
||||
CString m_strProductVersion;
|
||||
CString m_strComments;
|
||||
CString m_strLegalTrademarks;
|
||||
CString m_strPrivateBuild;
|
||||
CString m_strSpecialBuild;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_FILEVERSION_H__F828004C_7680_40FE_A08D_7BB4FF05B4CC__INCLUDED_)
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<SP-Console>
|
||||
<Settings>
|
||||
<Item name="Save Password" type="numeric">1</Item>
|
||||
<Item name="User ID" type="string">soribada</Item>
|
||||
<Item name="Password" type="string">001004011004001007007011015000117117115113118118115126121121126124121122127101105098096108101099110104106104099100113095088067095095093001004003004006005007014010</Item>
|
||||
<Item name="Windows Position" type="string">1 -4 -4 1284 978</Item>
|
||||
<Item name="Splitter Size" type="string">610</Item>
|
||||
<Item name="Remote Tree Size" type="numeric">300</Item>
|
||||
<Item name="Local Tree Size" type="numeric">300</Item>
|
||||
<Item name="Write Policy" type="numeric">1</Item>
|
||||
<Item name="Auto Connect" type="numeric">1</Item>
|
||||
</Settings>
|
||||
</SP-Console>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="X86"
|
||||
name="Microsoft.Windows.ConsoleUpdater"
|
||||
type="win32"
|
||||
/>
|
||||
<description>Console Updater</description>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="X86"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
</assembly>
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// ConsoleUpdater.RC2 - resources Microsoft Visual C++에서 직접 편집하지 않는 리소스
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#error 이 파일은 Microsoft Visual C++에서 편집할 수 없습니다.
|
||||
#endif //APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 여기에 수동으로 편집한 리소스를 추가합니다.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -0,0 +1,24 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by ConsoleUpdater.rc
|
||||
//
|
||||
#define IDM_ABOUTBOX 0x0010
|
||||
#define IDS_ABOUTBOX 101
|
||||
#define IDD_CONSOLE_UPDATER_DIALOG 102
|
||||
#define IDR_MAINFRAME 128
|
||||
#define ID_CANCEL 1000
|
||||
#define IDC_PRG_TOTAL 1001
|
||||
#define IDC_STC_TITLE 1002
|
||||
#define IDC_PRG_NOW 1003
|
||||
#define IDC_STC_LTIME 1004
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 129
|
||||
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||
#define _APS_NEXT_CONTROL_VALUE 1004
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,7 @@
|
||||
// stdafx.cpp : 표준 포함 파일을 포함하는 소스 파일입니다.
|
||||
// SP-Updater.pch는 미리 컴파일된 헤더가 됩니다.
|
||||
// stdafx.obj는 미리 컴파일된 형식 정보를 포함합니다.
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// stdafx.h : 잘 변경되지 않고 자주 사용하는
|
||||
// 표준 시스템 포함 파일 및 프로젝트 관련 포함 파일이
|
||||
// 들어 있는 포함 파일입니다.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef VC_EXTRALEAN
|
||||
#define VC_EXTRALEAN // Windows 헤더에서 거의 사용되지 않는 내용을 제외시킵니다.
|
||||
#endif
|
||||
|
||||
// 아래 지정된 플랫폼보다 우선하는 플랫폼을 대상으로 하는 경우 다음 정의를 수정하십시오.
|
||||
// 다른 플랫폼에 사용되는 해당 값의 최신 정보는 MSDN을 참조하십시오.
|
||||
#ifndef WINVER // Windows 95 및 Windows NT 4 이후 버전에서만 기능을 사용할 수 있습니다.
|
||||
#define WINVER 0x0400 // Windows 98과 Windows 2000 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WINNT // Windows NT 4 이후 버전에서만 기능을 사용할 수 있습니다.
|
||||
#define _WIN32_WINNT 0x0400 // Windows 98과 Windows 2000 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WINDOWS // Windows 98 이후 버전에서만 기능을 사용할 수 있습니다.
|
||||
#define _WIN32_WINDOWS 0x0410 // Windows Me 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_IE // IE 4.0 이후 버전에서만 기능을 사용할 수 있습니다.
|
||||
#define _WIN32_IE 0x0400 // IE 5.0 이후 버전에 맞도록 적합한 값으로 변경해 주십시오.
|
||||
#endif
|
||||
|
||||
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 일부 CString 생성자는 명시적으로 선언됩니다.
|
||||
|
||||
// MFC의 공통 부분과 무시 가능한 경고 메시지에 대한 숨기기를 해제합니다.
|
||||
#define _AFX_ALL_WARNINGS
|
||||
|
||||
#include <afxwin.h> // MFC 핵심 및 표준 구성 요소
|
||||
#include <afxext.h> // MFC 익스텐션
|
||||
#include <afxdisp.h> // MFC 자동화 클래스
|
||||
|
||||
#include <afxdtctl.h> // Internet Explorer 4 공용 컨트롤에 대한 MFC 지원
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // Windows 공용 컨트롤에 대한 MFC 지원
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <math.h>
|
||||
#include <io.h>
|
||||
#include <winsock2.h>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,214 @@
|
||||
#ifndef _unzip_H
|
||||
#define _unzip_H
|
||||
|
||||
// UNZIPPING functions -- for unzipping.
|
||||
// This file is a repackaged form of extracts from the zlib code available
|
||||
// at www.gzip.org/zlib, by Jean-Loup Gailly and Mark Adler. The original
|
||||
// copyright notice may be found in unzip.cpp. The repackaging was done
|
||||
// by Lucian Wischik to simplify and extend its use in Windows/C++. Also
|
||||
// encryption and unicode filenames have been added.
|
||||
|
||||
|
||||
#ifndef _zip_H
|
||||
DECLARE_HANDLE(HZIP);
|
||||
#endif
|
||||
// An HZIP identifies a zip file that has been opened
|
||||
|
||||
typedef DWORD ZRESULT;
|
||||
// return codes from any of the zip functions. Listed later.
|
||||
|
||||
typedef struct
|
||||
{ int index; // index of this file within the zip
|
||||
TCHAR name[MAX_PATH]; // filename within the zip
|
||||
DWORD attr; // attributes, as in GetFileAttributes.
|
||||
FILETIME atime,ctime,mtime;// access, create, modify filetimes
|
||||
long comp_size; // sizes of item, compressed and uncompressed. These
|
||||
long unc_size; // may be -1 if not yet known (e.g. being streamed in)
|
||||
} ZIPENTRY;
|
||||
|
||||
|
||||
HZIP OpenZip(const TCHAR *fn, const char *password);
|
||||
HZIP OpenZip(void *z,unsigned int len, const char *password);
|
||||
HZIP OpenZipHandle(HANDLE h, const char *password);
|
||||
// OpenZip - opens a zip file and returns a handle with which you can
|
||||
// subsequently examine its contents. You can open a zip file from:
|
||||
// from a pipe: OpenZipHandle(hpipe_read,0);
|
||||
// from a file (by handle): OpenZipHandle(hfile,0);
|
||||
// from a file (by name): OpenZip("c:\\test.zip","password");
|
||||
// from a memory block: OpenZip(bufstart, buflen,0);
|
||||
// If the file is opened through a pipe, then items may only be
|
||||
// accessed in increasing order, and an item may only be unzipped once,
|
||||
// although GetZipItem can be called immediately before and after unzipping
|
||||
// it. If it's opened in any other way, then full random access is possible.
|
||||
// Note: pipe input is not yet implemented.
|
||||
// Note: zip passwords are ascii, not unicode.
|
||||
// Note: for windows-ce, you cannot close the handle until after CloseZip.
|
||||
// but for real windows, the zip makes its own copy of your handle, so you
|
||||
// can close yours anytime.
|
||||
|
||||
ZRESULT GetZipItem(HZIP hz, int index, ZIPENTRY *ze);
|
||||
// GetZipItem - call this to get information about an item in the zip.
|
||||
// If index is -1 and the file wasn't opened through a pipe,
|
||||
// then it returns information about the whole zipfile
|
||||
// (and in particular ze.index returns the number of index items).
|
||||
// Note: the item might be a directory (ze.attr & FILE_ATTRIBUTE_DIRECTORY)
|
||||
// See below for notes on what happens when you unzip such an item.
|
||||
// Note: if you are opening the zip through a pipe, then random access
|
||||
// is not possible and GetZipItem(-1) fails and you can't discover the number
|
||||
// of items except by calling GetZipItem on each one of them in turn,
|
||||
// starting at 0, until eventually the call fails. Also, in the event that
|
||||
// you are opening through a pipe and the zip was itself created into a pipe,
|
||||
// then then comp_size and sometimes unc_size as well may not be known until
|
||||
// after the item has been unzipped.
|
||||
|
||||
ZRESULT FindZipItem(HZIP hz, const TCHAR *name, bool ic, int *index, ZIPENTRY *ze);
|
||||
// FindZipItem - finds an item by name. ic means 'insensitive to case'.
|
||||
// It returns the index of the item, and returns information about it.
|
||||
// If nothing was found, then index is set to -1 and the function returns
|
||||
// an error code.
|
||||
|
||||
ZRESULT UnzipItem(HZIP hz, int index, const TCHAR *fn);
|
||||
ZRESULT UnzipItem(HZIP hz, int index, void *z,unsigned int len);
|
||||
ZRESULT UnzipItemHandle(HZIP hz, int index, HANDLE h);
|
||||
// UnzipItem - given an index to an item, unzips it. You can unzip to:
|
||||
// to a pipe: UnzipItemHandle(hz,i, hpipe_write);
|
||||
// to a file (by handle): UnzipItemHandle(hz,i, hfile);
|
||||
// to a file (by name): UnzipItem(hz,i, ze.name);
|
||||
// to a memory block: UnzipItem(hz,i, buf,buflen);
|
||||
// In the final case, if the buffer isn't large enough to hold it all,
|
||||
// then the return code indicates that more is yet to come. If it was
|
||||
// large enough, and you want to know precisely how big, GetZipItem.
|
||||
// Note: zip files are normally stored with relative pathnames. If you
|
||||
// unzip with ZIP_FILENAME a relative pathname then the item gets created
|
||||
// relative to the current directory - it first ensures that all necessary
|
||||
// subdirectories have been created. Also, the item may itself be a directory.
|
||||
// If you unzip a directory with ZIP_FILENAME, then the directory gets created.
|
||||
// If you unzip it to a handle or a memory block, then nothing gets created
|
||||
// and it emits 0 bytes.
|
||||
ZRESULT SetUnzipBaseDir(HZIP hz, const TCHAR *dir);
|
||||
// if unzipping to a filename, and it's a relative filename, then it will be relative to here.
|
||||
// (defaults to current-directory).
|
||||
|
||||
|
||||
ZRESULT CloseZip(HZIP hz);
|
||||
// CloseZip - the zip handle must be closed with this function.
|
||||
|
||||
unsigned int FormatZipMessage(ZRESULT code, TCHAR *buf,unsigned int len);
|
||||
// FormatZipMessage - given an error code, formats it as a string.
|
||||
// It returns the length of the error message. If buf/len points
|
||||
// to a real buffer, then it also writes as much as possible into there.
|
||||
|
||||
|
||||
// These are the result codes:
|
||||
#define ZR_OK 0x00000000 // nb. the pseudo-code zr-recent is never returned,
|
||||
#define ZR_RECENT 0x00000001 // but can be passed to FormatZipMessage.
|
||||
// The following come from general system stuff (e.g. files not openable)
|
||||
#define ZR_GENMASK 0x0000FF00
|
||||
#define ZR_NODUPH 0x00000100 // couldn't duplicate the handle
|
||||
#define ZR_NOFILE 0x00000200 // couldn't create/open the file
|
||||
#define ZR_NOALLOC 0x00000300 // failed to allocate some resource
|
||||
#define ZR_WRITE 0x00000400 // a general error writing to the file
|
||||
#define ZR_NOTFOUND 0x00000500 // couldn't find that file in the zip
|
||||
#define ZR_MORE 0x00000600 // there's still more data to be unzipped
|
||||
#define ZR_CORRUPT 0x00000700 // the zipfile is corrupt or not a zipfile
|
||||
#define ZR_READ 0x00000800 // a general error reading the file
|
||||
#define ZR_PASSWORD 0x00001000 // we didn't get the right password to unzip the file
|
||||
// The following come from mistakes on the part of the caller
|
||||
#define ZR_CALLERMASK 0x00FF0000
|
||||
#define ZR_ARGS 0x00010000 // general mistake with the arguments
|
||||
#define ZR_NOTMMAP 0x00020000 // tried to ZipGetMemory, but that only works on mmap zipfiles, which yours wasn't
|
||||
#define ZR_MEMSIZE 0x00030000 // the memory size is too small
|
||||
#define ZR_FAILED 0x00040000 // the thing was already failed when you called this function
|
||||
#define ZR_ENDED 0x00050000 // the zip creation has already been closed
|
||||
#define ZR_MISSIZE 0x00060000 // the indicated input file size turned out mistaken
|
||||
#define ZR_PARTIALUNZ 0x00070000 // the file had already been partially unzipped
|
||||
#define ZR_ZMODE 0x00080000 // tried to mix creating/opening a zip
|
||||
// The following come from bugs within the zip library itself
|
||||
#define ZR_BUGMASK 0xFF000000
|
||||
#define ZR_NOTINITED 0x01000000 // initialisation didn't work
|
||||
#define ZR_SEEK 0x02000000 // trying to seek in an unseekable file
|
||||
#define ZR_NOCHANGE 0x04000000 // changed its mind on storage, but not allowed
|
||||
#define ZR_FLATE 0x05000000 // an internal error in the de/inflation code
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// e.g.
|
||||
//
|
||||
// SetCurrentDirectory("c:\\docs\\stuff");
|
||||
// HZIP hz = OpenZip("c:\\stuff.zip",0);
|
||||
// ZIPENTRY ze; GetZipItem(hz,-1,&ze); int numitems=ze.index;
|
||||
// for (int i=0; i<numitems; i++)
|
||||
// { GetZipItem(hz,i,&ze);
|
||||
// UnzipItem(hz,i,ze.name);
|
||||
// }
|
||||
// CloseZip(hz);
|
||||
//
|
||||
//
|
||||
// HRSRC hrsrc = FindResource(hInstance,MAKEINTRESOURCE(1),RT_RCDATA);
|
||||
// HANDLE hglob = LoadResource(hInstance,hrsrc);
|
||||
// void *zipbuf=LockResource(hglob);
|
||||
// unsigned int ziplen=SizeofResource(hInstance,hrsrc);
|
||||
// HZIP hz = OpenZip(zipbuf, ziplen, 0);
|
||||
// - unzip to a membuffer -
|
||||
// ZIPENTRY ze; int i; FindZipItem(hz,"file.dat",true,&i,&ze);
|
||||
// char *ibuf = new char[ze.unc_size];
|
||||
// UnzipItem(hz,i, ibuf, ze.unc_size);
|
||||
// delete[] ibuf;
|
||||
// - unzip to a fixed membuff -
|
||||
// ZIPENTRY ze; int i; FindZipItem(hz,"file.dat",true,&i,&ze);
|
||||
// char ibuf[1024]; ZRESULT zr=ZR_MORE; unsigned long totsize=0;
|
||||
// while (zr==ZR_MORE)
|
||||
// { zr = UnzipItem(hz,i, ibuf,1024);
|
||||
// unsigned long bufsize=1024; if (zr==ZR_OK) bufsize=ze.unc_size-totsize;
|
||||
// totsize+=bufsize;
|
||||
// }
|
||||
// - unzip to a pipe -
|
||||
// HANDLE hwrite; HANDLE hthread=CreateWavReaderThread(&hwrite);
|
||||
// int i; ZIPENTRY ze; FindZipItem(hz,"sound.wav",true,&i,&ze);
|
||||
// UnzipItemHandle(hz,i, hwrite);
|
||||
// CloseHandle(hwrite);
|
||||
// WaitForSingleObject(hthread,INFINITE);
|
||||
// CloseHandle(hwrite); CloseHandle(hthread);
|
||||
// - finished -
|
||||
// CloseZip(hz);
|
||||
// // note: no need to free resources obtained through Find/Load/LockResource
|
||||
//
|
||||
//
|
||||
// SetCurrentDirectory("c:\\docs\\pipedzipstuff");
|
||||
// HANDLE hread,hwrite; CreatePipe(&hread,&hwrite,0,0);
|
||||
// CreateZipWriterThread(hwrite);
|
||||
// HZIP hz = OpenZipHandle(hread,0);
|
||||
// for (int i=0; ; i++)
|
||||
// { ZIPENTRY ze;
|
||||
// ZRESULT zr=GetZipItem(hz,i,&ze); if (zr!=ZR_OK) break; // no more
|
||||
// UnzipItem(hz,i, ze.name);
|
||||
// }
|
||||
// CloseZip(hz);
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
// Now we indulge in a little skullduggery so that the code works whether
|
||||
// the user has included just zip or both zip and unzip.
|
||||
// Idea: if header files for both zip and unzip are present, then presumably
|
||||
// the cpp files for zip and unzip are both present, so we will call
|
||||
// one or the other of them based on a dynamic choice. If the header file
|
||||
// for only one is present, then we will bind to that particular one.
|
||||
ZRESULT CloseZipU(HZIP hz);
|
||||
unsigned int FormatZipMessageU(ZRESULT code, TCHAR *buf,unsigned int len);
|
||||
bool IsZipHandleU(HZIP hz);
|
||||
#ifdef _zip_H
|
||||
#undef CloseZip
|
||||
#define CloseZip(hz) (IsZipHandleU(hz)?CloseZipU(hz):CloseZipZ(hz))
|
||||
#else
|
||||
#define CloseZip CloseZipU
|
||||
#define FormatZipMessage FormatZipMessageU
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif // _unzip_H
|
||||
Reference in New Issue
Block a user