使用手册
环境变量自定义环境变量将在被保护程序运行时可以被调用,这是一个很好的隐藏/加密字符串的方法。请注意,变量名称/值限制在255字符内。 更多环境变量使用方法参看下面例子 几种语言使用自定义环境变量的例子Delphiuses 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 BasicPublic 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); } |