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,861 other subscribers

Archive for the ‘C’ Category

For my link archive: Counting the leading zeroes and ones in a binary number with C#

Posted by jpluimers on 2025/03/13

From a while back, but still interesting:

  1. [Wayback/Archive] Counting the leading zeroes in a binary number with C#
  2. [Wayback/Archive] c# – Getting the number of leading 1 bits – Stack Overflow (thanks [Wayback/Archive] Barry Kelly and [Wayback/Archive] SoapBox)

Especially the first link explains the algorithm very well and is similar to links referred to from the Stack Overflow question as it is based on counting ones (and leading ones are basically leading zeros but bit-inverted).

It also explains a cool thing for leading zeros: modern CPU have instructions which .NET Core.

Read the rest of this entry »

Posted in .NET, AArch64/arm64, Algorithms, ARM, Assembly Language, C, C#, C++, Delphi, Development, Software Development, x64, x86 | Tagged: , , | Leave a Comment »

Old programming books had cool little “puns” in their references, modern lack them in their indices. On the why, and history of them.

Posted by jpluimers on 2025/01/01

I wrote a two earlier blog posts around puns in programming book indices before:

  1. the 1992 Turbo Pascal 7.0 Language Guide having both entry in the manual about Recursion (“recursive loop, see recursive loop”) which of course is similar to “infinite loop” and entries for “infinite loop See loop, infinite” and “loop, infinite See infinite loop”.
  2. infinite loop in “LaTeX: A Document Preparation System” by Leslie Lamport, printed in 1994.

In the last one, I promised to list more occurrences which I now finally had time for to do.

But let me first elaborate more on the observation that modern computer books (like for instance on C# and Delphi beyond version 1) lack these kinds of index pun.

On the Delphi side, the index entry joke for recursion got removed no later than Delphi 3 (I am still looking for a Delphi 2 version of the Object Pascal Language Guide, see further below) even before the book being fully redone electronically and the index pages generation being automated in

I think I even understand why that is: the process of creating of indices. By the start of this century, more and more indices were automatically being generated and for the last 2 decades or so, all of them are. Back in the days however, indices were mostly done by hand. Nowadays, with everything automated, it is actually pretty tricky in most environments to add such an “infinite loop” index entry like in the Turbo Pascal book, as it would require two things at once:

Read the rest of this entry »

Posted in .NET, C, C#, C++, Conference Topics, Conferences, Delphi, Delphi 1, Delphi 2, Development, EKON, Event, History, LaTeX, LifeHacker, LISP, Mathematics, Pascal, Perl, PL/I (a.k.a. PL/1), Power User, science, Software Development, Turbo Pascal, Typesetting | Tagged: , | 4 Comments »

Link archive: Windows PSBits/PasswordStealing/NPPSpy at master · gtworek/PSBits

Posted by jpluimers on 2024/12/12

Simple (but fully working) code for NPLogonNotify(). The function obtains logon data, including cleartext password.

[Wayback/Archive] PSBits/PasswordStealing/NPPSpy at master · gtworek/PSBits has been used in the wild since about 2022 (the code is from 2020).

The code is a ~100 line C file resulting in a DLL exporting the NPGetCaps() and NPLogonNotify() functions.

Background/related:

Read the rest of this entry »

Posted in .NET, Blue team, C, CommandLine, Development, Power User, PowerShell, PowerShell, Red team, Scripting, Security, Software Development, Windows Development | Tagged: | 1 Comment »

Links to HTML versions of RFC’s need to move from “tools” to “datatracker” – Meta Stack Exchange

Posted by jpluimers on 2024/11/07

Some work to do replacing dead IETF RFC and draft links in my blog posts.

From the accepted answer on [Wayback/Archive.is] Links to HTML versions of RFC’s need to move from “tools” to “datatracker” – Meta Stack Exchange:

  1. [http/https]://tools.ietf.org/html/[rfc/RFC] became https://www.rfc-editor.org/rfc/rfc network-wide
  2. [http/https]://tools.ietf.org/html/draft- became https://datatracker.ietf.org/doc/html/draft-

>Both of these should conform to the reply we received from IETF.

Read the rest of this entry »

Posted in C, C++, Carbon, Development, Power User, SocialMedia, Software Development, Web Development, WordPress, WordPress | Leave a Comment »

One cautionary thing with C programming: the cost of macro expansion

Posted by jpluimers on 2024/10/03

The result C macros having become more lenient on the types they expect, is that they can become very large expansions. This not only causes long expanded code lines, but also

This shows you some examples:

[Wayback/Archive] Lorenzo Stoakes on social.kernel.org: For those interested in the ‘combinatorial explosion of min()/max() macro’ thing slowing down kernel builds, witness the horrors :))

[Wayback/Archive] Re: [PATCH 0/7] minmax: reduce compilation time – Linus Torvalds

