Archive: Issue with StrCmp


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


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


It was happening because you needed to jump over the 'End:' block of code with Goto after doing the 'Install:' block of code.

-Stu


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


Are you using the makensis special build compiled with logging?

-Stu


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


According to NSIS help manuals, you must have $INSTDIR defined before the LogSet function will work.


Hi Comperio,

Ur right!! That what i had changed and now it seems 2 work fine.

Tnx.
Panther24