From c3385d9010fc4ef11bd0aa463a2341ff72115787 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 18 Feb 2015 14:41:43 -0500 Subject: [svn-r26216] Removed inappropriate TEXT() macro from the plugin name and changed a few Win32 API calls to use the A version, which forces char behavior (vs. wchar_t) when UNICODE is defined. This only affects Windows. Fixes HDFFV-8927 Tested on 64-bit Windows 7 with Visual Studio 2012 and CMake 3.2 with UNICODE/_UNICODE both defined and undefined. --- src/H5PL.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/H5PL.c b/src/H5PL.c index 8042651..1806ea6 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -40,7 +40,19 @@ /* Macros for supporting * both Windows and Unix */ /****************************/ -/* Windows support */ +/* Windows support + * + * SPECIAL WINDOWS NOTE + * + * Some of the Win32 API functions expand to fooA or fooW depending on + * whether UNICODE or _UNICODE are defined. You MUST explicitly use + * the A version of the functions to force char * behavior until we + * work out a scheme for proper Windows Unicode support. + * + * If you do not do this, people will be unable to incorporate our + * source code into their own CMake builds if they define UNICODE. + */ + #ifdef H5_HAVE_WIN32_API #define H5PL_PATH_SEPARATOR ";" @@ -49,7 +61,7 @@ #define H5PL_HANDLE HINSTANCE /* Get a handle to a plugin library. Windows: TEXT macro handles Unicode strings */ -#define H5PL_OPEN_DLIB(S) LoadLibraryEx(TEXT(S), NULL, LOAD_WITH_ALTERED_SEARCH_PATH) +#define H5PL_OPEN_DLIB(S) LoadLibraryExA(S, NULL, LOAD_WITH_ALTERED_SEARCH_PATH) /* Get the address of a symbol in dynamic library */ #define H5PL_GET_LIB_FUNC(H,N) GetProcAddress(H,N) @@ -457,17 +469,17 @@ done: static htri_t H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) { - WIN32_FIND_DATA fdFile; - HANDLE hFind; - char *pathname = NULL; - char service[2048]; - htri_t ret_value = FALSE; + WIN32_FIND_DATAA fdFile; + HANDLE hFind; + char *pathname = NULL; + char service[2048]; + htri_t ret_value = FALSE; FUNC_ENTER_STATIC /* Specify a file mask. *.* = We want everything! */ sprintf(service, "%s\\*.dll", dir); - if((hFind = FindFirstFile(service, &fdFile)) == INVALID_HANDLE_VALUE) + if((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE) HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory") do { @@ -498,7 +510,7 @@ H5PL__find(H5PL_type_t plugin_type, int type_id, char *dir, const void **info) HDassert(pathname); pathname = (char *)H5MM_xfree(pathname); } /* end if */ - } while(FindNextFile(hFind, &fdFile)); /* Find the next file. */ + } while(FindNextFileA(hFind, &fdFile)); /* Find the next file. */ done: if(hFind) -- cgit v0.12