![]() |
Crash when getting user's groups
Why does the following code crash sometimes when I run it?
code: |
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? |
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) |
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 :D Thanks a lot! Am I correct in assuming that -1 is the biggest possible value for that parameter? Quote:
|
1 Attachment(s)
-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 |
Thanks.
I'm not using this to check if the current process has admin rights :) |
| All times are GMT. The time now is 18:05. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.