PICTools Programmer's Reference
PegasusLoadFromRes

The PegasusLoadFromRes function explicitly loads a specific PICTools opcode SSM embedded as a resource in an application or DLL.

 
Copy Code

LONG PegasusLoadFromRes(OPERATION Op, LONG ParmVer, char PICFAR* Path, PICINTPTRT hInstance)

Parameters:

Name Description
Op Specifies the opcode DLL to be loaded.
ParmVer Specifies the version of the DLL to load, ordinarily CURRENT_PARMVER.
Path Specifies the directory location from which to load the DLL. If the application specifies 0 for the path, then the opcode DLL is explicitly loaded using the same directory search order as when it is implicitly loaded (see Notes, below).
hInstance Specifies the instance handle of the resource DLL or application from which to load the SSM.

Return Value:

The return value is ERR_NONE if able to load the requested DLL, otherwise an error value defined in ERRORS.H is returned.

Notes:

Create the resource in the executable as type 'SSM' with a base name of the opcode DLL, e.g., 'PICN6320'. This function works in conjunction with PicParm.LoadPath and PicParm.LoadResInstance as follows:

If LoadPath == 0 && LoadResInstance == 0 then the opcode SSM is loaded from the same directory as the dispatcher DLL. If not found there then the opcode SSM is loaded using the directory order Windows uses when loading DLLs.

If LoadPath != 0 && LoadResInstance == 0, then the opcode SSM is loaded from the specified directory.

If LoadPath == 0 && LoadResInstance != 0 then the opcode SSM is loaded from the specified module's resource data.

If LoadPath != 0 && LoadResInstance != 0 then the opcode SSM is loaded from the specified module's resource data. If not found there, then the opcode SSM is loaded from the specified path. If LoadPath is "", and the opcode SSM is not found in the specified module's resource data, then the opcode SSM is loaded as though LoadPath == 0 && LoadResInstance == 0

Obtain the instance handle of the resource DLL using the Windows API call GetModuleInstance or some other technique.

Using PegasusLoadFromRes allows an application a way to directly specify the source of the opcode to be used. This enables application developers to gain the benefits of SSM compression of DLLs AND the benefits of having control over the specific version of the opcode code that is loaded.

See Also

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback