Announcement
Collapse
No announcement yet.
UserMgr Plugin
Collapse
X
-
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
-
-
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
-
-
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
-
-
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
-
-
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"
(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"
PHP Code:UserMgr::ValidatePassword "password1234" "dc.example.org"
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 meAttached Files
Comment
-
-
Originally Posted by Kanelo View PostNOTE²: 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!"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
Comment
-
-
Comment