Rev 68 | 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 DHCP_MAC; |
2 | |||
3 | uses |
||
4 | Windows, |
||
5 | SysUtils, |
||
6 | Classes, |
||
7 | UD2_PluginIntf in '..\UD2_PluginIntf.pas', |
||
8 | UD2_PluginUtils in '..\UD2_PluginUtils.pas', |
||
9 | NetworkUtils in 'NetworkUtils.pas'; |
||
10 | |||
11 | {$R *.res} |
||
12 | |||
13 | const |
||
14 | PLUGIN_GUID: TGUID = '{574F8C7F-318E-4FA9-96CE-5A6F1FAE67FD}'; |
||
15 | |||
16 | function PluginIdentifier: TGUID; cdecl; |
||
17 | begin |
||
18 | result := PLUGIN_GUID; |
||
19 | end; |
||
20 | |||
69 | daniel-mar | 21 | function IdentificationStringW(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl; |
68 | daniel-mar | 22 | var |
23 | sl, sl2: TStringList; |
||
24 | i: integer; |
||
25 | ip, mac: string; |
||
26 | begin |
||
27 | sl := TStringList.Create; |
||
28 | sl2 := TStringList.Create; |
||
29 | try |
||
30 | GetDHCPIPAddressList(sl); |
||
31 | for i := 0 to sl.Count-1 do |
||
32 | begin |
||
33 | ip := sl.Strings[i]; |
||
34 | if (GetMACAddress(ip, mac) = S_OK) and |
||
35 | (mac <> '') and |
||
36 | (sl2.IndexOf(mac) = -1) then |
||
37 | begin |
||
38 | sl2.add(mac); |
||
39 | end; |
||
40 | end; |
||
69 | daniel-mar | 41 | result := UD2_WriteStringListToPointerW(lpIdentifier, cchSize, sl2); |
68 | daniel-mar | 42 | finally |
43 | sl.Free; |
||
44 | sl2.Free; |
||
45 | end; |
||
46 | end; |
||
47 | |||
69 | daniel-mar | 48 | function PluginNameW(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl; |
68 | daniel-mar | 49 | var |
50 | stPluginName: WideString; |
||
51 | primaryLangID: Byte; |
||
52 | begin |
||
53 | primaryLangID := wLangID and $00FF; |
||
54 | if primaryLangID = LANG_GERMAN then |
||
55 | stPluginName := 'MAC-Adressen der DHCP-Server' |
||
56 | else |
||
57 | stPluginName := 'DHCP MAC addresses'; |
||
69 | daniel-mar | 58 | result := UD2_WritePascalStringToPointerW(lpPluginName, cchSize, stPluginName); |
68 | daniel-mar | 59 | end; |
60 | |||
69 | daniel-mar | 61 | function PluginVendorW(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl; |
68 | daniel-mar | 62 | begin |
69 | daniel-mar | 63 | result := UD2_WritePascalStringToPointerW(lpPluginVendor, cchSize, 'ViaThinkSoft'); |
68 | daniel-mar | 64 | end; |
65 | |||
69 | daniel-mar | 66 | function PluginVersionW(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl; |
68 | daniel-mar | 67 | begin |
69 | daniel-mar | 68 | result := UD2_WritePascalStringToPointerW(lpPluginVersion, cchSize, '1.0'); |
68 | daniel-mar | 69 | end; |
70 | |||
69 | daniel-mar | 71 | function IdentificationMethodNameW(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl; |
68 | daniel-mar | 72 | var |
73 | stIdentificationMethodName: WideString; |
||
74 | begin |
||
75 | stIdentificationMethodName := 'DHCP_MAC'; |
||
69 | daniel-mar | 76 | result := UD2_WritePascalStringToPointerW(lpIdentificationMethodName, cchSize, stIdentificationMethodName); |
68 | daniel-mar | 77 | end; |
78 | |||
69 | daniel-mar | 79 | function CheckLicense(lpReserved: LPVOID): UD2_STATUS; cdecl; |
68 | daniel-mar | 80 | begin |
69 | daniel-mar | 81 | result := UD2_STATUS_OK_LICENSED; |
68 | daniel-mar | 82 | end; |
83 | |||
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, |
||
92 | CheckLicense name mnCheckLicense; |
||
93 | |||
94 | end. |