jwawindows corrupts size of DHCPCAPI_PARAMS in jwadhcpcsdk in 64bit
- Lazarus/FPC Version: Lazarus 2.2.4 (rev lazarus_2_2_4) FPC 3.2.2 x86_64-win64-win32/win64
- Operating System: Windows
- CPU / Bitness: 64 Bit
What happens
When compiling for Target WIN64, CPU CPU64, but using jwawindows SizeOf(DHCPCAPI_PARAMS)=24 SizeOf(DHCPCAPI_PARAMS_ARRAY)=12 which is NOT correct (the results should be 32 and 16)
What did you expect
When compiling for Target WIN64, CPU CPU64, using jwadhcpcsdk I get: SizeOf(DHCPCAPI_PARAMS)=32 SizeOf(DHCPCAPI_PARAMS_ARRAY)=16 That is the correct size - which also should be the result, when i use jwawindows
It seemes, that the use of jwawindows somehow changes the structure of the record in jwadhcpcsdk to a packed record. I have tried to insert {$PACKRECORDS C} before the definition af the record i jwadhcpcsdk and recompile Jedi. In that case it works with the unit jwawindows, but I have no idea, if this wil cause any unwanted sideeffects.
BTW, with Target WIN32, CPU CPU32 i get the same correct result with both jwawindows and jwadhcpcsdk:
SizeOf(DHCPCAPI_PARAMS)=20
SizeOf(DHCPCAPI_PARAMS_ARRAY)=8
Steps to reproduce
program Project1;
uses JwaWindows,SysUtils;
var
SendParams: DHCPCAPI_PARAMS_ARRAY;
optionparam: DHCPCAPI_PARAMS;
begin
WriteLn(Format('SizeOf DHCPCAPI_PARAMS: %D', [SizeOf(DHCPCAPI_PARAMS)]));
WriteLn(Format('SizeOf DHCPCAPI_PARAMS_ARRAY: %D', [SizeOf(DHCPCAPI_PARAMS_ARRAY)]));
readln;
end.
Compile and run in 64bit windows - the output is:
SizeOf DHCPCAPI_PARAMS: 24
SizeOf DHCPCAPI_PARAMS_ARRAY: 12
Change
uses JwaWindows,SysUtils;
to
uses jwadhcpcsdk,SysUtils
;
and add C:\lazarus\fpc\3.2.2\source\packages\winunits-jedi\src to the projects unit search path.
compile and run gives the correct output :
outputs:
SizeOf DHCPCAPI_PARAMS: 32
SizeOf DHCPCAPI_PARAMS_ARRAY: 16