sebastienmz
Messages postés139Date d'inscriptionmardi 16 mai 2006StatutMembreDernière intervention23 juin 2008
-
21 juin 2007 à 14:33
cs_rt15
Messages postés3874Date d'inscriptionmardi 8 mars 2005StatutModérateurDernière intervention 7 novembre 2014
-
22 juin 2007 à 12:41
Bonjour
quand j'écrit mon exe
mon programme rajoute un \n quand il y a dans le buffer un \r et vice versa voici mon code :
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
printf("mapping du fichier\n");
HANDLE hFileIn;
DWORD dwsize, r=0, rw,dwFindDep,dwFindFin;
DWORD i = 0,k=0,l=0,m=0; //i pour le resu k pour le filein
DWORD nbIndent=0;
DWORD line=0;
char c;
char bufindent[500];
char *szBuff,*szResu, *e, *e1, *e2;
BOOL inchar=FALSE;
hFileIn = CreateFile("1.exe", GENERIC_READ, 0, 0, OPEN_ALWAYS, 0, 0);
if(hFileIn == INVALID_HANDLE_VALUE)
goto Erreur;
dwsize = GetFileSize(hFileIn, NULL);
if(dwsize == INVALID_FILE_SIZE )
goto ErreurSize;
szBuff =(CHAR *) malloc(dwsize+1);
memset(szBuff,0,sizeof(szBuff));
ReadFile(hFileIn, szBuff, dwsize, &rw, NULL);
szBuff[dwsize]='\0';
if(rw != dwsize)
goto ErreurMem;
CloseHandle(hFileIn);
printf("fin du mapping du fichier ...\nTeste de l'antivirus\n");
FILE * out;
int size;
out = fopen("C:\\test\\temp.exe","w");
if (!out)
return 0;
size=1;
for (i=0,k=0;k<=dwsize;k++,i++){
if (i>=500){
sleep(10);
i=0;
}