Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 17th January 2012, 16:00   #1
rijukk
Junior Member
 
Join Date: Jul 2011
Posts: 9
In 64bit installer AccessControl fail to set registry permission

I was using NSIS AccessControl plug-in to grant registry access permission

Quote:
AccessControl::GrantOnRegKey HKLM "Software\Demo" "(S-1-5-20)" "FullAccess" ;"NETWORK SERVICE"
It was working perfect, now I upgraded my installer to 64bit using "x64.nsh"'s ${RunningX64}
and SetRegView 64

Now
Quote:
AccessControl::GrantOnRegKey HKLM "Software\Demo" "(S-1-5-20)" "FullAccess"
it fail to grant permission; however i create a key in redirected node (Wow6432Node) like HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Demo. It providing proper grant permission.

Any help will be greatly appreciated

Thank you,
Riju
rijukk is offline   Reply With Quote
Old 18th January 2012, 06:09   #2
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 549
Send a message via ICQ to T.Slappy
Are you running 32bit application on x64 machine?
If yes then this situation is correct because 32bit applications use Wow6432Node in Registry.

Your assumption is wrong:
Quote:
by I upgraded my installer to 64bit using "x64.nsh"'s ${RunningX64}
Creating 64bit installer is possible only by recompiling NSIS as 64bit application.

Cool looking installers with custom design: www.graphical-installer.com
Create Setup Pages easily: www.install-designer.com
Build installers in Visual Studio 2005-2019: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.4 Sydney: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 18th January 2012, 07:40   #3
rijukk
Junior Member
 
Join Date: Jul 2011
Posts: 9
Hi T. Slappy,

I am upgrading the installer script with guideline provided in this link
http://bojan-komazec.blogspot.com/20...t-windows.html



I am able to read\write registry from HKLM\Software\Demo after using "SetRegView 64".

Quote:
; disable registry redirection (enable access to 64-bit portion of registry)
SetRegView 64
Only registry fails on
Quote:
AccessControl::GrantOnRegKey HKLM "SOFTWARE\Demo" "(S-1-5-20)" "FullAccess"
my installer is working perfectly in 64bit PC without any other issues


Thank you,
Riju
rijukk is offline   Reply With Quote
Old 8th February 2012, 20:01   #4
kalverson
Senior Member
 
Join Date: May 2007
Location: Maple Grove, Minnesota
Posts: 134
Question

Quote:
Originally Posted by T.Slappy View Post
Are you running 32bit application on x64 machine?
If yes then this situation is correct because 32bit applications use Wow6432Node in Registry.

Your assumption is wrong:

Creating 64bit installer is possible only by recompiling NSIS as 64bit application.
Is there a NSIS 64 bit compiled engine/install available somewhere for download?
kalverson is offline   Reply With Quote
Old 18th January 2012, 09:59   #5
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Could it be that the AccessControl plugin cannot handle x64 registry yet?
MSG is offline   Reply With Quote
Old 18th January 2012, 10:01   #6
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Could it be that the AccessControl plugin doesn't support x64 registry yet?
MSG is offline   Reply With Quote
Old 18th January 2012, 19:12   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
AccessControl plug-in needs updating to handle SetRegView. I will do it when I have some time (maybe tomorrow).

Stu
Afrow UK is offline   Reply With Quote
Old 19th January 2012, 05:59   #8
rijukk
Junior Member
 
Join Date: Jul 2011
Posts: 9
Hi Stu,

So nice of you

Thank you,
Riju
rijukk is offline   Reply With Quote
Old 23rd January 2012, 05:23   #9
rijukk
Junior Member
 
Join Date: Jul 2011
Posts: 9
What i read from internet in order to accomplish this; we need to use advapi32.dll's RegSetKeySecurity in the AccessControl plugin.
rijukk is offline   Reply With Quote
Old 25th January 2012, 23:48   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
It took a little longer than expected due to SetNamedSecurityInfo/GetNamedSecurityInfo complete lack of support for KEY_WOW64_64KEY (as you pointed out) so a lot of the code had to be changed quite drastically. It may also mean the plug-in will no longer work on Windows 2000, but we may have to live with that.

