Any questions? Ask us: support@enigmaprotector.com

Help

Manual
Additional
Manual

Environment Variables

Environment Variables

Define the list of your own environment variables that will be set up before the main code of the protected application is executed. This feature allows you to set up the necessary environment variables if this cannot be done from the code. It is also a good way to hide strings data. Please note that a variable name and value are limited to 255 symbols.

To access the environment variables, use the definitions and examples below

Definitions and Examples

Delphi

uses 
  Windows;

function GetEnvVar(Name : string) : String;
var 
  buf : array[0..255] of char;
begin
  Result := '';
  if (GetEnvironmentVariable(pansichar(name), @buf, sizeof(buf)) <> 0) then
    Result := string(buf);
End; 

// another way

uses 
  SysUtils;

 
function GetEnvVar(Name : string) : string;
begin
  Result := GetEnvironmentVariable(Name);
end;


C++

#include <windows.h>

{
   char variable[256]="";
   if (!GetEnvironmentVariable("my variable", variable, sizeof(variable))) {
       MessageBox(0, "Variable found!", "Application", MB_OK);
   };
}


Visual Basic

Public Declare Function GetEnvironmentVariable Lib "kernel32.dll" Alias "GetEnvironmentVariableA" (ByVal Name) As String

C# (.NET)

public class Enigma_EnvironmentVariables
{
  [DllImport("kernel32")] public static extern int GetEnvironmentVariable(string lpName, string lpBuffer, int nSize);
}