Old 26th February 2016, 23:21   #1
xlrotor
Junior Member
 
Join Date: Apr 2007
Location: Austin, TX, USA
Posts: 13
can't write a file to $WINDIR

Windows has a file named c:\Windows\hh.exe
that I need to replace, but I am getting stumped by writing privileges, I think.
My script contains this
!include x64.nsh
RequestExecutionLevel admin
.
.
.
SetOutPath $WINDIR
File Files\hh.exe

But when I run the script, it reports
Output Folder: C:\Windows
Skipped: hh.exe

What do I need to do to replace hh.exe in the Windows folder?
xlrotor is offline   Reply With Quote
Old 26th February 2016, 23:47   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,280
Normally I'd tell you to change the overwrite mode but hh.exe is a system file that you should not be messing with. Why do you think you need replace it?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th February 2016, 02:23   #3
xlrotor
Junior Member
 
Join Date: Apr 2007
Location: Austin, TX, USA
Posts: 13
Thanks for the reply. hh.exe is evidently used to display Windows compiled help files (files with .chm extension). I build my .chm file for my application using ForeHelp. ForeHelp comes with its own version of hh.exe because the Microsoft version has bugs (I think). The Microsoft Win 7, 8 and 10 versions cause my .chm file to throw scripting errors, and the ForeHelp version doesn't. The version that comes with Vista seems to work without errors.

I did some testing in a Win 7 virtual machine, and Win 7 made me do all sorts of file security and permission things to allow me to replace c:\Windows\hh.exe.

But there are other weird things going on I don't understand. My .chm can be launched by my application (which runs in Excel VBA) or by double clicking the .chm in Windows Explorer. When run from Excel VBA, the chm runs as some kind of subprocess to Excel, and script errors do not occur. But if double clicked in Explorer, script errors do occur. I wish I knew why this happens, but I have no idea.

I guess I could just be happy with my chm running ok as a subprocess to Excel. But if I can replace hh.exe, then it will run error free from Explorer, too.
xlrotor is offline   Reply With Quote
Old 27th February 2016, 09:47   #4
meoit
Member
 
Join Date: Oct 2014
Location: $DESKTOP
Posts: 99
Build again your .chm file with other application.
meoit is offline   Reply With Quote
Old 27th February 2016, 11:51   #5
xlrotor
Junior Member
 
Join Date: Apr 2007
Location: Austin, TX, USA
Posts: 13
If you mean to build the chm with something other than ForeHelp, I tried HelpSmith and HelpNDoc and both of those had script errors. I used their "trial" versions, and imported my chm project into those apps.
xlrotor is offline   Reply With Quote
Old 27th February 2016, 15:22   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,280
Microsoft really don't want you to change system files in $windir and $sysdir so they make it harder to do with every version. Windows File Protection will detect bad copies and replace them with a fresh Microsoft version. In Vista and later most system files are owned by TrustedInstaller and you have to take ownership before you can change the ACL and owerwrite.

Even if you are willing to get past all of this you should think about what would happen if everyone did this! What if another 3rd-party replaced hh.exe with something that works on their chm file but perhaps breaks yours. Please don't go down this route. It is much better if you file a bug report to the people that make your helpfile generator.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th February 2016, 15:38   #7
xlrotor
Junior Member
 
Join Date: Apr 2007
Location: Austin, TX, USA
Posts: 13
I agree completely, and I'm going to stop pursuing this. I really never did want to replace any Microsoft files in that folder for the very reasons you mentioned. I am presently working on another approach to my problem that should eliminate the need to do this.

Microsoft's files which are in the C:\Windows folder for supporting .chm help files seem to harken back to the days of XP.
xlrotor is offline   Reply With Quote
Old 27th February 2016, 16:04   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,280
Lightbulb

Quote:
Originally Posted by xlrotor View Post
Microsoft's files which are in the C:\Windows folder for supporting .chm help files seem to harken back to the days of XP.
It is older than that, Win98 was the first with it out of the box but NT4 and Win95 will probably have it if they have installed IE5 or the html help redistributable.

XP still used the older .hlp files for the popup help/"What's this?". All that stuff was removed in Vista.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 27th February 2016, 17:10   #9
xlrotor
Junior Member
 
Join Date: Apr 2007
Location: Austin, TX, USA
Posts: 13
Hmm. That's good to know. ForeHelp will generate either a hlp or chm from my project. I've been shipping both with my app, and give the user the option to select which to use. But I have decided to drop the hlp version altogether from here on.

I wonder how long the chm version of windows help will last. Microsoft hasn't upgraded it in any way that I can tell in probably 15 years or more.
xlrotor is offline   Reply With Quote
Old 27th February 2016, 18:18   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,280
Quote:
Originally Posted by xlrotor View Post
I wonder how long the chm version of windows help will last. Microsoft hasn't upgraded it in any way that I can tell in probably 15 years or more.
There has been at least 3 new formats after this, one for Vista+ and two for Visual Studio but they are not exactly supported for ISVs. See https://en.wikipedia.org/wiki/Online...help_platforms for more.

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

Tags
$windir, setoutpath

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