Files
KeyGenerator/KeyGenerator.cpp
T
Dario Sassi 94640720eb KeyGenerator 1.5i2 :
- primo rilascio.
2014-09-13 21:32:52 +00:00

106 lines
3.2 KiB
C++

//----------------------------------------------------------------------------
// EgalTech 2013-2014
//----------------------------------------------------------------------------
// File : KeyGenerator.cpp Data : 11.09.14 Versione : 1.5i2
// Contenuto : Implementazione della classe applicazione generatore chiavi.
//
//
//
// Modifiche : 11.09.14 DS Creazione modulo.
//
//
//----------------------------------------------------------------------------
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "KeyGenerator.h"
#include "KeyGeneratorDlg.h"
#include "/EgtDev/Include/EgnGetModuleVer.h"
#include "/EgtDev/Include/EGnStringConverter.h"
#include "/EgtDev/Include/EgtIniFile.h"
#include "/EgtDev/Include/SELkKeyProc.h"
using namespace std ;
//----------------------------------------------------------------------------
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//--------------------------- Define -----------------------------------------
#if defined( NDEBUG)
#define STR_EXE "KeyGeneratorR32.exe"
#else
#define STR_EXE "KeyGeneratorD32.exe"
#endif
//----------------------------------------------------------------------------
// The one and only CKeyGeneratorApp object
CKeyGeneratorApp theApp ;
//----------------------------------------------------------------------------
BEGIN_MESSAGE_MAP( CKeyGeneratorApp, CWinApp)
ON_COMMAND( ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
//----------------------------------------------------------------------------
CKeyGeneratorApp::CKeyGeneratorApp( void)
{
}
//----------------------------------------------------------------------------
BOOL
CKeyGeneratorApp::InitInstance( void)
{
// CommonControls initialize
INITCOMMONCONTROLSEX InitCtrls ;
InitCtrls.dwSize = sizeof(InitCtrls) ;
InitCtrls.dwICC = ICC_WIN95_CLASSES ;
InitCommonControlsEx(&InitCtrls) ;
CWinApp::InitInstance() ;
AfxEnableControlContainer() ;
// esco se debug nella versione release
#if defined( NDEBUG)
BOOL IsDbgPresent = FALSE ;
CheckRemoteDebuggerPresent( GetCurrentProcess(), &IsDbgPresent) ;
if ( IsDbgPresent)
return FALSE ;
#endif
// recupero il direttorio del programma e lo imposto come corrente
string sDir ;
GetModuleDirectory( NULL, sDir) ;
SetCurrentDirectory( stringtoW( sDir)) ;
// costruisco path file INI
string sFileIni= sDir + "\\KeyGenerator.ini" ;
wchar_t* p = _wcsdup( stringtoW( sFileIni)) ;
free( (void*) m_pszProfileName) ;
m_pszProfileName = p ;
// verifico la protezione
string sKey = GetPrivateProfileStringUtf8( "General", "Key", "", m_pszProfileName) ;
if ( VerifyKey( sKey, 1230, 15, 01) != KEY_OK)
return FALSE ;
// Dialog interface
CKeyGeneratorDlg dlg ;
m_pMainWnd = &dlg ;
dlg.DoModal() ;
// Per uscire dall'applicazione
return FALSE ;
}
//----------------------------------------------------------------------------
string
GetExeNameVer( void)
{
string sVer ;
GetModuleVersion( NULL, sVer) ;
return string( STR_EXE " ver." + sVer) ;
}