diff -r 8aff50fc76a5 -r 8c95ea7056b7 jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp --- a/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp Wed Aug 30 16:56:59 2017 +0530 +++ b/jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp Tue Aug 01 14:18:14 2017 +0800 @@ -52,6 +52,9 @@ } #endif +/* include to prevent charset problem */ +#include "PLATFORM_API_WinOS_Charset_Util.h" + #ifdef USE_DEBUG_SILENCING #define DEBUG_SILENCING0(p) TRACE0(p) #define DEBUG_SILENCING1(p1,p2) TRACE1(p1,p2) @@ -227,13 +230,13 @@ } BOOL CALLBACK DS_GetDescEnum(LPGUID lpGuid, - LPCSTR lpstrDescription, - LPCSTR lpstrModule, + LPCWSTR lpstrDescription, + LPCWSTR lpstrModule, DirectAudioDeviceDescription* desc) { INT32 cacheIndex = findCacheItemByGUID(lpGuid, g_audioDeviceCache[desc->deviceID].isSource); if (cacheIndex == desc->deviceID) { - strncpy(desc->name, lpstrDescription, DAUDIO_STRING_LENGTH); + UnicodeToUTF8AndCopy(desc->name, lpstrDescription, DAUDIO_STRING_LENGTH); //strncpy(desc->description, lpstrModule, DAUDIO_STRING_LENGTH); desc->maxSimulLines = -1; /* do not continue enumeration */ @@ -257,10 +260,10 @@ } desc->maxSimulLines = 0; if (g_audioDeviceCache[desc->deviceID].isSource) { - DirectSoundEnumerate((LPDSENUMCALLBACK) DS_GetDescEnum, desc); + DirectSoundEnumerateW((LPDSENUMCALLBACKW) DS_GetDescEnum, desc); strncpy(desc->description, "DirectSound Playback", DAUDIO_STRING_LENGTH); } else { - DirectSoundCaptureEnumerate((LPDSENUMCALLBACK) DS_GetDescEnum, desc); + DirectSoundCaptureEnumerateW((LPDSENUMCALLBACKW) DS_GetDescEnum, desc); strncpy(desc->description, "DirectSound Capture", DAUDIO_STRING_LENGTH); }