+ import the win16 debug apis

git-svn-id: trunk@31538 -
This commit is contained in:
nickysn 2015-09-05 20:45:22 +00:00
parent 1b84fbee57
commit 4d43d8d909
3 changed files with 178 additions and 0 deletions

View File

@ -1,5 +1,7 @@
unit win31;
{$MODE objfpc}
interface
uses
@ -10,8 +12,162 @@ const
GFSR_GDIRESOURCES = $0001;
GFSR_USERRESOURCES = $0002;
{****** LogParamError/LogError values *}
{ Error modifier bits }
ERR_WARNING = $8000;
ERR_PARAM = $4000;
ERR_SIZE_MASK = $3000;
ERR_BYTE = $1000;
ERR_WORD = $2000;
ERR_DWORD = $3000;
{****** LogParamError() values *}
{ Generic parameter values }
ERR_BAD_VALUE = $6001;
ERR_BAD_FLAGS = $6002;
ERR_BAD_INDEX = $6003;
ERR_BAD_DVALUE = $7004;
ERR_BAD_DFLAGS = $7005;
ERR_BAD_DINDEX = $7006;
ERR_BAD_PTR = $7007;
ERR_BAD_FUNC_PTR = $7008;
ERR_BAD_SELECTOR = $6009;
ERR_BAD_STRING_PTR = $700a;
ERR_BAD_HANDLE = $600b;
{ KERNEL parameter errors }
ERR_BAD_HINSTANCE = $6020;
ERR_BAD_HMODULE = $6021;
ERR_BAD_GLOBAL_HANDLE = $6022;
ERR_BAD_LOCAL_HANDLE = $6023;
ERR_BAD_ATOM = $6024;
ERR_BAD_HFILE = $6025;
{ USER parameter errors }
ERR_BAD_HWND = $6040;
ERR_BAD_HMENU = $6041;
ERR_BAD_HCURSOR = $6042;
ERR_BAD_HICON = $6043;
ERR_BAD_HDWP = $6044;
ERR_BAD_CID = $6045;
ERR_BAD_HDRVR = $6046;
{ GDI parameter errors }
ERR_BAD_COORDS = $7060;
ERR_BAD_GDI_OBJECT = $6061;
ERR_BAD_HDC = $6062;
ERR_BAD_HPEN = $6063;
ERR_BAD_HFONT = $6064;
ERR_BAD_HBRUSH = $6065;
ERR_BAD_HBITMAP = $6066;
ERR_BAD_HRGN = $6067;
ERR_BAD_HPALETTE = $6068;
ERR_BAD_HMETAFILE = $6069;
{**** LogError() values *}
{ KERNEL errors }
ERR_GALLOC = $0001;
ERR_GREALLOC = $0002;
ERR_GLOCK = $0003;
ERR_LALLOC = $0004;
ERR_LREALLOC = $0005;
ERR_LLOCK = $0006;
ERR_ALLOCRES = $0007;
ERR_LOCKRES = $0008;
ERR_LOADMODULE = $0009;
{ USER errors }
ERR_CREATEDLG2 = $0041;
ERR_CREATEDLG = $0040;
ERR_REGISTERCLASS = $0042;
ERR_DCBUSY = $0043;
ERR_CREATEWND = $0044;
ERR_STRUCEXTRA = $0045;
ERR_LOADSTR = $0046;
ERR_LOADMENU = $0047;
ERR_NESTEDBEGINPAINT = $0048;
ERR_BADINDEX = $0049;
ERR_CREATEMENU = $004a;
{ GDI errors }
ERR_CREATEDC = $0080;
ERR_CREATEMETA = $0081;
ERR_DELOBJSELECTED = $0082;
ERR_SELBITMAP = $0083;
type
{ Debugging support (DEBUG SYSTEM ONLY) }
LPWINDEBUGINFO = ^WINDEBUGINFO; far;
WINDEBUGINFO = record
flags: UINT;
dwOptions: DWORD;
dwFilter: DWORD;
achAllocModule: array [0..7] of char;
dwAllocBreak: DWORD;
dwAllocCount: DWORD;
end;
PWinDebugInfo = ^TWinDebugInfo;
TWinDebugInfo = WINDEBUGINFO;
const
{ WINDEBUGINFO flags values }
WDI_OPTIONS = $0001;
WDI_FILTER = $0002;
WDI_ALLOCBREAK = $0004;
{ dwOptions values }
DBO_CHECKHEAP = $0001;
DBO_BUFFERFILL = $0004;
DBO_DISABLEGPTRAPPING = $0010;
DBO_CHECKFREE = $0020;
DBO_SILENT = $8000;
DBO_TRACEBREAK = $2000;
DBO_WARNINGBREAK = $1000;
DBO_NOERRORBREAK = $0800;
DBO_NOFATALBREAK = $0400;
DBO_INT3BREAK = $0100;
{ DebugOutput flags values }
DBF_TRACE = $0000;
DBF_WARNING = $4000;
DBF_ERROR = $8000;
DBF_FATAL = $c000;
{ dwFilter values }
DBF_KERNEL = $1000;
DBF_KRN_MEMMAN = $0001;
DBF_KRN_LOADMODULE = $0002;
DBF_KRN_SEGMENTLOAD = $0004;
DBF_USER = $0800;
DBF_GDI = $0400;
DBF_MMSYSTEM = $0040;
DBF_PENWIN = $0020;
DBF_APPLICATION = $0008;
DBF_DRIVER = $0010;
{ ExitWindows values }
EW_REBOOTSYSTEM = $43;
function GetFreeSystemResources(SysResource: UINT): UINT; external 'USER';
procedure LogError(err: UINT; lpInfo: FarPointer); external 'KERNEL';
procedure LogParamError(err: UINT; lpfn: FARPROC; param: FarPointer); external 'KERNEL';
function GetWinDebugInfo(lpwdi: LPWINDEBUGINFO; flags: UINT): BOOL; external 'KERNEL';
function SetWinDebugInfo(lpwdi: LPWINDEBUGINFO): BOOL; external 'KERNEL';
procedure DebugOutput(flags: UINT; lpsz: LPCSTR; etc: array of const); cdecl; external 'KERNEL' name '_DebugOutput';
function ExitWindowsExec(Exe, Params: LPCSTR): BOOL; external 'USER';
implementation
end.

