Subversion Repositories userdetect2

Rev

Rev 73 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 73 Rev 82
1
library DomainName;
1
library DomainName;
2
 
2
 
3
uses
3
uses
4
  Windows,
4
  Windows,
5
  SysUtils,
5
  SysUtils,
6
  Classes,
6
  Classes,
7
  Registry,
7
  Registry,
8
  networkutils in 'networkutils.pas',
8
  networkutils in 'networkutils.pas',
9
  UD2_PluginIntf in '..\UD2_PluginIntf.pas',
9
  UD2_PluginIntf in '..\UD2_PluginIntf.pas',
10
  UD2_PluginUtils in '..\UD2_PluginUtils.pas',
10
  UD2_PluginUtils in '..\UD2_PluginUtils.pas',
11
  UD2_PluginStatus in '..\UD2_PluginStatus.pas';
11
  UD2_PluginStatus in '..\UD2_PluginStatus.pas';
12
 
12
 
13
{$R *.res}
13
{$R *.res}
14
 
14
 
15
const
15
const
16
  PLUGIN_GUID: TGUID = '{6D7AABD7-C4A8-43ED-99E3-3AF4723DD7B2}';
16
  PLUGIN_GUID: TGUID = '{6D7AABD7-C4A8-43ED-99E3-3AF4723DD7B2}';
17
 
17
 
18
function PluginIdentifier: TGUID; cdecl;
18
function PluginIdentifier: TGUID; cdecl;
19
begin
19
begin
20
  result := PLUGIN_GUID;
20
  result := PLUGIN_GUID;
21
end;
21
end;
22
 
22
 
23
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
23
function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
24
var
24
var
25
  stIdentifier: WideString;
25
  stIdentifier: WideString;
26
begin
26
begin
-
 
27
  try
27
  if not GetDomainName(stIdentifier) then
28
    if not GetDomainName(stIdentifier) then
28
  begin
29
    begin
29
    result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
30
      result := UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED;
30
    Exit;
31
      Exit;
31
  end;
32
    end;
32
  result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
33
    result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier);
-
 
34
  except
-
 
35
    on E: Exception do result := UD2_STATUS_HandleException(E);
-
 
36
  end;
33
end;
37
end;
34
 
38
 
35
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
39
function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
36
var
40
var
37
  stPluginName: WideString;
41
  stPluginName: WideString;
38
  primaryLangID: Byte;
42
  primaryLangID: Byte;
39
begin
43
begin
40
  primaryLangID := wLangID and $00FF;
44
  primaryLangID := wLangID and $00FF;
41
  if primaryLangID = LANG_GERMAN then
45
  if primaryLangID = LANG_GERMAN then
42
    stPluginName := 'Domänen-Name'
46
    stPluginName := 'Domänen-Name'
43
  else
47
  else
44
    stPluginName := 'Domain name';
48
    stPluginName := 'Domain name';
45
  result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
49
  result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName);
46
end;
50
end;
47
 
51
 
48
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
52
function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
49
begin
53
begin
50
  result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
54
  result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft');
51
end;
55
end;
52
 
56
 
53
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
57
function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
54
begin
58
begin
55
  result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
59
  result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0');
56
end;
60
end;
57
 
61
 
58
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
62
function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl;
59
var
63
var
60
  stIdentificationMethodName: WideString;
64
  stIdentificationMethodName: WideString;
61
begin
65
begin
62
  stIdentificationMethodName := 'DomainName';
66
  stIdentificationMethodName := 'DomainName';
63
  result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
67
  result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName);
64
end;
68
end;
65
 
69
 
66
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
70
function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl;
67
begin
71
begin
68
  result := UD2_STATUS_OK_LICENSED;
72
  result := UD2_STATUS_OK_LICENSED;
69
end;
73
end;
70
 
74
 
71
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
75
function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl;
72
begin
76
begin
73
  // This function does not use non-generic status codes
77
  // This function does not use non-generic status codes
74
  result := FALSE;
78
  result := FALSE;
75
end;
79
end;
76
 
80
 
77
exports
81
exports
78
  PluginInterfaceID         name mnPluginInterfaceID,
82
  PluginInterfaceID         name mnPluginInterfaceID,
79
  PluginIdentifier          name mnPluginIdentifier,
83
  PluginIdentifier          name mnPluginIdentifier,
80
  PluginNameW               name mnPluginNameW,
84
  PluginNameW               name mnPluginNameW,
81
  PluginVendorW             name mnPluginVendorW,
85
  PluginVendorW             name mnPluginVendorW,
82
  PluginVersionW            name mnPluginVersionW,
86
  PluginVersionW            name mnPluginVersionW,
83
  IdentificationMethodNameW name mnIdentificationMethodNameW,
87
  IdentificationMethodNameW name mnIdentificationMethodNameW,
84
  IdentificationStringW     name mnIdentificationStringW,
88
  IdentificationStringW     name mnIdentificationStringW,
85
  CheckLicense              name mnCheckLicense,
89
  CheckLicense              name mnCheckLicense,
86
  DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
90
  DescribeOwnStatusCodeW    name mnDescribeOwnStatusCodeW;
87
 
91
 
88
end.
92
end.
89
 
93