1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
//CODE FOR DECOMPRESSION
#include <windows.h>
#include <stdio.h>
#include <cstring>
void ArrayCopy(BYTE *arrSource,BYTE *arrDestination,LONG srcbeginPos,LONG destbeginpos,LONG length)
{
//int c=a+b;
//return c;
typedef LONG (__stdcall *pCopyMemory)(BYTE *in,BYTE *out);
if(length == 0){ length = (LONG)sizeof(arrSource)+ 1;}
if (HINSTANCE hInst = LoadLibrary("C:\\WINNT\\system32\\KERNEL32.dll"))
{
pCopyMemory CopyMemory = (pCopyMemory)GetProcAddress(hInst, "CopyMemory");
//CopyMemory(arrDestination(destbeginPos), arrSource(srcbeginPos), length);
if (CopyMemory)
{
CopyMemory(arrDestination,arrSource,length);
}
}
//return 0;
}
int main()
{
typedef LONG (__stdcall *pInitDecompression)();
typedef LONG (__stdcall *pCreateDecompression)(LONG *context, LONG flags);
typedef LONG (__stdcall *pDecompress)(
LONG context,
const BYTE *in,
LONG insize,
BYTE *out,
LONG outsize,
LONG *inused,
LONG *outused);
typedef LONG (__stdcall *pDestroyDecompression)(LONG context);
typedef LONG (__stdcall *pDeInitDecompression)();
// if (HINSTANCE hInst = LoadLibrary("C:\\WINDOWS\\ServicePackFiles\\i386\\gzip.dll"))
if (HINSTANCE hInst = LoadLibrary("C:\\WINNT\\system32\\gzip.dll"))
{
pInitDecompression InitDecompression = (pInitDecompression)GetProcAddress(hInst, "InitDecompression");
pCreateDecompression CreateDecompression = (pCreateDecompression)GetProcAddress(hInst, "CreateDecompression");
pDecompress Decompress = (pDecompress)GetProcAddress(hInst, "Decompress");
pDestroyDecompression DestroyDecompression = (pDestroyDecompression)GetProcAddress(hInst, "DestroyDecompression");
pDeInitDecompression DeInitDecompression = (pDeInitDecompression)GetProcAddress(hInst, "DeInitDecompression");
if (InitDecompression && CreateDecompression && Decompress && DestroyDecompression && DeInitDecompression)
{
const LONG GZIP_LVL = 1;
LONG ctx = 0;
char in[] = "gvnvcncv";
LONG insize = (LONG)strlen(in);
//unsigned char out[100];
BYTE *out=new BYTE[100];
LONG outsize = (LONG)sizeof(out);
memset(out, 0, sizeof(out));
BYTE *Result=new BYTE[insize];
LONG tmplength=0;
LONG inused = 0;
LONG outused = 0;LONG lret=0;
InitDecompression();
CreateDecompression(&ctx, GZIP_LVL);
if (ctx)
{
do{
lret=Decompress(ctx, (BYTE*)in, insize, out, outsize, &inused, &outused);
if(outused>0){
tmplength =(LONG)sizeof(Result);
Result=new BYTE[tmplength+outused];
ArrayCopy(out, Result, 0, tmplength, outused);
insize = insize - inused;
}
printf("Hello Worldss!\n");
}while(lret=0);
// Decompress(ctx, (BYTE*)AB, insize, out, outsize, &inused, &outused);
DestroyDecompression(ctx);
//messagebox("bcnc","sdbsdjk", MB_OK);
printf("Hello World!\n");
/* if((LONG)sizeof(Result)>0){
}*/
}
DeInitDecompression();
}
FreeLibrary(hInst);
}
return 0;
}
|