home *** CD-ROM | disk | FTP | other *** search
- unit CFGFILE;
- interface
- uses
- {$IFDEF WIN32}
- Windows;
- {$ELSE}
- Wintypes, WinProcs;
- {$ENDIF}
-
-
- {=> CFGFILE.H <=}
-
- {+// }
- {-CFGFILE.H }
-
- {-Config file interface header file for FMail 1.42g }
- {-Copyright (C) 1998 Folkert J. Wijnstra. All rights reserved. }
-
- {-All information in this document is subject to change at any time }
- {-without prior notice! }
- {= }
-
-
- const
- CFG_GENERAL = 0;
- const
- CFG_NODES = 1;
- const
- CFG_ECHOAREAS = 2;
- const
- CFG_AREADEF = 3;
- const
- MAX_CFG_FILES = 4;
-
- var
- openConfig: function(fileType: U16;
- var header: HEADERTYPE*;
- var buf: Pointer): S16 cdecl {$IFDEF WIN32} stdcall {$ENDIF};
- var
- getRec: function(fileType: U16;
- index: S16): S16 cdecl {$IFDEF WIN32} stdcall {$ENDIF};
- var
- putRec: function(fileType: U16;
- index: S16): S16 cdecl {$IFDEF WIN32} stdcall {$ENDIF};
- var
- insRec: function(fileType: U16;
- index: S16): S16 cdecl {$IFDEF WIN32} stdcall {$ENDIF};
- var
- delRec: function(fileType: U16;
- index: S16): S16 cdecl {$IFDEF WIN32} stdcall {$ENDIF};
- var
- chgNumRec: function(fileType: U16;
- number: S16): S16 cdecl {$IFDEF WIN32} stdcall {$ENDIF};
- var
- closeConfig: function(fileType: U16): S16 cdecl {$IFDEF WIN32} stdcall {$ENDIF};
-
-
- var
- DLLLoaded: Boolean { is DLL (dynamically) loaded already? }
- {$IFDEF WIN32} = False; {$ENDIF}
-
- implementation
-
- var
- SaveExit: pointer;
- DLLHandle: THandle;
- {$IFNDEF MSDOS}
- ErrorMode: Integer;
- {$ENDIF}
-
- procedure NewExit; far;
- begin
- ExitProc := SaveExit;
- FreeLibrary(DLLHandle)
- end {NewExit};
-
- procedure LoadDLL;
- begin
- if DLLLoaded then Exit;
- {$IFNDEF MSDOS}
- ErrorMode := SetErrorMode($8000{SEM_NoOpenFileErrorBox});
- {$ENDIF}
- DLLHandle := LoadLibrary('CFGFILE.DLL');
- if DLLHandle >= 32 then
- begin
- DLLLoaded := True;
- SaveExit := ExitProc;
- ExitProc := @NewExit;
- @openConfig := GetProcAddress(DLLHandle,'openConfig');
- {$IFDEF WIN32}
- Assert(@openConfig <> nil);
- {$ENDIF}
- @getRec := GetProcAddress(DLLHandle,'getRec');
- {$IFDEF WIN32}
- Assert(@getRec <> nil);
- {$ENDIF}
- @putRec := GetProcAddress(DLLHandle,'putRec');
- {$IFDEF WIN32}
- Assert(@putRec <> nil);
- {$ENDIF}
- @insRec := GetProcAddress(DLLHandle,'insRec');
- {$IFDEF WIN32}
- Assert(@insRec <> nil);
- {$ENDIF}
- @delRec := GetProcAddress(DLLHandle,'delRec');
- {$IFDEF WIN32}
- Assert(@delRec <> nil);
- {$ENDIF}
- @chgNumRec := GetProcAddress(DLLHandle,'chgNumRec');
- {$IFDEF WIN32}
- Assert(@chgNumRec <> nil);
- {$ENDIF}
- @closeConfig := GetProcAddress(DLLHandle,'closeConfig');
- {$IFDEF WIN32}
- Assert(@closeConfig <> nil);
- {$ENDIF}
- end
- else
- begin
- DLLLoaded := False;
- { Error: CFGFILE.DLL could not be loaded !! }
- end;
- {$IFNDEF MSDOS}
- SetErrorMode(ErrorMode)
- {$ENDIF}
- end {LoadDLL};
-
- begin
- LoadDLL;
- end.
-