mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 03:12:59 +00:00
Sync to Wine-0_9:
Vincent Béron <vberon@mecano.gme.usherb.ca> - Allow file:/// protocol to be used to download the Mozilla ActiveX control. - Remove tempfile used to download Mozilla ActiveX control once it's not used anymore. Alexandre Julliard <julliard@winehq.org> - Fixed a handle leak. svn path=/trunk/; revision=18957
This commit is contained in:
parent
91c3198544
commit
37dbc3c7d6
1 changed files with 26 additions and 14 deletions
|
@ -307,6 +307,7 @@ static DWORD WINAPI ThreadFunc( LPVOID info )
|
||||||
{
|
{
|
||||||
IBindStatusCallback *dl;
|
IBindStatusCallback *dl;
|
||||||
static const WCHAR szUrlVal[] = {'M','o','z','i','l','l','a','U','r','l',0};
|
static const WCHAR szUrlVal[] = {'M','o','z','i','l','l','a','U','r','l',0};
|
||||||
|
static const WCHAR szFileProtocol[] = {'f','i','l','e',':','/','/','/',0};
|
||||||
WCHAR path[MAX_PATH], szUrl[MAX_PATH];
|
WCHAR path[MAX_PATH], szUrl[MAX_PATH];
|
||||||
LPWSTR p;
|
LPWSTR p;
|
||||||
STARTUPINFOW si;
|
STARTUPINFOW si;
|
||||||
|
@ -315,6 +316,7 @@ static DWORD WINAPI ThreadFunc( LPVOID info )
|
||||||
DWORD r, sz, type;
|
DWORD r, sz, type;
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
BOOL bCancelled = FALSE;
|
BOOL bCancelled = FALSE;
|
||||||
|
BOOL bTempfile = FALSE;
|
||||||
|
|
||||||
/* find the name of the thing to download */
|
/* find the name of the thing to download */
|
||||||
szUrl[0] = 0;
|
szUrl[0] = 0;
|
||||||
|
@ -329,21 +331,27 @@ static DWORD WINAPI ThreadFunc( LPVOID info )
|
||||||
if( r != ERROR_SUCCESS )
|
if( r != ERROR_SUCCESS )
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
/* built the path for the download */
|
if( !strncmpW(szUrl, szFileProtocol, strlenW(szFileProtocol)) )
|
||||||
p = strrchrW( szUrl, '/' );
|
lstrcpynW( path, szUrl+strlenW(szFileProtocol), MAX_PATH );
|
||||||
if (!p)
|
else
|
||||||
goto end;
|
{
|
||||||
if (!GetTempPathW( MAX_PATH, path ))
|
/* built the path for the download */
|
||||||
goto end;
|
p = strrchrW( szUrl, '/' );
|
||||||
strcatW( path, p+1 );
|
if (!p)
|
||||||
|
goto end;
|
||||||
|
if (!GetTempPathW( MAX_PATH, path ))
|
||||||
|
goto end;
|
||||||
|
strcatW( path, p+1 );
|
||||||
|
|
||||||
/* download it */
|
/* download it */
|
||||||
dl = create_dl(info, &bCancelled);
|
bTempfile = TRUE;
|
||||||
r = URLDownloadToFileW( NULL, szUrl, path, 0, dl );
|
dl = create_dl(info, &bCancelled);
|
||||||
if( dl )
|
r = URLDownloadToFileW( NULL, szUrl, path, 0, dl );
|
||||||
IBindStatusCallback_Release( dl );
|
if( dl )
|
||||||
if( (r != S_OK) || bCancelled )
|
IBindStatusCallback_Release( dl );
|
||||||
goto end;
|
if( (r != S_OK) || bCancelled )
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
/* run it */
|
/* run it */
|
||||||
memset( &si, 0, sizeof si );
|
memset( &si, 0, sizeof si );
|
||||||
|
@ -352,8 +360,12 @@ static DWORD WINAPI ThreadFunc( LPVOID info )
|
||||||
if( !r )
|
if( !r )
|
||||||
goto end;
|
goto end;
|
||||||
WaitForSingleObject( pi.hProcess, INFINITE );
|
WaitForSingleObject( pi.hProcess, INFINITE );
|
||||||
|
CloseHandle( pi.hProcess );
|
||||||
|
CloseHandle( pi.hThread );
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
if( bTempfile )
|
||||||
|
DeleteFileW( path );
|
||||||
EndDialog( hDlg, 0 );
|
EndDialog( hDlg, 0 );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue