Old 14th December 2012, 02:17   #1
Ocrana
Junior Member
 
Join Date: Nov 2006
Posts: 27
ProgramData Windows 8

Hello,

my installer use the "C:\ProgramData" folder to install files for all users. But in Windows 8 NSIS do not write to this folder. I use:

code:

StrCpy $0 "FoxBurner"
; Retrieving CommonApplicationData path (in $1)
System::Call "shfolder::SHGetFolderPath(i $HWNDPARENT, i 0x0023, i 0, i 0, t.r1)"
StrCpy $APPLICATION_COMMON_FOXBURNER_FOLDER "$1\$0"

CreateDirectory $APPLICATION_COMMON_FOXBURNER_FOLDER
# Make the directory "$APPLICATION_COMMON_FOLDER\application name" read write delete accessible by all users
; SID instead of BU as users (it works also on Windows 2000)
AccessControl::GrantOnFile \
"$APPLICATION_COMMON_FOXBURNER_FOLDER" "(S-1-5-32-545)" "FullAccess + GenericRead + GenericWrite + Delete + AddFile"




On Windows 8 this C:\ProgramData only contains a "Microsoft" subfolder but none of the folder I install. Any ideas?
BTW: On Vista/XP/Windows7 everything works fine.

Ingo
Ocrana is offline   Reply With Quote
Old 14th December 2012, 16:18   #2
plaintext
Junior Member
 
Join Date: Apr 2009
Posts: 8
My code looks like this:
code:

!define CSIDL_COMMON_APPDATA 0x0023
Var AppDataPath
System::Call "shell32::SHGetFolderPath(0, i ${CSIDL_COMMON_APPDATA}, 0, 0, t .r1)"
StrCpy $AppDataPath "$1\${PRODUCT_PUBLISHER}\${PRODUCT_NAME}"
CreateDirectory "$AppDataPath"
AccessControl::GrantOnFile "$AppDataPath" "(BU)" "GenericRead + GenericWrite"


Works as expected.
plaintext is offline   Reply With Quote
Old 14th December 2012, 21:29   #3
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
If everyone needs write access to something in a common folder you probably have a design (and security) issue in your application.

Also, why not just use setshellvarcontext all?

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

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