Subversion Repositories userdetect2

Rev

Rev 81 | Details | Compare with Previous | Last modification | View Log | RSS feed

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