Raising admin rights on Vista

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Sep 1 05:42:15 CDT 2008


Bonjour à tous,

When you update Rev on Vista, a dialog prompts you to quit and reopen  
Rev as 'Administrator' if you have not these rights.
Of course it's because without admin rights, files written to Program  
files will be virtualized.
As to know if an exe has admin rights, I have written a tiny function:

function VistaAdmin
   local tFolder,tVirtualizedFolder,tAdminFlag
   ----
   put specialfolderpath(38) & slash & "TempTestfolder" into tFolder
   create folder tFolder
   put char 1 of tFolder & ":/Users/" & $USERNAME & "/AppData/Local/ 
VirtualStore/Program Files/TempTestfolder" into tVirtualizedFolder
   put there is no folder tVirtualizedFolder into tAdminFlag
   if tAdminFlag then delete folder tFolder
   else delete folder tVirtualizedFolder
   return tAdminFlag
end VistaAdmin

Forgive me because it's really a workaround but I could not figure  
another way to get it :-(
Now my questions:

1. Do you know a more elegant way (without writing to disk) to know  
if the user has admin rights?
2. Is there a way to raise privileges directly using a shell command  
or something else on Vista? *
Because this way of doing (as does any installer) would be by far  
preferable...

* I'm afraid not or Rev would have used it in their own installer?

Thanks for any idea on or off-list.

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list