Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / I have file system problems

Author
Message
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Oct 2010 05:19
My OS is Win7. I'm using Visual C++ studio 2008. Dark GDK - Version 14th November 2007.

My problem is complicated. I have a huge program with a simple file system. Using my file system, I can navigate up/down the directory tree. The problem comes when I try to access "c:\Documents and Settings", then my program crashes. The point where it crashes has nothing to do with the file system section so I think it's a memory write-over problem. The problem with that idea is that the directory in question DOES NOT EXIST, or at least I can't find it when I look on my harddrive. Also, when I try to "dbFindFirst()" "dbFindNext()" there are no entries:

"NumberOfEntries" comes out to ZERO. I use this number to allocate memory for storage of the info I need. I have tried to work arround this issue, but nothing seems to work.

I think it may be due to a Win7 access violation that keeps the entries from being counted.

Any thoughts?

The fastest code is the code never written.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 18th Oct 2010 13:41 Edited at: 18th Oct 2010 14:46
That directory exists all right. It's so much hidden by the system that Windows Explorer doesn't show it to you even if you switch on the display of hidden files (which is quite strange), but I see it in Total Commander. It's actually not a directory at all, but a symbolic link (shortcut) to another directory c:\users.

If you don't have administrator rights, then probably you can't list the contents, so the zero number of entries may be normal, but I think it shouldn't crash. If you are sure that the crash is related to accessing this directory (link) and nothing else in the program, then open a bug report about it, attaching a simple project to reproduce the problem.

EDIT: I tried to list the contents of several directories with a simple program, having admin rights on the computer. It doesn't list the contents of "Documents and Settings", probably doesn't follow the link, but it doesn't crash either.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Oct 2010 15:44
Well, my program does a lot more than list contents, so with your experiment I can rest assured that it's a Win7 thing and not a "my program sucks" thing.

I would still like to know why it crashes. What method do you use to retreive the contents of directories?

The fastest code is the code never written.
Fatal Berserker
14
Years of Service
User Offline
Joined: 2nd Jul 2010
Location:
Posted: 18th Oct 2010 19:01
Quote: "c:\Documents and Settings"

is from xp
since vista its different
C:\Users\Name

Smoke me a kipper, ill be back for breakfast.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 18th Oct 2010 19:49
That's not what the problem is. In my program I get a "Document and Settings" folder listing when I
dbFindFirst()
dbFindNext()....
The folder name "Document and Settings" appears. When I try to access it, something happens in my program that overwrites data for something else in my program causing <bad ptr> issues.

The fastest code is the code never written.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 19th Oct 2010 03:05
Hey umm try taking a look at your source directory, here's a over bloated function I wrote up, mostly because I am going to have load bulk information soon. Just figured I would get the pro typing out the way. I also figured I could post this in the code base as well as a example.


It works, tells me what's in the directory and gives me a file count back. You may be able to test your code out with this. Good luck to you.

There are many answers but just one question" ~ Jerilith the Mad
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Oct 2010 04:22
I added:
dbCD("C:\\Documents and Settings");
before the dbFindFirst(); and I got no entries in the programs output. When I pressed [ESC], the program errored with the following:
Quote: "A buffer overrun has occurred in Dark GDK - 3D Game1.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program."

For more details please see Help topic 'How to debug Buffer Overrun Issues'.
An overrun condition is what I have experienced in my program. Somehow accessing that directory causes memory problems within the program like pointers being written over.

The exact error I get is:
Quote: "Unhandled exception at 0x015b48a3 in GUI Plugin.exe: 0xC0000005: Access violation reading location 0x00001f60."


The fastest code is the code never written.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 19th Oct 2010 08:26
I use class's and arrays. class out of bounds will produce a Exception error and crash my game. A array out bounds, you won't really know that it's out of bounds unless you get funny data or you get the above error's on exit (or it crash's your game).

I added the dbCD to my test program and the change directory worked fine with no errors.

My bet is your program is access a rouge pointer or array that is being accessed outside it's initialized range. Like I have a array that is "int nArrary[20];" and I access nArray[20] and write some data in it. This will cause other stuff to be written over and will cause the above errors on program exit.

Good luck on your debugging.

There are many answers but just one question" ~ Jerilith the Mad
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 19th Oct 2010 14:40 Edited at: 19th Oct 2010 14:55
The test program Timidon posted crashes on my computer too when I try to read that famous folder. I think the problem is that you use dbFindNext() two times to filter out the "." and ".." entries in the beginning of the list. That's valid for a directory which you can read, but for a directory where you have no read permission, even these two first entries do not exist. If you comment those first two dbFindNext() out, there is no crash.

Solution: After dbFindFirst(), check immediately the type with dbGetFileType and continue processing only if you got a valid directory. If dbGetFileType doesn't return the desired result, then the number of entries is zero and that's it, don't try to use dbFindNext on that directory. If you get a valid result from dbGetFileType, then you can continue with the two empty dbFindNext commands.

EDIT: Modifying Timidon's program like this removes the crash on my machine:

Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 19th Oct 2010 16:32
Thanks guys. That confirms my suspicions. Mireben, I will try your method next. It may be a while because of vacation. I'm happy it's not because of my program, but a windows7 thing.

The fastest code is the code never written.
Timidon
19
Years of Service
User Offline
Joined: 26th Jun 2005
Location: Bakersfield, Ca. USA.
Posted: 19th Oct 2010 17:56
I am running on a XP Home Edition OS, so permissions are not much of issue. Well not to say I have not ran into issues like that before.. I had permission problems copying a screen image to a sprite on my Vista OS. Just go to love Micro$soft and of course the fun people who make us have the extra security so that those permissions exist.

And this code bit will help out when writing up my game. At least when I get to this point, I know what the errors are... Later.

There are many answers but just one question" ~ Jerilith the Mad

Login to post a reply

Server time is: 2024-10-02 11:30:51
Your offset time is: 2024-10-02 11:30:51