Re: Deployment under Vista

Usually, top posting is appreciated in technical groups because one does not
need to scroll down to see the reply. But when replying to a reply that was
bottom posted (or vice versa), the appropriate courtesy is to "go with the
flow" as to not be confusing.

"Sally" <me@xxxxxxxx> wrote in message news:46ab94f6@xxxxxxxxxxxxxxxxxxxx
Thanks. That's made CDSIL clearer to me. BTW, your top post actually
confused me! Was it your way of teaching me that it's best not to?

"Randy Birch" <rgb_removethis@xxxxxxxx> wrote in message
Under the user security model of Vista, applications can not write to
folders outside the folders assigned to the user's profile. This is a
combination of a special path designated by Windows and the current
on user's name. For example, my app-friendly folder is rooted at
c:\users\birchr\application data\<program name>.

Now, note I use drive C for my Windows drive, as do a good number of
but not all. So while in my case it would be safe to presume the initial
path is c:\users\, this is not always the case so must be determined on
per-machine basis. Similarly the user's name must also be determined in

Thankfully Windows provides a mechanism - which I warn will look
complicated to a newbie - to determine these types of things.
the roots used to be called namespaces in Windows parlance; we (users
especially developers) typically call them "special folders". In Windows
through XP, each special is represented by and accessed using a special
constant and a Windows API or two, and these constants are prefaced with
letters CSIDL, which stands for "constant special item ID list". Under
Vista the name was changed (somewhat gratuitously I might add) to become
"known folders" - I guess "special folders" was too technical for users.
Consequently, under Vista CSIDLs were changed into KNOWNFOLDERIDs,
a CSIDL is backwards compatible. IOW, your app can call CSIDL values and
the expected results under Vista, which is a Good Thing since I've not
updated my site with the KNOWNFOLDERID constants.

Anyhow, once you get your head around this you have to realize that
are two types of "special" (or "known") folders - those that return disk
paths (such as CSIDL_MYDOCUMENTS), and those that return non-physical
locations that can not be accessed by simply using standard path/file
(such as CSIDL_BITBUCKET - aka the recycle bin).

So ... this is a long introduction to the point: Under Vista it is your
app's responsibility to only create working files in the folder(s)
to the user and marked as accessible for read/write by applications. The
Program Files, while it can be used as an installation path by someone
admin rights (under Vista), is off-limits for the day-to-day record
a file might do. So is the Windows folder, which was traditionally
by Microsoft as *the* place for saving INI files (application settings
files - ini standing for initialization).

In order to ascertain the correct path to write to under any Windows
version, and especially Vista, you have to use** the Windows API to
the correct paths - a demo of this is presented at (Check out the parent
too for some other cool things that CSIDLs can be used for. And for
that just get's the name of the currently logged on user - not needed
the above since the user name is included in the data returned, but
useful nonetheless, see

** Qualification: you don't *have to* -- one could potentially consent
level of flagellation that would astound even Silas, by blurting out
another possibility might be considering the use of the shell object to
this info. But I am not one to enjoy suffering, especially given the
of adverse, severe (and possibly fatal but definitely deserved) ridicule
abuse that would come forth from the more knowledgeable participants of
group for making such a sacrilegious suggestion. So please note that I
not advocated nor supported that you undertake this self-destructive


Randy Birch
MS MVP, Visual Basic

Please respond to the newsgroups so all can benefit.

"Sally" <me@xxxxxxxx> wrote in message
Firstly, many thanks to those who replied in previous threads in an
to guide this idiot along.

Unfortunately the sheer volume of information and some of the
differing opinions made me even more confused. People who have pointed
what to them are obvious things understandably get annoyed when I appear
to have noted them, but in some cases their assertions have been
with by others. Added to that is my habit of replying on the fly, when
are more posts to come. Also, I haven't figured out a way of going back
through a thread, so once I've replied to the last post I lose the
(literally). I am using CTRL-U to advance through unread messages and my
Outlook (NOT Outlook Express) apparently does not easily allow me step

As for VB, I've learned a few things, I hope, and I'll summarise here
how far I've got and see if there's a way forward that's uncomplicated.

Let's call my app Fred.exe and it uses say two random access files,
Ledger.Dat and Transact.Dat. (not difficult to fathom out what the app

Anyway, this app works perfectly under XP Home. I have used the PDW
to deploy it, and the result is

1) The Install suggests that the app is placed in C:\Programs. I accept

2) As for the data files, I have hardcoded within my app to create a
directory C:\FredsData, and then lines like this

Open "C:\FredsData\Ledger.Dat" For Random As #1 Len=255

As I said, it all works under XP Home.

Now, a colleague is running Vista and I want to post him a CD so that he
install my app and use it. BUT, I don't want to risk messing up his
which runs many critical applications. It is not so serious if he has
trouble running mine. But it would certainly be serious if in attempting
install mine some files or settings on his Vista were messed up. That

So far, I think I have gleaned that

A) Any files apart from my app that PDW bundles on the deployment disc
not overwrite any of his that might be later (that cures one worry... IF
I've got that right.

B) The app should not go in root (meaning C: direct). In that respect
perhaps Vista makes a similarly appropriate default suggestion to the
Programs directory in XP Home?

C) The data files should not go in root. In that respect, perhaps my
hardcoded C:\FredsData\... will do the trick?

A, B and C really encapsulate my concerns.

If anyone has the time and patience to reply in as uncomplicated way as
possible, I would be grateful. For those who are fed up with this stupid
bird please do not reply! I guess if no-one replies the message is
and maybe I'll go back to my crochet (sniff)... no knitting here.
that challenge will encourage the experts who have difficulty coming
a newbie's level not to reply. At times I felt like a 6 year old trying
understand how subtraction works being given the formula for the
frequency of an LC combination by a learned professor who knows all
electronics and nothing about 6 year olds.


Relevant Pages

  • Re: upgrade c: from pata to sata with vista ultimate 64bit upgrade dis
    ... "How to Clean Install Windows Vista with Upgrade Media ... When I began inquiring into various Windows Vista installation options late last year, Microsoft and its representative grew quiet and seemed to begin selectively answering my questions. ...
  • clubbing of windows vista and windows server2008 in a single boota
    ... i want to club the windows vista and windows server 2008 in a single bootable ... Vista DVD? ... can you build a custom Vista install DVD that doesn’t ... John Pritchard how it all works and got some surprising answers. ...
  • Re: Format again
    ... specs to see if it can handle Vista. ... and I want to reformat my hard disk and re-install Windows XP ... and update it with a Vista upgrade which my good lady brought ... Instead of performing a clean install of XP, ...
  • Re: I cant install critical updates
    ... I resolved error message problem from Vista Security Center by uninstalling and reinstalling Antivir. ... How it comes I can't either manage to install manually failing updates? ... Be sure to obtain the correct version for Windows x86. ... Windows Update Agent File Versions: ...
  • Re: HID Non-User Input Data Filter Error
    ... A...hardware device does not function correctly after you install Windows ... How to uninstall Windows Vista SP1 as a troubleshooting step: ... Windows Vista Help: Learn how to install Windows Vista Service Pack 1: ... It sounds like a driver update has occured which messed up the USB ...