title: ZLIB uncompress
body: <p>I've coded a small application that should uncompress data encoded in the gzip/deflate format.</p>
  
  <p>In order to accomplish this,I'm using the ZLIB library, using the uncompress function.</p>
  
  <p>The problem is that the function doesn't work! In orher words, data is  not uncompressed!</p>
  
  <p>I post here the code:</p>
  
  <pre><code>int (*decompress)(PBYTE,PULONG,PBYTE,ULONG);
  
  void DecodeData(PBYTE data,ULONG dataSize){
    LoadLibrary("C:\\zlib1.dll");
  
    decompress=(int(*)(PBYTE,PULONG,PBYTE,ULONG))GetProcAddress(
      GetModuleHandle("zlib1.dll"),"uncompress");
  
    // Yeah I know the size is hardcoded and it's not right, but it's just a test,
    // so nevermind
  
    PBYTE decompressedData=(PBYTE)VirtualAlloc(NULL,300,MEM_COMMIT|MEM_RESERVE,
      PAGE_EXECUTE_READWRITE);
    ULONG maxSize=250;
  
    decompress(decompressedData,&amp;maxSize,data,dataSize);
  
    MessageBox(0,(char*)decompressedData,0,MB_OK);//MessageBox shows no data, it's blank!
  }
  </code></pre>
  
  <p>The pointer to the function is successfully obtained by GetProcAddress, the problem is that the function return NULL(and not even the errors listed in zlib documentation)</p>