FreeRDP/winpr/libwinpr/library/test/TestLibraryGetProcAddress.c

51 lines
1001 B
C
Raw Normal View History

#include <stdio.h>
#include <winpr/crt.h>
2012-10-05 07:19:05 +04:00
#include <winpr/path.h>
#include <winpr/tchar.h>
#include <winpr/windows.h>
2012-10-05 22:45:54 +04:00
#include <winpr/library.h>
int TestLibraryGetProcAddress(int argc, char* argv[])
{
2012-10-05 07:19:05 +04:00
char* str;
int length;
LPTSTR BasePath;
//HINSTANCE library;
2012-10-05 07:19:05 +04:00
LPTSTR LibraryPath;
str = argv[1];
#ifdef UNICODE
length = MultiByteToWideChar(CP_UTF8, 0, str, strlen(str), NULL, 0);
BasePath = (WCHAR*) malloc((length + 1) * sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, str, length, (LPWSTR) BasePath, length * sizeof(WCHAR));
BasePath[length] = 0;
#else
2012-10-05 22:45:54 +04:00
BasePath = _strdup(str);
2012-10-05 07:19:05 +04:00
#endif
_tprintf(_T("Base Path: %s\n"), BasePath);
PathAllocCombine(BasePath, _T("TestLibraryA\\TestLibraryA.dll"), 0, &LibraryPath);
//_tprintf(_T("Loading Library: %s\n"), LibraryPath);
/*
library = LoadLibrary(LibraryPath);
if (!library)
{
printf("LoadLibrary failure\n");
return -1;
}
if (!FreeLibrary(library))
{
printf("FreeLibrary failure\n");
return -1;
}*/
return 0;
}