Subversion Repositories userdetect2

Compare Revisions

No changes between revisions

Regard whitespace Rev 74 → Rev 75

/tags/UserDetect2_Release_2.0/Plugins/DomainName.dpr
0,0 → 1,88
library DomainName;
 
uses
Windows,
SysUtils,
Classes,
Registry,
networkutils in 'networkutils.pas',
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{6D7AABD7-C4A8-43ED-99E3-3AF4723DD7B2}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentifier: WideString;
begin
if not GetDomainName(stIdentifier) then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end;
result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'Domänen-Name'
else
stPluginName := 'Domain name';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'DomainName';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/AccountSID.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=AccountSID plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-AccountSID
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=AccountSID.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de
/tags/UserDetect2_Release_2.0/Plugins/ComputerName.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=ComputerName plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-ComputerName
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=CompuerName.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de
/tags/UserDetect2_Release_2.0/Plugins/DomainName.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=DomainName plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-DomainName
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=CompuerName.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de
/tags/UserDetect2_Release_2.0/Plugins/AccountSID.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/ComputerName.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/NetworkUtils.pas
0,0 → 1,276
unit NetworkUtils;
 
interface
 
uses
Windows, SysUtils, Classes;
 
function GetLocalIPAddressList(outsl: TStrings): DWORD;
function GetLocalMACAddressList(outSL: TStrings): DWORD;
function GetDHCPIPAddressList(outsl: TStrings): DWORD;
function GetGatewayIPAddressList(outsl: TStrings): DWORD;
function GetMACAddress(const IPAddress: string; var outAddress: string): DWORD;
function FormatMAC(s: string): string;
function GetDomainName(var outDomainName: WideString): boolean;
 
implementation
 
uses
iphlp, WinSock, Registry;
 
// TODO: Replace GetAdaptersInfo()? A comment at MSDN states that there might be problems with IPv6
// "GetAdaptersInfo returns ERROR_NO_DATA if there are only IPv6 interfaces
// configured on system. In that case GetAdapterAddresses has to be used!"
 
function GetLocalIPAddressList(outsl: TStrings): DWORD;
var
pAdapterInfo: PIP_ADAPTER_INFO;
addr: string;
addrStr: IP_ADDR_STRING;
BufLen: Cardinal;
begin
BufLen := SizeOf(IP_ADAPTER_INFO);
Result := GetAdaptersInfo(nil, @BufLen);
if Result <> ERROR_BUFFER_OVERFLOW then Exit;
pAdapterInfo := AllocMem(BufLen);
try
Result := GetAdaptersInfo(pAdapterInfo, @BufLen);
if Result <> ERROR_SUCCESS then Exit;
while pAdapterInfo <> nil do
begin
addrStr := pAdapterInfo^.IpAddressList;
repeat
addr := addrStr.IpAddress.S;
if (addr <> '') and (outsl.IndexOf(addr) = -1) then
outsl.Add(addr);
if addrStr.Next = nil then break;
AddrStr := addrStr.Next^;
until false;
pAdapterInfo := pAdapterInfo^.next;
end;
finally
Freemem(pAdapterInfo);
end;
end;
 
function GetDHCPIPAddressList(outsl: TStrings): DWORD;
var
pAdapterInfo: PIP_ADAPTER_INFO;
addr: string;
addrStr: IP_ADDR_STRING;
BufLen: Cardinal;
begin
BufLen := SizeOf(IP_ADAPTER_INFO);
Result := GetAdaptersInfo(nil, @BufLen);
if Result <> ERROR_BUFFER_OVERFLOW then Exit;
pAdapterInfo := AllocMem(BufLen);
try
Result := GetAdaptersInfo(pAdapterInfo, @BufLen);
if Result <> ERROR_SUCCESS then Exit;
while pAdapterInfo <> nil do
begin
addrStr := pAdapterInfo^.DhcpServer;
repeat
addr := addrStr.IpAddress.S;
if (addr <> '') and (outsl.IndexOf(addr) = -1) then
outsl.Add(addr);
if addrStr.Next = nil then break;
AddrStr := addrStr.Next^;
until false;
pAdapterInfo := pAdapterInfo^.next;
end;
finally
Freemem(pAdapterInfo);
end;
end;
 
