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. C / C++ / MFC
  4. Regarding Admin rights user

Regarding Admin rights user

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 3 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.
  • H Offline
    H Offline
    H4u32
    wrote on last edited by
    #1

    Hi all, My reqirement is to change admin rights user to limited account user. I tried to change admin rights to limited user account using NetUserSetInfo(). But wasnt succeeded in that. so please help me out in this scenario. How would I accomplish it?? Any help would be greatly appreciated. Thanks. Hemang

    D 1 Reply Last reply
    0
    • H H4u32

      Hi all, My reqirement is to change admin rights user to limited account user. I tried to change admin rights to limited user account using NetUserSetInfo(). But wasnt succeeded in that. so please help me out in this scenario. How would I accomplish it?? Any help would be greatly appreciated. Thanks. Hemang

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Hemang Raval wrote:

      I tried to change admin rights to limited user account using NetUserSetInfo(). But wasnt succeeded in that.

      What did NetUserSetInfo() return?

      "Love people and use things, not love things and use people." - Unknown

      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

      H 1 Reply Last reply
      0
      • D David Crow

        Hemang Raval wrote:

        I tried to change admin rights to limited user account using NetUserSetInfo(). But wasnt succeeded in that.

        What did NetUserSetInfo() return?

        "Love people and use things, not love things and use people." - Unknown

        "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

        H Offline
        H Offline
        H4u32
        wrote on last edited by
        #3

        It has returned error code 87. Having been referred to MSDN, i came to know that this error code indicates that one of the functions parameter is invalid. But i am not having an idea about which parameter i am passing wrong. Any clue?? Your help would be greatly appreciated. Thanks Hemang

        M 1 Reply Last reply
        0
        • H H4u32

          It has returned error code 87. Having been referred to MSDN, i came to know that this error code indicates that one of the functions parameter is invalid. But i am not having an idea about which parameter i am passing wrong. Any clue?? Your help would be greatly appreciated. Thanks Hemang

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          Post your code.

          --Mike-- Visual C++ MVP :cool: LINKS~! CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

          H 1 Reply Last reply
          0
          • M Michael Dunn

            Post your code.

            --Mike-- Visual C++ MVP :cool: LINKS~! CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

            H Offline
            H Offline
            H4u32
            wrote on last edited by
            #5

            void ChangeUserPrivilege(LPWSTR csUser, DWORD csPrivilege) { NET_API_STATUS nStatus; USER_INFO_1 ui1005; DWORD dwLevel1005 = 1005; DWORD dwPrivilege = 0;; wchar_t *pswzUser = csUser; if(csPrivilege == 2) dwPrivilege = USER_PRIV_USER; ui1005.usri1_priv = dwPrivilege; nStatus = NetUserSetInfo(NULL,pswzUser,dwLevel1005,(LPBYTE)&ui1005,NULL); if(nStatus != NERR_Success) // MessageBox(hwnd, (LPCWSTR)"Failed", (LPCWSTR)"Test", NULL); fprintf(stderr, "NetUserGetinfo failed with error: %d\n", nStatus); } I am using above code to change admin rights user to limited rights user. Is it possible with this code. Thanks

            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