PDA

View Full Version : Remind me - *why* a manifest for Vista?



NewsArchive
06-27-2007, 04:07 AM
The reason I ask is that adding a manifest to the Vista version of the
program appears to be causing an error in operation!

I write to the registry via the installer.... setting the DataPath reg.
key/value as appropriate.
My program, at the very start (as it initialises), now reads the value and
does a SETPATH accordingly.

This works fine on XP.... and if I copy the same exe to *Vista* also works
just fine.
But the 'correct', manifest-added exe fails to read the registry, finding no
value there!!

Since the non-manifest'd EXE seems to look ok and work ok on 'big V' <g> -
remind me, why am I supposed to install a manifest??

Steve Bywaters

NewsArchive
06-27-2007, 04:07 AM
.... if "asInvoker" is sufficient privileges... since that is the default,
is it not?

Steve Bywaters

NewsArchive
06-27-2007, 04:08 AM
Your installer should always request "requireAdministrator" privileges, your
application "asInvoker".

HTH,

--
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
06-27-2007, 04:09 AM
I'm talking about the app - IT only requires "asInvoker" - so why a
manifest?

Steve Bywaters

NewsArchive
06-27-2007, 04:10 AM
Because only the Vista manifest can request "asInvoker" privileges. Without
a manifest no "asInvoker" <g>

Friedrich

NewsArchive
06-27-2007, 04:10 AM
C55 btw... so no C6 manifest issue.

Steve Bywaters

NewsArchive
06-27-2007, 04:10 AM
It's not caused by your development environments. It's a "Vista
compatibility logic" issue ;-)

Friedrich

NewsArchive
06-27-2007, 04:10 AM
Steve,

If you do not a Vista-aware manifest, your application is a "legacy"
application. In this case, "Virtualization" can kick in (not on Vista 64)
and you cannot request an execution level privilege. Shipping your app
without a Vista-aware manifest is a no-no!

BTW, you should never write to HKCU from the installer.

HTH,

--
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
06-27-2007, 04:11 AM
>Shipping your app
> without a Vista-aware manifest is a no-no!

But adding the manifest is 'corrupting' the operation of my app - which is a
*bigger* 'no-no' in my view! <g>

Without manifest - app works and reads registry on start..
With manifest - app reads no value from the registry, and fails
startup/init!!
It's the same app: all I did was comment out the #embed line and recompile
the install!

I've seen some comments about embedding manifests causing app corruption, on
Vista n/gs...
So where to from here?


> BTW, you should never write to HKCU from the installer.
No, I write to HKLM from the installer (and the app just reads it... or is
intended to!)

Steve Bywaters

NewsArchive
06-27-2007, 04:18 AM
I am 100% sure your registry problem is NOT caused by the Vista manifest :)
A manifest only restricts write access actions, not read access. Your
application is something doing that is not allowed at startup and so
"Virtualization" kicks in. That's why your app works without the manifest.
The manifest disables Virtualization.

I have never ever seen a comment on any NG that a Vista manifest corrupts an
app. There is only a (checkbox) redrawing issue with C55 apps (C6 should
fix this).

HTH,

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
06-27-2007, 07:50 AM
> A manifest only restricts write access actions, not read access. Your
> application is something doing that is not allowed at startup and so
> "Virtualization" kicks in. That's why your app works without the
> manifest. The manifest disables Virtualization.

I get your logic... so

My app. *reads* the value in "DataPath", a string value under
"HKEY_LOCAL_MACHINE\SOFTWARE\Marvyn\TCS Store Manager",

Since there is no write to HKLM - why would there be virtualization?

Steve Bywaters

NewsArchive
06-27-2007, 07:50 AM
No, "Virtualization" does not kick in if you read HKLM.

But if your app works without the manifest but not with the manifest, then
your app is doing something that a Vista-aware application (that requests
asInvoker privileges) is not allowed to do.

Just for fun, change "asInvoker" to "requireAdministrator" in your app (of
course, this is a test and never ship your app with this option) and I bet
it works <g>.

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
06-28-2007, 02:05 AM
> Just for fun, change "asInvoker" to "requireAdministrator" in your app (of
> course, this is a test and never ship your app with this option) and I bet
> it works <g>.

You win!

Steve Bywaters

NewsArchive
06-28-2007, 02:06 AM
Use Regedit on the Vista machine after you install and double-check that you
actually wrote to HKLM.
If your installer runs with a requireAdministrator manifest, you should see
your values there.
Otherwise, they won't be.
If you have a clarionmag subscription, this article illustrates the
smoke-and-mirrors and shows where Vista is hiding the data you think you're
writing:
http://www.clarionmag.com/cmag/v9/v9n05vista3b.html and shows the difference
of how it treats an app that contains a Vista-aware manifest from how it
treats one without such a manifest.