function GetGatewayIPAddressList(outsl: TStrings): DWORD;
var
pAdapterInfo: PIP_ADAPTER_INFO;
addr: string;
addrStr: IP_ADDR_STRING;
BufLen: Cardinal;
begin
BufLen := SizeOf(IP_ADAPTER_INFO);
Result := GetAdaptersInfo(nil, @BufLen);
if Result <> ERROR_BUFFER_OVERFLOW then Exit;
pAdapterInfo := AllocMem(BufLen);
try
Result := GetAdaptersInfo(pAdapterInfo, @BufLen);
if Result <> ERROR_SUCCESS then Exit;
while pAdapterInfo <> nil do
begin
addrStr := pAdapterInfo^.GatewayList;
repeat
addr := addrStr.IpAddress.S;
if (addr <> '') and (outsl.IndexOf(addr) = -1) then
outsl.Add(addr);
if addrStr.Next = nil then break;
AddrStr := addrStr.Next^;
until false;
pAdapterInfo := pAdapterInfo^.next;
end;
finally
Freemem(pAdapterInfo);
end;
end;
 
function GetMACAddress(const IPAddress: string; var outAddress: string): DWORD;
// http://stackoverflow.com/questions/4550672/delphi-get-mac-of-router
var
MacAddr : Array[0..5] of Byte;
DestIP : ULONG;
PhyAddrLen : ULONG;
WSAData : TWSAData;
j: integer;
begin
outAddress := '';
WSAStartup($0101, WSAData);
try
ZeroMemory(@MacAddr, SizeOf(MacAddr));
DestIP := inet_addr(PAnsiChar(IPAddress));
PhyAddrLen := SizeOf(MacAddr); // TODO: more ?
Result := SendArp(DestIP, 0, @MacAddr, @PhyAddrLen);
if Result = S_OK then
begin
outAddress := '';
for j := 0 to PhyAddrLen-1 do
begin
outAddress := outAddress + format('%.2x', [MacAddr[j]]);
end;
outAddress := FormatMAC(outAddress);
end;
finally
WSACleanup;
end;
end;
 
function GetLocalMACAddressList(outSL: TStrings): DWORD;
const
_MAX_ROWS_ = 100;
type
_IfTable = Record
nRows: LongInt;
ifRow: Array[1.._MAX_ROWS_] of MIB_IFROW;
end;
var
pIfTable: ^_IfTable;
TableSize: LongInt;
tmp: String;
i, j: Integer;
begin
pIfTable := nil;
try
// First: just get the buffer size.
// TableSize returns the size needed.
TableSize := 0; // Set to zero so the GetIfTabel function
// won't try to fill the buffer yet,
// but only return the actual size it needs.
GetIfTable(pIfTable, TableSize, 1);
if (TableSize < SizeOf(MIB_IFROW)+SizeOf(LongInt)) then
begin
Result := ERROR_NO_DATA;
Exit; // less than 1 table entry?!
end;
 
// Second:
// allocate memory for the buffer and retrieve the
// entire table.
GetMem(pIfTable, TableSize);
Result := GetIfTable(pIfTable, TableSize, 1);
if Result <> NO_ERROR then Exit;
 
// Read the ETHERNET addresses.
for i := 1 to pIfTable^.nRows do
begin
//if pIfTable^.ifRow[i].dwType=MIB_IF_TYPE_ETHERNET then
begin
tmp := '';
for j := 0 to pIfTable^.ifRow[i].dwPhysAddrLen-1 do
begin
tmp := tmp + format('%.2x', [pIfTable^.ifRow[i].bPhysAddr[j]]);
end;
tmp := FormatMAC(tmp);
if (tmp <> '') and (outSL.IndexOf(tmp) = -1) then
outSL.Add(tmp);
end;
end;
finally
if Assigned(pIfTable) then FreeMem(pIfTable, TableSize);
end;
end;
 
