PDA

View Full Version : A note on Vista and data locations...



NewsArchive
08-30-2007, 01:27 PM
Hi Folks,

First off, let me say that I can fully appreciate Arnor's frustration about
Vista. I've said some VERY bad things about it and the weanies at
Microsoft this past week!

;-)

I've been dealing with the issue of "where's my data" for PageSnip and
having survived it (all is working well now - thanks to a lot of help from
Friedrich!) I wanted to pass on what I came up with.

First off, my installer runs with elevated permissions as you'd expect.

Data is installed (by default) under Program Files.

A program Registry key is created under HKLM and the path to where the app
is installed is stored there in a value called ProgramDir.


Now that is fine - I now know where the app is installed and this key is
available "read only" by any user at any level.


Next is the placement of the data.

FWIW - I don't have demo data, but if I did, I think that I would lean
towards installing it into a read only folder under the program dir (and
copying it to a user's profile when they start the app) or by putting it
into the COMMON data folder and grabbing a copy from there.


The way I solved my "where's the data" problem was to turn once again to
SetupBuilder.

I created a new script that is actually a "pre-loader" for PageSnip. This
app (which compiled down to a exe < 140K) actually gets installed into the
HKLM RUN Registry.

This way this tiny executable gets ran when any user logs in - no matter
what their level of access.

In the beginning the SB script reads the entry from HKLM to know where the
program is installed. Then it checks to see that the program.exe is
actually there. If it is not, then it gives a simple message about that
and exits the script.

If the program.exe is there, then it uses SB to get the user's LOGIN NAME.

Then it reads the PageSnip key from HKCU to see if it has a value called
DataDir. If it does not, then it runs a simple three step "PageSnip User
Wizard" to establish the data paths.


Now to keep it simple (thank you David<g>), the wizard asks a question:

Step 1 - Decide if you want to share your data

Then there is a drop box that defaults to:

"Keep my PageSnip data private"

The other drop entry says:

"Share my PageSnip data with other users on this computer"


There is also a brief message on the dialog box that tells them that based
on their selection, the wizard will suggest a data location for them.

They click Next to continue.


This Step 2 of the wizard lets them select a location for the data files.

By default (and using the CSIDL values relative to that LOGIN NAME) the
suggested locations are either like:

C:\Documents and Settings\Charles\My Documents\My PageSnips

or

C:\Documents and Settings\All Users\Documents\Shared PageSnips


(Note that the CSIDL for the LOGIN NAME is correct for that user)



So by default the user can just click Next and the data goes into a sub
folder of their My Documents.

If they want to change it - they can put it anywhere EXCEPT under Program
Files. If they try that - the wizard refuses to accept it (after all -
with Vista there is no point in allowing them to shoot themselves in the
foot<g>). Also the wizard makes sure that there is a value.

Next I have one other dialog box where I allow them to enter a piece of
optional information.


Next I then show them a custom ready to install dialog that shows where the
data is going and (in my case) the Windows login name and the name of their
PageSnip profile.

When they click Next I create my folders (using CSIDL values) and write my
HKCU entries for that user.


Then I launch PageSnip and it reads the HKCU values, knows where the data
goes ... and life is good.



Now - the user reboots and logs in again at some later time.


The same small "preloader" exe runs from HKLM.

It checks the HKCU of the user, gets the DataDir value (and the ProgramDir
too).

It also checks a entry in the HKCU key to see if it should Run PageSnip on
startup (note that this is enabled by default and the user would have to
turn it off in the app).

If it is supposed to run the program, it does - then the script exist
without displaying the wizard.


Again since this is a less than 140K exe in the startup and it does not
stay in memory - no harm, no foul.


As an aside, I also added some command line flags that allow me to call the
small exe from within the app to reset the data locations. This means I
don't have to write extra screens in the app for this and the "PageSnip
User Wizard" is exactly the same as the user remembered it the first time.


Note that I could have just as easily completed my wizard by copying sample
data to the correct folder (based on the user selection).


Having the small exe that runs as a preloader with the login means that my
app is never "lost". Even when a new user login is added to the machine,
the "PageSnip User Wizard" would automatically run to complete the setup
for that user.


This may not be the perfect solution, but I can tell you that I put a LOT
of thought and work into **HOW** to solve these problems and this is what I
came up with.


Friedrich is right in that we have to stop thinking about pre-Vista and
just set our sights on providing installs and initializations that work
under Vista.

Meanwhile - I hope that this gives some of you ideas on how to deal with
this under Vista.

IMHO - it is more than just putting the data in the Common Documents CSIDL
- you have to consider and use the HKCU Registry as it was planned to be
used.


To everyone here:

"Good luck on your Vista projects!"


To Microsoft:

"Pull my finger!"


;-)

