Rev 70 | Rev 81 | Go to most recent revision | 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, |
||
7 | UD2_PluginIntf in '..\UD2_PluginIntf.pas', |
||
71 | daniel-mar | 8 | UD2_PluginUtils in '..\UD2_PluginUtils.pas', |
9 | UD2_PluginStatus in '..\UD2_PluginStatus.pas'; |
||
68 | daniel-mar | 10 | |
11 | {$R *.res} |
||
12 | |||
13 | const |
||
14 | PLUGIN_GUID: TGUID = '{2AD004FF-6BFD-4038-B75B-9527DEABA28F}'; |
||
15 | |||
16 | function PluginIdentifier: TGUID; cdecl; |
||
17 | begin |
||
18 | result := PLUGIN_GUID; |
||
19 | end; |
||
20 | |||
21 | function GetComputerName: string; |
||
22 | // http://www.delphi-treff.de/tipps-tricks/netzwerkinternet/netzwerkeigenschaften/computernamen-des-eigenen-rechners-ermitteln/ |
||
23 | var |
||
24 | Len: DWORD; |
||
25 | begin |
||
26 | Len := MAX_COMPUTERNAME_LENGTH+1; |
||
27 | SetLength(Result,Len); |
||
28 | if Windows.GetComputerName(PChar(Result), Len) then |
||
29 | SetLength(Result,Len) |
||
30 | else |
||
31 | RaiseLastOSError; |
||
32 | end; |
||
33 | |||
69 | daniel-mar | 34 | function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl; |
68 | daniel-mar | 35 | var |
36 | stIdentifier: WideString; |
||
37 | begin |
||
38 | stIdentifier := GetComputerName; |
||
69 | daniel-mar | 39 | result := UD2_WritePascalStringToPointerW(lpIdentifier, cchSize, stIdentifier); |
68 | daniel-mar | 40 | end; |
41 | |||
69 | daniel-mar | 42 | function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl; |
68 | daniel-mar | 43 | var |
44 | stPluginName: WideString; |
||
45 | primaryLangID: Byte; |
||
46 | begin |
||
47 | primaryLangID := wLangID and $00FF; |
||
48 | if primaryLangID = LANG_GERMAN then |
||
49 | stPluginName := 'Computer-Name' |
||
50 | else |
||
51 | stPluginName := 'Computer name'; |
||
69 | daniel-mar | 52 | result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName); |
68 | daniel-mar | 53 | end; |
54 | |||
69 | daniel-mar | 55 | function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl; |
68 | daniel-mar | 56 | begin |
69 | daniel-mar | 57 | result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft'); |
68 | daniel-mar | 58 | end; |
59 | |||
69 | daniel-mar | 60 | function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl; |
68 | daniel-mar | 61 | begin |
69 | daniel-mar | 62 | result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0'); |
68 | daniel-mar | 63 | end; |
64 | |||
69 | daniel-mar | 65 | function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl; |
68 | daniel-mar | 66 | var |
67 | stIdentificationMethodName: WideString; |
||
68 | begin |
||
69 | stIdentificationMethodName := 'ComputerName'; |
||
69 | daniel-mar | 70 | result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName); |
68 | daniel-mar | 71 | end; |
72 | |||
69 | daniel-mar | 73 | function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl; |
68 | daniel-mar | 74 | begin |
69 | daniel-mar | 75 | result := UD2_STATUS_OK_LICENSED; |
68 | daniel-mar | 76 | end; |
77 | |||
70 | daniel-mar | 78 | function DescribeOwnStatusCodeW(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl; |
79 | begin |
||
80 | // This function does not use non-generic status codes |
||
81 | result := FALSE; |
||
82 | end; |
||
83 | |||
68 | daniel-mar | 84 | exports |
85 | PluginInterfaceID name mnPluginInterfaceID, |
||
86 | PluginIdentifier name mnPluginIdentifier, |
||
87 | PluginNameW name mnPluginNameW, |
||
88 | PluginVendorW name mnPluginVendorW, |
||
89 | PluginVersionW name mnPluginVersionW, |
||
90 | IdentificationMethodNameW name mnIdentificationMethodNameW, |
||
91 | IdentificationStringW name mnIdentificationStringW, |
||
70 | daniel-mar | 92 | CheckLicense name mnCheckLicense, |
93 | DescribeOwnStatusCodeW name mnDescribeOwnStatusCodeW; |
||
68 | daniel-mar | 94 | |
95 | end. |