Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ProgramFiles folder for Win7

715 views
Skip to first unread message

P E Schoen

unread,
Nov 9, 2010, 3:26:21 PM11/9/10
to
I have an application which was originally developed using Borland Delphi 4
Pro and tested for XP. I rewrote it so that it works on Vista, but now many
customers will be using Win7 (and I now have a Win7 Home Premium 64 bit
machine). I see that there is a new environment variable for 32 bit x86
program files and I want to make sure the program gets installed properly.
In my code I have the following:

CSIDL_COMMON_APPDATA = $0023; { All Users\Application Data }
CSIDL_SYSTEM = $0025; { Windows\System32 }
CSIDL_COMMON_DOCUMENTS = $002E; { All Users\Documents }
CSIDL_PROGRAM_FILES = $0026;

ProgramFolder := GetSystemFolder(CSIDL_PROGRAM_FILES);

I am using Inno Setup which has a constant which points to the ProgramFiles
folder for the installation. I have not yet tried to install my program on
my system but one of my customers has done so with questionable success. I
can test for the OS and use the 32 bit program files folder if Win7 is
detected. I already do this (which was needed for the BDE) as follows:

procedure TfmReclData.FormCreate(Sender: TObject);
const WIN2000 = 5.0;
WINXP = 5.1;
WINVISTA = 6.0;
WIN7 = 6.1;
var VersionInfo: OSVERSIONINFO;
Version: Real;
begin
VersionInfo.dwOSVersionInfoSize := sizeof (OSVERSIONINFO);
getVersionEx( VersionInfo );
Version := VersionInfo.dwMajorVersion + VersionInfo.dwMinorVersion/10;
if (Version >= WINVISTA) and (Session <> nil) then
Session.NetFileDir := ProgramDataFolder;
if Session <> nil then begin
fmDebug.AddDebugItem( 'FormCreate: OS Version: ' + Format( '%3.1f',
[Version] );
fmDebug.AddDebugItem( 'FormCreate: NetFileDir: ' +
Session.NetFileDir ); end;

Does anyone know of any issues that I need to be concerned about for Win7?
There is a new environment variable for 32 bit programs which is
CSIDL_PROGRAM_FILESx86, but of course it is not defined in D4.

Also, I wonder if the 32 bit version of Win7 has the ProgramFiles(x86)
folder or the usual ProgramFiles?

I have also posted this on the Microsoft Tech Forum but no response so far).

Thanks!

Jamie

unread,
Nov 9, 2010, 4:23:34 PM11/9/10
to
32 bit code gets installed so that the 32 bit interface see it's properly.
I don't think you even need to test for the OS version.

The new environment variable i am sure is only for 64 bit code to
find the 32 bit folder location.. If you are to use this in your 32 bit
code,
you must treat this as possible failure of existence.. You could thus
test to see if it exist and if so, get the actual folder the 64 bit OS
is using..

You must remember that WIn7 has the WOW directory or something like
that for the win32 code.. I believe that is where this new environment
variable will start pointing too.!

But then again, I could be wrong, won't be the first time,..


P.S.
Win 7 , unless you have the PRO version(xp mode), will not install
apps that use a 16 bit installer or has any 16 bit code somewhere in
files... This most likely also means DOS thingys..


P E Schoen

unread,
Nov 10, 2010, 3:44:24 PM11/10/10
to

"Jamie" <jamie_ka1lpa_not_v...@charter.net> wrote in message
news:ZNiCo.7807$8m....@newsfe09.iad...

> 32 bit code gets installed so that the 32 bit interface see it's properly.
> I don't think you even need to test for the OS version.
>
> The new environment variable i am sure is only for 64 bit code to find
> the 32 bit folder location.. If you are to use this in your 32 bit code,
> you must treat this as possible failure of existence.. You could thus
> test to see if it exist and if so, get the actual folder the 64 bit OS
> is using..
>
> You must remember that WIn7 has the WOW directory or something like that
> for the win32 code.. I believe that is where this new environment
> variable will start pointing too.!
>
>
>
> But then again, I could be wrong, won't be the first time,..
>
>
> P.S.
> Win 7 , unless you have the PRO version(xp mode), will not install apps
> that use a 16 bit installer or has any 16 bit code somewhere in
> files... This most likely also means DOS thingys..

