Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

The operation completed successfully

May
13,399
190
By mistake I put a non-plugin DLL into the plugins directory. When I started TCC, I got

Code:
TCC: (Sys) The operation completed successfully.
 "InitializePlugin"
That doesn't seem right. I would have expected "The entry point could not be found" (or something like that).
 
> By mistake I put a non-plugin DLL into the plugins directory. When I
> started TCC, I got
>
> Code:
> ---------
> TCC: (Sys) The operation completed successfully.
> "InitializePlugin"
> ---------
> That doesn't seem right. I would have expected "The entry point could
> not be found" (or something like that).

The error is coming from Windows, not from TCC. (When TCC then queries
Windows for the actual error message, Windows apparently has already
forgotten all about it.)

IMO it's not worth the effort to look for every case where Windows returned
an error (and subsequently denied it), and try to substitute some
meaningful TCC error message. (For one thing, it'd be a translation
nightmare.)

Rex Conn
JP Software
 
On Wed, 13 Jul 2011 14:36:35 -0400, rconn <> wrote:

|The error is coming from Windows, not from TCC. (When TCC then queries
|Windows for the actual error message, Windows apparently has already
|forgotten all about it.)

Is TCC calling GetLastError() right away? When I

Code:
IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
Printf("%lu\r\n", GetLastError());

and hMod doesn't have "InitializePlugin", I get "127" which should translate to
"The specified procedure could not be found.".
 
> Is TCC calling GetLastError() right away?

Yes.


> Code:
> ---------
> IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
> Printf("%lu\r\n", GetLastError());
> ---------
> and hMod doesn't have "InitializePlugin", I get "127" which
> should translate to
> "The specified procedure could not be found.".

And that's what I get here (tried it on three systems).

Rex Conn
JP Software
 
It looks to me like it varies according to the .DLL; some give one message, some give another. I've seen "the operation completed successfully," "the specified procedure could not be found," "the specified module could not be found," and even "class does not exist."

The only moral I take from all this is "so don't do that already!"
 
On Wed, 13 Jul 2011 15:58:55 -0400, rconn <> wrote:

|---Quote---
|> Is TCC calling GetLastError() right away?
|---End Quote---
|Yes.
|
|
|
|---Quote---
|> Code:
|> ---------
|> IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
|> Printf("%lu\r\n", GetLastError());
|> ---------
|> and hMod doesn't have "InitializePlugin", I get "127" which
|> should translate to
|> "The specified procedure could not be found.".
|---End Quote---
|And that's what I get here (tried it on three systems).

You lost me. Then why do I see the wrong message?

If I do this in a plugin:

Code:
typedef BOOL (WINAPI *IPTYPE) (void);
HMODULE hMod = LoadLibrary(L"appmgr.dll");
IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
if ( ip == NULL )
	error(GetLastError(), L"InitializePlugin");

I see the expected:

Code:
TCC: (Sys) The specified procedure could not be found.
 "InitializePlugin"
 
On Wed, 13 Jul 2011 17:00:18 -0400, rconn <> wrote:

|---Quote---
|> You lost me. Then why do I see the wrong message?
|---End Quote---
|Ask Microsoft.
|
|As Charles says, it's going to vary depending on the dll.

I won't believe that until I see it. Maybe someone will name a DLL (not
exporting BOOL InitializePlugin(void)) that will make the plugin code (far
below) produce anything other than

Code:
TCC: (Sys) The specified procedure could not be found.
 "InitializePlugin"

Code:
typedef BOOL (WINAPI *IPTYPE) (void);
HMODULE hMod = LoadLibrary(szDllName);
IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
if ( ip == NULL )
	error(GetLastError(), L"InitializePlugin");
 
On Wed, 13 Jul 2011 17:00:18 -0400, rconn <> wrote:

|---Quote---
|> You lost me. Then why do I see the wrong message?
|---End Quote---
|Ask Microsoft.
|
|As Charles says, it's going to vary depending on the dll.

I won't believe that until I see it. Maybe someone will name a DLL (not
exporting BOOL InitializePlugin(void)) that will make the plugin code (far
below) produce anything other than

Code:
TCC: (Sys) The specified procedure could not be found.
 "InitializePlugin"
