🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
4 messages
4 total messages Started by CapStick Sun, 11 May 2003 09:47
CreateDirectory
#16496
Author: CapStick
Date: Sun, 11 May 2003 09:47
25 lines
1645 bytes
I have reached the stage in My Application
where i need to create a directory
to hold users data.
Is there a set format for how this should be done
in relation to my .EXE

for example should i create a directory at root as say C:/mynewdirectory

or should my directory be created as say
C:/Myapp/mynew directory

I would also Like To Password Protect this Directory
and some or all of its contained files.

Also one more thing theres the question of running my app on different
Versions Platforms Etc..
Any Pointers Would be Appreciated
Big Thanks In advance.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.471 / Virus Database: 269 - Release Date: 10/04/2003
Re: CreateDirectory
#16500
Author: user
Date: Sun, 11 May 2003 14:50
45 lines
3038 bytes
CapStick wrote:
> I have reached the stage in My Application
> where i need to create a directory
> to hold users data.
> Is there a set format for how this should be done
> in relation to my .EXE
> 
> for example should i create a directory at root as say C:/mynewdirectory
> 
> or should my directory be created as say
> C:/Myapp/mynew directory
> 
> I would also Like To Password Protect this Directory
> and some or all of its contained files.
> 
> Also one more thing theres the question of running my app on different
> Versions Platforms Etc..
> Any Pointers Would be Appreciated
> Big Thanks In advance.
> 
A lot depends on how many versions and platforms you need to support. If 
you can limit it to Windows since NT4/95, those operating systems define 
system directories especially for this purpose.

You call SHGetFolderPath to get system folder locations at run time. For 
your purposes, the CSIDLs of interest are CSIDL_APPDATA, to get a folder 
specific to the current user, or CSIDL_COMMON_APPDATA, to get a folder 
that is shared by all users. (These folders are usually C:\Documents and 
Settings\username\Application Data and C:\Documents and Settings\All 
Users\Application Data, but you shouldn't assume they will be on every 
computer.)

For data that is private to each user, you'd get the CSIDL_APPDATA 
folder, probably create a subfolder for your application in it, and put 
the data files in there. If you have any data files that should be 
shared among all users, you can put them in a folder in the 
CSIDL_COMMON_APPDATA directory.

If you use these folders, you don't really have to take any further 
security measures. The common folder is of course accessible by anyone, 
but if the system is set up for multi-user use or if is on a network, 
the user folder should be secured by the operating system. Since the 
folders will only be accessible by the logged on user, your files will 
be safe, too. (And if the user has chosen to run an unsecured system, 
that's their business, isn't it?)
Re: CreateDirectory
#16505
Author: Remy Lebeau (TeamB)
Date: Sun, 11 May 2003 21:26
32 lines
2212 bytes
"CapStick" <lol@ljones81.fsnet.co.uk> wrote in message
news:3ebe1bab@newsgroups.borland.com...

> Is there a set format for how this
> should be done in relation to my .EXE

Although you are technically free to put your new folder wherever you want,
Microsoft's suggests that user-related data should go in the following
folder:

    "C:\<documents>\<username>\Application Data"

Where <documents> is "My Documents" or "Documents and Settings" depending on
the OS you're running under, and <username> is the name of the user
currently logged in or "All Users" if the folder should be accessible to all
users rather than a specific one.

Have a look at the SHGetSpecialFolderLocation() and SHGetPathFromIDList()
functions.  Use the CSIDL_APPDATA or CSIDL_COMMON_APPDATA flag when calling
SHGetSpecialFolderLocation().

> I would also Like To Password Protect this Directory
> and some or all of its contained files.

The Win32 API does not support that directly.  You need to use a Shell
Namespace Extension to handle that.  You would have to either write your own
from scratch (not a simple thing to do) or else find a third-party
ready-made extension.


Gambit
Re: CreateDirectory
#16506
Author: CapStick
Date: Mon, 12 May 2003 01:17
12 lines
1325 bytes
I thought it was a bit to easy to just go ahead and create a directory.


Big thanks for the advice Lads
Much Appreciated.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.471 / Virus Database: 269 - Release Date: 10/04/2003
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads