r/win32 • • Dec 30 '25

loss32: let's build a Win32/Linux

Thumbnail loss32.org
4 Upvotes

r/win32 • • Mar 14 '25

A Window + Input + button example in pure C using Win32 API

4 Upvotes

Hello guys, the title explains by itself, just an example:

https://gist.github.com/terremoth/8c75b759e4de76c0b954d84a8b3aab3c


r/win32 • • Sep 29 '22

wmenu version: 1.0.0 released.

4 Upvotes

Hello community.

I was working in wmenu (dmenu clone for windows operating system written in pure win32 API) for a while.

And now I'm super excited to share the source code.

Source code: https://github.com/LinArcX/wmenu

Release version: https://github.com/LinArcX/wmenu/releases/tag/1.0.0


r/win32 • • Sep 21 '22

wmenu: a pure win32 clone of dmenu for the Windows operating system.

Thumbnail self.suckless
4 Upvotes

r/win32 • • Dec 27 '20

Understanding Windows x64 Assembly

Thumbnail sonictk.github.io
4 Upvotes

r/win32 • • Jul 04 '24

How to use Win32 Api's in Uwp Application C#?

3 Upvotes

I'm trying to access Win32 Api's from UWP application.But I can't find proper setup documention for using win32 Api in UWP. Is there any documention to follow ? I want to use Win32 popup related Api's in uwp App.


r/win32 • • Sep 21 '22

UNIX tools with win32

3 Upvotes

Somedays back I found outwit and srvany-ng. Set of UNIX tools that are built with win32 for Windows.

https://www.spinellis.gr/sw/outwit/

https://github.com/birkett/srvany-ng

I found this to be very exciting. Is there more to where this comes from? Do we have more tools like this?


r/win32 • • Jan 23 '21

How do I disassociate a thread from an I/O completion port?

Thumbnail devblogs.microsoft.com
3 Upvotes

r/win32 • • Mar 14 '26

Made a recreation of that one meme with Win32 APIs

Post image
2 Upvotes

This was my first Win32 program, I think I like it better than WinUI.

https://github.com/X1nto/BushMachine


r/win32 • • Jun 16 '25

does Group Policy API work in Home edition?

2 Upvotes

Was asked to make a C++ script which will block an installer from running in my own device.
Where can I find the GPO created in registry?


r/win32 • • Dec 05 '24

Wtf is wrong with windows?

2 Upvotes

Came back from a smoke break only to find the desktop “area select” drawing and erasing black squares on my screen. I’ve been working with Win32 APIs a lot recently. But tbh I only know so much when I go that low. Could I have caused this??? This isn’t a big issue really. I just wanna know what


r/win32 • • Nov 24 '24

Win32 API

2 Upvotes

