Announcement

Collapse
No announcement yet.

UserMgr Plugin

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #46
    Sorry, I was too quick to answer.

    The reason is GetUserInfo only works for local accounts...
    The plugin should be updated to support domain users for GetUserInfo.
    You can try to use the system plugin to get the information you need:
    Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.

    Search for NetUserGetInfo in that post.

    Comment


    • #47
      Ahh, thanks, I'll give that a whirl.

      I posted a response to your questions, but it's pending moderator approval?

      Comment


      • #48
        Hi folks.

        Currently I'm working on creating unicode nsis installer. In ansi version of installer I use UserMgr.dll to receive username and user SID.

        For unicode installer I need UserMgr.dll to be compiled as unicode too.

        So I'm just curious if I can download somewhere unicode UserMgr.dll or should I download sources and construct it by myself?

        Thanks,
        Roman

        Comment


        • #49
          Unfortunately there is no Unicode version available yet.
          And I don't have time to do the port any time soon...

          Comment


          • #50
            I've had a quick look at the code and it doesn't seem too hard. It's just the sheer quantity that's the time consuming part. I'll play around with it and see what I can do.
            "Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
            NSIS 3 POSIX Ninja
            Wiki Profile

            Comment


            • #51
              So I've added unicode support to this plugin, but I haven't done any testing yet.

              I used VS2008 for the development, and I've included the project file along with all the source files and compiled release versions. I used C runtime calls as much as I could, so the source should compile on older compilers with little or no modifications.
              Attached Files
              "Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
              NSIS 3 POSIX Ninja
              Wiki Profile

              Comment


              • #52
                Hi Jason,

                thanks for your update.

                Did you change the plugin name on purpose from UserMgr to UsrMgr?
                Now existing scripts are broken.

                After changing the plugin file name, the UserMgr plugin is working fine in Unicode and Ansi.

                Thanks again!

                JP

                Comment


                • #53
                  Whoops, that's a typo on my behalf. But yeah, I haven't tested it, so that's why I didn't notice the name was wrong. Consider this a patch that will hopefully get merged at some point (I was only going to upload the usermgr.c file).
                  "Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
                  NSIS 3 POSIX Ninja
                  Wiki Profile

                  Comment


                  • #54
                    Thanks a lot, Jason!

                    Comment


                    • #55
                      very usefull plugin but i missed a password validation function and the possibility to use SID Groups directly as GetLocalizedStdAccountName did not do the trick for me.

                      AddToGroup, IsMemberOfGroup and RemoveFromGroup now checks if GroupID is in square Brackets "[]", if so it is treated as SID.

                      This will Add, check and remove user Test to builtin\administrators
                      For this test a User "Test" is needed
                      PHP Code:
                          UserMgr::IsMemberOfGroup "Test" "[S-1-5-32-544]"
                          
                      Pop $0
                          DetailPrint 
                      "$$0: $0"
                          
                          
                      UserMgr::AddToGroup  "Test" "[S-1-5-32-544]"
                          
                      Pop $0
                          DetailPrint 
                      "$$0: $0"
                          
                          
                      UserMgr::IsMemberOfGroup "Test" "[S-1-5-32-544]"
                          
                      Pop $0
                          DetailPrint 
                      "$$0: $0"
                          
                          
                      UserMgr::RemoveFromGroup "Test" "[S-1-5-32-544]"
                          
                      Pop $0
                          DetailPrint 
                      "$$0: $0"
                          
                          
                      UserMgr::IsMemberOfGroup "Test" "[S-1-5-32-544]"
                          
                      Pop $0
                          DetailPrint 
                      "$$0: $0" 
                      As it should be a non invasive modification there should be no need to change existing code!
                      (the idea/methode is copied from AccessControl. Thanks )


                      New Function ValidatePassword checks if the given password will be accepted on a given system.
                      PHP Code:
                      UserMgr::ValidatePassword "password1234" "local" 
                      Checks if "password1234" will be accepted on the local machine. You can also type the name of a valid remote server for validation over network.
                      PHP Code:
                      UserMgr::ValidatePassword "password1234" "dc.example.org" 
                      The Function places the return on top of the Stack. Return is "ERROR XXXX" or "OK".
                      Error codes can be found here Network Management Error Codes

                      NOTE: NERR_PasswordTooShort (2245) will sometimes be thrown if the password matches or contains the username. This can not be checked beforehand with this function as there is no username given.

                      Some code review would be appreciated.
                      If i don't hear anything wrong, i or hopefully one more experienced user will update the wiki page.


                      NOTEĀ²: I used VS2019 to compile this, so if you use the included unicode/ansi dll file you need to install "Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019" before the use on a machine!

                      Bonus
                      Fixed: RemoveFromGroup, didn't work with NetGroupDelUser (at least on Windows 10)


                      Famous last words: Works for me
                      Attached Files

                      Comment


                      • #56
                        Originally Posted by Kanelo View Post
                        NOTEĀ²: I used VS2019 to compile this, so if you use the included unicode/ansi dll file you need to install "Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019" before the use on a machine!
                        That's easy to fix, in the project settings under code generation, change the runtime library to /MT. That statically links the C/C++ runtime so that it runs on any machine. The downside is that it increases the size of the DLL alot, but for compatibility it's a compromise worth doing.
                        "Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
                        NSIS 3 POSIX Ninja
                        Wiki Profile

                        Comment


                        • #57
                          didn't know that, thank you
                          Attached Files

                          Comment

                          Working...
                          X
                          😀
                          🥰
                          🤢
                          😎
                          😡
                          👍
                          👎