Skip to content

Commit

Permalink
Fixed bugs; Various improvements
Browse files Browse the repository at this point in the history
Memory optimization for cached icons.
Fixed TreeListView edit box missing dark mode style.
Site Manager proxy settings are now applied to redirected URL(s).
Fixed scrolling issue when TreeListView items are removed and group host is first visible item.
  • Loading branch information
erickutcher committed Sep 3, 2024
1 parent 504a197 commit 5438e78
Show file tree
Hide file tree
Showing 17 changed files with 318 additions and 151 deletions.
8 changes: 4 additions & 4 deletions HTTP_Downloader/HTTP_Downloader.rc
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ IDI_ICON_TRAY ICON "icon_tray.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,6,2
PRODUCTVERSION 1,0,6,2
FILEVERSION 1,0,6,3
PRODUCTVERSION 1,0,6,3
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -81,12 +81,12 @@ BEGIN
BEGIN
VALUE "Comments", "HTTP Downloader is made free under the GPLv3 license."
VALUE "FileDescription", "HTTP Downloader can download files through HTTP(S), FTP(S), and SFTP connections."
VALUE "FileVersion", "1, 0, 6, 2"
VALUE "FileVersion", "1, 0, 6, 3"
VALUE "InternalName", "HTTP Downloader"
VALUE "LegalCopyright", "Copyright � 2015-2024 Eric Kutcher"
VALUE "OriginalFilename", "HTTP_Downloader.exe"
VALUE "ProductName", "HTTP Downloader"
VALUE "ProductVersion", "1, 0, 6, 2"
VALUE "ProductVersion", "1, 0, 6, 3"
END
END
BLOCK "VarFileInfo"
Expand Down
8 changes: 8 additions & 0 deletions HTTP_Downloader/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Version: 1.0.6.3
Released: 2024-09-03

Memory optimization for cached icons.
Fixed TreeListView edit box missing dark mode style.
Site Manager proxy settings are now applied to redirected URL(s).
Fixed scrolling issue when TreeListView items are removed and group host is first visible item.

Version: 1.0.6.2
Released: 2024-06-23

Expand Down
36 changes: 23 additions & 13 deletions HTTP_Downloader/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5061,7 +5061,7 @@ ICON_INFO *CacheIcon( DOWNLOAD_INFO *di, SHFILEINFO *sfi )
_CoUninitialize();
}

ii = ( ICON_INFO * )GlobalAlloc( GMEM_FIXED, sizeof( DOWNLOAD_INFO ) );
ii = ( ICON_INFO * )GlobalAlloc( GMEM_FIXED, sizeof( ICON_INFO ) );
if ( ii != NULL )
{
ii->file_extension = GlobalStrDupW( di->file_path + di->file_extension_offset );
Expand Down Expand Up @@ -6686,7 +6686,7 @@ DWORD WINAPI AddURL( void *add_info )

if ( proxy_info.type != 0 )
{
di->proxy_info = ( PROXY_INFO * )GlobalAlloc( GPTR, sizeof( PROXY_INFO ) );
di->proxy_info = di->saved_proxy_info = ( PROXY_INFO * )GlobalAlloc( GPTR, sizeof( PROXY_INFO ) );

di->proxy_info->type = proxy_info.type;
di->proxy_info->ip_address = proxy_info.ip_address;
Expand Down Expand Up @@ -6737,7 +6737,6 @@ DWORD WINAPI AddURL( void *add_info )

if ( proxy_info.username != NULL )
{
proxy_username_length = lstrlenA( proxy_info.username );
di->proxy_info->username = ( char * )GlobalAlloc( GMEM_FIXED, sizeof( char ) * ( proxy_username_length + 1 ) );
_memcpy_s( di->proxy_info->username, proxy_username_length + 1, proxy_info.username, proxy_username_length + 1 );
}
Expand All @@ -6748,7 +6747,6 @@ DWORD WINAPI AddURL( void *add_info )

if ( proxy_info.password != NULL )
{
proxy_password_length = lstrlenA( proxy_info.password );
di->proxy_info->password = ( char * )GlobalAlloc( GMEM_FIXED, sizeof( char ) * ( proxy_password_length + 1 ) );
_memcpy_s( di->proxy_info->password, proxy_password_length + 1, proxy_info.password, proxy_password_length + 1 );
}
Expand Down Expand Up @@ -8159,17 +8157,11 @@ void CleanupConnection( SOCKET_CONTEXT *context )
GlobalFree( di->auth_info.username );
GlobalFree( di->auth_info.password );

if ( di->proxy_info != NULL )
if ( di->proxy_info != di->saved_proxy_info )
{
GlobalFree( di->proxy_info->hostname );
GlobalFree( di->proxy_info->punycode_hostname );
GlobalFree( di->proxy_info->w_username );
GlobalFree( di->proxy_info->w_password );
GlobalFree( di->proxy_info->username );
GlobalFree( di->proxy_info->password );
GlobalFree( di->proxy_info->auth_key );
GlobalFree( di->proxy_info );
FreeProxyInfo( &di->saved_proxy_info );
}
FreeProxyInfo( &di->proxy_info );

// Safe to free this here since the listview item will have been removed.
while ( di->range_list != NULL )
Expand Down Expand Up @@ -8573,6 +8565,24 @@ void CleanupConnection( SOCKET_CONTEXT *context )
}
}

