Hi,
Thanks for the quick response.
FYI : I am using VC++ 6.0.
I ran the debugger and found the chunk of code where
the error gets generated and returned. It is below
between the asterisks. The code is in the file
C:\..\ATL\Include\ATLBASE.H.
We also observed that the "szModule" variable (which
should contain the path to the DLL) contained zeroes
(in the HEX representation) which turned out to be
periods (".") in the ASCII representation of the
contents of the section in memory allocated to it.
In order to see whether this was normal, I created a
component on my hard-drive and ran "Build All". The
resulting DLL not only registered but the "szModule"
variable had no zeroes or periods.
So it seems that the presence of the sets of two bytes
of zeroes (periods) consistently after every other set
of two bytes in the representation of the path to the
DLL may be responsible for the "Bad Arguement -
80070057" error code.
Do you have any tips on how to get around this?
Thanks once more.
Akochi
P.S. the code is below:
//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
ATLINLINE ATLAPI
AtlModuleUpdateRegistryFromResourceD(_ATL_MODULE* pM,
LPCOLESTR lpszRes,BOOL bRegister, struct
_ATL_REGMAP_ENTRY* pMapEntries, IRegistrar* pReg)
{
USES_CONVERSION;
ATLASSERT(pM != NULL);
HRESULT hRes = S_OK;
CComPtr<IRegistrar> p;
if (pReg != NULL)
p = pReg;
else
{
hRes = CoCreateInstance(CLSID_Registrar, NULL,
CLSCTX_INPROC_SERVER, IID_IRegistrar, (void**)&p);
}
if (SUCCEEDED(hRes))
{
TCHAR szModule[_MAX_PATH];
GetModuleFileName(pM->m_hInst, szModule, _MAX_PATH);
// Convert to short path to work around bug in
NT4's CreateProcess
TCHAR szModuleShort[_MAX_PATH];
GetShortPathName(szModule, szModuleShort,
_MAX_PATH);
LPOLESTR pszModule = T2OLE(szModuleShort);
int nLen = ocslen(pszModule);
LPOLESTR pszModuleQuote =
(LPOLESTR)alloca((nLen*2+1)*sizeof(OLECHAR));
CComModule::ReplaceSingleQuote(pszModuleQuote,
pszModule);
p->AddReplacement(OLESTR("Module"), pszModuleQuote);
if (NULL != pMapEntries)
{
while (NULL != pMapEntries->szKey)
{
ATLASSERT(NULL != pMapEntries->szData);
p->AddReplacement((LPOLESTR)pMapEntries->szKey,
(LPOLESTR)pMapEntries->szData);
pMapEntries++;
}
}
LPCOLESTR szType = OLESTR("REGISTRY");
if (HIWORD(lpszRes)==0)
{
******************************************************
if (bRegister)
hRes = p->ResourceRegister(pszModule,
((UINT)LOWORD((DWORD)lpszRes)), szType);
******************************************************
else
hRes = p->ResourceUnregister(pszModule,
((UINT)LOWORD((DWORD)lpszRes)), szType);
}
else
{
if (bRegister)
hRes = p->ResourceRegisterSz(pszModule, lpszRes,
szType);
else
hRes = p->ResourceUnregisterSz(pszModule, lpszRes,
szType);
}
}
return hRes;
}
///////////////////////////////////////////////////////
///////////////////////////////////////////////////////
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
|