Old 4th October 2017, 12:27   #1
Vincentv189
Junior Member
 
Join Date: Oct 2017
Posts: 2
NSIS Permissions and System32

Good morning/afternoon all,

I hoping someone can assist with this odd issue I am seeing in NSIS. I have a Powershell script that I am attempting to wrap in NSIS. This script modifies the local group policy via updating the Registry.pol file in C:\Windows\System32\GroupPolicy\Machine. Running this script via right click run as admin on the source bat file works fine.

However whenever a bat file is called in NSIS, even though the bat file has administrator, it cannot even see the Machine folder.

To test the permissions I am now wrapping a simple bat file to call a cmd window so I can play around in the NSIS permissions, if I go to the GroupPolicy folder and run a dir I get this:

C:\Windows\System32\GroupPolicy>dir

Directory of C:\Windows\System32\GroupPolicy

12/08/2016 05:27 PM <DIR> .
12/08/2016 05:27 PM <DIR> ..
12/08/2016 05:27 PM 11 gpt.ini
1 File(s) 11 bytes
2 Dir(s) 732,180,004,864 bytes free


I am running this RequestExecutionLevel admin set, and have verifed that the cmd window and the ps window are both elevated.

In nsis I run this command to call the bat: ExecWait '"$INSTDIR\Test.bat" ' $0

The bat file contains this:

CD %~dp0
call cmd.exe

Really unsure what to do next.

Thanks in advanced to anyone that could lend some insight, or even just wild conjecture as to why that folder
Vincentv189 is offline   Reply With Quote
Old 4th October 2017, 12:54   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,589
My guess is that this is a 64-bit system? If it is you are probably running into the file-system redirector.

What happens if you do:

Quote:
!include x64.nsh
Section
${DisableX64FSRedirection}
ExecWait '"$InstDir\Test.bat"' $0
${EnableX64FSRedirection}
SectionEnd
?

(I don't recommend this usage in an actual installer but testing it is fine)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 4th October 2017, 13:24   #3
Vincentv189
Junior Member
 
Join Date: Oct 2017
Posts: 2
Success! that was it!

Doing a dir on the folder now with the redirection disabled reveals the full folder list.

I imagine the path forward would be messing with the %windir% variable. Any quick suggestions would be appreciate, but thank you again for figuring out whats going on!
Vincentv189 is offline   Reply With Quote
Old 4th October 2017, 13:56   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,589
%windir% will not change anything, in a 32-bit app the System32 folder is redirected to SysWow64.

You can get to the real System32 folder on Vista+ with %windir%\SysNative but you need to make sure you are on a 64-bit system because that folder does not exist on 32-bit Windows.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Tags
local grouppolicy, permissions, uac

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump