forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


VDSPOPUP crashes VDS when bitmap resources don't exist

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Other Product Support/Announcements
View previous topic :: View next topic  
Author Message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Sep 10, 2004 3:22 pm    Post subject: VDSPOPUP crashes VDS when bitmap resources don't exist Reply with quote

When testing a program using VDSPOPUP in the VDS IDE, where the popup definition refers to graphics that are stored as binary resources in the EXE (e.g.: MenuItem;;#bitmap.bmp) VDSPOPUP can cause fatal errors. These errors are unpredictable, but have included the VDS IDE (and the program being tested) disappearing without warning (and loss of unsaved changes), various exceptions or illegal memory access errors reported either in VDS or VDSPOPUP, which are sometimes so persistent it is necessary to use the Task Manager to terminate VDS. On one occasion this coincided with the entire contents of the project directory being deleted.
These errors are definitely caused by using bitmaps that are binary bitmap resources present only in the compiled EXE and not in the IDE. The errors do not always occur: I have some programs that use VDSPOPUP which can be tested with their references to non-existent binary resources intact. However, I have one program that always crashes the IDE when tested. The problem can only be avoided by commenting out the menu line that references the bitmap resources and replacing it with one that omits the bitmap reference, but it is a nuisance having to remember to undo the commenting each time I compile a binary.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Fri Sep 10, 2004 4:12 pm    Post subject: Reply with quote

Now if it's feasible for prakash to fix it then that would be nice. Even otherwise U can do onething. Find if the scipt is running from the IDE or compiled.
Use GetModuleFileName API from Kernel32.dll to check if the app's File name is vds.exe.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Fri Sep 10, 2004 5:41 pm    Post subject: Reply with quote

CodeScript wrote:
Use GetModuleFileName API from Kernel32.dll to check if the app's File name is vds.exe.


I was thinking of something along those lines as a last resort. But if the issue could be fixed it would be nice.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Fri Sep 10, 2004 9:25 pm    Post subject: Reply with quote

CodeScript wrote:
Use GetModuleFileName API from Kernel32.dll to check if the app's File name is vds.exe.
Could you post a short example about how this API should be used please? Wink

Vic

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1562

PostPosted: Sat Sep 11, 2004 5:00 am    Post subject: Reply with quote

Hi guys,
I'll take a look and see what the problem might be. The dll does check if the script is running in the IDE or from an exe and acts accordingly when trying to load resources. When it detects running from the IDE it tries to load the actual bitmap file within the same dir as the script is in.

For instance when using #mygrap.bmp, if you place the actual mygrap.bmp in the same dir as the script it will load the bitmap from the directly while in the IDE, obviously it will load the resource 'MYGRAP' from within the exe when not running from IDE.

I'm not certain why its crashing or causing errors while in the IDE at the moment as I haven't looked at the code directly; but when running under Win XP I haven't had it show any crashes or errors even when the images do not exist.
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Sat Sep 11, 2004 8:55 am    Post subject: Reply with quote

Interesting. I don't normally store resources in the project directory - I have a separate resources folder and use the project manager to tell VDS where it is. Other menus that entirely use bitmaps read from resources don't have this problem of crashing. They will run fine for testing in the IDE, the menus just don't show the bitmaps.

The menu in question is user-configurable (it's the application launcher menu in Tech-Pro Utilities) so it mostly uses bitmaps that are generated by the program and stored in a folder. This menu only uses resource bitmaps for certain defaults. To avoid having to specify the full path to the bitmap folder, which is C:\Documents and Settings\blah blah\Application Data\blah blah\Bitmap Cache, the script makes that folder the current directory, and references the bitmaps by name only. I'm wondering whether whatever happens when the script runs in the IDE could somehow be interfering with that?

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Sat Sep 11, 2004 9:17 am    Post subject: Reply with quote

For experiment, I put the full path to the non-resource bitmaps. It did cure the crash the first time the program tries to display the menu, but on a subsequent attempt VDS again disappeared without trace. After several tests of this I found that I could start the program, display the menu several times and then close the program, but when I ran the program a second time from the IDE it crashed the first time I displayed the menu.

I don't believe it can be a problem with the script, or the bitmaps, because the compiled version runs all day long without any problems.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1562

PostPosted: Sat Sep 11, 2004 3:25 pm    Post subject: Reply with quote

Hi Jules,
The reason the dll looks for the actual bitmap files in the script directory (while running in the IDE) is because the dll has no way to communicate with the project manager or vds to retreive the resource directory where bitmaps/resources are for that script.

It sounds like there might be a problem in the dll code - freeing or allocating the resources/images and is the reason its crashing vds. For instance when the dll is loaded the first time it loads all images/resources etc and might not be freeing them all correctly while in the IDE, thus when the dll is loaded up again it tries to access to load the resources again which may have already been created.

One question I have for you is while in the IDE do dll's get unloaded after the script has completed?

It seems like the dll is not unloaded thus the reason some resoruces are already created/allocated and a crash can occur if the same resource is recreated without freeing it first; in the process taking vds down with it.
Back to top
View user's profile Send private message
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Sat Sep 11, 2004 5:13 pm    Post subject: Reply with quote

Extension DLLs are unloaded on termination of a script. In fact, when developing a DLL this allows me to modify and recompile the DLL without closing down the IDE each time. However, if the DLL doesn't free all its resources then Windows won't allow it to be unloaded until the calling process (VDS) itself terminates.

However, I'm not sure this has anything to do with the problem, because I could crash VDS the first time the menu was popped up with the script just loaded in a fresh copy of the IDE. Only after modifying the script to add the full path to the bitmap did it start crashing the second time the script was run.

After setting a breakpoint on the POPUP command, I even managed to get past that point, and after that I could run the script any number of times. My hunch is it's a stack overwrite. The reason I think this is that VDS often just disappears without warning, no error message, no Dr. Watson, nothing. If I do get a message, I often get repeated error messages, like the program is trying to execute random data. This suggests to me that the stack is being overwritten, including the return address, so the program can't find its way back from the API function that caused the error.

_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Sun Sep 12, 2004 12:39 pm    Post subject: Reply with quote

My Guess is that the dll is losing track of the resources at some point (could be at the point where some hashing is done etc). Now when the dll tries to load a non existing reource it will crash. Julian U may also take a look at the way the resources are named (partial similarity in names causing probs ??)
_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
jules
Professional Member
Professional Member


Joined: 14 Sep 2001
Posts: 1043
Location: Cumbria, UK

PostPosted: Sun Sep 12, 2004 2:22 pm    Post subject: Reply with quote

No, the DLL is crashing when run from the IDE. According to Prakash, it can detect this and won't even attempt to use the binary resources.
_________________
The Tech Pro
www.tech-pro.net
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Sun Sep 12, 2004 6:18 pm    Post subject: Reply with quote

k then this is going to be more complex problem Sad
_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Other Product Support/Announcements All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group