Example #1
0
static BOOL CALLBACK LicenseProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  if (uMsg == WM_INITDIALOG)
  {
    LPTSTR buf=(LPTSTR)GlobalAlloc(GMEM_FIXED,32769);
    int l=0;
    buf[0]=0;
    l=GetCompressedDataFromDataBlockToMemory(m_hFile, m_offset+m_header->licensedata_offset, buf, 32768);
    if (l >= 0)
    {
      buf[l]=0;
      SetDlgItemText(hwndDlg,IDC_EDIT1,buf);
    }
    GlobalFree((HGLOBAL)buf);
    SetDlgItemText(hwndDlg,IDC_LICTEXT,m_header->licensetext);
  }
  return 0;
}
Example #2
0
const TCHAR * NSISCALL loadHeaders(int cl_flags)
{
  __int64 left;
#ifdef NSIS_CONFIG_CRC_SUPPORT
  crc32_t crc = 0;
  int do_crc = 0;
#endif//NSIS_CONFIG_CRC_SUPPORT

  void *data;
  firstheader h;
  header *header;
  dataheader dh;

  HANDLE db_hFile;

#ifdef NSIS_CONFIG_CRC_SUPPORT
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
  verify_time = GetTickCount() + 1000;
#endif
#endif//NSIS_CONFIG_CRC_SUPPORT

  GetModuleFileName(NULL, state_exe_path, NSIS_MAX_STRLEN);

  g_db_hFile = db_hFile = myOpenFile(state_exe_path, GENERIC_READ, OPEN_EXISTING);
  if (db_hFile == INVALID_HANDLE_VALUE)
  {
    return _LANG_CANTOPENSELF;
  }

  mystrcpy(state_exe_directory, state_exe_path);
  mystrcpy(state_exe_file, trimslashtoend(state_exe_directory));

  GetFileSizeEx(db_hFile, (LARGE_INTEGER*)&m_length);
  left = m_length;
  while (left > 0)
  {
    static char temp[32768*32]; // modified by yew: for fast crc
    DWORD l = min(left, (g_filehdrsize ? sizeof(temp) : 512));
    if (!ReadSelfFile(temp, l))
    {
#if defined(NSIS_CONFIG_CRC_SUPPORT) && defined(NSIS_CONFIG_VISIBLE_SUPPORT)
      handle_ver_dlg(TRUE);
#endif//NSIS_CONFIG_CRC_SUPPORT
      return _LANG_INVALIDCRC;
    }

    if (!g_filehdrsize)
    {
      mini_memcpy(&h, temp, sizeof(firstheader));
      if (
           (h.flags & (~FH_FLAGS_MASK)) == 0 &&
           h.siginfo == FH_SIG &&
           h.nsinst[2] == FH_INT3 &&
           h.nsinst[1] == FH_INT2 &&
           h.nsinst[0] == FH_INT1
         )
      {
        g_filehdrsize = m_pos;

#if defined(NSIS_CONFIG_CRC_SUPPORT) || defined(NSIS_CONFIG_SILENT_SUPPORT)
        cl_flags |= h.flags;
#endif

#ifdef NSIS_CONFIG_SILENT_SUPPORT
        g_exec_flags.silent |= cl_flags & FH_FLAGS_SILENT;
#endif

        if (h.length_of_all_following_data > left)
          return _LANG_INVALIDCRC;

#ifdef NSIS_CONFIG_CRC_SUPPORT
        if ((cl_flags & FH_FLAGS_FORCE_CRC) == 0)
        {
          if (cl_flags & FH_FLAGS_NO_CRC)
            break;
        }

        do_crc++;

#ifndef NSIS_CONFIG_CRC_ANAL
        left = h.length_of_all_following_data - 4;
        // end crc checking at crc :) this means you can tack stuff on the end and it'll still work.
#else //!NSIS_CONFIG_CRC_ANAL
        left -= 4;
#endif//NSIS_CONFIG_CRC_ANAL
        // this is in case the end part is < 512 bytes.
        if (l > left) l=left;

#else//!NSIS_CONFIG_CRC_SUPPORT
        // no crc support, no need to keep on reading
        break;
#endif//!NSIS_CONFIG_CRC_SUPPORT
      }
    }
#ifdef NSIS_CONFIG_CRC_SUPPORT

#ifdef NSIS_CONFIG_VISIBLE_SUPPORT

#ifdef NSIS_CONFIG_SILENT_SUPPORT
    else if ((cl_flags & FH_FLAGS_SILENT) == 0)
#endif//NSIS_CONFIG_SILENT_SUPPORT
    {
      handle_ver_dlg(FALSE);
    }
#endif//NSIS_CONFIG_VISIBLE_SUPPORT

#ifndef NSIS_CONFIG_CRC_ANAL
    if (left < m_length)
#endif//NSIS_CONFIG_CRC_ANAL
      crc = CRC32(crc, (unsigned char*)temp, l);

#endif//NSIS_CONFIG_CRC_SUPPORT
    m_pos += l;
    left -= l;
  }
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
#ifdef NSIS_CONFIG_CRC_SUPPORT
  handle_ver_dlg(TRUE);
#endif//NSIS_CONFIG_CRC_SUPPORT
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
  if (!g_filehdrsize)
    return _LANG_INVALIDCRC;

#ifdef NSIS_CONFIG_CRC_SUPPORT
  if (do_crc)
  {
    crc32_t fcrc;
    SetSelfFilePointer(m_pos);
    if (!ReadSelfFile(&fcrc, sizeof(crc32_t)) || crc != fcrc)
      return _LANG_INVALIDCRC;
  }
#endif//NSIS_CONFIG_CRC_SUPPORT

  data = (void *)GlobalAlloc(GPTR,h.length_of_header);

#ifdef NSIS_COMPRESS_WHOLE
  inflateReset(&g_inflate_stream);

  {
    TCHAR fno[MAX_PATH];
    my_GetTempFileName(fno, state_temp_dir);
    dbd_hFile=CreateFile(fno,GENERIC_WRITE|GENERIC_READ,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE,NULL);
    if (dbd_hFile == INVALID_HANDLE_VALUE)
      return _LANG_ERRORWRITINGTEMP;
  }
  dbd_srcpos = SetSelfFilePointer(g_filehdrsize + sizeof(firstheader));
#ifdef NSIS_CONFIG_CRC_SUPPORT
  dbd_fulllen = dbd_srcpos - sizeof(h) + h.length_of_all_following_data - ((h.flags & FH_FLAGS_NO_CRC) ? 0 : sizeof(crc32_t));
#else
  dbd_fulllen = dbd_srcpos - sizeof(h) + h.length_of_all_following_data;
#endif//NSIS_CONFIG_CRC_SUPPORT
#else
  SetSelfFilePointer(g_filehdrsize + sizeof(firstheader));
#endif//NSIS_COMPRESS_WHOLE

  if (GetCompressedDataFromDataBlockToMemory(-1, data, h.length_of_header) != h.length_of_header)
  {
    return _LANG_INVALIDCRC;
  }

  header = g_header = data;

  g_flags = header->flags;

#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
  if (h.flags & FH_FLAGS_UNINSTALL)
    g_is_uninstaller++;
#endif

  // set offsets to real memory offsets rather than installer's header offset
  left = BLOCKS_NUM;
  while (left--)
    header->blocks[left].offset += (int)data;

  m_file_mapping.first = NULL;
  m_file_mapping.cur = NULL;
  m_file_mapping.LoadFinished = FALSE;

#ifdef NSIS_COMPRESS_WHOLE
  header->blocks[NB_DATA].offset = dbd_pos;
#else
  if (h.flags & FH_FLAGS_DATA_FILE)
  {
	  LPTSTR psz,psz2;
	  int cur_index= 1;
	  __int64 length;
	  while(1)
	  {
		  CloseHandle(g_db_hFile);
		  mystrcpy(m_data_file_path, state_exe_directory);
		  mystrcat(m_data_file_path, _T("\\setup-.bin"));
		  psz =_tcsrchr(m_data_file_path,'\\');
		  if (psz==NULL) psz=m_data_file_path;
		  while (psz2=_tcschr(psz+1,'.'))
		  {
			  psz = psz2;
		  }
		  wsprintf(psz,_T("%u.bin"),cur_index);
		  g_db_hFile = db_hFile = myOpenFile(m_data_file_path, GENERIC_READ, OPEN_EXISTING);
		  if (db_hFile == INVALID_HANDLE_VALUE)
		  {
			  return _LANG_CANTOPENSELF;
		  }
		  if (!ReadSelfFile(&dh, sizeof(dh)))
		  {// read out the data file header
			  return _LANG_INVALIDCRC;
		  }	
		  if (cur_index==1)
		  {
			 m_length = dh.total_length;
		  }
		  if (!GetFileSizeEx(db_hFile,(LARGE_INTEGER*)&length) || length!=dh.length+sizeof(dataheader) || dh.volume_index!=cur_index)
		  {// check the whole file length
			  return _LANG_INVALIDCRC;
		  }
		  if (m_file_mapping.first==NULL)
		  {// it's the first time to meet a data file
			  m_file_mapping.cur = GlobalAlloc(GPTR,sizeof(struct FileMapping));
			  m_file_mapping.first = m_file_mapping.cur;
		  }
		  else
		  {// push the new data file to the end, and replace the current one
			  m_file_mapping.cur->next = GlobalAlloc(GPTR,sizeof(struct FileMapping));
			  m_file_mapping.cur = m_file_mapping.cur->next;
		  }
		  mini_memcpy(&m_file_mapping.cur->dh,&dh,sizeof(dh));
		  m_file_mapping.cur->next = NULL;
#ifdef NSIS_CONFIG_CRC_SUPPORT
		  if (do_crc)
		  {
			  __int64 cur_length= 0;
			  crc = 0;
			  while (cur_length<dh.length)
			  {
				  static char temp[32768*32]; // modified by yew: for fast crc
				  DWORD l = min(dh.length-cur_length, sizeof(temp));
				  if (!ReadSelfFile(temp, l))
				  {
#if defined(NSIS_CONFIG_VISIBLE_SUPPORT)
					  handle_ver_dlg(TRUE);
#endif
					  return _LANG_INVALIDCRC;
				  }
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT

#ifdef NSIS_CONFIG_SILENT_SUPPORT
				  if ((cl_flags & FH_FLAGS_SILENT) == 0)
#endif//NSIS_CONFIG_SILENT_SUPPORT
				  {
					  handle_ver_dlg(FALSE);
				  }
#endif//NSIS_CONFIG_VISIBLE_SUPPORT

				  crc = CRC32(crc, (unsigned char*)temp, l);

				  m_pos += l;
				  cur_length += l;
			  }
			  if (dh.crc != crc)
				  return _LANG_INVALIDCRC;
		  }
#endif//NSIS_CONFIG_CRC_SUPPORT
		  if (cur_index<dh.total_volume)
			  cur_index++;// need to check next file
		  else
			  break;
	  }
#ifdef NSIS_CONFIG_CRC_SUPPORT
	  if (do_crc)
	  {
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
		  handle_ver_dlg(TRUE);
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
	  }
#endif//NSIS_CONFIG_CRC_SUPPORT
	  // re-open the first file
	  if (cur_index!=1)
	  {
		  CloseHandle(g_db_hFile);
		  mystrcpy(m_data_file_path, state_exe_directory);
		  mystrcat(m_data_file_path, _T("\\setup-.bin"));
		  psz =_tcsrchr(m_data_file_path,'\\');
		  if (psz==NULL) psz=m_data_file_path;
		  while (psz2=_tcschr(psz+1,'.'))
		  {
			  psz = psz2;
		  }
		  wsprintf(psz,_T("%u.bin"),1);
		  g_db_hFile = db_hFile = myOpenFile(m_data_file_path, GENERIC_READ, OPEN_EXISTING);
	  }
	  m_file_mapping.cur = m_file_mapping.first;// reset the current mapping to the first one
	  m_file_mapping.LoadFinished = TRUE;// if there is no data file, keep it to be FALSE always
	  header->blocks[NB_DATA].offset = SetFilePointer(db_hFile,0,NULL,FILE_BEGIN);
	  m_file_mapping.cur_offset = 0;
	}
	header->blocks[NB_DATA].offset = SetFilePointer(db_hFile,0,NULL,FILE_CURRENT);
#endif

  mini_memcpy(&g_blocks, &header->blocks, sizeof(g_blocks));

  return 0;
}
Example #3
0
const char * NSISCALL loadHeaders(int cl_flags)
{
#ifdef NSIS_CONFIG_CRC_SUPPORT
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
  HWND hwnd = 0;
  unsigned int verify_time = GetTickCount() + 1000;
#endif
  crc32_t crc = 0;
  int do_crc = 0;
#endif//NSIS_CONFIG_CRC_SUPPORT
  int left;

  void *data;
  firstheader h;
  header *header;

  HANDLE db_hFile;

  GetModuleFileName(NULL, state_exe_path, NSIS_MAX_STRLEN);

  g_db_hFile = db_hFile = myOpenFile(state_exe_path, GENERIC_READ, OPEN_EXISTING);
  if (db_hFile == INVALID_HANDLE_VALUE)
  {
    return _LANG_CANTOPENSELF;
  }

  mystrcpy(state_exe_directory, state_exe_path);
  mystrcpy(state_exe_file, trimslashtoend(state_exe_directory));

  left = m_length = GetFileSize(db_hFile,NULL);
  while (left > 0)
  {
    static char temp[32768];
    DWORD l = min(left, (g_filehdrsize ? 32768 : 512));
    if (!ReadSelfFile(temp, l))
    {
#if defined(NSIS_CONFIG_CRC_SUPPORT) && defined(NSIS_CONFIG_VISIBLE_SUPPORT)
      if (hwnd) DestroyWindow(hwnd);
#endif//NSIS_CONFIG_CRC_SUPPORT
      return _LANG_INVALIDCRC;
    }

    if (!g_filehdrsize)
    {
      mini_memcpy(&h, temp, sizeof(firstheader));
      if (
           (h.flags & (~FH_FLAGS_MASK)) == 0 &&
           h.siginfo == FH_SIG &&
           h.nsinst[2] == FH_INT3 &&
           h.nsinst[1] == FH_INT2 &&
           h.nsinst[0] == FH_INT1
         )
      {
        g_filehdrsize = m_pos;

#if defined(NSIS_CONFIG_CRC_SUPPORT) || defined(NSIS_CONFIG_SILENT_SUPPORT)
        cl_flags |= h.flags;
#endif

#ifdef NSIS_CONFIG_SILENT_SUPPORT
        g_exec_flags.silent |= cl_flags & FH_FLAGS_SILENT;
#endif

        if (h.length_of_all_following_data > left)
          return _LANG_INVALIDCRC;

#ifdef NSIS_CONFIG_CRC_SUPPORT
        if ((cl_flags & FH_FLAGS_FORCE_CRC) == 0)
        {
          if (cl_flags & FH_FLAGS_NO_CRC)
            break;
        }

        do_crc++;

#ifndef NSIS_CONFIG_CRC_ANAL
        left = h.length_of_all_following_data - 4;
        // end crc checking at crc :) this means you can tack shit on the end and it'll still work.
#else //!NSIS_CONFIG_CRC_ANAL
        left -= 4;
#endif//NSIS_CONFIG_CRC_ANAL
        // this is in case the end part is < 512 bytes.
        if (l > (DWORD)left) l=(DWORD)left;

#else//!NSIS_CONFIG_CRC_SUPPORT
        // no crc support, no need to keep on reading
        break;
#endif//!NSIS_CONFIG_CRC_SUPPORT
      }
    }
#ifdef NSIS_CONFIG_CRC_SUPPORT

#ifdef NSIS_CONFIG_VISIBLE_SUPPORT

#ifdef NSIS_CONFIG_SILENT_SUPPORT
    else if ((cl_flags & FH_FLAGS_SILENT) == 0)
#endif//NSIS_CONFIG_SILENT_SUPPORT
    {
      if (hwnd)
      {
        MessageLoop(0);
      }
      else if (GetTickCount() > verify_time)
        hwnd = CreateDialogParam(
          g_hInstance,
          MAKEINTRESOURCE(IDD_VERIFY),
          0,
          verProc,
          (LPARAM)_LANG_VERIFYINGINST
        );
    }
#endif//NSIS_CONFIG_VISIBLE_SUPPORT

#ifndef NSIS_CONFIG_CRC_ANAL
    if (left < m_length)
#endif//NSIS_CONFIG_CRC_ANAL
      crc = CRC32(crc, temp, l);

#endif//NSIS_CONFIG_CRC_SUPPORT
    m_pos += l;
    left -= l;
  }
#ifdef NSIS_CONFIG_VISIBLE_SUPPORT
#ifdef NSIS_CONFIG_CRC_SUPPORT
  if (hwnd)
  {
    DestroyWindow(hwnd);
  }
#endif//NSIS_CONFIG_CRC_SUPPORT
#endif//NSIS_CONFIG_VISIBLE_SUPPORT
  if (!g_filehdrsize)
    return _LANG_INVALIDCRC;

#ifdef NSIS_CONFIG_CRC_SUPPORT
  if (do_crc)
  {
    crc32_t fcrc;
    SetSelfFilePointer(m_pos);
    if (!ReadSelfFile(&fcrc, sizeof(crc32_t)) || crc != fcrc)
      return _LANG_INVALIDCRC;
  }
#endif//NSIS_CONFIG_CRC_SUPPORT

  data = (void *)GlobalAlloc(GPTR,h.length_of_header);

#ifdef NSIS_COMPRESS_WHOLE
  inflateReset(&g_inflate_stream);

  {
    char fno[MAX_PATH];
    my_GetTempFileName(fno, state_temp_dir);
    dbd_hFile=CreateFile(fno,GENERIC_WRITE|GENERIC_READ,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE,NULL);
    if (dbd_hFile == INVALID_HANDLE_VALUE)
      return _LANG_ERRORWRITINGTEMP;
  }
  dbd_srcpos = SetSelfFilePointer(g_filehdrsize + sizeof(firstheader));
#ifdef NSIS_CONFIG_CRC_SUPPORT
  dbd_fulllen = dbd_srcpos - sizeof(h) + h.length_of_all_following_data - ((h.flags & FH_FLAGS_NO_CRC) ? 0 : sizeof(crc32_t));
#else
  dbd_fulllen = dbd_srcpos - sizeof(h) + h.length_of_all_following_data;
#endif//NSIS_CONFIG_CRC_SUPPORT
#else
  SetSelfFilePointer(g_filehdrsize + sizeof(firstheader));
#endif//NSIS_COMPRESS_WHOLE

  if (GetCompressedDataFromDataBlockToMemory(-1, data, h.length_of_header) != h.length_of_header)
  {
    return _LANG_INVALIDCRC;
  }

  header = g_header = data;

  g_flags = header->flags;

#ifdef NSIS_CONFIG_UNINSTALL_SUPPORT
  if (h.flags & FH_FLAGS_UNINSTALL)
    g_is_uninstaller++;
#endif

  // set offsets to real memory offsets rather than installer's header offset
  left = BLOCKS_NUM;
  while (left--)
    header->blocks[left].offset += (int)data;

#ifdef NSIS_COMPRESS_WHOLE
  header->blocks[NB_DATA].offset = dbd_pos;
#else
  header->blocks[NB_DATA].offset = SetFilePointer(db_hFile,0,NULL,FILE_CURRENT);
#endif

  mini_memcpy(&g_blocks, &header->blocks, sizeof(g_blocks));

  return 0;
}
Example #4
0
int ExecuteEntry(HANDLE hFile, int offset, entry *thisentry)
{
  static TCHAR buf[MAX_PATH], buf2[MAX_PATH], tmpbuf[MAX_PATH];
  if (skip && thisentry->which != 15) return 0;
  switch (thisentry->which)
  {
    case 0: // set output directory
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf,sizeof(buf)))
      {
        if (!buf[0]) 
        {
          _tcscpy(state_output_directory,state_install_directory);
        }
        else 
        {
          if (process_string(state_output_directory,buf,state_install_directory))
            _tcscpy(state_output_directory,state_install_directory);
        }
        log_printf3("SetOutPath: \"%s\"->\"%s\"\n",buf,state_output_directory);
		{
			INT32 args[] = { (INT32)state_output_directory };
			GETRESOURCE2(tmpbuf, JAVAWS_STATUS_OUTDIR, args);
			update_status_text(tmpbuf);
		}
        recursive_create_directory(state_output_directory);
        return 0;
      }
      log_printf("SetOutPath: INSTALLER CORRUPTED\n");
    break;
    case 1: // extract file
      {
	TCHAR tempFile[MAX_PATH];
	int queueForRebootFlag = 0;
        int overwriteflag=thisentry->offsets[0];
        LPTSTR p;
        _tcscpy(buf,state_output_directory);
        p=buf; while (*p) p=CharNext(p); if (p == buf || (CharPrev(buf,p))[0]!=_T('\\')) _tcscat(buf,_T("\\"));

        if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[1],buf2,MAX_PATH))
        {
          HANDLE hOut;
          int ret;
          log_printf3("File: overwriteflag=%d, name=\"%s\"\n",overwriteflag,buf2);
          _tcscat(buf,buf2);
_tryagain:
          if ((overwriteflag&3)==0)
          {
            int attr=GetFileAttributes(buf);
            if (attr & FILE_ATTRIBUTE_READONLY)
              SetFileAttributes(buf,attr^FILE_ATTRIBUTE_READONLY);
          }
          hOut=CreateFile(buf,GENERIC_WRITE,0,NULL,(overwriteflag&1)?CREATE_NEW:CREATE_ALWAYS,0,NULL);
          if (hOut == INVALID_HANDLE_VALUE)
          {
            if (overwriteflag&3) 
            {
	      INT32 args[] = { (INT32)buf };
	      GETRESOURCE2(tmpbuf, JAVAWS_STATUS_SKIPPED, args);
	      update_status_text(tmpbuf);
              log_printf3("File: skipping: \"%s\" (overwriteflag=%d)\n",buf,overwriteflag); 
              return 0;
            }
            log_printf2("File: error creating \"%s\"\n",buf);
	    {
	      INT32 args[] = { (INT32)buf };
	      GETRESOURCE2(tmpbuf, JAVAWS_ERROR_OPENWRITE, args);
	      wsprintf(buf2, _T("%s"), tmpbuf);
            }

	    /* If we're not in silent mode then tell the user up front that */
	    /* the file is locked.  Otherwise (silent mode), queue the file */
	    /* for copy on next reboot.                                     */
	    if (noisy) {
	      switch (MessageBox(g_hwnd,buf2,g_caption,MB_ABORTRETRYIGNORE|MB_ICONSTOP))
		{
		case IDABORT:
		  log_printf("File: on error, user selected abort.\n");
		  {
		    INT32 args[]={ (INT32)buf };
		    GETRESOURCE2(tmpbuf, JAVAWS_ERROR_ABORTWRITE, args);
		    update_status_text(tmpbuf);
		  }
		  return -2;
		case IDRETRY:
		  log_printf("File: on error, user selected retry.\n"); 
		  goto _tryagain;
		case IDIGNORE:
		  log_printf("File: on error, user selected cancel.\n"); 
		  return 0;
		}
	    } else {
	      /* try to queue the file for copy on reboot */	      
	      GetTempFileName(g_tempdir, "jws", 0, tempFile);
	      hOut=CreateFile(tempFile,GENERIC_WRITE,0,NULL,(overwriteflag&1)?CREATE_NEW:CREATE_ALWAYS,0,NULL);
	      if (hOut == INVALID_HANDLE_VALUE) return 0;
	      queueForRebootFlag = 1;
	    }
          }
	  {
	    INT32 args[] = { (INT32)buf };
	    GETRESOURCE2(tmpbuf, JAVAWS_STATUS_EXTRACT, args);
            update_status_text(tmpbuf);
	  }
          ret=GetCompressedDataFromDataBlock(hFile,offset+thisentry->offsets[2],hOut);
	  
          log_printf3("File: wrote %d to \"%s\"\n",ret,buf);

          CloseHandle(hOut);

          if (ret >= 0) {
	    if (queueForRebootFlag == 1) {
	      TCHAR winini[MAX_PATH];
	      TCHAR shortname[MAX_PATH];
	      TCHAR rebootFlagFile[MAX_PATH];
	      int len;
	      _tcscpy(rebootFlagFile, g_tempdir);
	      _tcscat(rebootFlagFile, JAVAWS_REBOOT_FILENAME);

	      if (IsRunningOnNT4() || IsRunningOn2000XP()) {
		MoveFileEx(tempFile, buf, MOVEFILE_DELAY_UNTIL_REBOOT);
		MoveFileEx(rebootFlagFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT);
	      } else {
		/* queue for copy on boot; tempFile is the file to be copied */
		/* buf holds the target filename that was locked previously. */
		GetWindowsDirectory(winini, MAX_PATH);
		/* append a trailing backslash if necessary */
		len = _tcslen(winini);
		if (winini[len - 1] != '\\') {
		  winini[len] = '\\';
		  winini[len+1] = 0;
		}
		_tcscat(winini, "WININIT.INI");
		/* write to the wininit.ini file to queue the file for copy on */
		/* reboot.                                                     */
		GetShortPathName(buf, shortname, MAX_PATH);
		WritePrivateProfileString("rename", shortname, tempFile, winini);
		
		/* write the wininit.ini file to tell Windows to delete the  */
		/* reboot flag file after it reboots                         */
		WritePrivateProfileString("rename", "NUL", rebootFlagFile,
					  winini);
	      }
	      /* write the reboot flag file                                */
	      WritePrivateProfileString(JAVAWS_APPLICATION_NAME,
					JAVAWS_REBOOT_KEY,
					"1",
					rebootFlagFile);
	      state_reboot_needed = 1;
	    }
	    return ret;
	  }
          if (ret == -3 || ret == -6)
          {
            log_printf2("File: INSTALLER CORRUPTED (gcdfdb:%d)\n",ret);          
            goto installer_corrupted;
          }
          else
          {
            DeleteFile(buf);
            log_printf("File: error writing. deleted.\n");
            return -2;
          }

        }
        log_printf("File: INSTALLER CORRUPTED\n");
      }
    break;
    case 2: // execute program
      {
        PROCESS_INFORMATION ProcInfo={0,};
        STARTUPINFO StartUp={sizeof(STARTUPINFO),};
	int disabled = 0;
        if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf2,sizeof(buf2)))
        {
          log_printf2("Exec: command=\"%s\"\n",buf2);
          if (process_string(buf,buf2,state_install_directory)) _tcscpy(buf,buf2);
		  {
			  INT32 args[] = { (INT32)buf };
			  GETRESOURCE2(tmpbuf, JAVAWS_STATUS_EXECUTE, args);
			  update_status_text(tmpbuf);
		  }
		  if (IsWindowEnabled(GetDlgItem(g_hwnd,IDOK))!=0) {
		    /* if Next button is already disabled, don't disable */
                    /* and re-enable it. (bug 4624948) */
		    EnableWindow(GetDlgItem(g_hwnd,IDOK), 0);
                    disabled = 1;
                  }
          if (CreateProcess( NULL, buf, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, state_output_directory, &StartUp, &ProcInfo) )
          {
            log_printf2("Exec: success (\"%s\")\n",buf);
            if (NULL != ProcInfo.hThread) CloseHandle( ProcInfo.hThread );
            if (NULL != ProcInfo.hProcess)
            {
              if (thisentry->offsets[1]==1) 
              {
                WaitForSingleObject(ProcInfo.hProcess,INFINITE);
                ShowWindow(g_hwnd,SW_HIDE);
                ShowWindow(g_hwnd,SW_SHOW);
                InvalidateRect(g_hwnd,NULL,TRUE);
                UpdateWindow(g_hwnd);
                while (1)
                {
                  MSG msg;
                  if (!PeekMessage(&msg,g_hwnd,WM_PAINT,WM_PAINT,PM_REMOVE)) break;
                  DispatchMessage(&msg);
                }      
              }
			  {
				  DWORD exitcode;
				  if (!GetExitCodeProcess(ProcInfo.hProcess, (LPDWORD)&exitcode)) {
					  log_printf("Exec: failed getting exit code\n");
					  state_return_value = STATE_RETURN_INVALID;
				  } else {
					  state_return_value = exitcode;
				  }
			  }
              CloseHandle( ProcInfo.hProcess );
            }
          }
          else { log_printf2("Exec: failed createprocess (\"%s\")\n",buf); }
	  if (disabled != 0) {
	    EnableWindow(GetDlgItem(g_hwnd,IDOK), 1);
	  }
          return 0;
        }
        log_printf("Exec: INSTALLER CORRUPTED\n"); 
      }
    break;
    case 3: // register DLL
#ifdef NSIS_SUPPORT_ACTIVEXREG
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf2,sizeof(buf2)))
      {
        HRESULT hr;
        hr=OleInitialize(NULL);
        if (hr == S_OK || hr == S_FALSE)
        {
          if (!process_string(buf,buf2,state_install_directory)) 
          {
            HANDLE h;
            int is_uninstall=0;
            if (buf[0] == _T('-') && buf[1] == _T(' '))
              is_uninstall=2;
            
            h=LoadLibrary(buf+is_uninstall);
            if (h)
            {
              FARPROC funke = GetProcAddress(h,is_uninstall?"DllUnregisterServer":"DllRegisterServer");
              if (funke) 
              {
                if (!is_uninstall) {
					INT32 args[] = { (INT32)buf };
					GETRESOURCE2(tmpbuf, JAVAWS_STATUS_REGDLL, args);
					update_status_text(tmpbuf);
				}
                else {
					INT32 args[] = { (INT32)buf+is_uninstall };
					GETRESOURCE2(tmpbuf, JAVAWS_STATUS_UNREGDLL, args);
					update_status_text(tmpbuf);
				}
                funke();
              }
              else if (!is_uninstall)
              {
				INT32 args[] = { (INT32)buf };
				GETRESOURCE2(buf2,JAVAWS_ERROR_REGDLL,args);
                if (noisy) MessageBox(g_hwnd,buf2,g_caption,MB_OK);
              }
              FreeModule(h);
            }
            else if (!is_uninstall)
            {
			  INT32 args[] = { (INT32)buf };
			  GETRESOURCE2(buf2,JAVAWS_ERROR_REGDLLU, args);
              if (noisy) MessageBox(g_hwnd,buf2,g_caption,MB_OK);
            }
          }
          if (hr == S_OK) OleUninitialize();
        }
        else
        {
		  INT32 args[] = { (INT32)buf };
		  GETRESOURCE2(buf2,JAVAWS_ERROR_OLEINIT,args);
          if (noisy) MessageBox(g_hwnd,buf2,g_caption,MB_OK);
        }
        return 0;
      }
