- updating the environment after changing the path variable
git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@136 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
MODULE UsbUtils;
|
MODULE UsbUtils;
|
||||||
IMPORT WinApi, Strings, Log := StdLog;
|
IMPORT SYSTEM, WinApi, Strings, ComTools, Log := StdLog;
|
||||||
|
|
||||||
CONST
|
CONST
|
||||||
HK_LM_JRE_Key = "SOFTWARE\javaSoft\Java Runtime Environment";
|
HK_LM_JRE_Key = "SOFTWARE\javaSoft\Java Runtime Environment";
|
||||||
@@ -73,9 +73,14 @@ IMPORT WinApi, Strings, Log := StdLog;
|
|||||||
PROCEDURE CheckAndSetPath*;
|
PROCEDURE CheckAndSetPath*;
|
||||||
CONST
|
CONST
|
||||||
PATH_Pattern = "\bin\client";
|
PATH_Pattern = "\bin\client";
|
||||||
|
|
||||||
|
SMTO_ABORTIFHUNG = {1} (* 2 in C *);
|
||||||
|
HWND_BROADCAST = 0FFFFH;
|
||||||
|
|
||||||
VAR
|
VAR
|
||||||
jreHome, regValue, tmpRegValue: ARRAY 2048 OF SHORTCHAR;
|
jreHome, regValue, tmpRegValue: ARRAY 2048 OF SHORTCHAR;
|
||||||
pos: INTEGER; noUserPathValue, success, found: BOOLEAN;
|
pos, result: INTEGER; noUserPathValue, success, found: BOOLEAN;
|
||||||
|
environment: WinApi.PtrSTR;
|
||||||
BEGIN
|
BEGIN
|
||||||
(* get jre home path *)
|
(* get jre home path *)
|
||||||
IF ~RegLMQuery(HK_LM_JRE_Key, HK_LM_JRE_CurrentVersion_value, tmpRegValue) (* e.g. "1.5" *) THEN
|
IF ~RegLMQuery(HK_LM_JRE_Key, HK_LM_JRE_CurrentVersion_value, tmpRegValue) (* e.g. "1.5" *) THEN
|
||||||
@@ -111,6 +116,12 @@ IMPORT WinApi, Strings, Log := StdLog;
|
|||||||
ELSE
|
ELSE
|
||||||
Log.String("UsbUtils: Error on CreateKey with value " + tmpRegValue); Log.Ln;
|
Log.String("UsbUtils: Error on CreateKey with value " + tmpRegValue); Log.Ln;
|
||||||
END;
|
END;
|
||||||
|
(* Notify windows about Environment Change (if this is not done, the changes will only take effect after reboot) *)
|
||||||
|
Log.String("Updating Environment - this may take some seconds..."); Log.Ln;
|
||||||
|
environment := ComTools.NewSString("Environment");
|
||||||
|
result := WinApi.SendMessageTimeout(HWND_BROADCAST, WinApi.WM_SETTINGCHANGE, 0,
|
||||||
|
SYSTEM.VAL(INTEGER, environment), SMTO_ABORTIFHUNG, 2000, result);
|
||||||
|
Log.String("Please restart Blackbox"); Log.Ln;
|
||||||
ELSE
|
ELSE
|
||||||
Log.String("the PATH user variable " + regValue + " is already set"); Log.Ln;
|
Log.String("the PATH user variable " + regValue + " is already set"); Log.Ln;
|
||||||
END
|
END
|
||||||
|
|||||||
Reference in New Issue
Block a user