Installed Executable Program Cannot Open Installed Data Files to Read

219 views
Skip to first unread message

Colleen Kobe

unread,
Jan 7, 2022, 9:57:31 AM1/7/22
to innosetup
I am creating an install program.  I'm installing the executable files into the directory:

C:\Program Files (x86)\[my company]\[this program]\[this version]

Inno Setup creates the directory and installs the program perfectly, and the installed program runs correctly.

My problem is that I'm trying to load additional files into other directories that I was told it was "recommended" for an application to load files into.  I've tried loading the additional files into all three of these directories (one at a time).

C:\ProgramData\[my company]\[this program]\[this version]\Sample Files
C:\Users\[me]\Documents\[my company]\[this program]\[this version]\Sample Files
C:\Users\[me]\AppData\Local\[my company]\[this program]\[this version]\Sample Files

Inno Setup creates the directories and installs the files perfectly.

BUT when the program runs and tries to open one of the files in the Sample Files directory, no matter which directory it is, I get the same error message:  errno 2, "File not found."  But it's there.  I can see it in Windows File Explorer.

What is wrong?

How do I fix this so that the executable can open the sample files that were created during installation?

Thanks!
Colleen

Bill Stewart

unread,
Jan 7, 2022, 11:02:17 AM1/7/22
to innosetup
On Friday, January 7, 2022 at 7:57:31 AM UTC-7 writera...@yahoo.com wrote:

BUT when the program runs and tries to open one of the files in the Sample Files directory, no matter which directory it is, I get the same error message:  errno 2, "File not found."  But it's there.  I can see it in Windows File Explorer.

What is wrong?

How do I fix this so that the executable can open the sample files that were created during installation?

Not sure what this question has to do with Inno Setup?

Bill

Colleen Kobe

unread,
Jan 7, 2022, 11:30:15 AM1/7/22
to innosetup
I ask here because it seems like ANYONE who uses Inno Setup would have the same problem.

Where else would I ask?

Bill Stewart

unread,
Jan 7, 2022, 11:38:05 AM1/7/22
to innosetup
On Friday, January 7, 2022 at 9:30:15 AM UTC-7 writera...@yahoo.com wrote:

I ask here because it seems like ANYONE who uses Inno Setup would have the same problem.

Where else would I ask?

I suppose you would ask the developer of the program?

Keep in mind: 32-bit applications on 64-bit Windows run in the WoW (Windows on Windows) 32-bit emulator, and this can often cause confusion regarding finding of files in redirected file system locations.

However, troubleshooting/explaining this is really outside the scope of an Inno Setup question.

Bill

Jernej Simončič

unread,
Jan 7, 2022, 11:50:16 AM1/7/22
to Bill Stewart on [innosetup]

On Friday, January 7, 2022, 17:38:05, Bill Stewart wrote:


Keep in mind: 32-bit applications on 64-bit Windows run in the WoW (Windows on Windows) 32-bit emulator, and this can often cause confusion regarding finding of files in redirected file system locations.

WoW64 filesystem redirection only affects specific directories inside Windows directory, not anything else on the disk (Registry redirection is slightly more annoying, since it affects the whole HKLM\Software tree).

 

-- 
< Jernej Simončič ><><><><>< https://eternallybored.org/ >


If the experiment works, you must be using the wrong equipment.
       -- Patrick's Theorem

Colleen Kobe

unread,
Jan 7, 2022, 12:50:27 PM1/7/22
to innosetup
Thanks for replying.

I AM the developer. The guy who was supposed to do the install part of the project left and is not available.

I know the project works perfectly on my development computer. But I am at a loss how to get it installed on another person's computer. Installation is a whole different world of rules and regulations and I find many one-page articles about some small area of installation, but no cohesive step-by-step guide to get the installation to work. There are permissions and Windows Defender and all sorts of intentional obstacles on the destination computer blocking my way. I don't know how anyone else gets around them.

So yes, since Inno Setup is working great for me, I shouldn't be asking here how to modify my install so that it works. But I have no idea where else to start.
Colleen

