Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2287
  • Last Modified:

Powerbuilder Setting Environment variables in Windows 7

Hi,

We define a local external function in a window below as

//Local External function
Function Boolean SetEnvironmentVariableA(String lpName, String lpValue) Library "kernel32.dll"

and then in a script call as
Boolean            lbl_ret       = TRUE
String             ls_envname
String            ls_version

ls_version      =      "1.0"
ls_env_name = "TESTENV"

lbl_ret = SetEnvironmentVariableA ( ls_envname, ls_version )

This works on XP, but not with Windows 7.
i.e The environment variable is created in XP, but  not in Windows 7.

Any help on how to create an environment variable from Powerbuilder in Windows 7 very much appreciated. ( Please note, for security reasosn, we are unable to use the RegistrySet function )

Running Powerbuilder 10.5.2 Build 7826



0
cintra
Asked:
cintra
  • 2
2 Solutions
 
elimesikaCommented:
HI
In windows 7 this function is in
api-ms-win-core-processenvironment-l1-1-0.dll

See
http://www.nirsoft.net/articles/windows_7_kernel_architecture_changes.html
Function Boolean SetEnvironmentVariableA(String lpName, String lpValue) Library "api-ms-win-core-processenvironment-l1-1-0.dll"

Open in new window

0
 
kmanoharnaikCommented:
Hi,

if it works in XP, not in WIndows 7, try adding alias name as below

alias for "SetEnvironmentVariableA;Ansi"

i am not sure if it works.

Please let me know if it works.

thanks
manohar
0
 
cintraAuthor Commented:
Thanks for both replies. Will check them both out and let you know the outcome, as well as awarding points.
0
 
cintraAuthor Commented:
The "SetEnvironmentVariableA;Ansi" did not work, though the use of the Ansi at the end was very useful info.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now