Archive: UserInfo::Getname Bug ?


UserInfo::Getname Bug ?
I have the following code and when I try to use this on a Win9x platform, it shows always the messagebox that I need Admin rights... it works fine on NT based platforms.

Doesn't it just jump to the IsAdmin label (IfErrors IsAdmin) ? Even the UserInfo.nsi example scripts doesn't work.

Function _onGuiInit

ClearErrors
UserInfo::GetName
IfErrors IsAdmin
Pop $0
UserInfo::GetAccountType
Pop $1
StrCmp $1 "Admin" 0 +2
Goto IsAdmin

MessageBox MB_OK $(AC_AdminRights)
Abort

IsAdmin:

FunctionEnd


It is stated in the readme that this plug-in doesn't work on Windows 9x. There is also a script in there that shows you how to tell if you're runnig on Windows 9x.

Unlike the time that I have written this plug-in I do know of a way to make both GetName and GetAccountType to work together while only GetName will work on Windows 9x. Please add this to the feature list in the SF project page.


My mistake, in the example. There's no readme.


Kichik,

is there a way to do something like :

if Win9x then CheckRights
else do nothing

I know about the GetWindowsVersion function but it returns the VERSION, not the PLATFORM TYPE like 9x and NT.


The example shows you how. The function call will just fail if it's not Windows NT platform.


Originally posted by kichik
The example shows you how. The function call will just fail if it's not Windows NT platform.
That's the problem, it will not fail :( ... it seems that the Error variable isn't set ?

I found a solution for my problem :)