void FreeProxyInfo( PROXY_INFO **proxy_info )
{
if ( *proxy_info != NULL )
{
if ( ( *proxy_info )->hostname != NULL ) { GlobalFree( ( *proxy_info )->hostname ); }
if ( ( *proxy_info )->punycode_hostname != NULL ) { GlobalFree( ( *proxy_info )->punycode_hostname ); }
if ( ( *proxy_info )->w_username != NULL ) { GlobalFree( ( *proxy_info )->w_username ); }
if ( ( *proxy_info )->w_password != NULL ) { GlobalFree( ( *proxy_info )->w_password ); }
if ( ( *proxy_info )->username != NULL ) { GlobalFree( ( *proxy_info )->username ); }
if ( ( *proxy_info )->password != NULL ) { GlobalFree( ( *proxy_info )->password ); }
if ( ( *proxy_info )->auth_key != NULL ) { GlobalFree( ( *proxy_info )->auth_key ); }

GlobalFree( *proxy_info );

*proxy_info = NULL;
}
}

void FreePOSTInfo( POST_INFO **post_info )
{
if ( *post_info != NULL )
Expand Down
2 changes: 2 additions & 0 deletions HTTP_Downloader/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ struct DOWNLOAD_INFO
unsigned long long download_speed_limit;
DOWNLOAD_INFO *shared_info;
PROXY_INFO *proxy_info;
PROXY_INFO *saved_proxy_info;
wchar_t *url;
DoublyLinkedList *host_list; // Other hosts that are downloading the file.
DoublyLinkedList *range_list;
Expand Down Expand Up @@ -514,6 +515,7 @@ void RemoveCachedIcon( DOWNLOAD_INFO *di, wchar_t *file_extension = NULL );

void SetSharedInfoStatus( DOWNLOAD_INFO *shared_info );

void FreeProxyInfo( PROXY_INFO **proxy_info );
void FreePOSTInfo( POST_INFO **post_info );
void FreeAuthInfo( AUTH_INFO **auth_info );
void FreeAddInfo( ADD_INFO **add_info );
Expand Down
6 changes: 4 additions & 2 deletions HTTP_Downloader/dark_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4757,7 +4757,8 @@ BOOL CALLBACK EnumChildProc( HWND hWnd, LPARAM /*lParam*/ )
{
ret = _GetClassNameW( hWnd_parent, buf, 64 );
if ( ret == 8 && _StrCmpNW( buf, L"ComboBox", 8 ) == 0 ||
ret == 14 && _StrCmpNW( buf, L"SysIPAddress32", 14 ) == 0 )
ret == 14 && _StrCmpNW( buf, L"SysIPAddress32", 14 ) == 0 ||
ret == 12 && _StrCmpNW( buf, L"TreeListView", 12 ) == 0 )
{
SetSubclass( hWnd, &DMChildEditSubProc, &g_sci_edit_child );

Expand Down Expand Up @@ -5007,7 +5008,8 @@ BOOL CALLBACK EnumTLWProc( HWND hWnd, LPARAM /*lParam*/ )
( ret == 18 && _StrCmpNW( buf, L"class_site_manager", 18 ) == 0 ) ||
( ret == 23 && _StrCmpNW( buf, L"class_check_for_updates", 23 ) == 0 ) ||
( ret == 18 && _StrCmpNW( buf, L"class_site_manager", 18 ) == 0 ) ||
( ret == 24 && _StrCmpNW( buf, L"class_fingerprint_prompt", 24 ) == 0 ) )
( ret == 24 && _StrCmpNW( buf, L"class_fingerprint_prompt", 24 ) == 0 ) ||
( ret == 12 && _StrCmpNW( buf, L"TreeListView", 12 ) == 0 ) )
{
BOOL dark = TRUE;
/*WINDOWCOMPOSITIONATTRIBDATA data = { WCA_USEDARKMODECOLORS, &dark, sizeof( dark ) };
Expand Down
8 changes: 4 additions & 4 deletions HTTP_Downloader/dm_version.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
16778754
https://github.com/erickutcher/httpdownloader/releases/download/v1.0.6.2/HTTP_Downloader_DM_32.zip
16778754
https://github.com/erickutcher/httpdownloader/releases/download/v1.0.6.2/HTTP_Downloader_DM_64.zip
16778755
https://github.com/erickutcher/httpdownloader/releases/download/v1.0.6.3/HTTP_Downloader_DM_32.zip
16778755
https://github.com/erickutcher/httpdownloader/releases/download/v1.0.6.3/HTTP_Downloader_DM_64.zip
39 changes: 17 additions & 22 deletions HTTP_Downloader/file_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2398,16 +2398,6 @@ char read_download_history( wchar_t *file_path, bool scroll_to_last_item )

//

// Cache our file's icon.
ICON_INFO *ii = CacheIcon( shared_info, sfi );

if ( ii != NULL )
{
shared_info->icon = &ii->icon;
}

//

SYSTEMTIME st;
FILETIME ft;
ft.dwHighDateTime = shared_info->add_time.HighPart;
Expand Down Expand Up @@ -2995,7 +2985,7 @@ char read_download_history( wchar_t *file_path, bool scroll_to_last_item )
}
}

di->proxy_info = pi;
di->proxy_info = di->saved_proxy_info = pi;
}

//
Expand Down Expand Up @@ -3043,6 +3033,16 @@ char read_download_history( wchar_t *file_path, bool scroll_to_last_item )

SetSharedInfoStatus( shared_info );

//

// Cache our file's icon.
ICON_INFO *ii = CacheIcon( shared_info, sfi );

if ( ii != NULL )
{
shared_info->icon = &ii->icon;
}

continue;
}

Expand Down Expand Up @@ -3097,17 +3097,12 @@ char read_download_history( wchar_t *file_path, bool scroll_to_last_item )
GlobalFree( di->auth_info.username );
GlobalFree( di->auth_info.password );

if ( di->proxy_info != NULL )
// saved_proxy_info equals proxy_info here.
/*if ( di->proxy_info != di->saved_proxy_info )
{
GlobalFree( di->proxy_info->hostname );
GlobalFree( di->proxy_info->punycode_hostname );
GlobalFree( di->proxy_info->w_username );
GlobalFree( di->proxy_info->w_password );
GlobalFree( di->proxy_info->username );
GlobalFree( di->proxy_info->password );
GlobalFree( di->proxy_info->auth_key );
GlobalFree( di->proxy_info );
}
FreeProxyInfo( &di->saved_proxy_info );
}*/
FreeProxyInfo( &di->proxy_info );

while ( di->range_list != NULL )
{
Expand Down Expand Up @@ -3356,7 +3351,7 @@ char save_download_history( wchar_t *file_path )
int proxy_password_length = 0;
int proxy_address_length = 0;

PROXY_INFO *pi = di->proxy_info;
PROXY_INFO *pi = di->saved_proxy_info;
if ( pi != NULL && pi->type != 0 )
{
optional_extra_length += sizeof( unsigned char );
Expand Down
2 changes: 1 addition & 1 deletion HTTP_Downloader/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
#define CURRENT_VERSION_A 1
#define CURRENT_VERSION_B 0
#define CURRENT_VERSION_C 6
#define CURRENT_VERSION_D 2
#define CURRENT_VERSION_D 3

#define CURRENT_VERSION ( ( CURRENT_VERSION_A << 24 ) | \
( CURRENT_VERSION_B << 16 ) | \
Expand Down
Loading

0 comments on commit 5438e78

Please sign in to comment.