#endif
    break;
    case 4: // install netscape plug-in
    case 11:
#ifdef NSIS_SUPPORT_NETSCAPEPLUGINS
#warning NSIS_SUPPORT_NETSCAPEPLUGINS defined, this section NOT internationalized, proceed with caution!
if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf2,sizeof(buf2)))
      {
        HKEY hKey;
		    if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Netscape\\Netscape Navigator",0,KEY_READ,&hKey) == ERROR_SUCCESS)
		    {
          int x=0;
          while (1)
          {
            FILETIME pft;
            char name[256];
            HKEY subKey;
            DWORD lname=sizeof(name);
            if (RegEnumKeyEx(hKey,x++,name,&lname,NULL,NULL,NULL,&pft) != ERROR_SUCCESS) break;
            mini_strcat(name,"\\Main");
            if (RegOpenKeyEx(hKey,name,0,KEY_READ,&subKey) == ERROR_SUCCESS)
            {
			        int l = sizeof(buf);
			        int t=REG_SZ;
			        if (RegQueryValueEx(subKey,"Plugins Directory",NULL,&t,buf,&l ) == ERROR_SUCCESS && t == REG_SZ)
			        {
				        mini_strcat(buf,"\\");
                mini_strcat(buf,buf2);
                {
                  HANDLE hOut=INVALID_HANDLE_VALUE;
                  retryagainns:
                  {
                    int attr=GetFileAttributes(buf);
                    if (attr & FILE_ATTRIBUTE_READONLY)
                      SetFileAttributes(buf,attr^FILE_ATTRIBUTE_READONLY);
                  }
                  
                  hOut=CreateFile(buf,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,0,NULL);                  
                  if (thisentry->which != 4)
                  {
                    if (hOut != INVALID_HANDLE_VALUE)
                    {
                      CloseHandle(hOut);
                      hOut=(HANDLE)1;
                      if (!DeleteFile(buf))
                      {
                        log_printf2("InstNSPlug: error removing: %s\n",buf);
                        hOut=INVALID_HANDLE_VALUE;
                      }
                      else
                        log_printf2("InstNSPlug: removed: %s\n",buf);
                    }
                    else
                      hOut=(HANDLE)1;

                  }
                  
                  if (hOut == INVALID_HANDLE_VALUE)
                  {
                    if (MessageBox(g_hwnd,"Error accessing Netscape plug-in.\r\nMake sure all windows of Netscape are closed.\r\nHit Retry to try again, Cancel to skip",g_caption,MB_RETRYCANCEL|MB_APPLMODAL|MB_TOPMOST)==IDOK) goto retryagainns;
                    log_printf2("InstNSPlug: install to %s aborted by user.\n",buf);
                  }

                  if (hOut != INVALID_HANDLE_VALUE && thisentry->which == 4)
                  {
                    int ret=GetCompressedDataFromDataBlock(hFile,offset+thisentry->offsets[1],hOut);

                    CloseHandle(hOut);

                    if (ret<0)
                    {
                      DeleteFile(buf);
                      if (ret==-3)
                      {
                        log_printf("InstNSPlug: INSTALLER CORRUPTED (2)\n");
                        goto installer_corrupted;
                      }
                      log_printf2("InstNSPlug: couldn't write to: %s\n",buf);
                    }
                    else 
                    {
                      update_status_text("installed netscape plug-in: ",buf);
                      log_printf2("InstNSPlug: wrote: %s\n",buf);
                    }
                  }                  
                  else if (thisentry->which == 11)
                  {
                    update_status_text("removed netscape plug-in: ",buf);
                  }
                }
			        }
              RegCloseKey(subKey);
            }
          }
			    RegCloseKey(hKey);
        }
        else
        {
          log_printf("InstNSPlug: Netscape registry settings not found\n");
        }
        return 0;
      }
