Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Windows Vista not allowed to write file on C:\Users folder

Windows Vista not allowed to write file on C:\Users folder

Scheduled Pinned Locked Moved ATL / WTL / STL
c++com
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    am 2009
    wrote on last edited by
    #1

    Hi , I have created one ATL COM add ons for IE which write file on C:\users\sample.txt path. When i run application on my machine(Vista) then it writes files as correctly, but when I run application of another vista machine ,file is not written. Is there any setting in Vista which allow to write file on C:\users folders. Thanks ABM

    L 1 Reply Last reply
    0
    • A am 2009

      Hi , I have created one ATL COM add ons for IE which write file on C:\users\sample.txt path. When i run application on my machine(Vista) then it writes files as correctly, but when I run application of another vista machine ,file is not written. Is there any setting in Vista which allow to write file on C:\users folders. Thanks ABM

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It sounds to me as if the second machine has Internet Explorer running in protected mode. If this is the case then you will need to instead write your files into the FOLDERID_LocalAppDataLow special folder.PWSTR pszPath[1]; HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppDataLow,KF_FLAG_NO_ALIAS | KF_FLAG_DONT_VERIFY,NULL,pszPath); //Do something with path CoTaskMemFree(*pszPath);
      Understanding and Working in Protected Mode Internet Explorer[^] Best Wishes, -David Delaune

      A 1 Reply Last reply
      0
      • L Lost User

        It sounds to me as if the second machine has Internet Explorer running in protected mode. If this is the case then you will need to instead write your files into the FOLDERID_LocalAppDataLow special folder.PWSTR pszPath[1]; HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppDataLow,KF_FLAG_NO_ALIAS | KF_FLAG_DONT_VERIFY,NULL,pszPath); //Do something with path CoTaskMemFree(*pszPath);
        Understanding and Working in Protected Mode Internet Explorer[^] Best Wishes, -David Delaune

        A Offline
        A Offline
        am 2009
        wrote on last edited by
        #3

        Both machin have protected mode ON. But on other machin File is not written. Is there any other reason behind this? abm

        L 1 Reply Last reply
        0
        • A am 2009

          Both machin have protected mode ON. But on other machin File is not written. Is there any other reason behind this? abm

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          am 2009 wrote:

          Is there any other reason behind this?

          If the GetLastError Function[^] is telling you Error 5 (Access Denied) then I would suggest redesigning your application so it can operate in a least-privilege environment. Why do you need to write to the C:\Users folder? In my opinion applications should not be attempting to write into this folder. Best Wishes, -David Delaune

          A 1 Reply Last reply
          0
          • L Lost User

            am 2009 wrote:

            Is there any other reason behind this?

            If the GetLastError Function[^] is telling you Error 5 (Access Denied) then I would suggest redesigning your application so it can operate in a least-privilege environment. Why do you need to write to the C:\Users folder? In my opinion applications should not be attempting to write into this folder. Best Wishes, -David Delaune

            A Offline
            A Offline
            am 2009
            wrote on last edited by
            #5

            Thanks David, Actually it is my project requirement that to write file in C:\Users folder. In my case file is created but, it application could not write any data into it. This is happend only on one testing machine of windows Vista. Thanks ABM :)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups