【发布时间】:2012-09-18 08:29:54
【问题描述】:
我想加载在默认 Windows 打印机驱动程序资源文件中使用的 unired.dll。 我可以为 Windows Vista x86 加载 unires.dll。
它位于 C:\Windows\System32\spool\drivers\w32x86\3
但现在我使用的是 Windows 7 Pro x64。
所以同名的unires.dll位于 C:\Windows\System32\spool\drivers\x64\3 无法加载。
通过以下代码,GetLastError() 返回 193
有可能吗?还是不可能? 我使用 Visual Studio 2005 Pro。尝试构建 x64 和 x86,但它们都失败了。
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();
请帮助我。 最好的问候!!
【问题讨论】:
标签: x86 64-bit loadlibrary