Skip to content

Commit 604b876

Browse files
zcbenzpiscisaureus
authored andcommitted
src,deps: replace LoadLibrary by LoadLibraryW
On Windows, when compiling with `UNICODE` defined, `LoadLibrary` becomes `LoadLibraryW`. When an ASCII string is passed to that function it crashes. PR-URL: #226 Reviewed-By: Bert Belder <[email protected]>
1 parent cbf76c1 commit 604b876

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

deps/cares/src/ares_library_init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static int ares_win32_init(void)
4545
#ifdef USE_WINSOCK
4646

4747
hnd_iphlpapi = 0;
48-
hnd_iphlpapi = LoadLibrary("iphlpapi.dll");
48+
hnd_iphlpapi = LoadLibraryW(L"iphlpapi.dll");
4949
if (!hnd_iphlpapi)
5050
return ARES_ELOADIPHLPAPI;
5151

@@ -73,7 +73,7 @@ static int ares_win32_init(void)
7373
*/
7474

7575
hnd_advapi32 = 0;
76-
hnd_advapi32 = LoadLibrary("advapi32.dll");
76+
hnd_advapi32 = LoadLibraryW(L"advapi32.dll");
7777
if (hnd_advapi32)
7878
{
7979
ares_fpSystemFunction036 = (fpSystemFunction036_t)

src/node_win32_etw_provider.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void NTAPI etw_events_enable_callback(
167167
void init_etw() {
168168
events_enabled = 0;
169169

170-
advapi = LoadLibrary("advapi32.dll");
170+
advapi = LoadLibraryW(L"advapi32.dll");
171171
if (advapi) {
172172
event_register = (EventRegisterFunc)
173173
GetProcAddress(advapi, "EventRegister");

src/node_win32_perfctr_provider.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void InitPerfCountersWin32() {
135135
wcscpy_s(Inst, INST_MAX_LEN, INST_PREFIX);
136136
_itow_s(pid, Inst + INST_PREFIX_LEN, INST_MAX_LEN - INST_PREFIX_LEN, 10);
137137

138-
advapimod = LoadLibrary("advapi32.dll");
138+
advapimod = LoadLibraryW(L"advapi32.dll");
139139
if (advapimod) {
140140
perfctr_startProvider = (PerfStartProviderExFunc)
141141
GetProcAddress(advapimod, "PerfStartProviderEx");

0 commit comments

Comments
 (0)