How to Fix ERROR_SEEK_ON_DEVICE on LoadLibrary
Make sure to include the DLLs in the folder of your project
2 min. read
Published on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
Coder are dealing with the ERROR_SEEK_ON_DEVICE message that comes with the 132 (0x84) The file pointer cannot be set on the specified device or file description when addressing the LoadLibrary() function.
This error occurs when the program or the system can’t access a DLL library in the resources folder.
How do I fix the ERROR_SEEK_ON_DEVICE issue?
1. Check the hDll == NULL condition
Make sure to include the hDll == NULL condition to avoid this error. Here’s an example of code that includes it:
CString sDll = _T("c:\\my projects\\test\\debug\\test.dll");
HMODULE hDll = ::LoadLibrary(sDll);
if(hDll == NULL)
{
// failed to LoadLibrary!
DWORD dwErr = GetLastError();
.....
}
else
{
// work with the Dll
..........
}
2. Include the needed DLLs in your project folder
You must include all the DLLs that are used on your project in the same folder with your exe file. That ensures that the DLLs are found and your program will not have any issues with the LoadLibrary function.
Not surprisingly, if you include the DLLs in the Windows directory, the ERROR_SEEK_ON_DEVICE will not show up because the system will find them while addressing the OS.
However, in our research, we also found that including LOAD_WITH_ALTERED_SEARCH_PATH as the last parameter for LoadLibraryEx() fixes this problem and you will not get ERROR_SEEK_ON_DEVICE if all the other prerequisites are met.
We hope that our solutions helped you fix the ERROR_SEEK_ON_DEVICE 132 (0x84) error code and now your compiling shows no issues. Let us know in the comments below if you have any other possible solutions for this problem.
User forum
0 messages