Subversion Repositories userdetect2

Compare Revisions

Regard whitespace Rev 83 → Rev 84

/trunk/UserDetect2/UD2_Main.dfm
3,7 → 3,7
Top = 177
Width = 784
Height = 440
ActiveControl = Memo1
ActiveControl = IdentificationsListView
Caption = 'ViaThinkSoft UserDetect2'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
22,7 → 22,7
Top = 0
Width = 768
Height = 402
ActivePage = TabSheet5
ActivePage = TabSheet2
Align = alClient
TabOrder = 0
object TasksTabSheet: TTabSheet
/trunk/UserDetect2/UD2_Main.pas
572,7 → 572,9
idTerm: string;
slCmd: TStrings;
begin
if InputQuery('Enter example term', 'Example: abc|||Testecho:abc=calc.exe', idTerm) then
// TODO xxx: Auch eine Möglichkeit geben, einfach nur "Testecho(abc)" einzugeben und es kommt was bei raus
 
if InputQuery('Enter example term', 'Example: Testecho(abc):abc=calc.exe', idTerm) then
begin
slCmd := TStringList.Create;
try
/trunk/UserDetect2/UD2_Obj.pas
12,11 → 12,6
Windows, SysUtils, Classes, IniFiles, Contnrs, Dialogs, UD2_PluginIntf,
UD2_PluginStatus, UD2_Utils;
 
const
cchBufferSize = 32768;
 
dynamicDataDelim = '|||';
 
type
TUD2IdentificationEntry = class;
 
81,7 → 76,7
property Errors: TStrings read FErrors;
property LoadedPlugins: TObjectList{<TUD2Plugin>} read FLoadedPlugins;
property IniFile: TMemIniFile read FIniFile;
procedure GetAllIdNames(outSL: TStrings);
procedure GetAllDetectedIDs(outSL: TStrings);
function FulfilsEverySubterm(idTerm: WideString; slIdNames: TStrings=nil): boolean;
procedure CheckTerm(idTermAndCmd: string; commandSLout: TStrings; slIdNames: TStrings=nil);
function FindPluginByMethodNameOrGuid(idMethodName: string): TUD2Plugin;
102,6 → 97,9
uses
Math;
 
const
cchBufferSize = 32768;
 
type
TUD2PluginLoader = class(TThread)
protected
255,8 → 253,8
begin
if DynamicDataUsed then
begin
sl.Add(DynamicData+dynamicDataDelim+Plugin.IdentificationMethodName+':'+IdentificationString);
sl.Add(DynamicData+DynamicDataDelim+Plugin.PluginGUIDString+':'+IdentificationString);
sl.Add(Plugin.IdentificationMethodName+'('+DynamicData+'):'+IdentificationString);
sl.Add(Plugin.PluginGUIDString+'('+DynamicData+'):'+IdentificationString);
end
else
begin
416,9 → 414,9
 
(*
 
NAMING EXAMPLE: dynXYZ|||ComputerName:ABC&&User:John=calc.exe
NAMING EXAMPLE: $CASESENSITIVE$ComputerName(dynXYZ):ABC&&User:John=calc.exe$RIOD$
 
idTerm: dynXYZ|||ComputerName:ABC&&User:John
idTerm: ComputerName(dynXYZ):ABC&&User:John
idName: ComputerName:ABC
IdMethodName: ComputerName
IdStr ABC
427,7 → 425,7
 
*)
 
procedure TUD2.GetAllIdNames(outSL: TStrings);
procedure TUD2.GetAllDetectedIDs(outSL: TStrings);
var
i, j: integer;
pl: TUD2Plugin;
448,7 → 446,7
const
CASE_SENSITIVE_FLAG = '$CASESENSITIVE$';
var
x, y, z: TArrayOfString;
x, a, b: TArrayOfString;
i: integer;
p: TUD2Plugin;
idName: WideString;
462,7 → 460,7
if cleanUpStringList then
begin
slIdNames := TStringList.Create;
GetAllIdNames(slIdNames);
GetAllDetectedIDs(slIdNames);
end;
 
SetLength(x, 0);
480,17 → 478,21
 
/// --- Start Dynamic Extension
 
SetLength(y, 0);
y := SplitString(dynamicDataDelim, idName);
// xxxxxx ( xxxxx ): xxxxxxxxxxxx
// xxxxx ( xx:xx ): xxxxx:xxx(x)
// xxxxxxxxxxxx : xxxxx(xxx)xx
 
