ssss
s s
GentleSecurity.com
s
GesWall Safe applications Technology Download Support About us
ss
s s

Resource Name Syntax

Resource Name Syntax allows the identification of universal resource names that are valid in any environment. For example, instead of an exact folder name
C:\Program Files\MYIE2\Config\
you may specify
%HKEY_CURRENT_USER\Software\MYIE2\Folder%\Config

This example uses macro-substitution that reads the HKEY_CURRENT_USER\Software\MYIE2\Folder registry value. This is where the MyIE browser stores its install folder name. Such notation is not environment specific and provides the correct name regardless of the software installation folder.

The structure of a name depends on the resource type.

Files and file directories are represented by usual names with macro-substitution, e.g. three variants of the same name

  1. C:\Program Files\ICQ
  2. %ProgramFiles%\ICQ
  3. %HKLM\SOFTWARE\Mirabilis\ICQ\ICQPro\DefaultPrefs\ICQPath%

Registry key and value names are in regedit.exe format notation starting with the root-predefined keys, e.g.:
HKLM\SOFTWARE\Opera Software\Opera
%HKEY_CURRENT_USER%\Software\Skype
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

Resource name syntax also supports well-known acronyms for root-predefined keys.

Predefined key Acronym
HKEY_LOCAL_MACHINE HKLM
HKEY_USERS HKU
HKEY_CLASSES_ROOT HKCR
HKEY_CURRENT_CONFIG HKCC
HKEY_PERFORMANCE_DATA HKPD

Device names are Windows native names, which usually follow by prefix \Device\, e.g.:
\Device\Tcp
\Device\CdRom
\Device\Floppy

Macro-substitutions are enclosed within percent signs (%) and expanded by GeSWall according to its meaning. The table bellow describes all supported macro-substitutions.

%EnvironmentVariable%
Application environment variable, which is expanded according to actual values, e.g.: %SystemRoot%, %HOMEPATH%, %TEMP%
%ANYUSERPROFILE%

Returns a list of user profile folders (%USERPROFILE%) that exist on a given system, e.g. %USERPROFILE%\My Documents expands to the set:

C:\Documents and Settings\Administrator\My Documents
C:\Documents and Settings\test\My Documents
C:\Documents and Settings\LocalService\My Documents
C:\Documents and Settings\NetworkService\My Documents

%HKEY_CURRENT_USER%
%HKCU%
Return HKEY_USERS\S-1-... registry key for actual user. This is the same as HKEY_CURRENT_USER, but macro-substitution must be used because HKEY_CURRENT_USER is just a link to the corresponding HKEY_USERS sub-key and depends on the user who started an application.
%ANYHKU%

Returns a list of all HKEY_USERS\S-1-: registry keys, in fact all possible HKEY_CURRENT_USER, e.g.

HKEY_USERS\S-1-5-18
HKEY_USERS\S-1-5-19
HKEY_USERS\S-1-5-20
HKEY_USERS\S-1-5-21-813958858-572454927-963639892-1004

Registry value
A string value from the registry, e.g.
%HKLM\Software\Company\Software\InstallDir% - expands to InstallDir value content %HKCU\Software\Winamp\% - expands to the key default value content. Note, in that case HKCU must be used without % signs.
ANYHKU registry value

Returns a list of string registry values for all users who have a profile on a system, e.g. %ANYHKU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal% expands to the set of Personal registry value contents, which is My Document folder paths:

C:\Documents and Settings\Administrator\My Documents
C:\Documents and Settings\test\My Documents
C:\Documents and Settings\LocalService\My Documents
C:\Documents and Settings\NetworkService\My Documents

%getdir%() function
Function to extract directory name from full file name, e.g.:
%getdir%(%SystemRoot%\system32\msdtc.exe) expands to c:\windows\system32 Usually it is used to handle registry values.
%shortname%() function
Function to get a short 8.3 name from given file name, e.g.
%shortname%(%ProgramFiles%\Internet Explorer\IEXPLORE.EXE) expands to c:\PROGRA~1\INTERN~1\ IEXPLORE.EXE
%longname%() function
Function to get a long name from parameter's file name, e.g.
%longname%(c:\PROGRA~1\INTERN~1\ IEXPLORE.EXE) expands to c:\Program Files\Internet Explorer\IEXPLORE.EXE
%readfile% () function
%readfile% (full_path_to_file, type_of_file) returns string of data from given file. The function has two parameters:
full_path_to_file - full path to the file. The parameter can be a macro-substitution as well.
type_of_file - type of file: wchar - unicode file, char - ascii file.

Samples:
%readfile%(c:\test, wchar)
%readfile%("%readfile% (c:\\test, wchar)", wchar)
"%readfile%(%HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\ Explorer\\Shell Folders\\AppData%\\Mozilla\\Firefox\\profiles.ini, char)"
%regexp_parse_x% () function
%regexp_parse_x% (regex_pattern, data) is the same as %regexp_parse% but returns a set of found substrings. There are two parameters:
regex_pattern - regex pattern to search.
data - data to search in. The parameter can be a macro-substitution.

Note, macro-recursion is not supported, so you cannot use one macro-substitution within another one. However, macro-substitution is allowed as a parameter for a macro-substitution function.

s
s s
s s
s   s
 
Copyright 2006 GentleSecurity
Contact Us Privacy Statement