From 976c758abd558b7c54659c6231861021c0382adf Mon Sep 17 00:00:00 2001 From: Gerardo Date: Mon, 6 Apr 2020 12:58:42 +0200 Subject: [PATCH] Comnpilacion inicial de libreria partiendo de la de v2008 --- .gitignore | 5 + ConexionClienteLicSrv.cpp | 132 ++++++++ ConexionClienteLicSrv.h | 24 ++ LicCliente.cpp | 214 ++++++++++++ LicCliente.h | 25 ++ LicUtiles.cpp | 68 ++++ LicUtiles.h | 22 ++ LicUtilesDef.h | 44 +++ Licencia.cpp | 124 +++++++ Licencia.h | 51 +++ LicenciasManager.cpp | 91 +++++ LicenciasManager.h | 19 ++ ReadMe.txt | 54 +++ Resource.h | 17 + licUtiles.rc | 125 +++++++ licUtiles.vcproj | 459 ++++++++++++++++++++++++++ licUtiles.vcproj.yandrak.Gerardo.user | 121 +++++++ licUtiles.vcxproj | 241 ++++++++++++++ licUtiles.vcxproj.filters | 74 +++++ licUtiles.vcxproj.user | 4 + stdafx.cpp | 8 + stdafx.h | 38 +++ targetver.h | 24 ++ 23 files changed, 1984 insertions(+) create mode 100644 .gitignore create mode 100644 ConexionClienteLicSrv.cpp create mode 100644 ConexionClienteLicSrv.h create mode 100644 LicCliente.cpp create mode 100644 LicCliente.h create mode 100644 LicUtiles.cpp create mode 100644 LicUtiles.h create mode 100644 LicUtilesDef.h create mode 100644 Licencia.cpp create mode 100644 Licencia.h create mode 100644 LicenciasManager.cpp create mode 100644 LicenciasManager.h create mode 100644 ReadMe.txt create mode 100644 Resource.h create mode 100644 licUtiles.rc create mode 100644 licUtiles.vcproj create mode 100644 licUtiles.vcproj.yandrak.Gerardo.user create mode 100644 licUtiles.vcxproj create mode 100644 licUtiles.vcxproj.filters create mode 100644 licUtiles.vcxproj.user create mode 100644 stdafx.cpp create mode 100644 stdafx.h create mode 100644 targetver.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a5f1ba5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/Debug/* +/Release/* +/x64/* +/licUtiles.aps +/licUtiles.vcproj.NELIAM.Elena.user diff --git a/ConexionClienteLicSrv.cpp b/ConexionClienteLicSrv.cpp new file mode 100644 index 0000000..6ac3884 --- /dev/null +++ b/ConexionClienteLicSrv.cpp @@ -0,0 +1,132 @@ +#include "StdAfx.h" +#include "ConexionClienteLicSrv.h" +#define MODULO "ConexionClienteLicSrv" +#include "_log.h" +#include "licencia.h" + +ConexionClienteLicSrv::ConexionClienteLicSrv(void) +{ + pirate =false; +} + +ConexionClienteLicSrv::~ConexionClienteLicSrv(void) +{ +} + +void ConexionClienteLicSrv::run() +{ + int nr =0; + C_log::log(MODULO, "Iniciada Conexion"); + Licencia lic; + BYTE bufout[sizeof(int)+sizeof(Licencia)]; + if(!manager) + pirate =true; + while(!pirate && (!soc->pirate || !*soc->pirate)) + { + if(soc->sock_cerrado) + { + pirate = true; + C_log::log(MODULO, "Cliente desconectado"); + continue; + } + if(!soc->recibe_package(0)) + { + nr++; + if(nr>1000) + { + pirate = true; + C_log::log(MODULO, "Sobrepasado tiempo de espera."); + } + else + Sleep(1); + continue; + } + nr =0; + //recive package------------- + if(soc->nbbuf; + int nb =soc->nb-(sizeof(int)); + + void* buf = &((int*)soc->buf)[1]; + + switch(idp) + { + case(PETICION_GENERAL_OK): + if(!envia(PETICION_GENERAL_OK)) + { + C_log::log(MODULO, "Error al enviar no"); + pirate = true; + } + break; + case(PETICION_GENERAL_PRESENTA): + if(nb!=sizeof(Licencia)) + { + C_log::log(MODULO, "Presenta defectuoso"); + envia(PETICION_GENERAL_NO); + + pirate = true; + break; + } + + if(!lic.setLic(buf)) + { + C_log::log(MODULO, "Licencia defectuosa"); + envia(PETICION_GENERAL_NO); + + pirate = true; + break; + } + //seguridad-------------- + lic.set_nulls(); + C_log::log(MODULO, "Peticion licencia: user: %s produc: %s, clave: %s, version: %s idm: %s", lic.nombre_user, lic.nombre_producto, lic.clave, lic.version_producto, lic.idm); + + if(!manager->Get(&lic) || !lic.getLic((void*)&bufout[sizeof(int)])) + { + + C_log::log(MODULO, "Licencia No conseguida"); + envia(PETICION_GENERAL_NO); + + pirate = true; + } + if(lic.id<0) + { + C_log::log(MODULO, "Sin licencia"); + envia(PETICION_GENERAL_NO); + } + (*(int*)bufout) = PETICION_GENERAL_OK; + if(!envia(bufout, sizeof(int)+sizeof(Licencia))) + { + C_log::log(MODULO, "Error al enviar licencia"); + pirate = true; + } + break; + + case(PETICION_GENERAL_NO): + C_log::log(MODULO, "Peticion de fin"); + pirate = true; + + break; + default: + C_log::log(MODULO, "id no reconocido"); + + pirate = true; + break; + } + } +} +//***************************************************************************** +bool ConexionClienteLicSrv::envia(int id) +{ + return soc->envia_package((BYTE*)&id, sizeof(id)) == TRUE; +} +//***************************************************************************** +bool ConexionClienteLicSrv::envia(void *buf, int siz) +{ + return soc->envia_package((BYTE*)buf, siz) == TRUE; +} +//***************************************************************************** \ No newline at end of file diff --git a/ConexionClienteLicSrv.h b/ConexionClienteLicSrv.h new file mode 100644 index 0000000..d91cf25 --- /dev/null +++ b/ConexionClienteLicSrv.h @@ -0,0 +1,24 @@ +#pragma once +#include "LicUtilesDef.h" + +#include "proceso_cliente.h" +#include "sock_sv.h" +#include "LicenciasManager.h" + +class LICUTL_EXPORT ConexionClienteLicSrv : + public Cproceso_cliente +{ +public: + bool pirate; + + LicenciasManager *manager; + + ConexionClienteLicSrv(void); + ~ConexionClienteLicSrv(void); + + virtual void run();//funcion que hace el thread + +private: + bool envia(int id); + bool envia(void *buf, int siz); +}; diff --git a/LicCliente.cpp b/LicCliente.cpp new file mode 100644 index 0000000..096d715 --- /dev/null +++ b/LicCliente.cpp @@ -0,0 +1,214 @@ +#include "StdAfx.h" +#include "LicCliente.h" +#include "b_file.h" +#include "Csock_cl.h" +//********************************************************************************************************************* +LicCliente::LicCliente(void) +{ + lic.clear(); + pathf[0]=0; +} +//********************************************************************************************************************* +LicCliente::~LicCliente(void) +{ +} +//********************************************************************************************************************* +bool LicCliente::cargaLicencia( LicClientEscucha* escucha, char* exePath ) +{ + this->escucha = escucha; + lic.clear(); + pathf[0]=0; + if(!lic.fillLic(exePath)) + { + escucha->muestaError("Error, no se puede inicializar licencia", lic.nombre_producto); + return false; + } + //revisa archivo-------------- + if(!cargaArchivo()) + { + if(!escucha->getClave(lic.clave, lic.nombre_producto)) + return false; + } + + if(!lic.clave[0]) + { + lic.id = -1; + goto fin; + } + lic.instaVersion[0]=0; + //conecta--------------------- + conectaServer(); +fin: + if(lic.id<0) + { + lic.permisos =0; + escucha->muestaError("Sin licencia para este producto", lic.nombre_producto); + borraFileLic(); + return false; + } + grabaFile(); + if(lic.instaVersion[0] && strcmp(lic.instaVersion, lic.version_producto)) + { + if(!escucha->descargaInstalador(&lic)) + return false; + } + + return lic.id >=0 ; +} +//********************************************************************************************************************* +bool LicCliente::cargaArchivo() +{ + Cb_file f; + char str[128]; + if(lic.nombre_producto[0]) + sprintf(str,"%s.lic",lic.nombre_producto); + else + strcpy(str,LU_DEFAULT_FILE); + if(!f.abre(str,1)) + { + pathf[0]=0; + if(!escucha->getPathLic(pathf, lic.nombre_producto)|| !pathf[0] || !f.abre(pathf,1)) + { + if(!pathf[0]) + strcpy(pathf, str); + return false; + } + } + else + strcpy(pathf, str); + Licencia l; + if(!l.leeLic(&f)) + return false; + if(l.tipo == 2)//licencia propietario + { + l.fillidmYuser(); + } + if(strcmp(l.idm, lic.idm)|| strcmp(l.nombre_producto, lic.nombre_producto)) + return false; + strcpy(l.version_producto, lic.version_producto); + lic = l; + lic.id; + //comprueba fechas---------------- + if(lic.tipo == 1) + { + //CTime tiempo = CTime::GetCurrentTime(); + __int64 tact = CTime::GetCurrentTime().GetTime(); + if(lic.caducidad<=tact || (lic.ultimo_acceso+lic.renovacion)<=tact) + lic.id = -1; + } + + return true; +} + +//********************************************************************************************************************* +void LicCliente::grabaFile() +{ + Cb_file f; + if(!f.abre(pathf,2) || !lic.grabaLic(&f)) + escucha->muestaError("Error al grabar licencia", lic.nombre_producto); +} +//********************************************************************************************************************* +void LicCliente::borraFileLic() +{ + DeleteFile(pathf); +} +//********************************************************************************************************************* +void LicCliente::conectaServer() +{ + Csock_cl* sc = new Csock_cl(); + BYTE bufout[sizeof(int)+sizeof(Licencia)]; + int fin =PETICION_GENERAL_NO; + + int idp; + int nb ; + int ii=0; + char LicServerUrl[128]; + int puerto = lic.puertoServerLic; + strcpy(LicServerUrl, lic.LicServerUrl); + for(int ii =0; ii<2; ii++) + { + sc->conectar(LicServerUrl, puerto); + if(envia_ok(sc)) + break; + if(!escucha->getServer(LicServerUrl, &puerto, lic.nombre_producto)) + return; + + } + + if(ii>=2) + { + delete sc; + return; + } + + lic.puertoServerLic =puerto; + strcpy(lic.LicServerUrl, LicServerUrl); + (*(int*)bufout) = PETICION_GENERAL_PRESENTA; + lic.getLic(&bufout[sizeof(int)]); + if(!sc->envia_package(bufout,sizeof(int)+sizeof(Licencia))) + { + delete sc; + return; + } + if(!sc->recibe_package(0)) + { + delete sc; + return; + } + idp = *(int*)sc->buf; + nb =sc->nb-(sizeof(int)); + + void* buf = &((int*)sc->buf)[1]; + sc->envia_package((BYTE*)&fin, sizeof(fin)); + + if(nbenvia_package((BYTE*)&pok, sizeof(int))) + { + return false; + } + if(!sc->recibe_package(0)) + { + return false; + } + return (sc->nb == sizeof(int)) && (*(int*)sc->buf == pok); +} +//********************************************************************************************************************* +bool LicCliente::isLicencia() +{ + return lic.id >=0; +} +//********************************************************************************************************************* +int LicCliente::getPermisos() +{ + return lic.permisos; +} +//********************************************************************************************************************* +bool LicCliente::creaLicPropietaria( char *key, int tipo, char *path ) +{ + lic.clear(); + lic.fillLic(path); + + strcpy(lic.clave, key); + lic.tipo = tipo; + lic.idm[0]=0; + lic.id = 0; + lic.nombre_user[0]=0; + sprintf(pathf,"%s.lic", lic.nombre_producto); + grabaFile(); + return true; +} +//********************************************************************************************************************* \ No newline at end of file diff --git a/LicCliente.h b/LicCliente.h new file mode 100644 index 0000000..5a3d740 --- /dev/null +++ b/LicCliente.h @@ -0,0 +1,25 @@ +#pragma once +#include "Licencia.h" +class Csock_cl; +class LICUTL_EXPORT LicCliente +{ +private: + Licencia lic; + LicClientEscucha* escucha; + char pathf[257]; +public: + LicCliente(void); + ~LicCliente(void); + bool cargaLicencia(LicClientEscucha* escucha, char* exePath= NULL); + bool creaLicPropietaria(char *key, int tipo, char *path); + bool isLicencia();//devuelve si tiene licencia o no + int getPermisos();//devuelve permisos + +private: + bool cargaArchivo(); + void borraFileLic();//borra archivo licencia + void grabaFile();//borra archivo licencia + + void conectaServer(); + bool envia_ok(Csock_cl* sc); +}; diff --git a/LicUtiles.cpp b/LicUtiles.cpp new file mode 100644 index 0000000..0d867cc --- /dev/null +++ b/LicUtiles.cpp @@ -0,0 +1,68 @@ +#include "StdAfx.h" +#include "LicUtiles.h" +#include "Resource.h" + + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +// +//TODO: If this DLL is dynamically linked against the MFC DLLs, +// any functions exported from this DLL which call into +// MFC must have the AFX_MANAGE_STATE macro added at the +// very beginning of the function. +// +// For example: +// +// extern "C" BOOL PASCAL EXPORT ExportedFunction() +// { +// AFX_MANAGE_STATE(AfxGetStaticModuleState()); +// // normal function body here +// } +// +// It is very important that this macro appear in each +// function, prior to any calls into MFC. This means that +// it must appear as the first statement within the +// function, even before any object variable declarations +// as their constructors may generate calls into the MFC +// DLL. +// +// Please see MFC Technical Notes 33 and 58 for additional +// details. +// + +// CFileTransferApp + +BEGIN_MESSAGE_MAP(LicUtilesApp, CWinApp) +END_MESSAGE_MAP() + + +// CFileTransferApp construction + +LicUtilesApp::LicUtilesApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + + +// The one and only CFileTransferApp object + +LicUtilesApp theApp; + + +// CFileTransferApp initialization + +BOOL LicUtilesApp::InitInstance() +{ + CWinApp::InitInstance(); + + if (!AfxSocketInit()) + { + //AfxMessageBox(IDP_SOCKETS_INIT_FAILED); + return FALSE; + } + + return TRUE; +} \ No newline at end of file diff --git a/LicUtiles.h b/LicUtiles.h new file mode 100644 index 0000000..df610b4 --- /dev/null +++ b/LicUtiles.h @@ -0,0 +1,22 @@ +#ifndef __AFXWIN_H__ +#error "include 'stdafx.h' before including this file for PCH" +#endif + +#include "resource.h" // main symbols + + +// CFileTransferApp +// See FileTransfer.cpp for the implementation of this class +// + +class LicUtilesApp : public CWinApp +{ +public: + LicUtilesApp(); + + // Overrides +public: + virtual BOOL InitInstance(); + + DECLARE_MESSAGE_MAP() +}; diff --git a/LicUtilesDef.h b/LicUtilesDef.h new file mode 100644 index 0000000..9c8d6cc --- /dev/null +++ b/LicUtilesDef.h @@ -0,0 +1,44 @@ +#pragma once +#ifndef LICUTL_EXPORT +#ifdef _WINDLL +#define LICUTL_EXPORT __declspec(dllexport) +#else +#define LICUTL_EXPORT __declspec(dllimport) +#endif + +#define VERSION_LICENCIA 100 + +#define LU_LICENCIA_CADUCA 1 //licencia normal +#define LU_LICENCIA_PROPIETARIA 2 //licencia propietaria, por defecto da licencia + + +#define LU_DEFAULT_FILE "data.lic" +#define LU_DEFAULT_SERVER "desa.narvaling.com" +//#define LU_DEFAULT_SERVER "192.168.1.60" + +#define LU_DEFAULT_PUERTO 8051 + +class Licencia; +//structuras +class LICUTL_EXPORT DBLicProvider +{ +public: + virtual bool fill( Licencia* lic )=0;//rellena datos licencia + virtual int licCount( Licencia* lic )=0;//cuenta numero de licencias + virtual bool fillInstal( Licencia* lic )=0;//rellena instalador + virtual bool setAcceso( Licencia* lic, __int64 *ultAcc, __int64 *actualAcceso)=0; + virtual bool getConf( char *ip, int *port )=0;//configuracion de escucha +}; + +class LICUTL_EXPORT LicClientEscucha +{ +public: + virtual bool getClave(char* clave, char* producto )=0;//pide clave (pidiendosela al usuario) + virtual bool getServer( char*server, int *puerto, char* producto){ server[0]=0;*puerto=0;return false;}//pide servidor de licencias (no obligada) + virtual bool getPathLic( char* path, char* producto ){path[0]=0; return true;}//pide path de archivo de licencia (no obligada) + virtual void muestaError(char* info, char* producto){} + virtual bool descargaInstalador(Licencia *lic){return true;}//true si revisamos instalador, false si no + +}; + +#endif diff --git a/Licencia.cpp b/Licencia.cpp new file mode 100644 index 0000000..3b28aaa --- /dev/null +++ b/Licencia.cpp @@ -0,0 +1,124 @@ +#include "StdAfx.h" +#include "Licencia.h" +#include "utl.h" +#include "dir_manager.h" +#include "b_file.h" +#include "LicUtilesDef.h" +#include "_app.h" +//********************************************************************************************************************* +Licencia::Licencia(void) +{ + clear(); +} +void Licencia::clear() +{ + memset(this, 0, sizeof(Licencia)); + id = -1; +} +//********************************************************************************************************************* +Licencia::~Licencia(void) +{ +} +//********************************************************************************************************************* +void* Licencia::getLic( void *buf ) +{ + memcpy(buf,this, sizeof(Licencia)); + Cutl::cifra1((BYTE*)buf, sizeof(Licencia)); + return buf; +} +//********************************************************************************************************************* +Licencia* Licencia::setLic( void *buf ) +{ + Cutl::descifra1((BYTE*)buf, sizeof(Licencia)); + *this=*(Licencia*)buf; + return this; +} +//********************************************************************************************************************* +char* Licencia::getIdm( char *buf ) +{ + return Cutl::id_pc(buf,128); +} +//********************************************************************************************************************* +bool Licencia::fillLic( char* pathProducto /*= 0;*/ ) +{ + char path[256]; + strcpy(LicServerUrl, LU_DEFAULT_SERVER); + puertoServerLic = LU_DEFAULT_PUERTO; + Cutl::getWinUser(path)[31] = 0; + strcpy(nombre_user,path); + if(pathProducto) + strcpy(path, pathProducto); + else + { + if(C_app::GetApp()->archi.path_ejecutable[0] == 0) + { + if(!C_app::GetApp()->archi.rellena_dirs_ejecucion()) + return false; + } + + strcpy(path,C_app::GetApp()->archi.path_ejecutable); + } + + if(!getIdm(idm)) + return false; + if(!Cdir_manager::getVersionFile(path,version_producto)) + return false; + char name[32]; + if(!Cdir_manager::nombre_archivo(path,name)) + return false; + char *ext =Cdir_manager::extension_archivo(name); + if(ext) + *(ext-1)=0; + strcpy(nombre_producto, name); + return true; + +} +//********************************************************************************************************************* +bool Licencia::leeLic( Cb_file * f ) +{ + int i; + Licencia buf; + if(!f->lee(&i, sizeof(int)) || i != VERSION_LICENCIA) + return false; + if(!f->lee(&buf, sizeof(buf))) + return false; + setLic(&buf); + *this = buf; + return true; +} +//********************************************************************************************************************* +bool Licencia::grabaLic( Cb_file * f ) +{ + int i=VERSION_LICENCIA; + Licencia buf; + + if(!f->escribe(&i, sizeof(int))) + return false; + if(!f->escribe(getLic(&buf), sizeof(Licencia))) + return false; + return true; +} +//********************************************************************************************************************* +void Licencia::set_nulls() +{ + clave[31]=0; + nombre_user[31]=0; + version_producto[31]=0; + + idm[127]=0; + nombre_producto[127]=0; + + instaUsu[31]=0; + instaKey[31]=0; + instaVersion[31]=0; +} +//********************************************************************************************************************* +bool Licencia::fillidmYuser() +{ + char buf[256]; + Cutl::getWinUser(buf)[31] = 0; + strcpy(nombre_user,buf); + return getIdm(idm)!= NULL; +} + +//********************************************************************************************************************* diff --git a/Licencia.h b/Licencia.h new file mode 100644 index 0000000..e674cff --- /dev/null +++ b/Licencia.h @@ -0,0 +1,51 @@ +#pragma once +#include "LicUtilesDef.h" + +class Cb_file; +class LICUTL_EXPORT Licencia +{ +public: + __int64 caducidad; + __int64 renovacion; + __int64 ultimo_acceso; + + int id; + int tipo; + int permisos; + int max_user;//uso interno + int idCliente;//uso interno + int idProducto;//uso interno + int puertoServerLic; + char clave[32]; + char nombre_user[32]; + char idm[128]; + char LicServerUrl[128]; + char nombre_producto[128]; + char version_producto[32]; + + //info instalador--------------------- + int instaId; + char instaServer[128]; + char instaUsu[32]; + char instaKey[32]; + char instaPath[256]; + char instaDescrip[256]; + char instaVersion[32]; + + Licencia(void); + ~Licencia(void); + + bool leeLic(Cb_file * f); + bool grabaLic(Cb_file * f); + void clear(); + void set_nulls(); + + void* getLic( void *buf); + Licencia* setLic( void *buf); + + bool fillLic(char* pathProducto = 0); + bool fillidmYuser(); +private: + char* getIdm(char *buf);//buffer de tamaño 128 +}; + diff --git a/LicenciasManager.cpp b/LicenciasManager.cpp new file mode 100644 index 0000000..a8c49d0 --- /dev/null +++ b/LicenciasManager.cpp @@ -0,0 +1,91 @@ +#include "StdAfx.h" +#include "LicenciasManager.h" +#include "licencia.h" +#define MODULO "LicenciasManager" +#include "ConexionClienteLicSrv.h" +#include "_log.h" +//************************************************************************ +LicenciasManager::LicenciasManager(void) +{ +} +//************************************************************************ +LicenciasManager::~LicenciasManager(void) +{ + fin(); +} +//************************************************************************ +Licencia* LicenciasManager::Get( Licencia* lic ) +{ + if(!dbProvider->fill(lic)) + { + C_log::log(MODULO, "Sin licencia, clave: %s usuario: %s; producto: %s idm: %s",lic->clave, lic->nombre_user, lic->nombre_producto, lic->idm); + lic->id =-1; + return lic; + } + + __int64 accesodb, accesoAct; + if(!dbProvider->setAcceso(lic,&accesodb, &accesoAct)) + { + C_log::log(MODULO, "Sin al guardar acceso, clave: %s usuario: %s; producto: %s idm: %s",lic->clave, lic->nombre_user, lic->nombre_producto, lic->idm); + lic->id =-1; + return lic; + } + lic->ultimo_acceso = accesoAct; + if(lic->tipo == LU_LICENCIA_CADUCA) + { + if(lic->caducidad<=accesoAct) + { + C_log::log(MODULO, "Licencia caducada clave: %s usuario: %s; producto: %s idm: %s",lic->clave, lic->nombre_user, lic->nombre_producto, lic->idm); + lic->id =-1; + return lic; + } + if(lic->max_user>=0) + { + int nlic =dbProvider->licCount(lic); + if(nlic>lic->max_user) + { + C_log::log(MODULO, "Maximo numero de usuarios alcanzado en licencia clave: %s usuario: %s; producto: %s idm: %s",lic->clave, lic->nombre_user, lic->nombre_producto, lic->idm); + lic->id =-1; + return lic; + } + } + } + + + if(lic->instaId>=0) + { + if(!dbProvider->fillInstal(lic)) + C_log::log(MODULO, "Error al rellenar instalador clave: %s usuario: %s; producto: %s idm: %s",lic->clave, lic->nombre_user, lic->nombre_producto, lic->idm); + } + return lic; +} +//************************************************************************ +bool LicenciasManager::inicia( DBLicProvider* dbProv ) +{ + if(!dbProv) + return false; + dbProvider = dbProv; + sc.escucha = this; + char ip[128]; + int port; + dbProv->getConf(ip, &port); + bool res =sc.liseningThread(port,ip)== TRUE; + if(res) + C_log::log(MODULO, "Escucha en ip: %s:%ld;",ip, port); + + return res; +} +//************************************************************************ +void LicenciasManager::fin() +{ + sc.close(); +} +//************************************************************************ +Cproceso_cliente* LicenciasManager::crea_cliente( BOOL *pirate ) +{ + ConexionClienteLicSrv* cli = new ConexionClienteLicSrv(); + cli->manager = this; + return cli; +} + +//************************************************************************ \ No newline at end of file diff --git a/LicenciasManager.h b/LicenciasManager.h new file mode 100644 index 0000000..87d46d5 --- /dev/null +++ b/LicenciasManager.h @@ -0,0 +1,19 @@ +#pragma once +#include "LicUtilesDef.h" +#include "sock_sv.h" +class Licencia; +class LICUTL_EXPORT LicenciasManager : Cescucha_sock_sv +{ + DBLicProvider* dbProvider; + Csock_svThread sc; +public: + LicenciasManager(void); + ~LicenciasManager(void); + + bool inicia(DBLicProvider* dbProvider); + void fin(); + Licencia* Get(Licencia* lic); + virtual Cproceso_cliente* crea_cliente( BOOL *pirate ); +private: + +}; diff --git a/ReadMe.txt b/ReadMe.txt new file mode 100644 index 0000000..f8b8ad1 --- /dev/null +++ b/ReadMe.txt @@ -0,0 +1,54 @@ +======================================================================== + DYNAMIC LINK LIBRARY : licUtiles Project Overview +======================================================================== + +AppWizard has created this licUtiles DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your licUtiles application. + + +licUtiles.vcproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +licUtiles.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +AppWizard has created the following resources: + +licUtiles.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named licUtiles.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/Resource.h b/Resource.h new file mode 100644 index 0000000..8afa488 --- /dev/null +++ b/Resource.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by licUtiles.rc +// + +#define IDS_APP_TITLE 103 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/licUtiles.rc b/licUtiles.rc new file mode 100644 index 0000000..d89f370 --- /dev/null +++ b/licUtiles.rc @@ -0,0 +1,125 @@ +// 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 + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#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 + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_APP_TITLE "licUtiles" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Spanish resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESN) +#ifdef _WIN32 +LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_MODERN +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "0c0a04b0" + BEGIN + VALUE "CompanyName", "Narvaling" + VALUE "FileDescription", "Librería de Licencias" + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "licUtiles" + VALUE "LegalCopyright", "(c) Narvaling. All rights reserved." + VALUE "OriginalFilename", "licUtiles.dll" + VALUE "ProductName", "licUtiles" + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0xc0a, 1200 + END +END + +#endif // Spanish resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/licUtiles.vcproj b/licUtiles.vcproj new file mode 100644 index 0000000..e0507e6 --- /dev/null +++ b/licUtiles.vcproj @@ -0,0 +1,459 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/licUtiles.vcproj.yandrak.Gerardo.user b/licUtiles.vcproj.yandrak.Gerardo.user new file mode 100644 index 0000000..2d1426a --- /dev/null +++ b/licUtiles.vcproj.yandrak.Gerardo.user @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + diff --git a/licUtiles.vcxproj b/licUtiles.vcxproj new file mode 100644 index 0000000..8277fd4 --- /dev/null +++ b/licUtiles.vcxproj @@ -0,0 +1,241 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {04E5B10E-5A75-48A2-857B-805659C7877D} + licUtiles + Win32Proj + + + + DynamicLibrary + v141 + Dynamic + MultiByte + true + + + DynamicLibrary + v141 + Dynamic + MultiByte + + + DynamicLibrary + v141 + Dynamic + MultiByte + true + + + DynamicLibrary + v141 + Dynamic + MultiByte + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>15.0.28127.55 + + + $(Configuration)\ + $(Configuration)\ + true + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(Configuration)\ + $(Configuration)\ + false + + + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + + + + Disabled + ..\utiles;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;LICUTILES_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + EditAndContinue + + + utiles.lib;%(AdditionalDependencies) + ..\..\lib\$(Configuration);%(AdditionalLibraryDirectories) + true + Windows + MachineX86 + + + copy $(OutDir)$(TargetFileName) ..\bin\$(IntDir) +copy $(OutDir)licUtiles.lib ..\lib\$(IntDir) + + + + + X64 + + + Disabled + ..\utiles;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;LICUTILES_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + ProgramDatabase + + + utiles.lib;%(AdditionalDependencies) + ..\..\lib\x64\$(Configuration);%(AdditionalLibraryDirectories) + true + Windows + MachineX64 + + + copy $(OutDir)$(TargetFileName) ..\bin\$(IntDir) +copy $(OutDir)licUtiles.lib ..\lib\$(IntDir) + + + + + MaxSpeed + true + ..\utiles;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;LICUTILES_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + Use + Level3 + ProgramDatabase + + + utiles.lib;%(AdditionalDependencies) + ..\..\lib\$(Configuration);%(AdditionalLibraryDirectories) + true + Windows + true + true + MachineX86 + + + copy $(OutDir)$(TargetFileName) ..\bin\$(IntDir) +copy $(OutDir)licUtiles.lib ..\lib\$(IntDir) + + + + + X64 + + + MaxSpeed + true + ..\utiles;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;LICUTILES_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + Use + Level3 + ProgramDatabase + + + utiles.lib;%(AdditionalDependencies) + ..\..\lib\x64\$(Configuration);%(AdditionalLibraryDirectories) + true + Windows + true + true + MachineX64 + + + copy $(OutDir)$(TargetFileName) ..\bin\$(IntDir) +copy $(OutDir)licUtiles.lib ..\lib\$(IntDir) + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + {30c05365-2dfc-4ad4-905e-8a414ae0d0a0} + false + + + {aa58c828-7025-4a4c-868e-76b8902af6bb} + false + + + + + + \ No newline at end of file diff --git a/licUtiles.vcxproj.filters b/licUtiles.vcxproj.filters new file mode 100644 index 0000000..a46614f --- /dev/null +++ b/licUtiles.vcxproj.filters @@ -0,0 +1,74 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + + + + \ No newline at end of file diff --git a/licUtiles.vcxproj.user b/licUtiles.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/licUtiles.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/stdafx.cpp b/stdafx.cpp new file mode 100644 index 0000000..906c7e9 --- /dev/null +++ b/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// licUtiles.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/stdafx.h b/stdafx.h new file mode 100644 index 0000000..a007ac5 --- /dev/null +++ b/stdafx.h @@ -0,0 +1,38 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +#include +#include // MFC core and standard components +#include // MFC extensions +#include // MFC core and standard components +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC support for Internet Explorer 4 Common Controls + +#include // MFC OLE classes +#include // MFC OLE dialog classes +#include // MFC Automation classes +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include +// Windows Header Files: +#include +#include // MFC socket extensions + + +// TODO: reference additional headers your program requires here diff --git a/targetver.h b/targetver.h new file mode 100644 index 0000000..203dfbc --- /dev/null +++ b/targetver.h @@ -0,0 +1,24 @@ +#pragma once + +// The following macros define the minimum required platform. The minimum required platform +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. +#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. +#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. +#endif