Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8633845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:34:04+00:00 2026-06-12T09:34:04+00:00

I have a Delphi 6 application that, like most Windows applications, reads/writes data to

  • 0

I have a Delphi 6 application that, like most Windows applications, reads/writes data to the user’s “local application data” folder. I use the code below to determine that folder. Up until now, that code worked for most of my users. I have encountered a user whose local application data is not in the expected folder:

C:\Users\Bob\AppData\Roaming\

Usually the local app data folder resolves to:

C:\Documents and Settings\Bob\Application Data\

What is odd about this user’s particular situation is that several registry keys normally found in HKEY_LOCAL_MACHINE are actually located in HKEY_CURRENT_USER. They are running on Windows 7.

For lack of a better word, is there a way to get the “true” application data for a user so I can navigate this situation better? If it’s a matter of intelligently choosing between the CSIDL_APPDATA, CSIDL_COMMON_APPDATA and CSIDL_LOCAL_APPDATA special folders, what is the logic for doing so? As you can tell I’m looking for an all-purpose function that can root out the correct application data folder regardless of the version of Windows the user is running or their specific PC configuration.

I found this Stack Overflow post that seems to have the answer but it is using function from the .NET library and I am using Delphi 6. If this solution answers my question, can someone tell me a quick way to replicate it in Delphi:

How can i get the path of the current user's "Application Data" folder?

// Function to get the app data special folder.
function GetAppdataFolder: string;
begin
   Result := GetSpecialFolderLocation(CSIDL_APPDATA);
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:34:05+00:00Added an answer on June 12, 2026 at 9:34 am

    The .net code you link to uses Environment.SpecialFolder.ApplicationData which is exactly the same as CSIDL_APPDATA. So your code is already equivalent to the .net code to which you link. And these both refer to the same location as FOLDERID_RoamingAppData.

    Take a look at the documentation for FOLDERID_RoamingAppData. It says:

    Default Path        %APPDATA% (%USERPROFILE%\AppData\Roaming)
    Legacy Default Path %APPDATA% (%USERPROFILE%\Application Data) 
    

    The “Default Path” is what you will see on Vista or later. The “Legacy Path” is what you see on XP.

    The different behaviour that you have observed is nothing more than the expected difference between XP and Vista/7/8.

    On my Windows machine,

    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
    

    evaluates to

    C:\Users\heff\AppData\Roaming
    

    In other words, your code is already doing the right thing. You do not need to make any changes to it at all. Carry on using GetSpecialFolderLocation(CSIDL_APPDATA).


    What is odd about this user’s particular situation is that several registry keys normally found in HKEY_LOCAL_MACHINE are actually located in HKEY_CURRENT_USER.

    That’s not uncommon. Quite often applications configure default settings in HKLM and then copy them to HKCU when the application is first run. Without knowing more details of the settings in question it’s hard to comment on that aspect of your question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Delphi application that reads/writes to a COM port connected to a
We have a Windows desktop application written in Delphi that works fine on Windows
I have an Oracle 9 database from which my Delphi 2006 application reads data
I have Windows Server 2008 R2 Machine that is running a Delphi 2007 application.
I have a Delphi application that has a document browser as the main form.
I have a Delphi 6 application that uses the Indy 9 components to maintain
I have a Delphi 2009 application that runs a query over a database using
I have a process that currently runs in a Delphi application that I wrote
I have an application that called several other .exe components written in delphi. The
I have written a console application in Delphi that queries information from several locations.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.