The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,854 other subscribers

Archive for May, 2021

Running ArchiveTeam Warrior version 3.2 on ESXi

Posted by jpluimers on 2021/05/05

A while ago I wrote about Helping the WayBack ArchiveTeam team: running their Warrior virtual appliance on ESXi.

Since it was scheduled before my cancer treatment started and got posted when still recovering from it, I missed that version 3.2 of the [Wayback] ArchiveTeam Warrior appliance appeared in the [Wayback] Releases · ArchiveTeam/Ubuntu-Warrior at [Wayback] Release v3.2 · ArchiveTeam/Ubuntu-Warrior. You can download it form these places:

These two sites have not yet been updated, so they contain the older versions:

The source code now has been moved three times:

Read the rest of this entry »

Posted in *nix, *nix-tools, ArchiveTeamWarrior, Cloud, Containers, diff, Docker, ESXi5, ESXi5.1, ESXi5.5, ESXi6, ESXi6.5, ESXi6.7, ESXi7, Infrastructure, Internet, InternetArchive, Kubernetes (k8n), KVM Kernel-based Virtual Machine, patch, Power User, VirtualBox, Virtualization, VMware, VMware ESXi, VMware Workstation, WayBack machine | Leave a Comment »

Delphi 10.2 Tokyo introduced a “with” warning: for most “with” statements, W1048 is raised ([RSP-17326] with statements generate W1048 unsafe typecast warning – Embarcadero Technologies)

Posted by jpluimers on 2021/05/05

A cool feature introduced in Delphi 10.2 Tokyo: often [RSP-17326] with statements generate W1048 unsafe typecast warning – Embarcadero Technologies.

