I have a C program with an installer created by an NSIS script. The issue is one of the files that the installer adds needs to be read only. For this problem I am trying to use the AccessControl plugin. I include the plugin directory with the following line:
!addplugindir "AccessControl\Unicode\Plugins"
At the bottom of my install section I have attempted these lines with no success:
AccessControl::GrantOnFile "$INSTDIR\file.txt" "BUILTINUSERS" "GenericRead + Delete"
AccessControl::GrantOnFile "$INSTDIR\file.txt" "(BU)" "GenericRead + Delete"
AccessControl::GrantOnFile "$INSTDIR\file.txt" "(S-1-5-32-545)" "GenericRead + Delete"
AccessControl::GrantOnFile "$INSTDIR\file.txt" "(S-1-1-0)" "GenericRead + Delete"
There is no error displayed when the script is compiled but after running the installer the file can still be written over. I have had no success from any of these sources.
http://nsis.sourceforge.net/AccessControl_plug-in
http://avidinsight.uk/2014/01/nsis-access-control-problem-with-built-in-users-group/
How do you set directory permissions in NSIS?
http://nsis.sourceforge.net/Talk:AccessControl_plug-in
On a final note I am using Windows 8.
GrantOnFile appends to the existing ACL for the file and never restricts anything. Use SetOnFile to start a new ACL or in your case, use DenyOnFile to deny access for specific groups.
You should also Pop after each call to these functions, the popped string will be "ok" or a error message.
Related
I have a custom action (RunEncryption2) that I'm using for encrypting a configuration file by using aspnet_regiis.exe. The custom action type that I'm using is an EXE with path referencing a directory (initial type 34) using deferred execution in system context (so the final type is 3106). The file that I want to encrypt is on INSTALLDIR, so I have a Set Property custom action (SetRunEncryption2, type 51) where I'm setting RunEncryption2=[INSTALLDIR]. My two custom actions look like this:
SetRunEncryption2
Property Name: RunEncryption2
Property Value: [INSTALLDIR]
RunEncryption2
Working Directory: WindowsFolder
File Name & Command line: [WindowsFolder]Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef "connectionStrings" "[CustomActionData]" -prov "DataProtectionConfigurationProvider"
When the installer runs, I get no error, however the file gets no encryption at all. When I review the log, I get the following:
MSI (s) (34:C0) [17:32:11:356]: Executing op: CustomActionSchedule(Action=RunEncryption2,ActionType=3106,Source=C:\WINDOWS\,Target=C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef "connectionStrings" "" -prov "DataProtectionConfigurationProvider",CustomActionData=C:\Test\)
From the log I can see that the CustomActionData property has been set correctly, however it hasn't been included as part of the command.
At this point the only way I have to make the command work is passing a hard-coded value of INSTALLDIR, otherwise it doesn't seem to work.
I have tried:
Not using CustomActionData, instead passing the value of INSTALLDIR as part of my command line directly.
Using a "Path in Property value" custom action with similar results.
When I run option 1 above, I get a 1722 error on the log:
MSI (s) (C4:50) [12:49:46:968]: Note: 1: 1722 2: RunEncryption2 3: C:\WINDOWS\ 4: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef "connectionStrings" "C:\Test\" -prov "DataProtectionConfigurationProvider"
Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action RunEncryption2, location: C:\WINDOWS\, command: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef "connectionStrings" "C:\Test\" -prov "DataProtectionConfigurationProvider"
MSI (s) (C4:50) [12:49:56:841]: Product: TestEncryption -- Error 1722. There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor. Action RunEncryption2, location: C:\WINDOWS\, command: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -pef "connectionStrings" "C:\Test\" -prov "DataProtectionConfigurationProvider"
Does anyone know how can I do to correctly execute this command and dynamically pass the value of INSTALLDIR?
Finally found the problem was not in the custom action passing the properties, but in the way that aspnet_iisreg is expecting the parameters.
INSTALLDIR is passing the string with a trailing slash (e. gr. c:\Test\), when I hard coded the installation path I was passing c:\Test instead.
The solution consisted in creating another custom action that removes the trailing slash and stores the value in a new property, this then can be used as parameter for aspnet_iisreg.
By the way, as Michael Urman mentioned, there was no need to use CustomActionData. Thanks.
I'm using NReco.PdfGenerator.LT to create a PDF document from a HTML page. This works fine on windows if I just point it at the wkhtmltopdf.exe executable, but this does not have the same effect on Linux.
HtmlToPdfConverter cvt = new HtmlToPdfConverter();
cvt.PdfToolPath = GetPdfToolPath();
// Windows: <current-dir>\wkhtmltopdf\win32\bin
// Linux: <current-dir>/wkhtmltopdf/linux/bin
cvt.WkHtmlToPdfExeName = GetPdfToolName();
// Windows: wkhtmltopdf.exe
// Linux: wkhtmltopdf
I just get this error:
Cannot generate PDF: Permission denied
Possible reasons of this error:
linux user who starts .net core program has no permissions to run "wkhtmltopdf". Also ensure that "wkhtmltopdf" file is marked as "executable" (x).
sometimes temp folder returned by Path.GetTempPath() is not accessible; another location for temp files may be specified with HtmlToPdfConverter.TempFilesPath property
I'm doing the "Hello World" tutorial about User Control but without success.
In the first attempt I did the User Control like is shown in the tutorial page http://wiki.genexus.com/commwiki/servlet/hwiki?Hello+World+User+Control
But it didn't work, so I download the finished user control available for download in the end of the tutorial.
With the download user control, I have created this web panel
with this event
But I have an empty result
What is missing here? Any tips for debugging here?
I'm using the GeneXus latest version, GeneXus X Evolution 3 (trial).
Edit:
The user control code:
function HelloWorld($)
{
this.Width;
this.Height;
this.FontFace;
this.FontColor;
this.FontSize;
this.show = function()
{
///UserCodeRegionStart:[show] (do not remove this comment.)
var buffer= '<a id="hworld1" href="#" style="color:rgb(' + this.FontColor.R + ',' + this.FontColor.G + ',' + this.FontColor.B + ')' + '; font-family:' + this.FontFace+ ';font-size:' + this.FontSize + 'pt;">Hello World!!!</a>';
this.setHtml(buffer);
document.getElementById("hworld1").onclick = this.HelloWorldClicked;
///UserCodeRegionEnd: (do not remove this comment.)
}
///UserCodeRegionStart:[User Functions] (do not remove this comment.)
///UserCodeRegionEnd: (do not remove this comment.):
}
After I run in cmd line the command:
"C:\Program Files <x86>\Artech\GeneXus\GeneXusXEv3Trial\Genexus.exe" /install
It is now working! It was not clear for me, this step in the tutorial.
Edit:
I have found this in the wiki, that explains better how to install an User Control, and solves the problem I had:
Manual installation
Download the control from GeneXus Marketplace.
Unzip files
Copy the directory under the UserControls directory in the GeneXus installation.
Execute GeneXus with the /install parameter. For example: GX_Installation_Path\GeneXus.exe /install
Check that the toolbox has added the new option under the User Controls section.
Enjoy!
I am trying to configure Cruisecontrol.net for UCM Clearcase for the first time. Following is the sourceControl tag in the ccnet.config file:
<sourcecontrol type="clearCase">
<branch>123_India_Release</branch>
<autoGetSource>true</autoGetSource>
<viewName>admin_123_CRUISE</viewName>
<viewPath>$(ViewDirectory)</viewPath>
<useLabel>false</useLabel>
<useBaseline>false</useBaseline>
<executable>cleartool.exe</executable>
</sourcecontrol>
I constantly receive the following error:
ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control
operation failed: cleartool: Error: Not an object in a vob: "PATH TO
THE VIEW"
When I run cleartool from an arbitrary directory with the following parameters:
cleartool.exe lshist -r -nco -branch "123_India_Release" -since
05-Dec-2012.14:38:18 -fmt
I get the same error. But if I change the working directory to $(ViewDirectory) before running cleartool, it runs fine.
How should I make Cruisecontrol.net run cleartool.exe from the $(ViewDirectory)?
I have already tried adding <workingDirectory>$(ViewDirectory)</workingDirectory> tag before <executable>cleartool.exe</executable> but it did not work.
Any help would be appreciated.
EDIT 1:
As a workaround I have done the following:
<exec>
<executable>cleartool.exe</executable>
<baseDirectory>d:\Workspace\123_India_Release\VOB</baseDirectory>
<buildArgs>update -force</buildArgs>
<buildTimeoutSeconds>6000</buildTimeoutSeconds>
</exec>
I have added this to the tasks tag. I have configured an hourly trigger which does the following:
1) Update snapshot view
2) Build the VS 2010 solutions mentioned in the tasks tag.
The limitations are:
1) The trigger is hourly. I want it to be a commit based trigger.
2) This is a workaround
EDIT 2:
Further experimentation revealed that the ccnet.exe works fine. It does all that is needed. The issue is caused by the service ccservice.
I have stopped ccservice for now and started ccnet.exe. I plan to leave it running.
The View directory isn't enough: you must specify a vob.
See for instance:
"clearfsimport: Error: Not an object in a vob: "\"." (as an illustratio of that error message)
this thread (or this one): "You have to specify explicitly the VOB(s) to check for modification set"
The path should looks like:
<viewPath>Drive:\path\to\view\vobname</viewPath>
If your $(ViewDirectory) already references Drive:\path\to\view, then you could use:
<viewPath>$(ViewDirectory)\vobname</viewPath>
I'm getting a weird error whiles signing my software. I'm using inno setup 4.5.2.
Running Sign Tool command: signtool.exe sign /a /f cert.pfx /v /t "http://timestamp.verisign.com/scripts/timstamp.dll" /p pwd /d "Setup Label" "out\uninst.e32.tmp"
SignTool Error: An unexpected internal error has occurred.
Error information: "Error: Store IsDiskFile() failed." (-2147024893/0x80070003)
Error in W:\path\installer.iss: Sign Tool failed with exit code 0x1.
Compile aborted.
Command line seems pretty ok, it even work outside the inno setup compile. While setting the SignedUninstaller=no get me farther, it still make this error while trying to sign the output setup file.
Now i've looked pretty much everywhere for that error code (0x80070003) and/or the message "Store IsDiskFile() failed". I have also tried with multiple version of signtool.
I figured out the problem, the path to the certificate must be relative to the installer output path, not the current working folder. In this case, it would be "..\cert.pfx".
I had the same problem. My problem was I have used " in the signTool command, while I needed to use $q instead. Surprisingly it was successfully signed the executable but it failed to sign the result setup.exe file.
In my case I had the wrong Path for the certificate file. A message like "pfx not found" would much be better than just "IsDiskFile() failed."....
My problem was having the .pfx file on a network drive (G:). Moving it to a lokal drive (C:) solved the problem.