function FormatMAC(s: string): string;
var
m: integer;
begin
result := '';
m := 1;
s := UpperCase(s);
repeat
if m > 1 then result := result + '-';
result := result + Copy(s, m, 2);
inc(m, 2);
until m > Length(s);
end;
 
(*
type
WKSTA_INFO_100 = Record
wki100_platform_id : DWORD;
wki100_computername : LPWSTR;
wki100_langroup : LPWSTR;
wki100_ver_major : DWORD;
wki100_ver_minor : DWORD;
End;
 
LPWKSTA_INFO_100 = ^WKSTA_INFO_100;
 
function GetNetParam(AParam: integer): string;
Var
PBuf : LPWKSTA_INFO_100;
Res : LongInt;
begin
result := '';
Res := NetWkstaGetInfo(nil, 100, @PBuf);
If Res = NERR_Success Then
begin
case AParam of
0: Result := string(PBuf^.wki100_computername);
1: Result := string(PBuf^.wki100_langroup);
end;
end;
end;
 
function GetTheComputerName: string;
begin
Result := GetNetParam(0);
end;
 
function GetTheDomainName: string;
begin
Result := GetNetParam(1);
end;
 
*)
 
function GetDomainName(var outDomainName: WideString): boolean;
var
reg: TRegistry;
begin
outDomainName := '';
reg := TRegistry.Create;
try
reg.RootKey := HKEY_LOCAL_MACHINE;
result := reg.OpenKeyReadOnly('\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters');
if result then
begin
outDomainName := reg.ReadString('Domain');
reg.CloseKey;
end;
finally
reg.Free;
end;
end;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/DomainName.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/AccountSID.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/ComputerName.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/AccountSID.dpr
0,0 → 1,83
library AccountSID;
 
uses
Windows,
SysUtils,
Classes,
SPgetsid,
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{96374FFC-0A55-46B4-826B-CFD702FB24A2}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentifier: WideString;
begin
stIdentifier := GetCurrentUserSid;
result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'SID des Benutzerkontos'
else
stPluginName := 'Account Security Identifier';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'AccountSID';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/DomainName.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/LAN_IP.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/LAN_MAC.dpr
0,0 → 1,122
library LAN_MAC;
 
uses
Windows,
SysUtils,
Classes,
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas',
NetworkUtils in 'NetworkUtils.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{8E1AA598-67A6-4128-BB9F-7E624647F584}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
sl, sl2: TStringList;
i: integer;
ip, mac: string;
ec: DWORD;
begin
sl := TStringList.Create;
sl2 := TStringList.Create;
try
ec := GetLocalMACAddressList(sl2);
if ec = ERROR_NOT_SUPPORTED then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end
else if ec <> ERROR_SUCCESS then
begin
result := UD2_STATUS_OSError(ec);
Exit;
end;
 
// This procedure should not find any more MAC addresses...
GetLocalIPAddressList(sl);
for i := 0 to sl.Count-1 do
begin
ip := sl.Strings[i];
ec := GetMACAddress(ip, mac);
if ec = ERROR_NOT_SUPPORTED then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end
else if (ec = S_OK) and
(mac <> '') and
(sl2.IndexOf(mac) = -1) then
begin
sl2.add(mac);
end;
end;
result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl2);
finally
sl.Free;
sl2.Free;
end;
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'MAC-Adressen'
else
stPluginName := 'MAC addresses';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'LAN_MAC';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/GatewayIP.dpr
0,0 → 1,99
library GatewayIP;
 
uses
Windows,
SysUtils,
Classes,
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas',
NetworkUtils in 'NetworkUtils.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{F45C87FF-3A82-4AC8-AA19-C9DC0C6AAF7B}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
sl: TStringList;
ec: DWORD;
begin
sl := TStringList.Create;
try
ec := GetGatewayIPAddressList(sl);
if ec = ERROR_NOT_SUPPORTED then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end
else if ec <> ERROR_SUCCESS then
begin
result := UD2_STATUS_OSError(ec);
Exit;
end;
result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl);
finally
sl.Free;
end;
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'IP-Adressen der Gateways'
else
stPluginName := 'Gateway IP addresses';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'GatewayIP';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/DHCP_IP.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/DHCP_MAC.dpr
0,0 → 1,120
library DHCP_MAC;
 