Thanks for the ideas. I'll post again when I know more. This post is partly
to test my new "Windows Live Mail" newsreader which came with my new Win7
machine. It was not copying news posts to the Sent Items folder (and it also
will not show fixed width fonts for news). I know, get a better newsreader.
But it's convenient to use just the one program!

Paul

alang...@aol.com

unread,
Nov 11, 2010, 7:33:49 AM11/11/10
to

My CSIDL_ list is as follows :

{highest is CSIDL_CONNECTIONS = $0031}
CSIDL_ADMINTOOLS = $0030; // <user name>\Start Menu
\Programs\Administrative Tools
CSIDL_ALTSTARTUP = $001d; // non localized startup
CSIDL_APPDATA = $001a; // <user name>\Application
Data
CSIDL_BITBUCKET = $000a; // <desktop>\Recycle Bin
CSIDL_CD_BURN_AREA = $003b; // staging area for files
for CD
CSIDL_COMMON_ADMINTOOLS = $002f; // All Users\Start Menu
\Programs\Administrative Tools
CSIDL_COMMON_ALTSTARTUP = $001e; // non localized common
startup
CSIDL_COMMON_APPDATA = $0023; // All Users\Application
Data
CSIDL_COMMON_DESKTOPDIRECTORY = $0019; // All Users\Desktop
CSIDL_COMMON_DOCUMENTS = $002e; // All Users\Documents
CSIDL_COMMON_FAVORITES = $001f; // NT only
CSIDL_COMMON_MUSIC = $0035; // All Users\Documents\My
Music
CSIDL_COMMON_PICTURES = $0036; // All Users\Documents\My
Pictures
CSIDL_COMMON_PROFILES = $003e; // C:\Documents and Settings
CSIDL_COMMON_VIDEO = $0037; // All Users\Documents\My
Videos
CSIDL_COMMON_PROGRAMS = $0017; // All Users\Programs
CSIDL_COMMON_STARTMENU = $0016; // All Users\Start Menu
CSIDL_COMMON_STARTUP = $0018; // All Users\Startup
CSIDL_COMMON_TEMPLATES = $002d; // All Users\Templates
CSIDL_CONNECTIONS = $0031; // Network and Dial-
up;Connections
CSIDL_CONTROLS = $0003; // My Computer\Control Panel
CSIDL_COOKIES = $0021;
CSIDL_DESKTOP = $0000; //;<desktop>
CSIDL_DESKTOPDIRECTORY = $0010; // <user name>\Desktop
CSIDL_DRIVES = $0011; // My Computer
CSIDL_FAVORITES = $0006; // <user name>\Favorites
CSIDL_FONTS = $0014; //;windows\fonts
CSIDL_HISTORY = $0022;
CSIDL_INTERNET = $0001; // Internet Explorer (icon
on desktop)
CSIDL_INTERNET_CACHE = $0020;
CSIDL_LOCAL_APPDATA = $001c; // <user name>\Local Settings
\Application Data (non roaming)
CSIDL_MYDOCUMENTS = $000c; // logical "My Documents"
desktop icon
CSIDL_MYMUSIC = $000d; // "My Music" folder
CSIDL_MYPICTURES = $0027; // C:\Program Files\My
Pictures
CSIDL_MYVIDEO = $000e; // "My Videos" folder
CSIDL_NETHOOD = $0013; // <user name>\nethood
CSIDL_NETWORK = $0012; // Network Neighborhood
CSIDL_PERSONAL = $0005; // My;Documents
CSIDL_PRINTERS = $0004; // My;Computer\Printers
CSIDL_PRINTHOOD = $001b; // <user name>\PrintHood
CSIDL_PROFILE = $0028; // C:\Documents and Settings
\<username>
CSIDL_PROFILES = $002e; // C:\Documents and Settings
CSIDL_PROGRAM_FILES = $0026; // C:\Program Files
CSIDL_PROGRAM_FILES_COMMON = $002b; // C:\Program Files\Common
CSIDL_PROGRAM_FILES_COMMONX86 = $002c; // x86 Program Files\Common
on RISC
CSIDL_PROGRAM_FILESX86 = $002a; // x86 C:\Program Files on
RISC
CSIDL_PROGRAMS = $0002; // Start Menu\Programs
CSIDL_RECENT = $0008; // <user name>\Recent
CSIDL_SENDTO = $0009; // <user name>\SendTo
CSIDL_STARTMENU = $000b; // <user name>\Start Menu
CSIDL_STARTUP = $0007; // Start Menu\Programs
\Startup
CSIDL_SYSTEM = $0025; // GetSystemDirectory()
CSIDL_SYSTEMX86 = $0029; // x86 system directory on
RISC
CSIDL_TEMPLATES = $0015;
CSIDL_WINDOWS = $0024; // GetWindowsDirectory()

