What are the list of all possible values for DVCLAL?
What are the list of all possible values for DVCLAL?
I was reading SysUtils when I came across with this function:
function ALR: Pointer;
var
LibModule: PLibModule;
begin
if MainInstance <> 0 then
Result := Pointer(LoadResource(MainInstance, FindResource(MainInstance, 'DVCLAL',
RT_RCDATA)))
else
begin
After that, I searched what is DVCLAL and I've found this question.
What are all the possible signatures that Delphi compiler emits to the DVCLAL resource?
2 Answers
2
There is no official documentation on this, so here is something from my notes of 15+ years ago:
The DVCLAL
is there to check which SKU of Delphi you are using and it varies per SKU.
DVCLAL
There are only checks for the Professional (RPR
) and Client/Server (RCS
) SKUs:
RPR
RCS
procedure RCS;
procedure RPR;
If they fail, they call this method:
procedure ALV;
begin
raise Exception.CreateRes(@SNL);
end;
where
resourcestring
SNL = 'Application is not licensed to use this feature';
Depending on the feature matrix and Delphi version, various components call RPR
and RCS
in their Create
constructors to guarantee a minimum SKU.
RPR
RCS
Create
There is not even a non official documentation?
– EProgrammerNotFound
Sep 11 '13 at 11:40
@MatheusFreitas now there is (;
– Jeroen Wiert Pluimers
Sep 11 '13 at 14:15
I am just adding another answer to this question, for all the people who search the for actual DVCLAL (Delphi Visual Component Library Access License) values, as well as some other information for all people who are curious how stuff works.
1) Like Jeroen Wiert Pluimers said, if you want to check for "Professional or higher" or "Enterprise only" inside your Delphi application/library/package/component, you can use RPR
(Require Professional) or RCS
("Require Client/Server"; Client/Server was the name for the Enterprise edition in early Delphi versions) respectively. If the requirement is not met, ALV
(Access License Violation) will be called which will raise an Exception
with the message defined in SysConst.SNL
(S Not Licensed). In English:
RPR
RCS
ALV
Exception
SysConst.SNL
Application is not licensed to use this feature
2) In case you want to check for one specific edition, you can use the output of the function GDAL
(Get Delphi Access License), which is one of the following (AL1s
array):
GDAL
AL1s
AL1s[0] = $FFFFFFF0; // Standard/Personal edition DVCLAL value
AL1s[1] = $FFFFEBF0; // Professional edition DVCLAL value
AL1s[2] = $00000000; // Enterprise/ClientServer edition DVCLAL value
AL1s[3] = $FFFFFFFF; // DVCLAL resource not existing
if the DVCLAL resource has an invalid value, GDAL
will call ALV
which will raise an Exception
with message SysConst.SNL
.
GDAL
ALV
Exception
SysConst.SNL
3) In case you want to check the DVCLAL value of a foreign EXE/DLL file (e.g. if you want to write a Resource Editor, decompiler etc), then you'll have to query the DVCLAL resource directly.
There are only three official values:
Standard: 23 78 5D 23 B6 A5 F3 19 43 F3 40 02 26 D1 11 C7
Professional: A2 8C DF 98 7B 3C 3A 79 26 71 3F 09 0F 2A 25 17
Enterprise: 26 3D 4F 38 C2 82 37 B8 F3 24 42 03 17 9B 3A 83
4) Just for fun: If you solve the formula 0 = (ROR(a,15) xor a) xor (ROR(b,10) xor b) xor (ROR(c,5) xor c) xor (AL1 xor AL2)
you can define any DVCLAL value (tuple a, b, c, d) you want! (AL1
and AL2
are the values in the AL1s
and AL2s
arrays which describe the desired Delphi edition; ROR
is rotate right through carry)
0 = (ROR(a,15) xor a) xor (ROR(b,10) xor b) xor (ROR(c,5) xor c) xor (AL1 xor AL2)
AL1
AL2
AL1s
AL2s
ROR
For example, here are alternative DVCLALs which work too:
Standard: 00 00 00 00 00 00 00 00 9B 70 0C 66 6B 8F F3 99
Professional: 00 00 00 00 00 00 00 00 9A DB 73 0F 6A 30 8C F0
Enterprise: 00 00 00 00 00 00 00 00 D8 B2 48 11 D8 B2 48 11
To validate a DVCLAL, you calculate
AL1 := DVCLAL[0] xor DVCLAL[1] xor DVCLAL[2] xor DVCLAL[3];
AL2 := ROR(DVCLAL[0],15) xor ROR(DVCLAL[1],10) xor ROR(DVCLAL[2],5) xor DVCLAL[3];
and look up AL1 and AL2 in the array AL1s
and AL2s
,
AL1s
AL2s
This way you can disguise the edition you have used a little.
5) In the meantime, an official documentation, at least for the functions GDAL, RPR and RCS, has been published.
6) Of course, everything works for C++ Builder, too.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
It is not very clear what is your real question.
– Free Consulting
Sep 10 '13 at 13:59