diff --git a/src/coreclr/vm/dwbucketmanager.hpp b/src/coreclr/vm/dwbucketmanager.hpp index 6eb0e9438b5f32..2bbd0af0ccbf96 100644 --- a/src/coreclr/vm/dwbucketmanager.hpp +++ b/src/coreclr/vm/dwbucketmanager.hpp @@ -451,13 +451,14 @@ void BaseBucketParamsManager::GetAppName(_Out_writes_(maxLength) WCHAR* targetPa } CONTRACTL_END; - HMODULE hModule = WszGetModuleHandle(NULL); PathString appPath; - - if (GetCurrentModuleFileName(appPath) == S_OK) { - CopyStringToBucket(targetParam, maxLength, appPath); + // Get just the module name; remove the path + const WCHAR* appName = wcsrchr(appPath, DIRECTORY_SEPARATOR_CHAR_W); + appName = appName ? appName + 1 : appPath; + + CopyStringToBucket(targetParam, maxLength, appName); } else { @@ -475,10 +476,7 @@ void BaseBucketParamsManager::GetAppVersion(_Out_writes_(maxLength) WCHAR* targe } CONTRACTL_END; - HMODULE hModule = WszGetModuleHandle(NULL); PathString appPath; - - WCHAR verBuf[23] = {0}; USHORT major, minor, build, revision;