summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ/src/utilities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/IcqOscarJ/src/utilities.cpp')
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index a3fb13398c..9f212cd271 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -1888,22 +1888,12 @@ const char* ExtractFileName(const char *fullname)
char* FileNameToUtf(const TCHAR *filename)
{
- // reasonable only on NT systems
- HINSTANCE hKernel = GetModuleHandle(_T("KERNEL32"));
- DWORD (CALLBACK *RealGetLongPathName)(LPCWSTR, LPWSTR, DWORD);
+ WCHAR *usFileName = NULL;
+ int wchars = GetLongPathName(filename, usFileName, 0);
+ usFileName = (WCHAR*)_alloca((wchars + 1) * sizeof(WCHAR));
+ GetLongPathName(filename, usFileName, wchars);
- *(FARPROC *)&RealGetLongPathName = GetProcAddress(hKernel, "GetLongPathNameW");
-
- if (RealGetLongPathName)
- { // the function is available (it is not on old NT systems)
- WCHAR *usFileName = NULL;
- int wchars = RealGetLongPathName(filename, usFileName, 0);
- usFileName = (WCHAR*)_alloca((wchars + 1) * sizeof(WCHAR));
- RealGetLongPathName(filename, usFileName, wchars);
-
- return make_utf8_string(usFileName);
- }
- return make_utf8_string(filename);
+ return make_utf8_string(usFileName);
}