#include "CabeceraGlobal.h"
void lvddesmarcarpadre(TCHAR *rutahijo);
//void ddcerasefolder(TCHAR rutadir[], BOOL erasethisfolder);
BOOL he1extraeratemp(TCHAR *rutazip, TCHAR *subruta, BOOL *error);
void he1borrarantiguos(INT nivel);
void hd1crearfichconnombre(INT nivel, TCHAR * cadena);
//void ddcerasefile(TCHAR ruta[]);
//void ddcerasefolder(TCHAR rutadir[], BOOL erasethisfolder);
void he1renombarextraido(INT nivel);
void he1getcrcextraido(TCHAR * rutaficheroextraido, TCHAR * nombrefileextraido, UINT *crcextraido, UINT);
UINT getFileCrc(TCHAR *nombreArchivo, BOOL *hayerror, UCHAR *buffer);
void he1getnombreextraido(INT nivel, TCHAR * nombrefileextraido);
void olfeOrdenarListaDeArchivos(LPLISTADATOSELIMINAR lde);
BOOL zfEsComprimido(TCHAR *solonombrefile);
BOOL he1estaextraido(TCHAR *rutaficticia, INT nivel);
BOOL he1extraerfichero(TCHAR *rutazip, TCHAR *subruta, BOOL *bien, UINT *crc,
TCHAR * nombrefileextraido, TCHAR * rutaficheroextraido, BOOL *error, INT nivelzip, INT, UINT);
void he1obtenerzip(TCHAR *ruta, INT nivelzip, TCHAR * rutazip, BOOL *bien);
void he1obtenersubruta(TCHAR *ruta, INT nivelsubruta, TCHAR * subruta, BOOL *bien);
BOOL he1comprobarfichero(TCHAR *ruta, TCHAR *nombrefile, UINT crcfile, INT);
//void he1creardirtemporal(void);
static void marcarparacomprobar(void);
static LISTADATOSELIMINAR lde;
static TCHAR dirtemporal[MIMAXPATH];
static LPDATOSELIMINAR pdateli;
void HiloEliminar1(LPDATOSELIMINAR pde)
{
INT x, y, z;
TCHAR cadena[MIMAXPATH];
BOOL ret;
//BOOL redibujar = FALSE;
DWORD atr;
if(pde->datpro->comprobardentrozip != TRUE)
return;
//TCHAR dirtemporal[MIMAXPATH];
/*
GetTempPath(MIMAXPATH - 1, dirtemporal);
_tcscat(dirtemporal, TEXT(SZMITEMPDIR));
if(dirtemporal[_tcslen(dirtemporal) - 1] == TEXT('\\'))
dirtemporal[_tcslen(dirtemporal) - 1] = TEXT('\0');
if(GetFileAttributes(dirtemporal) != INVALID_FILE_ATTRIBUTES)
ddcerasefolder(dirtemporal, TRUE);
*/
if(pde->datpro->filelist.numelem == 0)
return;
pdateli = pde;
pde->redibujar = FALSE;
lde.numficheros = pde->datpro->filelist.numelem;
lde.ppficherolista = (LPFICHEROLISTA **) Mimalloc(lde.numficheros * sizeof(LPFICHEROLISTA **));
//if(lde.ppficherolista == NULL)
// MostrarError(ecErrorDeMemoria, TEXT(__FILE__), __LINE__);
for(x = 0; x < lde.numficheros; x++)
{
lde.ppficherolista[x] = &(pde->datpro->filelist.elementos[x]);
}
marcarparacomprobar();
olfeOrdenarListaDeArchivos(&lde);
Miwcscpy(dirtemporal, (WCHAR*) SZMITEMPDIR);
MiCrearDirTemporal(dirtemporal);
//he1creardirtemporal();
for(x = 0; x < lde.numficheros; x++)
{
if(WaitForSingleObject(*pde->evento, 0) == WAIT_OBJECT_0)
{
return;
}
if((*(lde.ppficherolista[x]))->sehadecomprobar == TRUE)
{
_tcscpy(cadena, (*(lde.ppficherolista[x]))->ruta);
_tcscat(cadena, (*(lde.ppficherolista[x]))->nombre);
ret = he1comprobarfichero(cadena, (*(lde.ppficherolista[x]))->nombre, (*(lde.ppficherolista[x]))->crc32, 0);
if(ret == FALSE)
{
z = (*(lde.ppficherolista[x]))->numerorepeticion;
for(y = 0; y < lde.numficheros; y++)
{
/* while((y < lde.numficheros) && (pde->datpro->filelist.elementos[y]->numerorepeticion < z))
y += 20;
if(y > lde.numficheros)
y = lde.numficheros - 1;
while(pde->datpro->filelist.elementos[y]->numerorepeticion > z)
--y;
while(pde->datpro->filelist.elementos[y]->numerorepeticion == z)
--y;
++y;
*/
if(pde->datpro->filelist.elementos[y]->numerorepeticion == z)
{
if(pde->datpro->filelist.elementos[y]->marcadoeliminar == TRUE)
{
pde->datpro->filelist.elementos[y]->marcadoeliminar = FALSE;
(pde->datpro->cantmarcadoseliminar)--;
lvddesmarcarpadre(pde->datpro->filelist.elementos[y]->ruta);
pde->redibujar = TRUE;
// MessageBeep(0xffffffff);
}
}
else if((INT) pde->datpro->filelist.elementos[y]->numerorepeticion > z)
{
break;
}
}
}
}
/*if(WaitForSingleObject(*pde->evento, 0) == WAIT_OBJECT_0)
{
return;
}*/
}
/*
FILE *fich;
fich = _tfopen(TEXT("c:\\paisa.txt"), TEXT("wb"));
for(x = 0; x < lde.numficheros; x++)
{
_ftprintf(fich, __TEXT("%s%s - %d\r\n"), (*(lde.ppficherolista[x]))->ruta, (*(lde.ppficherolista[x]))->nombre, x);
}
fclose(fich);
*/
free(lde.ppficherolista);
//if(redibujar == TRUE)
//{
//lvdLlenarLista(pde->datpro);
//lvLlenarLista(pde->datpro);
//}
//_stprintf(cadena, TEXT("%s\\tmp"), dirtemporal);
atr = GetFileAttributes(dirtemporal);
if(atr & FILE_ATTRIBUTE_DIRECTORY)
MiRemoveFolder(dirtemporal, TRUE);
WCHAR * dirAct;
dirAct = (WCHAR *) GlobalAlloc(GMEM_FIXED, (wcslen (L"") + 4) * sizeof(WCHAR));
Miwcscpy(dirAct, (WCHAR*) L"");
PostMessage(pdateli->workWindow, WM_SETAC, (WPARAM) dirAct, 0);
//_tcscpy(pdateli->accion, TEXT(""));
WCHAR * dirAct4;
dirAct4 = (WCHAR *) GlobalAlloc(GMEM_FIXED, (wcslen (L"") + 4) * sizeof(WCHAR));
Miwcscpy(dirAct4, (WCHAR*) L"");
//Miwcscat(dirAct, pdl->nombre);
PostMessage(pdateli->workWindow, WM_SETDIRAC, (WPARAM) dirAct4, 0);
// _tcscpy(pdateli->folder, TEXT(""));
//SendDlgItemMessage(pdateli->ventana, pdateli->etaccion, WM_SETTEXT, 0, (LPARAM) TEXT(""));
//SendDlgItemMessage(pdateli->ventana, pdateli->etfolder, WM_SETTEXT, 0, (LPARAM) TEXT(""));
return;
}
///////////////////////////////////////////////////////////////////
static void marcarparacomprobar(void)
{
INT y;
INT marcados;
INT cual;
INT x;
for(x = 0; x < lde.numficheros; x++)
{
(*(lde.ppficherolista[x]))->sehadecomprobar = FALSE;
}
for(x = 0; x < (INT) lde.numficheros; x++)
{
if((*(lde.ppficherolista[x]))->marcadoeliminar == FALSE)
continue;
marcados = 0;
//x = (*(lde.ppficherolista[lde.numficheros - 1]))->numerorepeticion;
for(y = 0; y < lde.numficheros; y++)
{
if(y == x)
continue;
if(( (*(lde.ppficherolista[x]))->numerorepeticion == (*(lde.ppficherolista[y]))->numerorepeticion) &&
((*(lde.ppficherolista[y]))->marcadoeliminar == FALSE))
{
marcados++;
cual = y;
}
}
if(marcados == 1)
{
if((*(lde.ppficherolista[cual]))->estaencomprimido == TRUE)
{
(*(lde.ppficherolista[cual]))->sehadecomprobar = TRUE;
}
}
}
}
//////////////////////////////////////////////////////////////
BOOL he1comprobarfichero(TCHAR *ruta, TCHAR *nombrefile, UINT crcfile, INT level)
{
TCHAR rutazip[MIMAXPATH];
TCHAR subruta[MIMAXPATH];
INT nivelzip = 1;
INT nivelsubruta = 1;
BOOL bien, error;
UINT crc;
BOOL estaba;
TCHAR nombrefileextraido[MIMAXPATH];
TCHAR rutaficheroextraido[MIMAXPATH];
TCHAR cadena[MIMAXPATH];
while(TRUE)
{
he1obtenerzip(ruta, nivelzip, rutazip, &bien);
if(bien == FALSE)
return FALSE;
he1obtenersubruta(&ruta[_tcslen(rutazip) + 1], nivelsubruta, subruta, &bien);
if(bien == FALSE)
{
nivelsubruta = 1;
++nivelzip;
continue;
}
//level = nivelsubruta;
estaba = he1extraerfichero(rutazip, subruta, &bien, &crc, nombrefileextraido, rutaficheroextraido, &error, nivelzip, level, crcfile);
if(error == TRUE)
return FALSE;
if(bien == FALSE)
{
nivelsubruta++;
continue;
}
if(_tcscmp(nombrefileextraido, nombrefile) == 0)
{
if(crc == crcfile)
return TRUE;
}
_tcscpy(cadena, rutaficheroextraido);
_tcscat(cadena, TEXT("\\"));
//_tcscat(cadena, nombrefileextraido);
//if(estaba == FALSE)
_tcscat(cadena, &ruta[_tcslen(rutazip) + 1 +(_tcslen(subruta) - _tcslen(nombrefileextraido))]);// + 2]);
//else
// _tcscat(cadena, &ruta[_tcslen(rutazip) + 1 + _tcslen(nombrefileextraido)]);
return(he1comprobarfichero(cadena, nombrefile, crcfile, level + 1));
}
}
/////////////////////////////////////////////////////////////////////
void he1obtenersubruta(TCHAR *ruta, INT nivelsubruta, TCHAR * subruta, BOOL *bien)
{
INT y = 1;
TCHAR cadena[MIMAXPATH];
INT x;
_tcscpy(cadena, ruta);
if(y == nivelsubruta)
{
_tcscpy(subruta, ruta);
*bien = TRUE;
return;
}
for(x = (INT) (_tcslen(ruta) - 1); x >= 0; x--)
{
if(cadena[x] == TEXT('\\'))
{
++y;
if(y == nivelsubruta)
break;
}
}
if(x < 0)
{
*bien = FALSE;
return;
}
cadena[x] = TEXT('\0');
_tcscpy(subruta, cadena);
*bien = TRUE;
return;
}
///////////////////////////////////////////////////////////
void he1obtenerzip(TCHAR *ruta, INT nivelzip, TCHAR * rutazip, BOOL *bien)
{
INT niveltemp = 1;
TCHAR cadena[MIMAXPATH];
INT x;
for(x = 0; x < (INT) _tcslen(ruta); x++)
{
if(ruta[x] == TEXT('\\'))
{
_tcscpy(cadena, ruta);
cadena[x] = TEXT('\0');
if(zfEsComprimido(cadena) == TRUE)
{
if(niveltemp == nivelzip)
{
_tcscpy(rutazip, cadena);
*bien = TRUE;
return;
}
else
niveltemp++;
}
}
}
*bien = FALSE;
}
///////////////////////////////////////////////////////////////////////
BOOL he1extraerfichero(TCHAR *rutazip, TCHAR *subruta, BOOL *bien, UINT *crcextraido,
TCHAR * nombrefileextraido, TCHAR * rutaficheroextraido, BOOL *error, INT nivelzip, INT level, UINT crcfile)
{
static TCHAR cadena[MIMAXPATH];
TCHAR cadenabk[MIMAXPATH];
static INT nivel;
if(level == 0)
nivel = 1;
if(nivel == 1)
{
//nivel = nivelzip;
cadenabk[0] = TEXT('\0');
_tcscpy(cadena, rutazip);
_tcscat(cadena, TEXT("\\"));
_tcscat(cadena, subruta);
WCHAR * dirAct;
dirAct = (WCHAR *) Mimalloc((wcslen (IdiomasObtenerTexto(1000060)) + 4) * sizeof(WCHAR));
Miwcscpy(dirAct, IdiomasObtenerTexto(1000060));
PostMessage(pdateli->workWindow, WM_SETAC, (WPARAM) dirAct, 0);
// _tcscpy(pdateli->accion, TEXT(SZCOMPROBANDO));
WCHAR * dirAct3;
dirAct3 = (WCHAR *) Mimalloc((wcslen (cadena) + 4) * sizeof(WCHAR));
Miwcscpy(dirAct3, cadena);
//Miwcscat(dirAct, pdl->nombre);
PostMessage(pdateli->workWindow, WM_SETDIRAC, (WPARAM) dirAct3, 0);
// _tcscpy(pdateli->folder, cadena);
// SendDlgItemMessage(pdateli->ventana, pdateli->etaccion, WM_SETTEXT, 0, (LPARAM) TEXT(SZCOMPROBANDO));
// SendDlgItemMessage(pdateli->ventana, pdateli->etfolder, WM_SETTEXT, 0, (LPARAM) cadena);
}
else
{
_tcscpy(cadenabk, cadena);
_tcscat(cadena, TEXT("\\"));
_tcscat(cadena, subruta);
WCHAR * dirAct;
dirAct = (WCHAR *) Mimalloc((wcslen (IdiomasObtenerTexto(1000060)) + 4) * sizeof(WCHAR));
Miwcscpy(dirAct, IdiomasObtenerTexto(1000060));
PostMessage(pdateli->workWindow, WM_SETAC, (WPARAM) dirAct, 0);
//_tcscpy(pdateli->accion, TEXT(SZCOMPROBANDO));
WCHAR * dirAct2;
dirAct2 = (WCHAR *) Mimalloc((wcslen (cadena) + 4) * sizeof(WCHAR));
Miwcscpy(dirAct2, cadena);
//Miwcscat(dirAct, pdl->nombre);
PostMessage(pdateli->workWindow, WM_SETDIRAC, (WPARAM) dirAct2, 0);
// _tcscpy(pdateli->folder, cadena);
// SendDlgItemMessage(pdateli->ventana, pdateli->etaccion, WM_SETTEXT, 0, (LPARAM) TEXT(SZCOMPROBANDO));
// SendDlgItemMessage(pdateli->ventana, pdateli->etfolder, WM_SETTEXT, 0, (LPARAM) cadena);
}
if(he1estaextraido(cadena, nivel) == TRUE)
{
he1getnombreextraido(nivel, nombrefileextraido);
_stprintf(rutaficheroextraido, TEXT("%s\\%d"), dirtemporal, nivel);
he1getcrcextraido(rutaficheroextraido, nombrefileextraido, crcextraido, crcfile);
*bien = TRUE;
*error = FALSE;
nivel++;
return TRUE;
}
else
{
if(he1extraeratemp(rutazip, subruta, error) == TRUE)
{
he1borrarantiguos(nivel);
he1renombarextraido(nivel);
he1getnombreextraido(nivel, nombrefileextraido);
_stprintf(rutaficheroextraido, TEXT("%s\\%d"), dirtemporal, nivel);
hd1crearfichconnombre(nivel, cadena);
he1getcrcextraido(rutaficheroextraido, nombrefileextraido, crcextraido, crcfile);
*bien = TRUE;
nivel++;
return FALSE;
}
else
{
if(*error == TRUE)
{
*bien = FALSE;
return FALSE;
}
else
{
*bien = FALSE;
_tcscpy(cadena, cadenabk);
}
}
}
return FALSE;
}
////////////////////////////////////////////////////////////////////
/*
void he1creardirtemporal(void)
{
if(GetTempPath(MIMAXPATH, dirtemporal) == 0)
MostrarError(ecMalInicioComponenteSistema, TEXT(__FILE__), __LINE__);
if(dirtemporal[_tcslen(dirtemporal) - 1] != TEXT('\\'))
_tcscat(dirtemporal, TEXT("\\"));
_tcscat(dirtemporal, TEXT(SZMITEMPDIR));
if(dirtemporal[_tcslen(dirtemporal) - 1] == TEXT('\\'))
dirtemporal[_tcslen(dirtemporal) - 1] = TEXT('\0');
CreateDirectory(dirtemporal, NULL);
}
*/
////////////////////////////////////////////////////////////////////
BOOL he1estaextraido(TCHAR *rutaficticia, INT nivel)
{
TCHAR leido[MIMAXPATH];
TCHAR cadena[MIMAXPATH];
FILE *fichero;
_stprintf(cadena, TEXT("%s\\%d.txt"), dirtemporal, nivel);
if((fichero = _tfopen(cadena, TEXT("rb"))) == NULL)
return FALSE;
_fgetts(leido, MIMAXPATH, fichero);
leido[_tcslen(leido) -2] = TEXT('\0');
fclose(fichero);
if(_tcscmp(leido, rutaficticia) != 0)
return FALSE;
return TRUE;
}
//////////////////////////////////////////////////////////////////
void he1getnombreextraido(INT nivel, TCHAR * nombrefileextraido)
{
TCHAR cadena[MIMAXPATH];
HANDLE bh;
WIN32_FIND_DATA fd;
_stprintf(cadena, TEXT("\\\\?\\%s\\%d\\*"), dirtemporal, nivel);
bh = FindFirstFileEx(cadena, FindExInfoStandard, &fd, FindExSearchNameMatch, NULL, 0);
if(bh == INVALID_HANDLE_VALUE)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*) TEXT(__FILE__), __LINE__);
if((_tcscmp(TEXT("."), fd.cFileName) != 0) && (_tcscmp(TEXT(".."), fd.cFileName) != 0))
{
_tcscpy(nombrefileextraido, fd.cFileName);
//_stprintf(nombrefileextraido, TEXT("%s\\%d\\%s"), dirtemporal, nivel, fd.cFileName);
if(FindClose(bh) == 0)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*) TEXT(__FILE__), __LINE__);
return;
}
while (FindNextFile(bh, &fd) != 0)
{
if((_tcscmp(TEXT("."), fd.cFileName) != 0) && (_tcscmp(TEXT(".."), fd.cFileName) != 0))
{
_tcscpy(nombrefileextraido, fd.cFileName);
//_stprintf(nombrefileextraido, TEXT("%s\\%d\\%s"), dirtemporal, nivel, fd.cFileName);
if(FindClose(bh) == 0)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*)TEXT(__FILE__), __LINE__);
return;
}
}
if(FindClose(bh) == 0)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*) TEXT(__FILE__), __LINE__);
}
/////////////////////////////////////////////////////////////////////
void he1getcrcextraido(TCHAR * rutaficheroextraido, TCHAR * nombrefileextraido, UINT *crcextraido, UINT crcfile)
{
TCHAR cadena[MIMAXPATH];
//BYTE *puntero;
BOOL b;
_stprintf(cadena, TEXT("%s\\%s"), rutaficheroextraido, nombrefileextraido);
//puntero = (BYTE *) Mimalloc(sizeof(BYTE) * BYTESALAVEZ);
// if(puntero == NULL)
// MostrarError(ecErrorDeMemoria, TEXT(__FILE__), __LINE__);
*crcextraido = getFileCrc(cadena, &b, NULL);
if(b == TRUE)
*crcextraido = crcfile + 1;
//free(puntero);
return;
}
////////////////////////////////////////////////////////////////
void he1renombarextraido(INT nivel)
{
TCHAR cadena[MIMAXPATH];
TCHAR cadenatmp[MIMAXPATH];
_stprintf(cadena, TEXT("\\\\?\\%s\\%d"), dirtemporal, nivel);
_stprintf(cadenatmp, TEXT("\\\\?\\%s\\tmp"), dirtemporal);
if(MoveFile(cadenatmp, cadena) == 0)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*)TEXT(__FILE__), __LINE__);
}
///////////////////////////////////////////////////////////////
void he1borrarantiguos(INT nivel)
{
TCHAR cadena1[MIMAXPATH];
TCHAR cadena2[MIMAXPATH];
DWORD atr;
INT x;
x = nivel;
while(TRUE)
{
_stprintf(cadena1, TEXT("%s\\%d"), dirtemporal, nivel);
_stprintf(cadena2, TEXT("\\\\?\\%s"), cadena1);
atr = GetFileAttributes(cadena2);
if(atr == INVALID_FILE_ATTRIBUTES)
return;
MiRemoveFolder(cadena1, TRUE);
_stprintf(cadena1, TEXT("%s\\%d.txt"), dirtemporal, nivel);
MiDeleteFile(cadena1);
++x;
}
}
////////////////////////////////////////////////////////////
void hd1crearfichconnombre(INT nivel, TCHAR * cadena)
{
TCHAR name[MIMAXPATH];
FILE *fich;
_stprintf(name, TEXT("%s\\%d.txt"), dirtemporal, nivel);
fich = _tfopen(name, TEXT("wb"));
if(fich == NULL)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*) TEXT(__FILE__), __LINE__);
_ftprintf(fich, TEXT("%s\r\n"), cadena);
fclose(fich);
/* fich = _tfopen(TEXT("c:\\paisapepe.txt"), TEXT("ab"));
_ftprintf(fich, TEXT("%s -- %d\r\n"), cadena, nivel);
fclose(fich);
*/
}
/////////////////////////////////////////////////////////
BOOL he1extraeratemp(TCHAR *rutazip, TCHAR *subruta, BOOL *error)
{
// TCHAR lineacomandoansi[MIMAXPATH * 2];
// TCHAR rutaacmd[MIMAXPATH];
TCHAR dirsalida[MIMAXPATH];
TCHAR cadena[MIMAXPATH];
TCHAR lineacomando[MIMAXPATH];
TCHAR miruta[MIMAXPATH];
TCHAR rutaprevia[MIMAXPATH];
FILE *ficherotexto;
HANDLE bh;
WIN32_FIND_DATA fd;
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD retorno;
ZeroMemory(&si, sizeof(STARTUPINFO));
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
// _tcscpy(rutaacmd, TEXT("cmd.exe"));
// if (PathFindOnPath(rutaacmd, NULL) == FALSE)
// {
// MostrarError(ecMalInicioComponenteSistema, TEXT(__FILE__), __LINE__);
// }
_stprintf(dirsalida, TEXT("%s\\tmp"), dirtemporal);
CreateDirectory(dirsalida, NULL);
GetModuleFileName(NULL, miruta, MIMAXPATH - 1);
PathRemoveFileSpec(miruta);
ComprobarError<BOOL>(GetCurrentDirectory(MIMAXPATH - 1, rutaprevia), 0, (WCHAR*) TEXT(__FILE__), __LINE__);
ComprobarError<BOOL>(SetCurrentDirectory(miruta), 0, (WCHAR*) TEXT(__FILE__), __LINE__);
PathAddBackslash(miruta);
DeleteFile(TEXT("from7zn.txt"));
ficherotexto = _tfopen(TEXT("to7zn.txt"), TEXT("wb"));
ComprobarError<FILE *>(ficherotexto, NULL, (WCHAR*) TEXT(__FILE__), __LINE__);
fwprintf(ficherotexto, TEXT("a.exe e -y -pa -o\"%s\" \"%s\" \"%s\""), dirsalida, rutazip, subruta);
fclose(ficherotexto);
_tcscpy(lineacomando, TEXT("7zn.exe"));
ComprobarError<BOOL>(CreateProcess(NULL, lineacomando, NULL, NULL, TRUE,
CREATE_NO_WINDOW, NULL, NULL, &si, &pi), 0, (WCHAR*) TEXT(__FILE__), __LINE__);
SetCurrentDirectory(rutaprevia);
/*
_stprintf(lineacomandoansi, TEXT("\"%s\" /C 7z.exe e -y -o\"%s\" \"%s\" \"%s\""),
rutaacmd, dirsalida, rutazip, subruta);
if(CreateProcess(NULL, lineacomandoansi, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi) == 0)
MostrarError(ecMalInicioComponenteSistema, TEXT(__FILE__), __LINE__);
*/
WaitForSingleObject( pi.hProcess, INFINITE );
/*retorno = STILL_ACTIVE;
while(retorno == STILL_ACTIVE)
{
Sleep(70);
GetExitCodeProcess(pi.hProcess, &retorno);
}*/
GetExitCodeProcess(pi.hProcess, &retorno);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
*error = FALSE;
if(retorno != 0)
*error = TRUE;
_stprintf(cadena, TEXT("\\\\?\\%s\\tmp\\*"), dirtemporal);
bh = FindFirstFileEx(cadena, FindExInfoStandard, &fd, FindExSearchNameMatch, NULL, 0);
if(bh == INVALID_HANDLE_VALUE)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*) TEXT(__FILE__), __LINE__);
if((_tcscmp(TEXT("."), fd.cFileName) != 0) && (_tcscmp(TEXT(".."), fd.cFileName) != 0))
{
if(FindClose(bh) == 0)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*) TEXT(__FILE__), __LINE__);
return TRUE;
}
while (FindNextFile(bh, &fd) != 0)
{
if((_tcscmp(TEXT("."), fd.cFileName) != 0) && (_tcscmp(TEXT(".."), fd.cFileName) != 0))
{
if(FindClose(bh) == 0)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*) TEXT(__FILE__), __LINE__);
return TRUE;
}
}
if(FindClose(bh) == 0)
MostrarError(ecMalInicioComponenteSistema, (WCHAR*) TEXT(__FILE__), __LINE__);
return FALSE;
}
///////////////////////////////////////////////////////////////////////
/*
void he1FijarSiComprobar(BOOL x)
{
sehadecomprobar = x;
}
*/