Skip to content

Commit 80efc7e

Browse files
committed
Allow ForceIncludeModules to contain wildcards (and implicitly disallow separators other than semicolon) / Add https://github.com/datadiode/chronos as a means to inject VLD into an executable which doesn't link to it by itself
1 parent 80870b5 commit 80efc7e

File tree

8 files changed

+46
-19
lines changed

8 files changed

+46
-19
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "src/chronos"]
2+
path = src/chronos
3+
url = https://github.com/datadiode/chronos

setup/version.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
#define VLDVERSION L"2.8.0"
3-
#define VERSION_NUMBER 2,8,0,0
4-
#define VERSION_STRING "2.8.0.0"
2+
#define VLDVERSION L"2.8.1"
3+
#define VERSION_NUMBER 2,8,1,0
4+
#define VERSION_STRING "2.8.1.0"
55
#define VERSION_COPYRIGHT "Copyright (C) 2005-2025"

setup/vld-setup.iss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "Visual Leak Detector"
5-
#define MyAppVersion "2.8.0"
5+
#define MyAppVersion "2.8.1"
66
#define MyAppPublisher "VLD Team"
77
#define MyAppURL "https://github.com/oneiric/vld"
88
#define MyAppRegKey "Software\Visual Leak Detector"
@@ -41,6 +41,9 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
4141
Name: "{group}\View Documentation"; Filename: "http://vld.codeplex.com/documentation"
4242

4343
[Files]
44+
Source: "..\x64\Release\chronos_x64.exe"; DestDir: "{app}\bin\Win64"; Flags: ignoreversion
45+
Source: "..\Release\chronos_x86.exe"; DestDir: "{app}\bin\Win32"; Flags: ignoreversion
46+
Source: "..\src\chronos\LICENSE"; DestDir: "{app}"; DestName: "LICENSE_chronos.txt"; Flags: ignoreversion
4447
Source: "dbghelp\x64\dbghelp.dll"; DestDir: "{app}\bin\Win64"; Flags: ignoreversion
4548
Source: "dbghelp\x64\Microsoft.DTfW.DHL.manifest"; DestDir: "{app}\bin\Win64"; Flags: ignoreversion
4649
Source: "dbghelp\x86\dbghelp.dll"; DestDir: "{app}\bin\Win32"; Flags: ignoreversion

src/chronos

Submodule chronos added at 7028ed1

src/stdafx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <cassert>
44
#include <cerrno>
55
#include <cstdio>
6-
#include <windows.h>
6+
#include <shlwapi.h>
77
#if _WIN32_WINNT < 0x0600 // Windows XP or earlier, no GetProcessIdOfThread()
88
#include <winternl.h>
99
#endif

src/vld.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -866,19 +866,11 @@ VOID VisualLeakDetector::attachToLoadedModules (ModuleSet *newmodules)
866866
{
867867
// This module does not import VLD. This means that none of the module's
868868
// sources #included vld.h.
869-
if ((m_options & VLD_OPT_MODULE_LIST_INCLUDE) != 0)
869+
const BOOL match = PathMatchSpecW(modulename, m_forcedModuleList);
870+
if ((m_options & VLD_OPT_MODULE_LIST_INCLUDE) != (match ? VLD_OPT_MODULE_LIST_INCLUDE : 0))
870871
{
871-
if (wcsstr(m_forcedModuleList, modulename) == NULL) {
872-
// Exclude this module from leak detection.
873-
moduleFlags |= VLD_MODULE_EXCLUDED;
874-
}
875-
}
876-
else
877-
{
878-
if (wcsstr(m_forcedModuleList, modulename) != NULL) {
879-
// Exclude this module from leak detection.
880-
moduleFlags |= VLD_MODULE_EXCLUDED;
881-
}
872+
// Exclude this module from leak detection.
873+
moduleFlags |= VLD_MODULE_EXCLUDED;
882874
}
883875
}
884876
}

