Problem with Virtualization/LUA

S

Sandeep

Hi,
I've an executable which displays/edits some user specific settings and do
some changes in %programfiles% folder as well.
XP:
It works fine 'coz you can change the user specific settings (stored in the
HKCU registry). And if it tries to access %programfiles% it fails(Shows an
error message) if the current user is non-admin and work fine if it is an
admin. All well
Vista:
Application works fine with user settings but when try to modify the
%programfiles% folder it creates a new file in the virtual store and never
throws an exception.
Everything works fine except the fact that we've hard links to this file in
the %programfiles% folder which are used by other applications. Now even
though my application works correctly other apps trying to use the hardlinks
can't see the changes because contents of %programfiles% file has not
changed.

What is the solution to this problem?

Some more question that can solve my problem
1) Is it possible for an application to specify if a particular operation
can be executed with elevated privilege only? Not the whole executable but
just some methods.

2)How can I disable virtualization for my process? (can I use manifest file
for this purpose?)

3)Can I determine at the runtime if I'm running with the elevated
privileges?
Will it return false
((WindowsPrincipal)Thread.CurrentPrincipal).IsInRole(WindowsBuiltInRole.Administrator))
if I'm running app without elevated privilege and true if running with
elevated privileges.

Regards
Sandeep
 
J

Jimmy Brush

1) Is it possible for an application to specify if a particular operation
can be executed with elevated privilege only? Not the whole executable but
just some methods.

Yes and no.

Yes - by separating out the elevated code its their own .exe or COM
components.

No - not within the same .exe/com component. An .exe/COM component is
either elevated or its not, and it cant change mid flight.
2)How can I disable virtualization for my process? (can I use manifest file
for this purpose?)

Manifested apps aren't virtualized.
3)Can I determine at the runtime if I'm running with the elevated
privileges?
Will it return false
((WindowsPrincipal)Thread.CurrentPrincipal).IsInRole(WindowsBuiltInRole.Administrator))
if I'm running app without elevated privilege and true if running with
elevated privileges.
Yes


Regards
Sandeep

- JB
 
S

Sandeep

Thanks Jimmy.

By manifest I meant the same thing. If I use manifest file for my app it
wont be virtualized and it will throw an exception if I try to write to
%programfiles%. Is that correct?
 
J

Jimmy Brush

Sandeep said:
Thanks Jimmy.

By manifest I meant the same thing. If I use manifest file for my app it
wont be virtualized and it will throw an exception if I try to write to
%programfiles%. Is that correct?

Correct, as long as it has the vista portion inside the manifest
(requestedEexecutionLevel).


Was supposed to be: Yes - by seperation out the elevated code into its
own .exe or com component. Then launching the special component elevated.

- JB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top