Rev 69 | Rev 71 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
68 | daniel-mar | 1 | unit UD2_PluginIntf; |
2 | |||
3 | interface |
||
4 | |||
5 | {$IF CompilerVersion >= 25.0} |
||
6 | {$LEGACYIFEND ON} |
||
7 | {$IFEND} |
||
8 | |||
9 | uses |
||
69 | daniel-mar | 10 | Windows, SysUtils; |
68 | daniel-mar | 11 | |
12 | const |
||
13 | GUID_USERDETECT2_IDPLUGIN_V1: TGUID = '{6C26245E-F79A-416C-8C73-BEA3EC18BB6E}'; |
||
14 | |||
15 | const |
||
16 | mnPluginInterfaceID = 'PluginInterfaceID'; |
||
17 | mnPluginIdentifier = 'PluginIdentifier'; |
||
18 | mnPluginNameW = 'PluginNameW'; |
||
19 | mnPluginVersionW = 'PluginVersionW'; |
||
20 | mnPluginVendorW = 'PluginVendorW'; |
||
21 | mnCheckLicense = 'CheckLicense'; |
||
22 | mnIdentificationMethodNameW = 'IdentificationMethodNameW'; |
||
23 | mnIdentificationStringW = 'IdentificationStringW'; |
||
70 | daniel-mar | 24 | mnDescribeOwnStatusCodeW = 'DescribeOwnStatusCodeW'; |
68 | daniel-mar | 25 | |
26 | {$IF not Declared(LPVOID)} |
||
27 | type |
||
28 | LPVOID = Pointer; |
||
29 | {$IFEND} |
||
30 | |||
31 | type |
||
69 | daniel-mar | 32 | UD2_STATUS = DWORD; |
33 | UD2_STATUSCAT = $0..$F; |
||
34 | UD2_STATUSAUTH = $000..$FFF; |
||
35 | UD2_STATUSMSG = $0000..$FFFF; |
||
68 | daniel-mar | 36 | |
37 | const |
||
69 | daniel-mar | 38 | UD2_STATUSCAT_SUCCESS : UD2_STATUSCAT = $8; |
39 | UD2_STATUSCAT_NOT_AVAIL : UD2_STATUSCAT = $9; |
||
40 | UD2_STATUSCAT_ERROR : UD2_STATUSCAT = $A; |
||
68 | daniel-mar | 41 | |
69 | daniel-mar | 42 | UD2_STATUSAUTH_GENERIC : UD2_STATUSAUTH = $100; |
43 | |||
44 | UD2_STATUS_OK_UNSPECIFIED : UD2_STATUS = $81000000; |
||
45 | UD2_STATUS_OK_SINGLELINE : UD2_STATUS = $81000001; |
||
46 | UD2_STATUS_OK_MULTILINE : UD2_STATUS = $81000002; |
||
47 | UD2_STATUS_OK_LICENSED : UD2_STATUS = $81000003; |
||
48 | |||
49 | UD2_STATUS_NOTAVAIL_UNSPECIFIED : UD2_STATUS = $91000000; |
||
50 | UD2_STATUS_NOTAVAIL_OS_NOT_SUPPORTED : UD2_STATUS = $91000001; |
||
51 | UD2_STATUS_NOTAVAIL_HW_NOT_SUPPORTED : UD2_STATUS = $91000002; |
||
52 | UD2_STATUS_NOTAVAIL_NO_ENTITIES : UD2_STATUS = $91000003; |
||
53 | UD2_STATUS_NOTAVAIL_API_CALL_FAILURE : UD2_STATUS = $91000004; |
||
54 | |||
55 | UD2_STATUS_ERROR_UNSPECIFIED : UD2_STATUS = $A1000000; |
||
56 | UD2_STATUS_ERROR_BUFFER_TOO_SMALL : UD2_STATUS = $A1000001; |
||
57 | UD2_STATUS_ERROR_INVALID_ARGS : UD2_STATUS = $A1000002; |
||
58 | UD2_STATUS_ERROR_PLUGIN_NOT_LICENSED : UD2_STATUS = $A1000003; |
||
59 | |||
60 | function UD2_STATUS_Construct(cat: UD2_STATUSCAT; |
||
61 | auth: UD2_STATUSAUTH; msg: UD2_STATUSMSG): UD2_STATUS; |
||
62 | function UD2_STATUS_GetCategory(dwStatus: UD2_STATUS): UD2_STATUSCAT; |
||
63 | function UD2_STATUS_GetAuthority(dwStatus: UD2_STATUS): UD2_STATUSAUTH; |
||
64 | function UD2_STATUS_GetMessage(dwStatus: UD2_STATUS): UD2_STATUSMSG; |
||
65 | function UD2_STATUS_Successful(dwStatus: UD2_STATUS): boolean; |
||
66 | function UD2_STATUS_NotAvail(dwStatus: UD2_STATUS): boolean; |
||
67 | function UD2_STATUS_Failed(dwStatus: UD2_STATUS): boolean; |
||
68 | function UD2_STATUS_FormatStatusCode(dwStatus: UD2_STATUS): string; |
||
69 | function UD2_STATUS_IsSpecific(dwStatus: UD2_STATUS): boolean; |
||
70 | |||
68 | daniel-mar | 71 | type |
72 | TFuncPluginInterfaceID = function(): TGUID; cdecl; |
||
73 | TFuncPluginIdentifier = function(): TGUID; cdecl; |
||
69 | daniel-mar | 74 | TFuncPluginNameW = function(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl; |
75 | TFuncPluginVersionW = function(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl; |
||
76 | TFuncPluginVendorW = function(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl; |
||
77 | TFuncCheckLicense = function(lpReserved: LPVOID): UD2_STATUS; cdecl; |
||
78 | TFuncIdentificationMethodNameW = function(lpIdentificationMethodName: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl; |
||
79 | TFuncIdentificationStringW = function(lpIdentifier: LPWSTR; cchSize: DWORD): UD2_STATUS; cdecl; |
||
70 | daniel-mar | 80 | TFuncDescribeOwnStatusCodeW = function(lpErrorDescription: LPWSTR; cchSize: DWORD; statusCode: UD2_STATUS; wLangID: LANGID): BOOL; cdecl; |
68 | daniel-mar | 81 | |
82 | const |
||
83 | UD2_MULTIPLE_ITEMS_DELIMITER = #10; |
||
84 | |||
85 | function PluginInterfaceID: TGUID; cdecl; |
||
86 | |||
87 | implementation |
||
88 | |||
69 | daniel-mar | 89 | function UD2_STATUS_Construct(cat: UD2_STATUSCAT; |
90 | auth: UD2_STATUSAUTH; msg: UD2_STATUSMSG): UD2_STATUS; |
||
91 | begin |
||
92 | result := (cat shl 28) + (auth shl 16) + msg; |
||
93 | end; |
||
94 | |||
95 | function UD2_STATUS_GetCategory(dwStatus: UD2_STATUS): UD2_STATUSCAT; |
||
96 | begin |
||
97 | result := (dwStatus and $F0000000) shr 28; |
||
98 | end; |
||
99 | |||
100 | function UD2_STATUS_GetAuthority(dwStatus: UD2_STATUS): UD2_STATUSAUTH; |
||
101 | begin |
||
102 | result := (dwStatus and $0FFF0000) shr 16; |
||
103 | end; |
||
104 | |||
105 | function UD2_STATUS_GetMessage(dwStatus: UD2_STATUS): UD2_STATUSMSG; |
||
106 | begin |
||
107 | result := dwStatus and $0000FFFF; |
||
108 | end; |
||
109 | |||
110 | function UD2_STATUS_Successful(dwStatus: UD2_STATUS): boolean; |
||
111 | begin |
||
112 | result := UD2_STATUS_GetCategory(dwStatus) = UD2_STATUSCAT_SUCCESS; |
||
113 | end; |
||
114 | |||
115 | function UD2_STATUS_NotAvail(dwStatus: UD2_STATUS): boolean; |
||
116 | begin |
||
117 | result := UD2_STATUS_GetCategory(dwStatus) = UD2_STATUSCAT_NOT_AVAIL; |
||
118 | end; |
||
119 | |||
120 | function UD2_STATUS_Failed(dwStatus: UD2_STATUS): boolean; |
||
121 | begin |
||
122 | result := UD2_STATUS_GetCategory(dwStatus) = UD2_STATUSCAT_ERROR; |
||
123 | end; |
||
124 | |||
125 | function UD2_STATUS_FormatStatusCode(dwStatus: UD2_STATUS): string; |
||
126 | begin |
||
127 | result := IntToHex(UD2_STATUS_GetCategory(dwStatus), 1) + ' ' + |
||
128 | IntToHex(UD2_STATUS_GetAuthority(dwStatus), 3) + ' ' + |
||
129 | IntToHex(UD2_STATUS_GetMessage(dwStatus), 4); |
||
130 | end; |
||
131 | |||
132 | function UD2_STATUS_IsSpecific(dwStatus: UD2_STATUS): boolean; |
||
133 | begin |
||
134 | result := (dwStatus and $0000FFFF) <> 0; |
||
135 | end; |
||
136 | |||
68 | daniel-mar | 137 | function PluginInterfaceID: TGUID; cdecl; |
138 | begin |
||
139 | result := GUID_USERDETECT2_IDPLUGIN_V1; |
||
140 | end; |
||
141 | |||
142 | end. |