src/vld.vcxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<DisableSpecificWarnings>4201;4229;4091;4302;4311;4312;4127</DisableSpecificWarnings>
8989
</ClCompile>
9090
<Link>
91-
<AdditionalDependencies>psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
91+
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
9292
<SubSystem>Windows</SubSystem>
9393
</Link>
9494
<Manifest>
@@ -107,7 +107,7 @@
107107
<EnablePREfast>false</EnablePREfast>
108108
</ClCompile>
109109
<Link>
110-
<AdditionalDependencies>psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
110+
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
111111
<SubSystem>Windows</SubSystem>
112112
</Link>
113113
<Manifest>
@@ -135,6 +135,7 @@
135135
<OptimizeReferences>true</OptimizeReferences>
136136
<EnableCOMDATFolding>true</EnableCOMDATFolding>
137137
<SubSystem>Windows</SubSystem>
138+
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
138139
</Link>
139140
<Manifest>
140141
<AdditionalManifestFiles>vld.dll.dependency.x86.manifest</AdditionalManifestFiles>
@@ -160,6 +161,7 @@
160161
<EnableCOMDATFolding>true</EnableCOMDATFolding>
161162
<Profile>true</Profile>
162163
<SubSystem>Windows</SubSystem>
164+
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
163165
</Link>
164166
<Manifest>
165167
<AdditionalManifestFiles>vld.dll.dependency.x64.manifest</AdditionalManifestFiles>

vld_vs16.sln

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vld_main_test", "src\tests\
7171
{8C732490-DC1A-40C0-923F-1555B9141B80} = {8C732490-DC1A-40C0-923F-1555B9141B80}
7272
EndProjectSection
7373
EndProject
74+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "chronos", "src\chronos\chronos.vcxproj", "{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}"
75+
EndProject
7476
Global
7577
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7678
Debug_StaticCrt|Win32 = Debug_StaticCrt|Win32
@@ -472,6 +474,30 @@ Global
472474
{BB99EDE9-D039-4169-B26B-6BFD93C6AF8E}.Release|Win32.Build.0 = Release|Win32
473475
{BB99EDE9-D039-4169-B26B-6BFD93C6AF8E}.Release|x64.ActiveCfg = Release|x64
474476
{BB99EDE9-D039-4169-B26B-6BFD93C6AF8E}.Release|x64.Build.0 = Release|x64
477+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_StaticCrt|Win32.ActiveCfg = Debug|Win32
478+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_StaticCrt|Win32.Build.0 = Debug|Win32
479+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_StaticCrt|x64.ActiveCfg = Debug|x64
480+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_StaticCrt|x64.Build.0 = Debug|x64
481+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_VldRelease_StaticCrt|Win32.ActiveCfg = Release|Win32
482+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_VldRelease_StaticCrt|Win32.Build.0 = Release|Win32
483+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_VldRelease_StaticCrt|x64.ActiveCfg = Release|x64
484+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_VldRelease_StaticCrt|x64.Build.0 = Release|x64
485+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_VldRelease|Win32.ActiveCfg = Release|Win32
486+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_VldRelease|Win32.Build.0 = Release|Win32
487+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_VldRelease|x64.ActiveCfg = Release|x64
488+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug_VldRelease|x64.Build.0 = Release|x64
489+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug|Win32.ActiveCfg = Debug|Win32
490+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug|Win32.Build.0 = Debug|Win32
491+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug|x64.ActiveCfg = Debug|x64
492+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Debug|x64.Build.0 = Debug|x64
493+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Release_StaticCrt|Win32.ActiveCfg = Release|Win32
494+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Release_StaticCrt|Win32.Build.0 = Release|Win32
495+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Release_StaticCrt|x64.ActiveCfg = Release|x64
496+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Release_StaticCrt|x64.Build.0 = Release|x64
497+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Release|Win32.ActiveCfg = Release|Win32
498+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Release|Win32.Build.0 = Release|Win32
499+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Release|x64.ActiveCfg = Release|x64
500+
{3DB94AD0-4960-4D71-B10A-F3A56AEA4C5D}.Release|x64.Build.0 = Release|x64
475501
EndGlobalSection
476502
GlobalSection(SolutionProperties) = preSolution
477503
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)