Skip to content

CommandLineToArgvW() always returns a null pointer on Windows 9x #8

@Aerocatia

Description

@Aerocatia

Take the example here

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
    int argc;
    wchar_t **argv = CommandLineToArgvW(GetCommandLineW(), &argc);
    if(!argv) {
        MessageBoxA(NULL, "returned nullptr", "test", MB_OK | MB_ICONERROR);
    }
    else {
        MessageBoxA(NULL, "success", "test", MB_OK);
    }

    return 0;
}

It always fails on 9x. I don't think it could be a real allocation problem because regular allocations with malloc() work just fine.
GetCommandLineW() seems to work correctly.
Tested on Windows 98 SE and Windows ME. I am using mingw32_686-msvcrt_win98-15.2.0-r7

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions