N J

I deleted some files (only data and text files, no dlls nor exes) from my application installed in the Program Files folder in Vista. I even removed the deleted files from recycle bin.

But all file functions in Windows API, (e.g. GetFileAttributes, fopen, fread) still have full access to the deleted files. These deleted files can still be read normally as if they were not deleted at all. Under WIndows File Explorer, those deleted files have already gone and there is no way you can get these files from Windows Interface.

I restarted the computer. It is still the same. Very strange thing - only in Vista.



Re: Visual C++ General How do Windows API file functions still have access to deleted files?

Aleksandr Tokarev

I think you are entangled yourself!

You deleted file from one location, and reading this file from another location!





Re: Visual C++ General How do Windows API file functions still have access to deleted files?

Simple Samples

Are you using fully qualified paths (directories) in the Windows API functions

It is likely you are overlooking something. Try to verify assumptions, such as the qualification of relative paths for the files.






Re: Visual C++ General How do Windows API file functions still have access to deleted files?

N J

> I think you are entangled yourself!

> You deleted file from one location, and reading this file from another location!

The files I deleted is in C:\Program Files\<My Application>\

The Application path I started is in C:\Program Files\<My Application>\

The path used in the application for the deleted files is also C:\Program Files\<My Application>\

I do not use relative path. The path used in API is "C:\Program Files\<My Application>\..."

This VIsta Computer is used for testing only. There is no other place where I put any files of my application.





Re: Visual C++ General How do Windows API file functions still have access to deleted files?

N J

I cannot believe that I am the only person who has this problem. To prove that I am not entangled by myself, I searched my computer for the deleted files. No result was found.

However, functions in API still have full access to these deleted files!

The problem only exsist in the folder of "Program Files".





Re: Visual C++ General How do Windows API file functions still have access to deleted files?

Simple Samples

You say "API"; what is the specific function If possible, can you copy and paste the relevant source code line or lines I don't know if that will help but I think we need more information of some kind.






Re: Visual C++ General How do Windows API file functions still have access to deleted files?

N J

I run debug to my application in VS 2005.

Any file functions used in the application will have success to get the deleted files. Here are just a few:

fopen("C:\\Program Files\\3D-Album-CS\\Presentation\\

DeletedFolder\\DeletedFile.vspc","rb");

FindFirstFile

("C:\\Program Files\\3D-Album-CS\\Presentation\\

DeletedFolder\\*",&fdata);

GetFileAttributes

("C:\\Program Files\\3D-Album-CS\\Presentation\\

DeletedFolder\\DeletedFile.vspc");

My application has a file browser. It displays all deleted folders and files as if they were not deleted. Here is what displayed in my browser:

http://www.visviva.com/temp/browser1.jpg

And here is what displayed in WIndows FIle Browser:

http://www.visviva.com/temp/browser2.jpg

Here is a side by side comparison (Deleted folders are in "Presentation"):

http://www.visviva.com/temp/browser3.jpg





Re: Visual C++ General How do Windows API file functions still have access to deleted files?

N J

I used my application for folders and files already deleted by WIndows. I can still copy and paste these deleted files. But if I use my application to delete the file or the folder, they are truely deleted (to recycle bin).

The way Vista used to delete files seems different from the one used by API functions, and this inconsistency brings a lot of confusions.





Re: Visual C++ General How do Windows API file functions still have access to deleted files?

N J

Things get more weird. I used my application to delete the folder, it was truely sent to the recycle bin.

I went to Windows Browser. It can undo my deletion, and then redo the deletion. But Windows cannot do undo/redo again. It can only do it once although the right click menu still provide the undo/redo option.

I went back to my application and undid the deletion. Then back to Windows and deleted the folder. This time, WIndows truely deleted the folder.

If the folder or the files were deleted and then restored by my application, then Vista can do the normal deletion. Otherwise, Vista can do the file deletion only recognized by itself.

I am totally confused.





Re: Visual C++ General How do Windows API file functions still have access to deleted files?

Simple Samples

I am confused also.

This question is not really a VC General question. If Vista is doing something you are not aware of, then the Vista forum might be better.

I am not sure I understand what it is you say about your application deleteing and restoring files. If I do understand, then it might help to have details about how you are doing that. I do not have Vista so I can't help much. I hope someone else can. Assuming however that there is a peculiarity of Vista then it could help to ask in the Vista forum.

Something that might help is a simple sample of deleting a file or folder and then retrieves the file information from the location it was deleted from. It might help if the first thing the program does is to create the directory or file. The progam should be a console program that does just the minimum necessary to re-create the problem. If it is simple enough then others can try it with their systems. If the progarm works as expected in a non-Vista system but not your Vista system then that would help to know. If the progarm works as expected in another Vista system then it should really help to know that. If there is something about Vista that explains the problem then a sample program is likely to help determination what that is.

I am not sure if it would be better for you to continue with this thread or strat a new one in the Vista forum.






Re: Visual C++ General How do Windows API file functions still have access to deleted files?

Aleksandr Tokarev

May be, it's a new feature of the System Restore.

Shadow copies of previos versions of files and folders.





Re: Visual C++ General How do Windows API file functions still have access to deleted files?

Andreas Masur

Aleksandr Tokarev wrote:

May be, it's a new feature of the System Restore.

Shadow copies of previos versions of files and folders.


That is certainly a good suggestion and most-likely the issue here...