Thread: Problems with program at work

  1. #1
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001

    Problems with program at work

    We have a program at work that keeps crashing. All it does is take 5 digital pictures and save them on the drive as BMPs.

    The 5 pictures though are compiled - for instance if you wanted to scan you car each frame would be 1 bmp. When the camera moved...another bmp. The final bmp is the sum total of all the bmps crammed together side by side. Not very efficient and not the best way....but hey I didn't write the code.

    Everyone says its crashing because of video memory, and/or system memory. But the thing has 698 MB free according to Windows and AFAIK you cannot get a pointer to texture memory under Windows w/o calling out to a third party driver running at a diff privilege level than your app. There is a big diference between video memory as we all know it and video card memory as in 256 MB of video mem. 256 MB of video mem is not the memory that the computer scans and displays on the screen. Rather it is video card texture memory and can only be accessed via drivers that map the texture memory into your app's address space or via DirectX which uses a driver...hence the HAL.

    In fact if Windows XP/NT/2000 did let you access video memory directly via a pointer what a mess that would be. So my assumption is that the privilege level of the video memory segment selector or even perhaps the LFB has been upped somewhat to prevent direct access to it by lower privilege programs. Am I way off here?

    The problem is not in the data being written to disk, it's in the image inside of the window. After a while it will begin to flash between the last known image and the current live one. After about 2 images like this...the thing will catch and error, crash, and say it is generating a log...which it doesn't. Windows does not even come up with an error which makes it hard to diagnose. This does not always occur after 2 scans....but usually when it starts flickering between 2 or 3 CTDs. Note though that even though the program CTD's and/or closes and aborts....the bmp is correctly written to disk which shows me that the buffer containing the bmps is not corrupted...rather is has something to do with the image being displayed inside of the window, or the real time image.

    Also if you close the dialog box that starts the digital camera and then reopen the dialog...the flashing stops - which points to a client HDC problem I think.

    To me it sounds like an error in the code whilst accessing the HDC of the client window. To write to a client window you must retrieve the HDC and either a pointer to the buffer the client uses or use API calls to draw inside of the buffer pixel by pixel. If this pointer to the HDC or to the buffer is corrupted via another problem in memory or a wild's possible the program could cause a CTD and on 98 probably a BSOD.

    This program is running on Win2K, note: it worked fine on Win98.

    Any ideas??
    Last edited by VirtualAce; 07-27-2004 at 04:30 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    But do you have the source code for this program?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    No, it's a commercial product but we cannot figure out why it keeps crashing.

    They have been notified. No one would listen to my theories at work since that's really not my dept., but I know what I'm talking about enough to know that it is not system and/or video memory causing the problem.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Blackjack program, having problems with the ace
    By yigster in forum C Programming
    Replies: 6
    Last Post: 05-07-2009, 06:41 AM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  4. Replies: 6
    Last Post: 07-10-2002, 07:45 PM
  5. LoadImage doesn't work when my program is accesing the hardrive
    By pinkcheese in forum Windows Programming
    Replies: 2
    Last Post: 04-20-2002, 12:39 AM