From: Jay on
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

From: Ajay Kalra on
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

Jay wrote:
> 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

From: Jay on
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

Jay wrote:
> 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