uses
Windows,
SysUtils,
Classes,
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas',
NetworkUtils in 'NetworkUtils.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{574F8C7F-318E-4FA9-96CE-5A6F1FAE67FD}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
sl, sl2: TStringList;
i: integer;
ip, mac: string;
ec: DWORD;
begin
sl := TStringList.Create;
sl2 := TStringList.Create;
try
ec := GetDHCPIPAddressList(sl);
if ec = ERROR_NOT_SUPPORTED then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end
else if ec <> ERROR_SUCCESS then
begin
result := UD2_STATUS_OSError(ec);
Exit;
end;
 
for i := 0 to sl.Count-1 do
begin
ip := sl.Strings[i];
ec := GetMACAddress(ip, mac);
if ec = ERROR_NOT_SUPPORTED then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end
else if (ec = S_OK) and
(mac <> '') and
(sl2.IndexOf(mac) = -1) then
begin
sl2.add(mac);
end;
end;
result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl2);
finally
sl.Free;
sl2.Free;
end;
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'MAC-Adressen der DHCP-Server'
else
stPluginName := 'DHCP MAC addresses';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'DHCP_MAC';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/ComputerName.dpr
0,0 → 1,95
library ComputerName;
 
uses
Windows,
SysUtils,
Classes,
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{2AD004FF-6BFD-4038-B75B-9527DEABA28F}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function GetComputerName: string;
// http://www.delphi-treff.de/tipps-tricks/netzwerkinternet/netzwerkeigenschaften/computernamen-des-eigenen-rechners-ermitteln/
var
Len: DWORD;
begin
Len := MAX_COMPUTERNAME_LENGTH+1;
SetLength(Result,Len);
if Windows.GetComputerName(PChar(Result), Len) then
SetLength(Result,Len)
else
RaiseLastOSError;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentifier: WideString;
begin
stIdentifier := GetComputerName;
result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'Computer-Name'
else
stPluginName := 'Computer name';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'ComputerName';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/LAN_IP.dpr
0,0 → 1,99
library LAN_IP;
 
uses
Windows,
SysUtils,
Classes,
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas',
NetworkUtils in 'NetworkUtils.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{3C7D83F7-742C-4B3C-9F63-D12DEB442D27}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
sl: TStringList;
ec: DWORD;
begin
sl := TStringList.Create;
try
ec := GetLocalIPAddressList(sl);
if ec = ERROR_NOT_SUPPORTED then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end
else if ec <> ERROR_SUCCESS then
begin
result := UD2_STATUS_OSError(ec);
Exit;
end;
result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl);
finally
sl.Free;
end;
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'IP-Adressen'
else
stPluginName := 'IP addresses';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'LAN_IP';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/DHCP_IP.dpr
0,0 → 1,99
library DHCP_IP;
 
uses
Windows,
SysUtils,
Classes,
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas',
NetworkUtils in 'NetworkUtils.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{3E0B99F7-E062-4FF1-B656-7D512BE90C47}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
sl: TStringList;
ec: DWORD;
begin
sl := TStringList.Create;
try
ec := GetDHCPIPAddressList(sl);
if ec = ERROR_NOT_SUPPORTED then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end
else if ec <> ERROR_SUCCESS then
begin
result := UD2_STATUS_OSError(ec);
Exit;
end;
result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl);
finally
sl.Free;
end;
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'IP-Adresse der DHCP-Server'
else
stPluginName := 'DHCP IP addresses';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'DHCP_IP';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dpr
0,0 → 1,82
library ExecuteAlways;
 
