Huw Davies (@huw) commented about dlls/shell32/dde.c:
} if (argc >= 2) {
len = lstrlenW(last_group) + 1 + lstrlenW(argv[1]) + 5;
name = heap_alloc(len * sizeof(*name));
swprintf( name, len, L"%s/%s.lnk", last_group, argv[1] );
name = combine_path(last_group, argv[1], L".lnk", TRUE); } else {
const WCHAR *filename = PathFindFileNameW(argv[0]);
len = PathFindExtensionW(filename) - filename;
name = heap_alloc((lstrlenW(last_group) + 1 + len + 5) * sizeof(*name));
swprintf( name, lstrlenW(last_group) + 1 + len + 5, L"%s/%.*s.lnk", last_group, len, filename );
WCHAR *filename = PathFindFileNameW(argv[0]);
*PathFindExtensionW(filename) = '\0';
You're modifying `argv[0]` here which is pretty ugly.
More broadly, you might find things easier if you add the `combine_path()` helper without the `sanitize` param in a first commit and then turn on the sanitizing in a second commit.