vkd3d: Add a win32 version of vkd3d_get_program_name.

This commit is contained in:
Stefan Dösinger 2023-12-27 12:21:44 +03:00 committed by Alexandre Julliard
parent 962096f179
commit d6b1e62ffc
Notes: Alexandre Julliard 2024-05-08 22:51:40 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/832

View File

@ -901,6 +901,30 @@ bool vkd3d_get_program_name(char program_name[PATH_MAX])
return true; return true;
} }
#elif defined(WIN32)
bool vkd3d_get_program_name(char program_name[PATH_MAX])
{
char buffer[MAX_PATH];
char *p, *name;
size_t len;
*program_name = '\0';
len = GetModuleFileNameA(NULL, buffer, ARRAY_SIZE(buffer));
if (!(len && len < MAX_PATH))
return false;
name = buffer;
if ((p = strrchr(name, '/')))
name = p + 1;
if ((p = strrchr(name, '\\')))
name = p + 1;
len = strlen(name) + 1;
memcpy(program_name, name, len);
return true;
}
#else #else
bool vkd3d_get_program_name(char program_name[PATH_MAX]) bool vkd3d_get_program_name(char program_name[PATH_MAX])