uses
Windows,
SysUtils,
Classes,
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{7A1189CD-8F68-4068-9477-C50B9DCCCECC}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentifier: WideString;
begin
stIdentifier := 'Always';
result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'Immer ausführen'
else
stPluginName := 'Execute always';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'Execute';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/GatewayMAC.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/LAN_MAC.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/GatewayIP.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/GatewayMAC.dpr
0,0 → 1,120
library GatewayMAC;
 
uses
Windows,
SysUtils,
Classes,
UD2_PluginIntf in '..\UD2_PluginIntf.pas',
UD2_PluginUtils in '..\UD2_PluginUtils.pas',
UD2_PluginStatus in '..\UD2_PluginStatus.pas',
NetworkUtils in 'NetworkUtils.pas';
 
{$R *.res}
 
const
PLUGIN_GUID: TGUID = '{C24258AE-2092-41CA-9DB5-313B38954D01}';
 
function PluginIdentifier: TGUID; cdecl;
begin
result := PLUGIN_GUID;
end;
 
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
sl, sl2: TStringList;
i: integer;
ip, mac: string;
ec: DWORD;
begin
sl := TStringList.Create;
sl2 := TStringList.Create;
try
ec := GetGatewayIPAddressList(sl);
if ec = ERROR_NOT_SUPPORTED then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end
else if ec <> ERROR_SUCCESS then
begin
result := UD2_STATUS_OSError(ec);
Exit;
end;
 
for i := 0 to sl.Count-1 do
begin
ip := sl.Strings[i];
ec := GetMACAddress(ip, mac);
if ec = ERROR_NOT_SUPPORTED then
begin
result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
Exit;
end
else if (ec = S_OK) and
(mac <> '') and
(sl2.IndexOf(mac) = -1) then
begin
sl2.add(mac);
end;
end;
result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl2);
finally
sl.Free;
sl2.Free;
end;
end;
 
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
var
stPluginName: WideString;
primaryLangID: Byte;
begin
primaryLangID := wLangID and $00FF;
if primaryLangID = LANG_GERMAN then
stPluginName := 'MAC-Adressen der Gateways'
else
stPluginName := 'Gateway MAC addresses';
result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
end;
 
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
end;
 
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
begin
result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
end;
 
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
var
stIdentificationMethodName: WideString;
begin
stIdentificationMethodName := 'GatewayMAC';
result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
end;
 
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
begin
result := UD2_STATUS_OK_LICENSED;
end;
 
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
begin
// This function does not use non-generic status codes
result := FALSE;
end;
 
exports
PluginInterfaceID name mnPluginInterfaceID,
PluginIdentifier name mnPluginIdentifier,
PluginNameW name mnPluginNameW,
PluginVendorW name mnPluginVendorW,
PluginVersionW name mnPluginVersionW,
IdentificationMethodNameW name mnIdentificationMethodNameW,
IdentificationStringW name mnIdentificationStringW,
CheckLicense name mnCheckLicense,
DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/DHCP_MAC.dll
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/GatewayIP.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/LAN_MAC.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/GatewayMAC.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=GatewayMAC plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-GatewayMAC
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=GatewayMAC.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de
/tags/UserDetect2_Release_2.0/Plugins/ExecuteAlways.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=ExecuteAlways plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-ExecuteAlways
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=ExecuteAlways.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de
/tags/UserDetect2_Release_2.0/Plugins/DHCP_IP.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/DHCP_MAC.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=DHCP_MAC plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-DHCP_MAC
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=DHCP_MAC.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de
/tags/UserDetect2_Release_2.0/Plugins/LAN_IP.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=LAN_IP plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-LAN_IP
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=LAN_IP.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de
/tags/UserDetect2_Release_2.0/Plugins/GatewayMAC.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/DHCP_MAC.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/LAN_IP.res
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/tags/UserDetect2_Release_2.0/Plugins/iphlp.pas
0,0 → 1,148
unit iphlp;
 
interface
 
uses
Windows;
 
const
MAX_INTERFACE_NAME_LEN = $100;
ERROR_SUCCESS = 0;
MAXLEN_IFDESCR = $100;
MAXLEN_PHYSADDR = 8;
 