Jernej Simončič

unread,
Jan 7, 2022, 1:02:40 PM1/7/22
to 'Colleen Kobe' via innosetup on [innosetup]

On Friday, January 7, 2022, 18:50:27, 'Colleen Kobe' via innosetup wrote:


So yes, since Inno Setup is working great for me, I shouldn't be asking here how to modify my install so that it works. But I have no idea where else to start.

Start by copying the program manually to a different computer (preferably a VM, since it's easier to roll back to a clean state), and if that works, replicate what you did manually inside Inno. If it doesn't, figure out why.

 

When accessing files in %PROGRAMDATA%, %APPDATA% and %LOCALAPPDATA%, also ensure you're using WinAPI to get the location of these directories, since their names and locations may differ depending on Windows version. Another thing you should pay attention to is to never install anything inside user profile directory (and of the {user*} constants in Inno), because the user installing the program may not be the user running it (at the same time, your program should not attempt to write anywhere outside the user profile, unless the user is specifically saving a file there, since regular programs usually won't have write permissions there).

 

-- 
< Jernej Simončič ><><><><>< https://eternallybored.org/ >


The more ridiculous a belief system, the higher the probability of its success.
       -- Bartz's Law of Hokey Horsepuckery

Colleen Kobe

unread,
Jan 7, 2022, 2:55:24 PM1/7/22
to innosetup
Hi, Jernej,

Thanks for helping.


> Another thing you should pay attention to is to never install
> anything inside user profile directory (and of the {user*}
> constants in Inno), because the user installing the program
> may not be the user running it (at the same time, your program
> should not attempt to write anywhere outside the user profile,

Okay, so, never install anything inside user profile directory,
and never write anywhere outside the user profile.

What is left?

Colleen

Bill Stewart

unread,
Jan 7, 2022, 3:20:38 PM1/7/22
to innosetup
On Friday, January 7, 2022 at 9:50:16 AM UTC-7 Jernej Simončič wrote:

WoW64 filesystem redirection only affects specific directories inside Windows directory, not anything else on the disk (Registry redirection is slightly more annoying, since it affects the whole HKLM\Software tree).

Yes, that's correct. For the complete developer's reference (recommended reading even for non-developers):


Bill

Elmar H.

unread,
Jan 8, 2022, 8:46:18 AM1/8/22
to innosetup
Try to copy your program files to an other computer manually as Jernej said and check if there are additional admin permissions necessary.

Gavin Lambert

unread,
Jan 9, 2022, 10:12:00 PM1/9/22
to inno...@googlegroups.com
On 8/01/2022 08:55, 'Colleen Kobe' wrote:
> > Another thing you should pay attention to is to never install
> > anything inside user profile directory (and of the {user*}
> > constants in Inno), because the user installing the program
> > may not be the user running it (at the same time, your program
> > should not attempt to write anywhere outside the user profile,
>
> Okay, so, never install anything inside user profile directory,
> and never write anywhere outside the user profile.
>
> What is left?

It's important to note *who* does *what*.

The installer (when running as admin) is allowed to write to per-machine
locations like HKLM and {pf}. While it does have *permission* to write
elsewhere, it MUST NOT do so.

The application (when running not as admin) is allowed only to read from
per-machine locations like HKLM and {pf}, and must write only to
per-user locations like HKCU and (your language of choice's equivalent
of) {(user/local)appdata}.

So: at install time, you install the non-user-specific files only, and
(if really needed) read-only templates of the user-specific files. All
of these are installed to the per-machine locations only.

And then at application runtime, you first try to read from per-user
locations; if that fails, you then read from per-machine locations; if
that also fails, you use some hard-coded internal defaults or display an
error. And in all cases, you write only to per-user locations.

The install happens just once, for "all users" (ignoring upgrades).
Running the app will happen more than once, and possibly by more than
one different user.


This is standard "how to write applications" stuff; it's not
Inno-specific (or even Windows-specific, other than the particular
folder names).
Reply all
Reply to author
Forward
0 new messages