Subversion Repositories userdetect2

Rev

Rev 70 | Rev 81 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 70 Rev 71
Line 5... Line 5...
5
{$IF CompilerVersion >= 25.0}
5
{$IF CompilerVersion >= 25.0}
6
{$LEGACYIFEND ON}
6
{$LEGACYIFEND ON}
7
{$IFEND}
7
{$IFEND}
8
 
8
 
9
uses
9
uses
10
  Windows, SysUtils;
10
  Windows, SysUtils, UD2_PluginStatus;
11
 
11
 
12
const
12
const
13
  GUID_USERDETECT2_IDPLUGIN_V1: TGUID = '{6C26245E-F79A-416C-8C73-BEA3EC18BB6E}';
13
  GUID_USERDETECT2_IDPLUGIN_V1: TGUID = '{6C26245E-F79A-416C-8C73-BEA3EC18BB6E}';
14
 
14
 
15
const
15
const
Line 27... Line 27...
27
type
27
type
28
  LPVOID = Pointer;
28
  LPVOID = Pointer;
29
{$IFEND}
29
{$IFEND}
30
 
30
 
31
type
31
type
32
  UD2_STATUS = DWORD;
-
 
33
  UD2_STATUSCAT = $0..$F;
-
 
34
  UD2_STATUSAUTH = $000..$FFF;
-
 
35
  UD2_STATUSMSG = $0000..$FFFF;
-
 
36
 
-
 
37
const
-
 
38
  UD2_STATUSCAT_SUCCESS   : UD2_STATUSCAT = $8;
-
 
39
  UD2_STATUSCAT_NOT_AVAIL : UD2_STATUSCAT = $9;        
-
 
40
  UD2_STATUSCAT_ERROR     : UD2_STATUSCAT = $A;
-
 
41
 
-
 
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
 
-
 
71
type
-
 
72
  TFuncPluginInterfaceID = function(): TGUID; cdecl;
32
  TFuncPluginInterfaceID = function(): TGUID; cdecl;
73
  TFuncPluginIdentifier = function(): TGUID; cdecl;
33
  TFuncPluginIdentifier = function(): TGUID; cdecl;
74
  TFuncPluginNameW = function(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
34
  TFuncPluginNameW = function(lpPluginName: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
75
  TFuncPluginVersionW = function(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
35
  TFuncPluginVersionW = function(lpPluginVersion: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
76
  TFuncPluginVendorW = function(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
36
  TFuncPluginVendorW = function(lpPluginVendor: LPWSTR; cchSize: DWORD; wLangID: LANGID): UD2_STATUS; cdecl;
Line 84... Line 44...
84
 
44
 
85
function PluginInterfaceID: TGUID; cdecl;
45
function PluginInterfaceID: TGUID; cdecl;
86
 
46
 
87
implementation
47
implementation
88
 
48
 
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
 
-
 
137
function PluginInterfaceID: TGUID; cdecl;
49
function PluginInterfaceID: TGUID; cdecl;
138
begin
50
begin
139
  result := GUID_USERDETECT2_IDPLUGIN_V1;
51
  result := GUID_USERDETECT2_IDPLUGIN_V1;
140
end;
52
end;
141
 
53