Skip to content

gmSCOperatingSystemClass

The service class OperatingSystem performs those operations that require direct access to the operating system that cannot implemented in a platform independent way. This implementation is provided for Windows platforms MSCPLAT. Other platforms would require their own version.

Prototype

int OperatingSystem_CopyFile(char* SrcFile, char* DestFile);

The OperatingSystem_CopyFile method does a file copy in as efficient a method as possible. If the destination file already exists, it will be overridden. Its parameters are as follows:

ParameterDescription
SrcFileContains the name of the source file in null-terminated string form.
DestFileContains the name of the destination file in null-terminated form.

If the copy succeeds, the return value is nonzero, else the return value is zero.

The method OperatingSystem_DeleteDirectory

Section titled “The method OperatingSystem_DeleteDirectory”

Prototype

int OperatingSystem_DeleteDirectory(char* Directory);

The OperatingSystem_DeleteDirectory method deletes a named directory. Its parameter is:

ParameterDescription
DirectoryContains the name of the directory to be deleted in null-terminated string form.

If the directory is successfully deleted, then a zero is returned. If the directory cannot be deleted, then a one is returned.

Prototype

int OperatingSystem_GetGuid(char* guidStr,int length);

The OperatingSystem_GetGuid method returns a created GUID string. A GUID is a Globally Unique Identifier, a unique 128-bit number that is used to identify a particular component, application, file, database entry, or user. This method uses the operating to create such an identifier in the commonly used string form. Each call to this method creates a new unique GUID. Its parameters are as follows:

ParameterDescription
guidStrReceives the GUID as obtained from the operating system. It is not null-terminated.
lengthSpecifies the length of guidStr. It is used to avoid overflow. No more than length characters will be copied into it.

The method returns the length of the GUID string as returned.

Prototype

int OperatingSystem_GetFileInfo(char* Filename,tOperatingSystem_FileInfo* FileInfo);

The method OperatingSystem_GetFileInfo gets information about a specific file from the operating system. This information is as follows:

MemberDescription
FileNameFull name of file
ExtensionExtension associated with file
LocalStartStart of local name
TypeOfFileThe type of the file
DateModifiedDate last modified
TimeModifiedTime last modified
DateCreatedDate created
TimeCreatedTime created
DateAccessedDate last accessed
TimeAccessedTime last accessed
CurrentSizeCurrent size of file
ProtectionProtection status
ModeMode of file

The parameters of the method are as follows:

ParameterDescription
FilenameContains the name of the file in null-terminated form.
FileinfoReceives the information about the file as listed above.

The method OperatingSystem_GetLibraryMethod

Section titled “The method OperatingSystem_GetLibraryMethod”

Prototype

MethodHandle OperatingSystem_GetLibraryMethod(void* library,CONST char* methodName);

The OperatingSystem_GetLibraryMethod method gets the execution handle to a method in a loaded a dynamic link library. Its parameters are as follows:

ParameterDescription
librarySpecifies the handle of the library containing the desired method obtained from the method OperatingSystem_LoadLibrary.
methodNameContains the name of the method to be executed in null-terminated form.

This method returns an execution handle to the method if all went well; else it returns a NULL.

Prototype

int OperatingSystem_GetTime(void);

The OperatingSystem_GetTime method returns the current time in milliseconds. It has no parameters.

Prototype

void OperatingSystem_GetProgramName(char* name,int nName)

The OperatingSystem_GetProgramName method obtains the name of the currently executing program. This name is typically used to determine the names of corresponding startup files. Its parameters are as follows:

ParameterDescription
nameReceives the name of the executing program in null-terminated form.
nNameSpecifies the size of the name return area and is used to avoid overflow.

Prototype

void* OperatingSystem_LoadLibrary(char* libName);

The OperatingSystem_LoadLibrary method loads a dynamic link library and returns the handle to its information. Its parameter is:

ParameterDescription
libNameContains the name of the library to be loaded in null-terminated string form.

This method returns an opaque handle to the loaded library information if all went well; else it returns a NULL.

Prototype

int OperatingSystem_MakeDirectory(char* Directory);

The OperatingSystem_MakeDirectory method makes a directory in the file system. Its parameter is:

ParameterDescription
DirectoryContains the name of the directory to be created as a null-terminated string.

If the directory is successfully created, then a zero is returned. If the directory cannot be created, then a one is returned.

The method OperatingSystem_ReadFileDirectory

Section titled “The method OperatingSystem_ReadFileDirectory”

Prototype

int OperatingSystem_ReadFileDirectory(char* DirName,tOperatingSystem_FileInfo* FileInfo);

The OperatingSystem_ReadFileDirectory method reads the file directory one entry at a time. It is used to obtain a listing of all files in a directory. The information about each file is stored in a tOperatingSystem_FileInfo structure whose members are as follows:

MemberDescription
FileNameFull name of file
ExtensionExtension associated with file
LocalStartStart of local name
TypeOfFileThe type of the file
DateModifiedDate last modified
TimeModifiedTime last modified
DateCreatedDate created
TimeCreatedTime created
DateAccessedDate last accessed
TimeAccessedTime last accessed
CurrentSizeCurrent size of file
ProtectionProtection status
ModeMode of file
InternalInfoUsed internally

The parameters of the method are as follows:

ParameterDescription
DirNameContains the name of the directory to be read on the initial call to this method. On subsequent calls this parameter is set to NULL.
FileInfoReceives the tOperatingSystem_FileInfo member values for the current file.

If information about a first or next file is being returned, then a zero is returned. If no more files are present, a one is returned.

Prototype

void OperatingSystem_UnloadLibrary(void* library);

The OperatingSystem_UnloadLibrary method unloads a dynamic link library. Its parameter is:

ParameterDescription
librarySpecifies the handle of the library to be unloaded as received from the method OperatingSystem_LoadLibrary.