From 20f91023217e75644dcaf2a030678dcb578e492e Mon Sep 17 00:00:00 2001 From: kichik Date: Wed, 21 Aug 2002 17:23:46 +0000 Subject: [PATCH] Added a dialog that shows up if compress whole is used and initial uncompressing lasts longer than a second. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@703 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/exehead/fileform.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Source/exehead/fileform.c b/Source/exehead/fileform.c index fc49053d..3f2b3172 100644 --- a/Source/exehead/fileform.c +++ b/Source/exehead/fileform.c @@ -2,6 +2,7 @@ #include "fileform.h" #include "util.h" #include "state.h" +#include "resource.h" #ifdef NSIS_CONFIG_COMPRESSION_SUPPORT #ifdef NSIS_COMPRESS_USE_ZLIB @@ -224,13 +225,20 @@ static int NSISCALL _dodecomp(int offset, HANDLE hFileOut, char *outbuf, int out static char _inbuffer[IBUFSIZE]; static char _outbuffer[OBUFSIZE]; +extern int m_length; +extern int m_pos; +extern BOOL CALLBACK verProc(HWND, UINT, WPARAM, LPARAM); static int NSISCALL __ensuredata(int amount) { + HWND hwnd=NULL; + unsigned int verify_time=GetTickCount()+500; int needed=amount-(dbd_size-dbd_pos); if (needed>0) { SetFilePointer(g_db_hFile,dbd_srcpos,NULL,FILE_BEGIN); SetFilePointer(dbd_hFile,dbd_size,NULL,FILE_BEGIN); + m_length=needed; + m_pos=0; for (;;) { int err; @@ -242,6 +250,24 @@ static int NSISCALL __ensuredata(int amount) do { DWORD r,t; +#ifdef NSIS_CONFIG_VISIBLE_SUPPORT + if (g_inst_cmnheader) + if (!g_inst_cmnheader->silent_install) { + if (hwnd) { + static MSG msg; + m_pos=m_length-(amount-(dbd_size-dbd_pos)); + while (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) DispatchMessage(&msg); + } + else if (GetTickCount() > verify_time) + hwnd=CreateDialogParam( + g_hInstance, + MAKEINTRESOURCE(IDD_VERIFY), + GetDesktopWindow(), + verProc, + (LPARAM)_LANG_UNPACKING + ); + } +#endif//NSIS_CONFIG_VISIBLE_SUPPORT g_inflate_stream.next_out=_outbuffer; g_inflate_stream.avail_out=OBUFSIZE; err=inflate(&g_inflate_stream); @@ -266,6 +292,7 @@ static int NSISCALL __ensuredata(int amount) } SetFilePointer(dbd_hFile,dbd_pos,NULL,FILE_BEGIN); } + if (hwnd) DestroyWindow(hwnd); return 0; }