From e571113b227029f1a893e15d65d4796f9f5fd2a9 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 16 Dec 2020 09:35:09 +1100 Subject: [PATCH 1/3] fix(windows): sentrytool should fail build on exception This does not fix the core issue. Examining the logs shows that sentrytool is failing with an access violation when running on the build agent, although it works on my local machine. This first step is to get the build to fail, and then I will test again directly on the build agent. --- windows/src/buildtools/sentrytool/sentrytool.dpr | 3 +++ 1 file changed, 3 insertions(+) diff --git a/windows/src/buildtools/sentrytool/sentrytool.dpr b/windows/src/buildtools/sentrytool/sentrytool.dpr index 20365891db..f1ed8450b6 100644 --- a/windows/src/buildtools/sentrytool/sentrytool.dpr +++ b/windows/src/buildtools/sentrytool/sentrytool.dpr @@ -16,6 +16,9 @@ begin ExitCode := main; except on E: Exception do + begin Writeln(E.ClassName, ': ', E.Message); + ExitCode := 1; + end; end; end. From 023a70aaddcdeedf20764f6c73bb574fe2096573 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 16 Dec 2020 11:34:39 +1100 Subject: [PATCH 2/3] fix(windows): sentrytool fails on mem realloc Fixes #4002. We needed to reseat the pointers after the realloc as the base address changed; this only affected us occasionally but nasty when it did! --- .../src/buildtools/sentrytool/Keyman.System.AddPdbToPe.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/windows/src/buildtools/sentrytool/Keyman.System.AddPdbToPe.pas b/windows/src/buildtools/sentrytool/Keyman.System.AddPdbToPe.pas index f92b815172..0416c8bd54 100644 --- a/windows/src/buildtools/sentrytool/Keyman.System.AddPdbToPe.pas +++ b/windows/src/buildtools/sentrytool/Keyman.System.AddPdbToPe.pas @@ -265,6 +265,9 @@ begin s.SetSize(SectionOffset + SectionRawSize); FillChar((PByte(s.Memory) + SectionOffset)^, SectionRawSize, 0); + nh32 := PImageNtHeaders(NativeUInt(nh32)-NativeUInt(dh)+NativeUInt(s.Memory)); + section := PImageSectionHeader(NativeUInt(section)-NativeUInt(dh)+NativeUInt(s.Memory)); + // Increment the number of sections Inc(nh32.FileHeader.NumberOfSections); @@ -324,6 +327,9 @@ begin s.SetSize(SectionOffset + SectionRawSize); FillChar((PByte(s.Memory) + SectionOffset)^, SectionRawSize, 0); + nh64 := PImageNtHeaders64(NativeUInt(nh64)-NativeUInt(dh)+NativeUInt(s.Memory)); + section := PImageSectionHeader(NativeUInt(section)-NativeUInt(dh)+NativeUInt(s.Memory)); + // Increment the number of sections Inc(nh64.FileHeader.NumberOfSections); From 90b8b379be82b99f1df396c126ea2bfe9a3b44bf Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 16 Dec 2020 11:47:05 +1100 Subject: [PATCH 3/3] fix(windows): kmconfig sentrytool typo --- windows/src/desktop/kmconfig/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/src/desktop/kmconfig/Makefile b/windows/src/desktop/kmconfig/Makefile index 447de763bc..75a3587c18 100644 --- a/windows/src/desktop/kmconfig/Makefile +++ b/windows/src/desktop/kmconfig/Makefile @@ -6,7 +6,7 @@ build: version.res manifest.res #icons $(DELPHI_MSBUILD) kmconfig.dproj /p:Platform=Win32 - $(SENTRYTOOL_DELPHIPREP) $(WIN32_TARGET_PATH)\kmconfig.exe -dpr kmconfig.exe + $(SENTRYTOOL_DELPHIPREP) $(WIN32_TARGET_PATH)\kmconfig.exe -dpr kmconfig.dpr $(TDS2DBG) $(WIN32_TARGET_PATH)\kmconfig.exe $(COPY) $(WIN32_TARGET_PATH)\kmconfig.exe $(PROGRAM)\desktop if exist $(WIN32_TARGET_PATH)\kmconfig.dbg $(COPY) $(WIN32_TARGET_PATH)\kmconfig.dbg $(DEBUGPATH)\desktop