MIB_IF_OPER_STATUS_NON_OPERATIONAL = 0 ;
MIB_IF_OPER_STATUS_UNREACHABLE = 1;
MIB_IF_OPER_STATUS_DISCONNECTED = 2;
MIB_IF_OPER_STATUS_CONNECTING = 3;
MIB_IF_OPER_STATUS_CONNECTED = 4;
MIB_IF_OPER_STATUS_OPERATIONAL = 5;
 
MIB_IF_TYPE_OTHER = 1;
MIB_IF_TYPE_ETHERNET = 6;
MIB_IF_TYPE_TOKENRING = 9;
MIB_IF_TYPE_FDDI = 15;
MIB_IF_TYPE_PPP = 23;
MIB_IF_TYPE_LOOPBACK = 24;
MIB_IF_TYPE_SLIP = 28;
 
MIB_IF_ADMIN_STATUS_UP = 1;
MIB_IF_ADMIN_STATUS_DOWN = 2;
MIB_IF_ADMIN_STATUS_TESTING = 3;
 
type
MIB_IFROW = Record
wszName: Array[0 .. (MAX_INTERFACE_NAME_LEN*2-1)] of char;
dwIndex: LongInt;
dwType: LongInt;
dwMtu: LongInt;
dwSpeed: LongInt;
dwPhysAddrLen: LongInt;
bPhysAddr: Array[0 .. (MAXLEN_PHYSADDR-1)] of Byte;
dwAdminStatus: LongInt;
dwOperStatus: LongInt;
dwLastChange: LongInt;
dwInOctets: LongInt;
dwInUcastPkts: LongInt;
dwInNUcastPkts: LongInt;
dwInDiscards: LongInt;
dwInErrors: LongInt;
dwInUnknownProtos: LongInt;
dwOutOctets: LongInt;
dwOutUcastPkts: LongInt;
dwOutNUcastPkts: LongInt;
dwOutDiscards: LongInt;
dwOutErrors: LongInt;
dwOutQLen: LongInt;
dwDescrLen: LongInt;
bDescr: Array[0 .. (MAXLEN_IFDESCR - 1)] of Char;
end;
 
const
MAX_HOSTNAME_LEN = 128;
MAX_DOMAIN_NAME_LEN = 128;
MAX_SCOPE_ID_LEN = 256;
 
MAX_ADAPTER_NAME_LENGTH = 256;
MAX_ADAPTER_DESCRIPTION_LENGTH = 128;
MAX_ADAPTER_ADDRESS_LENGTH = 8;
 
IPHelper = 'iphlpapi.dll';
 
type
PIPAddressString = ^TIPAddressString;
PIPMaskString = ^TIPAddressString;
TIPAddressString = record
_String: array[0..(4 * 4) - 1] of Char;
end;
TIPMaskString = TIPAddressString;
PIPAddrString = ^TIPAddrString;
TIPAddrString = packed record
Next: PIPAddrString;
IpAddress: TIPAddressString;
IpMask: TIPMaskString;
Context: DWORD;
end;
PFixedInfo = ^TFixedInfo;
TFixedInfo = packed record
HostName: array[0..MAX_HOSTNAME_LEN + 4 - 1] of Char;
DomainName: array[0..MAX_DOMAIN_NAME_LEN + 4 - 1] of Char;
CurrentDnsServer: PIPAddrString;
DnsServerList: TIPAddrString;
NodeType: UINT;
ScopeId: array[0..MAX_SCOPE_ID_LEN + 4 - 1] of Char;
EnableRouting,
EnableProxy,
EnableDns: UINT;
end;
 
IP_ADDRESS_STRING = record
S: array [0..15] of Char;
end;
IP_MASK_STRING = IP_ADDRESS_STRING;
PIP_MASK_STRING = ^IP_MASK_STRING;
 