Charles





--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
08-30-2007, 01:30 PM
Charles,

Sounds like a good subject for a ClarionMag article. I'll tell Dave you are
working on it <g>

--
Russell B. Eggen
www.radfusion.com
Skype IRC: http://tinyurl.com/2mqr2j

NewsArchive
08-30-2007, 01:32 PM
> Sounds like a good subject for a ClarionMag article. I'll tell Dave you are
> working on it <g>

That might be a good idea - as soon as I get PageSnip out the door.

Until then I am using 20 of the 24 hours in a day (and looking hard at the
other four<g>)


Did I mention I HATE releasing new software???


;-)

Charles


--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
08-30-2007, 01:33 PM
> The way I solved my "where's the data" problem was to turn once again to
> SetupBuilder.
>
> I created a new script that is actually a "pre-loader" for PageSnip. This
> app (which compiled down to a exe < 140K) actually gets installed into the
> HKLM RUN Registry.

A couple of things I forgot to mention:

1) The tiny exe is set to run "AsInvolker"

2) Both the installer and the tiny exe are code signed, manifested, etc
with SetupBuilder.

HTH,

Charles



--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
08-30-2007, 02:39 PM
>> Sounds like a good subject for a ClarionMag article. I'll tell Dave you are
>> working on it <g>
>
> That might be a good idea - as soon as I get PageSnip out the door.
>
> Until then I am using 20 of the 24 hours in a day (and looking hard at the
> other four<g>)
>

A quote from Charles Edmonds of LANSRAD slightly before his PageSnip
release!

> Did I mention I HATE releasing new software???

30 days after PageSnip release -

Quoted from local bank manager concerning LANSRAD account:

"Well, Charles, when an account grows this large in a small period of time,
we recommend these additional steps for your company to take from our
commercial accounts financial advice division..."

> Did I mention I LOVE releasing new software???

:-D

David


--
From David Troxell - Product Scope 32 PRO - Encourager Software
Clarion Third Party Profile Exchange Online
http://encouragersoftware.com/profile/clarlinks.html
http://www.encouragersoftware.com/
http://www.profileexchanges.com/blog/

NewsArchive
08-30-2007, 02:40 PM
Hi Charles,

>FWIW - I don't have demo data, but if I did, I think that I would lean
>towards installing it into a read only folder under the program dir (and
>copying it to a user's profile when they start the app) or by putting it
>into the COMMON data folder and grabbing a copy from there.

I'm leaning towards that myself. There is a method in the Utilities
that I can call to create a folders to any level, such as:

F = '\Icetips Creative\Demo\Previwer\Data'
S = ITU.GetSpecialFolder(IT_CSIDL_LOCAL_APPDATA)
ITU.CreateDirectories(F,S)

and then I can do:

D = ITU.GetSpecialFolder(IT_CSIDL_COMMON_APPDATA)
ITU.CopyFiles(S & F, D & F)

in my program then update a HKCU key to indicate that the files have
been copied for this user and then I just need to check and if it's
not set to True, I copy the files and set the data path to that path.

I think I could perhaps write a small method to take care of this;)

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
08-31-2007, 02:10 AM
>> Did I mention I LOVE releasing new software???

Nope - I stand by my guns on this one.

I may love it when we get new software out the door and it does well<g>,
but getting it there is somewhat akin to self dentistry.

;-)

Charles


--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
08-31-2007, 02:12 AM
>>FWIW - I don't have demo data, but if I did, I think that I would lean
>>towards installing it into a read only folder under the program dir (and
>>copying it to a user's profile when they start the app) or by putting it
>>into the COMMON data folder and grabbing a copy from there.
>
> I'm leaning towards that myself. There is a method in the Utilities
> that I can call to create a folders to any level
<snip>
> in my program then update a HKCU key to indicate that the files have
> been copied for this user and then I just need to check and if it's
> not set to True, I copy the files and set the data path to that path.
>
> I think I could perhaps write a small method to take care of this;)

Great idea!

Tonight would be fine and I'll try it out for you<g>.

;-)


Like Jane, I think a lot of problems that are happening world wide with
software stem from YEARS of us saying:

"Bug off Microsoft! (or something worse<g>) - we'll put our data where we
want it and set permissions the way we want to!"


Unfortunately now (with Vista) Microsoft is telling us:

"I know this is going to hurt like hell - but it is for your own good..."


