This example starts the DSOM daemon within the Workplace Shell process and then starts the Workplace Shell DSOM server.
#define INCL_WINERRORS
#define INCL_WPCLASS
#include <os2.h>
enum {OFF, ON};
APIRET apiRtnCd;
apiRtnCd=WinRestartSOMDD(ON);
if (apiRtnCd == PMERR_OK)
{
apiRtnCd = WinRestartWPDServer(ON);
if (apiRtnCd)
{
PERRINFO perriErrorInfo;
if (apiRtnCd == PMERR_WPDSERVER_IS_ACTIVE)
{
somPrintf("The Workplace Shell DSOM server is already running");
exit(2);
}
if (apiRtnCd == PMERR_WPDSERVER_NOT_STARTED)
{
somPrintf("Failed to start the Workplace Shell DSOM server");
exit(2);
}
/* Obtain the error block */
/* WinGetErrorInfo is for DosLoadModule related errors only */
perriErrorInfo = WinGetErrorInfo(hab);
somPrintf("Loading WPDSRVP.DLL failed: %ld", perriErrorInfo->idError);
WinFreeErrorInfo(perriErrorInfo);
exit(99);
}
somPrintf("All's well!");
}
else
{
somPrintf("Failed to start the DSOM daemon");
exit(1);
}