PIP_ADDR_STRING = ^IP_ADDR_STRING;
IP_ADDR_STRING = record
Next: PIP_ADDR_STRING;
IpAddress: IP_ADDRESS_STRING;
IpMask: IP_MASK_STRING;
Context: DWORD;
end;
 
PIP_ADAPTER_INFO = ^IP_ADAPTER_INFO;
IP_ADAPTER_INFO = record
Next: PIP_ADAPTER_INFO;
ComboIndex: DWORD;
AdapterName: array [0..MAX_ADAPTER_NAME_LENGTH + 3] of Char;
Description: array [0..MAX_ADAPTER_DESCRIPTION_LENGTH + 3] of Char;
AddressLength: UINT;
Address: array [0..MAX_ADAPTER_ADDRESS_LENGTH - 1] of BYTE;
Index: DWORD;
Type_: UINT;
DhcpEnabled: UINT;
CurrentIpAddress: PIP_ADDR_STRING;
IpAddressList: IP_ADDR_STRING;
GatewayList: IP_ADDR_STRING;
DhcpServer: IP_ADDR_STRING;
HaveWins: BOOL;
PrimaryWinsServer: IP_ADDR_STRING;
SecondaryWinsServer: IP_ADDR_STRING;
LeaseObtained: Cardinal;
LeaseExpires: Cardinal;
end;
 
function GetAdaptersInfo(pAdapterInfo: PIP_ADAPTER_INFO; pOutBufLen: PULONG): DWORD; stdcall;
function GetNetworkParams(pFixedInfo: PFixedInfo; pOutBufLen: PULONG): DWORD; stdcall;
function SendArp(DestIP, SrcIP: ULONG; pMacAddr: PULONG; PhyAddrLen: PULONG) : DWORD; stdcall;
function GetIfTable(pIfTable: Pointer; var pdwSize: LongInt; bOrder: LongInt): LongInt; stdcall;
 
implementation
 
function GetAdaptersInfo; external IPHelper Name 'GetAdaptersInfo';
function GetNetworkParams; external IPHelper Name 'GetNetworkParams';
function SendArp; external IPHelper name 'SendARP';
function GetIfTable; external IPHelper Name 'GetIfTable';
 
end.
 
