mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 02:49:21 +02:00
+ add and initialize the win16 system unit variables that correspond to the
WinMain parameters in C git-svn-id: trunk@31547 -
This commit is contained in:
parent
83a7fa2320
commit
eea09632a3
@ -53,7 +53,9 @@ function Is_IntResource(aStr : pchar) : boolean; {$ifdef SYSTEMINLINE}inline;{$e
|
|||||||
function MakeLangID(primary,sub : word) : word; {$ifdef SYSTEMINLINE}inline;{$endif}
|
function MakeLangID(primary,sub : word) : word; {$ifdef SYSTEMINLINE}inline;{$endif}
|
||||||
|
|
||||||
// Win32 API compatible Resource functions
|
// Win32 API compatible Resource functions
|
||||||
|
{$ifndef Win16}
|
||||||
Function HINSTANCE : TFPResourceHMODULE;
|
Function HINSTANCE : TFPResourceHMODULE;
|
||||||
|
{$endif Win16}
|
||||||
Function EnumResourceTypes(ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
|
Function EnumResourceTypes(ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
|
||||||
Function EnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
|
Function EnumResourceNames(ModuleHandle : TFPResourceHMODULE; ResourceType : PChar; EnumFunc : EnumResNameProc; lParam : PtrInt) : LongBool;
|
||||||
Function EnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
|
Function EnumResourceLanguages(ModuleHandle : TFPResourceHMODULE; ResourceType, ResourceName : PChar; EnumFunc : EnumResLangProc; lParam : PtrInt) : LongBool;
|
||||||
|
@ -141,10 +141,12 @@ end;
|
|||||||
*****************************************************************************)
|
*****************************************************************************)
|
||||||
{ These functions will call the specified resource manager functions }
|
{ These functions will call the specified resource manager functions }
|
||||||
|
|
||||||
|
{$ifndef Win16}
|
||||||
Function HINSTANCE : TFPResourceHMODULE;
|
Function HINSTANCE : TFPResourceHMODULE;
|
||||||
begin
|
begin
|
||||||
Result:=resourcemanager.HINSTANCEFunc();
|
Result:=resourcemanager.HINSTANCEFunc();
|
||||||
end;
|
end;
|
||||||
|
{$endif Win16}
|
||||||
|
|
||||||
Function EnumResourceTypes(ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
|
Function EnumResourceTypes(ModuleHandle : TFPResourceHMODULE; EnumFunc : EnumResTypeProc; lParam : PtrInt) : LongBool;
|
||||||
begin
|
begin
|
||||||
|
@ -27,6 +27,10 @@
|
|||||||
|
|
||||||
extern PASCALMAIN
|
extern PASCALMAIN
|
||||||
extern __fpc_PrefixSeg
|
extern __fpc_PrefixSeg
|
||||||
|
extern __fpc_CmdLine
|
||||||
|
extern __fpc_CmdShow
|
||||||
|
extern __fpc_HInstance
|
||||||
|
extern __fpc_HPrevInst
|
||||||
|
|
||||||
extern InitTask
|
extern InitTask
|
||||||
import InitTask KERNEL
|
import InitTask KERNEL
|
||||||
@ -67,7 +71,11 @@
|
|||||||
|
|
||||||
mov ax, es
|
mov ax, es
|
||||||
mov [__fpc_PrefixSeg], ax
|
mov [__fpc_PrefixSeg], ax
|
||||||
mov [hInst], di
|
mov [__fpc_CmdLine+2], ax
|
||||||
|
mov [__fpc_CmdLine], bx
|
||||||
|
mov [__fpc_CmdShow], dx
|
||||||
|
mov [__fpc_HInstance], di
|
||||||
|
mov [__fpc_HPrevInst], si
|
||||||
|
|
||||||
; call WaitEvent(0) to clear the event that started this task
|
; call WaitEvent(0) to clear the event that started this task
|
||||||
; Windows expects this call immediately after InitTask
|
; Windows expects this call immediately after InitTask
|
||||||
@ -75,10 +83,10 @@
|
|||||||
push ax
|
push ax
|
||||||
call far WaitEvent
|
call far WaitEvent
|
||||||
|
|
||||||
; call InitApp(hInst) to initialize the queue and support routines
|
; call InitApp(hInstance) to initialize the queue and support
|
||||||
; for the app. Windows expects this to be the third call in the
|
; routines for the app. Windows expects this to be the third
|
||||||
; Win16 startup sequence.
|
; call in the Win16 startup sequence.
|
||||||
push word [hInst]
|
push word [__fpc_HInstance]
|
||||||
call far InitApp
|
call far InitApp
|
||||||
test ax, ax
|
test ax, ax
|
||||||
jz error
|
jz error
|
||||||
@ -108,7 +116,6 @@ pStackBot: dw 0
|
|||||||
; end of reserved area, filled by InitTask
|
; end of reserved area, filled by InitTask
|
||||||
|
|
||||||
|
|
||||||
hInst: dw 0
|
|
||||||
|
|
||||||
segment _STACK stack class=STACK align=16
|
segment _STACK stack class=STACK align=16
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ interface
|
|||||||
systemh.inc is included otherwise the
|
systemh.inc is included otherwise the
|
||||||
$mode switch is not effective }
|
$mode switch is not effective }
|
||||||
|
|
||||||
|
{$DEFINE HAS_CMDLINE}
|
||||||
|
|
||||||
{$I systemh.inc}
|
{$I systemh.inc}
|
||||||
{$I tnyheaph.inc}
|
{$I tnyheaph.inc}
|
||||||
|
|
||||||
@ -52,6 +54,9 @@ const
|
|||||||
64K bytes (BP7 compatibility) }
|
64K bytes (BP7 compatibility) }
|
||||||
SelectorInc: Word = $1000;
|
SelectorInc: Word = $1000;
|
||||||
|
|
||||||
|
type
|
||||||
|
LPSTR = ^Char;far;
|
||||||
|
|
||||||
var
|
var
|
||||||
{ Mem[] support }
|
{ Mem[] support }
|
||||||
mem : array[0..$7fff-1] of byte absolute $0:$0;
|
mem : array[0..$7fff-1] of byte absolute $0:$0;
|
||||||
@ -66,6 +71,13 @@ var
|
|||||||
{ The DOS Program Segment Prefix segment (TP7 compatibility) }
|
{ The DOS Program Segment Prefix segment (TP7 compatibility) }
|
||||||
PrefixSeg:Word;public name '__fpc_PrefixSeg';
|
PrefixSeg:Word;public name '__fpc_PrefixSeg';
|
||||||
|
|
||||||
|
{ BP7 compatible windows variables }
|
||||||
|
{ In C, these are the parameters to WinMain }
|
||||||
|
CmdLine: LPSTR;public name '__fpc_CmdLine';
|
||||||
|
CmdShow: SmallInt;public name '__fpc_CmdShow';
|
||||||
|
HInstance: Word{HINST};public name '__fpc_HInstance';
|
||||||
|
HPrevInst: Word{HINST};public name '__fpc_HPrevInst';
|
||||||
|
|
||||||
{ SaveInt00: FarPointer;public name '__SaveInt00';}
|
{ SaveInt00: FarPointer;public name '__SaveInt00';}
|
||||||
|
|
||||||
AllFilesMask: string [3];
|
AllFilesMask: string [3];
|
||||||
|
Loading…
Reference in New Issue
Block a user