Commit 0e2451b7dd32f78492dd64de6f21d5c8265115d6
1 parent
cf0bd127
Exists in
master
-Acrescentado debugador do cacicservice, pois devido ao script de instalação pel…
…o netlogon, o serviço estava sendo instalado sem ser com o tipo idetarivo. -Acrescentado loop de espera para pegar o nome de usuário logado, pois às vezes o mapa executava antes de realizar o login completo na máquina.
Showing
17 changed files
with
274 additions
and
102 deletions
Show diff stats
CACIC_Library.pas
@@ -60,6 +60,7 @@ uses Windows, | @@ -60,6 +60,7 @@ uses Windows, | ||
60 | Tlhelp32, | 60 | Tlhelp32, |
61 | ComObj, | 61 | ComObj, |
62 | ShellAPI, | 62 | ShellAPI, |
63 | + WinSvc, | ||
63 | Variants; | 64 | Variants; |
64 | 65 | ||
65 | type | 66 | type |
@@ -124,7 +125,7 @@ type | @@ -124,7 +125,7 @@ type | ||
124 | {*------------------------------------------------------------------------------ | 125 | {*------------------------------------------------------------------------------ |
125 | Classe geral da biblioteca | 126 | Classe geral da biblioteca |
126 | -------------------------------------------------------------------------------} | 127 | -------------------------------------------------------------------------------} |
127 | - TCACIC = class(TCACIC_Windows) | 128 | + TCACIC = class(TCACIC_Windows) |
128 | constructor Create(); | 129 | constructor Create(); |
129 | destructor Destroy; override; | 130 | destructor Destroy; override; |
130 | private | 131 | private |
@@ -140,7 +141,7 @@ type | @@ -140,7 +141,7 @@ type | ||
140 | Windows : TCACIC_Windows; /// objeto de informacoes de windows | 141 | Windows : TCACIC_Windows; /// objeto de informacoes de windows |
141 | function checkIfFileDateIsToday(pStrFileName : String) : Boolean; | 142 | function checkIfFileDateIsToday(pStrFileName : String) : Boolean; |
142 | function countOccurences(const strSubText, strText: string) : Integer; | 143 | function countOccurences(const strSubText, strText: string) : Integer; |
143 | - function createOneProcess(pStrCmd: string; pBoolWait: boolean; pWordShowWindow : word = SW_HIDE) : Boolean; | 144 | + function createOneProcess(pStrCmd: string; pBoolWait: boolean; pWordShowWindow : word = SW_HIDE; waitMilliseconds : cardinal = INFINITE) : Boolean; |
144 | function capitalize (CONST s: STRING) : String; | 145 | function capitalize (CONST s: STRING) : String; |
145 | function checkModule(pStrModuleFileName, pStrModuleHashCode : String) : String; | 146 | function checkModule(pStrModuleFileName, pStrModuleHashCode : String) : String; |
146 | function deCrypt(pStrCipheredText : String; pBoolShowInLog : boolean = true; pBoolForceDecrypt : boolean = false) : String; | 147 | function deCrypt(pStrCipheredText : String; pBoolShowInLog : boolean = true; pBoolForceDecrypt : boolean = false) : String; |
@@ -199,6 +200,10 @@ type | @@ -199,6 +200,10 @@ type | ||
199 | procedure writeDailyLog(pStrLogMessage : String; pStrFileNameSuffix : String = ''); | 200 | procedure writeDailyLog(pStrLogMessage : String; pStrFileNameSuffix : String = ''); |
200 | procedure writeDebugLog(pStrDebugMessage : String); override; | 201 | procedure writeDebugLog(pStrDebugMessage : String); override; |
201 | procedure writeExceptionLog(pStrExceptionMessage, pStrExceptionClassName : String; pStrAddedMessage : String = ''); override; | 202 | procedure writeExceptionLog(pStrExceptionMessage, pStrExceptionClassName : String; pStrAddedMessage : String = ''); override; |
203 | + | ||
204 | + function serviceGetType(sMachine, sService: PChar): DWORD; | ||
205 | + function serviceStart(sMachine,sService : string ) : boolean; | ||
206 | + function ServiceGetStatus(sMachine, sService: PChar): DWORD; | ||
202 | end; | 207 | end; |
203 | 208 | ||
204 | // Declaração de constantes para a biblioteca | 209 | // Declaração de constantes para a biblioteca |
@@ -1091,6 +1096,47 @@ begin | @@ -1091,6 +1096,47 @@ begin | ||
1091 | end; | 1096 | end; |
1092 | end; | 1097 | end; |
1093 | 1098 | ||
1099 | +function TCACIC.serviceStart(sMachine,sService : string ) : boolean; | ||
1100 | +var | ||
1101 | + schm,schs : SC_Handle; | ||
1102 | + ss : TServiceStatus; | ||
1103 | + psTemp : PChar; | ||
1104 | + dwChkP : DWord; | ||
1105 | +begin | ||
1106 | + ss.dwCurrentState := 0; | ||
1107 | + schm := OpenSCManager(PChar(sMachine),Nil,SC_MANAGER_CONNECT); | ||
1108 | + if(schm > 0)then | ||
1109 | + begin | ||
1110 | + schs := OpenService(schm,PChar(sService),SERVICE_START or SERVICE_QUERY_STATUS); | ||
1111 | + if(schs > 0)then | ||
1112 | + begin | ||
1113 | + psTemp := Nil; | ||
1114 | + if(StartService(schs,0,psTemp))then | ||
1115 | + begin | ||
1116 | + if(QueryServiceStatus(schs,ss))then | ||
1117 | + begin | ||
1118 | + while(SERVICE_RUNNING <> ss.dwCurrentState)do | ||
1119 | + begin | ||
1120 | + dwChkP := ss.dwCheckPoint; | ||
1121 | + Sleep(ss.dwWaitHint); | ||
1122 | + if(not QueryServiceStatus(schs,ss))then | ||
1123 | + begin | ||
1124 | + break; | ||
1125 | + end; | ||
1126 | + if(ss.dwCheckPoint < dwChkP)then | ||
1127 | + begin | ||
1128 | + break; | ||
1129 | + end; | ||
1130 | + end; | ||
1131 | + end; | ||
1132 | + end; | ||
1133 | + CloseServiceHandle(schs); | ||
1134 | + end; | ||
1135 | + CloseServiceHandle(schm); | ||
1136 | + end; | ||
1137 | + Result := SERVICE_RUNNING = ss.dwCurrentState; | ||
1138 | +end; | ||
1139 | + | ||
1094 | procedure TCACIC.writeDebugLog(pStrDebugMessage : String); | 1140 | procedure TCACIC.writeDebugLog(pStrDebugMessage : String); |
1095 | Begin | 1141 | Begin |
1096 | if isInDebugMode(copy(pStrDebugMessage,1,pos(':',pStrDebugMessage)-1)) then | 1142 | if isInDebugMode(copy(pStrDebugMessage,1,pos(':',pStrDebugMessage)-1)) then |
@@ -1224,7 +1270,7 @@ end; | @@ -1224,7 +1270,7 @@ end; | ||
1224 | @param p_wait TRUE se deve aguardar término da excução, FALSE caso contrário | 1270 | @param p_wait TRUE se deve aguardar término da excução, FALSE caso contrário |
1225 | @param p_showWindow Constante que define o tipo de exibição da janela do aplicativo | 1271 | @param p_showWindow Constante que define o tipo de exibição da janela do aplicativo |
1226 | -------------------------------------------------------------------------------} | 1272 | -------------------------------------------------------------------------------} |
1227 | -function TCACIC.createOneProcess(pStrCmd: string; pBoolWait: boolean; pWordShowWindow : word = SW_HIDE): boolean; | 1273 | +function TCACIC.createOneProcess(pStrCmd: string; pBoolWait: boolean; pWordShowWindow : word = SW_HIDE; waitMilliseconds : cardinal = INFINITE): boolean; |
1228 | var | 1274 | var |
1229 | SUInfo: TStartupInfo; | 1275 | SUInfo: TStartupInfo; |
1230 | ProcInfo: TProcessInformation; | 1276 | ProcInfo: TProcessInformation; |
@@ -1244,8 +1290,7 @@ begin | @@ -1244,8 +1290,7 @@ begin | ||
1244 | nil, | 1290 | nil, |
1245 | nil, | 1291 | nil, |
1246 | false, | 1292 | false, |
1247 | - CREATE_NEW_CONSOLE or | ||
1248 | - BELOW_NORMAL_PRIORITY_CLASS, | 1293 | + NORMAL_PRIORITY_CLASS, |
1249 | nil, | 1294 | nil, |
1250 | nil, | 1295 | nil, |
1251 | SUInfo, | 1296 | SUInfo, |
@@ -1253,7 +1298,7 @@ begin | @@ -1253,7 +1298,7 @@ begin | ||
1253 | if (Result) then | 1298 | if (Result) then |
1254 | begin | 1299 | begin |
1255 | if(pBoolWait) then begin | 1300 | if(pBoolWait) then begin |
1256 | - WaitForSingleObject(ProcInfo.hProcess, INFINITE); | 1301 | + WaitForSingleObject(ProcInfo.hProcess, waitMilliseconds); |
1257 | CloseHandle(ProcInfo.hProcess); | 1302 | CloseHandle(ProcInfo.hProcess); |
1258 | CloseHandle(ProcInfo.hThread); | 1303 | CloseHandle(ProcInfo.hThread); |
1259 | end; | 1304 | end; |
@@ -1950,5 +1995,102 @@ begin | @@ -1950,5 +1995,102 @@ begin | ||
1950 | end; | 1995 | end; |
1951 | end; | 1996 | end; |
1952 | end; | 1997 | end; |
1998 | + | ||
1999 | +function TCACIC.ServiceGetType(sMachine, sService: PChar): DWORD; | ||
2000 | + {*******************************************} | ||
2001 | + {*** Parameters: ***} | ||
2002 | + {*** sService: specifies the name of the service to open | ||
2003 | + {*** sMachine: specifies the name of the target computer | ||
2004 | + {*** ***} | ||
2005 | + {*** Return Values: ***} | ||
2006 | + | ||
2007 | +var | ||
2008 | + SCManHandle, SvcHandle: SC_Handle; | ||
2009 | + SS: TServiceStatus; | ||
2010 | + dwStat: DWORD; | ||
2011 | +begin | ||
2012 | + dwStat := 0; | ||
2013 | + // Open service manager handle. | ||
2014 | + writeDebugLog('ServiceGetStatus: Executando OpenSCManager.SC_MANAGER_CONNECT'); | ||
2015 | + SCManHandle := OpenSCManager(sMachine, nil, SC_MANAGER_CONNECT); | ||
2016 | + if (SCManHandle > 0) then | ||
2017 | + begin | ||
2018 | + writeDebugLog('ServiceGetStatus: Executando OpenService.SERVICE_QUERY_STATUS'); | ||
2019 | + SvcHandle := OpenService(SCManHandle, sService, SERVICE_ALL_ACCESS); | ||
2020 | + // if Service installed | ||
2021 | + if (SvcHandle > 0) then | ||
2022 | + begin | ||
2023 | + writeDebugLog('ServiceGetStatus: O serviço "'+ sService +'" já está instalado.'); | ||
2024 | + // SS structure holds the service status (TServiceStatus); | ||
2025 | + if (QueryServiceStatus(SvcHandle, SS)) then | ||
2026 | + dwStat := ss.dwServiceType; | ||
2027 | + if dwStat <> 272 then | ||
2028 | + begin | ||
2029 | + ChangeServiceConfig(SvcHandle, | ||
2030 | + 272, //iterative | ||
2031 | + SERVICE_NO_CHANGE, | ||
2032 | + SERVICE_NO_CHANGE, | ||
2033 | + nil, | ||
2034 | + nil, | ||
2035 | + nil, | ||
2036 | + nil, | ||
2037 | + nil, | ||
2038 | + nil, | ||
2039 | + nil); | ||
2040 | + end; | ||
2041 | + | ||
2042 | + if (QueryServiceStatus(SvcHandle, SS)) then | ||
2043 | + dwStat := ss.dwServiceType; | ||
2044 | + CloseServiceHandle(SvcHandle); | ||
2045 | + end; | ||
2046 | + CloseServiceHandle(SCManHandle); | ||
2047 | + end; | ||
2048 | + Result := dwStat; | ||
2049 | +end; | ||
2050 | + | ||
2051 | +function TCACIC.ServiceGetStatus(sMachine, sService: PChar): DWORD; | ||
2052 | + {*******************************************} | ||
2053 | + {*** Parameters: ***} | ||
2054 | + {*** sService: specifies the name of the service to open | ||
2055 | + {*** sMachine: specifies the name of the target computer | ||
2056 | + {*** ***} | ||
2057 | + {*** Return Values: ***} | ||
2058 | + {*** -1 = Error opening service ***} | ||
2059 | + {*** 1 = SERVICE_STOPPED ***} | ||
2060 | + {*** 2 = SERVICE_START_PENDING ***} | ||
2061 | + {*** 3 = SERVICE_STOP_PENDING ***} | ||
2062 | + {*** 4 = SERVICE_RUNNING ***} | ||
2063 | + {*** 5 = SERVICE_CONTINUE_PENDING ***} | ||
2064 | + {*** 6 = SERVICE_PAUSE_PENDING ***} | ||
2065 | + {*** 7 = SERVICE_PAUSED ***} | ||
2066 | + {******************************************} | ||
2067 | +var | ||
2068 | + SCManHandle, SvcHandle: SC_Handle; | ||
2069 | + SS: TServiceStatus; | ||
2070 | + dwStat: DWORD; | ||
2071 | +begin | ||
2072 | + dwStat := 0; | ||
2073 | + // Open service manager handle. | ||
2074 | + writeDebugLog('ServiceGetStatus: Executando OpenSCManager.SC_MANAGER_CONNECT'); | ||
2075 | + SCManHandle := OpenSCManager(sMachine, nil, SC_MANAGER_CONNECT); | ||
2076 | + if (SCManHandle > 0) then | ||
2077 | + begin | ||
2078 | + writeDebugLog('ServiceGetStatus: Executando OpenService.SERVICE_QUERY_STATUS'); | ||
2079 | + SvcHandle := OpenService(SCManHandle, sService, SERVICE_QUERY_STATUS); | ||
2080 | + // if Service installed | ||
2081 | + if (SvcHandle > 0) then | ||
2082 | + begin | ||
2083 | + writeDebugLog('ServiceGetStatus: O serviço "'+ sService +'" já está instalado.'); | ||
2084 | + // SS structure holds the service status (TServiceStatus); | ||
2085 | + if (QueryServiceStatus(SvcHandle, SS)) then | ||
2086 | + dwStat := ss.dwCurrentState; | ||
2087 | + | ||
2088 | + CloseServiceHandle(SvcHandle); | ||
2089 | + end; | ||
2090 | + CloseServiceHandle(SCManHandle); | ||
2091 | + end; | ||
2092 | + Result := dwStat; | ||
2093 | +end; | ||
2094 | + | ||
1953 | end. | 2095 | end. |
1954 | 2096 |
Grupo_CACIC.groupproj
@@ -19,15 +19,6 @@ | @@ -19,15 +19,6 @@ | ||
19 | <Target Name="chksis:Make"> | 19 | <Target Name="chksis:Make"> |
20 | <MSBuild Projects="chksis\chksis.dproj" Targets="Make" /> | 20 | <MSBuild Projects="chksis\chksis.dproj" Targets="Make" /> |
21 | </Target> | 21 | </Target> |
22 | - <Target Name="cacicservice"> | ||
23 | - <MSBuild Projects="cacicservice\cacicservice.dproj" Targets="" /> | ||
24 | - </Target> | ||
25 | - <Target Name="cacicservice:Clean"> | ||
26 | - <MSBuild Projects="cacicservice\cacicservice.dproj" Targets="Clean" /> | ||
27 | - </Target> | ||
28 | - <Target Name="cacicservice:Make"> | ||
29 | - <MSBuild Projects="cacicservice\cacicservice.dproj" Targets="Make" /> | ||
30 | - </Target> | ||
31 | <Target Name="cacic280"> | 22 | <Target Name="cacic280"> |
32 | <MSBuild Projects="cacic280.dproj" Targets="" /> | 23 | <MSBuild Projects="cacic280.dproj" Targets="" /> |
33 | </Target> | 24 | </Target> |
@@ -37,6 +28,15 @@ | @@ -37,6 +28,15 @@ | ||
37 | <Target Name="cacic280:Make"> | 28 | <Target Name="cacic280:Make"> |
38 | <MSBuild Projects="cacic280.dproj" Targets="Make" /> | 29 | <MSBuild Projects="cacic280.dproj" Targets="Make" /> |
39 | </Target> | 30 | </Target> |
31 | + <Target Name="cacicservice"> | ||
32 | + <MSBuild Projects="cacicservice\cacicservice.dproj" Targets="" /> | ||
33 | + </Target> | ||
34 | + <Target Name="cacicservice:Clean"> | ||
35 | + <MSBuild Projects="cacicservice\cacicservice.dproj" Targets="Clean" /> | ||
36 | + </Target> | ||
37 | + <Target Name="cacicservice:Make"> | ||
38 | + <MSBuild Projects="cacicservice\cacicservice.dproj" Targets="Make" /> | ||
39 | + </Target> | ||
40 | <Target Name="gercols"> | 40 | <Target Name="gercols"> |
41 | <MSBuild Projects="gercols\gercols.dproj" Targets="" /> | 41 | <MSBuild Projects="gercols\gercols.dproj" Targets="" /> |
42 | </Target> | 42 | </Target> |
@@ -83,12 +83,12 @@ | @@ -83,12 +83,12 @@ | ||
83 | <MSBuild Projects="C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\TesteSoftware.dproj" Targets="Make" /> | 83 | <MSBuild Projects="C:\Documents and Settings\adriano\Meus documentos\RAD Studio\Projects\TesteSoftware.dproj" Targets="Make" /> |
84 | </Target> | 84 | </Target> |
85 | <Target Name="Build"> | 85 | <Target Name="Build"> |
86 | - <CallTarget Targets="chksis;cacicservice;cacic280;gercols;installcacic;mapacacic;CacicVersionsAndHashes;TesteSoftware" /> | 86 | + <CallTarget Targets="chksis;cacic280;cacicservice;gercols;installcacic;mapacacic;CacicVersionsAndHashes;TesteSoftware" /> |
87 | </Target> | 87 | </Target> |
88 | <Target Name="Clean"> | 88 | <Target Name="Clean"> |
89 | - <CallTarget Targets="chksis:Clean;cacicservice:Clean;cacic280:Clean;gercols:Clean;installcacic:Clean;mapacacic:Clean;CacicVersionsAndHashes:Clean;TesteSoftware:Clean" /> | 89 | + <CallTarget Targets="chksis:Clean;cacic280:Clean;cacicservice:Clean;gercols:Clean;installcacic:Clean;mapacacic:Clean;CacicVersionsAndHashes:Clean;TesteSoftware:Clean" /> |
90 | </Target> | 90 | </Target> |
91 | <Target Name="Make"> | 91 | <Target Name="Make"> |
92 | - <CallTarget Targets="chksis:Make;cacicservice:Make;cacic280:Make;gercols:Make;installcacic:Make;mapacacic:Make;CacicVersionsAndHashes:Make;TesteSoftware:Make" /> | 92 | + <CallTarget Targets="chksis:Make;cacic280:Make;cacicservice:Make;gercols:Make;installcacic:Make;mapacacic:Make;CacicVersionsAndHashes:Make;TesteSoftware:Make" /> |
93 | </Target> | 93 | </Target> |
94 | </Project> | 94 | </Project> |
95 | \ No newline at end of file | 95 | \ No newline at end of file |
MapaTesteProj/MapaCACIC.dproj
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | <Borland.Personality>Delphi.Personality</Borland.Personality> | 24 | <Borland.Personality>Delphi.Personality</Borland.Personality> |
25 | <Borland.ProjectType /> | 25 | <Borland.ProjectType /> |
26 | <BorlandProject> | 26 | <BorlandProject> |
27 | -<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">2</VersionInfo><VersionInfo Name="MinorVer">8</VersionInfo><VersionInfo Name="Release">1</VersionInfo><VersionInfo Name="Build">7</VersionInfo><VersionInfo Name="Debug">True</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1046</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Dataprev - Emp. de TI da Prev Social - URES/SESS</VersionInfoKeys><VersionInfoKeys Name="FileDescription">Sistema CACIC - Módulo para Verificação e Instalação de Estrutura Básica do Sistema CACIC</VersionInfoKeys><VersionInfoKeys Name="FileVersion">2.8.1.7</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">3.0</VersionInfoKeys><VersionInfoKeys Name="Comments">Licença: GNU/LGPL</VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">mapacacic.dpr</Source></Source></Delphi.Personality><ModelSupport>False</ModelSupport></BorlandProject></BorlandProject> | 27 | +<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">2</VersionInfo><VersionInfo Name="MinorVer">8</VersionInfo><VersionInfo Name="Release">1</VersionInfo><VersionInfo Name="Build">8</VersionInfo><VersionInfo Name="Debug">True</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1046</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Dataprev - Emp. de TI da Prev Social - URES/SESS</VersionInfoKeys><VersionInfoKeys Name="FileDescription">Sistema CACIC - Módulo para Verificação e Instalação de Estrutura Básica do Sistema CACIC</VersionInfoKeys><VersionInfoKeys Name="FileVersion">2.8.1.8</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">3.0</VersionInfoKeys><VersionInfoKeys Name="Comments">Licença: GNU/LGPL</VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">mapacacic.dpr</Source></Source></Delphi.Personality><ModelSupport>False</ModelSupport></BorlandProject></BorlandProject> |
28 | </ProjectExtensions> | 28 | </ProjectExtensions> |
29 | <Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> | 29 | <Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> |
30 | <ItemGroup> | 30 | <ItemGroup> |
MapaTesteProj/MapaCACIC.res
No preview for this file type
MapaTesteProj/MapaTeste.dcu
No preview for this file type
MapaTesteProj/MapaTeste.pas
@@ -166,8 +166,10 @@ Begin | @@ -166,8 +166,10 @@ Begin | ||
166 | Visible := false; | 166 | Visible := false; |
167 | 167 | ||
168 | reset(textFileAguarde); | 168 | reset(textFileAguarde); |
169 | - objCACIC.deleteFileOrFolder(objCacic.getLocalFolderName + | ||
170 | - '\temp\aguarde_MAPACACIC.txt'); | 169 | + if FileExists(objCACIC.getLocalFolderName + '\temp\aguarde_MAPACACIC.txt') then |
170 | + objCACIC.deleteFileOrFolder(objCacic.getLocalFolderName + | ||
171 | + '\temp\aguarde_MAPACACIC.txt'); | ||
172 | + | ||
171 | Application.ProcessMessages; | 173 | Application.ProcessMessages; |
172 | 174 | ||
173 | Sair; | 175 | Sair; |
@@ -315,7 +317,7 @@ Begin | @@ -315,7 +317,7 @@ Begin | ||
315 | End | 317 | End |
316 | else | 318 | else |
317 | begin | 319 | begin |
318 | - MessageDlg(#13#13+'Não foi possível realizar a conexão!',mtError, [mbOK], 0); | 320 | + objCACIC.writeDailyLog('Não foi possível realizar a conexão!'); |
319 | end; | 321 | end; |
320 | btCombosUpdate.Enabled := true; | 322 | btCombosUpdate.Enabled := true; |
321 | End; | 323 | End; |
@@ -428,7 +430,9 @@ end; | @@ -428,7 +430,9 @@ end; | ||
428 | procedure TfrmMapaCacic.MontaInterface; | 430 | procedure TfrmMapaCacic.MontaInterface; |
429 | var strConfigsPatrimonioInterface, | 431 | var strConfigsPatrimonioInterface, |
430 | strNomeLDAP : String; | 432 | strNomeLDAP : String; |
433 | + count : integer; | ||
431 | Begin | 434 | Begin |
435 | + count := 0; | ||
432 | btCombosUpdate.Enabled := false; | 436 | btCombosUpdate.Enabled := false; |
433 | 437 | ||
434 | strConfigsPatrimonioInterface := objCacic.deCrypt(objCacic.getValueFromFile | 438 | strConfigsPatrimonioInterface := objCacic.deCrypt(objCacic.getValueFromFile |
@@ -449,9 +453,15 @@ Begin | @@ -449,9 +453,15 @@ Begin | ||
449 | //-----------------------------USUARIO LOGADO----------------------------------- | 453 | //-----------------------------USUARIO LOGADO----------------------------------- |
450 | 454 | ||
451 | // edTeInfoUserLogado.Text := getUserLogon; | 455 | // edTeInfoUserLogado.Text := getUserLogon; |
452 | - strTeInfoPatrimonio2:=objCACIC.getValueFromTags('UserName',fetchWMIvalues('Win32_ComputerSystem',objCACIC.getLocalFolderName,'UserName')); | ||
453 | - strTeInfoPatrimonio2:=copy(strTeInfoPatrimonio2, pos('\', strTeInfoPatrimonio2)+1, length(strTeInfoPatrimonio2)); | ||
454 | - edTeInfoPatrimonio2.Text:=strTeInfoPatrimonio2; | 456 | + while(strTeInfoPatrimonio2 = '') and (count < 600) do |
457 | + begin | ||
458 | + strTeInfoPatrimonio2:=objCACIC.getValueFromTags('UserName',fetchWMIvalues('Win32_ComputerSystem',objCACIC.getLocalFolderName,'UserName')); | ||
459 | + strTeInfoPatrimonio2:=copy(strTeInfoPatrimonio2, pos('\', strTeInfoPatrimonio2)+1, length(strTeInfoPatrimonio2)); | ||
460 | + edTeInfoPatrimonio2.Text:=strTeInfoPatrimonio2; | ||
461 | + sleep(1000); | ||
462 | + count := count + 1; | ||
463 | + end; | ||
464 | + | ||
455 | if edTeInfoPatrimonio2.Text <> '' then | 465 | if edTeInfoPatrimonio2.Text <> '' then |
456 | begin | 466 | begin |
457 | lbEtiqueta2.Visible := true; | 467 | lbEtiqueta2.Visible := true; |
@@ -684,10 +694,10 @@ begin | @@ -684,10 +694,10 @@ begin | ||
684 | else | 694 | else |
685 | Begin | 695 | Begin |
686 | frmMapaCacic.boolAcessoOK := false; | 696 | frmMapaCacic.boolAcessoOK := false; |
687 | - MessageDLG(#13#10+'Atenção! É necessário reinstalar o CACIC nesta estação.' + #13#10 + #13#10 + | ||
688 | - 'A escctrutura encontra-se corrompida.' + #13#10,mtError,[mbOK],0); | ||
689 | - Application.ProcessMessages; | ||
690 | - frmMapaCacic.Finalizar; | 697 | + Application.messagebox(Pchar('Atenção! É necessário reinstalar o CACIC nesta estação.' + |
698 | + #13#10 + #13#10 + 'A estrutura encontra-se corrompida.'), | ||
699 | + 'Erro!',MB_ICONERROR + mb_ok); | ||
700 | + Finalizar; | ||
691 | End; | 701 | End; |
692 | end | 702 | end |
693 | else | 703 | else |
MapaTesteProj/Source/synsock.pas
cacic280.dproj
@@ -40,7 +40,7 @@ | @@ -40,7 +40,7 @@ | ||
40 | <Borland.Personality>Delphi.Personality</Borland.Personality> | 40 | <Borland.Personality>Delphi.Personality</Borland.Personality> |
41 | <Borland.ProjectType>VCLApplication</Borland.ProjectType> | 41 | <Borland.ProjectType>VCLApplication</Borland.ProjectType> |
42 | <BorlandProject> | 42 | <BorlandProject> |
43 | -<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">2</VersionInfo><VersionInfo Name="MinorVer">8</VersionInfo><VersionInfo Name="Release">1</VersionInfo><VersionInfo Name="Build">9</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1046</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Dataprev - Emp. de TI da Prev.Social - URES/SESS</VersionInfoKeys><VersionInfoKeys Name="FileDescription">Sistema CACIC - Módulo Agente Principal</VersionInfoKeys><VersionInfoKeys Name="FileVersion">2.8.1.9</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright">Baseado na licença GNU/LGPL</VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName">Cacic - Configurador Automático e Coletor de Informações Computacionais</VersionInfoKeys><VersionInfoKeys Name="ProductVersion">3.0</VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">cacic280.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject> | 43 | +<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">2</VersionInfo><VersionInfo Name="MinorVer">8</VersionInfo><VersionInfo Name="Release">1</VersionInfo><VersionInfo Name="Build">11</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1046</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Dataprev - Emp. de TI da Prev.Social - URES/SESS</VersionInfoKeys><VersionInfoKeys Name="FileDescription">Sistema CACIC - Módulo Agente Principal</VersionInfoKeys><VersionInfoKeys Name="FileVersion">2.8.1.11</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright">Baseado na licença GNU/LGPL</VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName">Cacic - Configurador Automático e Coletor de Informações Computacionais</VersionInfoKeys><VersionInfoKeys Name="ProductVersion">3.0</VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">cacic280.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject> |
44 | </ProjectExtensions> | 44 | </ProjectExtensions> |
45 | <Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> | 45 | <Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> |
46 | <ItemGroup> | 46 | <ItemGroup> |
cacic280.res
No preview for this file type
cacicservice/CACICserviceMain.pas
@@ -97,7 +97,7 @@ begin | @@ -97,7 +97,7 @@ begin | ||
97 | //TOKEN_ADJUST_SESSIONID := 256; | 97 | //TOKEN_ADJUST_SESSIONID := 256; |
98 | 98 | ||
99 | // Log the client on to the local computer. | 99 | // Log the client on to the local computer. |
100 | - | 100 | + ServiceType := stWin32; |
101 | dwSessionId := WTSGetActiveConsoleSessionId(); | 101 | dwSessionId := WTSGetActiveConsoleSessionId(); |
102 | hSnap := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); | 102 | hSnap := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); |
103 | if (hSnap = INVALID_HANDLE_VALUE) then | 103 | if (hSnap = INVALID_HANDLE_VALUE) then |
@@ -433,15 +433,6 @@ Begin | @@ -433,15 +433,6 @@ Begin | ||
433 | else | 433 | else |
434 | g_oCacic.writeDebugLog('ExecutaCACIC: Cookie Bloqueado pelo Agente Principal ENCONTRADO - CACIC em Execução!'); | 434 | g_oCacic.writeDebugLog('ExecutaCACIC: Cookie Bloqueado pelo Agente Principal ENCONTRADO - CACIC em Execução!'); |
435 | 435 | ||
436 | - // Execução do MAPA. | ||
437 | - if ((g_oCacic.getValueFromFile('Configs', 'modulo_patr', | ||
438 | - g_oCacic.getLocalFolderName + 'GerCols.inf') = 'S') and | ||
439 | - (g_oCacic.getValueFromFile('Configs', 'col_patr_exe', | ||
440 | - g_oCacic.getLocalFolderName + 'GerCols.inf') <> 's')) then | ||
441 | - begin | ||
442 | - g_oCacic.createOneProcess(g_oCacic.getLocalFolderName + 'Modules\mapacacic.exe',false,SW_NORMAL); | ||
443 | - end; | ||
444 | - | ||
445 | g_oCacic.writeDebugLog('ExecutaCACIC: Verificando existência de nova versão deste serviço para atualização.'); | 436 | g_oCacic.writeDebugLog('ExecutaCACIC: Verificando existência de nova versão deste serviço para atualização.'); |
446 | // Verifico a existência de nova versão do serviço e finalizo em caso positivo... | 437 | // Verifico a existência de nova versão do serviço e finalizo em caso positivo... |
447 | if (FileExists(g_oCacic.getLocalFolderName + 'Temp\cacicservice.exe')) and | 438 | if (FileExists(g_oCacic.getLocalFolderName + 'Temp\cacicservice.exe')) and |
cacicservice/cacicservice.dproj
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | <Borland.Personality>Delphi.Personality</Borland.Personality> | 37 | <Borland.Personality>Delphi.Personality</Borland.Personality> |
38 | <Borland.ProjectType>VCLApplication</Borland.ProjectType> | 38 | <Borland.ProjectType>VCLApplication</Borland.ProjectType> |
39 | <BorlandProject> | 39 | <BorlandProject> |
40 | -<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Language><Language Name="RootDir">E:\NTService\</Language></Language><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">2</VersionInfo><VersionInfo Name="MinorVer">8</VersionInfo><VersionInfo Name="Release">1</VersionInfo><VersionInfo Name="Build">6</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1046</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Dataprev - Emp. de TI da Prev Social - URES/SESS</VersionInfoKeys><VersionInfoKeys Name="FileDescription">Sistema CACIC - Módulo para Sustentação do Agente Principal</VersionInfoKeys><VersionInfoKeys Name="FileVersion">2.8.1.6</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">3.0</VersionInfoKeys><VersionInfoKeys Name="Comments">Licença: GNU/LGPL</VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">cacicservice.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject> | 40 | +<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><Language><Language Name="RootDir">E:\NTService\</Language></Language><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">2</VersionInfo><VersionInfo Name="MinorVer">8</VersionInfo><VersionInfo Name="Release">1</VersionInfo><VersionInfo Name="Build">7</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1046</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Dataprev - Emp. de TI da Prev Social - URES/SESS</VersionInfoKeys><VersionInfoKeys Name="FileDescription">Sistema CACIC - Módulo para Sustentação do Agente Principal</VersionInfoKeys><VersionInfoKeys Name="FileVersion">2.8.1.7</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">3.0</VersionInfoKeys><VersionInfoKeys Name="Comments">Licença: GNU/LGPL</VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">cacicservice.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject> |
41 | </ProjectExtensions> | 41 | </ProjectExtensions> |
42 | <Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> | 42 | <Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> |
43 | <ItemGroup> | 43 | <ItemGroup> |
cacicservice/cacicservice.res
No preview for this file type
gercols/gercols.dpr
@@ -247,7 +247,7 @@ Begin | @@ -247,7 +247,7 @@ Begin | ||
247 | 247 | ||
248 | if (objCacic.getValueFromTags('WebManagerAddress', strRetorno,'<>') <> '') then | 248 | if (objCacic.getValueFromTags('WebManagerAddress', strRetorno,'<>') <> '') then |
249 | Begin | 249 | Begin |
250 | - strForcaColeta = objCacic.getValueFromTags('ForcaColeta', strRetorno, '<>'); | 250 | + strForcaColeta := objCacic.getValueFromTags('ForcaColeta', strRetorno, '<>'); |
251 | // if strForcaColeta <> 'S' then | 251 | // if strForcaColeta <> 'S' then |
252 | // objCacic.setValueToFile('Configs','col_patr_exe', | 252 | // objCacic.setValueToFile('Configs','col_patr_exe', |
253 | // 'n', | 253 | // 'n', |
@@ -850,6 +850,7 @@ Begin | @@ -850,6 +850,7 @@ Begin | ||
850 | else if FindCmdLineSwitch ('getTest', True) then | 850 | else if FindCmdLineSwitch ('getTest', True) then |
851 | begin | 851 | begin |
852 | getTest(); | 852 | getTest(); |
853 | + Finalizar(false); | ||
853 | end; | 854 | end; |
854 | 855 | ||
855 | // Chamada efetuada pelo Agente Principal quando da existência de temp\<AgentePrincipal>.exe para AutoUpdate | 856 | // Chamada efetuada pelo Agente Principal quando da existência de temp\<AgentePrincipal>.exe para AutoUpdate |
@@ -925,7 +926,7 @@ Begin | @@ -925,7 +926,7 @@ Begin | ||
925 | intTotalExecutedCollects := 0; | 926 | intTotalExecutedCollects := 0; |
926 | intTotalSendedCollects := 0; | 927 | intTotalSendedCollects := 0; |
927 | 928 | ||
928 | - //getConfigs(true); | 929 | + getConfigs(true); |
929 | 930 | ||
930 | // Abaixo eu testo se existe um endereço configurado para não disparar os procedimentos de coleta em vão. | 931 | // Abaixo eu testo se existe um endereço configurado para não disparar os procedimentos de coleta em vão. |
931 | if (objCacic.getWebManagerAddress <> '') then | 932 | if (objCacic.getWebManagerAddress <> '') then |
installcacic/installcacic.dproj
@@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
32 | <Borland.Personality>Delphi.Personality</Borland.Personality> | 32 | <Borland.Personality>Delphi.Personality</Borland.Personality> |
33 | <Borland.ProjectType>VCLApplication</Borland.ProjectType> | 33 | <Borland.ProjectType>VCLApplication</Borland.ProjectType> |
34 | <BorlandProject> | 34 | <BorlandProject> |
35 | -<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">2</VersionInfo><VersionInfo Name="MinorVer">8</VersionInfo><VersionInfo Name="Release">1</VersionInfo><VersionInfo Name="Build">6</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1046</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Dataprev - Emp. de TI da Prev Social - URES/SESS</VersionInfoKeys><VersionInfoKeys Name="FileDescription">Sistema CACIC - Módulo para Verificação e Instalação de Estrutura Básica do Sistema CACIC</VersionInfoKeys><VersionInfoKeys Name="FileVersion">2.8.1.6</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">3.0</VersionInfoKeys><VersionInfoKeys Name="Comments">Licença: GNU/LGPL</VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">installcacic.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject> | 35 | +<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">2</VersionInfo><VersionInfo Name="MinorVer">8</VersionInfo><VersionInfo Name="Release">1</VersionInfo><VersionInfo Name="Build">8</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">1046</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName">Dataprev - Emp. de TI da Prev Social - URES/SESS</VersionInfoKeys><VersionInfoKeys Name="FileDescription">Sistema CACIC - Módulo para Verificação e Instalação de Estrutura Básica do Sistema CACIC</VersionInfoKeys><VersionInfoKeys Name="FileVersion">2.8.1.8</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">3.0</VersionInfoKeys><VersionInfoKeys Name="Comments">Licença: GNU/LGPL</VersionInfoKeys></VersionInfoKeys><Source><Source Name="MainSource">installcacic.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject> |
36 | </ProjectExtensions> | 36 | </ProjectExtensions> |
37 | <Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> | 37 | <Import Project="$(MSBuildBinPath)\Borland.Delphi.Targets" /> |
38 | <ItemGroup> | 38 | <ItemGroup> |
installcacic/installcacic.res
No preview for this file type
installcacic/uInstallCACIC.pas
@@ -111,7 +111,6 @@ type | @@ -111,7 +111,6 @@ type | ||
111 | function boolCanRunCACIC : boolean; | 111 | function boolCanRunCACIC : boolean; |
112 | function findWindowByTitle(pStrWindowTitle: string) : Hwnd; | 112 | function findWindowByTitle(pStrWindowTitle: string) : Hwnd; |
113 | function listFileDir(pStrPath: string) : string; | 113 | function listFileDir(pStrPath: string) : string; |
114 | - function serviceGetStatus(sMachine, sService: PChar) : DWORD; | ||
115 | function serviceStart(pStrServiceName : string ) : boolean; | 114 | function serviceStart(pStrServiceName : string ) : boolean; |
116 | function serviceRunning(pCharMachineName, pCharServiceName: PChar) : boolean; | 115 | function serviceRunning(pCharMachineName, pCharServiceName: PChar) : boolean; |
117 | function serviceStopped(pCharMachineName, pCharServiceName: PChar) : boolean; | 116 | function serviceStopped(pCharMachineName, pCharServiceName: PChar) : boolean; |
@@ -135,6 +134,8 @@ implementation | @@ -135,6 +134,8 @@ implementation | ||
135 | {$R *.dfm} | 134 | {$R *.dfm} |
136 | 135 | ||
137 | procedure TfrmInstallCACIC.FormCreate(Sender: TObject); | 136 | procedure TfrmInstallCACIC.FormCreate(Sender: TObject); |
137 | +var | ||
138 | +wordServiceStatus, serviceType : DWord; | ||
138 | begin | 139 | begin |
139 | Try | 140 | Try |
140 | boolShowForm := true; | 141 | boolShowForm := true; |
@@ -200,49 +201,6 @@ begin | @@ -200,49 +201,6 @@ begin | ||
200 | End; | 201 | End; |
201 | end; | 202 | end; |
202 | 203 | ||
203 | -function TfrmInstallCACIC.ServiceGetStatus(sMachine, sService: PChar): DWORD; | ||
204 | - {*******************************************} | ||
205 | - {*** Parameters: ***} | ||
206 | - {*** sService: specifies the name of the service to open | ||
207 | - {*** sMachine: specifies the name of the target computer | ||
208 | - {*** ***} | ||
209 | - {*** Return Values: ***} | ||
210 | - {*** -1 = Error opening service ***} | ||
211 | - {*** 1 = SERVICE_STOPPED ***} | ||
212 | - {*** 2 = SERVICE_START_PENDING ***} | ||
213 | - {*** 3 = SERVICE_STOP_PENDING ***} | ||
214 | - {*** 4 = SERVICE_RUNNING ***} | ||
215 | - {*** 5 = SERVICE_CONTINUE_PENDING ***} | ||
216 | - {*** 6 = SERVICE_PAUSE_PENDING ***} | ||
217 | - {*** 7 = SERVICE_PAUSED ***} | ||
218 | - {******************************************} | ||
219 | -var | ||
220 | - SCManHandle, SvcHandle: SC_Handle; | ||
221 | - SS: TServiceStatus; | ||
222 | - dwStat: DWORD; | ||
223 | -begin | ||
224 | - dwStat := 0; | ||
225 | - // Open service manager handle. | ||
226 | - objCacic.writeDebugLog('ServiceGetStatus: Executando OpenSCManager.SC_MANAGER_CONNECT'); | ||
227 | - SCManHandle := OpenSCManager(sMachine, nil, SC_MANAGER_CONNECT); | ||
228 | - if (SCManHandle > 0) then | ||
229 | - begin | ||
230 | - objCacic.writeDebugLog('ServiceGetStatus: Executando OpenService.SERVICE_QUERY_STATUS'); | ||
231 | - SvcHandle := OpenService(SCManHandle, sService, SERVICE_QUERY_STATUS); | ||
232 | - // if Service installed | ||
233 | - if (SvcHandle > 0) then | ||
234 | - begin | ||
235 | - objCacic.writeDebugLog('ServiceGetStatus: O serviço "'+ sService +'" já está instalado.'); | ||
236 | - // SS structure holds the service status (TServiceStatus); | ||
237 | - if (QueryServiceStatus(SvcHandle, SS)) then | ||
238 | - dwStat := ss.dwCurrentState; | ||
239 | - CloseServiceHandle(SvcHandle); | ||
240 | - end; | ||
241 | - CloseServiceHandle(SCManHandle); | ||
242 | - end; | ||
243 | - Result := dwStat; | ||
244 | -end; | ||
245 | - | ||
246 | // start service | 204 | // start service |
247 | // | 205 | // |
248 | // return TRUE if successful | 206 | // return TRUE if successful |
@@ -393,7 +351,7 @@ Begin | @@ -393,7 +351,7 @@ Begin | ||
393 | End; | 351 | End; |
394 | 352 | ||
395 | procedure TfrmInstallCACIC.installCACIC; | 353 | procedure TfrmInstallCACIC.installCACIC; |
396 | -var wordServiceStatus : DWORD; | 354 | +var wordServiceStatus, serviceType : cardinal; |
397 | tstrRequest_ConfigIC : TStringList; | 355 | tstrRequest_ConfigIC : TStringList; |
398 | strAuxInstallCACIC : String; | 356 | strAuxInstallCACIC : String; |
399 | begin | 357 | begin |
@@ -717,7 +675,11 @@ begin | @@ -717,7 +675,11 @@ begin | ||
717 | objCacic, | 675 | objCacic, |
718 | strChkSisInfFileName); | 676 | strChkSisInfFileName); |
719 | 677 | ||
720 | - objCacic.setValueToFile('Installation','chkSIS.exe', objCacic.checkModule(objCacic.getWinDir + 'chksis.exe', objCACIC.deCrypt( objCacic.getValueFromTags('CHKSIS.EXE_HASH', strCommResponse,'<>'),false,true)), strChkSisInfFileName); | 678 | + objCacic.setValueToFile('Installation','chkSIS.exe', |
679 | + objCacic.checkModule(objCacic.getWinDir + 'chksis.exe', | ||
680 | + objCACIC.deCrypt( objCacic.getValueFromTags | ||
681 | + ('CHKSIS.EXE_HASH', strCommResponse,'<>'), | ||
682 | + false,true)), strChkSisInfFileName); | ||
721 | 683 | ||
722 | // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor | 684 | // Caso o Cacic tenha sido baixado executo-o com parâmetro de configuração de servidor |
723 | if (objCacic.getValueFromFile('Installation','CacicService.exe' , strChkSisInfFileName) = 'Ok!') and | 685 | if (objCacic.getValueFromFile('Installation','CacicService.exe' , strChkSisInfFileName) = 'Ok!') and |
@@ -739,8 +701,7 @@ begin | @@ -739,8 +701,7 @@ begin | ||
739 | ComunicaInsucesso('1'); // O indicador "1" sinalizará que não foi devido a privilégio na estação | 701 | ComunicaInsucesso('1'); // O indicador "1" sinalizará que não foi devido a privilégio na estação |
740 | End; | 702 | End; |
741 | 703 | ||
742 | - if boolCanRunCACIC and | ||
743 | - (objCacic.getValueFromFile('Installation','ChkSIS.exe', strChkSisInfFileName) = 'Ok!') then | 704 | + if (objCacic.getValueFromFile('Installation','ChkSIS.exe', strChkSisInfFileName) = 'Ok!') then |
744 | Begin | 705 | Begin |
745 | // Se não for plataforma NT executo o agente principal | 706 | // Se não for plataforma NT executo o agente principal |
746 | if not (objCacic.isWindowsNTPlataform()) then | 707 | if not (objCacic.isWindowsNTPlataform()) then |
@@ -761,8 +722,18 @@ begin | @@ -761,8 +722,18 @@ begin | ||
761 | {*** 6 = SERVICE_PAUSE_PENDING ***} | 722 | {*** 6 = SERVICE_PAUSE_PENDING ***} |
762 | {*** 7 = SERVICE_PAUSED ***} | 723 | {*** 7 = SERVICE_PAUSED ***} |
763 | 724 | ||
725 | + informaProgresso('Verificando CACICservice.'); | ||
764 | // Verifico se o serviço está instalado/rodando,etc. | 726 | // Verifico se o serviço está instalado/rodando,etc. |
765 | - wordServiceStatus := ServiceGetStatus(nil,'CacicSustainService'); | 727 | + wordServiceStatus := objCacic.ServiceGetStatus(nil,'CacicSustainService'); |
728 | + | ||
729 | + //Verifico o serviço para correção de bug | ||
730 | + if wordServiceStatus <> 0 then | ||
731 | + begin | ||
732 | + //verifica o status, se não estiver correto altera | ||
733 | + serviceType := objCacic.serviceGetType('', 'CacicSustainService'); | ||
734 | + end; | ||
735 | + | ||
736 | + | ||
766 | if (wordServiceStatus = 0) then | 737 | if (wordServiceStatus = 0) then |
767 | Begin | 738 | Begin |
768 | // Instalo e Habilito o serviço | 739 | // Instalo e Habilito o serviço |
@@ -788,8 +759,10 @@ begin | @@ -788,8 +759,10 @@ begin | ||
788 | MessageDLG(#13#10+'ATENÇÃO!'+#13#10+#13#10+'Se o ícone do CACIC não for exibido na bandeja do sistema, é recomendável a reinicialização da máquina.',mtInformation,[mbOK],0); | 759 | MessageDLG(#13#10+'ATENÇÃO!'+#13#10+#13#10+'Se o ícone do CACIC não for exibido na bandeja do sistema, é recomendável a reinicialização da máquina.',mtInformation,[mbOK],0); |
789 | informaProgresso('Executando o Agente Principal do CACIC.'); | 760 | informaProgresso('Executando o Agente Principal do CACIC.'); |
790 | End; | 761 | End; |
791 | - | ||
792 | - objCacic.createOneProcess(objCacic.getLocalFolderName + objCACIC.getMainProgramName, false); | 762 | + |
763 | + if boolCanRunCACIC then | ||
764 | + objCacic.createOneProcess(objCacic.getLocalFolderName + objCACIC.getMainProgramName, false); | ||
765 | + | ||
793 | End | 766 | End |
794 | else | 767 | else |
795 | if FileExists(objCacic.getLocalFolderName + 'aguarde_CACIC.txt') then | 768 | if FileExists(objCacic.getLocalFolderName + 'aguarde_CACIC.txt') then |
@@ -823,12 +796,12 @@ end; | @@ -823,12 +796,12 @@ end; | ||
823 | 796 | ||
824 | function TfrmInstallCACIC.serviceRunning(pCharMachineName, pCharServiceName: PChar): Boolean; | 797 | function TfrmInstallCACIC.serviceRunning(pCharMachineName, pCharServiceName: PChar): Boolean; |
825 | begin | 798 | begin |
826 | - Result := SERVICE_RUNNING = ServiceGetStatus(pCharMachineName, pCharServiceName); | 799 | + Result := SERVICE_RUNNING = objCacic.ServiceGetStatus(pCharMachineName, pCharServiceName); |
827 | end; | 800 | end; |
828 | 801 | ||
829 | function TfrmInstallCACIC.serviceStopped(pCharMachineName, pCharServiceName: PChar): Boolean; | 802 | function TfrmInstallCACIC.serviceStopped(pCharMachineName, pCharServiceName: PChar): Boolean; |
830 | begin | 803 | begin |
831 | - Result := SERVICE_STOPPED = ServiceGetStatus(pCharMachineName, pCharServiceName); | 804 | + Result := SERVICE_STOPPED = objCacic.ServiceGetStatus(pCharMachineName, pCharServiceName); |
832 | end; | 805 | end; |
833 | 806 | ||
834 | function TfrmInstallCACIC.findWindowByTitle(pStrWindowTitle: string): Hwnd; | 807 | function TfrmInstallCACIC.findWindowByTitle(pStrWindowTitle: string): Hwnd; |
main.pas
@@ -73,6 +73,7 @@ var strConfigsPatrimonio, | @@ -73,6 +73,7 @@ var strConfigsPatrimonio, | ||
73 | g_intStatus, | 73 | g_intStatus, |
74 | g_intStatusAnterior, | 74 | g_intStatusAnterior, |
75 | g_intIconIndex : integer; | 75 | g_intIconIndex : integer; |
76 | + bl_primeira_execucao : bool = false; | ||
76 | objCACIC: TCACIC; | 77 | objCACIC: TCACIC; |
77 | 78 | ||
78 | type | 79 | type |
@@ -961,8 +962,12 @@ Begin | @@ -961,8 +962,12 @@ Begin | ||
961 | Result := not (FileExists(objCACIC.getLocalFolderName + 'aguarde_CACIC.txt')); | 962 | Result := not (FileExists(objCACIC.getLocalFolderName + 'aguarde_CACIC.txt')); |
962 | End; | 963 | End; |
963 | 964 | ||
965 | + | ||
966 | + | ||
964 | procedure TFormularioGeral.FormCreate(Sender: TObject); | 967 | procedure TFormularioGeral.FormCreate(Sender: TObject); |
965 | var textFileAguarde : TextFile; | 968 | var textFileAguarde : TextFile; |
969 | + serviceType, wordServiceStatus : Cardinal; | ||
970 | + service_start : bool; | ||
966 | begin | 971 | begin |
967 | objCACIC := TCACIC.Create; | 972 | objCACIC := TCACIC.Create; |
968 | objCACIC.setLocalFolderName(ExtractFilePath(ParamStr(0))); | 973 | objCACIC.setLocalFolderName(ExtractFilePath(ParamStr(0))); |
@@ -972,6 +977,8 @@ begin | @@ -972,6 +977,8 @@ begin | ||
972 | strGerColsInfFileName := objCACIC.getLocalFolderName + 'gercols.inf'; | 977 | strGerColsInfFileName := objCACIC.getLocalFolderName + 'gercols.inf'; |
973 | strChkSisInfFileName := objCACIC.getWinDir + 'chksis.inf'; | 978 | strChkSisInfFileName := objCACIC.getWinDir + 'chksis.inf'; |
974 | 979 | ||
980 | + bl_primeira_execucao := true; | ||
981 | + | ||
975 | // A verificação dupla é uma solução de contorno para o caso de o boolCipher ter sido setado após criptografia/deCriptografia do dado gravado | 982 | // A verificação dupla é uma solução de contorno para o caso de o boolCipher ter sido setado após criptografia/deCriptografia do dado gravado |
976 | if (objCACIC.deCrypt( objCACIC.getValueFromFile('Hash-Codes',objCACIC.getMainProgramName,strChkSisInfFileName),false,true) = objCACIC.getFileHash(ParamStr(0))) then | 983 | if (objCACIC.deCrypt( objCACIC.getValueFromFile('Hash-Codes',objCACIC.getMainProgramName,strChkSisInfFileName),false,true) = objCACIC.getFileHash(ParamStr(0))) then |
977 | Begin | 984 | Begin |
@@ -988,6 +995,44 @@ begin | @@ -988,6 +995,44 @@ begin | ||
988 | strWin32_NetworkAdapterConfiguration := fetchWMIvalues('Win32_NetworkAdapterConfiguration', objCACIC.getLocalFolderName); | 995 | strWin32_NetworkAdapterConfiguration := fetchWMIvalues('Win32_NetworkAdapterConfiguration', objCACIC.getLocalFolderName); |
989 | strWin32_ComputerSystem := fetchWMIvalues('Win32_ComputerSystem', objCACIC.getLocalFolderName); | 996 | strWin32_ComputerSystem := fetchWMIvalues('Win32_ComputerSystem', objCACIC.getLocalFolderName); |
990 | 997 | ||
998 | + //Correção do bug do script net logon da pgfn; | ||
999 | + //O script estava instalando o cacic sem interação com desktop, | ||
1000 | + //bugando o mapa e o trayicon. | ||
1001 | + | ||
1002 | + {*** 1 = SERVICE_STOPPED ***} | ||
1003 | + {*** 2 = SERVICE_START_PENDING ***} | ||
1004 | + {*** 3 = SERVICE_STOP_PENDING ***} | ||
1005 | + {*** 4 = SERVICE_RUNNING ***} | ||
1006 | + {*** 5 = SERVICE_CONTINUE_PENDING ***} | ||
1007 | + {*** 6 = SERVICE_PAUSE_PENDING ***} | ||
1008 | + {*** 7 = SERVICE_PAUSED ***} | ||
1009 | + | ||
1010 | + // Verifico se o serviço está instalado/rodando,etc. | ||
1011 | + wordServiceStatus := objCacic.ServiceGetStatus(nil,'CacicSustainService'); | ||
1012 | + | ||
1013 | + //Verifico o serviço para correção de bug | ||
1014 | + // Verifico se o serviço está instalado/rodando,etc. | ||
1015 | + | ||
1016 | + if wordServiceStatus <> 0 then | ||
1017 | + begin | ||
1018 | + //verifica o status, se não estiver correto altera | ||
1019 | + serviceType := objCacic.serviceGetType('', 'CacicSustainService'); | ||
1020 | + end; | ||
1021 | + | ||
1022 | + if (wordServiceStatus = 0) then | ||
1023 | + Begin | ||
1024 | + // Instalo e Habilito o serviço | ||
1025 | + objCacic.createOneProcess(objCacic.getWinDir + 'cacicservice.exe /install /silent',true); | ||
1026 | + End | ||
1027 | + else if (wordServiceStatus < 4) then | ||
1028 | + Begin | ||
1029 | + objCacic.createOneProcess(objCacic.getWinDir + 'cacicservice.exe -start', true); | ||
1030 | + End | ||
1031 | + else if (wordServiceStatus > 4) then | ||
1032 | + Begin | ||
1033 | + objCacic.createOneProcess(objCacic.getWinDir + 'cacicservice.exe -continue', true); | ||
1034 | + End; | ||
1035 | + | ||
991 | TrayIcon1 := TTrayIcon.Create(self); | 1036 | TrayIcon1 := TTrayIcon.Create(self); |
992 | TrayIcon1.Hint := pnVersao.Caption; | 1037 | TrayIcon1.Hint := pnVersao.Caption; |
993 | if not (objCACIC.getValueFromTags('IPAddress',strWin32_NetworkAdapterConfiguration) = '') then | 1038 | if not (objCACIC.getValueFromTags('IPAddress',strWin32_NetworkAdapterConfiguration) = '') then |
@@ -1257,7 +1302,7 @@ begin | @@ -1257,7 +1302,7 @@ begin | ||
1257 | if ((p_acao = 'getTest') or (p_acao = 'getConfigs')) then //se for getTest, esperar a aplicação finalizar. | 1302 | if ((p_acao = 'getTest') or (p_acao = 'getConfigs')) then //se for getTest, esperar a aplicação finalizar. |
1258 | objCACIC.createOneProcess(objCACIC.getLocalFolderName + 'Modules\gercols.exe /'+p_acao+' /WebServicesFolderName='+objCACIC.getWebServicesFolderName +' /LocalFolderName='+objCACIC.getLocalFolderName + ' /WebManagerAddress=' + objCACIC.getWebManagerAddress + ' /MainProgramName=' + objCACIC.getMainProgramName + ' /MainProgramHash=' + objCACIC.getMainProgramHash,true,SW_HIDE) | 1303 | objCACIC.createOneProcess(objCACIC.getLocalFolderName + 'Modules\gercols.exe /'+p_acao+' /WebServicesFolderName='+objCACIC.getWebServicesFolderName +' /LocalFolderName='+objCACIC.getLocalFolderName + ' /WebManagerAddress=' + objCACIC.getWebManagerAddress + ' /MainProgramName=' + objCACIC.getMainProgramName + ' /MainProgramHash=' + objCACIC.getMainProgramHash,true,SW_HIDE) |
1259 | else | 1304 | else |
1260 | - objCACIC.createOneProcess(objCACIC.getLocalFolderName + 'Modules\gercols.exe /'+p_acao+' /WebServicesFolderName='+objCACIC.getWebServicesFolderName +' /LocalFolderName='+objCACIC.getLocalFolderName + ' /WebManagerAddress=' + objCACIC.getWebManagerAddress + ' /MainProgramName=' + objCACIC.getMainProgramName + ' /MainProgramHash=' + objCACIC.getMainProgramHash,false,SW_HIDE); | 1305 | + objCACIC.createOneProcess(objCACIC.getLocalFolderName + 'Modules\gercols.exe /'+p_acao+' /WebServicesFolderName='+objCACIC.getWebServicesFolderName +' /LocalFolderName='+objCACIC.getLocalFolderName + ' /WebManagerAddress=' + objCACIC.getWebManagerAddress + ' /MainProgramName=' + objCACIC.getMainProgramName + ' /MainProgramHash=' + objCACIC.getMainProgramHash,true,SW_HIDE); |
1261 | g_intStatus := 1; | 1306 | g_intStatus := 1; |
1262 | objCacic.setBoolCipher(not objCacic.isInDebugMode); | 1307 | objCacic.setBoolCipher(not objCacic.isInDebugMode); |
1263 | End | 1308 | End |
@@ -1290,7 +1335,7 @@ begin | @@ -1290,7 +1335,7 @@ begin | ||
1290 | objCacic.writeDailyLog('Invoca_MapaCacic: Criando processo mapa.'); | 1335 | objCacic.writeDailyLog('Invoca_MapaCacic: Criando processo mapa.'); |
1291 | objCACIC.writeDebugLog('Invoca_MapaCacic: Criando Processo Mapa => "'+objCACIC.getLocalFolderName + 'Modules\MapaCACIC.exe'); | 1336 | objCACIC.writeDebugLog('Invoca_MapaCacic: Criando Processo Mapa => "'+objCACIC.getLocalFolderName + 'Modules\MapaCACIC.exe'); |
1292 | sleep(10000); //Pausa para dar tempo de realizar o login na máquina, senão o usuário fica em branco. | 1337 | sleep(10000); //Pausa para dar tempo de realizar o login na máquina, senão o usuário fica em branco. |
1293 | - if (objCACIC.createOneProcess(objCACIC.getLocalFolderName + 'Modules\mapacacic.exe',false,SW_NORMAL)) then | 1338 | + if (objCACIC.createOneProcess(objCACIC.getLocalFolderName + 'Modules\mapacacic.exe',false,SW_SHOW)) then |
1294 | objCacic.writeDailyLog('Invoca_MapaCacic: Processo criado.') | 1339 | objCacic.writeDailyLog('Invoca_MapaCacic: Processo criado.') |
1295 | else | 1340 | else |
1296 | objCacic.writeDailyLog('Invoca_MapaCacic: Falha ao criar processo.'); | 1341 | objCacic.writeDailyLog('Invoca_MapaCacic: Falha ao criar processo.'); |
@@ -1327,11 +1372,13 @@ end; | @@ -1327,11 +1372,13 @@ end; | ||
1327 | procedure TFormularioGeral.ExecutaCACIC(Sender: TObject); | 1372 | procedure TFormularioGeral.ExecutaCACIC(Sender: TObject); |
1328 | var v_mensagem, | 1373 | var v_mensagem, |
1329 | v_tipo_mensagem, | 1374 | v_tipo_mensagem, |
1375 | + primeira_execucao, | ||
1330 | v_TE_FILA_FTP : string; | 1376 | v_TE_FILA_FTP : string; |
1331 | v_MsgDlgType : TMsgDlgType; | 1377 | v_MsgDlgType : TMsgDlgType; |
1332 | intTentativas : integer; | 1378 | intTentativas : integer; |
1333 | begin | 1379 | begin |
1334 | try | 1380 | try |
1381 | + primeira_execucao := FormatDateTime('yyyymmdd', Now); | ||
1335 | 1382 | ||
1336 | if FindCmdLineSwitch('execute', True) or | 1383 | if FindCmdLineSwitch('execute', True) or |
1337 | FindCmdLineSwitch('atualizacao', True) or | 1384 | FindCmdLineSwitch('atualizacao', True) or |
@@ -1374,9 +1421,14 @@ begin | @@ -1374,9 +1421,14 @@ begin | ||
1374 | //////////////////////////////////////////////////////////////////////////////// | 1421 | //////////////////////////////////////////////////////////////////////////////// |
1375 | // CRIADO PARA TESTAR A CHAMADA DO MAPA CACIC // | 1422 | // CRIADO PARA TESTAR A CHAMADA DO MAPA CACIC // |
1376 | //////////////////////////////////////////////////////////////////////////////// | 1423 | //////////////////////////////////////////////////////////////////////////////// |
1377 | - if (trim(objCACIC.getValueFromFile('Configs','col_patr_exe', strGerColsInfFileName))<>'s') | 1424 | + if not FindCmdLineSwitch('atualizacao', True) and |
1425 | + (trim(objCACIC.getValueFromFile('Configs','col_patr_exe', strGerColsInfFileName))<>'s') | ||
1378 | and not (FileExists(objCacic.getLocalFolderName + 'Temp\aguarde_MAPACACIC.txt')) | 1426 | and not (FileExists(objCacic.getLocalFolderName + 'Temp\aguarde_MAPACACIC.txt')) |
1379 | - and (objCACIC.getValueFromFile('Configs', 'modulo_patr', strGerColsInfFileName) = 'S') then begin | 1427 | + and (objCACIC.getValueFromFile('Configs', 'modulo_patr', strGerColsInfFileName) = 'S') |
1428 | + and ((objCACIC.getValueFromFile('Configs','primeira_execucao', | ||
1429 | + objCacic.getLocalFolderName + 'cacic280.inf') <> | ||
1430 | + primeira_execucao) and bl_primeira_execucao) then | ||
1431 | + begin | ||
1380 | objCACIC.writeDebugLog('ExecutaCACIC: Executa chamada ao Mapa Cacic...'); | 1432 | objCACIC.writeDebugLog('ExecutaCACIC: Executa chamada ao Mapa Cacic...'); |
1381 | Invoca_MapaCacic; | 1433 | Invoca_MapaCacic; |
1382 | end; | 1434 | end; |
@@ -1481,6 +1533,9 @@ begin | @@ -1481,6 +1533,9 @@ begin | ||
1481 | objCACIC.writeExceptionLog(E.Message,E.ClassName,'PROBLEMAS AO TENTAR ATIVAR COLETAS.'); | 1533 | objCACIC.writeExceptionLog(E.Message,E.ClassName,'PROBLEMAS AO TENTAR ATIVAR COLETAS.'); |
1482 | end; | 1534 | end; |
1483 | objCACIC.writeDebugLog('ExecutaCACIC: ' + DupeString('=',100)); | 1535 | objCACIC.writeDebugLog('ExecutaCACIC: ' + DupeString('=',100)); |
1536 | + objCacic.setValueToFile('Configs','primeira_execucao', primeira_execucao, | ||
1537 | + objCacic.getLocalFolderName + 'cacic280.inf'); | ||
1538 | + bl_primeira_execucao := false; | ||
1484 | end; | 1539 | end; |
1485 | 1540 | ||
1486 | procedure TFormularioGeral.ExecutarMapa1DrawItem(Sender: TObject; | 1541 | procedure TFormularioGeral.ExecutarMapa1DrawItem(Sender: TObject; |