Initial commit
This commit is contained in:
48
LIB386/LIB_SYS/LOADMALL.C
Normal file
48
LIB386/LIB_SYS/LOADMALL.C
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
MALLOC (c) Adeline 1993
|
||||
|
||||
Functions:
|
||||
|
||||
- Malloc
|
||||
- Free
|
||||
- Mshrink
|
||||
*/
|
||||
|
||||
#include <i86.h>
|
||||
#include <dos.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "adeline.h"
|
||||
#include "lib_sys.h"
|
||||
|
||||
ULONG LoadMallocFileSize ;
|
||||
|
||||
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
|
||||
void *LoadMalloc( char *name )
|
||||
{
|
||||
LONG handle ;
|
||||
ULONG sizer ;
|
||||
void *pt ;
|
||||
|
||||
LoadMallocFileSize = FileSize( name ) ;
|
||||
if ( !LoadMallocFileSize ) return( 0 ) ;
|
||||
|
||||
pt = Malloc( LoadMallocFileSize ) ;
|
||||
if ( pt == 0 ) return( 0 ) ;
|
||||
|
||||
handle = OpenRead( name ) ;
|
||||
if ( !handle) return( 0 ) ;
|
||||
|
||||
sizer = Read( handle, pt, LoadMallocFileSize );
|
||||
if ( sizer != LoadMallocFileSize )
|
||||
{
|
||||
Close( handle ) ;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
Close( handle ) ;
|
||||
return( pt ) ;
|
||||
}
|
||||
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
|
||||
Reference in New Issue
Block a user