[fpc-pascal]More strangeness...
L D Blake
ldblake at sympatico.ca
Fri Aug 29 23:19:08 CEST 2003
In reply to your message of August 29, 2003
> It could be the handle which is passed on the lost focus event.
That's what I'm thinking... a handle passed in LParam, which is defined as a
longint in the windows unit and thus in my code, causing a range checking error.
I've been looking further at that unit... So far I've caught about 115
references to longint that should be either Byte, Word or Longword values.
I'm still only looking at BASE.INC and I really dread the thought that it
might be through all the hundreds of function and record and type declarations
in the other files.
For example:
HANDLE = longint; { or should it be cardinal ?? PM }
HACCEL = HANDLE;
HBITMAP = HANDLE;
HBRUSH = HANDLE;
HCOLORSPACE = HANDLE;
HCONV = HANDLE;
HCONVLIST = HANDLE;
HCURSOR = HANDLE;
HDBC = HANDLE;
HDC = HANDLE;
HDDEDATA = HANDLE;
HDESK = HANDLE;
HDROP = HANDLE;
HDWP = HANDLE;
HENHMETAFILE = HANDLE;
HENV = HANDLE;
HFILE = HANDLE;
HFONT = HANDLE;
HGDIOBJ = HANDLE;
HGLOBAL = HANDLE;
HGLRC = HANDLE;
HHOOK = HANDLE;
HICON = HANDLE;
HIMAGELIST = HANDLE;
HINST = HANDLE; { Not HINSTANCE, else it has problems with the var HInstance }
HKEY = CARDINAL;
HKL = HANDLE;
HLOCAL = HANDLE;
HMENU = HANDLE;
HMETAFILE = HANDLE;
HMODULE = HANDLE;
HPALETTE = HANDLE;
HPEN = HANDLE;
HRASCONN = HANDLE;
HRESULT = HANDLE;
HRGN = HANDLE;
HRSRC = HANDLE;
HSTMT = HANDLE;
HSZ = HANDLE;
HWINSTA = HANDLE;
HWND = HANDLE;
HTASK = HANDLE;
LANGID = word;
LCID = DWORD;
LCTYPE = DWORD;
LPARAM = longint;
Which occupies lines 85 to 132 of the file. In another file, THandle is
defines as "Type THandle : handle;" Granted, there's only half a dozen changes
needed to fix this part... but look at the potential for chaos. Also, note the
comment made by the unit Author...
I also found functions defined with longints that, according to the SDK
should be Bytes, others that should be Words and others that should be
longwords.
For example, further down in the same file:
{ was #define dname(params) def_expr }
{ argument types are unknown }
function GetBValue(rgb : longint) : BYTE;
{ was #define dname(params) def_expr }
{ argument types are unknown }
function GetGValue(rgb : longint) : BYTE;
{ was #define dname(params) def_expr }
{ argument types are unknown }
function GetRValue(rgb : longint) : BYTE;
According to the SDK these should be:
Function GetBValue(RGB : LongWord) : Byte;
Function GetGValue(RGB : LongWord) : Byte;
Function GetRValue(RGB : LongWord) : Byte;
{ was #define dname(params) def_expr }
{ argument types are unknown }
function RGB(r,g,b : longint) : DWORD;
And according to the SDK this should be:
Function RGB(R,G,B : Byte) : LongWord;
These examples are all from one file... BASE.INC. Lord only knows how many
*hundreds* of these mistakes there are in the other files!
>> I wasn't able to get a test compile out of the unit last night (it bombs out
>> at line 255 of Base.inc, in the "enumeratons" section) and there's no point
>> swimming through all that code until I do.
>>
>> If anyone knows the correct setup for re-compiling the windows and mmsystem
>> units could you please let me know... Thanks.
> Unfortunately, the Windows unit is very basic. Short of the system unit,
> almost all other RTL units are based on it. You have no choice but to
> compile the RTL, using make...
OK... not having done such an extensive job in FP before, I would really
appreciate some step by step instructions. I tried recompiling last night and
it just kept bombing out on this:
ACL_INFORMATION_CLASS = (AclRevisionInformation := 1,AclSizeInformation);
(BASE.INC Line: 259)
So... how do I get this to work???
1) Move the following directories and files to a separate location...
2) ... ???
I don't mind putting in the time and effort to go though this and correct the
problems (at least the ones I can find), and I have no reservation about
sharing the result with everyone... but I sure could use a little help with
the correct compiling process to follow.
<G> It's not worth a darn if I can't compile it...
(Thanks in advance)
-----
L D Blake
More information about the fpc-pascal
mailing list