View File

@ -39,6 +39,17 @@ function GetCurrentTime: DWORD; external 'USER';
function GetTickCount: DWORD; external 'USER';
function GetTimerResolution: DWORD; external 'USER';
{ Error handling }
procedure FatalExit(Code: SmallInt); external 'KERNEL';
procedure FatalAppExit(Action: UINT; MessageText: LPCSTR); external 'KERNEL';
function ExitWindows(dwReturnCode: DWORD; wReserved: UINT): BOOL; external 'USER';
procedure DebugBreak; external 'KERNEL';
procedure OutputDebugString(OutputString: LPCSTR); external 'KERNEL';
function SetErrorMode(Mode: UINT): UINT; external 'KERNEL';
implementation
function LOBYTE(w: Word): Byte;

View File

@ -42,6 +42,9 @@ type
LPVOID = FarPointer;
FARPROC = FarPointer;
TFarProc = FARPROC;
PHANDLE = ^THandle;
SPHANDLE = ^THandle; near;
LPHANDLE = ^THandle; far;
@ -76,6 +79,14 @@ const
WF_PAGING = $0800;
WF_WLO = $8000;
{ ExitWindows values }
EW_RESTARTWINDOWS = $42;
{ SetErrorMode() constants }
SEM_FAILCRITICALERRORS = $0001;
SEM_NOGPFAULTERRORBOX = $0002;
SEM_NOOPENFILEERRORBOX = $8000;
implementation
end.