Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

C++: Odd error

  • 12-01-2008 07:28PM
    #1
    Closed Accounts Posts: 2,349 ✭✭✭


    I'm trying to open a cached file, read its contents, close it, then delete it.

    First I use:
    RetrieveUrlCacheEntryStream()
    then ReadUrlCacheEntryStream()

    and the buffer contains the cached file. So I'm all good up to there.

    Then I do:
    UnlockUrlCacheEntryStream() on the handle, which returns true
    and finally DeleteUrlCacheEntry() to get rid of the file.
    DeleteUrlCacheEntry fails and returns the following error through GetLastError():

    ERROR_SHARING_VIOLATION
    "The process cannot access the file because it is being used by another process."

    There are no browser windows opened. This error is not even given as a possible error in the DeleteUrlCacheEntry() MSDN page.

    Any help very much appreciated.

    See here for reference:
    http://msdn2.microsoft.com/en-us/library/aa383928(VS.85).aspx


Comments

  • Closed Accounts Posts: 1,444 ✭✭✭Cantab.


    Haven't used C++ in a while. Just a thought, but when you write this file to cache, do you close the writer stream before attempting a read?


  • Closed Accounts Posts: 7,562 ✭✭✭leeroybrown


    Could you be tripping over an external influence like anti-virus/anti-spyware software doing real time scanning?


  • Closed Accounts Posts: 2,349 ✭✭✭nobodythere


    Sorted it. Was looking at the windows system error codes instead of the wininet.lib error codes.

    Thanks all


  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,119 Mod ✭✭✭✭Tar.Aldarion


    Are you around the main college? I need help with C++ :)


  • Closed Accounts Posts: 2,349 ✭✭✭nobodythere


    I will be in an hour if you want but I dunno how useful I am to you! I'll pm you my number, I don't spend all day on boards you know! Hooray something to do.

    Also, this problem isn't solved, I thought that'd fix it but it didn't. IE wrote the file to the cache, not me. I'm thinking that's why I can't delete it? It's IE7

    There is no AV/firewall running.


  • Advertisement
  • Moderators, Science, Health & Environment Moderators, Social & Fun Moderators, Society & Culture Moderators Posts: 60,119 Mod ✭✭✭✭Tar.Aldarion


    What compiler do you use? I think I just need to change mine from vc++ express 2005 as windows.h is not included with this.


Advertisement