From 77874aea5389a577d635e56ead26abf521b1f86d Mon Sep 17 00:00:00 2001 From: anderson.peterle@previdencia.gov.br Date: Thu, 10 Mar 2011 19:32:51 +0000 Subject: [PATCH] Exclusão para posterior reposição com versão 2.6-Beta-2 --- CACIC_Library.pas | 929 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- cacic2.bpg | 67 ------------------------------------------------------------------- cacic2.dof | 135 --------------------------------------------------------------------------------------------------------------------------------------- cacic_icon_WithoutServer.ico | Bin 4286 -> 0 bytes cacic_icon_raio.ico | Bin 9660 -> 0 bytes cacic_service_32x32.ico | Bin 4286 -> 0 bytes del-svnignore.bat | 1 - frmConfiguracoes.pas | 137 ----------------------------------------------------------------------------------------------------------------------------------------- imgFechar.bmp | Bin 1256 -> 0 bytes raio.ico | Bin 3774 -> 0 bytes raio.psd | Bin 3942 -> 0 bytes 11 files changed, 0 insertions(+), 1269 deletions(-) delete mode 100644 CACIC_Library.pas delete mode 100644 cacic2.bpg delete mode 100755 cacic2.dof delete mode 100755 cacic_icon_WithoutServer.ico delete mode 100755 cacic_icon_raio.ico delete mode 100755 cacic_service_32x32.ico delete mode 100644 del-svnignore.bat delete mode 100755 frmConfiguracoes.pas delete mode 100755 imgFechar.bmp delete mode 100755 raio.ico delete mode 100755 raio.psd diff --git a/CACIC_Library.pas b/CACIC_Library.pas deleted file mode 100644 index c8302fb..0000000 --- a/CACIC_Library.pas +++ /dev/null @@ -1,929 +0,0 @@ -{*------------------------------------------------------------------------------ - Package of both methods/properties to be used by CACIC Clients - - @version CACIC_Library 2009-01-07 23:00 harpiain - @package CACIC_Agente - @subpackage CACIC_Library - @author Adriano dos Santos Vieira - @copyright Copyright (C) Adriano dos Santos Vieira. All rights reserved. - @license GNU/GPL, see LICENSE.php - CACIC_Library is free software and parts of it may contain or be derived from - the GNU General Public License or other free or open source software license. - See COPYRIGHT.php for copyright notices and details. - - CACIC_Library - Coding style - for Constants - - characters always in uppercase - - use underscore for long name - e.g. - const CACIC_VERSION = '2.4.0'; - - for Variables - - characters always in lowercase - - start with "g" character for global - - start with "v" character for local - - start with "p" character for methods parameters - - start with "P" character for pointers - - use underscore for better read - e.g. - var g_global : string; - var v_local : string; - - for Objects - - start with "o" character - e.g. - oCacicObject : TCACIC_Common; - - for Methods - - start with lowercase word - - next words start with capital letter - e.g. - function getCacicPath() : string; - procedure setCacicPath( pPath: string ); --------------------------------------------------------------------------------} - -unit CACIC_Library; - -interface - -uses - Windows, - Classes, - SysUtils, - StrUtils, - MD5, - DCPcrypt2, - DCPrijndael, - DCPbase64, - ActiveX, - ComObj; -type - -{ ------------------------------------------------------------------------------ - Tipo de dados para obter informacoes extendidas dos Sistema Operacional - ver MSDN: http://msdn.microsoft.com/en-us/library/ms724833(VS.85).aspx --------------------------------------------------------------------------------} - TOSVersionInfoEx = packed record - dwOSVersionInfoSize: DWORD; - dwMajorVersion: DWORD; - dwMinorVersion: DWORD; - dwBuildNumber: DWORD; - dwPlatformId: DWORD; - szCSDVersion: array[0..127] of AnsiChar; - wServicePackMajor: WORD; - wServicePackMinor: WORD; - wSuiteMask: WORD; - wProductType: Byte; - wReserved: Byte; - end; - -{*------------------------------------------------------------------------------ - Classe para obter informações do sistema windows --------------------------------------------------------------------------------} - TCACIC_Windows = class - private - - protected - /// Mantem a identificação do sistema operacional - g_osVersionInfo: TOSVersionInfo; - /// Mantem a identificação extendida do sistema operacional - g_osVersionInfoEx: TOSVersionInfoEx; - /// TRUE se houver informação extendida do SO, FALSE caso contrário - g_osVersionInfoExtended: boolean; - - public - function isWindowsVista() : boolean; - function isWindowsGEVista() : boolean; - function isWindowsXP() : boolean; - function isWindowsGEXP() : boolean; - function isWindowsNTPlataform() : boolean; - function isWindows2000() : boolean; - function isWindowsNT() : boolean; - function isWindows9xME() : boolean; - function getWindowsStrId() : string; - function getWinDir() : string; - function getHomeDrive() : string; - function isWindowsAdmin() : boolean; - function createSampleProcess(p_cmd: string; p_wait: boolean; p_showWindow : word = SW_HIDE): boolean; - procedure showTrayIcon(p_visible:boolean); - procedure addApplicationToFirewall(p_EntryName:string;p_ApplicationPathAndExe:string; p_Enabled : boolean); - end; - -{*------------------------------------------------------------------------------ - Classe para tratamento de debug --------------------------------------------------------------------------------} - TCACIC_Debug = class - private - - protected - /// TRUE se em mode de debug, FALSE caso contrário - g_debug: boolean; - - public - procedure debugOn(); - procedure debugOff(); - function inDebugMode() : boolean; - end; -{*------------------------------------------------------------------------------ - Classe geral da biblioteca --------------------------------------------------------------------------------} - TCACIC = class(TCACIC_Windows) - constructor Create(); - destructor Destroy; override; - private - - protected - /// Mantem o caminho físico de instalação do agente cacic - g_cacic_path: string; - g_boolCipher : boolean; - - public - Windows : TCACIC_Windows; /// objeto de informacoes de windows - Debug : TCACIC_Debug; /// objeto de tratamento de debug - procedure setCacicPath(p_cacic_path: string); - procedure setBoolCipher(p_boolCipher : boolean); - function deCrypt(p_Data : String) : String; - function enCrypt(p_Data : String) : String; - function explode(p_String, p_Separador : String) : TStrings; - function implode(p_Array : TStrings ; p_Separador : String) : String; - function getCacicPath() : String; - function getCipherKey() : String; - function getBoolCipher() : boolean; - function getIV() : String; - function getKeySize() : integer; - function getBlockSize() : integer; - function getDatFileName() : String; - function getSeparatorKey() : String; - function getFileHash(strFileName : String) : String; - function isAppRunning( p_app_name: PAnsiChar ) : boolean; - function padWithZeros(const str : string; size : integer) : String; - function trimEspacosExcedentes(p_str: string) : String; - - end; - -// Declaração de constantes para a biblioteca -const - CACIC_PROCESS_WAIT = true; // aguardar fim do processo - CACIC_PROCESS_NOWAIT = false; // não aguardar o fim do processo - -// Some constants that are dependant on the cipher being used -// Assuming MCRYPT_RIJNDAEL_128 (i.e., 128bit blocksize, 256bit keysize) -const - CACIC_KEYSIZE = 32; // 32 bytes = 256 bits - CACIC_BLOCKSIZE = 16; // 16 bytes = 128 bits - -// Chave AES. Recomenda-se que cada empresa altere a sua chave. -// Esta chave é passada como parâmetro para o Gerente de Coletas que, por sua vez, -// passa para o Inicializador de Coletas e este passa para os coletores... -const - CACIC_CIPHERKEY = 'CacicBrasil'; - CACIC_IV = 'abcdefghijklmnop'; - CACIC_SEPARATORKEY = '=CacicIsFree='; // Usada apenas para o cacic2.dat - -// Arquivo local para armazenamento de configurações e informações coletadas -const - CACIC_DATFILENAME = 'cacic2.dat'; - - -{ - Controle de prioridade de processo - http://msdn.microsoft.com/en-us/library/ms683211(VS.85).aspx -} -const BELOW_NORMAL_PRIORITY_CLASS = $00004000; - {$EXTERNALSYM BELOW_NORMAL_PRIORITY_CLASS} - -var - P_OSVersionInfo: POSVersionInfo; - -implementation - -{*------------------------------------------------------------------------------ - Construtor para a classe - - Objetiva inicializar valores a serem usados pelos objetos da - classe. --------------------------------------------------------------------------------} -constructor TCACIC.Create(); -begin - FillChar(Self.g_osVersionInfoEx, SizeOf(Self.g_osVersionInfoEx), 0); - {$TYPEDADDRESS OFF} - P_OSVersionInfo := @Self.g_osVersionInfoEx; - {$TYPEDADDRESS ON} - - Self.g_osVersionInfoEx.dwOSVersionInfoSize:= SizeOf(TOSVersionInfoEx); - Self.g_osVersionInfoExtended := GetVersionEx(P_OSVersionInfo^); - if (not Self.g_osVersionInfoExtended) then begin - Self.g_osVersionInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); - GetVersionEx(Self.g_osVersionInfo); - end; - Self.Windows := TCACIC_Windows.Create(); - Self.Debug := TCACIC_Debug.Create(); -end; - -{*------------------------------------------------------------------------------ - Destrutor para a classe - - Objetiva finalizar valores usados pelos objetos da classe. --------------------------------------------------------------------------------} -destructor TCACIC.Destroy(); -begin - FreeMemory(P_OSVersionInfo); - inherited; -end; - -{*------------------------------------------------------------------------------ - Retorna a pasta de instalação do MS-Windows --------------------------------------------------------------------------------} -function TCACIC_Windows.getWinDir : string; -var - WinPath: array[0..MAX_PATH + 1] of char; -begin - GetWindowsDirectory(WinPath,MAX_PATH); - Result := StrPas(WinPath)+'\'; -end; - -{*------------------------------------------------------------------------------ - Retorna a unidade de instalação do MS-Windows --------------------------------------------------------------------------------} -function TCACIC_Windows.getHomeDrive() : string; -begin - Result := MidStr(getWinDir,1,3); //x:\ -end; - -{*------------------------------------------------------------------------------ - Insere exceção na FireWall nativa do MS-Windows - - @param p_EntryName String Nome da exceção - @param p_ApplicationPathAndExe String Caminho e nome da aplicação - @param p_Enabled Boolean Estado da exceção --------------------------------------------------------------------------------} -procedure TCACIC_Windows.addApplicationToFirewall(p_EntryName:string;p_ApplicationPathAndExe:string; p_Enabled : boolean); -var fwMgr,app:OleVariant; - profile:OleVariant; -Const NET_FW_PROFILE_DOMAIN = 0; - NET_FW_PROFILE_STANDARD = 1; - NET_FW_IP_VERSION_ANY = 2; - NET_FW_IP_PROTOCOL_UDP = 17; - NET_FW_IP_PROTOCOL_TCP = 6; - NET_FW_SCOPE_ALL = 0; - NET_FW_SCOPE_LOCAL_SUBNET = 1; -begin - CoInitialize(nil); - - fwMgr := CreateOLEObject('HNetCfg.FwMgr'); - profile := fwMgr.LocalPolicy.CurrentProfile; - app := CreateOLEObject('HNetCfg.FwAuthorizedApplication'); - app.ProcessImageFileName := p_ApplicationPathAndExe; - app.Name := p_EntryName; - app.Scope := NET_FW_SCOPE_ALL; - app.IpVersion := NET_FW_IP_VERSION_ANY; - app.Enabled := p_Enabled; - profile.AuthorizedApplications.Add(app); - - CoUninitialize; -end; - -{*------------------------------------------------------------------------------ - Retorna array de elementos com base em separador - - @param p_String String contendo campos e valores separados por caracter ou string - @param p_Separador String separadora de campos e valores --------------------------------------------------------------------------------} -Function TCACIC.explode(p_String, p_Separador : String) : TStrings; -var - strItem : String; - ListaAuxUTILS : TStrings; - NumCaracteres, - TamanhoSeparador, - I : Integer; -Begin - ListaAuxUTILS := TStringList.Create; - strItem := ''; - NumCaracteres := Length(p_String); - TamanhoSeparador := Length(p_Separador); - I := 1; - While I <= NumCaracteres Do - Begin - If (Copy(p_String,I,TamanhoSeparador) = p_Separador) or (I = NumCaracteres) Then - Begin - if (I = NumCaracteres) then strItem := strItem + p_String[I]; - ListaAuxUTILS.Add(trim(strItem)); - strItem := ''; - I := I + (TamanhoSeparador-1); - end - Else - strItem := strItem + p_String[I]; - - I := I + 1; - End; - Explode := ListaAuxUTILS; -end; - -{*------------------------------------------------------------------------------ - Retorna string com campos e valores separados por caracter ou string - - @param p_Array Array contendo campos e valores - @param p_Separador String separadora de campos e valores --------------------------------------------------------------------------------} -Function TCACIC.implode(p_Array : TStrings ; p_Separador : String) : String; -var intAux : integer; - strAux : string; -Begin - strAux := ''; - For intAux := 0 To p_Array.Count -1 do - Begin - if (strAux<>'') then strAux := strAux + p_Separador; - strAux := strAux + p_Array[intAux]; - End; - Implode := strAux; -end; - -{*------------------------------------------------------------------------------ - Elimina espacos excedentes na string - - @param p_str String a excluir espacos --------------------------------------------------------------------------------} -function TCACIC.trimEspacosExcedentes(p_str: String): String; -begin - if(ansipos(' ', p_str ) <> 0 ) then - repeat - p_str := StringReplace( p_str, ' ', ' ', [rfReplaceAll] ); - until ( ansipos( ' ', p_str ) = 0 ); - - Result := p_str; -end; - -{*------------------------------------------------------------------------------ - Atribui valor booleano à variável indicadora do status da criptografia - - @param p_boolCipher Valor booleano para atribuição à variável para status da - criptografia. --------------------------------------------------------------------------------} -procedure TCACIC.setBoolCipher(p_boolCipher : boolean); -Begin - Self.g_boolCipher := p_boolCipher; -End; -{*------------------------------------------------------------------------------ - Obtém o status da criptografia (TRUE -> Ligada / FALSE -> Desligada) - - @return boolean contendo o status para a criptografia --------------------------------------------------------------------------------} -function TCACIC.getBoolCipher() : boolean; -Begin - Result := Self.g_boolCipher; -End; - -{*------------------------------------------------------------------------------ - Atribui o caminho físico de instalação do agente cacic - - @param p_cacic_path Caminho físico de instalação do agente cacic --------------------------------------------------------------------------------} -procedure TCACIC.setCacicPath(p_cacic_path: string); -begin - Self.g_cacic_path := p_cacic_path; -end; - -{*------------------------------------------------------------------------------ - Obter o caminho fisico de instalacao do agente cacic - - @return String contendo o caminho físico --------------------------------------------------------------------------------} -function TCACIC.getCacicPath(): string; -begin - Result := Self.g_cacic_path; -end; - -{*------------------------------------------------------------------------------ - Verifica se a aplicação está em execução - - @param p_app_name Nome da aplicação a ser verificada - @return TRUE se em execução, FALSE caso contrário --------------------------------------------------------------------------------} -function TCACIC.isAppRunning( p_app_name: PAnsiChar ): boolean; -var - MutexHandle: THandle; - -begin - MutexHandle := CreateMutex(nil, TRUE, p_app_name); - if (MutexHandle = 0) OR (GetLastError = ERROR_ALREADY_EXISTS) - then Result := true - else Result := false; -end; - -{*------------------------------------------------------------------------------ - Coloca o sistema em modo de debug - --------------------------------------------------------------------------------} -procedure TCACIC_Debug.debugOn(); -begin - Self.g_debug := true; -end; - -{*------------------------------------------------------------------------------ - Desliga o modo de debug do sistema - --------------------------------------------------------------------------------} -procedure TCACIC_Debug.debugOff(); -begin - Self.g_debug := false; -end; - -{*------------------------------------------------------------------------------ - Coloca o sistema em modo de debug - - @return String contendo o caminho físico --------------------------------------------------------------------------------} -function TCACIC_Debug.inDebugMode() : boolean; -begin - Result := Self.g_debug; -end; - -{*------------------------------------------------------------------------------ - Verifica se é Windows Vista ou superior - - @return TRUE se Windows Vista ou superior, FALSE caso contrário - @see isWindowsNTPlataform, isWindows9xME, isWindowsNT, isWindows2000 - @see isWindowsXP, isWindowsVista, isWindowsGEVista --------------------------------------------------------------------------------} -function TCACIC_Windows.isWindowsGEVista() : boolean; -begin - Result := false; - if(Self.g_osVersionInfoExtended) then begin - if((g_osVersionInfoEx.dwMajorVersion >= 6) and (g_osVersionInfoEx.dwMinorVersion >= 0)) then - Result := true; - end - else - if((g_osVersionInfo.dwMajorVersion >= 6) and (g_osVersionInfo.dwMinorVersion >= 0)) then - Result := true; -end; - -{*------------------------------------------------------------------------------ - Verifica se é Windows Vista - - @return TRUE se Windows Vista, FALSE caso contrário - @see isWindowsNTPlataform, isWindows9xME, isWindowsNT, isWindows2000 - @see isWindowsXP, isWindowsVista --------------------------------------------------------------------------------} -function TCACIC_Windows.isWindowsVista() : boolean; -begin - Result := false; - if(Self.g_osVersionInfoExtended) then begin - if((g_osVersionInfoEx.dwMajorVersion = 6) and (g_osVersionInfoEx.dwMinorVersion = 0)) then - Result := true; - end - else - if((g_osVersionInfo.dwMajorVersion = 6) and (g_osVersionInfo.dwMinorVersion = 0)) then - Result := true; -end; - -{*------------------------------------------------------------------------------ - Verifica se é Windows XP ou superior - - @return TRUE se Windows XP ou superior, FALSE caso contrário - @see isWindowsNTPlataform, isWindows9xME, isWindowsNT, isWindows2000 - @see isWindowsXP, isWindowsVista --------------------------------------------------------------------------------} -function TCACIC_Windows.isWindowsGEXP() : boolean; -begin - Result := false; - if(Self.g_osVersionInfoExtended) then begin - if((g_osVersionInfoEx.dwMajorVersion >= 5) and (g_osVersionInfoEx.dwMinorVersion >= 1)) then - Result := true; - end - else - if((g_osVersionInfo.dwMajorVersion >= 5) and (g_osVersionInfo.dwMinorVersion >= 1)) then - Result := true; -end; - -{*------------------------------------------------------------------------------ - Verifica se é Windows XP - - @return TRUE se Windows XP, FALSE caso contrário - @see isWindowsNTPlataform, isWindows9xME, isWindowsNT, isWindows2000 - @see isWindowsXP, isWindowsVista --------------------------------------------------------------------------------} -function TCACIC_Windows.isWindowsXP() : boolean; -begin - Result := false; - if(Self.g_osVersionInfoExtended) then begin - if((g_osVersionInfoEx.dwMajorVersion = 5) and (g_osVersionInfoEx.dwMinorVersion = 1)) then - Result := true; - end - else - if((g_osVersionInfo.dwMajorVersion = 5) and (g_osVersionInfo.dwMinorVersion = 1)) then - Result := true; -end; - -{*------------------------------------------------------------------------------ - Verifica se é Windows 2000 - - @return TRUE se Windows 2000, FALSE caso contrário - @see isWindowsNTPlataform, isWindows9xME, isWindowsNT, isWindows2000 - @see isWindowsXP, isWindowsVista --------------------------------------------------------------------------------} -function TCACIC_Windows.isWindows2000() : boolean; -begin - Result := false; - if(Self.g_osVersionInfoExtended) then begin - if((g_osVersionInfoEx.dwMajorVersion = 5) and (g_osVersionInfoEx.dwMinorVersion = 0)) then - Result := true; - end - else - if((g_osVersionInfo.dwMajorVersion = 5) and (g_osVersionInfo.dwMinorVersion = 0)) then - Result := true; -end; - -{*------------------------------------------------------------------------------ - Verifica se é Windows NT - - @return TRUE se Windows NT, FALSE caso contrário - @see isWindowsNTPlataform, isWindows9xME, isWindowsNT, isWindows2000 - @see isWindowsXP, isWindowsVista --------------------------------------------------------------------------------} -function TCACIC_Windows.isWindowsNT() : boolean; -begin - Result := false; - if(Self.g_osVersionInfoExtended) then begin - if((g_osVersionInfoEx.dwMajorVersion = 4) and (g_osVersionInfoEx.dwMinorVersion = 0)) then - Result := true; - end - else - if((g_osVersionInfo.dwMajorVersion = 4) and (g_osVersionInfo.dwMinorVersion = 0)) then - Result := true; -end; - -{*------------------------------------------------------------------------------ - Verifica se a plataforma do sistema é de windows 9x ou ME - - @return TRUE se plataforma de Windows 9x/ME, FALSE caso contrário - @see isWindowsNTPlataform, isWindows9xME, isWindowsNT, isWindows2000 - @see isWindowsXP, isWindowsVista --------------------------------------------------------------------------------} -function TCACIC_Windows.isWindows9xME() : boolean; -begin - if (Self.g_osVersionInfoExtended) then - Result := (Self.g_osVersionInfoEx.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS) - else - Result := (Self.g_osVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS); -end; - -{*------------------------------------------------------------------------------ - Obter identificação extensa do sistema operacional - - @return String de identificação do sistema operacional - @example 1.4.10.A --------------------------------------------------------------------------------} -function TCACIC_Windows.getWindowsStrId() : string; -var - v_version_id: string; -begin - v_version_id := 'S.O.unknown'; - try - if (Self.g_osVersionInfoExtended) then - if(Self.isWindows9xME) then - v_version_id := IntToStr(Self.g_osVersionInfoEx.dwPlatformId) + '.' + - IntToStr(Self.g_osVersionInfoEx.dwMajorVersion) + '.' + - IntToStr(Self.g_osVersionInfoEx.dwMinorVersion) + - ifThen(trim(Self.g_osVersionInfoEx.szCSDVersion)='', - '', - '.'+trim(Self.g_osVersionInfoEx.szCSDVersion)) - else - v_version_id := IntToStr(Self.g_osVersionInfoEx.dwPlatformId) + '.' + - IntToStr(Self.g_osVersionInfoEx.dwMajorVersion) + '.' + - IntToStr(Self.g_osVersionInfoEx.dwMinorVersion) + '.' + - IntToStr(Self.g_osVersionInfoEx.wProductType) + '.' + - IntToStr(Self.g_osVersionInfoEx.wSuiteMask) - else - v_version_id := IntToStr(Self.g_osVersionInfo.dwPlatformId) + '.' + - IntToStr(Self.g_osVersionInfo.dwMajorVersion) + '.' + - IntToStr(Self.g_osVersionInfo.dwMinorVersion) + - ifThen(trim(Self.g_osVersionInfo.szCSDVersion)='', - '', - '.'+trim(Self.g_osVersionInfo.szCSDVersion)); - except - end; - Result := v_version_id; - -end; - -{*------------------------------------------------------------------------------ - Verifica se a plataforma do sistema é de Windows NT - - @return TRUE se plataforma de Windows NT, FALSE caso contrário - @see isWindows9xME, isWindowsVista --------------------------------------------------------------------------------} -function TCACIC_Windows.isWindowsNTPlataform() : boolean; -begin - if(Self.g_osVersionInfoExtended) - then Result := (Self.g_osVersionInfoEx.dwPlatformId = VER_PLATFORM_WIN32_NT) - else Result := (Self.g_osVersionInfo.dwPlatformId = VER_PLATFORM_WIN32_NT); -end; - -{*------------------------------------------------------------------------------ - Verifica se é administrador do sistema operacional se em plataforma NT - - @return TRUE se administrador do sistema, FALSE caso contrário --------------------------------------------------------------------------------} -function TCACIC_Windows.isWindowsAdmin(): Boolean; - -const - constSECURITY_NT_AUTHORITY: TSIDIdentifierAuthority = (Value: (0, 0, 0, 0, 0, 5)); - constSECURITY_BUILTIN_DOMAIN_RID = $00000020; - constDOMAIN_ALIAS_RID_ADMINS = $00000220; - -var - hAccessToken: THandle; - ptgGroups: PTokenGroups; - dwInfoBufferSize: DWORD; - psidAdministrators: PSID; - x: Integer; - bSuccess: BOOL; - -begin - if (not Self.isWindowsNTPlataform()) then // Se nao NT (ex: Win95/98) - // Se nao eh NT nao tem ''admin'' - Result := True - else begin - Result := False; - bSuccess := OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True, hAccessToken); - if not bSuccess then begin - if GetLastError = ERROR_NO_TOKEN then - bSuccess := OpenProcessToken(GetCurrentProcess, TOKEN_QUERY, hAccessToken); - end; - if bSuccess then begin - GetMem(ptgGroups, 1024); - bSuccess := GetTokenInformation(hAccessToken, TokenGroups, ptgGroups, 1024, dwInfoBufferSize); - CloseHandle(hAccessToken); - if bSuccess then begin - AllocateAndInitializeSid(constSECURITY_NT_AUTHORITY, 2, - constSECURITY_BUILTIN_DOMAIN_RID, - constDOMAIN_ALIAS_RID_ADMINS, - 0, 0, 0, 0, 0, 0, psidAdministrators); - {$R-} - for x := 0 to ptgGroups.GroupCount - 1 do - if EqualSid(psidAdministrators, ptgGroups.Groups[x].Sid) then begin - Result := True; - Break; - end; - {$R+} - FreeSid(psidAdministrators); - end; - FreeMemory(ptgGroups); - end; - end; -end; - -{*------------------------------------------------------------------------------ - Executa commandos, substitui o WinExec - - @autor: Marcos Dell Antonio - @param p_cmd Comando a ser executado - @param p_wait TRUE se deve aguardar término da excução, FALSE caso contrário --------------------------------------------------------------------------------} -{function TCACIC_Windows.createSampleProcess(p_cmd: string; p_wait: boolean ): boolean; -begin -end; -} -{*------------------------------------------------------------------------------ - Executa commandos, substitui o WinExec - - @autor: Marcos Dell Antonio - @param p_cmd Comando a ser executado - @param p_wait TRUE se deve aguardar término da excução, FALSE caso contrário - @param p_showWindow Constante que define o tipo de exibição da janela do aplicativo --------------------------------------------------------------------------------} -function TCACIC_Windows.createSampleProcess(p_cmd: string; p_wait: boolean; p_showWindow : word = SW_HIDE): boolean; -var - SUInfo: TStartupInfo; - ProcInfo: TProcessInformation; -begin - FillChar(SUInfo, SizeOf(SUInfo), #0); - SUInfo.cb := SizeOf(SUInfo); - SUInfo.dwFlags := STARTF_USESHOWWINDOW; - SUInfo.wShowWindow := p_showWindow; - - Result := CreateProcess(nil, - PChar(p_cmd), - nil, - nil, - false, - CREATE_NEW_CONSOLE or - BELOW_NORMAL_PRIORITY_CLASS, - nil, - nil, - SUInfo, - ProcInfo); - - if (Result) then - begin - if(p_wait) then begin - WaitForSingleObject(ProcInfo.hProcess, INFINITE); - CloseHandle(ProcInfo.hProcess); - CloseHandle(ProcInfo.hThread); - end; - end; -end; - -{*------------------------------------------------------------------------------ - Para cálculo de HASH de determinado arquivo. - - @autor: Anderson Peterle - @param p_strFileName - Nome do arquivo para extração do HashCode --------------------------------------------------------------------------------} -function TCACIC.GetFileHash(strFileName : String) : String; -Begin - Result := 'Arquivo "'+strFileName+'" Inexistente!'; - if (FileExists(strFileName)) then - Result := MD5Print(MD5File(strFileName)); -End; - -{*------------------------------------------------------------------------------ - Mostra ou oculta o cacic na "systray" do windows - - @autor: Diversos - compilado de vários exemplos obtidos na internet - @param p_visible TRUE se deve mostrar na systray, FALSE caso contrário --------------------------------------------------------------------------------} -procedure TCACIC_Windows.showTrayIcon(p_visible:boolean); - Var - v_tray, v_child : hWnd; - v_char : Array[0..127] of Char; - v_string : String; - - Begin - v_tray := FindWindow('Shell_TrayWnd', NIL); - v_child := GetWindow(v_tray, GW_CHILD); - While v_child <> 0 - do Begin - If GetClassName(v_child, v_char, SizeOf(v_char)) > 0 - Then Begin - v_string := StrPAS(v_char); - If UpperCase(v_string) = 'TRAYNOTIFYWND' - then begin - If p_visible - then ShowWindow(v_child, 1) - else ShowWindow(v_child, 0); - end; - End; - v_child := GetWindow(v_child, GW_HWNDNEXT); - End; - End; - -{*------------------------------------------------------------------------------ - Obter a chave para criptografia simétrica - - @return String contendo a chave simétrica --------------------------------------------------------------------------------} -function TCACIC.getCipherKey(): string; -begin - Result := CACIC_CIPHERKEY; -end; - -{*------------------------------------------------------------------------------ - Obter o vetor de inicialização para criptografia - - @return String contendo o vetor de inicialização --------------------------------------------------------------------------------} -function TCACIC.getIV(): string; -begin - Result := CACIC_IV; -end; - -{*------------------------------------------------------------------------------ - Obter o valor para tamanho da chave de criptografia - - @return Integer contendo o tamanho para chave de criptografia --------------------------------------------------------------------------------} -function TCACIC.getKeySize(): Integer; -begin - Result := CACIC_KEYSIZE; -end; - -{*------------------------------------------------------------------------------ - Obter o valor para tamanho do bloco de criptografia - - @return Integer contendo o tamanho para bloco de criptografia --------------------------------------------------------------------------------} -function TCACIC.getBlockSize(): Integer; -begin - Result := CACIC_BLOCKSIZE; -end; - -{*------------------------------------------------------------------------------ - Obter o nome do arquivo de informações de configurações e dados locais - - @return String contendo o nome do arquivo de configurações e dados locais --------------------------------------------------------------------------------} -function TCACIC.getDatFileName(): string; -begin - Result := CACIC_DATFILENAME; -end; - -{*------------------------------------------------------------------------------ - Obter o separador para criação de listas locais - - @return String contendo o separador de campos e valores --------------------------------------------------------------------------------} -function TCACIC.getSeparatorKey(): string; -begin - Result := CACIC_SEPARATORKEY; -end; - -// Encrypt a string and return the Base64 encoded result -function TCACIC.enCrypt(p_Data : String) : String; -var - l_Cipher : TDCP_rijndael; - l_Data, l_Key, l_IV : string; -begin - Try - if self.g_boolCipher then - Begin - // Pad Key, IV and Data with zeros as appropriate - l_Key := PadWithZeros(CACIC_CIPHERKEY,CACIC_KEYSIZE); - l_IV := PadWithZeros(CACIC_IV,CACIC_BLOCKSIZE); - l_Data := PadWithZeros(p_Data,CACIC_BLOCKSIZE); - - // Create the cipher and initialise according to the key length - l_Cipher := TDCP_rijndael.Create(nil); - if Length(CACIC_CIPHERKEY) <= 16 then - l_Cipher.Init(l_Key[1],128,@l_IV[1]) - else if Length(CACIC_CIPHERKEY) <= 24 then - l_Cipher.Init(l_Key[1],192,@l_IV[1]) - else - l_Cipher.Init(l_Key[1],256,@l_IV[1]); - - // Encrypt the data - l_Cipher.EncryptCBC(l_Data[1],l_Data[1],Length(l_Data)); - - // Free the cipher and clear sensitive information - l_Cipher.Free; - FillChar(l_Key[1],Length(l_Key),0); - - // Return the Base64 encoded result - Result := Base64EncodeStr(l_Data); - End - Else - // Return the original value - Result := p_Data; - Except -// LogDiario('Erro no Processo de Criptografia'); - End; -end; - -function TCACIC.deCrypt(p_Data : String) : String; -var - l_Cipher : TDCP_rijndael; - l_Data, l_Key, l_IV : string; -begin - Try - if self.g_boolCipher then - Begin - // Pad Key and IV with zeros as appropriate - l_Key := PadWithZeros(CACIC_CIPHERKEY,CACIC_KEYSIZE); - l_IV := PadWithZeros(CACIC_IV,CACIC_BLOCKSIZE); - - // Decode the Base64 encoded string - l_Data := Base64DecodeStr(p_Data); - - // Create the cipher and initialise according to the key length - l_Cipher := TDCP_rijndael.Create(nil); - if Length(CACIC_CIPHERKEY) <= 16 then - l_Cipher.Init(l_Key[1],128,@l_IV[1]) - else if Length(CACIC_CIPHERKEY) <= 24 then - l_Cipher.Init(l_Key[1],192,@l_IV[1]) - else - l_Cipher.Init(l_Key[1],256,@l_IV[1]); - - // Decrypt the data - l_Cipher.DecryptCBC(l_Data[1],l_Data[1],Length(l_Data)); - - // Free the cipher and clear sensitive information - l_Cipher.Free; - FillChar(l_Key[1],Length(l_Key),0); - - // Return the result (unCrypted) - Result := trim(l_Data); - End - Else - // Return the original value - Result := p_Data - Except -// LogDiario('Erro no Processo de Decriptografia'); - End; -end; - -// Pad a string with zeros so that it is a multiple of size -function TCACIC.padWithZeros(const str : string; size : integer) : string; -var origsize, i : integer; -begin - Result := str; - origsize := Length(Result); - if ((origsize mod size) <> 0) or (origsize = 0) then - begin - SetLength(Result,((origsize div size)+1)*size); - for i := origsize+1 to Length(Result) do - Result[i] := #0; - end; -end; - -end. - diff --git a/cacic2.bpg b/cacic2.bpg deleted file mode 100644 index 8c7dbec..0000000 --- a/cacic2.bpg +++ /dev/null @@ -1,67 +0,0 @@ -#------------------------------------------------------------------------------ -VERSION = BWS.01 -#------------------------------------------------------------------------------ -!ifndef ROOT -ROOT = $(MAKEDIR)\.. -!endif -#------------------------------------------------------------------------------ -MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** -DCC = $(ROOT)\bin\dcc32.exe $** -BRCC = $(ROOT)\bin\brcc32.exe $** -#------------------------------------------------------------------------------ -PROJECTS = cacic2.exe chkcacic.exe chksis.exe col_anvi.exe col_comp.exe \ - col_hard.exe col_moni.exe col_patr.exe col_soft.exe col_undi.exe ger_cols.exe \ - ini_cols.exe mapacacic.exe vaca.exe vacon.exe CACICsvc.exe -#------------------------------------------------------------------------------ -default: $(PROJECTS) -#------------------------------------------------------------------------------ - -cacic2.exe: cacic2.dpr - $(DCC) - -chkcacic.exe: chkcacic\chkcacic.dpr - $(DCC) - -chksis.exe: chksis\chksis.dpr - $(DCC) - -col_anvi.exe: col_anvi\col_anvi.dpr - $(DCC) - -col_comp.exe: col_comp\col_comp.dpr - $(DCC) - -col_hard.exe: col_hard\col_hard.dpr - $(DCC) - -col_moni.exe: col_moni\col_moni.dpr - $(DCC) - -col_patr.exe: col_patr\col_patr.dpr - $(DCC) - -col_soft.exe: col_soft\col_soft.dpr - $(DCC) - -col_undi.exe: col_undi\col_undi.dpr - $(DCC) - -ger_cols.exe: ger_cols\ger_cols.dpr - $(DCC) - -ini_cols.exe: ini_cols\ini_cols.dpr - $(DCC) - -mapacacic.exe: mapa\mapacacic.dpr - $(DCC) - -vaca.exe: vaca\vaca.dpr - $(DCC) - -vacon.exe: vacon\vacon.dpr - $(DCC) - -CACICsvc.exe: cacicservice\CACICsvc.dpr - $(DCC) - - diff --git a/cacic2.dof b/cacic2.dof deleted file mode 100755 index 17b8d77..0000000 --- a/cacic2.dof +++ /dev/null @@ -1,135 +0,0 @@ -[FileVersion] -Version=7.0 -[Compiler] -A=8 -B=0 -C=1 -D=1 -E=0 -F=0 -G=1 -H=1 -I=1 -J=0 -K=0 -L=1 -M=0 -N=1 -O=1 -P=1 -Q=0 -R=0 -S=0 -T=0 -U=0 -V=1 -W=0 -X=1 -Y=1 -Z=1 -ShowHints=1 -ShowWarnings=1 -UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; -NamespacePrefix= -SymbolDeprecated=1 -SymbolLibrary=1 -SymbolPlatform=1 -UnitLibrary=1 -UnitPlatform=1 -UnitDeprecated=1 -HResultCompat=1 -HidingMember=1 -HiddenVirtual=1 -Garbage=1 -BoundsError=1 -ZeroNilCompat=1 -StringConstTruncated=1 -ForLoopVarVarPar=1 -TypedConstVarPar=1 -AsgToTypedConst=1 -CaseLabelRange=1 -ForVariable=1 -ConstructingAbstract=1 -ComparisonFalse=1 -ComparisonTrue=1 -ComparingSignedUnsigned=1 -CombiningSignedUnsigned=1 -UnsupportedConstruct=1 -FileOpen=1 -FileOpenUnitSrc=1 -BadGlobalSymbol=1 -DuplicateConstructorDestructor=1 -InvalidDirective=1 -PackageNoLink=1 -PackageThreadVar=1 -ImplicitImport=1 -HPPEMITIgnored=1 -NoRetVal=1 -UseBeforeDef=1 -ForLoopVarUndef=1 -UnitNameMismatch=1 -NoCFGFileFound=1 -MessageDirective=1 -ImplicitVariants=1 -UnicodeToLocale=1 -LocaleToUnicode=1 -ImagebaseMultiple=1 -SuspiciousTypecast=1 -PrivatePropAccessor=1 -UnsafeType=0 -UnsafeCode=0 -UnsafeCast=0 -[Linker] -MapFile=0 -OutputObjs=0 -ConsoleApp=1 -DebugInfo=0 -RemoteSymbols=0 -MinStackSize=16384 -MaxStackSize=1048576 -ImageBase=4194304 -ExeDescription= -[Directories] -OutputDir= -UnitOutputDir= -PackageDLLOutputDir= -PackageDCPOutputDir= -SearchPath= -Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOffice2k -Conditionals= -DebugSourceDirs= -UsePackages=0 -[Parameters] -RunParams= -HostApplication= -Launcher= -UseLauncher=0 -DebugCWD= -[Language] -ActiveLang= -ProjectLang= -RootDir=Y:\arariboia_mod\ -[Version Info] -IncludeVerInfo=1 -AutoIncBuild=0 -MajorVer=2 -MinorVer=5 -Release=0 -Build=787 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1046 -CodePage=1252 -[Version Info Keys] -CompanyName=Dataprev - Emp. de TI da Prev.Social - URES -FileDescription=Módulo Agente Principal do Sistema CACIC -FileVersion=2.5.0.787 -InternalName= -LegalCopyright=Baseado na licença GPL (General Public License) -LegalTrademarks= -OriginalFilename= -ProductName=Cacic - Configurador Automático e Coletor de Informações Computacionais -ProductVersion=2.6 diff --git a/cacic_icon_WithoutServer.ico b/cacic_icon_WithoutServer.ico deleted file mode 100755 index 80dcb24..0000000 Binary files a/cacic_icon_WithoutServer.ico and /dev/null differ diff --git a/cacic_icon_raio.ico b/cacic_icon_raio.ico deleted file mode 100755 index cb83f02..0000000 Binary files a/cacic_icon_raio.ico and /dev/null differ diff --git a/cacic_service_32x32.ico b/cacic_service_32x32.ico deleted file mode 100755 index b6381ab..0000000 Binary files a/cacic_service_32x32.ico and /dev/null differ diff --git a/del-svnignore.bat b/del-svnignore.bat deleted file mode 100644 index 3b4f8ec..0000000 --- a/del-svnignore.bat +++ /dev/null @@ -1 +0,0 @@ -del /s *.txt *.log *.dsk *.dcu *.exe thumbs.db *.~ddp *.~dfm *.~pas *.~dpr *.~dsk \ No newline at end of file diff --git a/frmConfiguracoes.pas b/frmConfiguracoes.pas deleted file mode 100755 index 1626b43..0000000 --- a/frmConfiguracoes.pas +++ /dev/null @@ -1,137 +0,0 @@ -(** ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -Copyright 2000, 2001, 2002, 2003, 2004, 2005 Dataprev - Empresa de Tecnologia e Informações da Previdência Social, Brasil - -Este arquivo é parte do programa CACIC - Configurador Automático e Coletor de Informações Computacionais - -O CACIC é um software livre; você pode redistribui-lo e/ou modifica-lo dentro dos termos da Licença Pública Geral GNU como -publicada pela Fundação do Software Livre (FSF); na versão 2 da Licença, ou (na sua opinião) qualquer versão. - -Este programa é distribuido na esperança que possa ser util, mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAÇÂO a qualquer -MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU para maiores detalhes. - -Você deve ter recebido uma cópia da Licença Pública Geral GNU, sob o título "LICENCA.txt", junto com este programa, se não, escreva para a Fundação do Software -Livre(FSF) Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -*) - -unit frmConfiguracoes; - -interface - -uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Buttons, StdCtrls, ExtCtrls, main, dialogs; - -type - TFormConfiguracoes = class(TForm) - Lb_End_Serv_Aplicacao: TLabel; - EditEnderecoServidorAplicacao: TEdit; - BtN_Confirmar: TButton; - Btn_Desinstalar: TButton; - Bv1_Configuracoes: TBevel; - Btn_Cancelar: TButton; - Btn_OK: TButton; - Lb_End_Serv_Updates: TLabel; - EditEnderecoServidorUpdates: TEdit; - procedure pro_Btn_OK(Sender: TObject); - procedure pro_Btn_Cancelar(Sender: TObject); - procedure FormClose(Sender: TObject; var Action: TCloseAction); - procedure FormCreate(Sender: TObject); - procedure pro_Btn_Confirmar(Sender: TObject); - procedure pro_Btn_Desinstalar(Sender: TObject); - procedure AtualizaConfiguracoes(Chave, Valor : String); - private - { Private declarations } - public - { Public declarations } - end; - -var - FormConfiguracoes: TFormConfiguracoes; - -implementation - - -{$R *.dfm} - -procedure TFormConfiguracoes.AtualizaConfiguracoes(Chave, Valor: String); -begin - ///Falta validar se o endereco é valido. E se for nome? - FormularioGeral.SetValorDatMemoria(Chave, Valor, v_tstrCipherOpened); -end; - -procedure TFormConfiguracoes.pro_Btn_OK(Sender: TObject); -begin - AtualizaConfiguracoes('Configs.EnderecoServidor',EditEnderecoServidorAplicacao.Text); - AtualizaConfiguracoes('Configs.TE_SERV_UPDATES' ,EditEnderecoServidorUpdates.Text); - FormularioGeral.CipherClose; - release; - Close; -end; - -procedure TFormConfiguracoes.pro_Btn_Cancelar(Sender: TObject); -begin - release; - Close; -end; - - -procedure TFormConfiguracoes.FormClose(Sender: TObject; var Action: TCloseAction); -begin - Release; - close; -end; - - -procedure TFormConfiguracoes.FormCreate(Sender: TObject); -var v_ID_SO : String; -begin - EditEnderecoServidorAplicacao.Text := FormularioGeral.GetValorDatMemoria('Configs.EnderecoServidor',v_tstrCipherOpened); - EditEnderecoServidorUpdates.Text := FormularioGeral.GetValorDatMemoria('Configs.TE_SERV_UPDATES',v_tstrCipherOpened); - v_ID_SO := trim(FormularioGeral.GetValorDatMemoria('Configs.ID_SO',v_tstrCipherOpened)); - Btn_Desinstalar.Visible := FALSE; - If (v_ID_SO <> '') and (g_oCacic.isWindows9xME()) then - begin - //Se for Win9x/ME - Btn_Desinstalar.Visible := TRUE; - end; -end; - -procedure TFormConfiguracoes.pro_Btn_Confirmar(Sender: TObject); -Begin - If Trim(EditEnderecoServidorAplicacao.Text) = '' Then - Begin - MessageDlg('Erro na instalação: ' + #13#10 + 'Não foi especificado o endereço do servidor do CACIC.', mtInformation, [mbOk], 0); - Exit; - end; - If Trim(EditEnderecoServidorUpdates.Text) = '' Then - Begin - MessageDlg('Erro na instalação: ' + #13#10 + 'Não foi especificado o endereço do servidor de Updates do CACIC.', mtInformation, [mbOk], 0); - Exit; - end; - - try - FormConfiguracoes.AtualizaConfiguracoes('Configs.EnderecoServidor',Trim(EditEnderecoServidorAplicacao.Text)); - finally - end; - try - FormConfiguracoes.AtualizaConfiguracoes('Configs.TE_SERV_UPDATES',Trim(EditEnderecoServidorUpdates.Text)); - finally - end; - FormularioGeral.CipherClose; - release; - close; -end; - - - - -procedure TFormConfiguracoes.pro_Btn_Desinstalar(Sender: TObject); -begin - FormularioGeral.DelValorReg('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run\cacic2'); - FormConfiguracoes.Visible := false; - MessageDlg('O CACIC não será mais executado automaticamente durante a inicialização do Windows. O arquivo ' + Application.ExeName + ' não será removido do seu computador, permitindo que seja realizada a instalação novamente.', mtInformation, [mbOk], 10); - close; -end; -end. diff --git a/imgFechar.bmp b/imgFechar.bmp deleted file mode 100755 index dd08618..0000000 Binary files a/imgFechar.bmp and /dev/null differ diff --git a/raio.ico b/raio.ico deleted file mode 100755 index bd949d0..0000000 Binary files a/raio.ico and /dev/null differ diff --git a/raio.psd b/raio.psd deleted file mode 100755 index d691c84..0000000 Binary files a/raio.psd and /dev/null differ -- libgit2 0.21.2