|
@@ -3,7 +3,13 @@
|
|
}
|
|
}
|
|
unit UnzipDLL;
|
|
unit UnzipDLL;
|
|
|
|
|
|
-{$Cdecl+,AlignRec-,OrgName+}
|
|
|
|
|
|
+{$IFDEF VIRTUALPASCAL}
|
|
|
|
+ {$Cdecl+,AlignRec-,OrgName+}
|
|
|
|
+{$ELSE}
|
|
|
|
+ {$IFDEF FPC}
|
|
|
|
+ {$PACKRECORDS 1}
|
|
|
|
+ {$ENDIF}
|
|
|
|
+{$ENDIF}
|
|
|
|
|
|
interface
|
|
interface
|
|
|
|
|
|
@@ -36,11 +42,15 @@ uses
|
|
BseDos,
|
|
BseDos,
|
|
{$ENDIF VirtualPascal}
|
|
{$ENDIF VirtualPascal}
|
|
{$ENDIF FPC}
|
|
{$ENDIF FPC}
|
|
|
|
+{$ELSE}
|
|
|
|
+ {$IFDEF WIN32}
|
|
|
|
+ Dos;
|
|
|
|
+ {$ENDIF WIN32}
|
|
{$ENDIF OS2}
|
|
{$ENDIF OS2}
|
|
Dos;
|
|
Dos;
|
|
|
|
|
|
type
|
|
type
|
|
- UzpMainFunc = function (ArgC: longint; var ArgV: TArgV): longint;
|
|
|
|
|
|
+ UzpMainFunc = function (ArgC: longint; var ArgV: TArgV): longint; cdecl;
|
|
|
|
|
|
const
|
|
const
|
|
{$IFDEF OS2}
|
|
{$IFDEF OS2}
|
|
@@ -63,7 +73,9 @@ var
|
|
|
|
|
|
function DLLInit: boolean;
|
|
function DLLInit: boolean;
|
|
var
|
|
var
|
|
|
|
+{$IFDEF OS2}
|
|
ErrPath: array [0..259] of char;
|
|
ErrPath: array [0..259] of char;
|
|
|
|
+{$ENDIF}
|
|
DLLPath: PathStr;
|
|
DLLPath: PathStr;
|
|
Dir: DirStr;
|
|
Dir: DirStr;
|
|
Name: NameStr;
|
|
Name: NameStr;
|
|
@@ -73,6 +85,7 @@ begin
|
|
FSplit (FExpand (ParamStr (0)), Dir, Name, Ext);
|
|
FSplit (FExpand (ParamStr (0)), Dir, Name, Ext);
|
|
DLLPath := Dir + DLLName;
|
|
DLLPath := Dir + DLLName;
|
|
Insert ('.DLL', DLLPath, byte (DLLPath [0]));
|
|
Insert ('.DLL', DLLPath, byte (DLLPath [0]));
|
|
|
|
+{$IFDEF OS2}
|
|
if (DosLoadModule (@ErrPath, SizeOf (ErrPath), @DLLPath [1], DLLHandle) <> 0)
|
|
if (DosLoadModule (@ErrPath, SizeOf (ErrPath), @DLLPath [1], DLLHandle) <> 0)
|
|
and (DosLoadModule (@ErrPath, SizeOf (ErrPath), @DLLName [1], DLLHandle) <> 0)
|
|
and (DosLoadModule (@ErrPath, SizeOf (ErrPath), @DLLName [1], DLLHandle) <> 0)
|
|
then
|
|
then
|
|
@@ -83,6 +96,20 @@ begin
|
|
WriteLn (PChar (@ErrPath));
|
|
WriteLn (PChar (@ErrPath));
|
|
end;
|
|
end;
|
|
end else DLLInit := DosQueryProcAddr (DLLHandle, UzpMainOrd, nil, @UzpMain) = 0;
|
|
end else DLLInit := DosQueryProcAddr (DLLHandle, UzpMainOrd, nil, @UzpMain) = 0;
|
|
|
|
+{$ELSE}
|
|
|
|
+ {$IFDEF WIN32}
|
|
|
|
+ DLLHandle := LoadLibrary (@DLLPath [1]);
|
|
|
|
+ if DLLHandle = 0 then DLLHandle := LoadLibrary (@DLLName [1]);
|
|
|
|
+ if DLLHande = 0 then
|
|
|
|
+ begin
|
|
|
|
+ if ErrPath [0] <> #0 then WriteLn (#13#10'Error while loading DLL.');
|
|
|
|
+ end else
|
|
|
|
+ begin
|
|
|
|
+ UzpMain := UzpMainFunc (GetProcAddress (DLLHandle, 'UzpMain');
|
|
|
|
+ DLLInit := Assigned (UzpMain);
|
|
|
|
+ end;
|
|
|
|
+ {$ENDIF}
|
|
|
|
+{$ENDIF}
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure NewExit;
|
|
procedure NewExit;
|
|
@@ -174,7 +201,10 @@ begin
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.2 1999-06-10 07:28:29 hajny
|
|
|
|
|
|
+ Revision 1.3 2000-03-05 17:57:08 hajny
|
|
|
|
+ + added support for Win32 (untested)
|
|
|
|
+
|
|
|
|
+ Revision 1.2 1999/06/10 07:28:29 hajny
|
|
* compilable with TP again
|
|
* compilable with TP again
|
|
|
|
|
|
Revision 1.1 1999/02/19 16:45:26 peter
|
|
Revision 1.1 1999/02/19 16:45:26 peter
|