Привет!
Скорее всего здесь это случается в АМХХ:
Код:
bool CModule::queryModule()
{
...
m_Handle = DLLOAD(m_Filename.c_str()); // load file
if (!m_Handle)
{
m_Status = MODULE_BADLOAD;
return false;
}
DLL просто не загружается.
Код:
#define DLLOAD(path) (DLHANDLE)LoadLibrary(path)
https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms684175%28v=vs.85%29.aspxЦитата:
Return value
If the function succeeds, the return value is a handle to the module.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Вот тестовая программка для проверки загрузки DLL:
Код:
#include <stdio.h>
#include <windows.h>
void OutpuError(DWORD err)
{
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuf,
0, NULL);
printf("%s", (LPCTSTR)lpMsgBuf);
LocalFree(lpMsgBuf);
}
int main(int argc, char *args[])
{
if (argc <= 1)
{
printf("Usage: LoadLibraryTest.exe <library file name> [function name]\r\n");
return 0;
}
DWORD err = 0;
HMODULE hLibrary = LoadLibrary(args[1]);
if (hLibrary != nullptr)
{
printf("Library loaded successfully.\r\n");
if (argc > 2)
{
FARPROC addr = GetProcAddress(hLibrary, args[2]);
if (addr != nullptr)
{
printf("%s function address: 0x%.08X.\r\n", args[2], (DWORD)addr);
}
else
{
err = GetLastError();
printf("Failed to get %s function address: 0x%.08X.\r\n", args[2], err);
OutpuError(err);
}
}
FreeLibrary(hLibrary);
return err;
}
err = GetLastError();
printf("Failed to load library: 0x%.08X.\r\n", err);
OutpuError(err);
return err;
}
Скомпилена в аттаче.
Примеры использования:
Цитата:
>LoadLibraryTest.exe
Usage: LoadLibraryTest.exe <library file name> [function name]
>LoadLibraryTest.exe test.dll
Failed to load library: 0x0000007E.
The specified module could not be found.
>LoadLibraryTest.exe user32.dll
Library loaded successfully.
>LoadLibraryTest.exe user32.dll GetWindow
Library loaded successfully.
GetWindow function address: 0x75B6926E.
>LoadLibraryTest.exe user32.dll GetWindowWrong
Library loaded successfully.
Failed to get GetWindowWrong function address: 0x0000007F.
The specified procedure could not be found.