if Length(y) >= 2 then
SetLength(a, 0);
a := SplitString('(', idName);
if (Length(a) >= 2) and (Pos(':', a[0]) = 0) then
begin
dynamicData := y[0];
SetLength(b, 0);
b := SplitString('):', a[1]);
if Length(b) >= 2 then
begin
dynamicData := b[0];
idMethodName := a[0];
 
SetLength(z, 0);
z := SplitString(':', y[1]);
idMethodName := z[0];
 
p := FindPluginByMethodNameOrGuid(idMethodName);
if Assigned(p) then
begin
498,10 → 500,11
begin
// Reload the identifications
slIdNames.Clear;
GetAllIdNames(slIdNames);
GetAllDetectedIDs(slIdNames);
end;
end;
end;
end;
 
/// --- End Dynamic Extension
 
553,7 → 556,7
begin
slIdNames := TStringList.Create;
try
GetAllIdNames(slIdNames);
GetAllDetectedIDs(slIdNames);
 
slSV := TStringList.Create;
try
582,7 → 585,7
begin
slIdNamesCreated := true;
slIdNames := TStringList.Create;
GetAllIdNames(slIdNames);
GetAllDetectedIDs(slIdNames);
end;
 
SetLength(nameVal, 0);
/trunk/UserDetect2/UD2_Parsing.pas
0,0 → 1,87
unit UD2_Parsing;
 
interface
 
uses
Windows, SysUtils;
 
// TODO: use this for better object oriented programming
 
type
TUD2Command = record
executable: string;
runAsAdmin: boolean;
runInOwnDirectory: boolean;
windowMode: integer;
end;
TUD2CommandArray = array of TUD2Command;
 
TUD2TDFCondition = record
idMethodName: string;
idStr: string;
dynamicDataUsed: Boolean;
dynamicData: string;
caseSensitive: boolean;
end;
TUD2TDFConditionArray = array of TUD2TDFCondition;
 
TUD2TDFEntry = record
ids: TUD2TDFConditionArray;
commands: TUD2CommandArray;
end;
TUD2TDFEntryArray = array of TUD2TDFEntry;
 
implementation
 
uses
UD2_Utils;
 
function ParseTdfLine(line: string; var entry: TUD2TDFEntry): boolean;
begin
// TODO: xxxxx
 
(*
entry.idName: string;
entry.idValue: string;
entry.dynamicDataUsed: Boolean;
entry.dynamicData: string;
entry.caseSensitive: boolean;
entry.commands: TUD2CommandArray;
*)
 
// ReadSectionValues
 
 
(*
nameVal := SplitString('=', idTermAndCmd);
if Length(nameVal) < 2 then exit;
idTerm := nameVal[0];
cmd := nameVal[1];
*)
end;
 
function ParseCommandLine(line: string; var cmd: TUD2Command): boolean;
begin
if Pos(UD2_RUN_AS_ADMIN, line) >= 1 then
begin
line := StringReplace(line, UD2_RUN_AS_ADMIN, '', [rfReplaceAll]);
cmd.runAsAdmin := true;
end
else cmd.runAsAdmin := false;
 
if Pos(UD2_RUN_IN_OWN_DIRECTORY_PREFIX, line) >= 1 then
begin
line := StringReplace(line, UD2_RUN_IN_OWN_DIRECTORY_PREFIX, '', [rfReplaceAll]);
cmd.runInOwnDirectory := true;
end
else cmd.runInOwnDirectory := false;
 
cmd.executable := line;
 
cmd.windowMode := SW_NORMAL; // TODO (future): make it configurable
 
result := true;
end;
 
end.
/trunk/UserDetect2/UserDetect2.dpr
8,7 → 8,8
UD2_PluginUtils in 'UD2_PluginUtils.pas',
UD2_Obj in 'UD2_Obj.pas',
UD2_Utils in 'UD2_Utils.pas',
UD2_PluginStatus in 'UD2_PluginStatus.pas';
UD2_PluginStatus in 'UD2_PluginStatus.pas',
UD2_Parsing in 'UD2_Parsing.pas';
 
{$R WindowsXP.res}
 
/trunk/UserDetect2/private/TODO.txt
28,3 → 28,5
* should the program really ask for a TDF when starting? why can't it run without TDF (in case the user only want to view the ident strings)
* Improve compatibility for older OS (e.g. Win95)
* Give .udp a file-type (icon)?
* TDF in XML?
* mehrere commandos aufrufen in einer einzigen zeile, ohne BAT ?