|
|||
|
I am using the following code to retrieve the current values in the registry...
Code:
r = new RegKey("HKLM\\Software\\ILSP\\LAMDA");
value = r.getValues();
But when I work with a user in Windows XP that hasn't got administration privileges, the application cannot access the values from the registry. So I want a way to ensure that the function Code:
new RegKey("HKLM\\Software\\ILSP\\LAMDA");
|
|
|||
|
Thanx for the immediate answer...but it doesn't work. It still doesn't read the registry without administrative privileges.
The Code I am using, retrieves the value of INSTALLID variable and if it's length is equal to 4 it approves the user. Code:
r = new RegKey("HKLM\\Software\\ILSP\\LAMDA", 131097/*KEY_READ*/);
values = r.getValues();
for (i = 0; i < values.length; i++)
{
if (values[i].name == "INSTALLID")
{
installID = String(values[i].data);
if (installID.length == 4) {
_root.$APP.installID = installID;
}
}
}
|
|
|||
|
I created a simple .exe file, to show you the problem.
In the zip file you will find all the source files, plus the REGISTRY entry (Lamda.reg). Before you test the code, execute "Lamda.reg" file. The code is the following: Code:
import SWFKit.*;
r = new RegKey("HKLM\\Software\\ILSP\\LAMDA", 131097/*KEY_READ*/);
values = r.getValues();
_txt.text += "\n r = new RegKey('HKLM\\Software\\ILSP\\LAMDA', 131097/*KEY_READ*/); returns...\n";
_txt.text += r;
_txt.text += "\n r.getValues(); returns...\n";
_txt.text += values[1].data;
BUT if you run the same "exe" in a user without administrative privileges, r still returns [Object object] (it always does, even if you compile it in flash) but values doesn't return "undefined". I think that the problem is in this line -> values = r.getValues(); It doesn't return anything... Please give me a solution ASAP, I am in a tight schedule. If no solution can be found in this problem...I would like to know some way of detecting whether the user has administrative privileges or not, and if he doesn't the application will not execute. |
|
|||
|
The wrapper class for the RegKey object (RegKey.as) does not pass the second parameter to swfkit, so it does not work although you have specified the "key_read" access flag. To solve the problem, please write a ffish script function
Code:
function readValue() {
r = new RegKey("HKLM\\Software\\ILSP\\LAMDA", 131097/*KEY_READ*/);
values = r.getValues();
for (i = 0; i < values.length; i++)
{
if (values[i].name == "INSTALLID")
{
installID = String(values[i].data);
if (installID.length == 4) {
return installID;
}
}
}
return "";
}
Code:
_root.$APP.installID = ExternalInterface.call("readValue");
|
|
|||
|
I am having trouble on executing the function from actionscript.
I copy-pasted the function INSIDE the Initialize script (between getAdditionalFile() and after return true and I tried calling the function from actionscript with the ExternalInterface.call("readValue"), but I am getting "undefined" all the time. Probably I am setting or calling the function correctly. The project is in AS2 not AS3. Thanx and sorry for the trouble. |
|
|||
|
It should work in either as2 or as3.
Please make sure that the function is in the "initialize" script before "return true;" And in actionscript, maybe you need to add "import flash.external.*". If you still cannot make it work, please feel free to let us know. We will send a sample to you. |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|