![]() |
#1 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
UserMgr Plugin
Hello Ivan,
I uploaded a new version of the plugin, which has a new Function "GetCurrentDomain". http://nsis.sourceforge.net/UserMgr_plug-in This function will return the domainname you are currently logged in to (in your case "mshome"). Best regards, jpderuiter P.S.: this is a follow up of the "New Plugin" thread on this forum: http://forums.winamp.com/showthread....postid=2477038 |
![]() |
![]() |
![]() |
#2 |
Junior Member
Join Date: Dec 2004
Posts: 2
|
Environmental variables changed creating a new user
Hi all,
After I created a new user, I make some shortcuts in the start menù, but I find those shortcuts in the "newuser" menù, not in the current user menù. (but I want them in the current user menù!) It seems like UserMgr pluging changed the environmental variable when creating the user. Any suggestions? Many thanks, Luca This is my nsis code: UserMgr::CreateAccountEx "newuser" "password" "-" "-" "-" "UF_PASSWD_CANT_CHANGE|UF_DONT_EXPIRE_PASSWD" Pop $0 ${If} $0 != "OK" Quit ${EndIf} UserMgr::AddToGroup ${AEPUSER} "Users" Pop $0 ${If} $0 != "OK" Quit ${EndIf} UserMgr::BuiltAccountEnv ${AEPUSER} ${AEPPWD} Pop $0 ${If} $0 != "OK" Quit ${EndIf} CreateDirectory "$SMPROGRAMS\myapp" CreateShortCut "$SMPROGRAMS\myapp\myapp.lnk" "$INSTDIR\myapp.exe" "" "$INSTDIR\myapp.exe" 0 |
![]() |
![]() |
![]() |
#3 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Hello coppolo,
I tried the following: code: All 3 Messageboxes show the Startmenu programs folder of the current user, not the new created user. But as soon as I comment the first messagebox out, the other 2 Messageboxes both show the Startmenu programs folder of the new created user! I'm not sure what is causing this, but as far as I can see the UserMgr plugin does not change the environmental variable at all. Anyone else? Regards, jpderuiter |
![]() |
![]() |
![]() |
#4 | |
Junior Member
Join Date: Nov 2003
Location: Vancouver, BC
Posts: 48
|
Re: UserMgr Plugin
Quote:
I have an actual domain here, not a workgroup. Not sure if this would affect anything. I tested it on 2 different domains and 2 different machines and the behavior is the same. code: |
|
![]() |
![]() |
![]() |
#5 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Hello Ivan,
unfortunately I'm in a workgroup, and it was working correctly for me. But a used another combination of API's to get the domainname, and I uploaded it to the wiki. Can you try if it works now? Best regards, Jan Pieter |
![]() |
![]() |
![]() |
#6 | |
Junior Member
Join Date: Nov 2003
Location: Vancouver, BC
Posts: 48
|
Quote:
Can you create a pdb file and upload it somewhere so I can debug? It's a pain to build the project myself since I am running different Visual Studio version, and don't have libc. |
|
![]() |
![]() |
![]() |
#7 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Hello Ivan,
I'm sorry to hear that, and that I'm unable to help now. I sent you a private message with a link to the Debug version, incl the pdb. I also altered the GetCurrentDomain again, so maybe it's working now. Best regards, Jan Pieter |
![]() |
![]() |
![]() |
#8 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
This installer crashes every time I try to run it:
code: Am I doing something wrong here? |
![]() |
![]() |
![]() |
#9 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Hello all,
I uploaded a new version of the plugin with a bugfix for the crashing installer. @Tobbe: I tried your script, and it's not crashing anymore, but it wasn't crashing before on the HasPrivilege call, only when exiting the installer. @Ivan: I tried the GetCurrentDomain function at work, and it's returning the domain properly. @coppolo: Your problem isn't solved yet. A workaround could be creating the shortcuts before calling BuiltAccountEnv, or storing the $SMPROGRAMS string in another variable. Best regards, jpderuiter |
![]() |
![]() |
![]() |
#10 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
It still crashes for me. It crashes before it prints anything to the log window.
|
![]() |
![]() |
![]() |
#11 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Hmm, strange.
I assume you are using NSIS v2.42? Are other UserMgr funtions crashing the installer as well? |
![]() |
![]() |
![]() |
#12 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
Hmm, I'm using 2.37. Let me upgrade and I'll report back
|
![]() |
![]() |
![]() |
#13 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
So I upgraded to 2.42 and now I get different results
![]() With the latest version of UserMgr I get this: Invalid command: UserMgr::HasPrivilege Invalid command: UserMgr::GetCurrentUserName UserMgr::GetUserInfo "Tobbe" "HOMEDIR" doesn't give me the Invalid command error, but it only returns an empty string. My installer does not crash however ![]() With the old version I don't get any Invalid command errors, but "HasPrivilege" returns ERROR LsaEnumerateAccountRights and GetUserInfo only returns an empty string. GetCurrentUserName does however correctly return "Tobbe" EDIT: With the old version I get the behavior you describe with the installer crashing when closing it. |
![]() |
![]() |
![]() |
#14 | |
Junior Member
Join Date: Nov 2003
Location: Vancouver, BC
Posts: 48
|
Quote:
|
|
![]() |
![]() |
![]() |
#15 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Well, I have used the new NSIS Plugin API coming with NSIS v2.42, so I think that's the reason why it's crashing.
So you should upgrade to 2.42 to make the plugin work. For the time being you can use the older plugin version dated 22:06, 1 February 2008: http://nsis.sourceforge.net/File:UserMgr.zip |
![]() |
![]() |
![]() |
#16 | |
Junior Member
Join Date: Nov 2003
Location: Vancouver, BC
Posts: 48
|
Quote:
![]() You should make a note in BOLD letters on the wiki page that this version is for 2.42+ only. Also include a link to older versions as well there ![]() I'll give 2.42 a shot. I just hope it doesn't break the old plugins I am using. |
|
![]() |
![]() |
![]() |
#17 |
Junior Member
Join Date: Nov 2003
Location: Vancouver, BC
Posts: 48
|
Awesome, it works perfectly with NSIS 2.42. It didn't break any old plugins either
![]() |
![]() |
![]() |
![]() |
#18 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Ivan,
The way I see it is that you should always have to use the newest version. And well, I haven't noticed any plugin didn't work with v2.42. v2.42 is supposed to be backwards compatible with pre-v2.42 plugins. |
![]() |
![]() |
![]() |
#19 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
@Ivan:
Ah, you already found out ;-) @Tobbe: Sorry, I missed your last post. Did you place the UserMgr plugin in the Plugins directory again after upgrading to v2.42. Since the installer removes all plugin... |
![]() |
![]() |
![]() |
#20 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
Firefox seems to be caching the download or something... Could you please add a version number to the downloadable file? Thanks
|
![]() |
![]() |
![]() |
#21 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Well, that's not how the NSIS wiki page works, or I'll have to make a new file page for each new version.
But I'll attach the plugin with this post. |
![]() |
![]() |
![]() |
#22 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
Perfect! Thank you
![]() |
![]() |
![]() |
![]() |
#23 | |
Junior Member
Join Date: Nov 2003
Location: Vancouver, BC
Posts: 48
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#24 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
Now I can run the plugin but there is one thing I find weird...
code: $1 is just an empty string when I run that. And $2 is "ERROR LsaEnumerateAccountRights". $0 does contain my username. |
![]() |
![]() |
![]() |
#25 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
OK, I'm not sure why the HOMEDIR is an empty string, I'll try to look into that.
Can you do the same with the attached test plugin, and tell me what the error message on the HasPrivilege function. (It will give an error code as well now) Regards, Jan Pieter |
![]() |
![]() |
![]() |
#26 | |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Quote:
|
|
![]() |
![]() |
![]() |
#27 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
I get "ERROR LsaEnumerateAccountRights 1" with the test1 version
|
![]() |
![]() |
![]() |
#28 | |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Quote:
At least the one used for the NetUserGetInfo API does. When you set a value using code: you will get this directory back when using GetUserInfo... Not very usefull though... |
|
![]() |
![]() |
![]() |
#29 | |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Quote:
Would it be possible that the user does not have any rights? Does this happen on each user on your system? |
|
![]() |
![]() |
![]() |
#30 |
Junior Member
Join Date: Nov 2003
Location: Vancouver, BC
Posts: 48
|
What do UserMgr::GetCurrentUserName and UserMgr::GetCurrentDomain return if there is some problem? I want to do some error checking on my end.
|
![]() |
![]() |
![]() |
#31 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
The user I'm testing with is myself. And I'm an administrator... I tried with the admin account and got the same error. It does work with the guest account though. It returns TRUE.
|
![]() |
![]() |
![]() |
#32 | ||
Major Dude
Join Date: Feb 2007
Posts: 672
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#33 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Tobbe,
have you tried the following code: http://nsis.sourceforge.net/Enumerate_User_Privileges Is the same error code returned (the error code in $R8)? |
![]() |
![]() |
![]() |
#34 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
No, $R8 is -1073741772
I have been researching this, and it seems as if I should get an error, and that script gives me that error (in $R9). I can't compile the source code for the plugin, but could you please make the following changes and post a build? code: |
![]() |
![]() |
![]() |
#35 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
Hello Tobbe
I uploaded a new version which return the errorcode for LsaEnumerateAccountRights (either the System errorcode if available, else the NTSTATUS errorcode). I used the following code: code: (Attached newest version to this post) Regards, jpderuiter |
![]() |
![]() |
![]() |
#36 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
For some reason your code returns "ERROR LsaEnumerateAccountRights n1"
http://nsis.sourceforge.net/Enumerate_User_Privileges returns FILE_NOT_FOUND I believe the correct return value in my case is FILE_NOT_FOUND |
![]() |
![]() |
![]() |
#37 |
Junior Member
Join Date: Nov 2003
Location: Vancouver, BC
Posts: 48
|
I have a feature request. How about a function that checks whether the specified Username (password too, if needed) has access rights to go to a specified path. Is that feasible, or is this outside the scope of this plug-in?
|
![]() |
![]() |
![]() |
#38 |
Junior Member
Join Date: Nov 2003
Location: Vancouver, BC
Posts: 48
|
Cancel that. My studio has been closed down and we've all been fired today.
But thanks so much for the hard work you put in with this plug-in! |
![]() |
![]() |
![]() |
#39 |
Major Dude
Join Date: Feb 2007
Posts: 672
|
@Tobbe:
I'm sorry, but I'm not able to solve the HasPrivilege problem. The function LsaEnumerateAccountRights returns 1 on every error, and I can't find a solution for it. So I'm afraid you'll have to use the Macro mentioned before as a workaround. @Ivan: I'm really sorry to hear that. I hope you will find yourself a new job soon. About your feature request: I think it's a usefull feature so I'm thinking about adding it anyway as soon as I have the time for it. Regards, Jan Pieter |
![]() |
![]() |
![]() |
#40 |
Senior Member
Join Date: Oct 2006
Posts: 106
|
I compiled and ran this code: http://win32.mvps.org/lsa/lsa_lear.cpp
It uses LsaEnumerateAccountRights and I got the "FILE_NOT_FOUND" error. Maybe you can work off of that? |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|