News:

Download Pelles C here: http://www.pellesc.se

Main Menu

Recent posts

#71
Assembly discussions / Re: Windows domain membership
Last post by Vortex - September 22, 2026, 11:52:49 AM
Hello,

Here is the 64-bit version :

OS_DOMAINMEMBER equ 28

ExitProcess PROTO :QWORD
IsOS PROTO :QWORD
printf PROTO :QWORD,:VARARG

.data

m1  db 'The computer is not joined to a domain.',0
m2  db 'The computer is joined to a domain.',0
tbl dq OFFSET m1,OFFSET m2

.data?

rv  dq ?

.code

start:

    sub     rsp,4*8+8

    invoke  IsOS,OS_DOMAINMEMBER

    xor     rdx,rdx
    test    rax,rax
    setne   dl
    mov     rv,rdx
    shl     rdx,3
    lea     rax,[tbl+rdx]

    invoke  printf,QWORD PTR [rax]

    invoke  ExitProcess,rv

END start
#73
Beginner questions / Where to download old version?
Last post by desert_myrrh - September 20, 2026, 09:16:41 AM
Hi,

I was recently tasked with migrating some legacy applications written in C99 for Windows XP. It appears the previous developer used Pelles C.

From my research, it seems the last version with Windows XP support was the 7.x series; however, I haven't been able to find a place to download it.

Does anyone know where I can find download links for the 32-bit and 64-bit editions of the final 7.x version?

What about other versions? I haven't found a repository for them anywhere. The site I was referred to (http://www.smorgasbordet.com/pellesc) simply doesn't display anything.
#74
Work in progress / Re: Controls notifications ref...
Last post by MrBcx - September 19, 2026, 05:02:15 PM
Michele -- Thank you for sharing your library. 

When I built my BCX_SPLITBUTTON control and its support function earlier this year,
I learned some lessons about dealing with WM_NOTIFY messages originating in the
parent that needed to be forwarded to the control for processing.  If not for AI,
your library would have been very helpful.  I'm going to study your code some more
and hopefully learn a few more lessons that will help me in the future.

#75
Work in progress / Controls notifications reflect...
Last post by Michele - September 19, 2026, 01:36:09 PM
Almost all windows UI programmers needed to create custom versions or behavior of standard controls to perform special function.
For simple hackings the control procedure subclassing is enough, but for some more sophisticated modifications we need to handle also the notifications messages.
The problem in this case is that the notification messages, in WM_COMMAND or WM_NOTIFY form, are sent only to the parent window. The solution is to insert the custom handling code inside the parent procedure, or subclass it adding another procedure function.
The result is always complex code difficult to read, debug and maintain, not mentioning the difficulties to route control private data structures and cleaning allocated resources: memory, properties, etc.
Another limitation is the portability, to reuse the customization for other controls requires many tweaking in the program sources.

It would be very nice to code all the custom functions inside the control subclass procedure, possibly with a transparent layer that reflects the window messages to the control subclass procedure and take care of infrastructure creation and cleanup.
To avoid reinventing the wheel, I thoroughly examined several well-established techniques that have been in use for years, observing how they are employed by frameworks such as MFC, ATL, and the like.
I built this simple framework for the code above. It isn't perfect, needs more tests and may get upgrades for added functionalities.
Up to now it works flawlessly for my code.

I share it in the hope that could be of any help to someone else.

P.S. It is freshly written code and I didn't put a lot of comments up to now, but I think it is easily understandable. The AI was of a lot of help to speed-up.
#76
Tips & tricks / Re: UTF-8 multilanguage consol...
Last post by TimoVJL - September 18, 2026, 12:14:50 PM
Windows 7 have Consolas font, but version 5.? and Windows 1x have version 7 font family.
Less interest to console, albeit file / folder names can have many kind of chars.
#77
Tips & tricks / Re: UTF-8 multilanguage consol...
Last post by Michele - September 18, 2026, 09:26:00 AM
Timovjl you successfully changed the codepage to UTF-8, in fact many characters are correctly displayed.
I agree that now the problem is the console font that doesn't contains the full set.
A known font known to render all charset is 'Consolas', try changing the face font with:
BOOL SetConsoleFontToConsolas(void)
{
    HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
    if (hConsole == INVALID_HANDLE_VALUE) return FALSE;

    CONSOLE_FONT_INFOEX cfi;
    cfi.cbSize = sizeof(CONSOLE_FONT_INFOEX);

    // Get the current font info first to preserve defaults
    if (!GetCurrentConsoleFontEx(hConsole, FALSE, &cfi))
    {
        return FALSE;
    }

    // Set font properties
    cfi.dwFontSize.X = 0;   // Width (0 lets Windows calculate based on height)
    cfi.dwFontSize.Y = 16;  // Height (Font size in points/pixels)
    cfi.FontFamily = FF_DONTCARE;
    cfi.FontWeight = FW_NORMAL;

    // Specify a TrueType font that supports UTF-8 Unicode characters
    // Common choices: L"Cascadia Code", L"Consolas", L"Lucida Console"
    wcscpy_s(cfi.FaceName, LF_FACESIZE, L"Consolas");

    // Apply the new font
    return SetCurrentConsoleFontEx(hConsole, FALSE, &cfi);
}

If still doesn't it confirms that the fonts in your OS version are limited.
You said that on a Win10/11 system it works?
#78
Tips & tricks / Re: UTF-8 multilanguage consol...
Last post by TimoVJL - September 18, 2026, 09:03:07 AM
Windows 7 x64 EN console.

Less fonts than Windows 1x versions.

#79
Tips & tricks / Re: UTF-8 multilanguage consol...
Last post by Michele - September 17, 2026, 10:06:40 PM
Hello Vortex, I imagine that the problem is the OS version.
I will not add mine, just report what Gemini says:
QuoteThe functions SetConsoleOutputCP and SetConsoleCP along with the CP_UTF8 code page constant (code page 65001) have been supported since Windows 2000.

However, the minimal OS version depends on what you are trying to achieve:

Basic Function Support (API availability): Windows 2000 or later. Calling SetConsoleOutputCP(65001) is supported on all Windows NT-based OS versions starting from 2000, as well as Windows XP, Vista, 7, 8, and 10.

Functional UTF-8 Console Rendering: Windows 10 Version 1903 (Build 18362) or later.

Why the distinction matters:
While the functions exist on older OS versions, UTF-8 support inside cmd.exe on legacy releases (Windows 7/8/early Win 10) was notoriously buggy:

Legacy Bugs: On older versions like Windows 7, setting the console to code page 65001 frequently broke C runtime output routines (printf), caused character truncation, or crashed batch scripts.

Font Rendering: Legacy consoles couldn't render multi-byte UTF-8 sequences properly unless using specific TrueType fonts.

Full ConPTY Overhaul: Microsoft fully overhauled the Windows Console infrastructure in Windows 10 version 1903 (Build 18362)—the exact same release that introduced manifest-based UTF-8 ACP support—making UTF-8 output reliable and stable in the terminal.
#80
Tips & tricks / Re: UTF-8 multilanguage consol...
Last post by Vortex - September 17, 2026, 10:01:22 PM
Hi Michele,

Thanks for your code. Testing your executable on my Windows 7 Sp1 64-bit, I get a lot of garbled characters, probably a limitation of Windows 7.