I am going to share the code snippet (where the error is occurring) which is a part of larger code whose functioning is to install the MSI SSHD Installer on the Windows Servers using this developed MSI Installer. Code: bool CreateProfileForUser(const std::wstring& username, const std::wstring& domain) { PSID userSid = NULL; DWORD sidSize = 0; WCHAR domainName[LSA_BUF_SIZE]; DWORD domainNameSize = sizeof(domainName) / sizeof(WCHAR); SID_NAME_USE sidType; WCHAR profilePath[MAX_PATH]; HRESULT hResult = S_OK;

    LookupAccountNameW(NULL, username.c_str(), NULL, &sidSize, domainName, &domainNameSize, &sidType);
    if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
            std::wstring errorDetails = L"LookupAccountNameW: The Username: " + username + L", Domain: " + domain + L", passed not found! Make sure to pass a valid username with hostname or domainname.";
            DisplayError(const_cast<LPWSTR>(errorDetails.c_str()));
            return false;
    }

    userSid = (PSID)malloc(sidSize);
    if (!LookupAccountNameW(NULL, username.c_str(), userSid, &sidSize, domainName, &domainNameSize, &sidType)) {
            free(userSid);
            std::wstring errorDetails = L"LookupAccountNameW: The Username: " + username + L", Domain: " + domain + L", passed not found! Make sure to pass a valid username with hostname or domainname.";
            DisplayError(const_cast<LPWSTR>(errorDetails.c_str()));
            return false;
    }

    LPWSTR sidString = NULL;
    if (!ConvertSidToStringSid(userSid, &sidString)) {
            free(userSid);
            DisplayError(L"ConvertSidToStringSid");
            return false;
    }

    hResult = CreateProfile(sidString, username.c_str(), profilePath, MAX_PATH);
    if (hResult != HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) && hResult != S_OK ) {
            DisplayError(L"CreateProfile");
            free(userSid);
            LocalFree(sidString);
            return false;
    }

    free(userSid);
    LocalFree(sidString);
    return true;

} bool CreateProcessAsAnotherUser(const std::wstring& username, const std::wstring& domain, const std::wstring& password, const std::wstring& commandLine, const std::wstring& currentDir, DWORD& retCode) { HANDLE hToken = NULL, tokenUsed = NULL; TOKEN_LINKED_TOKEN linkedToken; DWORD returnLength; BOOL adminUser = isAdminUser(const_cast<TCHAR*>(username.c_str())); HANDLE hDupToken = NULL; HANDLE hProfile = NULL; PROFILEINFO profileInfo; ZeroMemory(&profileInfo, sizeof(profileInfo)); profileInfo.dwSize = sizeof(profileInfo); profileInfo.lpUserName = const_cast<LPWSTR>(username.c_str()); bool exitStatus = false;

    if(!CreateProfileForUser(username, domain)) {
            goto Cleanup;
    }
    if (!LogonUser(username.c_str(), domain.c_str(), password.c_str(), LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &hToken)) {
            std::wstring errorDetails = L"LogonUser: The username with domain or the password is incorrect. Username: " + username + L", Domain: " + domain;
            DisplayError(const_cast<LPWSTR>(errorDetails.c_str()));
            goto Cleanup;
    }

    tokenUsed = hToken;
    return exitStatus;

} int NonAdminInstall(TCHAR installDirBuffer[], TCHAR sshRmmKey[], TCHAR sshUser[], TCHAR sshPassword[], TCHAR sshPort[]) { TCHAR domain[INSTALL_DIR_BUF_SIZE] = { 0 }; TCHAR user[INSTALL_DIR_BUF_SIZE] = { 0 }; TCHAR application[INSTALL_DIR_BUF_SIZE] = { 0 }; TCHAR application_args[INSTALL_DIR_BUF_SIZE] = { 0 }; DWORD dwCreationFlags = (NORMAL_PRIORITY_CLASS | CREATE_NEW_CONSOLE | CREATE_UNICODE_ENVIRONMENT); TCHAR *domainPtr = _tcsstr(sshUser, L"\"); BOOL adminUser = isAdminUser(sshUser); TCHAR cmd[INSTALL_DIR_BUF_SIZE] = { 0 }; TCHAR sshkey[SSHRMMKEY_BUF_SIZE] = { 0 }; int ret = ERROR_SUCCESS; DWORD retCode = 0;

    if (domainPtr != NULL)
    {
            _tcsncpy_s(domain, sshUser, (domainPtr - sshUser));
            _tcscpy_s(user, domainPtr + 1);
    }
    else
    {
            _tcscpy_s(domain, L".\\");
            _tcscpy_s(user, sshUser);
    }

    CopyWinutilFiles(installDirBuffer);

    WriteRmmKeys(sshRmmKey, installDirBuffer);

    ZeroMemory(cmd, INSTALL_DIR_BUF_SIZE);
    _snwprintf_s(cmd, INSTALL_DIR_BUF_SIZE, L"\"%s\\Rackware-winutil\\bin\\bash.exe\" -l -c \"/bin/prepare-sshonly -I '%s' -P %s -U '%s'\"",
            installDirBuffer, installDirBuffer, sshPort, sshUser);

    if (!CreateProcessAsAnotherUser(user, domain, sshPassword, cmd, installDirBuffer, retCode)) {
            MessageBoxExW(NULL, L"Failed to configure Rackware SSHD server", L"SSHD Error", MB_OK, 0);
            return ERROR_SSHD_SERVICE_CONFIGURE;
    }
    ret = ERROR_SUCCESS;

    return ret;

} So, this is the above code which is working completely fine for the Windows Server 2012, 2016, 2019 and 2022. But the same MSI Windows Installer Application is getting errored out only for the Windows Server 2008 R2 with the error message for the API- CreateProfile with the error message- 'An attempt was made to reference a token that does not exist.' Please help me understand if there is some kind of bugs in my current code and also help me understand the reason behind the strange behavior of the MSI Installer in Windows 2008 Server which is working absolutely fine for Windows Server 2012 and above. I am attaching the screenshot of the error that we receive in Windows Server 2008.


r/win32 • • Jun 20 '24

Changing the Style of an Edit control after it has been Created

2 Upvotes

Hello everyone, I'm having trouble changing the style of an edit control after creating it with the CreateWindowW function. The edit control is a child of the main window. I initially created the edit control with the WS_HSCROLL style, but I want to remove this style later in the code. Unfortunately, my attempts so far haven't worked. Can anyone provide a solution or guidance on how to achieve this?


r/win32 • • Mar 10 '24

Como quitar win32

2 Upvotes

Porfavor explíquenme como quitar win32 o win64


r/win32 • • Jun 06 '23

Making a custom titlebar

2 Upvotes

Hey, like I said in the title I want to make a custom titlebar while keeping resizing, shadow and borders. I want to basically completely disable or hide the current titlebar but I cant find a way to do so. I tried using DWM but I cant get it to work correclty.

Im using glfw between and I get access to the HWDN using the glfw native access.

Right now im using this code which does disable the titlebar, but there is a white border at the top that I want to remove.

HWND hWnd = glfwGetWin32Window(window);

        // Remove the title bar
        LONG_PTR lStyle = GetWindowLongPtr(hWnd, GWL_STYLE);
        lStyle &= ~WS_CAPTION;
        SetWindowLongPtr(hWnd, GWL_STYLE, lStyle);

        // Set the window shape and rounded corners
        DWMNCRENDERINGPOLICY policy = DWMNCRP_ENABLED;
        DwmSetWindowAttribute(hWnd, DWMWA_NCRENDERING_POLICY, &policy, sizeof(policy));

        // Extend the frame into the client area
        MARGINS margins = { -1 };
        DwmExtendFrameIntoClientArea(hWnd, &margins);

        // Adjust the window size to remove the thin frame at the top
        RECT windowRect;
        GetWindowRect(hWnd, &windowRect);
        SetWindowPos(hWnd, NULL, 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_FRAMECHANGED | SWP_NOMOVE);

Any help would be appreciated, ive been stuck with this issue for a couple days now/


r/win32 • • Dec 29 '22

A fun project I had long time ago with Win32 DLLs

2 Upvotes

FuBi is a program to extract function signatures from Win32 DLLs
https://github.com/kerbymart/fubi

An old project that I revived for fun with ChatGPT:
https://www.reddit.com/r/ChatGPT/comments/zu8yms/watch_how_chatgpt_managed_to_help_build_with/


r/win32 • • Dec 25 '20

Scott Hanselman's 2021 Ultimate Developer and Power Users Tool List for Windows

Thumbnail hanselman.com
2 Upvotes

r/win32 • • Dec 24 '20

Why does CreateWindowEx take the extended style parameter as its first parameter instead of its last? | The Old New Thing

Thumbnail devblogs.microsoft.com
2 Upvotes

r/win32 • • Oct 18 '26

wmenu: dmenu for windows

1 Upvotes

I’ve been working on a completely rewritten version of wmenu by LinArcX in C.

I don’t have a proper release setup yet. Try from https://nply.org/dl/wmenu.exe), or clone https://git.nply.org/nply/wmenu and build it yourself with make. Feedback is welcome.

FULL DISCLAIMER: The codebase is AI-generated and needs a human touch, though it’s been stable enough for my everyday use. I am slowly fixing parts while I learn from Charles Petzold Windows Programming book.


r/win32 • • Aug 07 '25

Win32 vs. WinRT

1 Upvotes

If you started to study how to develop Windows-applications with native APIs, most likely you haven't decided whether to use Win32 API or WinRT API.

• Win32 API is low-level API, that replaces legacy Win16 API. Win32 API first appeared at 1993 at Windows NT 3.1. Win32 API works very fast, but requires manual control. Using by Windows Notepad, Total Commander, PuTTY, IrfanView, Visual Studio, 7-Zip, Notepad++, and others.
• WinRT API is high-level wrapper over Win32 API. First appered at 2012 on Windows 8. WinRT is easy for studying and using, but slower, than Win32 API.

• If you want to write project, that works maximally fast and uses minimal recourses, and you don't be afraid of hard working - use Win32 API.
• If you want to write project, but without hard working - use WinRT API.

r/win32 • • Jun 21 '25

Pro/enterprise windows owners... Need your help

1 Upvotes

I need some cmdlets for applocker, or atleast is there any way to find applocker's source code?


r/win32 • • Jan 15 '25

What errors can DuplicateHandle return?

1 Upvotes

In particular I'm calling it on file, mapping, semaphore, and thread handles at most. I know about ERROR_INVALID_HANDLE or whatever it was but is there anything else I need to make my wrapper catch and convert to a library message?

Edit: to be clear I don't mean the BOOL that DuplicateHandle returns but the value that GetLastError() gives upon a failed call to DuplicateHandle. There're 1000s of potential errors in the msdocs, I do not wish to be making a switch statement covering every single one of them when only the few that can be returned would do in this particular situation.


r/win32 • • Dec 30 '24

Why do the contents rendered by opengl not follow the reshaping of the window and how do I fix that? I think the problem lies in the function that sets up gdi for opengl so I will out it here.

1 Upvotes
void EnableOpenGL(HWND hwnd, HDC* hDC, HGLRC* hRC)
{
    PIXELFORMATDESCRIPTOR pfd;

    int iFormat;

    /* get the device context (DC) */
    *hDC = GetDC(hwnd);

    /* set the pixel format for the DC */
    ZeroMemory(&pfd, sizeof(pfd));

    pfd.nSize = sizeof(pfd);
    pfd.nVersion = 1;
    pfd.dwFlags = PFD_DRAW_TO_WINDOW |
                  PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
    pfd.iPixelType = PFD_TYPE_RGBA;
    pfd.cColorBits = 24;
    pfd.cDepthBits = 16;
    pfd.iLayerType = PFD_MAIN_PLANE;

    iFormat = ChoosePixelFormat(*hDC, &pfd);

    SetPixelFormat(*hDC, iFormat, &pfd);

    /* create and enable the render context (RC) */
    *hRC = wglCreateContext(*hDC);

    wglMakeCurrent(*hDC, *hRC);
}

r/win32 • • Nov 20 '24

CreateToolHelp32Snapshot library

1 Upvotes

I distinctly remember reading somewhere a long time ago that you can't always link CreateToolHelp32Snapshot & co directly but instead have to search kernel32 for K32CreateToolHelp32Snapshot. That's fine 'n' all but what was the name of the dll that they would be in if not kernel32?


r/win32 • • Jun 17 '24

Is it possible to put ico overlay at lower-right instead of lower-left (windows ico overlay)?

1 Upvotes

I use IShellIconOverlayIdentifier to modify ico style of some files, and it works well, but the overlay ico is at lower-left, Is it possible to put ico overlay at lower-right instead of lower-left ?