|
|
|
|
#1 |
|
Senior Member
Join Date: Oct 2006
Posts: 106
|
Crash when getting user's groups
Why does the following code crash sometimes when I run it?
code: Last edited by TobbeSweden; 26th January 2009 at 09:08. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Oct 2006
Posts: 106
|
I have trimmed the code down in the post above to show the minimal code that still crashes.
If I remove the line 'System::Call "*$R0(w.R3)"' the crash goes away. What am I doing wrong? |
|
|
|
|
|
#3 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
other than the fact that you are passing NSIS_MAX_STRLEN for some weird reason, I don't see anything wrong
this code works fine for me code: Also, don't forget that a user might have deny only groups in their token, so even if administrator is returned, your process might not have admin rights (use the userinfo plugin for this detection) IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#4 | |
|
Senior Member
Join Date: Oct 2006
Posts: 106
|
The reason I had NSIS_MAX_STRLEN was because that's what the original macro had... http://nsis.sourceforge.net/User_Man...s_Group.28s.29
Using -1 instead stops it from crashing Thanks a lot!Am I correct in assuming that -1 is the biggest possible value for that parameter? Quote:
|
|
|
|
|
|
|
#5 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
-1 = MAX_PREFERRED_LENGTH
I don't know why you need this code, but you just need to know that even if NetUserGetLocalGroups returns with Administrator as a group, it does not mean that you can do admin stuff, it is not the correct way to check if the current process has admin rights IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Oct 2006
Posts: 106
|
Thanks.
I'm not using this to check if the current process has admin rights
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|