Quantcast
Channel: Indigo Rose Software Forums - Forums
Viewing all articles
Browse latest Browse all 2105

WoW64 Plugin implementation

$
0
0
Hi Forum, I need to include this code, based on AMS Expiration Example, in Startup Page.
How I can use this correctly on both architectures 32\64bit?
Thanks a lot!


Code:
-- Check if the OS is 64 bit
b64Bit = System.Is64BitOS();

if b64Bit then

else

end

------32Bit------

-- Initialize variables
days_left = 365;
date_installed = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "MyValue", true);
time_limit = 365; --the length of the trial period, in days

-- Convert string value to number
date_installed = String.ToNumber(date_installed);

-- Was date_installed 0 (non-existent)?
if date_installed == 0 then
-- Value was nonexistent, create it
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "MyValue", System.GetDate(DATE_FMT_JULIAN), REG_SZ);
else
-- Update days_left
days_left = (date_installed + time_limit) - System.GetDate(DATE_FMT_JULIAN);
end

-- Are there days left?
if days_left < 1 then
-- There are not any days left, alert user and exit.
Dialog.Message("Trial Period Over", "This software has expired");
Application.Exit();
end

------64Bit------

-- Initialize variables
days_left = 365;
date_installed = Wow64.RegistryGetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "MyValue", true, Wow64.KEY64);
time_limit = 365; --the length of the trial period, in days

-- Convert string value to number
date_installed = String.ToNumber(date_installed);

-- Was date_installed 0 (non-existent)?
if date_installed == 0 then
-- Value was nonexistent, create it
Wow64.RegistrySetValue(HKEY_LOCAL_MACHINE, "Software\\My Application", "MyValue", System.GetDate(DATE_FMT_JULIAN), REG_SZ, Wow64.KEY64);
else
-- Update days_left
days_left = (date_installed + time_limit) - System.GetDate(DATE_FMT_JULIAN);
end

-- Are there days left?
if days_left < 1 then
-- There are not any days left, alert user and exit.
Dialog.Message("Trial Period Over", "This software has expired");
Application.Exit();
end

Viewing all articles
Browse latest Browse all 2105

Trending Articles