/tags/UserDetect2_Release_2.0/Plugins/LAN_MAC.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=LAN_MAC plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-LAN_MAC
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=LAN_MAC.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de
/tags/UserDetect2_Release_2.0/Plugins/GatewayIP.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=GatewayIP plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-GatewayIP
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=GatewayIP.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de
/tags/UserDetect2_Release_2.0/Plugins/SPGetSid.pas
0,0 → 1,159
(******************************************************************************)
(* SPGetSid - Retrieve the current user's SID in text format *)
(* *)
(* Copyright (c) 2004 Shorter Path Software *)
(* http://www.shorterpath.com *)
(******************************************************************************)
 
 
{
SID is a data structure of variable length that identifies user, group,
and computer accounts.
Every account on a network is issued a unique SID when the account is first created.
Internal processes in Windows refer to an account's SID
rather than the account's user or group name.
}
 
 
unit SPGetSid;
 
interface
 
uses
Windows, SysUtils;
 
function GetCurrentUserSid: string;
 
implementation
 
const
HEAP_ZERO_MEMORY = $00000008;
SID_REVISION = 1; // Current revision level
 
type
PTokenUser = ^TTokenUser;
TTokenUser = packed record
User: TSidAndAttributes;
end;
 
function ConvertSid(Sid: PSID; pszSidText: PChar; var dwBufferLen: DWORD): BOOL;
var
psia: PSIDIdentifierAuthority;
dwSubAuthorities: DWORD;
dwSidRev: DWORD;
dwCounter: DWORD;
dwSidSize: DWORD;
begin
Result := False;
 
dwSidRev := SID_REVISION;
 
if not IsValidSid(Sid) then Exit;
 
psia := GetSidIdentifierAuthority(Sid);
 
dwSubAuthorities := GetSidSubAuthorityCount(Sid)^;
 
dwSidSize := (15 + 12 + (12 * dwSubAuthorities) + 1) * SizeOf(Char);
 
if (dwBufferLen < dwSidSize) then
begin
dwBufferLen := dwSidSize;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
Exit;
end;
 
StrFmt(pszSidText, 'S-%u-', [dwSidRev]);
 
if (psia.Value[0] <> 0) or (psia.Value[1] <> 0) then
StrFmt(pszSidText + StrLen(pszSidText),
'0x%.2x%.2x%.2x%.2x%.2x%.2x',
[psia.Value[0], psia.Value[1], psia.Value[2],
psia.Value[3], psia.Value[4], psia.Value[5]])
else
StrFmt(pszSidText + StrLen(pszSidText),
'%u',
[DWORD(psia.Value[5]) +
DWORD(psia.Value[4] shl 8) +
DWORD(psia.Value[3] shl 16) +
DWORD(psia.Value[2] shl 24)]);
 
dwSidSize := StrLen(pszSidText);
 
for dwCounter := 0 to dwSubAuthorities - 1 do
begin
StrFmt(pszSidText + dwSidSize, '-%u',
[GetSidSubAuthority(Sid, dwCounter)^]);
dwSidSize := StrLen(pszSidText);
end;
 
Result := True;
end;
 
function ObtainTextSid(hToken: THandle; pszSid: PChar;
var dwBufferLen: DWORD): BOOL;
var
dwReturnLength: DWORD;
dwTokenUserLength: DWORD;
tic: TTokenInformationClass;
ptu: Pointer;
begin
Result := False;
dwReturnLength := 0;
dwTokenUserLength := 0;
tic := TokenUser;
ptu := nil;
 
if not GetTokenInformation(hToken, tic, ptu, dwTokenUserLength,
dwReturnLength) then
begin
if GetLastError = ERROR_INSUFFICIENT_BUFFER then
begin
ptu := HeapAlloc(GetProcessHeap, HEAP_ZERO_MEMORY, dwReturnLength);
if ptu = nil then Exit;
dwTokenUserLength := dwReturnLength;
dwReturnLength := 0;
 
if not GetTokenInformation(hToken, tic, ptu, dwTokenUserLength,
dwReturnLength) then Exit;
end
else
Exit;
end;
 
if not ConvertSid((PTokenUser(ptu).User).Sid, pszSid, dwBufferLen) then Exit;
 
if not HeapFree(GetProcessHeap, 0, ptu) then Exit;
 
Result := True;
end;
 
function GetCurrentUserSid: string;
var
hAccessToken: THandle;
bSuccess: BOOL;
dwBufferLen: DWORD;
szSid: array[0..260] of Char;
begin
Result := '';
 
bSuccess := OpenThreadToken(GetCurrentThread, TOKEN_QUERY, True,
hAccessToken);
if not bSuccess then
begin
if GetLastError = ERROR_NO_TOKEN then
bSuccess := OpenProcessToken(GetCurrentProcess, TOKEN_QUERY,
hAccessToken);
end;
if bSuccess then
begin
ZeroMemory(@szSid, SizeOf(szSid));
dwBufferLen := SizeOf(szSid);
 
if ObtainTextSid(hAccessToken, szSid, dwBufferLen) then
Result := szSid;
CloseHandle(hAccessToken);
end;
end;
 
end.
/tags/UserDetect2_Release_2.0/Plugins/DHCP_IP.dof
0,0 → 1,84
[FileVersion]
Version=6.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=1
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Version Info]
IncludeVerInfo=1
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=0
CodePage=1252
[Version Info Keys]
CompanyName=ViaThinkSoft
FileDescription=DHCP_IP plugin for UserDetect2
FileVersion=1.0.0.0
InternalName=UD2-DHCP_IP
LegalCopyright=(C) 2015 ViaThinkSoft
LegalTrademarks=
OriginalFilename=DHCP_IP.dll
ProductName=UserDetect2
ProductVersion=2.0.0.0
Website=www.viathinksoft.de
Project leader=Daniel Marschall - www.daniel-marschall.de