Panther24
21st April 2005 06:52 UTC
Issue with StrCmp
Hi!
I'm trying to find the User Previlidges and cont as per that.
Is the user has Admin, then the function True else False.
Here is a sample of what i'm doing ....
Function .onInit
Call IsUserAdmin
Pop $R0
MessageBox MB_OK 'User= "$R1" AccountType= "$R2" IsUserAdmin= "$R0"'
StrCmp "True" $R0 Install End
Install:
InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp "abcd.bmp"
advsplash::show 1000 600 200 -1 $PLUGINSDIR\splash
Delete $PLUGINSDIR\splash.bmp
LogSet on
End:
MessageBox MB_OK 'Need Administrative Previlidges to Install'
FunctionEnd
The problem is that the StrCmp though equal to True executes Install & then End.
Any Help or Suggestion!!
Panther24
Panther24
21st April 2005 07:04 UTC
Hi!
Sorry Folks!! I have another shot at it and resolved the issue myself. Sorry!!
The new Function looks like...
Function .onInit
Call IsUserAdmin
Pop $R0
;MessageBox MB_OK 'User= "$R1" AccountType= "$R2" IsUserAdmin= "$R0"'
StrCmp "True" $R0 Install End
End:
MessageBox MB_OK|MB_ICONSTOP 'Need Administrative Previlidges to Install'
Abort
Install:
InitPluginsDir
File /oname=$PLUGINSDIR\splash.bmp "abc.bmp"
advsplash::show 1000 600 200 -1 $PLUGINSDIR\splash
Delete $PLUGINSDIR\splash.bmp
LogSet on
FunctionEnd
Afrow UK
21st April 2005 08:40 UTC
It was happening because you needed to jump over the 'End:' block of code with Goto after doing the 'Install:' block of code.
-Stu
Panther24
21st April 2005 10:23 UTC
But now i have another problem the Logging doesn't seem to work!! Any Ideas, Before Every Section i'm using LogText also to specify with section is being installed.
- Panther24
Afrow UK
21st April 2005 12:35 UTC
Are you using the makensis special build compiled with logging?
-Stu
Panther24
22nd April 2005 05:42 UTC
Yes I'm using the special build i copied it twice and also verified it by downloading twice. It was working fine for abt 3-4 builds, but now.... :(
Panther24
Comperio
22nd April 2005 06:18 UTC
According to NSIS help manuals, you must have $INSTDIR defined before the LogSet function will work.
Panther24
22nd April 2005 07:41 UTC
Hi Comperio,
Ur right!! That what i had changed and now it seems 2 work fine.
Tnx.
Panther24