Skip to content

Commit 9c0554e

Browse files
authored
Merge pull request #1958 from dscho/ansi-unicode
mingw: safeguard against compiling with `-DUNICODE`
2 parents 1120702 + 0f05a8c commit 9c0554e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

compat/mingw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1679,7 +1679,7 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
16791679
do_unset_environment_variables();
16801680

16811681
/* Determine whether or not we are associated to a console */
1682-
cons = CreateFile("CONOUT$", GENERIC_WRITE,
1682+
cons = CreateFileA("CONOUT$", GENERIC_WRITE,
16831683
FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
16841684
FILE_ATTRIBUTE_NORMAL, NULL);
16851685
if (cons == INVALID_HANDLE_VALUE) {
@@ -2344,7 +2344,7 @@ struct passwd *getpwuid(int uid)
23442344
return p;
23452345

23462346
len = sizeof(user_name);
2347-
if (!GetUserName(user_name, &len)) {
2347+
if (!GetUserNameA(user_name, &len)) {
23482348
initialized = 1;
23492349
return NULL;
23502350
}
@@ -3270,7 +3270,7 @@ int is_inside_windows_container(void)
32703270
return inside_container;
32713271

32723272
inside_container = ERROR_SUCCESS ==
3273-
RegOpenKeyEx(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &handle);
3273+
RegOpenKeyExA(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &handle);
32743274
RegCloseKey(handle);
32753275

32763276
return inside_container;

compat/poll/poll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ win32_compute_revents (HANDLE h, int *p_sought)
147147
if (!once_only)
148148
{
149149
NtQueryInformationFile = (PNtQueryInformationFile)
150-
GetProcAddress (GetModuleHandle ("ntdll.dll"),
150+
GetProcAddress (GetModuleHandleA ("ntdll.dll"),
151151
"NtQueryInformationFile");
152152
once_only = TRUE;
153153
}

compat/win32/exit-process.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static int exit_process(HANDLE process, int exit_code)
127127
HANDLE thread = NULL;
128128

129129
if (!initialized) {
130-
HINSTANCE kernel32 = GetModuleHandle("kernel32");
130+
HINSTANCE kernel32 = GetModuleHandleA("kernel32");
131131
if (!kernel32)
132132
die("BUG: cannot find kernel32");
133133
exit_process_address = (LPTHREAD_START_ROUTINE)

compat/winansi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,12 +629,12 @@ void winansi_init(void)
629629

630630
/* create a named pipe to communicate with the console thread */
631631
xsnprintf(name, sizeof(name), "\\\\.\\pipe\\winansi%lu", GetCurrentProcessId());
632-
hwrite = CreateNamedPipe(name, PIPE_ACCESS_OUTBOUND,
632+
hwrite = CreateNamedPipeA(name, PIPE_ACCESS_OUTBOUND,
633633
PIPE_TYPE_BYTE | PIPE_WAIT, 1, BUFFER_SIZE, 0, 0, NULL);
634634
if (hwrite == INVALID_HANDLE_VALUE)
635635
die_lasterr("CreateNamedPipe failed");
636636

637-
hread = CreateFile(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
637+
hread = CreateFileA(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
638638
if (hread == INVALID_HANDLE_VALUE)
639639
die_lasterr("CreateFile for named pipe failed");
640640

0 commit comments

Comments
 (0)