I want to load unired.dll which used in default Windows Printer driver resource file.
I can load unires.dll for Windows Vista x86.
It’s located in C:\Windows\System32\spool\drivers\w32x86\3
But now I use Windows 7 Pro x64.
So the same name unires.dll which is located in
C:\Windows\System32\spool\drivers\x64\3 cannot be load.
By the following code,GetLastError() returns 193
Is it possible? or impossible ?
I use Visual Studio 2005 Pro. try build x64 and x86 but each of them failed.
TCHAR libName[MAX_PATH];
wsprintf(libName , _T("unires.dll"));
HINSTANCE hLibraryInstance = ::LoadLibrary(libName);
DWORD ErrorId=::GetLastError();
std::wofstream out;
out.open(_T("unires.txt"));
for(UINT resKey=0;resKey<100000;resKey++)
{
TCHAR * resBuf=new TCHAR[CHAR_MAX];
int BufferMaxSize=CHAR_MAX;
int Result=::LoadString(hLibraryInstance, resKey, resBuf, BufferMaxSize);
wstring resStr=resBuf;
if(!resStr.empty())
{
out<<resKey;
out<<" ";
out<<resStr.c_str();
out<<endl;
}
if(resBuf!=NULL)
{
delete [] resBuf;
}
}
out.close();
Please help me.
Best regards!!
As mentioned in the comment link, you can’t load a x64 library in a x86 process.
The solution might be to port your program to 64 bit.