Browse Source

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: https://github.com/iojs/io.js/pull/226
Reviewed-By: Bert Belder <bertbelder@gmail.com>
v1.8.0-commit
Cheng Zhao 10 years ago
committed by Bert Belder
parent
commit
604b876147
  1. 4
      deps/cares/src/ares_library_init.c
  2. 2
      src/node_win32_etw_provider.cc
  3. 2
      src/node_win32_perfctr_provider.cc

4
deps/cares/src/ares_library_init.c

@ -45,7 +45,7 @@ static int ares_win32_init(void)
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
hnd_iphlpapi = 0; hnd_iphlpapi = 0;
hnd_iphlpapi = LoadLibrary("iphlpapi.dll"); hnd_iphlpapi = LoadLibraryW(L"iphlpapi.dll");
if (!hnd_iphlpapi) if (!hnd_iphlpapi)
return ARES_ELOADIPHLPAPI; return ARES_ELOADIPHLPAPI;
@ -73,7 +73,7 @@ static int ares_win32_init(void)
*/ */
hnd_advapi32 = 0; hnd_advapi32 = 0;
hnd_advapi32 = LoadLibrary("advapi32.dll"); hnd_advapi32 = LoadLibraryW(L"advapi32.dll");
if (hnd_advapi32) if (hnd_advapi32)
{ {
ares_fpSystemFunction036 = (fpSystemFunction036_t) ares_fpSystemFunction036 = (fpSystemFunction036_t)

2
src/node_win32_etw_provider.cc

@ -167,7 +167,7 @@ void NTAPI etw_events_enable_callback(
void init_etw() { void init_etw() {
events_enabled = 0; events_enabled = 0;
advapi = LoadLibrary("advapi32.dll"); advapi = LoadLibraryW(L"advapi32.dll");
if (advapi) { if (advapi) {
event_register = (EventRegisterFunc) event_register = (EventRegisterFunc)
GetProcAddress(advapi, "EventRegister"); GetProcAddress(advapi, "EventRegister");

2
src/node_win32_perfctr_provider.cc

@ -135,7 +135,7 @@ void InitPerfCountersWin32() {
wcscpy_s(Inst, INST_MAX_LEN, INST_PREFIX); wcscpy_s(Inst, INST_MAX_LEN, INST_PREFIX);
_itow_s(pid, Inst + INST_PREFIX_LEN, INST_MAX_LEN - INST_PREFIX_LEN, 10); _itow_s(pid, Inst + INST_PREFIX_LEN, INST_MAX_LEN - INST_PREFIX_LEN, 10);
advapimod = LoadLibrary("advapi32.dll"); advapimod = LoadLibraryW(L"advapi32.dll");
if (advapimod) { if (advapimod) {
perfctr_startProvider = (PerfStartProviderExFunc) perfctr_startProvider = (PerfStartProviderExFunc)
GetProcAddress(advapimod, "PerfStartProviderEx"); GetProcAddress(advapimod, "PerfStartProviderEx");

Loading…
Cancel
Save