Commit a91edf1c54be688899136cbe6805eb35c5aeb687
1 parent
58dcc587
Exists in
master
Ajustes no agente principal (cacic2.exe) para tratamento da reexibicao do icone …
…no systray quando em logoff/logon, ajustes no chkCACIC para criacao de excecoes no firewall nativo do XP para o srCACICsrv, implementacao de indicador da condicao para Desativacao do Suporte Remoto pelo cliente. git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@781 fecfc0c7-e812-0410-ae72-849f08638ee7
Showing
7 changed files
with
136 additions
and
59 deletions
Show diff stats
cacic2.res
No preview for this file type
cacicservice/CACICsvcMain.pas
... | ... | @@ -110,10 +110,10 @@ procedure TCACICservice.logDEBUG(Msg : String); |
110 | 110 | var fLog: textfile; |
111 | 111 | begin |
112 | 112 | // Somente gravarei informações para debug se o arquivo "<HomeDrive>:\CACICsvc.log" existir |
113 | - if FileExists(g_oCacic.Windows.getHomeDrive + 'CACICsvc.log') then | |
113 | + if FileExists(g_oCacic.Windows.getHomeDrive + g_oCacic.Windows.getWinDir + 'CACICsvc.log') then | |
114 | 114 | Begin |
115 | - AssignFile(fLog, g_oCacic.Windows.getHomeDrive + 'CACICsvc.log'); | |
116 | - if FileExists(g_oCacic.Windows.getHomeDrive + 'CACICsvc.log') then | |
115 | + AssignFile(fLog, g_oCacic.Windows.getHomeDrive + g_oCacic.Windows.getWinDir + 'CACICsvc.log'); | |
116 | + if FileExists(g_oCacic.Windows.getHomeDrive + g_oCacic.Windows.getWinDir + 'CACICsvc.log') then | |
117 | 117 | Append(fLog) |
118 | 118 | else |
119 | 119 | Rewrite(fLog); |
... | ... | @@ -148,6 +148,9 @@ procedure TCACICservice.ServiceStart(Sender: TService; var Started: Boolean); |
148 | 148 | begin |
149 | 149 | |
150 | 150 | g_oCacic := TCACIC.Create; |
151 | + g_oCacic.setCacicPath(GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini')); | |
152 | + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : setCacicPath => '+GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini')); | |
153 | + | |
151 | 154 | CACICservice.logDEBUG('TCACICservice.ServiceStart'); |
152 | 155 | Started := true; |
153 | 156 | |
... | ... | @@ -162,9 +165,6 @@ end; |
162 | 165 | |
163 | 166 | procedure TCACICservice.ExecutaCACIC; |
164 | 167 | Begin |
165 | - CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : setCacicPath => '+GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini')); | |
166 | - g_oCacic.setCacicPath(GetValorChaveRegIni('Cacic2', 'cacic_dir', g_oCacic.getWinDir + 'chksis.ini')); | |
167 | - | |
168 | 168 | CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : deleteFile => '+g_oCacic.getCacicPath + 'aguarde_CACIC.txt'); |
169 | 169 | DeleteFile(g_oCacic.getCacicPath + 'aguarde_CACIC.txt'); |
170 | 170 | Sleep(3000); |
... | ... | @@ -181,15 +181,14 @@ Begin |
181 | 181 | |
182 | 182 | While not (FileExists(g_oCacic.getCacicPath + 'cacic2.exe')) do |
183 | 183 | Sleep(5000); // Espero 5 segundos... |
184 | - End; | |
185 | - | |
186 | 184 | |
187 | - // Executo o Agente Principal do CACIC | |
188 | - Try | |
189 | - CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : winExec => '+g_oCacic.getCacicPath + 'cacic2.exe'); | |
190 | - g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe',false); | |
191 | - Except | |
192 | - End; | |
185 | + // Executo o Agente Principal do CACIC | |
186 | + Try | |
187 | + CACICservice.logDEBUG('TCACICservice.ExecutaCACIC : winExec => '+g_oCacic.getCacicPath + 'cacic2.exe'); | |
188 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'cacic2.exe',false); | |
189 | + Except | |
190 | + End; | |
191 | + End; | |
193 | 192 | End; |
194 | 193 | |
195 | 194 | procedure TCACICservice.ServiceAfterInstall(Sender: TService); | ... | ... |
chkcacic/chkcacic.res
No preview for this file type
chkcacic/main.pas
... | ... | @@ -901,14 +901,32 @@ begin |
901 | 901 | End |
902 | 902 | else |
903 | 903 | LogDebug('Exceção para "'+p_objeto+'" já existente.'); |
904 | + | |
905 | + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then | |
906 | + Begin | |
907 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto); | |
908 | + End | |
909 | + else | |
910 | + LogDebug('Exceção para "'+p_objeto+'" já existente.'); | |
911 | + | |
904 | 912 | End |
905 | 913 | else |
906 | - if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then | |
907 | - Begin | |
908 | - SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto); | |
909 | - End | |
910 | - else | |
911 | - LogDebug('Exceção para "'+p_objeto+'" já existente.'); | |
914 | + Begin | |
915 | + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then | |
916 | + Begin | |
917 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto); | |
918 | + End | |
919 | + else | |
920 | + LogDebug('Exceção para "'+p_objeto+'" já existente.'); | |
921 | + | |
922 | + if (trim(GetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll])))='') then | |
923 | + Begin | |
924 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile\AuthorizedApplications\List\'+StringReplace(p_objeto+'.exe','\','?\',[rfReplaceAll]),p_objeto+'.exe:*:Enabled:'+p_objeto); | |
925 | + End | |
926 | + else | |
927 | + LogDebug('Exceção para "'+p_objeto+'" já existente.'); | |
928 | + | |
929 | + End | |
912 | 930 | Except |
913 | 931 | LogDebug('Problema adicionando "'+p_objeto+'" à lista de exceções do FireWall!'); |
914 | 932 | End; |
... | ... | @@ -1249,22 +1267,33 @@ begin |
1249 | 1267 | // Liberando as conexões de Saída para o FTP |
1250 | 1268 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|'); |
1251 | 1269 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|'); |
1270 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|'); | |
1271 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\FTP-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getHomeDrive+'system32\\ftp.exe|Name=Programa de transferência de arquivos|Desc=Programa de transferência de arquivos|Edge=FALSE|'); | |
1252 | 1272 | |
1253 | 1273 | // Liberando as conexões de Saída para o Ger_Cols |
1254 | 1274 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|'); |
1255 | 1275 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|'); |
1276 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|'); | |
1277 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-GERCOLS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\ger_cols.exe|Name=Módulo Gerente de Coletas do Sistema CACIC|Desc=Módulo Gerente de Coletas do Sistema CACIC|Edge=FALSE|'); | |
1256 | 1278 | |
1257 | 1279 | // Liberando as conexões de Saída para o SrCACICsrv |
1258 | 1280 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=Módulo Suporte Remoto Seguro do Sistema CACIC|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|'); |
1259 | 1281 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=Módulo Suporte Remoto Seguro do Sistema CACIC|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|'); |
1282 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=Módulo Suporte Remoto Seguro do Sistema CACIC|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|'); | |
1283 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-SRCACICSRV-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getCacicPath+'modulos\\srcacicsrv.exe|Name=Módulo Suporte Remoto Seguro do Sistema CACIC|Desc=Módulo Suporte Remoto Seguro do Sistema CACIC|Edge=FALSE|'); | |
1260 | 1284 | |
1261 | 1285 | // Liberando as conexões de Saída para o ChkCacic |
1262 | 1286 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKCACIC-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+ExtractFilePath(Application.Exename) + '\chkcacic.exe|Name=chkcacic.exe|Desc=chkcacic.exe|Edge=FALSE|'); |
1263 | 1287 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKCACIC-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+ExtractFilePath(Application.Exename) + '\chkcacic.exe|Name=chkcacic.exe|Desc=chkcacic.exe|Edge=FALSE|'); |
1288 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKCACIC-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+ExtractFilePath(Application.Exename) + '\chkcacic.exe|Name=chkcacic.exe|Desc=chkcacic.exe|Edge=FALSE|'); | |
1289 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKCACIC-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+ExtractFilePath(Application.Exename) + '\chkcacic.exe|Name=chkcacic.exe|Desc=chkcacic.exe|Edge=FALSE|'); | |
1264 | 1290 | |
1265 | 1291 | // Liberando as conexões de Saída para o ChkSis |
1266 | 1292 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getWinDir + 'chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|'); |
1267 | 1293 | SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getWinDir + 'chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|'); |
1294 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-TCP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=6|Profile=Private|App='+g_oCacic.getWinDir + 'chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|'); | |
1295 | + SetValorChaveRegEdit('HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules\CACIC-CHKSIS-Out-UDP','v2.0|Action=Allow|Active=TRUE|Dir=Out|Protocol=17|Profile=Private|App='+g_oCacic.getWinDir + 'chksis.exe|Name=Módulo Verificador de Integridade do Sistema CACIC|Desc=Módulo Verificador de Integridade do Sistema CACIC|Edge=FALSE|'); | |
1296 | + | |
1268 | 1297 | End |
1269 | 1298 | Except |
1270 | 1299 | LogDebug('Problema Liberando Policies de FireWall!'); |
... | ... | @@ -1272,10 +1301,11 @@ begin |
1272 | 1301 | End |
1273 | 1302 | else |
1274 | 1303 | Begin |
1275 | - // Acrescento o ChkCacic às exceções do FireWall nativo... | |
1304 | + // Acrescento o ChkCacic e srCACICsrv às exceções do FireWall nativo... | |
1276 | 1305 | {chkcacic} |
1277 | 1306 | LogDebug('Inserindo "'+ExtractFilePath(Application.Exename) + 'chkcacic" nas exceções do FireWall!'); |
1278 | 1307 | LiberaFireWall(ExtractFilePath(Application.Exename) + 'chkcacic'); |
1308 | + LiberaFireWall(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe'); | |
1279 | 1309 | End; |
1280 | 1310 | Except |
1281 | 1311 | End; | ... | ... |
ger_cols/ger_cols.dpr
... | ... | @@ -170,7 +170,7 @@ procedure log_DEBUG(p_msg:string); |
170 | 170 | Begin |
171 | 171 | if v_Debugs then log_diario('(v.'+getVersionInfo(ParamStr(0))+') DEBUG - '+p_msg); |
172 | 172 | End; |
173 | - | |
173 | +{ | |
174 | 174 | function Compress(p_strToCompress : string) : String; |
175 | 175 | var v_tstrToCompress, v_tstrCompressed : TStringStream; |
176 | 176 | Zip : TZCompressionStream; |
... | ... | @@ -182,7 +182,7 @@ begin |
182 | 182 | Zip.Free; |
183 | 183 | |
184 | 184 | Result := ZlibEx.ZCompressStrWeb(v_tstrCompressed.DataString); |
185 | -end; {Compress} | |
185 | +end; | |
186 | 186 | |
187 | 187 | function DeCompress(p_ToDeCompress : String) : String; |
188 | 188 | var v_tstrToDeCompress, v_tstrDeCompressed : TStringStream; |
... | ... | @@ -203,8 +203,8 @@ end; |
203 | 203 | |
204 | 204 | DeZip.Free; |
205 | 205 | Result := ZlibEx.ZDecompressStrEx(v_tstrDeCompressed.DataString); |
206 | -end; {DeCompress} | |
207 | - | |
206 | +end; | |
207 | +} | |
208 | 208 | Function RemoveCaracteresEspeciais(Texto, p_Fill : String; p_start, p_end:integer) : String; |
209 | 209 | var I : Integer; |
210 | 210 | Begin |
... | ... | @@ -2435,6 +2435,8 @@ Begin |
2435 | 2435 | SetValorDatMemoria('Configs.IN_EXIBE_BANDEJA' ,UpperCase(g_oCacic.deCrypt(XML_RetornaValor('in_exibe_bandeja' , strRetorno))), v_tstrCipherOpened); |
2436 | 2436 | SetValorDatMemoria('Configs.TE_JANELAS_EXCECAO' ,g_oCacic.deCrypt(XML_RetornaValor('te_janelas_excecao' , strRetorno)) , v_tstrCipherOpened); |
2437 | 2437 | SetValorDatMemoria('TcpIp.TE_ENDERECOS_MAC_INVALIDOS' ,g_oCacic.deCrypt(XML_RetornaValor('te_enderecos_mac_invalidos' , strRetorno)) , v_tstrCipherOpened); |
2438 | + SetValorDatMemoria('Configs.NU_PORTA_SRCACIC' ,g_oCacic.deCrypt(XML_RetornaValor('nu_porta_srcacic' , strRetorno)) , v_tstrCipherOpened); | |
2439 | + SetValorDatMemoria('Configs.CS_PERMITIR_DESATIVAR_SRCACIC' ,g_oCacic.deCrypt(XML_RetornaValor('cs_permitir_desativar_srcacic' , strRetorno)) , v_tstrCipherOpened); | |
2438 | 2440 | SetValorDatMemoria('Configs.DT_HR_COLETA_FORCADA' ,stringreplace(stringreplace(stringreplace(g_oCacic.deCrypt(XML_RetornaValor('dt_hr_coleta_forcada' , strRetorno)),'-','',[rfReplaceAll]),' ','',[rfReplaceAll]),':','',[rfReplaceAll]), v_tstrCipherOpened); |
2439 | 2441 | SetValorDatMemoria('Configs.DT_HR_COLETA_FORCADA_ANVI' ,stringreplace(stringreplace(stringreplace(g_oCacic.deCrypt(XML_RetornaValor('dt_hr_coleta_forcada_anvi', strRetorno)),'-','',[rfReplaceAll]),' ','',[rfReplaceAll]),':','',[rfReplaceAll]), v_tstrCipherOpened); |
2440 | 2442 | SetValorDatMemoria('Configs.DT_HR_COLETA_FORCADA_COMP' ,stringreplace(stringreplace(stringreplace(g_oCacic.deCrypt(XML_RetornaValor('dt_hr_coleta_forcada_comp', strRetorno)),'-','',[rfReplaceAll]),' ','',[rfReplaceAll]),':','',[rfReplaceAll]), v_tstrCipherOpened); | ... | ... |
ger_cols/ger_cols.res
No preview for this file type
main.pas
... | ... | @@ -62,6 +62,10 @@ var |
62 | 62 | v_tstrCipherOpened : TStrings; |
63 | 63 | |
64 | 64 | var |
65 | + g_intTaskBarAtual, | |
66 | + g_intTaskBarAnterior : integer; | |
67 | + | |
68 | +var | |
65 | 69 | boolDebugs : Boolean; |
66 | 70 | |
67 | 71 | var |
... | ... | @@ -1054,6 +1058,11 @@ var strAux, |
1054 | 1058 | v_Aguarde : TextFile; |
1055 | 1059 | v_SystemDrive : TStrings; |
1056 | 1060 | begin |
1061 | + // Essas variáveis ajudarão a controlar o redesenho do ícone no systray, | |
1062 | + // evitando o "roubo" do foco. | |
1063 | + g_intTaskBarAtual := 0; | |
1064 | + g_intTaskBarAnterior := 0; | |
1065 | + | |
1057 | 1066 | // Não mostrar o formulário... |
1058 | 1067 | Application.ShowMainForm:=false; |
1059 | 1068 | g_oCacic := TCACIC.Create; |
... | ... | @@ -2158,15 +2167,20 @@ end; |
2158 | 2167 | } |
2159 | 2168 | procedure TFormularioGeral.Mnu_SuporteRemotoClick(Sender: TObject); |
2160 | 2169 | var boolAux : boolean; |
2161 | - strPalavraChave, | |
2162 | - strTeSO, | |
2163 | - strTeNodeAddress : String; | |
2170 | + v_strPalavraChave, | |
2171 | + v_strTeSO, | |
2172 | + v_strTeNodeAddress, | |
2173 | + v_strNuPortaSR : String; | |
2164 | 2174 | fileAguarde : TextFile; |
2165 | 2175 | begin |
2166 | 2176 | if boolServerON then // Ordeno ao SrCACICsrv que auto-finalize |
2167 | 2177 | Begin |
2168 | 2178 | Log_Diario('Desativando Suporte Remoto Seguro.'); |
2179 | + WinExec(PChar(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -kill'), SW_NORMAL); | |
2180 | + { | |
2169 | 2181 | g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -kill',false); |
2182 | + } | |
2183 | + | |
2170 | 2184 | boolServerON := false; |
2171 | 2185 | End |
2172 | 2186 | else |
... | ... | @@ -2176,28 +2190,31 @@ begin |
2176 | 2190 | |
2177 | 2191 | // Alguns cuidados necessários ao tráfego e recepção de valores pelo Gerente WEB |
2178 | 2192 | // Some cares about send and receive at Gerente WEB |
2179 | - strPalavraChave := FormularioGeral.getValorDatMemoria('Configs.te_palavra_chave', v_tstrCipherOpened); | |
2180 | - strPalavraChave := StringReplace(strPalavraChave,' ' ,'<ESPACE>' ,[rfReplaceAll]); | |
2181 | - strPalavraChave := StringReplace(strPalavraChave,'"' ,'<AD>' ,[rfReplaceAll]); | |
2182 | - strPalavraChave := StringReplace(strPalavraChave,'''' ,'<AS>' ,[rfReplaceAll]); | |
2183 | - strPalavraChave := StringReplace(strPalavraChave,'\' ,'<BarrInv>' ,[rfReplaceAll]); | |
2184 | - strPalavraChave := g_oCacic.enCrypt(strPalavraChave); | |
2185 | - strPalavraChave := StringReplace(strPalavraChave,'+','<MAIS>',[rfReplaceAll]); | |
2186 | - | |
2187 | - strTeSO := trim(StringReplace(FormularioGeral.getValorDatMemoria('Configs.TE_SO', v_tstrCipherOpened),' ','<ESPACE>',[rfReplaceAll])); | |
2188 | - strTeSO := g_oCacic.enCrypt(strTeSO); | |
2189 | - strTeSO := StringReplace(strTeSO,'+','<MAIS>',[rfReplaceAll]); | |
2190 | - | |
2191 | - strTeNodeAddress := trim(StringReplace(FormularioGeral.getValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),' ','<ESPACE>' ,[rfReplaceAll])); | |
2192 | - strTeNodeAddress := g_oCacic.enCrypt(strTeNodeAddress); | |
2193 | - strTeNodeAddress := StringReplace(strTeNodeAddress,'+','<MAIS>',[rfReplaceAll]); | |
2193 | + v_strPalavraChave := FormularioGeral.getValorDatMemoria('Configs.te_palavra_chave', v_tstrCipherOpened); | |
2194 | + v_strPalavraChave := StringReplace(v_strPalavraChave,' ' ,'<ESPACE>' ,[rfReplaceAll]); | |
2195 | + v_strPalavraChave := StringReplace(v_strPalavraChave,'"' ,'<AD>' ,[rfReplaceAll]); | |
2196 | + v_strPalavraChave := StringReplace(v_strPalavraChave,'''' ,'<AS>' ,[rfReplaceAll]); | |
2197 | + v_strPalavraChave := StringReplace(v_strPalavraChave,'\' ,'<BarrInv>' ,[rfReplaceAll]); | |
2198 | + v_strPalavraChave := g_oCacic.enCrypt(v_strPalavraChave); | |
2199 | + v_strPalavraChave := StringReplace(v_strPalavraChave,'+','<MAIS>',[rfReplaceAll]); | |
2200 | + | |
2201 | + v_strTeSO := trim(StringReplace(FormularioGeral.getValorDatMemoria('Configs.TE_SO', v_tstrCipherOpened),' ','<ESPACE>',[rfReplaceAll])); | |
2202 | + v_strTeSO := g_oCacic.enCrypt(v_strTeSO); | |
2203 | + v_strTeSO := StringReplace(v_strTeSO,'+','<MAIS>',[rfReplaceAll]); | |
2204 | + | |
2205 | + v_strTeNodeAddress := trim(StringReplace(FormularioGeral.getValorDatMemoria('TcpIp.TE_NODE_ADDRESS' , v_tstrCipherOpened),' ','<ESPACE>' ,[rfReplaceAll])); | |
2206 | + v_strTeNodeAddress := g_oCacic.enCrypt(v_strTeNodeAddress); | |
2207 | + v_strTeNodeAddress := StringReplace(v_strTeNodeAddress,'+','<MAIS>',[rfReplaceAll]); | |
2208 | + | |
2209 | + v_strNuPortaSR := trim(FormularioGeral.getValorDatMemoria('Configs.NU_PORTA_SRCACIC' , v_tstrCipherOpened)); | |
2194 | 2210 | |
2195 | 2211 | log_DEBUG('Invocando "'+g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' + |
2196 | - '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' + | |
2197 | - '[' + strTeSO + ']' + | |
2198 | - '[' + strTeNodeAddress + ']' + | |
2199 | - '[' + strPalavraChave + ']' + | |
2200 | - '[' + g_oCacic.getCacicPath + 'Temp\aguarde_srCACIC.txt' + ']'); | |
2212 | + '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' + | |
2213 | + '[' + v_strTeSO + ']' + | |
2214 | + '[' + v_strTeNodeAddress + ']' + | |
2215 | + '[' + v_strPalavraChave + ']' + | |
2216 | + '[' + g_oCacic.getCacicPath + 'Temp\' + ']' + | |
2217 | + '[' + v_strNuPortaSR + ']'); | |
2201 | 2218 | |
2202 | 2219 | // Detectar versão do Windows antes de fazer a chamada seguinte... |
2203 | 2220 | try |
... | ... | @@ -2215,12 +2232,23 @@ begin |
2215 | 2232 | CloseFile(fileAguarde); |
2216 | 2233 | Finally |
2217 | 2234 | End; |
2218 | - g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' + | |
2219 | - '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' + | |
2220 | - '[' + strTeSO + ']' + | |
2221 | - '[' + strTeNodeAddress + ']' + | |
2222 | - '[' + strPalavraChave + ']' + | |
2223 | - '[' + g_oCacic.getCacicPath + 'Temp\' + ']',false); | |
2235 | + WinExec(PChar(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' + | |
2236 | + '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' + | |
2237 | + '[' + v_strTeSO + ']' + | |
2238 | + '[' + v_strTeNodeAddress + ']' + | |
2239 | + '[' + v_strPalavraChave + ']' + | |
2240 | + '[' + g_oCacic.getCacicPath + 'Temp\' + ']' + | |
2241 | + '[' + v_strNuPortaSR + ']'),SW_NORMAL); | |
2242 | + { | |
2243 | + g_oCacic.createSampleProcess(g_oCacic.getCacicPath + 'modulos\srcacicsrv.exe -start [' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.EnderecoServidor', v_tstrCipherOpened)) + ']' + | |
2244 | + '[' + g_oCacic.enCrypt(FormularioGeral.getValorDatMemoria('Configs.Endereco_WS' , v_tstrCipherOpened)) + ']' + | |
2245 | + '[' + v_strTeSO + ']' + | |
2246 | + '[' + v_strTeNodeAddress + ']' + | |
2247 | + '[' + v_strPalavraChave + ']' + | |
2248 | + '[' + g_oCacic.getCacicPath + 'Temp\' + ']' + | |
2249 | + '[' + v_strNuPortaSR + ']',false); | |
2250 | + } | |
2251 | + | |
2224 | 2252 | |
2225 | 2253 | BoolServerON := true; |
2226 | 2254 | End; |
... | ... | @@ -2240,8 +2268,17 @@ begin |
2240 | 2268 | FormularioGeral.Matar(g_oCacic.getCacicPath+'temp\','aguarde_SRCACIC.txt'); |
2241 | 2269 | if FileExists(g_oCacic.getCacicPath + 'temp\aguarde_SRCACIC.txt') then |
2242 | 2270 | Begin |
2243 | - Mnu_SuporteRemoto.Caption := 'Suporte Remoto Ativo!'; | |
2244 | - Mnu_SuporteRemoto.Enabled := false; | |
2271 | + if (getValorDatMemoria('Configs.CS_PERMITIR_DESATIVAR_SRCACIC',v_tstrCipherOpened) = 'S') then | |
2272 | + Begin | |
2273 | + Mnu_SuporteRemoto.Caption := 'Desativar Suporte Remoto'; | |
2274 | + Mnu_SuporteRemoto.Enabled := true; | |
2275 | + End | |
2276 | + else | |
2277 | + Begin | |
2278 | + Mnu_SuporteRemoto.Caption := 'Suporte Remoto Ativo!'; | |
2279 | + Mnu_SuporteRemoto.Enabled := false; | |
2280 | + End; | |
2281 | + | |
2245 | 2282 | boolServerON := true; |
2246 | 2283 | End |
2247 | 2284 | else |
... | ... | @@ -2254,9 +2291,18 @@ end; |
2254 | 2291 | |
2255 | 2292 | procedure TFormularioGeral.Timer_InicializaTrayTimer(Sender: TObject); |
2256 | 2293 | begin |
2257 | - Timer_InicializaTray.Enabled := false; | |
2258 | - InicializaTray; | |
2259 | - Timer_InicializaTray.Enabled := true; | |
2294 | + Timer_InicializaTray.Enabled := false; | |
2295 | + | |
2296 | + g_intTaskBarAtual := FindWindow('Shell_TrayWnd', Nil); | |
2297 | + Log_DEBUG('g_intTaskBarAnterior: '+ intToStr(g_intTaskBarAnterior)); | |
2298 | + Log_DEBUG('g_intTaskBarAtual: ' + intToStr(g_intTaskBarAtual)); | |
2299 | + | |
2300 | + if (g_intTaskBarAnterior = 0) and (g_intTaskBarAtual > 0) then | |
2301 | + InicializaTray; | |
2302 | + | |
2303 | + g_intTaskBarAnterior := g_intTaskBarAtual; | |
2304 | + | |
2305 | + Timer_InicializaTray.Enabled := true; | |
2260 | 2306 | end; |
2261 | 2307 | |
2262 | 2308 | end. | ... | ... |