Category Archives: Coding

Posts about coding and other software issues

C++ Calling Convention with naked functions

Calling conventions are a standardized methods for c++ compilers how to pass parameters to called function. MS Visual Studio gives possibility to use four of them: cdecl, fastcall, stdcall and vectorcall. The specific of every calling convention is hidden in function prolog and not visible for high level language programmer. This article makes an attempt… Read More »

CPU usage programmatically

Do you know what does it mean when some tool shows percentage of CPU usage, for example 60%? Basically this indicates that during some timing interval 60% of time processor spent on execution of some software code and 40% did nothing or was in idle state. Usually CPU timing is divided into 3 main categories:… Read More »

How to Increase CPU Usage

The title of this post looks ridiculous, usually high CPU usage is a problem that slows down your computer and people are fighting to reduce CPU usage. However in my particular case I was working on CPU monitoring code and I need some tool that makes CPU consumption higher. So I created simple C# console… Read More »

Custom Protocol Handler (CPH)

Microsoft Windows supports registered custom protocols additionally to the common ones such as http, https, ftp, mailto and so on. To register an application to handle a particular URI scheme, new key, along with the appropriate subkeys and values should be added to the Windows registry. The new key The may be added to HKEY_LOCAL_MACHINE\Software\Classes… Read More »

UTC to local time converter in C++

Recently it was needed to convert UTC time string to local computer time string in C++ code. After analyzing several examples from stackoverflow and other resources I implemented this one. It is short application free from explicitely specified time zone. It is not extremely sophisticated at all. I am keeping it here mainly for my… Read More »

Happy MMXVIII new year or JavaScript in WP post

This is the first my post in 2018. The main goal of this post is to check how javascript code embedded into WP post works. The javascript code which is used in this post may be downloaded from here. It is pure javascript implementation without jQuery or other libraries. The purpose of the code is… Read More »

How To Find Parent Process in Windows

Everything has been started by someone. It is related also to any application executed in operating system, except system itself. If you start notepad from command prompt the parent process of notepad process is command prompt. Currently most of the people find parent process using WMI query. For example: C:\projects>wmic process get processid,parentprocessid,name | findstr… Read More »

Processing Output Debug String Event

In previous article “Writing Windows Debugger in C#” the whole debugger architecture for Windows OS was discuss. This post describe how to process output debug string event sent by debugged process. On debugger side output debug string event is triggered by OutputDebugString function call, which has 2 versions: ASCII version OutputDebugStringA and Unicode version OutputDebugStringW.… Read More »

Writing Windows Debugger in C#

Actually C# is not the best language to call Windows Debugging functions. Several pinvokes and debugging structures definitions are required. They may be taken for winbase.h include file. In attached projects these pinvoke and structures definitions are located in PInvokes.cs file. Debugger is a program to debug another process. The debugger may start new process… Read More »