CSIDL_FLAG_CREATE = $8000; // combine with CSIDL_ value
to force folder creation in SHGetFolderPath()
CSIDL_FLAG_DONT_VERIFY = $4000; // combine with CSIDL_ value
to return an unverified folder path
CSIDL_FLAG_NO_ALIAS = $1000; // combine with CSIDL_ value
to insure non-alias versions of the pidl
CSIDL_FLAG_MASK = $FF00; // mask for all possible
flag values

GetVersions Platform, Major, Minor & Build are variables supplied in
Delphi's SysUtils.pas as Win32Platform, Win32MajorVersion,
Win32MinorVersion & Win32Build, so you don't need to GetVersion
yourself.

Constants for the various OSs are :

+------------+----------+-------+-------+
| Version | Platform | Major | Minor |
+------------+----------+-------+-------+
| Win95 | 1 | 4 | 0 |
| Win98 | 1 | 4 | 10 |
| WinME | 1 | 4 | 90 |
| WinNT4 | 2 | 4 | 0 |
| Win2000 | 2 | 5 | 0 |
| WinXP | 2 | 5 | 1 |
| Win2003 | 2 | 5 | 2 |
| WinXPx64 | 2 | 5 | 2 |
| Vista | 2 | 6 | 0 |
| Win2008 | 2 | 6 | 0 |
| Win2008R2 | 2 | 6 | 1 |
| Win7 | 2 | 6 | 1 |
+------------+------------+-------+-----+
Delphi Constants for Platform in SysUtils.pas
VER_PLATFORM_WIN32_Windows = 1
VER_PLATFORM_WIN32_NT = 2

Alan Lloyd

Robert Wolfe

unread,
May 17, 2012, 11:49:26 AM5/17/12
to
> Does anyone know of any issues that I need to be concerned about for Win7?
> There is a new environment variable for 32 bit programs which is
> CSIDL_PROGRAM_FILESx86, but of course it is not defined in D4.

> Also, I wonder if the 32 bit version of Win7 has the ProgramFiles(x86)
> folder or the usual ProgramFiles?

The (x86) program files directory shows up only in the 64-bit versions of Windows Vista, 2008 Server and 7.


Dietmar Braun

unread,
May 17, 2012, 11:01:15 AM5/17/12
to
In Artikel <MSGID_1=3a261=2f20_3...@fidonet.org>, Robert Wolfe
(Robert...@fpsoft.net) schrub:
> The (x86) program files directory shows up only in the 64-bit versions
of Windows Vista, 2008 Server and 7.

Usually, on these platforms, 32-bit software installs in "x86", e.g. "C:
\Program Files (x86)\", and the 64-bit versions install in e.g. "C:
\Program Files\" (without the "x86"!)

Dietmar

Jamie

unread,
May 17, 2012, 5:45:37 PM5/17/12
to
The best thing to do is to use the "ShGetspecialFolderLocation" with
in your 32 bit programs, it should return the actual name of the 32 bit
programs folder for you. And if you're on a 64 bit Os, you should get
the (x86) name in there some where.

I do think the CDIDL_PROGRAM_FILESx86 flag was more intended for 64 bit
programs to find out where the 32 bit programs folder is. Since older
existing 32 bit programs do not know anything about this flag, it's
logical to assume that using the shxxxxxx method to get the name will
continue to work.

Jamie


0 new messages