// Here's the chunk of code in fileform.c that I added some additional logging to.
// This is the second appearance of a _dodecomp function found in fileform.c.

//...
int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int outbuflen)
{
  DWORD r;
  int input_len;
  int retval;
  if( g_header ) log_printf2( "top of other _dodecomp, offset is %d", offset );
  if (offset>=0)
  {
    dbd_pos=g_blocks[NB_DATA].offset+offset;
	if( g_header ) log_printf( "SetFilePointer" );
    SetFilePointer(dbd_hFile,dbd_pos,NULL,FILE_BEGIN);
  }
  retval=__ensuredata(sizeof(int));
  if( g_header ) log_printf2( "1st check: retval=%d", retval );
  if (retval<0) return retval;

  if( g_header ) log_printf( "check bool return from ReadFile" );
  if (!ReadFile(dbd_hFile,(LPVOID)&input_len,sizeof(int),&r,NULL) || r!=sizeof(int)) return -3;
  dbd_pos+=sizeof(int);

  if( g_header ) log_printf2( "2nd check: retval=%d", retval );
  retval=__ensuredata(input_len);
  if (retval < 0) return retval;

  if (!outbuf)
  {
    while (input_len > 0)
    {
      DWORD t;
      DWORD l=min(input_len,IBUFSIZE);
	  if( g_header ) log_printf( "in while loop, call ReadFile" );
      if (!ReadFile(dbd_hFile,(LPVOID)_inbuffer,l,&r,NULL) || l != r) return -3;
	  if( g_header ) log_printf( "in while loop, call WriteFile" );
      if (!WriteFile(hFileOut,_inbuffer,r,&t,NULL) || t != l) return -2;
      retval+=r;
      input_len-=r;
      dbd_pos+=r;
    }
  }
  else
  {
    if( g_header ) log_printf( "outbuf was 'true', call ReadFile" );
    if (!ReadFile(dbd_hFile,(LPVOID)outbuf,min(input_len,outbuflen),&r,NULL)) return -3;
    retval=r;
    dbd_pos+=r;
  }
  if( g_header ) log_printf2( "_dodecomp, returning %d", retval );
  return retval;
}
//...








// And here's what I get in my logs for a failure case:
// Looks like the call to SetFilePointer is taking 97 seconds.

 ms 1124923 reading self file with filehdrsize=39424
 ms 1124923 just set unicon_data from my_GlobalAlloc(756)
 ms 1124923 unicon_data exists, getting compressed data from block to memory using: 18038326, , 756
 ms 1124923 top of other _dodecomp, offset is 18038326
 ms 1124923 SetFilePointer
 ms 1222657 1st check: retval=0
 ms 1222657 check bool return from ReadFile
 ms 1222657 2nd check: retval=0
 ms 1222657 outbuf was 'true', call ReadFile
 ms 1222657 _dodecomp, returning 756
 ms 1222657 inside loop, seeker is 2957664
 ms 1222657 inside loop, adding 744 to seeker
 ms 1222657 freeing unicon_data
 ms 1222657 writing file 288 with size 39424 and filebuf MZ
 ms 1222657 freeing filebuf
 ms 1222657 GetCompressedDataFromDataBlock...
 ms 1222657 top of other _dodecomp, offset is -1
 ms 1222657 1st check: retval=0
 ms 1222657 check bool return from ReadFile
 ms 1222657 2nd check: retval=0
 ms 1222673 in while loop, call ReadFile
 ms 1222673 in while loop, call WriteFile
 ms 1222673 in while loop, call ReadFile
 ms 1222673 in while loop, call WriteFile
 ms 1222673 in while loop, call ReadFile
 ms 1222673 in while loop, call WriteFile
 ms 1222673 in while loop, call ReadFile
 ms 1222673 in while loop, call WriteFile
 ms 1222673 in while loop, call ReadFile
 ms 1222673 in while loop, call WriteFile
 ms 1222673 in while loop, call ReadFile
 ms 1222673 in while loop, call WriteFile
 ms 1222673 in while loop, call ReadFile
 ms 1222673 in while loop, call WriteFile
 ms 1222673 _dodecomp, returning 103613
 ms 1222673 ...returned 103613
 ms 1222673 CloseHandle










