By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!> 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).
IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
Printf("%lu\r\n", GetLastError());
> Is TCC calling GetLastError() right away?
> 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.".
typedef BOOL (WINAPI *IPTYPE) (void);
HMODULE hMod = LoadLibrary(L"appmgr.dll");
IPTYPE ip = (IPTYPE) GetProcAddress(hMod, "InitializePlugin");
if ( ip == NULL )
error(GetLastError(), L"InitializePlugin");
TCC: (Sys) The specified procedure could not be found.
"InitializePlugin"
> You lost me. Then why do I see the wrong message?
TCC: (Sys) The specified procedure could not be found.
"InitializePlugin"
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".
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
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));
}
}