News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Recent posts

#71
User contributions / Offline GitHub MS Documents
Last post by John Z - November 09, 2025, 05:21:33 PM
Attached is the full release for the access program for the win32-docs.zip downloaded from GitHub:
https://github.com/MicrosoftDocs/win32

This provides a way to use and access documentation (mainly the API Names) from the GitHub documentation effort off-line, and searchable.

The documents can be viewed in the .md format or in a .html format.  Searching is provided in the .md display, and of course intrinsically in the web browser viewing .html.

TimoVJL provided the code/method to search the win32 documentation for API NAMES from which I created a database and the rest of the program.  See readme_v4.txt, for other external source code attributions.

It is possible that the MD_Files_3.db3 could be expanded in the future to include all topics in the win32-docs.zip and that would not require changing the basic program to be immediately useful.  TBD

John Z
#72
Work in progress / Re: ChatGPT examples
Last post by Vortex - November 09, 2025, 10:01:13 AM
Console application to get the boot time :

/* ChatGPT code */

#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <stdio.h>

int main(void)
{
    FILETIME ftNow, ftBootUtc, ftBootLocal;
    ULONGLONG now100ns;
    ULONGLONG uptimeMs;
    ULONGLONG boot100ns;
    SYSTEMTIME st;

    /* current system time as FILETIME (UTC, 100-ns intervals since 1601) */
    GetSystemTimeAsFileTime(&ftNow);
    now100ns = ((ULONGLONG)ftNow.dwHighDateTime << 32) | ftNow.dwLowDateTime;

    /* milliseconds since system start */
    uptimeMs = GetTickCount64(); /* Vista+; returns milliseconds since boot */

    /* convert uptime to 100-ns units and subtract */
    boot100ns = now100ns - (uptimeMs * 10000ULL);

    /* convert back to FILETIME structure */
    ftBootUtc.dwLowDateTime  = (DWORD)(boot100ns & 0xFFFFFFFF);
    ftBootUtc.dwHighDateTime = (DWORD)(boot100ns >> 32);

    /* show UTC boot time */
    if (FileTimeToSystemTime(&ftBootUtc, &st)) {
        printf("Boot time (UTC)  : %04u-%02u-%02u %02u:%02u:%02u\n",
               st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
    }

    /* convert to local time and show */
    if (FileTimeToLocalFileTime(&ftBootUtc, &ftBootLocal) &&
        FileTimeToSystemTime(&ftBootLocal, &st)) {
        printf("Boot time (local): %04u-%02u-%02u %02u:%02u:%02u\n",
               st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
    }

    return 0;
}
#73
User contributions / Re: Boot time
Last post by Vortex - November 08, 2025, 10:10:06 PM
Hi Timo,

Keep up the nice work.
#74
User contributions / Boot time
Last post by TimoVJL - November 08, 2025, 03:01:42 PM
Inspirate from
http://masm32.com/board/index.php?msg=140972
I might fix this later.

#define WIN32_LEAN_AND_MEAN
#include <windows.h>

#define NTSTATUS  LONG

typedef struct _SYSTEM_TIMEOFDAY_INFORMATION
{
    LARGE_INTEGER BootTime;                     // Number of 100-nanosecond intervals since the system was started.
    LARGE_INTEGER CurrentTime;                  // The current system date and time.
    LARGE_INTEGER TimeZoneBias;                 // Number of 100-nanosecond intervals between local time and Coordinated Universal Time (UTC).
    ULONG TimeZoneId;                           // The current system time zone identifier.
    ULONG Reserved;                             // Reserved
    ULONGLONG BootTimeBias;                     // Number of 100-nanosecond intervals between the boot time and Coordinated Universal Time (UTC).
    ULONGLONG SleepTimeBias;                    // Number of 100-nanosecond intervals between the sleep time and Coordinated Universal Time (UTC).
} SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION;

#define SystemTimeOfDayInformation 3
// enum SYSTEM_INFORMATION_CLASS

//NTSTATUS WINAPI NtQuerySystemInformation(int SystemInformationClass,
//    PVOID SystemInformation, ULONG SystemInformationLength, PULONG ReturnLength);

typedef int (WINAPI NTQUERYSYSTEMINFORMATION)(int SystemInformationClass,
    PVOID SystemInformation, ULONG SystemInformationLength, PULONG ReturnLength);
typedef NTQUERYSYSTEMINFORMATION *LNTQUERYSYSTEMINFORMATION;
// FILETIME SYSTEMTIME
void __cdecl WinMainCRTStartup(void)
{
    HANDLE hLib;
    static LNTQUERYSYSTEMINFORMATION NtQuerySystemInformation;
    SYSTEM_TIMEOFDAY_INFORMATION stodi;
    FILETIME ft;
    SYSTEMTIME st;
    char szBuf[50];
    hLib = LoadLibrary("ntdll.dll");
    NtQuerySystemInformation = (LNTQUERYSYSTEMINFORMATION)GetProcAddress(hLib, "NtQuerySystemInformation");
    NtQuerySystemInformation(SystemTimeOfDayInformation, &stodi, sizeof(stodi), 0);
    (*(LONGLONG*)&stodi.BootTime) -= (*(LONGLONG*)&stodi.TimeZoneBias);
    ft.dwLowDateTime = ((LARGE_INTEGER*)&stodi.BootTime)->LowPart;
    ft.dwHighDateTime = ((LARGE_INTEGER*)&stodi.BootTime)->HighPart;
    FileTimeToSystemTime(&ft, &st);
    wsprintf(szBuf, "Date: %04d-%02d-%02d\nTime: %02d:%02d:%02d", st.wYear, st.wMonth, st.wDay,
        st.wHour, st.wMinute, st.wSecond);
    MessageBox(0, szBuf, "Boot time", MB_OK);
    ExitProcess(0);
}
#75
Work in progress / Re: win32-doc md files
Last post by John Z - November 08, 2025, 02:09:03 PM
:)
It looks like I have got 3.0.2 working in Pelles C at least for unzipping to a file or memory.

I'll need to run some tests to see if it works for zipping too.

Making progress in either case.

John Z

Update - looking nice, it was able to zip a file and both 7z and WIN zip could access it and the file was extracted intact and readable.

#76
Assembly discussions / Re: Rich Edit sample
Last post by Vortex - November 08, 2025, 09:15:32 AM
Same example built with binary resource template :

include DlgBox.inc

.data

DialogBox:

INCBIN "MyDlg.bin"

.code

start:

    mov     eax,RichEditANSIWndProc
    invoke  GetModuleHandle,0

    xor     ecx,ecx
    invoke  DialogBoxIndirectParam,eax,\
            ADDR DialogBox,ecx,ADDR DlgProc,ecx

    invoke  ExitProcess,eax

DlgProc PROC hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

    .IF uMsg==WM_CLOSE

        invoke  EndDialog,hWnd,0

    .ELSE

        xor     eax,eax
        ret

    .ENDIF

    mov     eax,1
    ret

DlgProc ENDP

END start
#77
Work in progress / Re: win32-doc md files
Last post by John Z - November 06, 2025, 11:22:03 PM
Quote from: TimoVJL on November 06, 2025, 07:06:38 PMLike in this:
https://github.com/kuba--/zip

Thank Timo!  I'll give this one a try - maybe simple enough for me to use.

John Z

Update:  An older version of this (1.19) is what I am using now.  Back in about 2020 I went through the 1.19 code and succeeded in getting it to work for Pelles C.  Now looking at this version 3.0.2 it is just as difficult under Pelles C as 1.19 was :( but structurally it has changed a lot so a file difference does not highlight changes compared to what I did in 1.19 SO it is basically going to be starting all over......   
#78
Work in progress / Re: win32-doc md files
Last post by Vortex - November 06, 2025, 07:14:31 PM
Hi Timo,

Mentioning about Miniz, are your referring to this project?

https://github.com/richgel999/miniz
#79
Work in progress / Re: win32-doc md files
Last post by TimoVJL - November 06, 2025, 07:06:38 PM
Many times is good to keep line numbers intact.

Have miniz still problems with Pelles C 13 ?

Like in this:
https://github.com/kuba--/zip

EDIT: it have :(
#80
Work in progress / Re: win32-doc md files
Last post by John Z - November 06, 2025, 04:18:08 PM
Yes about what I did but a bit differently-
I added     #ifdef _PELLESC__
        #define MD_ASSERT(cond)     do {} while(0)
        #define MD_UNREACHABLE()    do {} while(0)
    #elif
at the beginning of the block there.

Flags are set to accommodate the GitHub idiosyncrasies, but
will probably work ok for any .md file.  Use the 'Convert other .md File'
button.

Here is a quick update of the program
Fixed needing the TOP button so that is now removed.

Added ability to list every name in the DB by entering an *
Hoping this makes it easier to find something -

John Z

Still need to modernize the ZIP code before posting sources.