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. Windows API
  4. How to create file in system folder when UAC feature is enable in Vista?

How to create file in system folder when UAC feature is enable in Vista?

Scheduled Pinned Locked Moved Windows API
helpc++jsontutorialquestion
19 Posts 6 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
    ashipandey
    wrote on last edited by
    #1

    Hello, My product needs admin rights to work. On vista, if user uses UAC feature, then my product is not working. My product is on VC++ platform. I tried adding some manifest to the exe specifying access rights. But i was not able to fix. Secondly, i need to create the file(s) in C:\Windows\system32\.Is there any API which does it on Vista. Please help me in fixing this behavior on vista, so that the same application should work from windows 95 to windows vista without allowing the end user to do anything. Ashish Ashish

    C 1 Reply Last reply
    0
    • A ashipandey

      Hello, My product needs admin rights to work. On vista, if user uses UAC feature, then my product is not working. My product is on VC++ platform. I tried adding some manifest to the exe specifying access rights. But i was not able to fix. Secondly, i need to create the file(s) in C:\Windows\system32\.Is there any API which does it on Vista. Please help me in fixing this behavior on vista, so that the same application should work from windows 95 to windows vista without allowing the end user to do anything. Ashish Ashish

      C Offline
      C Offline
      Craster
      wrote on last edited by
      #2

      Why on earth do you need to create a file in c:\windows\system32?

      A 1 Reply Last reply
      0
      • C Craster

        Why on earth do you need to create a file in c:\windows\system32?

        A Offline
        A Offline
        ashipandey
        wrote on last edited by
        #3

        My Product needs it for security purpose Ashish

        realJSOPR C 2 Replies Last reply
        0
        • A ashipandey

          My Product needs it for security purpose Ashish

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #4

          Then you need to re-write it.

          "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
          -----
          "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

          1 Reply Last reply
          0
          • A ashipandey

            My Product needs it for security purpose Ashish

            C Offline
            C Offline
            Craster
            wrote on last edited by
            #5

            That's not an answer. Unless you have a really, really, good reason to be writing something to a system folder, you shouldn't be doing it. The correct solution to your problem is to write somewhere else.

            A 1 Reply Last reply
            0
            • C Craster

              That's not an answer. Unless you have a really, really, good reason to be writing something to a system folder, you shouldn't be doing it. The correct solution to your problem is to write somewhere else.

              A Offline
              A Offline
              ashipandey
              wrote on last edited by
              #6

              Ya i do have a very good reason to write into the system folder and registry of Vista. The product is in the market from last 20 yrs.At the time of activation(License)it creates some file into system folder and registers it.Every time the product get started, it checks for the licensed file(which happens to be in system folder).Even i cannot write somewhere else. I tried using manifest file.

              C 1 Reply Last reply
              0
              • A ashipandey

                Ya i do have a very good reason to write into the system folder and registry of Vista. The product is in the market from last 20 yrs.At the time of activation(License)it creates some file into system folder and registers it.Every time the product get started, it checks for the licensed file(which happens to be in system folder).Even i cannot write somewhere else. I tried using manifest file.

                C Offline
                C Offline
                Craster
                wrote on last edited by
                #7

                That's not a good reason, it's a stupid reason. All it tells me is that part of your app has been stupid for the last twenty years. Tell whoever you need to that it is stupid, and move the folder into a user-writeable application specific area like it should always have been.

                A 1 Reply Last reply
                0
                • C Craster

                  That's not a good reason, it's a stupid reason. All it tells me is that part of your app has been stupid for the last twenty years. Tell whoever you need to that it is stupid, and move the folder into a user-writeable application specific area like it should always have been.

                  A Offline
                  A Offline
                  ashipandey
                  wrote on last edited by
                  #8

                  Please don't give irritating answers.My application will use registry and windows system folder to store sensitive security information. Since windows introduing one great feature,we can not redesign entire application. Its very funny to think. My application is based on unmanaged Win32/C++ platform. For managed applications there is some workaround using manifest. Is there any workaround for problems like my applications? Please anyone, share your experience who faces the similar problem.

                  C D J 3 Replies Last reply
                  0
                  • A ashipandey

                    Please don't give irritating answers.My application will use registry and windows system folder to store sensitive security information. Since windows introduing one great feature,we can not redesign entire application. Its very funny to think. My application is based on unmanaged Win32/C++ platform. For managed applications there is some workaround using manifest. Is there any workaround for problems like my applications? Please anyone, share your experience who faces the similar problem.

                    C Offline
                    C Offline
                    Craster
                    wrote on last edited by
                    #9

                    You're welcome to ignore my comments. However, this is a site that encourages best practice. Best practice is to move the folder. This is not an entire application redesign, unless the application is exceedingly badly written. Putting things in system folders or in the registry is not security. If you need to secure what's there, encrypt it.

                    1 Reply Last reply
                    0
                    • A ashipandey

                      Please don't give irritating answers.My application will use registry and windows system folder to store sensitive security information. Since windows introduing one great feature,we can not redesign entire application. Its very funny to think. My application is based on unmanaged Win32/C++ platform. For managed applications there is some workaround using manifest. Is there any workaround for problems like my applications? Please anyone, share your experience who faces the similar problem.

                      D Offline
                      D Offline
                      Dan Neely
                      wrote on last edited by
                      #10

                      People with YOUR attitude are the reason WHY MS was forced to implement the UAC sledgehammer. They've been writing best practice guides and logo certification requirements trying to persuade developers to write applications that will run as normal users since at least the win2k era. After so long though, it becomes clear that asking nicely just isn't going to work and out comes the warclub. ***SPLAT***

                      -- If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.

                      V 1 Reply Last reply
                      0
                      • A ashipandey

                        Please don't give irritating answers.My application will use registry and windows system folder to store sensitive security information. Since windows introduing one great feature,we can not redesign entire application. Its very funny to think. My application is based on unmanaged Win32/C++ platform. For managed applications there is some workaround using manifest. Is there any workaround for problems like my applications? Please anyone, share your experience who faces the similar problem.

                        J Offline
                        J Offline
                        Jonathan Darka
                        wrote on last edited by
                        #11

                        I'll answer your question. You 'really' should move the location of the file, but to get around it you can use a manifest file to elevate your app and then it should work. regards,


                        Jonathan Wilkes Darka[Xanya.net]

                        A 1 Reply Last reply
                        0
                        • J Jonathan Darka

                          I'll answer your question. You 'really' should move the location of the file, but to get around it you can use a manifest file to elevate your app and then it should work. regards,


                          Jonathan Wilkes Darka[Xanya.net]

                          A Offline
                          A Offline
                          ashipandey
                          wrote on last edited by
                          #12

                          Thankx for the answer. I tried using manifest file to elevate my application but unable to fix it. My application uses unmanaged C++ and visual studio 2003 as tool.Is manifest file applicable for unmanaged C++ application? Here is the manifest code.

                          J 1 Reply Last reply
                          0
                          • A ashipandey

                            Thankx for the answer. I tried using manifest file to elevate my application but unable to fix it. My application uses unmanaged C++ and visual studio 2003 as tool.Is manifest file applicable for unmanaged C++ application? Here is the manifest code.

                            J Offline
                            J Offline
                            Jonathan Darka
                            wrote on last edited by
                            #13

                            Unfortunately I cannot see much of your manifest file, problems with < > and HTML I suspect :-) Here is mine;

                            <?xml version="1.0" encoding="utf-8" standalone="yes"?>
                            <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
                            <assemblyIdentity version="1.0.0.0"
                            processorArchitecture="X86"
                            name="MyExe.exe"
                            type="win32"/>
                            <description>MyExe Description</description>

                            <!-- Identify the application security requirements. -->
                            <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
                            <security>
                            <requestedPrivileges>
                            <requestedExecutionLevel
                            level="requireAdministrator"
                            uiAccess="false"/>
                            </requestedPrivileges>
                            </security>
                            </trustInfo>
                            </assembly>

                            regards,


                            Jonathan Wilkes Darka[Xanya.net]

                            A 1 Reply Last reply
                            0
                            • J Jonathan Darka

                              Unfortunately I cannot see much of your manifest file, problems with < > and HTML I suspect :-) Here is mine;

                              <?xml version="1.0" encoding="utf-8" standalone="yes"?>
                              <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
                              <assemblyIdentity version="1.0.0.0"
                              processorArchitecture="X86"
                              name="MyExe.exe"
                              type="win32"/>
                              <description>MyExe Description</description>

                              <!-- Identify the application security requirements. -->
                              <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
                              <security>
                              <requestedPrivileges>
                              <requestedExecutionLevel
                              level="requireAdministrator"
                              uiAccess="false"/>
                              </requestedPrivileges>
                              </security>
                              </trustInfo>
                              </assembly>

                              regards,


                              Jonathan Wilkes Darka[Xanya.net]

                              A Offline
                              A Offline
                              ashipandey
                              wrote on last edited by
                              #14

                              Thankx Jonathan.It works fine. Currently i have to put the "myexe.exe.manifest" file along with my application exe.Is it possible to embedd into the resource file?

                              J 1 Reply Last reply
                              0
                              • D Dan Neely

                                People with YOUR attitude are the reason WHY MS was forced to implement the UAC sledgehammer. They've been writing best practice guides and logo certification requirements trying to persuade developers to write applications that will run as normal users since at least the win2k era. After so long though, it becomes clear that asking nicely just isn't going to work and out comes the warclub. ***SPLAT***

                                -- If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.

                                V Offline
                                V Offline
                                Vasudevan Deepak Kumar
                                wrote on last edited by
                                #15

                                dan neely wrote:

                                People with YOUR attitude are the reason WHY MS was forced to implement the UAC sledgehammer.

                                When you say politely people don't listen. Unless M$ brandished out a whip called UAC, they could not come to terms. Now they are thinking of unlearning their bad habits and laziness (inertia). :mad:

                                Vasudevan Deepak Kumar Personal Homepage Tech Gossips

                                1 Reply Last reply
                                0
                                • A ashipandey

                                  Thankx Jonathan.It works fine. Currently i have to put the "myexe.exe.manifest" file along with my application exe.Is it possible to embedd into the resource file?

                                  J Offline
                                  J Offline
                                  Jonathan Darka
                                  wrote on last edited by
                                  #16

                                  Glad to help, if you want to embed the manifest in your application then open your resource file e.g. myapp.rc in a text editor and add the following: For an executable

                                  /////////////////////////////////////////////////////////////////////////////
                                  //
                                  // RT_MANIFEST
                                  //
                                  1 RT_MANIFEST "MyApp.exe.manifest"

                                  and for a DLL or control panel applet

                                  /////////////////////////////////////////////////////////////////////////////
                                  //
                                  // RT_MANIFEST
                                  //

                                  2 RT_MANIFEST "MyApp.dll.manifest"

                                  regards,


                                  Jonathan Wilkes Darka[Xanya.net]

                                  A 2 Replies Last reply
                                  0
                                  • J Jonathan Darka

                                    Glad to help, if you want to embed the manifest in your application then open your resource file e.g. myapp.rc in a text editor and add the following: For an executable

                                    /////////////////////////////////////////////////////////////////////////////
                                    //
                                    // RT_MANIFEST
                                    //
                                    1 RT_MANIFEST "MyApp.exe.manifest"

                                    and for a DLL or control panel applet

                                    /////////////////////////////////////////////////////////////////////////////
                                    //
                                    // RT_MANIFEST
                                    //

                                    2 RT_MANIFEST "MyApp.dll.manifest"

                                    regards,


                                    Jonathan Wilkes Darka[Xanya.net]

                                    A Offline
                                    A Offline
                                    ashipandey
                                    wrote on last edited by
                                    #17

                                    Thanks Jonathan for your kind help. Thanks alot.

                                    1 Reply Last reply
                                    0
                                    • J Jonathan Darka

                                      Glad to help, if you want to embed the manifest in your application then open your resource file e.g. myapp.rc in a text editor and add the following: For an executable

                                      /////////////////////////////////////////////////////////////////////////////
                                      //
                                      // RT_MANIFEST
                                      //
                                      1 RT_MANIFEST "MyApp.exe.manifest"

                                      and for a DLL or control panel applet

                                      /////////////////////////////////////////////////////////////////////////////
                                      //
                                      // RT_MANIFEST
                                      //

                                      2 RT_MANIFEST "MyApp.dll.manifest"

                                      regards,


                                      Jonathan Wilkes Darka[Xanya.net]

                                      A Offline
                                      A Offline
                                      ashipandey
                                      wrote on last edited by
                                      #18

                                      Hi Jonathan, For my appl executable i have inclued the above line (RT_MANIFEST into the myexe.rc)and it worked for the console based application.But for the GUI app. it is not working.Do i need to edit into the manifest file or need to create separate manifest(MyApp.dll.manifest) file for it.

                                      J 1 Reply Last reply
                                      0
                                      • A ashipandey

                                        Hi Jonathan, For my appl executable i have inclued the above line (RT_MANIFEST into the myexe.rc)and it worked for the console based application.But for the GUI app. it is not working.Do i need to edit into the manifest file or need to create separate manifest(MyApp.dll.manifest) file for it.

                                        J Offline
                                        J Offline
                                        Jonathan Darka
                                        wrote on last edited by
                                        #19

                                        Each exe and dll should have their own manifest, you should not need to modify the manifest (except maybe the description). Just embed it into both apps, if both are executables then use the first example I gave, else if they are DLL's then use the second. It should work fine for the GUI app too, in Vista when the executable is recognised as having a manifest file (by explorer for example) then the elevated shield icon will be overlayed on your aplications icon. If your apps icon does not have an overlay of the shield then Vista does not recognise the manifest, you may need to clear the explorer icon cache before it sees it. To do this kill (using task manager) ALL instances of explorer.exe, then start a new instance. regards,


                                        Jonathan Wilkes Darka[Xanya.net]

                                        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