Only 2 upvotes, so I assume the “anti with camp” people are finally winning (:

Notes:

Quoted from the bug-report (as they cannot be archived in the wayback machine)

  1. RAD Studio
  2. RSP-17326

with statements generate W1048 unsafe typecast warning

Details

  • Type:Bug Bug
  • Status:Reported Reported
  • Priority:Major Major
  • Resolution:Unresolved
  • Affects Version/s:10.2 Tokyo
  • Fix Version/s:None
  • Component/s:Delphi Compiler
  • Labels: None
  • Build No: 25.0.25948.9960
  • Platform: All
  • Language Version: English
  • Edition: Enterprise
  • InternalID: RS-82298
  • InternalStatus: Validation

Description

All with statements generate this warning. I am on board with the theory that all with statements are inherently somewhat unsafe, but with 1.5 million lines of legacy code (and over 500 new warnings), I would significantly prefer to have a separate warning for with statements.
As it happens I would like to go through and do this work, especially if we can have refactoring to restore non-with code – see RSP-13978. BUT, Godzilla is generating new extra warnings (including unsafe typecasts) in this legacy code and I would prefer to be able to attack these first and attend to with statements later.

Activity

Comments

Jira-Quality Sync Service added a comment – 

Jason Sprenger requested more info in order to validate the issue and commented: Not any code involving “with” statements produces an unsafe typecast warning.

For instance,

program RS82298;

{$APPTYPE CONSOLE}

uses
  System.SysUtils;

procedure Use(var X);
begin<
end;

type
  TMyClass = class
    FValue: Integer;
    property Value: Integer read FValue write FValue;
  end;

procedure RunRS82298;
var
  MyClass: TMyClass;
begin
  MyClass := TMyClass.Create;
  with MyClass do
    begin
      Value := 42;
    end;
  with MyClass do
    WriteLn('MyClass.Value=', MyClass.Value);

  Use(MyClass);
end;

begin
  try
    RunRS82298
  except
    on E: Exception do
      begin
        WriteLn('FAIL - Unexpected Exception');
        WriteLn('  ClassName=', E.ClassName);
        WriteLn('    Message=', E.Message);
      end;
  end;
end.

What sort of source involving “with” statements is generating these warnings for you?

With this information our development team can consider addressing your particular circumstance.

Stuart Seath [X] (Inactive) added a comment – 

Try this (obviously a simple made-up example), and you do need to enable W1048 first in the project options:

program Project18;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils;

type
  TAnother = class
  private
    FAmbiguous : Boolean;
  public
    property Ambiguous : Boolean read FAmbiguous write FAmbiguous;
  end;

  TFirst = class
  private
    FAnother : TAnother;
  public
    procedure Doit;
  end;

var
  First : TFirst;

{ TFirst }

procedure TFirst.Doit;
begin
  FAnother := TAnother.Create;
  with FAnother do // WARNING
  begin
    Ambiguous := true;
  end;
end;

var
  XAnother : TAnother;

begin
  try
    XAnother := TAnother.Create;
    with XAnother do // NO WARNING HERE
    begin
      Ambiguous := true;
    end;

  except
    on E: Exception do
  Writeln(E.ClassName, ': ', E.Message);
end;
end.

–jeroen

Posted in Delphi, Delphi 10.2 Tokyo (Godzilla), Development, Software Development | 1 Comment »

Preference variable $ConfirmPreference allows getting more or less PowerShell confirmation prompts

Posted by jpluimers on 2021/05/04

On my list to experiment with are [Wayback] about_Preference_Variables – PowerShell | Microsoft Docs, especially

$ConfirmPreference

Determines whether PowerShell automatically prompts you for confirmation before running a cmdlet or function.

The $ConfirmPreference variable’s valid values are HighMedium, or Low. Cmdlets and functions are assigned a risk of HighMedium, or Low. When the value of the $ConfirmPreference variable is less than or equal to the risk assigned to a cmdlet or function, PowerShell automatically prompts you for confirmation before running the cmdlet or function.

If the value of the $ConfirmPreference variable is None, PowerShell never automatically prompts you before running a cmdlet or function.

To change the confirming behavior for all cmdlets and functions in the session, change $ConfirmPreference variable’s value.

To override the $ConfirmPreference for a single command, use a cmdlet’s or function’s Confirm parameter. To request confirmation, use -Confirm. To suppress confirmation, use -Confirm:$false.

Valid values of $ConfirmPreference:

  • None: PowerShell doesn’t prompt automatically. To request confirmation of a particular command, use the Confirm parameter of the cmdlet or function.
  • Low: PowerShell prompts for confirmation before running cmdlets or functions with a low, medium, or high risk.
  • Medium: PowerShell prompts for confirmation before running cmdlets or functions with a medium, or high risk.
  • High: PowerShell prompts for confirmation before running cmdlets or functions with a high risk.

–jeroen

Posted in .NET, CommandLine, Development, PowerShell, PowerShell, Scripting, Software Development | Leave a Comment »

From Yahoo closing Answers tonight to blocking ads on YouTube

Posted by jpluimers on 2021/05/04

The discussion on Yahoo closing Answers tonight quickly went from alternative text based question/answer sites to long YouTube videos having hardly any content but ads, to blocking these ads: [Wayback] Yahoo sluit Answers-dienst na vijftien jaar en verwijdert inhoud – IT Pro – Nieuws – Tweakers

So here are some links where I can learn a bit of browser plugin and Android development technology as well:

(What I dislike most about ads is that they start at unnatural positions in the stream and cover topics I’m totally not interested in).

–jeroen

Posted in Android, Android Devices, Development, Mobile Development, Power User, SocialMedia, Software Development, Web Development, YouTube | Leave a Comment »

Delphi …hide the scrollbars of a DBGrid?

Posted by jpluimers on 2021/05/04

Recently I needed a plain TDBGrid without a horizontal scrollbar. I based it on the below solutions, but using an interposer class (type TDBGrid = class(TDBGrid) ... end;).

Another solution is to redirect the WinProc for a single grid component to a different method (you can apply it to the similar TDBCtrlGrid class as well):

unit DBGridFormUnit;
uses
  Winapi.Messages,
  Vcl.DBGrids,
  Vcl.Forms;

type
  TDBGridForm = class(TForm)
    DBGrid: TDBGrid;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  strict private
    OriginalDBGridWindowProc : TWndMethod;
    procedure DBGridWindowProc(var Message: TMessage);
  end;

implementation

uses
  Winapi.Windows;
procedure TDBGridForm.FormCreate(Sender: TObject);
begin
  OriginalDBGridWindowProc := DBGrid.WindowProc;
  DBGrid.WindowProc := DBGridWindowProc;
end;

procedure TDBGridForm.FormDestroy(Sender: TObject);
begin
  DBGrid.WindowProc := OriginalDBGridWindowProc;
end;

procedure TDBGridForm.DBGridWindowProc(var Message: TMessage);
const 
  ScrollStylesToExclude = WS_VSCROLL or WS_HSCROLL;
var 
  Style: Integer;
begin
  if Message.Msg = WM_NCCALCSIZE then
  begin
    Style := GetWindowLong(Handle, GWL_STYLE);
    if (Style and ScrollStylesToExclude) <> 0 then // any scroll style to exclude present?
      SetWindowLong(Handle, GWL_STYLE, Style and not ScrollStylesToExclude);
  end
  else
    OrigWndProc(Message);
end;
end.

I think the SwissDelphiCenter solution in [WayBack] …hide the scrollbars of a DBGrid? originally has been copied from the 2003 post by Peter Below at [WayBack] how to hide DBCtrlGrid scrollbars – delphi.

(*
Q:
I want to hide the vertical scrollbar on a dbgrid when the record count
exceed a number. How can I do that?

A:
Make a descendent of the TDBGrid class. Add a handler for the
WM_NCCALCSIZE message.

Title: ...hide the scrollbars of a DBGrid?

Author: P. Below 

Category: VCL
*)
type
  TNoScrollDBGrid = class(TDBGrid)
  private
    procedure WMNCCalcSize(var Msg: TMessage);
    message WM_NCCALCSIZE;
  end;

procedure TNoScrollDBGrid.WMNCCalcSize(var Msg: TMessage);
const
  Scrollstyles = WS_VSCROLL or WS_HSCROLL;
var
  Style: Integer;
begin
  Style := GetWindowLong(Handle, GWL_STYLE);
  if (Style and Scrollstyles) <> 0 then
    SetWindowLong(Handle, GWL_STYLE, Style and not Scrollstyles);
  inherited;
end;

//This removes both scrollbars. If you want to remove only the vertical one
//change the scrollstyles constant accordingly.

I like this derived class from [WayBack] Delphi VCL Component • View topic • Hiding Scrollbars in DBGRID by Chris Luck based on the code from Peter Below more (I slightly condensed it from non-relevant code):

unit NoScrollDBGrid;

interface

uses
  Windows, Messages, DBGrids;

type
  TNoScrollDBGrid = class(TDBGrid)
  private
    FVertScroll: Boolean;
    FHorzScroll: Boolean;
    procedure WMNCCalcSize(var msg: TMessage); message WM_NCCALCSIZE;
    procedure SetVertScroll(Value: Boolean);
    procedure SetHorzScroll(Value: Boolean);
  published
    property VertScroll: Boolean read FVertScroll write SetVertScroll;
    property HorzScroll: Boolean read FHorzScroll write SetHorzScroll;
  end;

procedure Register;

implementation

uses
  Classes;
procedure TNoScrollDBGrid.SetVertScroll(Value: Boolean);
begin
  if FVertScroll <> Value then
  begin
    FVertScroll := Value;
    RecreateWnd;
  end;
end;

procedure TNoScrollDBGrid.SetHorzScroll(Value: Boolean);
begin
  if FHorzScroll <> Value then
  begin
    FHorzScroll := Value;
    RecreateWnd;
  end;
end;

procedure TNoScrollDBGrid.WMNCCalcSize(var msg: TMessage);
var
  style: Integer;
begin
  style := getWindowLong( handle, GWL_STYLE );

  if (NOT(FHorzScroll)) AND ((style and WS_HSCROLL) <> 0) then
    SetWindowLong( handle, GWL_STYLE, style and not WS_HSCROLL );

  if (NOT(FVertScroll)) AND ((style and WS_VSCROLL) <> 0) then
    SetWindowLong( handle, GWL_STYLE, style and not WS_VSCROLL );

  inherited;
end;

procedure Register;
begin
  RegisterComponents('Samples', [TNoScrollDBGrid]);
end;

end.

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

authentication – Bypassing Windows 10 password with Utilman.exe trick – fixed? – Information Security Stack Exchange

Posted by jpluimers on 2021/05/03

It is debatable if these tricks are vulnerabilities or not: [WayBack] authentication – Bypassing Windows 10 password with Utilman.exe trick – fixed? – Information Security Stack Exchange.

There are arguments that leaving a system open to physical access or allow operating system manipulation, it means it is busted.

On the other hand, making systems more resilient to modification, helps alleviate these problems.

So it pays for developers to harden operating systems against modification.

From the question:

Of the sethc.exe, Utilman.exe, and osk.exe ones in Windows, Utilman.exe seems to have been fixed.

Related:

–jeroen

Posted in Power User, Windows, Windows 10, Windows 7, Windows 8, Windows 8.1 | Leave a Comment »

Supermicro: 5 BIOS beeps might just mean internal VGA is disabled

Posted by jpluimers on 2021/05/03

A while ago, I got a second hand Supermicro workstation and wondered why the IPMI KVM would not show anything.

The video card in it worked fine, so I used it as a desktop machine setup for a while, happily running VMS.

I finally decided to move into a closet, so I removed the video card, and rebooted.

Then it beeped 5 times, which was odd: I expected it to switch from the video card to the internal video. It didn’t.

Older BIOS codes: [WayBack] AMI BIOS Beep Codes – Thomas-Krenn-Wiki

From PDF [WayBack] BIOS POST Codes for C7/X9/X10/X11/B9/B10/B1/A1 Motherboards

PEI Beep Codes

# of Beeps Description
1 Memory not Installed
1 Memory was installed twice (InstallPeiMemory routine in PEI Core called twice)
2 Recovery started
3 DXEIPL was not found
3 DXE Core Firmware Volume was not found
4 Recovery failed
4 S3 Resume failed
7 Reset PPI is not available

DXE Beep Codes

# of Beeps Description
1 Invalid password
4 Some of the Architectural Protocols are not available
5 No Console Output Devices are found
5 No Console Input Devices are found
6 Flash update is failed
7 Reset protocol is not available
8 Platform PCI resource requirements cannot be met

So I did a bit of reading in the manual, then found about a jumper which had happily been living out of view, under the video card:

VGA Enable (JPG1)

JPG1 allows you to enable or disable the onboard VGA connector. The default position is on pins 1 and 2 to enable VGA.

Setting the jumper to pins 1&2 made internal VGA available again, it happily booted and showed in the IPMI KVM.

Later I understood why the jumper was set to VGA disabled: when having two video cards, by default Windows will extend your desktop to an invisible monitor.

The easiest workaround for that is just to disable VGA. However, you can also change Windows

Older versus newer boards

It appears that most older SuperMicro systems have a hardware switch, but for newer chipsets supporting Intel Quick Sync Video a there is a BIOS setting: [WayBack] Enable internal graphics in SUPERMICRO servers | Any IT here? Help Me!

Windows 10 fixing video cards and ACPI_BIOS_ERROR

The reboot did not work fine: Windows 10 would not initialise properly, but hung when detecting video cards.

Read the rest of this entry »

Posted in Hardware, IPMI, Mainboards, Power User, SuperMicro, X10SRH-CF, X9SRi-3F, X9SRi-F | Leave a Comment »

Windows 10: when “wmic path SoftwareLicensingService get OA3xOriginalProductKey” fails, try ProduKey from NirSoft.

Posted by jpluimers on 2021/05/03

Somehow, many Windows 10 systems, when I try on an Administrative command prompt wmic path SoftwareLicensingService get OA3xOriginalProductKey, the result is empty:

Microsoft Windows [Version 10.0.17763.475]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>wmic path SoftwareLicensingService get OA3xOriginalProductKey
OA3xOriginalProductKey



C:\WINDOWS\system32>

On those systems, [Wayback] NirSoft ProduKey always works.

Having a product key at hand is a great help when re-installing Windows 10: often it does not automatically obtain a digital license on the same hardware.

Most of those systems have been upgrades from previous Windows versions, but not all of them: even some new systems have this behaviour.

Related:

–jeroen

Read the rest of this entry »

Posted in Power User, Windows, Windows 10 | Leave a Comment »