// DnAutoUpdate.cpp : ÀÀ¿ë ÇÁ·Î±×·¥¿¡ ´ëÇÑ Å¬·¡½º µ¿ÀÛÀ» Á¤ÀÇÇÕ´Ï´Ù. // #include "stdafx.h" #include "DnAutoUpdate.h" #include "DnAutoUpdateDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #endif extern CString g_strHttpPath; extern CString g_strLocalPath; extern vector g_vecUpdateVersion; // CDnAutoUpdateApp BEGIN_MESSAGE_MAP(CDnAutoUpdateApp, CWinApp) ON_COMMAND(ID_HELP, &CWinApp::OnHelp) END_MESSAGE_MAP() int __cdecl DefautAllocHook( int, void *, size_t, int, long, const unsigned char *, int ) { return 1; } int __cdecl MyAllocHook( int nAllocType, void * pvData, size_t nSize, int nBlockUse, long lRequest, const unsigned char * szFileName, int nLine ) { if( nAllocType == _HOOK_ALLOC && nSize == 196 ) { int a = 0; } return 1; } // CDnAutoUpdateApp »ý¼º CDnAutoUpdateApp::CDnAutoUpdateApp() { // TODO: ¿©±â¿¡ »ý¼º Äڵ带 Ãß°¡ÇÕ´Ï´Ù. // InitInstance¿¡ ¸ðµç Áß¿äÇÑ ÃʱâÈ­ ÀÛ¾÷À» ¹èÄ¡ÇÕ´Ï´Ù. // _CrtSetAllocHook( MyAllocHook ); // _CrtSetBreakAlloc(59925); } // À¯ÀÏÇÑ CDnAutoUpdateApp °³Ã¼ÀÔ´Ï´Ù. CDnAutoUpdateApp theApp; // CDnAutoUpdateApp ÃʱâÈ­ BOOL CDnAutoUpdateApp::InitInstance() { // ÀÀ¿ë ÇÁ·Î±×·¥ ¸Å´ÏÆä½ºÆ®°¡ ComCtl32.dll ¹öÀü 6 ÀÌ»óÀ» »ç¿ëÇÏ¿© ºñÁÖ¾ó ½ºÅ¸ÀÏÀ» // »ç¿ëÇϵµ·Ï ÁöÁ¤ÇÏ´Â °æ¿ì, Windows XP »ó¿¡¼­ ¹Ýµå½Ã InitCommonControlsEx()°¡ ÇÊ¿äÇÕ´Ï´Ù. // InitCommonControlsEx()¸¦ »ç¿ëÇÏÁö ¾ÊÀ¸¸é âÀ» ¸¸µé ¼ö ¾ø½À´Ï´Ù. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // ÀÀ¿ë ÇÁ·Î±×·¥¿¡¼­ »ç¿ëÇÒ ¸ðµç °ø¿ë ÄÁÆ®·Ñ Ŭ·¡½º¸¦ Æ÷ÇÔÇϵµ·Ï // ÀÌ Ç׸ñÀ» ¼³Á¤ÇϽʽÿÀ. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); AfxEnableControlContainer(); // Ç¥ÁØ ÃʱâÈ­ // ÀÌµé ±â´ÉÀ» »ç¿ëÇÏÁö ¾Ê°í ÃÖÁ¾ ½ÇÇà ÆÄÀÏÀÇ Å©±â¸¦ ÁÙÀÌ·Á¸é // ¾Æ·¡¿¡¼­ ÇÊ¿ä ¾ø´Â ƯÁ¤ ÃʱâÈ­ // ·çƾÀ» Á¦°ÅÇØ¾ß ÇÕ´Ï´Ù. // ÇØ´ç ¼³Á¤ÀÌ ÀúÀåµÈ ·¹Áö½ºÆ®¸® ۸¦ º¯°æÇϽʽÿÀ. // TODO: ÀÌ ¹®ÀÚ¿­À» ȸ»ç ¶Ç´Â Á¶Á÷ÀÇ À̸§°ú °°Àº // ÀûÀýÇÑ ³»¿ëÀ¸·Î ¼öÁ¤ÇØ¾ß ÇÕ´Ï´Ù. SetRegistryKey(_T("·ÎÄà ÀÀ¿ë ÇÁ·Î±×·¥ ¸¶¹ý»ç¿¡¼­ »ý¼ºµÈ ÀÀ¿ë ÇÁ·Î±×·¥")); CString strCmdLine = m_lpCmdLine; int nIndex = strCmdLine.Find( '|' ); g_strHttpPath = strCmdLine.Left( nIndex ); strCmdLine.Delete( 0, nIndex + 1 ); nIndex = strCmdLine.Find( '|' ); g_strLocalPath = strCmdLine.Left( nIndex ); strCmdLine.Delete( 0, nIndex + 1 ); nIndex = strCmdLine.Find( '-' ); char szTemp[256] = { 0, }; WideCharToMultiByte( CP_ACP, 0, strCmdLine.Left( nIndex ).GetBuffer(), -1, szTemp, sizeof(szTemp), NULL, NULL ); int nStartVersion = atoi( szTemp ); strCmdLine.Delete( 0, nIndex + 1 ); WideCharToMultiByte( CP_ACP, 0, strCmdLine.GetBuffer(), -1, szTemp, sizeof(szTemp), NULL, NULL ); int nTargetVersion = atoi( szTemp ); if( g_strHttpPath.GetLength() == 0 || g_strLocalPath.GetLength() == 0 ) return FALSE; if( nStartVersion == 0 || nTargetVersion == 0 || nStartVersion > nTargetVersion ) return FALSE; for( int i=nStartVersion; i<=nTargetVersion; i++ ) g_vecUpdateVersion.push_back( i ); CDnAutoUpdateDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: ¿©±â¿¡ [È®ÀÎ]À» Ŭ¸¯ÇÏ¿© ´ëÈ­ »óÀÚ°¡ ¾ø¾îÁú ¶§ ó¸®ÇÒ // Äڵ带 ¹èÄ¡ÇÕ´Ï´Ù. } else if (nResponse == IDCANCEL) { // TODO: ¿©±â¿¡ [Ãë¼Ò]¸¦ Ŭ¸¯ÇÏ¿© ´ëÈ­ »óÀÚ°¡ ¾ø¾îÁú ¶§ ó¸®ÇÒ // Äڵ带 ¹èÄ¡ÇÕ´Ï´Ù. } // ´ëÈ­ »óÀÚ°¡ ´ÝÇûÀ¸¹Ç·Î ÀÀ¿ë ÇÁ·Î±×·¥ÀÇ ¸Þ½ÃÁö ÆßÇÁ¸¦ ½ÃÀÛÇÏÁö ¾Ê°í ÀÀ¿ë ÇÁ·Î±×·¥À» ³¡³¾ ¼ö ÀÖµµ·Ï FALSE¸¦ // ¹ÝȯÇÕ´Ï´Ù. return FALSE; }