Discussion:
Regsvr32 failed for debug version of Dll, why?
(too old to reply)
Jay
2006-10-29 04:37:19 UTC
Permalink
Hi There,

I am working on a MFC application with sone Dlls. Development
environment: Visual Studio 6.0 / Sp6 on Windows XP/Sp2. I login the
system as an administrator.

When I was registering debug version of my dll using regsvr32, it
failed. Result of debugging points to:

BOOL COleLinkingDoc::RegisterIfServerAttached(LPCTSTR lpszPathName,
BOOL bMessage)

The lpszPathName is my dll file name, which is empty; although I am
sure the path name has been sent to the regsvr32.

I tried to register the same dll file programmatically:

// Start of the code /////////

#ifdef _WIN32
// this call failed because file path is empty when it is passed
to
// OleLinkingDoc::RegisterIfServerAttached function even I send a
const
// string! Note that if it is release version, it works fine
HINSTANCE hDLL = LoadLibrary("C:\\MyDll\\Debug\\MyLib.dll");
if(NULL == hDLL)
{
// See Winerror.h for explaination of error code.
DWORD error = GetLastError();
TRACE1("LoadLibrary() Failed with: %i\n", error);
}
#endif
//
/////////End of code ////////

Could anybody here tell me why the problem occurs and how to get rid of
it?

I'd try to run the 'regsvr32.exe' command in the DependencyWalker in
'Profile' mode. If the myLib.dll is in its debug directory, the error
info:
LoadLibraryExW("myLib.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH)
returned NULL. Error: Invalid access to memory location (998).

If the file is copied into C:\WOMDOWS\system32, then loaded with the
dependency walker, the error info is:
LoadLibraryExW("myLib.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH)
returned NULL. Error: The specified module could not be found (126).

Could anyone tell me why the error messages are deferent upon on
deferent location?

Thank you,

Jay
Ajay Kalra
2006-10-29 12:44:41 UTC
Permalink
Use Depends.exe and load MyLib.DLL in it. This will show you if any of
its dependents cannot be found. Most likely the problem is related to
location of dependent modules is not in the path.

--
Ajay
Post by Jay
Hi There,
I am working on a MFC application with sone Dlls. Development
environment: Visual Studio 6.0 / Sp6 on Windows XP/Sp2. I login the
system as an administrator.
When I was registering debug version of my dll using regsvr32, it
BOOL COleLinkingDoc::RegisterIfServerAttached(LPCTSTR lpszPathName,
BOOL bMessage)
The lpszPathName is my dll file name, which is empty; although I am
sure the path name has been sent to the regsvr32.
// Start of the code /////////
#ifdef _WIN32
// this call failed because file path is empty when it is passed
to
// OleLinkingDoc::RegisterIfServerAttached function even I send a
const
// string! Note that if it is release version, it works fine
HINSTANCE hDLL = LoadLibrary("C:\\MyDll\\Debug\\MyLib.dll");
if(NULL == hDLL)
{
// See Winerror.h for explaination of error code.
DWORD error = GetLastError();
TRACE1("LoadLibrary() Failed with: %i\n", error);
}
#endif
//
/////////End of code ////////
Could anybody here tell me why the problem occurs and how to get rid of
it?
I'd try to run the 'regsvr32.exe' command in the DependencyWalker in
'Profile' mode. If the myLib.dll is in its debug directory, the error
LoadLibraryExW("myLib.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH)
returned NULL. Error: Invalid access to memory location (998).
If the file is copied into C:\WOMDOWS\system32, then loaded with the
LoadLibraryExW("myLib.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH)
returned NULL. Error: The specified module could not be found (126).
Could anyone tell me why the error messages are deferent upon on
deferent location?
Thank you,
Jay
Jay
2006-10-29 13:38:20 UTC
Permalink
Please tell what is message mean:

LoadLibraryExW("myLib.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH)
returned NULL. Error: Invalid access to memory location (998)

It is gotten from the dependency walker by profiling the dll.

Thanks,

Jay
Post by Jay
Hi There,
I am working on a MFC application with sone Dlls. Development
environment: Visual Studio 6.0 / Sp6 on Windows XP/Sp2. I login the
system as an administrator.
When I was registering debug version of my dll using regsvr32, it
BOOL COleLinkingDoc::RegisterIfServerAttached(LPCTSTR lpszPathName,
BOOL bMessage)
The lpszPathName is my dll file name, which is empty; although I am
sure the path name has been sent to the regsvr32.
// Start of the code /////////
#ifdef _WIN32
// this call failed because file path is empty when it is passed
to
// OleLinkingDoc::RegisterIfServerAttached function even I send a
const
// string! Note that if it is release version, it works fine
HINSTANCE hDLL = LoadLibrary("C:\\MyDll\\Debug\\MyLib.dll");
if(NULL == hDLL)
{
// See Winerror.h for explaination of error code.
DWORD error = GetLastError();
TRACE1("LoadLibrary() Failed with: %i\n", error);
}
#endif
//
/////////End of code ////////
Could anybody here tell me why the problem occurs and how to get rid of
it?
I'd try to run the 'regsvr32.exe' command in the DependencyWalker in
'Profile' mode. If the myLib.dll is in its debug directory, the error
LoadLibraryExW("myLib.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH)
returned NULL. Error: Invalid access to memory location (998).
If the file is copied into C:\WOMDOWS\system32, then loaded with the
LoadLibraryExW("myLib.dll", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH)
returned NULL. Error: The specified module could not be found (126).
Could anyone tell me why the error messages are deferent upon on
deferent location?
Thank you,
Jay
Loading...