[svn-r26216] Removed inappropriate TEXT() macro from the plugin name and changed a few Win32 API calls to use the <function>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.
This commit is contained in:
Dana Robinson 2015-02-18 14:41:43 -05:00
parent 27a385d557
commit c3385d9010

View File

@ -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)