Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you access the windows registry from Adobe Air?

(y/N)

Edit: Read-only access is fine.

like image 472
Shawn Avatar asked Aug 06 '08 16:08

Shawn


People also ask

How do I view Windows registry files?

There are two ways to open Registry Editor in Windows 10: In the search box on the taskbar, type regedit, then select Registry Editor (Desktop app) from the results. Right-click Start , then select Run. Type regedit in the Open: box, and then select OK.

Where are Windows Registry stored?

The registry files are stored in the %WINDIR% directory under the names USER. DAT and SYSTEM.

How do I install Adobe AIR on my Mac?

Install the runtime on a Mac computerDownload the runtime installation file from http://get.adobe.com/air. Double-click runtime installation file. In the installation window, follow the prompts to complete the installation. If the Installer displays an Authenticate window, enter your Mac OS user name and password.


3 Answers

I haven't tried this yet, but I think I've found a workaround.

Adobe AIR cannot write to Windows Registry, but you can, however, launch a native process in AIR 2. Here's a blog post that shows how to do that: http://www.adobe.com/devnet/air/flex/quickstart/articles/interacting_with_native_process.html

Now, on Windows, you are able to modify the Windows registry with .reg files. .reg files are just plain text files that's read by regedit.exe. So in theory, you can write a .reg file to the file system, then launch regedit.exe with the .reg file passed in and...TADA! You just modified Windows registry from your AIR app!

To read value, you can use regedit's export function to write to a reg file and read from the reg file. Details to regedit's options: http://www.robvanderwoude.com/regedit.php

Here are some additional resources:
.reg file syntax: http://support.microsoft.com/kb/310516
write to file with AIR: http://www.adobe.com/devnet/air/flex/articles/exploring_file_capabilities.html

like image 96
ming_codes Avatar answered Oct 22 '22 10:10

ming_codes


Are you trying to determine if the user is an administrator or not?

If so you could grad the username by with "File.userDirectory.name".

And I think to figure out if the user is an administrator you could probably try to access a file that requires administrator privileges (maybe try writing a file to Windows/System32). If the file access fails you could probably assume that the user is under a Limited account.

like image 2
Matt MacLean Avatar answered Oct 22 '22 09:10

Matt MacLean


If you can I'd be horrified.

Why would you be horrified? Air is a desktop platform, and having access to the OS's APIs (such as registry access) makes plenty of sense.

That being said, it isn't supported now (and as Adobe seem to be very Mac-centric, I doubt it will ever be added).

I have settled on grabbing the users name from the name of the user directory

Using File.userDirectory.name will work in most cases, but it seems like a very fragile implementation, it relies on the OS maintaining the convention of having the username as their directory. I can think of a few possible things that might break it (playing with TweakUI etc).

like image 2
RodeoClown Avatar answered Oct 22 '22 09:10

RodeoClown