Read the rest of this entry »

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

NTFS Sparse Files For Programmers

Posted by jpluimers on 2024/09/25

Need to check this out some day: cs.exe compiled from [Wayback] sparse.zip which you can download from [Wayback/Archive] NTFS Sparse Files For Programmers

Read the rest of this entry »

Posted in C, C++, Development, NTFS, Power User, RoboCopy, Software Development, Visual Studio C++, Windows, Windows 10, Windows 11 | Leave a Comment »

ladislav-zezula/FileTest: Source code for File Test – Interactive File System Test Tool

Posted by jpluimers on 2024/08/14

Cool tool to peek around in the Windows File System API and fiddle around uncharted territory: [Wayback/Archive] ladislav-zezula/FileTest: Source code for File Test – Interactive File System Test Tool.

It is written in C++ using Visual Studio and has build-instructions in [Wayback/Archive] FileTest/README.md at master · ladislav-zezula/FileTest.

Via [Wayback/Archive] “create reparse point” “query reparse point” – Google Search (which also found [Wayback/Archive] Free File Utilities – Free download and software reviews – CNET Download [Wayback download]) after reading a tweet thread having these highlights:

Read the rest of this entry »

Posted in C, C++, Development, Polyglot, Software Development, Visual Studio C++, Windows Development | Leave a Comment »

Code Visualisation through Python Tutor – Visualise Python, Java, C, C++, JavaScript, TypeScript, and Ruby code execution

Posted by jpluimers on 2024/04/18

The final visualisation post of this week (themed Data Visualisation and Code Visualisation) is about [Wayback/Archive] Python Tutor – Visualize Python, Java, C, C++, JavaScript, TypeScript, and Ruby code execution.

Languages covered in these visualisers:

Earlier posts in the series:

–jeroen

Posted in C, C++, Development, Java, Java Platform, JavaScript/ECMAScript, Python, Ruby, Scripting, Software Development | Leave a Comment »

XZ 5.6.x are backdoored and present in many systems: downgrade to 5.4.x or earlier now; consider libarchive compromised until proven otherwise

Posted by jpluimers on 2024/03/30

Edit 20240331: because of

https://mastodon.social/@kobold/112183756981119562

Debian is working on reverting back to even earlier than 5.4.x

[Wayback/Archive] #1068024 – revert to version that does not contain changes by bad actor – Debian Bug report logs

> I'd suggest reverting to 5.3.1. Bearing in mind that there were security
> fixes after that point for ZDI-CAN-16587 that would need to be reapplied.

Note that reverted to such an old version will break packages that use
new symbols introduced since then. From a quick look, this is at least:
- dpkg
- erofs-utils
- kmod

Having dpkg in that list means that such downgrade has to be planned
carefully.


Original post:

Everything I know about the XZ backdoor

Note that because of the Wayback Machine limit of 5 archivals per URL per day, the archived versions are rapidly getting out-of-date.

It is way worse:

[Wayback/Archive] Thread by @_ruby on Thread Reader App – Thread Reader App

@_ruby: The setup behind the CVE-2024-3094 supply-chain attack is fascinating. I originally wanted to finish and share a tool to audit other OSS projects for anomalous contributor behavior, but I feel what I found tr……

How it was found:

Analogy on how it was found:

Via:

Related:

If you are running homebrew on a Mac, then update too:

Of course this “XKCD dependency” adoption applies:

[Wayback/Archive] GJ4KvbeWIAAS_mu (535×680)

Posted in C, Compression, Development, Infosec (Information Security), Power User, Security, Software Development, xz | Leave a Comment »

When Microsoft download URLs time out: check if it other IP addresses for the same host do work fine (it might be a regional Microsoft CDN issue)

Posted by jpluimers on 2024/03/28

A while back, early in the Wednesday morning after Patch Tuesday I performed regular updates of all the systems noticing some updates failed because timeouts on the Microsoft download servers.

Note I perform the manual steps on Wednesday as Patch Tuesday as it starts at 10:00 AM PST which is in the evening in Amsterdam. The automated steps are automated and kick in when Microsoft tells the Windows machines to update themselves.

See [Wayback/Archive] Security Update Guide FAQs

Microsoft schedules the release of security updates on “Patch Tuesday,” the second Tuesday of each month at 10:00 AM PST.

Depending on time zone(s) in which the organization operates, IT pros should plan their deployment schedules accordingly. Please note that there are some products that do not follow the Patch Tuesday schedule.

I posted a gist and a Tweet, but didn’t immediately thought of a good resolution so I postponed that until Thursday and found it:

Read the rest of this entry »

Posted in C, C++, Development, Power User, Software Development, Visual Studio and tools, Visual Studio C++, vscode Visual Studio Code, Windows, Windows Development | Leave a Comment »