Can you access the windows registry from Adobe Air

2019-03-20 06:12发布

(y/N)

Edit: Read-only access is fine.

8条回答
混吃等死
2楼-- · 2019-03-20 06:29

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.

查看更多
唯我独甜
3楼-- · 2019-03-20 06:30

You could theoretically modify the actual registry files, but I would highly discourage that idea.

查看更多
Summer. ? 凉城
4楼-- · 2019-03-20 06:30

Be very careful if you decide to create a socket server that listens for registry commands. You are potentially creating a security hole and users' personal firewalls may get in the way in terms of usability.

查看更多
戒情不戒烟
5楼-- · 2019-03-20 06:33

If your willing to force the user to also install another application, you could write a small C# or C++ windows service that simply opens a Socket that provides some kind of protocol for accessing the registry. Then in AIR you can use the Socket class to send messages to/from the C# service that would return results to the AIR app.

When the app loads you can try to connect to the Socket, and if the connection is rejected you could prompt the user to download/install the service.

As for direct access to the registry I am pretty sure Adobe wouldn't allow that from AIR.

查看更多
Lonely孤独者°
6楼-- · 2019-03-20 06:42

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).

查看更多
\"骚年 ilove
7楼-- · 2019-03-20 06:44

A bit late, but I got a wish from a client to read some values from the registry when the project was almost finished. If there were more of these types of wishes, I would have never choosen AIR. But I found a nice extension from FluorineFx, and by extending it, I can now read string and dword values from the registry. Windows only: http://aperture.fluorinefx.com/

查看更多
登录 后发表回答