2007-03-08 19:00:15 +00:00
|
|
|
/* PROJECT: ReactOS Downloader (was GetFirefox)
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* FILE: base/applications/downloader/download.c
|
|
|
|
* PURPOSE: Displaying a download dialog
|
|
|
|
* COPYRIGHT: Copyright 2001 John R. Sheets (for CodeWeavers)
|
|
|
|
* Copyright 2004 Mike McCormack (for CodeWeavers)
|
|
|
|
* Copyright 2005 Ge van Geldorp (gvg@reactos.org)
|
2007-11-18 13:33:06 +00:00
|
|
|
* Copyright 2007 Dmitry Chapyshev (lentind@yandex.ru)
|
2007-03-08 19:00:15 +00:00
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Based on Wine dlls/shdocvw/shdocvw_main.c
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
#include <shlobj.h>
|
|
|
|
#include <shlwapi.h>
|
|
|
|
#include <urlmon.h>
|
|
|
|
|
|
|
|
#include "resources.h"
|
|
|
|
#include "structures.h"
|
|
|
|
|
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
extern struct Application* SelectedApplication;
|
|
|
|
extern WCHAR Strings [STRING_COUNT][MAX_STRING_LENGHT];
|
|
|
|
|
|
|
|
typedef struct _IBindStatusCallbackImpl
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
|
|
|
const IBindStatusCallbackVtbl *vtbl;
|
|
|
|
LONG ref;
|
|
|
|
HWND hDialog;
|
|
|
|
BOOL *pbCancelled;
|
|
|
|
} IBindStatusCallbackImpl;
|
2007-03-08 19:00:15 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
dlQueryInterface(IBindStatusCallback* This, REFIID riid, void** ppvObject)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
if (NULL == ppvObject)
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
return E_POINTER;
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
2007-10-19 23:05:02 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IBindStatusCallback))
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
IBindStatusCallback_AddRef( This );
|
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-12-27 16:52:25 +00:00
|
|
|
return E_NOINTERFACE;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
dlAddRef(IBindStatusCallback* iface)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
|
2007-10-19 23:05:02 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return InterlockedIncrement(&This->ref);
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI
|
|
|
|
dlRelease(IBindStatusCallback* iface)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
|
|
|
|
DWORD ref = InterlockedDecrement(&This->ref);
|
2007-10-19 23:05:02 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
if( !ref )
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
DestroyWindow( This->hDialog );
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
2007-10-19 23:05:02 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return ref;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
dlOnStartBinding(IBindStatusCallback* iface, DWORD dwReserved, IBinding* pib)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
DPRINT1("OnStartBinding not implemented\n");
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return S_OK;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
dlGetPriority(IBindStatusCallback* iface, LONG* pnPriority)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
DPRINT1("GetPriority not implemented\n");
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return S_OK;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
dlOnLowResource( IBindStatusCallback* iface, DWORD reserved)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
DPRINT1("OnLowResource not implemented\n");
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return S_OK;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
dlOnProgress(IBindStatusCallback* iface, ULONG ulProgress,
|
2007-12-27 16:52:25 +00:00
|
|
|
ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
|
2007-03-08 19:00:15 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
IBindStatusCallbackImpl *This = (IBindStatusCallbackImpl *) iface;
|
|
|
|
HWND Item;
|
|
|
|
LONG r;
|
|
|
|
WCHAR OldText[100];
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
Item = GetDlgItem(This->hDialog, IDC_PROGRESS);
|
|
|
|
if (NULL != Item && 0 != ulProgressMax)
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
SendMessageW(Item, PBM_SETPOS, (ulProgress * 100) / ulProgressMax, 0);
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
Item = GetDlgItem(This->hDialog, IDC_STATUS);
|
|
|
|
if (NULL != Item && NULL != szStatusText)
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
SendMessageW(Item, WM_GETTEXT, sizeof(OldText) / sizeof(OldText[0]),
|
2007-12-27 16:52:25 +00:00
|
|
|
(LPARAM) OldText);
|
2007-10-15 20:45:06 +00:00
|
|
|
if (sizeof(OldText) / sizeof(OldText[0]) - 1 <= wcslen(OldText) || 0 != wcscmp(OldText, szStatusText))
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) szStatusText);
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
|
|
|
}
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
SetLastError(0);
|
|
|
|
r = GetWindowLongPtrW(This->hDialog, GWLP_USERDATA);
|
|
|
|
if (0 != r || 0 != GetLastError())
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
*This->pbCancelled = TRUE;
|
|
|
|
DPRINT("Cancelled\n");
|
|
|
|
return E_ABORT;
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return S_OK;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
dlOnStopBinding(IBindStatusCallback* iface, HRESULT hresult, LPCWSTR szError)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
DPRINT1("OnStopBinding not implemented\n");
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return S_OK;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
dlGetBindInfo(IBindStatusCallback* iface, DWORD* grfBINDF, BINDINFO* pbindinfo)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
DPRINT1("GetBindInfo not implemented\n");
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return S_OK;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
dlOnDataAvailable(IBindStatusCallback* iface, DWORD grfBSCF,
|
2007-12-27 16:52:25 +00:00
|
|
|
DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed)
|
2007-03-08 19:00:15 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
DPRINT1("OnDataAvailable implemented\n");
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return S_OK;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI
|
|
|
|
dlOnObjectAvailable(IBindStatusCallback* iface, REFIID riid, IUnknown* punk)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
DPRINT1("OnObjectAvailable implemented\n");
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return S_OK;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IBindStatusCallbackVtbl dlVtbl =
|
|
|
|
{
|
2007-12-27 16:52:25 +00:00
|
|
|
dlQueryInterface,
|
|
|
|
dlAddRef,
|
|
|
|
dlRelease,
|
|
|
|
dlOnStartBinding,
|
|
|
|
dlGetPriority,
|
|
|
|
dlOnLowResource,
|
|
|
|
dlOnProgress,
|
|
|
|
dlOnStopBinding,
|
|
|
|
dlGetBindInfo,
|
|
|
|
dlOnDataAvailable,
|
|
|
|
dlOnObjectAvailable
|
2007-03-08 19:00:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static IBindStatusCallback*
|
|
|
|
CreateDl(HWND Dlg, BOOL *pbCancelled)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
IBindStatusCallbackImpl *This;
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
This = HeapAlloc(GetProcessHeap(), 0, sizeof(IBindStatusCallbackImpl));
|
|
|
|
This->vtbl = &dlVtbl;
|
|
|
|
This->ref = 1;
|
|
|
|
This->hDialog = Dlg;
|
|
|
|
This->pbCancelled = pbCancelled;
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
return (IBindStatusCallback*) This;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD WINAPI
|
|
|
|
ThreadFunc(LPVOID Context)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
//static const WCHAR szUrl[] = DownloadUrl;
|
|
|
|
IBindStatusCallback *dl;
|
|
|
|
WCHAR path[MAX_PATH];
|
|
|
|
LPWSTR p;
|
|
|
|
STARTUPINFOW si;
|
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
HWND Dlg = (HWND) Context;
|
|
|
|
DWORD r;
|
|
|
|
BOOL bCancelled = FALSE;
|
|
|
|
BOOL bTempfile = FALSE;
|
|
|
|
HKEY hKey;
|
2007-11-25 15:46:06 +00:00
|
|
|
DWORD dwSize = MAX_PATH;
|
2007-10-15 20:45:06 +00:00
|
|
|
|
|
|
|
/* built the path for the download */
|
|
|
|
p = wcsrchr(SelectedApplication->Location, L'/');
|
|
|
|
if (NULL == p)
|
2007-11-25 15:46:06 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
goto end;
|
2007-11-25 15:46:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Create default download path */
|
|
|
|
if (GetWindowsDirectory(path, sizeof(path) / sizeof(WCHAR)))
|
|
|
|
{
|
|
|
|
WCHAR DPath[256];
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
if (i == 3)
|
|
|
|
{
|
|
|
|
DPath[i] = '\0';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
DPath[i] = path[i];
|
|
|
|
}
|
|
|
|
LoadString(GetModuleHandle(NULL), IDS_DOWNLOAD_FOLDER, path, sizeof(path) / sizeof(WCHAR));
|
|
|
|
wcscat((LPWSTR)DPath, path);
|
|
|
|
wcscpy(path, DPath);
|
|
|
|
}
|
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
if (RegOpenKey(HKEY_LOCAL_MACHINE,
|
2007-11-18 13:33:06 +00:00
|
|
|
TEXT("Software\\ReactOS\\Downloader"),
|
2007-11-25 15:46:06 +00:00
|
|
|
&hKey) == ERROR_SUCCESS)
|
2007-10-15 20:45:06 +00:00
|
|
|
{
|
2007-11-25 15:46:06 +00:00
|
|
|
if ((RegQueryValueEx(hKey,
|
2007-10-15 20:45:06 +00:00
|
|
|
L"DownloadFolder",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
(LPBYTE)&path,
|
2007-11-25 15:46:06 +00:00
|
|
|
&dwSize) != ERROR_SUCCESS) && (path[0] == 0))
|
|
|
|
{
|
|
|
|
goto end;
|
|
|
|
}
|
2007-10-15 20:45:06 +00:00
|
|
|
}
|
2007-11-25 15:46:06 +00:00
|
|
|
|
|
|
|
|
2007-10-19 23:05:02 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
if (GetFileAttributes(path) == 0xFFFFFFFF)
|
|
|
|
if (!CreateDirectory((LPCTSTR)path,NULL))
|
|
|
|
{
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
wcscat(path, L"\\");
|
|
|
|
wcscat(path, p + 1);
|
|
|
|
|
|
|
|
/* download it */
|
|
|
|
bTempfile = TRUE;
|
|
|
|
dl = CreateDl(Context, &bCancelled);
|
|
|
|
r = URLDownloadToFileW(NULL, SelectedApplication->Location, path, 0, dl);
|
|
|
|
if (NULL != dl)
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
IBindStatusCallback_Release(dl);
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
2007-10-15 20:45:06 +00:00
|
|
|
if (S_OK != r)
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
MessageBoxW(0,Strings[IDS_DOWNLOAD_ERROR],0,0);
|
|
|
|
goto end;
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
2007-10-15 20:45:06 +00:00
|
|
|
else if (bCancelled)
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
goto end;
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
2007-10-15 20:45:06 +00:00
|
|
|
ShowWindow(Dlg, SW_HIDE);
|
2007-05-16 18:05:03 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
/* run it */
|
|
|
|
memset(&si, 0, sizeof(si));
|
|
|
|
si.cb = sizeof(si);
|
|
|
|
r = CreateProcessW(path, NULL, NULL, NULL, 0, 0, NULL, NULL, &si, &pi);
|
|
|
|
if (0 == r)
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
goto end;
|
2007-12-27 16:52:25 +00:00
|
|
|
}
|
2007-10-15 20:45:06 +00:00
|
|
|
CloseHandle(pi.hThread);
|
|
|
|
WaitForSingleObject(pi.hProcess, INFINITE);
|
|
|
|
CloseHandle(pi.hProcess);
|
|
|
|
|
|
|
|
end:
|
|
|
|
if (bTempfile)
|
|
|
|
{
|
2007-12-27 17:06:30 +00:00
|
|
|
if (bCancelled)
|
|
|
|
DeleteFileW(path);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DWORD dwSize = sizeof(DWORD);
|
|
|
|
DWORD dwValue, dwType = REG_DWORD;
|
|
|
|
if (RegQueryValueEx(hKey,
|
|
|
|
L"DeleteInstaller",
|
|
|
|
NULL,
|
|
|
|
&dwType,
|
|
|
|
(LPBYTE)&dwValue,
|
|
|
|
&dwSize) == ERROR_SUCCESS)
|
|
|
|
if (dwValue == 0x1)
|
|
|
|
DeleteFileW(path);
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
2007-10-15 20:45:06 +00:00
|
|
|
}
|
|
|
|
EndDialog(Dlg, 0);
|
|
|
|
return 0;
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
INT_PTR CALLBACK
|
|
|
|
DownloadProc(HWND Dlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
HANDLE Thread;
|
|
|
|
DWORD ThreadId;
|
|
|
|
HWND Item;
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-10-15 20:45:06 +00:00
|
|
|
switch (Msg)
|
2007-12-27 16:52:25 +00:00
|
|
|
{
|
2007-10-15 20:45:06 +00:00
|
|
|
case WM_INITDIALOG:/*
|
2007-03-08 19:00:15 +00:00
|
|
|
Icon = LoadIconW((HINSTANCE) GetWindowLongPtr(Dlg, GWLP_HINSTANCE),
|
|
|
|
MAKEINTRESOURCEW(IDI_ICON_MAIN));
|
|
|
|
if (NULL != Icon)
|
|
|
|
{
|
|
|
|
SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) Icon);
|
|
|
|
SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) Icon);
|
|
|
|
}*/
|
2007-12-27 16:52:25 +00:00
|
|
|
SetWindowLongPtrW(Dlg, GWLP_USERDATA, 0);
|
|
|
|
Item = GetDlgItem(Dlg, IDC_PROGRESS);
|
|
|
|
if (NULL != Item)
|
|
|
|
{
|
|
|
|
SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0,100));
|
|
|
|
SendMessageW(Item, PBM_SETPOS, 0, 0);
|
|
|
|
}/*
|
2007-03-08 19:00:15 +00:00
|
|
|
Item = GetDlgItem(Dlg, IDC_REMOVE);
|
|
|
|
if (NULL != Item)
|
|
|
|
{
|
|
|
|
if (GetShortcutName(ShortcutName) &&
|
|
|
|
INVALID_FILE_ATTRIBUTES != GetFileAttributesW(ShortcutName))
|
|
|
|
{
|
|
|
|
SendMessageW(Item, BM_SETCHECK, BST_CHECKED, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SendMessageW(Item, BM_SETCHECK, BST_UNCHECKED, 0);
|
|
|
|
ShowWindow(Item, SW_HIDE);
|
|
|
|
}
|
|
|
|
}*/
|
2007-12-27 16:52:25 +00:00
|
|
|
Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId);
|
|
|
|
if (NULL == Thread)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
CloseHandle(Thread);
|
|
|
|
return TRUE;
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-12-27 16:52:25 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
if (wParam == IDCANCEL)
|
|
|
|
{
|
|
|
|
SetWindowLongPtrW(Dlg, GWLP_USERDATA, 1);
|
|
|
|
PostMessage(Dlg, WM_CLOSE, 0, 0);
|
|
|
|
}
|
|
|
|
return FALSE;
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-12-27 16:52:25 +00:00
|
|
|
case WM_CLOSE:
|
|
|
|
EndDialog(Dlg, 0);
|
|
|
|
return TRUE;
|
2007-03-08 19:00:15 +00:00
|
|
|
|
2007-12-27 16:52:25 +00:00
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-03-08 19:00:15 +00:00
|
|
|
}
|