Jane

NewsArchive
06-28-2007, 02:06 AM
Oh yes, it's there....

I've read that and the Microsoft document "WindowsVistaUACDevReqs.doc"...
and I still don't see why the *read* would fail!

Friedrich is right - if I give the app Admin priveleges, it returns the
correct result, so there is obviously something going on re.
virtualization... but what?

Right at the *very* start of my program (Program Setup embed, before any
data writes, ini writes... there are no writes to Registry)...it attempts to
read the registry... fails (asInvoker), succeds (as Admin).

What is the mechanism that can cause that?

S.

NewsArchive
06-28-2007, 02:06 AM
GOT IT!!

I'm using a Registry function library template to access the Registry.

In that, the call to Open the key was hard-wired to open it with 'full'
access!
I changed it to read/query only and Voila! It works!

Thanks for the pointers.... (J & F)

S.

NewsArchive
06-28-2007, 02:06 AM
:) Perfect!

Friedrich

NewsArchive
06-28-2007, 10:54 AM
Hi Steve,

>In that, the call to Open the key was hard-wired to open it with 'full'
>access!
>I changed it to read/query only and Voila! It works!

Are you using 6.x? If so could you try it with GetReg() and see what
happens?

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
06-28-2007, 10:54 AM
Hi Arnór,

AFAIK, Steve is using C55.

Friedrich

NewsArchive
06-28-2007, 10:54 AM
AFAIK, getreg() and putreg() were included in c55util

Jane

NewsArchive
06-28-2007, 10:55 AM
Hi Friedrich,

>AFAIK, Steve is using C55.

Thanks, that's what I tought. I'm pretty sure that GetReg does open
the keys for read only.?

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
06-28-2007, 10:58 AM
Hi Arnór,

I am using my own registry functions. But I believe C63 does not try to
open keys with full access rights.

Friedrich

NewsArchive
06-28-2007, 11:45 PM
> AFAIK, getreg() and putreg() were included in c55util

Don't think so... no trace in Help (natch) and can't find prototypes in
system CLW.

No mind - I've done a nice mod. to the template, which adds a new
'accesslevel' parameter to the Open call.
It's an optional parameter, defaulting to 'full access' (so nothing else
breaks), but when OpenKey is called from GetReg then the KEY_QUERY_VALUE
level is used.


So that now works in Vista.... now my graph OCX is 'broken' (app hangs... ok
in XP)
A strong sense of 'swimming as hard as I can just to stay afloat', here <g>

Steve

NewsArchive
06-28-2007, 11:46 PM
Funny you don't have it.
I have a file called c55util.inc in the Clarion55\Libsrc folder.

I'll paste its contents:
MODULE('c55util.clw')
OSVersion( ),STRING
FileExists( STRING sFile ), BYTE
WindowExists( STRING sWindow ), BYTE
ValidateOLE( SIGNED OleControl, <STRING OleFileName>, <STRING
OleCreateName> ), BYTE
GetUserName( ),STRING
BeginUnique( STRING sAppName ),LONG
EndUnique( LONG hUnique )
IsTermServer( ),BYTE
GetFileTime( STRING iFile, BYTE bType=0 ),LONG
GetFileDate( STRING iFile, BYTE bType=0 ),LONG
CreateDirectory( STRING sDirectory ), BYTE
RemoveDirectory( STRING sDirectory ), BYTE
GetTempPath( ), STRING
GetTempFileName( STRING sPrefix, <STRING sDirectory> ),STRING
GetReg( LONG hKey, STRING sSubKeyPath, STRING sValue ), ?
PutReg( LONG hKey, STRING sSubKeyPath, STRING sValueName, STRING sValue,
LONG lType=1 ), BYTE
FullDrag( <LONG lDragSetting> ),LONG,PROC
END

Jane Fleming

NewsArchive
06-28-2007, 11:46 PM
Whoa - there it is - you're right!

How long have I been working in C55 now...?... and I didn't know that was
there!

Steve Bywaters

NewsArchive
06-28-2007, 11:46 PM
ROFL...
It's probably even documented somewhere...

I got acquainted with it when I came back to Clarion after a long absence
and bought Bruce Johnson's ABC book, which has a chapter on it.
http://www.capesoft.com/accessories/abcbook.htm

Jane Fleming

NewsArchive
06-28-2007, 11:46 PM
> ROFL...
> It's probably even documented somewhere...

Aw gee Jane - now that you've told him, you know we're going to have to
kill him<g>.


;-)

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
06-29-2007, 10:38 AM
Argh!
Sorry, Charles...
I forgot the RULES!!!
:hanging-head-in-shame:

Jane Fleming