mirror of
https://gitlab.winehq.org/wine/wine.git
synced 2024-11-19 17:06:04 -07:00
tools: Use GetModuleFileNameA in get_bindir on Windows targets.
This commit is contained in:
parent
51d7a3dee3
commit
62d49fd48c
Notes:
Alexandre Julliard
2024-09-16 23:24:59 +02:00
Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/wine/merge_requests/6495
2 changed files with 9 additions and 3 deletions
|
@ -56,6 +56,8 @@
|
|||
# define strncasecmp _strnicmp
|
||||
# define strcasecmp _stricmp
|
||||
# endif
|
||||
# include <windef.h>
|
||||
# include <winbase.h>
|
||||
#else
|
||||
extern char **environ;
|
||||
# include <spawn.h>
|
||||
|
@ -706,7 +708,10 @@ static inline char *get_bindir( const char *argv0 )
|
|||
if (!dir && !(dir = realpath( argv0, NULL ))) return NULL;
|
||||
return get_dirname( dir );
|
||||
#else
|
||||
return get_dirname( argv0 );
|
||||
char path[MAX_PATH], *p;
|
||||
GetModuleFileNameA( NULL, path, ARRAYSIZE(path) );
|
||||
for (p = path; *p; p++) if (*p == '\\') *p = '/';
|
||||
return get_dirname( path );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#define IMAGE_FILE_MACHINE_I386 0x014c
|
||||
#define IMAGE_FILE_MACHINE_POWERPC 0x01f0
|
||||
#define IMAGE_FILE_MACHINE_AMD64 0x8664
|
||||
#define IMAGE_FILE_MACHINE_ARMNT 0x01C4
|
||||
#define IMAGE_FILE_MACHINE_ARMNT 0x01c4
|
||||
#define IMAGE_FILE_MACHINE_ARM64 0xaa64
|
||||
|
||||
#define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
|
||||
|
@ -942,7 +942,8 @@ static unsigned int flush_output_to_section( const char *name, int dir_idx, unsi
|
|||
|
||||
if (!output_buffer_pos) return 0;
|
||||
|
||||
strncpy( sec->name, name, sizeof(sec->name) );
|
||||
memset( sec->name, 0, sizeof(sec->name) );
|
||||
memcpy( sec->name, name, min( strlen(name), sizeof(sec->name) ));
|
||||
sec->ptr = output_buffer;
|
||||
sec->size = output_buffer_pos;
|
||||
sec->flags = flags;
|
||||
|
|
Loading…
Reference in a new issue