#endif
      log_printf("InstNSPlug: INSTALLER CORRUPTED\n");
    break;
    case 12:
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[1],buf,sizeof(buf)))
      {
        int rootkey=thisentry->offsets[0];
        if (thisentry->offsets[2] != -1)
        {
          HKEY hKey;
          if (RegOpenKey((HKEY)rootkey,buf,&hKey) == ERROR_SUCCESS) 
          {
            if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[2],buf2,sizeof(buf2)))
            {
              if (process_string(buf,buf2,state_install_directory)) _tcscpy(buf,buf2);
              RegDeleteValue(hKey,buf);
            }
            RegCloseKey(hKey);
          }
        }
        else
        {
          log_printf3("DeleteRegKey: %d\\%s\n",rootkey,buf);
          RegDeleteKey((HKEY)rootkey,buf);
        }
        return 0;
      }
    break;
    case 5: // write registry value
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[1],buf,sizeof(buf)) &&
          !GetStringFromDataBlock(hFile,offset+thisentry->offsets[2],buf2,sizeof(buf2)))
      {
        int rootkey=thisentry->offsets[0];
        int type=thisentry->offsets[4];
        HKEY hKey;
        if (RegCreateKey((HKEY)rootkey,buf,&hKey) == ERROR_SUCCESS) 
        {
          TCHAR buf4[MAX_PATH];
          if (type == 1)
          {
            if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[3],buf4,sizeof(buf4)))
            {
              TCHAR buf3[MAX_PATH];
              if (process_string(buf3,buf4,state_install_directory)) _tcscpy(buf3,buf4);
              if (process_string(buf4,buf2,state_install_directory)) _tcscpy(buf4,buf2);
              log_printf5("WriteRegStr: set %d\\%s\\%s to %s\n",rootkey,buf,buf4,buf3);
              RegSetValueEx(hKey,buf4,0,REG_SZ,buf3,_tcslen(buf3)+1);
            }
          }
          else if (type == 2)
          {
            if (process_string(buf4,buf2,state_install_directory)) _tcscpy(buf4,buf2);
            log_printf5("WriteRegDword: set %d\\%s\\%s to %d\n",rootkey,buf,buf4,thisentry->offsets[3]);
            RegSetValueEx(hKey,buf4,0,REG_DWORD,(BYTE*)&thisentry->offsets[3],4);
          }
          else if (type == 3)
          {
            BYTE data[512];
            int len=GetCompressedDataFromDataBlockToMemory(hFile, 
              offset+thisentry->offsets[3], data,sizeof(data));

            if (len >= 0)
            {
              if (process_string(buf4,buf2,state_install_directory)) _tcscpy(buf4,buf2);
              RegSetValueEx(hKey,buf4,0,REG_BINARY,data,len);
            }
            log_printf5("WriteRegBin: set %d\\%s\\%s with %d bytes\n",rootkey,buf,buf4,len);

          }
          RegCloseKey(hKey);
        }
        else { log_printf3("WriteReg: error creating key %d\\%s\n",rootkey,buf); }
        if (type > 0 && type < 4) return 0;
      }
      log_printf("WriteReg: INSTALLER CORRUPTED\n");
    break;
    case 6:
      {
        TCHAR section[MAX_PATH];
        TCHAR name[MAX_PATH];
        TCHAR t[MAX_PATH];
        TCHAR t2[MAX_PATH];
        if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],section,sizeof(section)) &&
            !GetStringFromDataBlock(hFile,offset+thisentry->offsets[1],name,sizeof(name)) &&
            !GetStringFromDataBlock(hFile,offset+thisentry->offsets[2],buf,sizeof(buf)) &&
            !GetStringFromDataBlock(hFile,offset+thisentry->offsets[3],buf2,sizeof(buf2)))
        {
          if (process_string(t,buf2,state_install_directory)) _tcscpy(t,buf2);
          if (process_string(buf2,buf,state_install_directory)) _tcscpy(buf2,buf);
          if (process_string(t2,name,state_install_directory)) _tcscpy(t2,name);
          if (process_string(buf,section,state_install_directory)) _tcscpy(buf,section);
          log_printf5("WriteINIStr: wrote [%s] %s=%s in %s\n",buf,t2,buf2,t);
          WritePrivateProfileString(buf,t2,buf2,t);
          return 0;
        }
        log_printf("WriteINIStr: INSTALLER CORRUPTED\n");
      }
    break;
    case 7:
