How to Fix ERROR_SEEK_ON_DEVICE on LoadLibrary

Make sure to include the DLLs in the folder of your project

Reading time icon 2 min. read


Readers help support Windows Report. We may get a commission if you buy through our links. Tooltip Icon

Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more

How to fix ERROR_SEEK_ON_DEVICE
XINSTALL BY CLICKING THE DOWNLOAD FILE
A message from our partner

For fixing DLL errors, we recommend Fortect:

Fortect will search for an intitial version of your missing, corrupted or damaged DLL files that cause problems to your Windows OS and will replace it. Here is how to find them in 3 easy steps:

  • Download Fortect and install it on your PC
  • Launch the tool and Start scanning to find DLL files that could be causing PC problems
  • Right-click on Start Repair to replace all broken DLLs or fix them one by one from the console
Download Now Fortect has been downloaded by 0 readers this month, rated 4.6 on TrustPilot

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.

More about the topics: Programming tools and tips

User forum

0 messages