v1.0.5.0 - 25th January 2012 ~ Afrow UK
  • Removed IsUserTheAdministrator.
  • Added NameToSid.
  • Major code cleanup/rewrite.
  • Proper Unicode build (with Unicode plugin API).
  • Support for 64-bit registry (SetRegView 64).
  • Functions now return "ok" on success or "error" otherwise. On "error", the next item on the stack will be the error description.
  • Added version information resource.
Edit: I removed IsUserTheAdministrator because you can quite easily test for that yourself using the new NameToSid. Just check the result of NameToSid ends with -500.

Stu
Afrow UK is offline   Reply With Quote
Old 26th January 2012, 00:47   #11
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
Quote:
Originally Posted by Afrow UK View Post
It may also mean the plug-in will no longer work on Windows 2000, but we may have to live with that.
IMHO the Ansi version needs to support NT4/Win95 (I don't know what the old behavior was but it can just return ok on 9x) and the unicode build 2000+ (It is unclear at this point if NT4 will be supported as unicode)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 26th January 2012, 11:11   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
When was ConvertSidToStringSid/ConvertStringSidToSid added to Windows? The plug-in has been using those for some time. Now it's using RegOpenKeyEx as well.

Stu
Afrow UK is offline   Reply With Quote
Old 26th January 2012, 11:59   #13
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
RegOpenKeyEx was added in Win95/NT4 IIRC and I don't remember off the top of my head but I'm guessing ConvertSidToStringSid was added in 2000 (You cannot trust MSDN, you must check the dll exports)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 26th January 2012, 12:46   #14
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
How about RegSetKeySecurity? I will look into writing replacements for ConvertSidToStringSid/ConvertStringSidToSid.

Stu
Afrow UK is offline   Reply With Quote
Old 26th January 2012, 17:56   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
v1.0.6.0 - 26th January 2012 - Afrow UK
  • Wrote replacements for ConvertSidToStringSid/ConvertStringSidToSid for backwards compatibility with Windows NT4/ME (ANSI build only).
  • Loads RegSetKeySecurity/RegGetKeySecurity functions at run-time for backwards compatibility with Windows NT4/ME (ANSI build only).
  • Removed commented out legacy code.
Note that RegSetKeySecurity/RegGetKeySecurity is only used when SetRegView 64 is set.

http://nsis.sourceforge.net/AccessControl_plug-in

Stu
Afrow UK is offline   Reply With Quote
Old 26th January 2012, 18:52   #16
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Hate to be a nagger, but... Wasn't NT4 also unicode? Not that I feel strongly about NT4 support one way or the other, but yeah.
MSG is offline   Reply With Quote
Old 26th January 2012, 19:55   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
As Anders says I don't think Unicode NSIS supports below Windows 2000 anyway so there is no point the Unicode plug-in doing so.

Edit: If someone needs the Unicode build for NT4 they can just rebuild with ACCESS_CONTROL_NT4 preprocessor directive. Otherwise the Unicode build links to the native Windows 2000+ API's to save on code size.

Stu
Afrow UK is offline   Reply With Quote
Old 26th January 2012, 22:07   #18
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
I did not check out the code yet but I hope you are only going down the wow64 path on NT5.2+, I don't know what happens if you pass the WOW64 flag to older registry functions...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th January 2012, 00:15   #19
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
According to MSDN KEY_WOW64_64KEY is ignored on 32-bit Windows (and Windows 2000) so I assume that means older versions of Windows too. The registry functions are only used if SetRegView 64 is set but I suppose a test for a 64-bit OS would be good too.

Stu
Afrow UK is offline   Reply With Quote
Old 2nd February 2012, 16:19   #20
rijukk
Junior Member
 
Join Date: Jul 2011
Posts: 9
Thank you Stu... i will test it tomorrow and let you know the feedbacks

Riju
rijukk is offline   Reply With Quote
Old 8th February 2012, 20:43   #21
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
No. Why do you need it?

Stu
Afrow UK is offline   Reply With Quote
Old 9th February 2012, 15:27   #22
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
Quote:
Originally Posted by Afrow UK View Post
No. Why do you need it?

Stu
Server Core

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

Tags
accesscontrol, registry, x64

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