#ifdef NSIS_SUPPORT_CREATESHORTCUT
      {
        TCHAR scf[MAX_PATH],iconfile[MAX_PATH], parms[MAX_PATH];
        int iindex=thisentry->offsets[4];
        if (GetStringFromDataBlock(hFile,offset+thisentry->offsets[3],buf,sizeof(buf))) break;
        if (process_string(iconfile,buf,state_install_directory)) break;
        if (GetStringFromDataBlock(hFile,offset+thisentry->offsets[2],buf,sizeof(buf))) break;
        if (process_string(parms,buf,state_install_directory)) break;
        if (GetStringFromDataBlock(hFile,offset+thisentry->offsets[1],buf,sizeof(buf))) break;
        if (process_string(buf2,buf,state_install_directory)) break;
        if (GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf,sizeof(buf))) break;
        if (process_string(scf,buf,state_install_directory)) break;

        log_printf6("CreateShortCut: out: \"%s\", in: \"%s %s\", icon: %s,%d\n",scf,buf2,parms,iconfile,iindex); 
        CreateShortCut(g_hwnd, scf, iconfile[0]?iconfile:NULL, iindex, buf2, parms[0]?parms:NULL,state_output_directory);
		{
			INT32 args[] = { (INT32)scf };
			GETRESOURCE2(tmpbuf, JAVAWS_STATUS_CREATESHORTCUT, args);
			update_status_text(tmpbuf);
		}
        return 0;
      }
