• R/O
  • HTTP
  • SSH
  • HTTPS

thirdparty-altwindirstat: Commit

A - since abandoned - fork of WinDirStat which had some interesting changes.

Original home: https://github.com/ariccio/altWinDirStat


Commit MetaInfo

Révisionc714547b81ba81392e51728a452c42cc5150f119 (tree)
l'heure2016-08-29 10:33:15
AuteurAlexander Riccio <alexander@ricc...>
CommiterAlexander Riccio

Message de Log

tweaks to compile on VC14 toolset, reduce MFC deps

Change Summary

Modification

--- a/WinDirStat/windirstat/COM_helpers.h
+++ b/WinDirStat/windirstat/COM_helpers.h
@@ -38,10 +38,16 @@ class CFileDialogEventHandler final : public IFileDialogEvents, public IFileDial
3838
3939 // IUnknown methods
4040 IFACEMETHODIMP QueryInterface( _In_ REFIID riid, _COM_Outptr_ void** ppv ) {
41+
42+ //#define QITABENT(Cthis, Ifoo) QITABENTMULTI(Cthis, Ifoo, Ifoo)
43+ //#define QITABENTMULTI(Cthis, Ifoo, Iimpl) { &__uuidof(Ifoo), OFFSETOFCLASS(Iimpl, Cthis) }
44+
4145 static const QITAB qit[ ] =
4246 {
43- QITABENT( CFileDialogEventHandler, IFileDialogEvents ),
44- QITABENT( CFileDialogEventHandler, IFileDialogControlEvents ),
47+ //QITABENT( CFileDialogEventHandler, IFileDialogEvents ),
48+ { &__uuidof(IFileDialogEvents), static_cast<int>( OFFSETOFCLASS( IFileDialogEvents, CFileDialogEventHandler ) ) },
49+ //QITABENT( CFileDialogEventHandler, IFileDialogControlEvents ),
50+ { &__uuidof(IFileDialogControlEvents), static_cast<int>( OFFSETOFCLASS( IFileDialogControlEvents, CFileDialogEventHandler ) ) },
4551 { 0 }
4652 #pragma warning( suppress: 4365)
4753 };
--- a/WinDirStat/windirstat/ChildrenHeapManager.h
+++ b/WinDirStat/windirstat/ChildrenHeapManager.h
@@ -62,9 +62,11 @@ class Children_String_Heap_Manager final {
6262
6363 public:
6464 Children_String_Heap_Manager( _In_ const rsize_t number_of_characters_needed ) /* : buffer_ptr { new wchar_t[ number_of_characters_needed ] }*/ {
65- const rsize_t size_of_base_struct = sizeof( Children_String_Heap_Manager_Impl );
65+ constexpr rsize_t size_of_base_struct = sizeof( Children_String_Heap_Manager_Impl );
6666 const rsize_t size_total_needed = ( size_of_base_struct + ( sizeof( wchar_t ) * number_of_characters_needed ) );
6767 m_buffer_impl = reinterpret_cast<Children_String_Heap_Manager_Impl*>( malloc( size_total_needed ) );
68+#pragma message("This is temporary!")
69+#pragma warning(suppress: 6386)
6870 new ( m_buffer_impl ) Children_String_Heap_Manager_Impl( number_of_characters_needed );
6971 }
7072 ~Children_String_Heap_Manager( ) {
--- a/WinDirStat/windirstat/PageGeneral.cpp
+++ b/WinDirStat/windirstat/PageGeneral.cpp
@@ -1,10 +1,11 @@
11 // PageGeneral.cpp - Implementation of CPageGeneral
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
5+
46
57 #pragma once
68
7-#include "stdafx.h"
89
910 #ifndef WDS_PAGEGENERAL_CPP
1011 #define WDS_PAGEGENERAL_CPP
--- a/WinDirStat/windirstat/PageTreemap.cpp
+++ b/WinDirStat/windirstat/PageTreemap.cpp
@@ -1,10 +1,10 @@
11 // PageTreemap.cpp - Implementation of CDemoControl and CPageTreemap
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
88
99 #ifndef WDS_PAGETREEMAP_CPP
1010 #define WDS_PAGETREEMAP_CPP
--- a/WinDirStat/windirstat/TreeListControl.cpp
+++ b/WinDirStat/windirstat/TreeListControl.cpp
@@ -1,11 +1,10 @@
11 // TreeListControl.cpp - Implementation of CTreeListItem and CTreeListControl
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
8-
98 #ifndef WDS_TREELISTCONTROL_CPP
109 #define WDS_TREELISTCONTROL_CPP
1110
@@ -301,7 +300,7 @@ void CTreeListItem::childNotNull( _In_ const CTreeListItem* const aTreeListChild
301300
302301
303302 //TODO: This should be reversed (i.e. CTreeListControl::SortChildren( _Inout_ CTreeListItem* const item ) )
304-_Pre_satisfies_( this->m_vi._Myptr != nullptr )
303+_Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
305304 void CTreeListItem::SortChildren( _In_ const CTreeListControl* const ctrl ) {
306305 ASSERT( CTreeListItem::IsVisible( ) );
307306
@@ -508,7 +507,7 @@ const COLORREF CTreeListItem::Concrete_ItemTextColor( ) const {
508507 }
509508 //ASSERT( GetItemTextColor( true ) == default_item_text_color( ) );
510509 //return GetItemTextColor( true ); // The rest is not colored
511- return default_item_text_color( ); // The rest is not colored
510+ return COwnerDrawnListItem::default_item_text_color( ); // The rest is not colored
512511 }
513512
514513
@@ -918,7 +917,7 @@ void CTreeListItem::refresh_sizeCache( ) {
918917 ASSERT( m_child_info.m_child_info_ptr != nullptr );
919918 //ASSERT( m_child_info->m_childCount == m_childCount );
920919
921- const auto children_size = m_child_info.m_child_info_ptr->m_childCount;
920+ const std::uint32_t children_size = m_child_info.m_child_info_ptr->m_childCount;
922921 const auto child_array = m_child_info.m_child_info_ptr->m_children.get( );
923922 for ( size_t i = 0; i < children_size; ++i ) {
924923 ( child_array + i )->refresh_sizeCache( );
@@ -930,7 +929,7 @@ void CTreeListItem::refresh_sizeCache( ) {
930929 ASSERT( m_child_info.m_child_info_ptr != nullptr );
931930 //ASSERT( m_child_info->m_childCount == m_childCount );
932931
933- const auto childCount = m_child_info.m_child_info_ptr->m_childCount;
932+ const std::uint32_t childCount = m_child_info.m_child_info_ptr->m_childCount;
934933 const rsize_t stack_alloc_threshold = 128;
935934 if ( childCount < stack_alloc_threshold ) {
936935 std::uint64_t child_totals[ stack_alloc_threshold ];
@@ -1034,13 +1033,13 @@ void CTreeListItem::UpwardGetPathWithoutBackslash( std::wstring& pathBuf ) const
10341033 return;
10351034 }
10361035
1037-_Pre_satisfies_( this->m_vi._Myptr != nullptr )
1036+_Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
10381037 RECT CTreeListItem::GetPlusMinusRect( ) const {
10391038 ASSERT( CTreeListItem::IsVisible( ) );
10401039 return BuildRECT( m_vi->rcPlusMinus );
10411040 }
10421041
1043-_Pre_satisfies_( this->m_vi._Myptr != nullptr )
1042+_Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
10441043 RECT CTreeListItem::GetTitleRect( ) const {
10451044 ASSERT( CTreeListItem::IsVisible( ) );
10461045 return BuildRECT( m_vi->rcTitle );
@@ -1095,9 +1094,14 @@ void CTreeListControl::adjustColumnSize( _In_ const CTreeListItem* const item_at
10951094
10961095 const auto w = COwnerDrawnListCtrl::GetSubItemWidth( item_at_index, column::COL_NAME ) + 5;
10971096
1098- const auto colWidth = CListCtrl::GetColumnWidth( static_cast<int>( column::COL_NAME ) );
1097+ const int colWidth = GetColumnWidth_LVM_GETCOLUMNWIDTH( m_hWnd, static_cast<int>( column::COL_NAME ) );
1098+ //const auto colWidth = CListCtrl::GetColumnWidth( static_cast<int>( column::COL_NAME ) );
10991099 if ( colWidth < w ) {
1100- VERIFY( CListCtrl::SetColumnWidth( 0, w + colWidth ) );
1100+ //_AFXCMN_INLINE BOOL CListCtrl::SetColumnWidth(_In_ int nCol, _In_ int cx)
1101+ //{ ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0)); }
1102+
1103+ VERIFY( SetColumnWidth_LVM_SETCOLUMNWIDTH( m_hWnd, static_cast<int>( column::COL_NAME ), w + colWidth ) );
1104+ //VERIFY( CListCtrl::SetColumnWidth( 0, w + colWidth ) );
11011105 }
11021106 }
11031107
@@ -1361,7 +1365,7 @@ BEGIN_MESSAGE_MAP(CTreeListControl, COwnerDrawnListCtrl)
13611365 ON_WM_DESTROY()
13621366 END_MESSAGE_MAP()
13631367
1364-_Pre_satisfies_( item->m_vi._Myptr != nullptr ) _Success_( return )
1368+_Pre_satisfies_( item->m_vi._Mypair._Myval2 != nullptr ) _Success_( return )
13651369 const bool CTreeListControl::DrawNodeNullWidth( _In_ const CTreeListItem* const item, _In_ HDC hDC, _In_ const RECT& rcRest, _In_ HDC hDCmem, _In_ const UINT ysrc ) const {
13661370 bool didBitBlt = false;
13671371 auto ancestor = item;
@@ -1888,7 +1892,11 @@ void CTreeListControl::ExpandItemInsertChildren( _In_ const CTreeListItem* const
18881892 CTreeListControl::insertItemsAdjustWidths( item, count, maxwidth, scroll, i );
18891893
18901894 if ( scroll && ( CListCtrl::GetColumnWidth( static_cast<int>( column::COL_NAME ) ) < maxwidth ) ) {
1891- VERIFY( CListCtrl::SetColumnWidth( static_cast<int>( column::COL_NAME ), maxwidth ) );
1895+ //Should I use PathCompactPath (https://msdn.microsoft.com/en-us/library/windows/desktop/bb773575.aspx) here?
1896+ //NOTE: PathCompactPath has a MAX_PATH width
1897+ //See also: PathCompactPathEx (https://msdn.microsoft.com/en-us/library/windows/desktop/bb773578.aspx)
1898+ VERIFY( SetColumnWidth_LVM_SETCOLUMNWIDTH( m_hWnd, static_cast<int>( column::COL_NAME ), maxwidth ) );
1899+ //VERIFY( CListCtrl::SetColumnWidth( static_cast<int>( column::COL_NAME ), maxwidth ) );
18921900 }
18931901 }
18941902
@@ -2083,7 +2091,10 @@ void CTreeListControl::EnsureItemVisible( _In_ const CTreeListItem* const item )
20832091 if ( i == -1 ) {
20842092 return;
20852093 }
2086- VERIFY( CListCtrl::EnsureVisible( i, false ) );
2094+ //_AFXCMN_INLINE BOOL CListCtrl::EnsureVisible(_In_ int nItem, _In_ BOOL bPartialOK)
2095+ //{ ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, LVM_ENSUREVISIBLE, nItem, MAKELPARAM(bPartialOK, 0)); }
2096+ VERIFY( EnsureVisible_LVM_ENSUREVISIBLE( m_hWnd, i, FALSE ) );
2097+ //VERIFY( CListCtrl::EnsureVisible( i, false ) );
20872098 }
20882099
20892100
--- a/WinDirStat/windirstat/TreeListControl.h
+++ b/WinDirStat/windirstat/TreeListControl.h
@@ -171,25 +171,25 @@ class CTreeListItem final : public COwnerDrawnListItem {
171171 PCWSTR const CStyle_GetExtensionStrPtr( ) const;
172172
173173
174- _Pre_satisfies_( this->m_vi._Myptr != nullptr )
174+ _Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
175175 std::int16_t GetIndent( ) const {
176176 ASSERT( IsVisible( ) );
177177 return m_vi->indent;
178178 }
179179
180- _Pre_satisfies_( this->m_vi._Myptr != nullptr )
180+ _Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
181181 void SetExpanded( _In_ const bool expanded = true ) {
182182 ASSERT( IsVisible( ) );
183183 m_vi->isExpanded = expanded;
184184 }
185185
186- _Pre_satisfies_( this->m_vi._Myptr != nullptr )
186+ _Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
187187 void SetPlusMinusRect( _In_ const RECT& rc ) const {
188188 ASSERT( IsVisible( ) );
189189 m_vi->rcPlusMinus = SRECT( rc );
190190 }
191191
192- _Pre_satisfies_( this->m_vi._Myptr != nullptr )
192+ _Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
193193 void SetTitleRect( _In_ const RECT& rc ) const {
194194 ASSERT( IsVisible( ) );
195195 m_vi->rcTitle = SRECT( rc );
@@ -199,7 +199,7 @@ class CTreeListItem final : public COwnerDrawnListItem {
199199
200200
201201 //TODO: This should be reversed (i.e. CTreeListControl::SortChildren( _Inout_ CTreeListItem* const item ) )
202- _Pre_satisfies_( this->m_vi._Myptr != nullptr )
202+ _Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
203203 void SortChildren ( _In_ const CTreeListControl* const ctrl );
204204
205205 _Pre_satisfies_( this->m_parent != NULL )
@@ -211,7 +211,7 @@ class CTreeListItem final : public COwnerDrawnListItem {
211211 return ( m_child_info.m_child_info_ptr != NULL );
212212 }
213213
214- _Pre_satisfies_( this->m_vi._Myptr != nullptr )
214+ _Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
215215 bool IsExpanded( ) const {
216216 ASSERT( IsVisible( ) );
217217 return m_vi->isExpanded;
@@ -221,10 +221,10 @@ class CTreeListItem final : public COwnerDrawnListItem {
221221 return ( m_vi != nullptr );
222222 }
223223
224- _Pre_satisfies_( this->m_vi._Myptr != nullptr )
224+ _Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
225225 RECT GetPlusMinusRect( ) const;
226226
227- _Pre_satisfies_( this->m_vi._Myptr != nullptr )
227+ _Pre_satisfies_( this->m_vi._Mypair._Myval2 != nullptr )
228228 RECT GetTitleRect( ) const;
229229
230230
@@ -331,7 +331,7 @@ class CTreeListControl final : public COwnerDrawnListCtrl {
331331 void EnsureItemVisible ( _In_ const CTreeListItem* const item );
332332 void handle_VK_LEFT ( _In_ const CTreeListItem* const item, _In_ _In_range_( 0, INT32_MAX ) const int i );
333333
334- _Pre_satisfies_( item->m_vi._Myptr != nullptr ) _Success_( return )
334+ _Pre_satisfies_( item->m_vi._Mypair._Myval2 != nullptr ) _Success_( return )
335335 const bool DrawNodeNullWidth ( _In_ const CTreeListItem* const item, _In_ HDC hDC, _In_ const RECT& rcRest, _In_ HDC hDCmem, _In_ const UINT ysrc ) const;
336336 RECT DrawNode_Indented ( _In_ const CTreeListItem* const item, _In_ HDC hDC, _Inout_ RECT& rc, _Inout_ RECT& rcRest ) const;
337337 RECT DrawNode ( _In_ const CTreeListItem* const item, _In_ HDC hDC, _Inout_ RECT& rc ) const;
--- a/WinDirStat/windirstat/colorbutton.cpp
+++ b/WinDirStat/windirstat/colorbutton.cpp
@@ -1,9 +1,8 @@
11 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
2+#include "stdafx.h"
23
34 #pragma once
45
5-#include "stdafx.h"
6-
76 #ifndef WDS_COLORBUTTON_CPP
87 #define WDS_COLORBUTTON_CPP
98
--- a/WinDirStat/windirstat/datastructures.cpp
+++ b/WinDirStat/windirstat/datastructures.cpp
@@ -1,8 +1,8 @@
11 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
2+#include "stdafx.h"
23
34 #pragma once
45
5-#include "stdafx.h"
66
77 #ifndef WDS_DATASTRUCTURES_CPP
88 #define WDS_DATASTRUCTURES_CPP
@@ -179,23 +179,40 @@ SExtensionRecord::SExtensionRecord( ) : files { 0u }, color { 0u }, bytes { 0u }
179179
180180 SExtensionRecord::SExtensionRecord( _In_ std::uint32_t files_in, _In_ std::uint64_t bytes_in, _In_ std::wstring ext_in ) : files { std::move( files_in ) }, bytes { std::move( bytes_in ) }, ext( std::move( ext_in ) ) { }
181181
182-SExtensionRecord::SExtensionRecord( const SExtensionRecord& in ) {
183- /*
184- std::wstring ext;
185- _Field_range_( 0, 4294967295 ) std::uint32_t files;//save 4 bytes :)
186- _Field_range_( 0, 18446744073709551615 ) std::uint64_t bytes;
187- COLORREF color;
188- */
189- ext = in.ext;
190- files = in.files;
191- bytes = in.bytes;
192- color = in.color;
182+//SExtensionRecord::SExtensionRecord( const SExtensionRecord& in ) {
183+// /*
184+// std::wstring ext;
185+// _Field_range_( 0, 4294967295 ) std::uint32_t files;//save 4 bytes :)
186+// _Field_range_( 0, 18446744073709551615 ) std::uint64_t bytes;
187+// COLORREF color;
188+// */
189+// ext = in.ext;
190+// files = in.files;
191+// bytes = in.bytes;
192+// color = in.color;
193+// }
194+
195+
196+SExtensionRecord& SExtensionRecord::operator=( SExtensionRecord&& in ) {
197+ files = std::move( in.files );
198+ bytes = std::move( in.bytes );
199+ ext = std::move( in.ext );
200+ color = std::move( in.color );
201+ return *this;
193202 }
194203
195204 const bool SExtensionRecord::compareSExtensionRecordByExtensionAlpha( const SExtensionRecord& lhs, const SExtensionRecord& rhs ) const {
196205 return ( lhs.ext.compare( rhs.ext ) < 0 );
197206 }
198207
208+//Yes, this is used!
209+SExtensionRecord::SExtensionRecord( SExtensionRecord&& in ) {
210+ ext = std::move( in.ext );
211+ files = std::move( in.files );
212+ bytes = std::move( in.bytes );
213+ color = std::move( in.color );
214+ }
215+
199216 minimal_SExtensionRecord::minimal_SExtensionRecord( ) : files { 0u }, bytes { 0u } { }
200217
201218
--- a/WinDirStat/windirstat/datastructures.h
+++ b/WinDirStat/windirstat/datastructures.h
@@ -86,11 +86,13 @@ protected:
8686 struct SExtensionRecord final {
8787 SExtensionRecord( );
8888
89- SExtensionRecord( const SExtensionRecord& in );
89+ //SExtensionRecord( const SExtensionRecord& in ) = delete;
9090 //SExtensionRecord( SExtensionRecord& in ) = delete;
91+ DISALLOW_COPY_AND_ASSIGN( SExtensionRecord );
9192
9293 //Yes, this is used!
9394 SExtensionRecord( SExtensionRecord&& in );
95+ SExtensionRecord& operator=( SExtensionRecord&& in );
9496
9597 SExtensionRecord( _In_ std::uint32_t files_in, _In_ std::uint64_t bytes_in, _In_ std::wstring ext_in );
9698 /*
--- a/WinDirStat/windirstat/directory_enumeration.cpp
+++ b/WinDirStat/windirstat/directory_enumeration.cpp
@@ -24,8 +24,9 @@ WDS_FILE_INCLUDE_MESSAGE
2424 namespace {
2525 struct FILEINFO final {
2626 FILEINFO( ) { }
27- FILEINFO( const FILEINFO& in ) = delete;
28- FILEINFO& operator=( const FILEINFO& in ) = delete;
27+ //FILEINFO( const FILEINFO& in ) = delete;
28+ //FILEINFO& operator=( const FILEINFO& in ) = delete;
29+ DISALLOW_COPY_AND_ASSIGN( FILEINFO );
2930
3031 FILEINFO& operator=( FILEINFO&& in ) {
3132 length = std::move( in.length );
@@ -43,8 +44,8 @@ namespace {
4344 name = std::move( in.name );
4445 }
4546
46-
47- FILEINFO( _In_ std::uint64_t length_, _In_ FILETIME lastWriteTime_, _In_ DWORD attributes_, _In_z_ wchar_t( &cFileName )[ MAX_PATH ] ) : length { std::move( length_ ) }, lastWriteTime( std::move( lastWriteTime_ ) ), attributes { std::move( attributes_ ) }, name( cFileName ) {
47+ template<size_t size>
48+ FILEINFO( _In_ std::uint64_t length_, _In_ FILETIME lastWriteTime_, _In_ DWORD attributes_, _In_z_ wchar_t( &cFileName )[ size ] ) : length { std::move( length_ ) }, lastWriteTime( std::move( lastWriteTime_ ) ), attributes { std::move( attributes_ ) }, name( cFileName ) {
4849 #ifdef DEBUG
4950 if ( length > 34359738368 ) {
5051 _CrtDbgBreak( );
@@ -91,7 +92,10 @@ namespace {
9192 path = std::move( in.path );
9293 }
9394
94- DIRINFO( _In_ std::uint64_t length_, _In_ FILETIME lastWriteTime_, _In_ DWORD attributes_, _In_z_ wchar_t( &cFileName )[ MAX_PATH ], _In_ std::wstring path_ ) : length { std::move( length_ ) }, lastWriteTime( std::move( lastWriteTime_ ) ), attributes { std::move( attributes_ ) }, name( cFileName ), path( std::move( path_ ) ) { }
95+ template<size_t size>
96+ DIRINFO( _In_ std::uint64_t length_, _In_ FILETIME lastWriteTime_, _In_ DWORD attributes_, _In_z_ wchar_t( &cFileName )[ size ], _In_ std::wstring path_ ) : length { std::move( length_ ) }, lastWriteTime( std::move( lastWriteTime_ ) ), attributes { std::move( attributes_ ) }, name( cFileName ), path( std::move( path_ ) ) { }
97+
98+ DISALLOW_COPY_AND_ASSIGN( DIRINFO );
9599
96100 std::uint64_t length;
97101 FILETIME lastWriteTime;
@@ -130,20 +134,18 @@ WDS_DECLSPEC_NOTHROW void FindFilesLoop( _Inout_ std::vector<FILEINFO>& files, _
130134 else if ( fData.dwFileAttributes bitand FILE_ATTRIBUTE_DIRECTORY ) {
131135 ASSERT( path.substr( path.length( ) - 3, 3 ).compare( L"*.*" ) == 0 );
132136 const std::wstring alt_path_this_dir( path.substr( 0, path.length( ) - 3 ) + fData.cFileName );
133- directories.emplace_back( DIRINFO { UINT64_ERROR,
134- std::move( fData.ftLastWriteTime ),
135- std::move( fData.dwFileAttributes ),
136- fData.cFileName,
137- std::move( alt_path_this_dir )
138- }
139- );
137+ directories.emplace_back( UINT64_ERROR,
138+ std::move( fData.ftLastWriteTime ),
139+ std::move( fData.dwFileAttributes ),
140+ fData.cFileName,
141+ std::move( alt_path_this_dir )
142+ );
140143 }
141144 else {
142- files.emplace_back( FILEINFO { std::move( ( static_cast<std::uint64_t>( fData.nFileSizeHigh ) * ( static_cast<std::uint64_t>( MAXDWORD ) + 1 ) ) + static_cast<std::uint64_t>( fData.nFileSizeLow ) ),
145+ files.emplace_back( std::move( ( static_cast<std::uint64_t>( fData.nFileSizeHigh ) * ( static_cast<std::uint64_t>( MAXDWORD ) + 1 ) ) + static_cast<std::uint64_t>( fData.nFileSizeLow ) ),
143146 fData.ftLastWriteTime,
144147 fData.dwFileAttributes,
145148 fData.cFileName
146- }
147149 );
148150 }
149151 findNextFileRes = FindNextFileW( fDataHand, &fData );
@@ -237,11 +239,10 @@ namespace {
237239 }
238240
239241 TRACE( _T( "FSCTL_GET_NTFS_VOLUME_DATA succeeded!\r\n" ) );
240- files.emplace_back( FILEINFO { static_cast<std::uint64_t>( data_buf.MftValidDataLength.QuadPart ),
241- FILETIME{ 0 }, //fData.ftLastWriteTime, - GetFileTime/GetFileInformationByHandle
242+ files.emplace_back( static_cast<std::uint64_t>( data_buf.MftValidDataLength.QuadPart ),
243+ FILETIME{ }, //fData.ftLastWriteTime, - GetFileTime/GetFileInformationByHandle
242244 static_cast<DWORD>( FILE_ATTRIBUTE_HIDDEN bitor FILE_ATTRIBUTE_SYSTEM bitor FILE_ATTRIBUTE_READONLY ),//fData.dwFileAttributes,
243245 L"$MFT"
244- }
245246 );
246247 (*result_code) = NO_ERROR;
247248 return S_OK;
@@ -332,11 +333,10 @@ namespace {
332333
333334 TRACE( L"Fallback method (GetCompressedFileSize) for \"file\" `%s`, succeeded!\r\n\r\n", path.c_str( ) );
334335
335- files.emplace_back( FILEINFO { static_cast<std::uint64_t>( file_size ),
336+ files.emplace_back( static_cast<std::uint64_t>( file_size ),
336337 FILETIME{ 0 }, //fData.ftLastWriteTime, - GetFileTime/GetFileInformationByHandle
337338 static_cast<DWORD>( FILE_ATTRIBUTE_HIDDEN bitor FILE_ATTRIBUTE_SYSTEM bitor FILE_ATTRIBUTE_READONLY ),//fData.dwFileAttributes,
338339 special_file_name
339- }
340340 );
341341
342342 }
@@ -423,7 +423,7 @@ namespace {
423423 const FILETIME special_file_filetime = { static_cast<DWORD>( file_info->LastWriteTime.HighPart ), static_cast<DWORD>( file_info->LastWriteTime.LowPart ) };
424424 ASSERT( file_info->EndOfFile.QuadPart >= 0 );
425425
426- files.emplace_back( FILEINFO { static_cast<std::uint64_t>( file_info->EndOfFile.QuadPart ), special_file_filetime, file_info->FileAttributes, special_file_name } );
426+ files.emplace_back( static_cast<std::uint64_t>( file_info->EndOfFile.QuadPart ), special_file_filetime, file_info->FileAttributes, special_file_name );
427427 }
428428
429429 void query_special_files( const std::wstring& path, _Inout_ std::vector<FILEINFO>& files, _Inout_ std::vector<DIRINFO>& directories ) {
@@ -994,13 +994,6 @@ WDS_DECLSPEC_NOTHROW const std::uint64_t get_uncompressed_file_size( _In_ const
994994 #endif
995995
996996
997-//Yes, this is used!
998-SExtensionRecord::SExtensionRecord( SExtensionRecord&& in ) {
999- ext = std::move( in.ext );
1000- files = std::move( in.files );
1001- bytes = std::move( in.bytes );
1002- color = std::move( in.color );
1003- }
1004997
1005998
1006999 #else
--- a/WinDirStat/windirstat/dirstatdoc.cpp
+++ b/WinDirStat/windirstat/dirstatdoc.cpp
@@ -1,10 +1,10 @@
11 // dirstatdoc.cpp: Implementation of CDirstatDoc
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
88
99 #ifndef WDS_DIRSTAT_DOC_CPP
1010 #define WDS_DIRSTAT_DOC_CPP
--- a/WinDirStat/windirstat/dirstatview.cpp
+++ b/WinDirStat/windirstat/dirstatview.cpp
@@ -1,10 +1,10 @@
11 // dirstatview.cpp : Implementation of CDirstatView
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
88
99 #ifndef WDS_DIRSTATVIEW_CPP
1010 #define WDS_DIRSTATVIEW_CPP
--- a/WinDirStat/windirstat/globalhelpers.cpp
+++ b/WinDirStat/windirstat/globalhelpers.cpp
@@ -1,10 +1,10 @@
11 // globalhelpers.cpp - Implementation of global helper functions
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
88
99 #ifndef WDS_GLOBALHELPERS_CPP
1010 #define WDS_GLOBALHELPERS_CPP
@@ -739,11 +739,11 @@ void displayWindowsMsgBoxWithMessage( const std::string message ) {
739739 //MessageBoxW( NULL, message.c_str( ), TEXT( "Error" ), MB_OK );
740740
741741 //see: https://code.google.com/p/hadesmem/source/browse/trunk/Include/Common/HadesCommon/I18n.hpp?r=1163
742- auto convert_obj = stdext::cvt::wstring_convert<std::codecvt<wchar_t, char, mbstate_t>, wchar_t>( );
742+ //auto convert_obj = stdext::cvt::wstring_convert<std::codecvt<wchar_t, char, mbstate_t>, wchar_t>( );
743743
744- const auto new_wide_str = convert_obj.from_bytes( message );
745- ::MessageBoxW( NULL, new_wide_str.c_str( ), L"Error", MB_OK | MB_ICONINFORMATION );
746- TRACE( _T( "Error: %s\r\n" ), new_wide_str.c_str( ) );
744+ //const auto new_wide_str = convert_obj.from_bytes( message );
745+ ::MessageBoxA( NULL, message.c_str( ), "Error", MB_OK | MB_ICONINFORMATION );
746+ TRACE( _T( "Error: %S\r\n" ), message.c_str( ) );
747747 }
748748
749749 //This is an error handling function, and is intended to be called rarely!
@@ -999,7 +999,7 @@ void trace_full_path( _In_z_ PCWSTR const path ) {
999999 #endif
10001000
10011001
1002-int GetItemCount_HDM_GETITEMCOUNT( _In_ HWND hWnd ) {
1002+int GetItemCount_HDM_GETITEMCOUNT( _In_ const HWND hWnd ) {
10031003 ASSERT( ::IsWindow( hWnd ) );
10041004 //SendMessage function: https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950.aspx
10051005 //The return value [of SendMessage] specifies the result of the message processing; it depends on the message sent.
@@ -1016,24 +1016,79 @@ int GetItemCount_HDM_GETITEMCOUNT( _In_ HWND hWnd ) {
10161016 }
10171017
10181018
1019-int GetColumnWidth_LVM_GETCOLUMNWIDTH( _In_ HWND hWnd, _In_ _In_range_( >=, 0 ) int nCol ) {
1019+int GetColumnWidth_LVM_GETCOLUMNWIDTH( _In_ const HWND hWnd, _In_ _In_range_( >=, 0 ) const int nCol ) {
10201020 ASSERT( ::IsWindow( hWnd ) );
10211021 //SendMessage function: https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950.aspx
10221022 //The return value [of SendMessage] specifies the result of the message processing; it depends on the message sent.
10231023
10241024 //LVM_GETCOLUMNWIDTH message: https://msdn.microsoft.com/en-us/library/windows/desktop/bb774915.aspx
10251025 //Gets the width of a column in report or list view.
1026+ //wParam
1027+ //The index of the column. This parameter is ignored in list view.
1028+ //lParam
1029+ //Must be zero.
1030+ //Returns the column width if successful, or zero otherwise.
1031+ //If this message is sent to a list-view control with the LVS_REPORT style and the specified column does not exist, the return value is undefined.
1032+
10261033 return static_cast< int >( ::SendMessageW( hWnd, LVM_GETCOLUMNWIDTH, static_cast<WPARAM>( nCol ), 0 ) );
10271034 }
10281035
1036+BOOL SetColumnWidth_LVM_SETCOLUMNWIDTH( _In_ const HWND hWnd, _In_ _In_range_( >=, 0 ) const int nCol, _In_ _In_range_( >=, 0 ) const int cx ) {
1037+ ASSERT( ::IsWindow( hWnd ) );
1038+ //_AFXCMN_INLINE BOOL CListCtrl::SetColumnWidth(_In_ int nCol, _In_ int cx)
1039+ //{ ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, LVM_SETCOLUMNWIDTH, nCol, MAKELPARAM(cx, 0)); }
1040+
1041+ //SendMessage function: https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950.aspx
1042+ //The return value [of SendMessage] specifies the result of the message processing; it depends on the message sent.
1043+
1044+ //LVM_SETCOLUMNWIDTH message: https://msdn.microsoft.com/en-us/library/windows/desktop/bb761163.aspx
1045+ //Changes the width of a column in report-view mode or the width of all columns in list-view mode.
1046+ //wParam
1047+ //Zero-based index of a valid column. For list-view mode, this parameter must be set to zero.
1048+ //lParam
1049+ //New width of the column, in pixels. For report-view mode, the following special values are supported:
1050+ //Returns TRUE if successful, or FALSE otherwise.
1051+
1052+ //Assume that you have a 2-column list-view control with a width of 500 pixels.
1053+ //If the width of column zero is set to 200 pixels, and you send this message with wParam = 1 and lParam = LVSCW_AUTOSIZE_USEHEADER, the second (and last) column will be 300 pixels wide.
1054+
1055+ return static_cast<BOOL>( ::SendMessageW( hWnd, LVM_SETCOLUMNWIDTH, static_cast<WPARAM>( nCol ), MAKELPARAM( cx, 0 ) ) );
1056+ }
1057+
1058+BOOL EnsureVisible_LVM_ENSUREVISIBLE( _In_ const HWND hWnd, _In_ _In_range_( >=, 0 ) const int nItem, _In_ _In_range_( FALSE, TRUE ) const BOOL bPartialOK ) {
1059+ ASSERT( ::IsWindow( hWnd ) );
1060+
1061+ //_AFXCMN_INLINE BOOL CListCtrl::EnsureVisible(_In_ int nItem, _In_ BOOL bPartialOK)
1062+ //{ ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd, LVM_ENSUREVISIBLE, nItem, MAKELPARAM(bPartialOK, 0)); }
1063+
1064+ //SendMessage function: https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950.aspx
1065+ //The return value [of SendMessage] specifies the result of the message processing; it depends on the message sent.
1066+
1067+ //LVM_ENSUREVISIBLE message: https://msdn.microsoft.com/en-us/library/windows/desktop/bb774902.aspx
1068+ //Ensures that a list-view item is either entirely or partially visible, scrolling the list-view control if necessary.
1069+ //wParam
1070+ //The index of the list-view item.
1071+ //lParam
1072+ //A value specifying whether the item must be entirely visible. If this parameter is TRUE, no scrolling occurs if the item is at least partially visible.
1073+ //Returns TRUE if successful, or FALSE otherwise.
1074+ //The message fails if the window style includes LVS_NOSCROLL.
1075+
1076+ return static_cast<BOOL>( ::SendMessageW( hWnd, LVM_ENSUREVISIBLE, static_cast<WPARAM>( nItem ), bPartialOK ) );
1077+ }
1078+
10291079 _Success_( return )
1030-BOOL GetItem_HDM_GETITEM( _In_ _In_range_( >=, 0 ) const int nPos, _Out_ HDITEM* const pHeaderItem, _In_ const HWND hWnd ) {
1080+BOOL GetItem_HDM_GETITEM( _In_ const HWND hWnd, _In_ _In_range_( >=, 0 ) const int nPos, _Out_ HDITEM* const pHeaderItem ) {
1081+ ASSERT( ::IsWindow( hWnd ) );
1082+
10311083 pHeaderItem->mask = HDI_WIDTH;
10321084 //VERIFY( thisHeader->GetItem( 0, &hditem ) );
10331085 /*
10341086 _AFXCMN_INLINE BOOL CHeaderCtrl::GetItem(_In_ int nPos, _Out_ HDITEM* pHeaderItem) const
10351087 { ASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, HDM_GETITEM, nPos, (LPARAM)pHeaderItem); }
10361088 */
1089+ //SendMessage function: https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950.aspx
1090+ //The return value [of SendMessage] specifies the result of the message processing; it depends on the message sent.
1091+
10371092 //HDM_GETITEM message: https://msdn.microsoft.com/en-us/library/windows/desktop/bb775335.aspx
10381093 //Gets information about an item in a header control.
10391094 //Returns TRUE if successful, or FALSE otherwise.
@@ -1057,6 +1112,27 @@ BOOL GetItem_HDM_GETITEM( _In_ _In_range_( >=, 0 ) const int nPos, _Out_ HDITEM*
10571112 return static_cast<BOOL>( get_item_result );
10581113 }
10591114
1115+BOOL SetItem_HDM_SETITEM( _In_ const HWND hWnd, _In_range_( >=, 0 ) const int nPos, _In_ const HDITEM * const pHeaderItem ) {
1116+ ASSERT( ::IsWindow( hWnd ) );
1117+ //_AFXCMN_INLINE BOOL CHeaderCtrl::SetItem(_In_ int nPos, _In_ HDITEM* pHeaderItem)
1118+ //{ ASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, HDM_SETITEM, nPos, (LPARAM)pHeaderItem); }
1119+
1120+ //SendMessage function: https://msdn.microsoft.com/en-us/library/windows/desktop/ms644950.aspx
1121+ //The return value [of SendMessage] specifies the result of the message processing; it depends on the message sent.
1122+
1123+ //HDM_SETITEM message: https://msdn.microsoft.com/en-us/library/windows/desktop/bb775367.aspx
1124+ //Sets the attributes of the specified item in a header control.
1125+ //wParam
1126+ //The current index of the item whose attributes are to be changed.
1127+ //lParam
1128+ //A pointer to an HDITEM structure that contains item information. When this message is sent, the mask member of the structure must be set to indicate which attributes are being set.
1129+ //Returns nonzero upon success, or zero otherwise.
1130+ //The HDITEM structure that supports this message supports item order and image list information. By using these members, you can control the order in which items are displayed and specify images to appear with items.
1131+
1132+ return static_cast<BOOL>( ::SendMessageW( hWnd, HDM_SETITEM, static_cast<WPARAM>( nPos ), reinterpret_cast<LPARAM>( pHeaderItem ) ) );
1133+
1134+ }
1135+
10601136 _Success_( return )
10611137 BOOL GetItemRect_LVM_GETITEMRECT( _In_ const HWND hWnd, _In_ _In_range_( >=, 0 ) const int nItem, _Out_ RECT* const rect, _In_ _In_range_( LVIR_BOUNDS, LVIR_SELECTBOUNDS ) const LONG nCode ) {
10621138 /*
--- a/WinDirStat/windirstat/globalhelpers.h
+++ b/WinDirStat/windirstat/globalhelpers.h
@@ -189,10 +189,13 @@ void trace_full_path( _In_z_ PCWSTR const path );
189189
190190 int GetItemCount_HDM_GETITEMCOUNT( _In_ HWND hWnd );
191191 int GetColumnWidth_LVM_GETCOLUMNWIDTH( _In_ HWND hWnd, _In_ _In_range_( >=, 0 ) int nCol );
192-
192+BOOL SetColumnWidth_LVM_SETCOLUMNWIDTH( _In_ HWND hWnd, _In_ _In_range_( >=, 0 ) int nCol, _In_ _In_range_( >=, 0 ) int cx );
193+BOOL EnsureVisible_LVM_ENSUREVISIBLE( _In_ HWND hWnd, _In_ _In_range_( >=, 0 ) int nItem, _In_ _In_range_( FALSE, TRUE ) BOOL bPartialOK );
193194
194195 _Success_( return )
195-BOOL GetItem_HDM_GETITEM( _In_ _In_range_( >=, 0 ) const int nPos, _Out_ HDITEM* const pHeaderItem, _In_ const HWND hWnd );
196+BOOL GetItem_HDM_GETITEM( _In_ const HWND hWnd, _In_ _In_range_( >=, 0 ) const int nPos, _Out_ HDITEM* const pHeaderItem );
197+
198+BOOL SetItem_HDM_SETITEM( _In_ const HWND hWnd, _In_ _In_range_( >=, 0 ) int nPos, _In_ const HDITEM* pHeaderItem );
196199
197200 _Success_( return )
198201 BOOL GetItemRect_LVM_GETITEMRECT( _In_ const HWND hWnd, _In_ _In_range_( >=, 0 ) const int nItem, _Out_ RECT* const rect, _In_ _In_range_( LVIR_BOUNDS, LVIR_SELECTBOUNDS ) const LONG nCode );
--- a/WinDirStat/windirstat/graphview.cpp
+++ b/WinDirStat/windirstat/graphview.cpp
@@ -1,11 +1,10 @@
11 // graphview.cpp: Implementation of CGraphView
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
8-
98 #ifndef WDS_GRAPHVIEW_CPP
109 #define WDS_GRAPHVIEW_CPP
1110
--- a/WinDirStat/windirstat/mainframe.cpp
+++ b/WinDirStat/windirstat/mainframe.cpp
@@ -1,11 +1,10 @@
11 // mainframe.cpp - Implementation of WDSSplitterWnd, CPacmanControl and CMainFrame
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
8-
98 #ifndef WDS_MAINFRAME_CPP
109 #define WDS_MAINFRAME_CPP
1110
--- a/WinDirStat/windirstat/mountpoints.cpp
+++ b/WinDirStat/windirstat/mountpoints.cpp
@@ -1,10 +1,10 @@
11 // mountpoints.h - Declaration of CMountPoins
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4-#pragma once
5-
64 #include "stdafx.h"
75
6+#pragma once
7+
88 #ifndef WDS_MOUNTPOINTS_CPP_INCLUDED
99 #define WDS_MOUNTPOINTS_CPP_INCLUDED
1010
--- a/WinDirStat/windirstat/options.cpp
+++ b/WinDirStat/windirstat/options.cpp
@@ -1,12 +1,10 @@
11 // options.cpp - Implementation of CPersistence, COptions and CRegistryUser
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4-
4+#include "stdafx.h"
55
66 #pragma once
77
8-#include "stdafx.h"
9-
108 #ifndef WDS_OPTIONS_CPP
119 #define WDS_OPTIONS_CPP
1210
@@ -66,6 +64,7 @@ namespace registry_strings {
6664 namespace helpers {
6765 std::wstring generalized_make_entry( _In_z_ const PCWSTR name, _In_z_ const PCWSTR entry_fmt_str ) {
6866 //TODO: uses heap!
67+#pragma warning(suppress:4774)
6968 const auto chars_needed = ( _scwprintf( entry_fmt_str, name ) + 1 );
7069 std::unique_ptr<_Null_terminated_ wchar_t[]> char_buffer_ptr = std::make_unique<wchar_t[ ]>( static_cast<size_t>( chars_needed ) );
7170
@@ -433,12 +432,16 @@ void CPersistence::SetRect( _In_z_ const PCWSTR entry, _In_ const RECT rc ) {
433432 _Success_( SUCCEEDED( return ) )
434433 const HRESULT CPersistence::GetRect( _In_ const std::wstring entry, _Out_ RECT* const rc ) {
435434 const auto s = CRegistryUser::GetProfileString_( registry_strings::sectionPersistence, entry.c_str( ), _T( "" ) );
436- RECT tmp;
437- const auto r = swscanf_s( s.c_str( ), _T( "%d,%d,%d,%d" ), &tmp.left, &tmp.top, &tmp.right, &tmp.bottom );
435+ //RECT tmp;
436+ int left = 0;
437+ int top = 0;
438+ int right = 0;
439+ int bottom = 0;
440+ const auto r = swscanf_s( s.c_str( ), _T( "%d,%d,%d,%d" ), &left, &top, &right, &bottom );
438441 static_assert( SUCCEEDED( S_OK ), "Bad success return value!" );
439442 if ( r == 4 ) {
440- TRACE( _T( "swscanf_s succeeded! read in rectangle: %d,%d,%d,%d\r\n" ), tmp.left, tmp.top, tmp.right, tmp.bottom );
441- (*rc) = tmp;
443+ TRACE( _T( "swscanf_s succeeded! read in rectangle: %l,%l,%l,%l\r\n" ), left, top, right, bottom );
444+ (*rc) = { left, top, right, bottom };
442445 return S_OK;
443446 }
444447
--- a/WinDirStat/windirstat/ownerdrawnlistcontrol.h
+++ b/WinDirStat/windirstat/ownerdrawnlistcontrol.h
@@ -439,7 +439,7 @@ protected:
439439
440440 namespace {
441441 static INT CALLBACK _CompareFunc( _In_ const LPARAM lParam1, _In_ const LPARAM lParam2, _In_ const LPARAM lParamSort ) {
442- const auto sorting = reinterpret_cast<const SSorting*>( lParamSort );
442+ const SSorting* const sorting = reinterpret_cast<const SSorting*>( lParamSort );
443443 return reinterpret_cast<const COwnerDrawnListItem*>( lParam1 )->CompareS( reinterpret_cast<const COwnerDrawnListItem*>( lParam2 ), *sorting );
444444 }
445445
@@ -728,8 +728,8 @@ protected:
728728 VERIFY( thisHeaderCtrl->GetOrderArray( order_temp, resize_size )) ;
729729
730730 const rsize_t thisLoopSize = static_cast<rsize_t>( resize_size );
731- if ( is_right_aligned_cache.empty( ) ) {
732- repopulate_right_aligned_cache( is_right_aligned_cache, thisLoopSize, thisHeaderCtrl->m_hWnd, this );
731+ if ( m_is_right_aligned_cache.empty( ) ) {
732+ repopulate_right_aligned_cache( m_is_right_aligned_cache, thisLoopSize, thisHeaderCtrl->m_hWnd, this );
733733 }
734734 ASSERT( thisLoopSize < 8 );
735735
@@ -756,7 +756,7 @@ protected:
756756 build_focusLefts_from_drawable_rects( thisLoopSize, rects_draw, focusLefts_temp );
757757
758758
759- draw_proper_text_for_each_column( item, thisLoopSize, subitems, hInMemoryDeviceContext, rects_draw, pDestinationDrawItemStruct, focusLefts_temp, showSelectionAlways, bIsFullRowSelection, is_right_aligned_cache, this );
759+ draw_proper_text_for_each_column( item, thisLoopSize, subitems, hInMemoryDeviceContext, rects_draw, pDestinationDrawItemStruct, focusLefts_temp, showSelectionAlways, bIsFullRowSelection, m_is_right_aligned_cache, this );
760760
761761 const int (&focusLefts)[ stack_array_size ] = focusLefts_temp;
762762
@@ -774,7 +774,7 @@ protected:
774774 }
775775 public:
776776 static const CRuntimeClass classCOwnerDrawnListCtrl;
777- virtual CRuntimeClass* GetRuntimeClass( ) const {
777+ virtual CRuntimeClass* GetRuntimeClass( ) const override {
778778 return ((CRuntimeClass*)(&COwnerDrawnListCtrl::classCOwnerDrawnListCtrl) );
779779 }
780780
@@ -786,8 +786,7 @@ public:
786786
787787 virtual ~COwnerDrawnListCtrl( ) = default;
788788
789- COwnerDrawnListCtrl& operator=( const COwnerDrawnListCtrl& in ) = delete;
790- COwnerDrawnListCtrl( const COwnerDrawnListCtrl& in ) = delete;
789+ DISALLOW_COPY_AND_ASSIGN( COwnerDrawnListCtrl );
791790
792791 void LoadPersistentAttributes( ) {
793792 //TRACE statements in headers output the FULL source file path. Ick.
@@ -865,10 +864,12 @@ public:
865864 const auto maxWidth = ( GetColumnWidth_LVM_GETCOLUMNWIDTH( m_hWnd, static_cast<int>( i ) ) * 2 );
866865 #pragma push_macro("min")
867866 #undef min
868- const auto w = ( col_order_array[ i ], maxWidth );
867+ //I'm an idiot, somehow I deleted std::min!
868+ const auto w = std::min( col_order_array[ i ], maxWidth );
869869 #pragma pop_macro("min")
870870
871- VERIFY( CListCtrl::SetColumnWidth( static_cast<int>( i ), w ) );
871+ VERIFY( SetColumnWidth_LVM_SETCOLUMNWIDTH( m_hWnd, static_cast<int>( i ), w ) );
872+ //VERIFY( CListCtrl::SetColumnWidth( static_cast<int>( i ), w ) );
872873 }
873874 // We refrain from saving the sorting because it is too likely, that users start up with insane settings and don't get it.
874875 }
@@ -878,8 +879,8 @@ public:
878879 int col_array[ col_array_size ] = { 0 };
879880
880881 //const auto itemCount = CListCtrl::GetHeaderCtrl( )->GetItemCount( );
881- const auto itemCount = GetItemCount_HDM_GETITEMCOUNT( CListCtrl::GetHeaderCtrl( )->m_hWnd );
882-
882+ const int itemCount = GetItemCount_HDM_GETITEMCOUNT( CListCtrl::GetHeaderCtrl( )->m_hWnd );
883+ ASSERT( itemCount > -1 );
883884 if ( itemCount < 2 ) {
884885 //CPersistence expects more than one item arrays
885886 //Since that's a nonsensical condition, no point in continuing.
@@ -903,14 +904,26 @@ public:
903904 CPersistence::SetColumnOrder( m_persistent_name, col_array, static_cast<rsize_t>( itemCount ) );
904905
905906 for ( INT_PTR i = 0; i < itemCount; i++ ) {
906- col_array[ i ] = CListCtrl::GetColumnWidth( static_cast<int>( i ) );
907+ col_array[ i ] = GetColumnWidth_LVM_GETCOLUMNWIDTH( m_hWnd, static_cast<int>( i ) );
908+ //col_array[ i ] = CListCtrl::GetColumnWidth( static_cast<int>( i ) );
907909 }
908910 CPersistence::SetColumnWidths( m_persistent_name, col_array, static_cast<rsize_t>( itemCount ) );
909911 }
910912
911913 void SortItems( ) {
912- VERIFY( CListCtrl::SortItems( &_CompareFunc, reinterpret_cast<DWORD_PTR>( &m_sorting ) ) );
913- auto hditem = zero_init_struct<HDITEM>( );
914+
915+ //_AFXCMN_INLINE BOOL CListCtrl::SortItems(_In_ PFNLVCOMPARE pfnCompare, _In_ DWORD_PTR dwData)
916+ //{ ASSERT(::IsWindow(m_hWnd)); ASSERT((CWnd::GetStyle() & LVS_OWNERDATA)==0); return (BOOL) ::SendMessage(m_hWnd, LVM_SORTITEMS, dwData, (LPARAM)pfnCompare); }
917+ ASSERT( ::IsWindow( m_hWnd ) );
918+ ASSERT( ( CWnd::GetStyle( ) & LVS_OWNERDATA ) == 0 );
919+
920+ VERIFY( static_cast<BOOL>( ::SendMessageW( m_hWnd, LVM_SORTITEMS, reinterpret_cast<WPARAM>( &m_sorting ), reinterpret_cast<LPARAM>( &_CompareFunc ) ) ) );
921+
922+ static_assert( std::is_convertible<WPARAM, DWORD_PTR>::value, "Why the hell does CListCtrl::SortItems take a DWORD_PTR and SendMessage takes a WPARAM?" );
923+
924+ //VERIFY( CListCtrl::SortItems( &_CompareFunc, reinterpret_cast<DWORD_PTR>( &m_sorting ) ) );
925+
926+ HDITEM hditem = { };
914927 auto thisHeaderCtrl = CListCtrl::GetHeaderCtrl( );
915928
916929 //http://msdn.microsoft.com/en-us/library/windows/desktop/bb775247(v=vs.85).aspx specifies 260
@@ -924,7 +937,8 @@ public:
924937 hditem.cchTextMax = text_char_count;
925938
926939 if ( m_indicatedColumn != -1 ) {
927- VERIFY( thisHeaderCtrl->GetItem( m_indicatedColumn, &hditem ) );
940+ VERIFY( GetItem_HDM_GETITEM( thisHeaderCtrl->m_hWnd, m_indicatedColumn, &hditem ) );
941+ //VERIFY( thisHeaderCtrl->GetItem( m_indicatedColumn, &hditem ) );
928942 //text.ReleaseBuffer( );
929943 //text = text.Mid( 2 );
930944 //PWSTR text_str = &( text_buffer_1[ 2 ] );
@@ -932,14 +946,16 @@ public:
932946 //hditem.pszText = text.GetBuffer( text_char_count );
933947 hditem.pszText = &( text_buffer_1[ 2 ] );
934948 hditem.cchTextMax = ( text_char_count - 3 );
935- VERIFY( thisHeaderCtrl->SetItem( m_indicatedColumn, &hditem ) );
949+ //VERIFY( thisHeaderCtrl->SetItem( m_indicatedColumn, &hditem ) );
950+ VERIFY( SetItem_HDM_SETITEM( thisHeaderCtrl->m_hWnd, m_indicatedColumn, &hditem ) );
936951 //text.ReleaseBuffer( );
937952 }
938953
939954 //hditem.pszText = text.GetBuffer( text_char_count );
940955 hditem.pszText = text_buffer_1;
941956 hditem.cchTextMax = text_char_count;
942- VERIFY( thisHeaderCtrl->GetItem( m_sorting.column1, &hditem ) );
957+ VERIFY( GetItem_HDM_GETITEM( thisHeaderCtrl->m_hWnd, m_sorting.column1, &hditem ) );
958+ //VERIFY( thisHeaderCtrl->GetItem( m_sorting.column1, &hditem ) );
943959 //text.ReleaseBuffer( );
944960
945961 _Null_terminated_ wchar_t text_buffer_2[ text_char_count ] = { 0 };
@@ -953,8 +969,8 @@ public:
953969 }
954970 //hditem.pszText = text.GetBuffer( text_char_count );
955971 hditem.pszText = text_buffer_2;
956- VERIFY( thisHeaderCtrl->SetItem( m_sorting.column1, &hditem ) );
957-
972+ //VERIFY( thisHeaderCtrl->SetItem( m_sorting.column1, &hditem ) );
973+ VERIFY( SetItem_HDM_SETITEM( thisHeaderCtrl->m_hWnd, m_sorting.column1, &hditem ) );
958974 //goddamnit, static_assert is AWESOME when combined with template metaprogramming!
959975 static_assert( std::is_convertible<std::underlying_type<column::ENUM_COL>::type, decltype( m_indicatedColumn )>::value, "m_sorting.column1 MUST be convertible to an ENUM_COL!" );
960976 //static_assert( std::is_convertible<std::underlying_type<column::ENUM_COL>::type, std::int8_t>::value, "m_sorting.column1 MUST be convertible to an ENUM_COL!" );
@@ -971,7 +987,23 @@ public:
971987 fi.flags = LVFI_PARAM;
972988 fi.lParam = reinterpret_cast<LPARAM>( item );
973989
974- const auto i = static_cast<INT>( CListCtrl::FindItem( &fi ) );
990+ //_AFXCMN_INLINE int CListCtrl::FindItem(_In_ LVFINDINFO* pFindInfo, _In_ int nStart = -1) const
991+ //{ ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, LVM_FINDITEM, nStart, (LPARAM)pFindInfo); }
992+ //LVM_FINDITEM message: https://msdn.microsoft.com/en-us/library/windows/desktop/bb774903.aspx
993+ //Searches for a list-view item with the specified characteristics.
994+ //wParam
995+ //The index of the item to begin the search with or -1 to start from the beginning. The specified item is itself excluded from the search.
996+ //lParam
997+ //A pointer to an LVFINDINFO structure that contains information about what to search for.
998+ //Returns the index of the item if successful, or -1 otherwise.
999+
1000+ //LVFINDINFO structure: https://msdn.microsoft.com/en-us/library/windows/desktop/bb774745.aspx
1001+ //Contains information used when searching for a list-view item.
1002+ ASSERT( ::IsWindow( m_hWnd ) );
1003+
1004+
1005+ //const int i = static_cast<INT>( CListCtrl::FindItem( &fi ) );
1006+ const int i = static_cast<int>( ::SendMessageW( m_hWnd, LVM_FINDITEM, static_cast<WPARAM>( -1 ), reinterpret_cast<LPARAM>( &fi ) ) );
9751007
9761008 return i;
9771009 }
@@ -991,6 +1023,9 @@ public:
9911023 m_yFirstItem = rc.top;
9921024 }
9931025 else {
1026+ //_AFXCMN_INLINE int CListCtrl::InsertItem(_In_ int nItem, _In_z_ LPCTSTR lpszItem, _In_ int nImage)
1027+ //{ ASSERT(::IsWindow(m_hWnd)); return InsertItem(LVIF_TEXT|LVIF_IMAGE, nItem, lpszItem, 0, 0, nImage, 0); }
1028+
9941029 CListCtrl::InsertItem( 0, _T( "_tmp" ), 0 );
9951030 RECT rc;
9961031 //VERIFY( CListCtrl::GetItemRect( 0, &rc, LVIR_BOUNDS ) );
@@ -1023,13 +1058,17 @@ _AFXCMN_INLINE BOOL CListCtrl::DeleteItem(_In_ int nItem)
10231058 return;
10241059 }
10251060 const auto w = COwnerDrawnListCtrl::GetSubItemWidth( item, col );
1061+ //_AFXCMN_INLINE int CListCtrl::GetStringWidth(_In_z_ LPCTSTR lpsz) const
1062+ //{ ASSERT(::IsWindow(m_hWnd)); return (int) ::SendMessage(m_hWnd, LVM_GETSTRINGWIDTH, 0, (LPARAM)lpsz); }
1063+
10261064 ASSERT( w == ( CListCtrl::GetStringWidth( item->m_name ) + 20 ) );
10271065 //ASSERT( w == ( GetStringWidth( item->m_name ) + 10 ) );
10281066 if ( w > width ) {
10291067 width = w;
10301068 }
10311069 }
1032- VERIFY( CListCtrl::SetColumnWidth( col, width + 5 ) );
1070+ VERIFY( SetColumnWidth_LVM_SETCOLUMNWIDTH( m_hWnd, col, width + 5 ) );
1071+ //VERIFY( CListCtrl::SetColumnWidth( col, width + 5 ) );
10331072 }
10341073
10351074 void InsertListItem( _In_ _In_range_( 0, INT32_MAX ) const INT_PTR i, _In_ const COwnerDrawnListItem* const item ) {
@@ -1045,15 +1084,20 @@ _AFXCMN_INLINE BOOL CListCtrl::DeleteItem(_In_ int nItem)
10451084 }
10461085
10471086 void AddExtendedStyle( _In_ const DWORD exStyle ) {
1087+ //_AFXCMN_INLINE DWORD CListCtrl::SetExtendedStyle(_In_ DWORD dwNewStyle)
1088+ //{ ASSERT(::IsWindow(m_hWnd)); return (DWORD) ::SendMessage(m_hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, (LPARAM) dwNewStyle); }
10481089 CListCtrl::SetExtendedStyle( CListCtrl::GetExtendedStyle( ) bitor exStyle );
10491090 }
10501091
10511092 //COLORREF GetItemSelectionBackgroundColor ( _In_ _In_range_( 0, INT_MAX ) const INT i ) const;
10521093
10531094 COLORREF GetItemSelectionTextColor( _In_ _In_range_( 0, INT_MAX ) const INT i ) const {
1054- auto selected = ( CListCtrl::GetItemState( i, LVIS_SELECTED ) & LVIS_SELECTED ) != 0;
1095+ //_AFXCMN_INLINE UINT CListCtrl::GetItemState(_In_ int nItem, _In_ UINT nMask) const
1096+ //{ ASSERT(::IsWindow(m_hWnd)); return (UINT) ::SendMessage(m_hWnd, LVM_GETITEMSTATE, nItem, nMask); }
1097+
1098+ const bool selected = ( CListCtrl::GetItemState( i, LVIS_SELECTED ) & LVIS_SELECTED ) != 0;
10551099 if ( selected && m_showFullRowSelection && ( COwnerDrawnListCtrl::HasFocus( ) || COwnerDrawnListCtrl::IsShowSelectionAlways( ) ) ) {
1056- return GetHighlightTextColor( );
1100+ return COwnerDrawnListCtrl::GetHighlightTextColor( );
10571101 }
10581102 return ::GetSysColor( COLOR_WINDOWTEXT );
10591103 }
@@ -1066,9 +1110,10 @@ _AFXCMN_INLINE BOOL CListCtrl::DeleteItem(_In_ int nItem)
10661110 HDITEM hditem = { };
10671111 hditem.mask = HDI_WIDTH;
10681112
1069- VERIFY( GetItem_HDM_GETITEM( 0, &hditem, header_hWnd ) );
1113+ VERIFY( GetItem_HDM_GETITEM( header_hWnd, 0, &hditem ) );
10701114
1071- VERIFY( CListCtrl::GetItemRect( item, rc, LVIR_LABEL ) );
1115+ //VERIFY( CListCtrl::GetItemRect( item, rc, LVIR_LABEL ) );
1116+ VERIFY( GetItemRect_LVM_GETITEMRECT( m_hWnd, item, &rc, LVIR_LABEL ) );
10721117 rc.left = rc.right - hditem.cxy;
10731118 }
10741119 else {
@@ -1137,9 +1182,9 @@ BOOL CListCtrl::GetSubItemRect(int iItem, int iSubItem, int nArea, CRect& ref) c
11371182 _Must_inspect_result_ _Success_( return != NULL ) _Ret_maybenull_
11381183 COwnerDrawnListItem* GetItem( _In_ _In_range_( 0, INT_MAX ) const int i ) const {
11391184 ASSERT( i < CListCtrl::GetItemCount( ) );
1140- const auto itemCount = CListCtrl::GetItemCount( );
1185+ const int itemCount = CListCtrl::GetItemCount( );
11411186 if ( i < itemCount ) {
1142- return reinterpret_cast< COwnerDrawnListItem* >( CListCtrl::GetItemData( static_cast<int>( i ) ) );
1187+ return reinterpret_cast< COwnerDrawnListItem* >( CListCtrl::GetItemData( i ) );
11431188 }
11441189 return NULL;
11451190 }
@@ -1373,7 +1418,7 @@ public:
13731418 HDITEM hditem = { };
13741419 hditem.mask = HDI_FORMAT;
13751420 //VERIFY( thisHeaderControl->GetItem( col, &hditem ) );
1376- VERIFY( GetItem_HDM_GETITEM( col, &hditem, hWnd ) );
1421+ VERIFY( GetItem_HDM_GETITEM( hWnd, col, &hditem ) );
13771422 return ( hditem.fmt bitand HDF_RIGHT ) != 0;
13781423 }
13791424
@@ -1514,7 +1559,7 @@ public:
15141559 SSorting m_sorting;
15151560 //C4820: 'COwnerDrawnListCtrl' : '3' bytes padding added after data member 'COwnerDrawnListCtrl::m_indicatedColumn'
15161561 _Field_range_( 0, 8 ) std::int8_t m_indicatedColumn;
1517- std::vector<bool> is_right_aligned_cache;
1562+ std::vector<bool> m_is_right_aligned_cache;
15181563
15191564
15201565 private:
@@ -1541,7 +1586,7 @@ private:
15411586 //Probably NOT vectorizable anyway.
15421587 //Not vectorized: 1304, loop includes assignments of different sizes
15431588 for ( INT i = 0; i < header_ctrl_item_count; i++ ) {
1544- VERIFY( GetItem_HDM_GETITEM( columnOrder[ i ], &hdi, header_hWnd ) );
1589+ VERIFY( GetItem_HDM_GETITEM( header_hWnd, columnOrder[ i ], &hdi ) );
15451590
15461591 //VERIFY( header_ctrl->GetItem( columnOrder[ i ], &hdi ) );
15471592 x += hdi.cxy;
--- a/WinDirStat/windirstat/stdafx.h
+++ b/WinDirStat/windirstat/stdafx.h
@@ -216,6 +216,7 @@ static_assert( _WIN32_WINNT >= 0x0600, "" );
216216
217217
218218
219+#pragma warning(disable:4710) //The given function was selected for inline expansion, but the compiler did not perform the inlining.
219220
220221 #include <afxwin.h> // MFC Core //MUST BE INCLUDED FIRST!!!!!!!!!!!!!
221222
@@ -303,7 +304,7 @@ extern WTL::CAppModule _Module;
303304 //#include <afxmt.h> // MFC Multithreading
304305
305306
306-#include <cvt/wstring> //for wstring_convert
307+//#include <cvt/wstring> //for wstring_convert
307308
308309 #include <windowsx.h>
309310 #include <stdlib.h>
@@ -323,15 +324,18 @@ extern WTL::CAppModule _Module;
323324
324325 #include <iso646.h>
325326 #include <wctype.h>
326-#include <concurrent_vector.h>
327327
328+#pragma warning (push)
329+#pragma warning (disable:4619) // unreachable code
330+#include <concurrent_vector.h>
331+#pragma warning (pop)
328332
329333 #pragma warning(pop)
330334
331335 #pragma warning(disable:4710) //The given function was selected for inline expansion, but the compiler did not perform the inlining.
332336
333337 // Headers placed in the common directory (used by windirstat and by setup)
334-#include "../common/version.h"
338+//#include "../common/version.h"
335339
336340 #ifndef _INC_STDARG
337341 #include <stdarg.h>
--- a/WinDirStat/windirstat/stringformatting.cpp
+++ b/WinDirStat/windirstat/stringformatting.cpp
@@ -1,10 +1,10 @@
11 // stringformatting.cpp
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
88
99 #ifndef WDS_STRINGFORMATTING_CPP_INCLUDED
1010 #define WDS_STRINGFORMATTING_CPP_INCLUDED
--- a/WinDirStat/windirstat/treemap.cpp
+++ b/WinDirStat/windirstat/treemap.cpp
@@ -1,12 +1,10 @@
11 // treemap.cpp - Implementation of CColorSpace, CTreemap and CTreemapPreview
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-
8-#include "stdafx.h"
9-
108 #ifndef WDS_TREEMAP_CPP
119 #define WDS_TREEMAP_CPP
1210
--- a/WinDirStat/windirstat/typeview.cpp
+++ b/WinDirStat/windirstat/typeview.cpp
@@ -2,11 +2,11 @@
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
44
5+#include "stdafx.h"
56
67 #pragma once
78
89
9-#include "stdafx.h"
1010
1111 #ifndef WDS_TYPEVIEW_CPP
1212 #define WDS_TYPEVIEW_CPP
--- a/WinDirStat/windirstat/windirstat.cpp
+++ b/WinDirStat/windirstat/windirstat.cpp
@@ -1,10 +1,10 @@
11 // windirstat.cpp - Implementation of CDirstatApp and some globals
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
88
99 #ifndef WDS_WINDIRSTAT_CPP
1010 #define WDS_WINDIRSTAT_CPP
--- a/WinDirStat/windirstat/windirstat.vcxproj
+++ b/WinDirStat/windirstat/windirstat.vcxproj
@@ -42,7 +42,7 @@
4242 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
4343 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
4444 <ConfigurationType>Application</ConfigurationType>
45- <PlatformToolset>v120</PlatformToolset>
45+ <PlatformToolset>v140</PlatformToolset>
4646 <UseOfMfc>Static</UseOfMfc>
4747 <CharacterSet>Unicode</CharacterSet>
4848 <WholeProgramOptimization>true</WholeProgramOptimization>
@@ -66,7 +66,7 @@
6666 </PropertyGroup>
6767 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
6868 <ConfigurationType>Application</ConfigurationType>
69- <PlatformToolset>v120</PlatformToolset>
69+ <PlatformToolset>v140</PlatformToolset>
7070 <UseOfMfc>Static</UseOfMfc>
7171 <CharacterSet>Unicode</CharacterSet>
7272 <WholeProgramOptimization>true</WholeProgramOptimization>
--- a/WinDirStat/windirstat/xyslider.cpp
+++ b/WinDirStat/windirstat/xyslider.cpp
@@ -1,10 +1,10 @@
11 // XySlider.cpp - Implementation of CXySlider
22 //
33 // see `file_header_text.txt` for licensing & contact info. If you can't find that file, then assume you're NOT allowed to do whatever you wanted to do.
4+#include "stdafx.h"
45
56 #pragma once
67
7-#include "stdafx.h"
88
99 #ifndef WDS_XYSLIDER_CPP
1010 #define WDS_XYSLIDER_CPP
Afficher sur ancien navigateur de dépôt.