Of course to all the developers who had figured out the cool little tricks
to work around M$ security and trick the OS into playing along they are
standing there with a wicked little grin as they yank the scab off and say:

"There - that didn't hurt now did it?"


;-)

Charles




--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
08-31-2007, 02:13 AM
>Next is the placement of the data.
>
>FWIW - I don't have demo data, but if I did, I think that I would lean
>towards installing it into a read only folder under the program dir (and
>copying it to a user's profile when they start the app) or by putting it
>into the COMMON data folder and grabbing a copy from there.

That's what I do with my sample files. On first run the application
copies the sample files to the users documents folder and then sets
the program folder to read only.

Steve

--
Steve Wolstenholme Neural Planner Software Ltd

EasyNN-plus. The easy way to build neural networks.

http://www.easynn.com

NewsArchive
08-31-2007, 03:36 AM
>>> Did I mention I LOVE releasing new software???
>
> Nope - I stand by my guns on this one.
>
> I may love it when we get new software out the door and it does well<g>,
> but getting it there is somewhat akin to self dentistry.

Charles,

Believe me, I FEEL your pain!

Just trying to let some sunshine through the darks clouds of imminent
release, but still not there after months of arduous labor. It WILL be
worth it!

David


--
From David Troxell - Product Scope 32 PRO - Encourager Software
Clarion Third Party Profile Exchange Online
http://encouragersoftware.com/profile/clarlinks.html
http://www.encouragersoftware.com/
http://www.profileexchanges.com/blog/

NewsArchive
09-02-2007, 03:38 AM
Hi Charles,

>FWIW - I don't have demo data, but if I did, I think that I would lean
>towards installing it into a read only folder under the program dir (and
>copying it to a user's profile when they start the app) or by putting it
>into the COMMON data folder and grabbing a copy from there.

With my new SetupBuilder class addition to the Icetips Utilties I
think I can put this one to rest:)

Basically you will install your data into a common folder. With a
single method call in your application, before any data is loaded, you
copy the data from the common folder to a local folder. Example:

Data embed:

ITS ITSetupBuilderClass

Code embed:

ITS.FinishInstall('Icetips Creative\Previewer\Demo\Data',|
IT_CSIDL_APPDATA,|
IT_CSIDL_COMMON_APPDATA)

This will look for the data in a subfolder from CSIDL_COMMON_DATA (3rd
parameter) using the partial folder structure in the first parameter -
which is the folder that your install puts the data. It then creates
that folder structure under the CSIDL_APPDATA (2nd parameter) and
copies the files (using SHFolderOperation).

When done it creates a registry key using HKCU\SOFTWARE\ and the
partial folder structure, so in this case the key would be:

HKCU\SOFTWARE\Icetips Creative\Previewer\Demo\Data

and adds a single value there called FilesCopied and puts a 1 into it.
The first thing that this method does is check that value and if it is
0 or '' the files are copied. If it's 1, it returns immediately, i.e.
doesn't do anything.

Currently it only deals with a single folder. You could call it
multiple times if you wanted, but I'll try to add multi-folder copying
before Beta 3 goes out.

This will make it much easier to deal with this situation:)

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
09-02-2007, 03:39 AM
>>FWIW - I don't have demo data, but if I did, I think that I would lean
>>towards installing it into a read only folder under the program dir (and
>>copying it to a user's profile when they start the app) or by putting it
>>into the COMMON data folder and grabbing a copy from there.
>
> With my new SetupBuilder class addition to the Icetips Utilties I
> think I can put this one to rest:)

<snip>

That's going to be a nice solution Arnor and certainly a timesaver!

Another reason to be a Clarion programmer and to use your Icetips
Utilities<g>

Sorry about the rest of you folks!

;-)

Charles


--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
09-03-2007, 02:53 AM
Hi Arnór,

> With my new SetupBuilder class addition to the Icetips Utilties I
> think I can put this one to rest:)

VERY COOL!

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6.5
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
09-03-2007, 02:54 AM
Hi Friedrich,

>> With my new SetupBuilder class addition to the Icetips Utilties I
>> think I can put this one to rest:)
>
>VERY COOL!

Thanks:) It now copies the entire folder structure (i.e. subfolders,
empty or not empty and all files) from the source to the destination
and compiles SB projects;)

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
09-04-2007, 01:53 AM
Greetings -

Kind of makes me feel warm and fuzzy about that GOLD subscription I signed
up for.

Regards,
Roberto Artigas

NewsArchive
09-04-2007, 01:54 AM
Hi Roberto,

>Kind of makes me feel warm and fuzzy about that GOLD subscription I signed
>up for.

Thanks:)

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php