#endif
      log_printf("CreateShortCut: INSTALLER CORRUPTED\n"); 
    break;
    case 8:
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf,sizeof(buf)))
      {
        log_printf2("Delete: \"%s\"\n",buf); 
        if (!process_string(buf2,buf,state_install_directory))
        {
		      HANDLE h;
		      WIN32_FIND_DATA fd;
          LPTSTR p=buf;
          _tcscpy(buf,buf2);
          while (*p) p=CharNext(p);
          while (p > buf && *p != _T('\\')) p=CharPrev(buf, p);
          *p=_T('\0');
    		  h=FindFirstFile(buf2,&fd);
		      if (h != INVALID_HANDLE_VALUE)
		      {
            do
            {
			        if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) 
              {
                wsprintf(buf2,_T("%s\\%s"),buf,fd.cFileName);
                log_printf2("Delete: DeleteFile(\"%s\")\n",buf2);
				{
					INT32 args[] = { (INT32)buf2 };
					GETRESOURCE2(tmpbuf, JAVAWS_STATUS_DELETEFILE, args);
					update_status_text(tmpbuf);
				}
                DeleteFile(buf2);
              }
            } while (FindNextFile(h,&fd));
			      FindClose(h);
    		  } 
        }
        else { log_printf("Delete: error parsing parameter\n"); }
        return 0;
      }
      log_printf("Delete: INSTALLER CORRUPTED\n"); 
    break;
    case 9:
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[1],buf,sizeof(buf)))
      {
        int whattodo=thisentry->offsets[0];
        log_printf3("FindWindow: checking for window class: %s . whattodo=%d\n",buf,whattodo); 
        if (whattodo==2)
        {
          if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[2],buf2,sizeof(buf2)))
          {
            while (FindWindow(buf,NULL))
            {
				int r=noisy ? MessageBox(g_hwnd,buf2,g_caption,MB_ABORTRETRYIGNORE) : IDIGNORE;
              if (r == IDABORT) 
              {
                log_printf("FindWindow: user abort\n");
				{
					INT32 args[] = { (INT32)buf };
					GETRESOURCE2(tmpbuf, JAVAWS_STATUS_ABORTED, args);
					update_status_text(tmpbuf);
				}
                return -2;
              }
              if (r == IDIGNORE) 
              {
                log_printf("FindWindow: user ignore\n"); 
                break;
              }
            }
          }
          else
          {
            log_printf("FindWindow: INSTALLER CORRUPTED\n"); 
            break;
          }
        }
        else if (whattodo==1)
        {
          HWND hwnd=FindWindow(buf,NULL);
          if (hwnd) 
          {
            log_printf2("FindWindow: closing window (%s) (one-shot)\n",buf); 
            SendMessage(hwnd,WM_CLOSE,0,0);
          }
        }
        else if (whattodo==0)
        {
          HWND hwnd;
          int r=8;
          while ((hwnd=FindWindow(buf,NULL)))
          {
            SendMessage(hwnd,WM_CLOSE,0,0);
            Sleep(250);
            if (r--<0) 
            {
              break;
            }
          }
          if (!hwnd)
          {
            log_printf3("FindWindow: closed window (%s) (multi-try). %d\n",buf,r); 
          }
          else
          {
            log_printf2("FindWindow: gave up closing window (%s)\n",buf); 
          }
        }
        return 0;
      }
      log_printf("FindWindow: INSTALLER CORRUPTED\n"); 
    break;
    case 10: // MessageBox      
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[1],buf,sizeof(buf)))
      {
	if (!process_string(buf2, buf, state_install_directory)) {
	  log_printf3("MessageBox: %d,\"%s\"\n",thisentry->offsets[0],buf2);
	  if (noisy) {
	    DWORD ret=MessageBox(g_hwnd,buf2,g_caption,thisentry->offsets[0]);
	    if ( ret == IDNO || ret == IDCANCEL) {
	      state_return_value=0;
	    } else {
	      state_return_value=1;
	    }
	  }
	} else { log_printf("MessageBox: error parsing parameter\n"); }
	return 0;
      }
    log_printf("MessageBox: INSTALLER CORRUPTED\n"); 
    break;
   case 13: //RMDir
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf,sizeof(buf)))
      {
        log_printf2("RMDir: \"%s\"\n",buf); 
        if (!process_string(buf2,buf,state_install_directory))
        {
          log_printf2("RMDir: RemoveDirectory(\"%s\")\n",buf2);
		  {
			  INT32 args[] = { (INT32)buf };
			  GETRESOURCE2(tmpbuf, JAVAWS_STATUS_REMOVEDIR, args);
			  update_status_text(tmpbuf);
		  }
	  RemoveDirectory(buf2);
        }
        else { log_printf("RMDir: error parsing parameter\n"); }
        return 0;
      }
      log_printf("RMDir: INSTALLER CORRUPTED\n"); 
    break;
   case 19:
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf,sizeof(buf)))
      {
        log_printf2("RMDirRecursive: \"%s\"\n",buf); 
        if (!process_string(buf2,buf,state_install_directory))
        {
		  SHFILEOPSTRUCT fos;
          log_printf2("RMDirRecursive: RemoveDirectory(\"%s\")\n",buf2);
		  {
			  INT32 args[] = { (INT32)buf };
			  GETRESOURCE2(tmpbuf, JAVAWS_STATUS_REMOVEDIR, args);
			  update_status_text(tmpbuf);
		  }
		  buf2[_tcslen(buf2)]=0;
		  buf2[_tcslen(buf2)+1]=0;
		  if (GetFileAttributes(buf2)!=0xffffffff) {
		    // Only do SHFileOperation if file exists
		    fos.hwnd = g_hwnd;
		    fos.wFunc = FO_DELETE;
		    fos.pFrom = buf2;
		    fos.pTo = NULL;
		    fos.fFlags = FOF_SILENT | FOF_NOERRORUI | FOF_NOCONFIRMATION;
		    fos.hNameMappings = NULL;
		    fos.lpszProgressTitle = NULL;
		    SHFileOperation(&fos);
		  }
        }
        else { log_printf("RMDirRecursive: error parsing parameter\n"); }
        return 0;
      }
      log_printf("RMDirRecursive: INSTALLER CORRUPTED\n"); 
    break;
   case 14: // If
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf,sizeof(buf)))
      {
        log_printf2("If: \"%s\"\n",buf); 
        if (!process_string(buf2,buf,state_install_directory))
        {
		  int  ret=0;
          log_printf2("If(variables evaluated): (\"%s\")\n",buf2);
		  if (!(ret=evalStr(buf2))) {
			  skip=1;
			  return 0;
		  }
		}
        else { log_printf("If: error parsing parameter\n"); }
        return 0;
      }
      log_printf("If: INSTALLER CORRUPTED\n"); 
    break;
   case 15: //EndIf
	   skip=0;
	   return 0;
	break;
   case 16: //RebootBox
	   if (noisy) {
			GETRESOURCE(buf,JAVAWS_MESSAGE_REBOOT);
			if (MessageBox(g_hwnd,buf,g_caption,MB_YESNO|MB_ICONWARNING)==IDYES) {
				if (!ExitWindowsEx(EWX_REBOOT, (DWORD)0)) {
					GETRESOURCE(buf,JAVAWS_ERROR_EXITWINDOWS);
					if (noisy) MessageBox(g_hwnd,buf,g_caption,MB_OK);
				}

			}
	   }
	   return 0;
	break;
   case 17: //Browser
	  if (!noisy) return 0;
      if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf,sizeof(buf)))
      {
        log_printf2("Browser: \"%s\"\n",buf); 
        if (!process_string(buf2,buf,state_install_directory))
        {	
	  ShellExecute(g_hwnd, "open", buf2, "-new", state_install_directory, 0);
	}
        else { log_printf("Browser: error parsing parameter\n"); }
        return 0;
      }
      log_printf("Browser: INSTALLER CORRUPTED\n"); 
    break;
   case 18:  // AltDirBox
	   {
		   TCHAR name[MAX_PATH];
		   TCHAR buf3[MAX_PATH];
		   TCHAR buf4[MAX_PATH];
		   if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf,sizeof(buf)) &&
			   !GetStringFromDataBlock(hFile,offset+thisentry->offsets[1],name,sizeof(name)) &&
			   !GetStringFromDataBlock(hFile,offset+thisentry->offsets[2],buf3,sizeof(buf3)))
		   {
			   if (!process_string(tmpbuf,buf,state_install_directory) &&
				   !process_string(buf4,buf3,state_install_directory) &&
				   !process_string(buf2,name,state_install_directory))
			   {
				   _tcscpy(state_alt_directory,tmpbuf);
				   _tcscpy(state_alt_name, buf2);
				   _tcscpy(state_alt_version,buf4);
				   state_return_value = noisy ? DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIR1),g_hwnd,DirProc2): 1;
			   }
			   return 0;
		   }
	   }
	break;
   case 41:
	   if (!GetStringFromDataBlock(hFile,offset+thisentry->offsets[0],buf,sizeof(buf)))
      {
        log_printf2("MKDir: \"%s\"\n",buf); 
        if (!process_string(buf2,buf,state_install_directory))
        {
          log_printf2("MKDir: recursive_create_directory(\"%s\")\n",buf2);
		  {
			  INT32 args[] = { (INT32)buf };
			  GETRESOURCE2(tmpbuf, JAVAWS_STATUS_MAKEDIR, args);
			  update_status_text(tmpbuf);
		  }
          recursive_create_directory(buf2);
        }
        else { log_printf("RMDir: error parsing parameter\n"); }
        return 0;
      }
      log_printf("MKDir: INSTALLER CORRUPTED\n"); 
    break;
  }
installer_corrupted:
  {
     GETRESOURCE(tmpbuf, JAVAWS_ERROR_INSTCORRUPT);
     if (noisy) MessageBox(g_hwnd,tmpbuf,g_caption,MB_OK|MB_ICONSTOP);
  }
  return -1;
}