Cannot copy file to c:\windows\system32

1,332 views
Skip to first unread message

Rod S

unread,
May 29, 2021, 4:31:23 PM5/29/21
to innosetup
Hello!
according to the manual
{win} The system's Windows directory.
so 
"{win}\system32" must be \Windows\system32
But it copies files to SysWow64 :(
Why?
Thanks

Jernej Simončič

unread,
May 29, 2021, 7:00:57 PM5/29/21
to Rod S on [innosetup]
On Saturday, May 29, 2021, 22:31:23, Rod S wrote:

> according to the manual
> *{win} *The system's Windows directory.
> so
> "{win}\system32" must be \Windows\system32
> But it copies files to SysWow64 :(
> Why?

You did not read the manual. If you want to copy files to System32, use {sys} constant, and set the appropriate architecture flags.

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

He who has the gold, makes the rules.
-- The Golden Rule

Rod S

unread,
Jun 3, 2021, 9:10:05 AM6/3/21
to innosetup
I did read the manual
why cannot I copy file to directorу described as string "system32" path, not a variable or constant {sys} ?
I dont use architecture flags and constants in this example, I need "system32" for any architecture
if {win}\system32 is not windows\system32 but something else - it is a bug in the program

Jernej Simončič

unread,
Jun 3, 2021, 9:21:28 AM6/3/21
to Rod S on [innosetup]
On Thursday, June 3, 2021, 15:10:05, Rod S wrote:

> I did read the manual
> why cannot I copy file to directorу described as string "system32" path,
> not a variable or constant {sys} ?
> I dont use architecture flags and constants in this example, I need
> "system32" for any architecture
> if {win}\system32 is not windows\system32 but something else - it is a bug
> in the program

Read about 64-bit install mode to understand why you have to use {sys} and how to use the architecture flags: <https://jrsoftware.org/ishelp/topic_32vs64bitinstalls.htm>. Also read <https://jrsoftware.org/ishelp/topic_64bitlimitations.htm> and Flags description on <https://jrsoftware.org/ishelp/topic_filessection.htm>

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

Last year's was always better.
-- Law of Regressive Achievement

Bill Stewart

unread,
Jun 3, 2021, 10:13:31 AM6/3/21
to innosetup
On Thursday, June 3, 2021 at 7:10:05 AM UTC-6 Rod S wrote:
I did read the manual
why cannot I copy file to directorу described as string "system32" path, not a variable or constant {sys} ?
I dont use architecture flags and constants in this example, I need "system32" for any architecture
if {win}\system32 is not windows\system32 but something else - it is a bug in the program

It's not a bug in the program.

Keep in mind that on a 64-bit system, "System32" means "64-bit system files" (it does not mean 32-bit system files).

Also keep in mind that the installers that Inno Setup produces are 32-bit.

As suggested, you probably need to read the documentation about OS architectures and how Inno Setup handles these differences.

Bill

Rod S

unread,
Jun 3, 2021, 10:42:56 AM6/3/21
to innosetup
"Keep in mind that on a 64-bit system, "System32" means "64-bit system files" "
it is not true
{sys} and {sysnative} mean different depending of architecture
string "c:\aaaa" means the same at any system
so the string "system32" does, it is not predefined constant, it is a string
%userprofile% is a env variable, but c:\userprofile is a folder
if program has no difference between constant {sys] and string "system32" it is a BUG

Rod S

unread,
Jun 3, 2021, 11:04:55 AM6/3/21
to innosetup

please show me the page in manual https://jrsoftware.org/ishelp/
where it is told that system32 without the {} brackets is a constant not a string and cannot be used??

Jernej Simončič

unread,
Jun 3, 2021, 11:45:12 AM6/3/21
to Rod S on [innosetup]
On Thursday, June 3, 2021, 17:04:55, Rod S wrote:

> where it is told that system32 *without the {} brackets* is a constant not
> a string and cannot be used??

You can use it like that, but you will cause trouble, especially if you use regserver. Also, if you have a 32-bit program and try accessing C:\Windows\System32, Windows will silently redirect you on x64 Windows (same thing happens if you're running on AArch64 Windows, except you currently have 3 distinct System32 directories there, and there'll soon probably be 4).

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

Nobody notices when things go right.
-- Zimmerman's Law of Complaints

Gavin Lambert

unread,
Jun 3, 2021, 7:01:05 PM6/3/21
to inno...@googlegroups.com
On 4/06/2021 1:10 am, Rod S wrote:
> why cannot I copy file to directorу described as string "system32" path,
> not a variable or constant {sys} ?

While it's less common these days, it is entirely possible that the
{sys} folder not be inside {win} at all, or have an entirely different
name. That's just one of the many reconfigurable directory names in
Windows.

Eivind Bakkestuen

unread,
Jun 3, 2021, 9:03:29 PM6/3/21
to inno...@googlegroups.com
Rod,

If the documentation and MS help on windows file redirection doesn't help you, then thoroughly explain what it is you really want to do. Then it's possible you'll get help more suited to the task at hand.

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/b226bc75-717b-4b97-a73f-9dc80589f7f0n%40googlegroups.com.

Rod S

unread,
Jun 4, 2021, 3:41:52 AM6/4/21
to innosetup
what I am trying to do?
I am trying to copy file to System32 like copy /Y * %SystemRoot%\System32\ do
without any dependency with windows architecture

Rod S

unread,
Jun 4, 2021, 3:43:16 AM6/4/21
to innosetup
I think I need to install file to {tmp} and then run batch command script for that

Jernej Simončič

unread,
Jun 4, 2021, 5:09:13 AM6/4/21
to Rod S on [innosetup]
On Friday, June 4, 2021, 09:41:52, Rod S wrote:

> I am trying to copy file to System32 like *copy /Y * %SystemRoot%\System32\
> *do
> without any dependency with windows architecture

Please explain why can't you use {sys}, and why do you insist on using System32.

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

You never run out of things that can go wrong.
-- NBC's Addendum to Murphy's Law

Bill Stewart

unread,
Jun 4, 2021, 1:37:31 PM6/4/21
to innosetup
Much frustration can be easily avoided by understanding how the 32-bit emulator works on 64-bit Windows.


Some background also:



it's important to keep in mind that Inno Setup is a 32-bit application but is fully aware of how to install 64-bit apps by intelligent use of its constants and the file system and registry redirector.

There's no point in getting frustrated and complaining that there is somehow a bug when you're doing things incorrectly in the first place. Things will be much easier if you read the documentation.

Bill

Rod S

unread,
Jun 4, 2021, 1:46:11 PM6/4/21
to innosetup
OK
"copy file c:\windows\system32"
where will be the file? will it be "redirected" according your links? or will it be in the same place where copied? 
does it depend of file content? will 32 dll, 64 dll and txt file copied to different folders?

Martijn Laan

unread,
Jun 4, 2021, 2:26:40 PM6/4/21
to inno...@googlegroups.com
Hi,

It depends on the program doing the copy (is it 32 bit or 64 bit) and the program checking for it (is it 32 bit or 64 bit).
  • A filed copied to c:\Windows\System32 by a 32 bit process will be found in c:\Windows\System32 by a 32 bit process and in c:\Windows\SysWow64 (and NOT in c:\Windows\System32) by a 64 bit process. So the same file appears in different places depending on the bitness of the process trying to find it.
  • A filed copied to c:\Windows\System32 by a 64 bit process will be found in c:\Windows\Sysnative (and NOT in c:\Windows\System32) by a 32 bit process and in c:\Windows\System32 by a 64 bit process. Again, the same file appears in different places.

This is called redirection and is performed by Windows.
https://docs.microsoft.com/en-us/windows/win32/winprog64/file-system-redirector

Similar things happens to certain parts of the registry when to try to write to or read from it.
https://docs.microsoft.com/en-us/windows/win32/winprog64/registry-redirector

Some programs (like Inno Setup) can be told to switch between 32 bit or 64 bit copying and checking, both for files and for the registry.
https://jrsoftware.org/ishelp/index.php?topic=32vs64bitinstalls

This is done using Wow64DisableWow64FsRedirection and KEY_WOW64_64KEY.
https://docs.microsoft.com/en-us/windows/win32/api/wow64apiset/nf-wow64apiset-wow64disablewow64fsredirection
https://docs.microsoft.com/en-us/windows/win32/winprog64/accessing-an-alternate-registry-view

Greetings,
Martijn

Op 4-6-2021 om 19:46 schreef Rod S:
--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.

Bill Stewart

unread,
Jun 4, 2021, 4:02:19 PM6/4/21
to innosetup
On Friday, June 4, 2021 at 11:46:11 AM UTC-6 Rod S wrote:

OK
"copy file c:\windows\system32"
where will be the file? will it be "redirected" according your links? or will it be in the same place where copied? 
does it depend of file content? will 32 dll, 64 dll and txt file copied to different folders?

I would start by reading through the links and gaining an understanding of the registry and file system redirectors.

Once you understand how those work, then read the Inno Setup help that describes how to install in different architectures.

All is working by design.

Bill

Gavin Lambert

unread,
Jun 7, 2021, 7:32:58 PM6/7/21
to inno...@googlegroups.com
On 5/06/2021 5:46 am, Rod S wrote:
> *"copy file c:\windows\system32"*
> where will be the file? will it be "redirected" according your links? or
> will it be in the same place where copied?
> does it depend of file content? will 32 dll, 64 dll and txt file copied
> to different folders?

Another question is what you're installing and why.

A common DLL or COM component *must* be installed into the correct
directory matching its own architecture (so you need to know whether the
component itself was compiled as 32-bit or 64-bit).

Having said that, in this day and age installing anything at all into
{sys} is considered poor practice, as there's almost always a better way
to do it that avoids the potential conflicts that can arise. So that's
another thing to think about.

So: what are you trying to install and why?
Reply all
Reply to author
Forward
0 new messages