0

I am writing an NSIS script on windows OS to create shared directories at the time of installation. Here is my code which works well on English Windows but doesn't work on French Windows 7.

CreateDirectory C:\tmpShare
nsExec::Exec 'icacls C:\tmpShare /grant *S-1-1-0:(OI)(CI)F'
nsExec::Exec 'net share "tmpShare"="C:\tmpShare" /grant:Everyone,full  /remark:"Temp shared folder"'

Reason: French OS doesn't understand user name string 'Everyone' in the net share command, it translates to 'Tout le monde' in french.

I tried using security id of the 'Everyone' i.e. *S-1-1-0 instead string 'Everyone' but it doesn't work with net share (BAD DESIGN OF WINDOWS, icacls works with it though)

I tried using "Tout de monde" instead of 'Everyone' and it solved the problem, now the question is How to write my NSIS script which platform independent ?

Veve
  • 6,643
  • 5
  • 39
  • 58
Nitin
  • 145
  • 9
  • You need to Pop after each call to nsExec::Exec – Anders Apr 28 '16 at 19:32
  • It's not a "BAD DESIGN", you're just using it wrongly. The `net share` command is intended for *interactive* use, by the end user or system administrator, not for use by installers. *You're* supposed to be using the API. – Harry Johnston Apr 28 '16 at 22:39

1 Answers1

1

The AccessControl plug-in can convert the SID for you:

AccessControl::SidToName "(S-1-1-0)"
Pop $2
Pop $1
MessageBox MB_OK "Name=$1 Domain=$2"
Anders
  • 97,548
  • 12
  • 110
  • 164
  • Thanks for your answer and probably you answered my question but I am not using this solution because I found another way to share a folder without needing to use 'net share ' command. it here: http://nsis.sourceforge.net/Sharing_Folders – Nitin May 13 '16 at 23:55