Code:
typedef BOOL (WINAPI *IPTYPE) (void);
HMODULE hMod = LoadLibrary(szDllName);
IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
if ( ip == NULL )
    error(GetLastError(), L"InitializePlugin");

There are 1356 DLLs in my System32 directory. Three (MSVC runtime DLLs are excluded because they pop up message boxes about being loaded improperly). 68 more refuse to load (LoadLibrary returns NULL). All the rest produce the error message above when I ask for the address of "InitializePlugin".
 
There are 1356 DLLs in my System32 directory. Three (MSVC runtime DLLs are excluded because they pop up message boxes about being loaded improperly). 68 more refuse to load (LoadLibrary returns NULL). All the rest produce the error message above when I ask for the address of "InitializePlugin".

Not reproducible here, with 3 systems and 100 randomly selected dll's.

There's apparently something getting in the middle on your system. I can't do anything about Windows errors -- if the misleading error message bothers you, don't do it.
 
I can reproduce the odd (Windows) behavior. Apparently, TCC calls FreeLibrary() before GetLastError() and FreeLibrary() resets LastError (either randomly, or depending (in some inexplicable way) on the library it's freeing).

The files (in system32) xmlprov.dll and xmlprovi.dll demonstrate the difference. The code far below loads each and tries to get the address of "InitializePlugin" ... all of this twice, the first time calling FreeLibrary() before GetLastError() and the second time the other way around.

The results (immediately below) shows that in the first of the two tests, FreeLibrary resets LastError (for no apparent reason).

Code:
File is: s:\xmlprov.dll
LastError is: 127
FreeLibrary returned: 1
LastError is: 0  ................................................. BAD!
TCC: (Sys) The operation completed successfully.
 "InitializePlugin"

File is: s:\xmlprovi.dll
LastError is: 127
FreeLibrary returned: 1
LastError is: 127
TCC: (Sys) The specified procedure could not be found.
 "InitializePlugin"

File is: s:\xmlprov.dll
LastError is: 127
TCC: (Sys) The specified procedure could not be found.
 "InitializePlugin"
FreeLibrary returned: 1

File is: s:\xmlprovi.dll
LastError is: 127
TCC: (Sys) The specified procedure could not be found.
 "InitializePlugin"
FreeLibrary returned: 1
Code:
typedef BOOL (WINAPI *IPTYPE) (void);
LPWSTR files[2] = {L"s:\\xmlprov.dll", L"s:\\xmlprovi.dll"};
for ( INT i=0; i<2; i++ )
{
    Printf(L"File is: %s\r\n", files[i]);
    HMODULE hMod = LoadLibrary(files[i]);
    IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
    if ( ip == NULL )
    {
        Printf(L"LastError is: %lu\r\n", GetLastError());
        Printf(L"FreeLibrary returned: %lu\r\n", FreeLibrary(hMod));
        Printf(L"LastError is: %lu\r\n", GetLastError());
        error(GetLastError(), L"InitializePlugin");
        Printf(L"\r\n");
    }
}
for ( INT i=0; i<2; i++ )
{
    Printf(L"File is: %s\r\n", files[i]);
    HMODULE hMod = LoadLibrary(files[i]);
    IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
    if ( ip == NULL )
    {
        Printf(L"LastError is: %lu\r\n", GetLastError());
        error(GetLastError(), L"InitializePlugin");
        Printf(L"FreeLibrary returned: %lu\r\n\r\n", FreeLibrary(hMod));
    }
}
 
On Thu, 14 Jul 2011 17:29:38 -0400, rconn <> wrote:

|---Quote (Originally by vefatica)---
|There are 1356 DLLs in my System32 directory. Three (MSVC runtime DLLs are excluded because they pop up message boxes about being loaded improperly). 68 more refuse to load (LoadLibrary returns NULL). All the rest produce the error message above when I ask for the address of "InitializePlugin".
|---End Quote---
|
|Not reproducible here, with 3 systems and 100 randomly selected dll's.
|
|There's apparently something getting in the middle on your system. I can't do anything about Windows errors -- if the misleading error message bothers you, don't do it.

See my very recent post. Apperently FreeLibrary() may (for no apparent reason)
reset LastError when it succeeds (and may not!).
 
Back
Top
[FOX] Ultimate Translator
Translate