FsGetPreviewBitmap is not being called

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, petermad, Stefan2, white

hramov
Junior Member
Junior Member
Posts: 15
Joined: 2007-10-14, 18:12 UTC
Location: Russia

FsGetPreviewBitmap is not being called

Post by *hramov »

I have a problem with function FsGetPreviewBitmap.
Version of Total Commander 7.0 (32 bit) 6.6.2007

Function FsGetPreviewBitmap is not call

Code: Select all

#define IDB_BITMAP1                     101 

Code: Select all

EXPORTS
	FsInit
	FsFindFirst
	FsFindNext
	FsFindClose
	FsGetDefRootName
	FsGetPreviewBitmap
	FsGetLocalName
	FsLinksToLocalFiles

Code: Select all

int __stdcall FsGetPreviewBitmap(char* RemoteName,int width,int height,  HBITMAP* ReturnedBitmap)
{
	*ReturnedBitmap=LoadBitmap((HINSTANCE)hmyself,MAKEINTRESOURCE(IDB_BITMAP1));
	return FS_BITMAP_EXTRACTED;
}
[mod]New bugreport split from Strange behaviour of FsGetPreviewBitmap.

Hacker (Moderator)[/mod]
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

I would like to add some info about hramov's report.
We (hramov and me) are tested very simple fs-plugin on two different computers. On one of them FsGetPreviewBitmap is called and bitmap is shown correctly in thumbnail view. On another computer FsGetPreviewBitmap is not called at all.
Both computer running the same version of TC and test was made with empty ini file.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This should work OK. How do you set hmyself? Could you try with the current TC version 7.02a?
Author of Total Commander
https://www.ghisler.com
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

hmyself is set in DllMain

Code: Select all

BOOL APIENTRY DllMain( HANDLE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
    switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
			hmyself=hModule;
		case DLL_THREAD_ATTACH:
		case DLL_THREAD_DETACH:
		case DLL_PROCESS_DETACH:
			break;
    }
    return TRUE;
}
I want to accent - I'v checked this with TC 7.02a on two computers - WinXP SP1 and WinXP SP2 with the same executables files (both totalcmd and plugin).
FsGetPreviewBitmap is called on WinXP SP1 and is not called on Win XP SP2.

If you want you can download whole test project (it is very simple project created for testing this issue only) here - http://rapidshare.com/files/62530992/fsbmp_src.zip.html
User avatar
Lefteous
Power Member
Power Member
Posts: 9536
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2VadiMGP
I have downloaded and debugged the plug-in here on my German Windows XP Pro SP2. It stops fine here in FsGetPreviewBitmap. The bitmap is displayed properly in thumbnail view.
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

Well, so reason isn't a Windows version, but what it can be?
Obviously, it is some environmental issue, but we are unable to figure out it.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Maybe TC gets confused by the random data returned by FsFindFirst. Try clearing the WIN32_FIND_DATA structure via
memset(FindData,0,sizeof(WIN32_FIND_DATA));
before setting any parts of it.
Author of Total Commander
https://www.ghisler.com
hramov
Junior Member
Junior Member
Posts: 15
Joined: 2007-10-14, 18:12 UTC
Location: Russia

Post by *hramov »

At me without changes :(
My plugins: http://hram-tc.ru/
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

2ghisler(Author)
Unfortunately no success on my side too. :(

1. I've added memset(FindData,0,sizeof(WIN32_FIND_DATA)); but it has no effect.

2. I've changed FsFindFirst as follow

Code: Select all

HANDLE __stdcall FsFindFirst(char* Path,WIN32_FIND_DATA *FindData)
{
	memset(FindData,0,sizeof(WIN32_FIND_DATA)); 
	HANDLE ff=FindFirstFile("c:\\text.txt",FindData);
	FindClose(ff);
	strcpy(FindData->cFileName,"file.nam");

	return (HANDLE)1;
}
but also without success. Of course, "c:\\text.txt" exists and I'm able to view it via F3 from FS-panel.

3. I used APImonitor (from www.apimonitor.com) and seen that TC retrieves address of FsGetPreviewBitmap successfully.

What else can we do/try ?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Does it work when you leave out the functions
BOOL __stdcall FsLinksToLocalFiles(void)
and
BOOL __stdcall FsGetLocalName(char* RemoteName,int maxlen)
?

Maybe TC is somehow trying to get the preview image from the linked file? I checked that in my source and couldn't confirm it, but I cannot exclude that it works like that in some previous version.
Author of Total Commander
https://www.ghisler.com
hramov
Junior Member
Junior Member
Posts: 15
Joined: 2007-10-14, 18:12 UTC
Location: Russia

Post by *hramov »

I deleted function
BOOL __stdcall FsLinksToLocalFiles(void)
and
BOOL __stdcall FsGetLocalName(char* RemoteName,int maxlen)
in *.cpp, *.h and *.def files, but no change.
My plugins: http://hram-tc.ru/
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

I confirm. Dropping of FsLinksToLocalFiles and FsGetLocalName doesn't solve the problem.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50475
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Who moved this thread to fixed bugs then?
Author of Total Commander
https://www.ghisler.com
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Christian,
Who moved this thread to fixed bugs then?
As the original bug was confirmed fixed, it might have easily been me.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
D1P
Senior Member
Senior Member
Posts: 233
Joined: 2005-02-28, 18:29 UTC
Location: Moscow
Contact:

Post by *D1P »

Hi. I have this problem too. I use Delphi 7 under Windows 2003 Enterprise (no SP installed).

I wrote simple debugging application. It just load wfx library, find FsGetPreviewBitmap procedure adress and call it with some parameters. But standart GetProcAddress function doesn't return procedure adress in this case! Why? I have no idea...

You can download my simple debugger from http://super.wincmd.ru/_tmp/FsGetPreviewBitmapTest.rar (sources included). It is very simple, and not nedeed with any comments.
Post Reply