Newsgroups: comp.os.ms-windows.programmer.win32
Path: bga.com!news.sprintlink.net!uunet!riscy!riscy.simplot.COM!
From: lhob...@simplot.COM (Logan Hobdey)
Subject: MSmail from a service anyone?
Message-ID: <1994Aug17.193637.20553@simplot.com>
Keywords: mail,service
Lines: 12
Sender: r...@riscy.simplot.COM (System PRIVILEGED Account)
Reply-To: lhob...@simplot.COM (Logan Hobdey)
Organization: J. R. Simplot Co.
Date: Wed, 17 Aug 1994 19:36:37 GMT


Does anyone know of a way to reliably send mail (MSmail that is) from a
service? I have a MAPI implementation that works well in debug from MSVCNT v1.10, 
but as a service the MAPILogon call returns MAPI_E_FAILURE.

Does anyone have any experience or insights that might help here?

-------------------------------------------------------------------------------
Logan Hobdey                                      Phone:  (208) 327-3214
Systems Programmer                                E-mail: lhob...@simplot.com
J.R. Simplot Co.
-------------------------------------------------------------------------------
#include "standard-disclaimers.h"

Newsgroups: comp.os.ms-windows.programmer.win32
Path: bga.com!news.sprintlink.net!hookup!yeshua.marcam.com!
charnel.ecst.csuchico.edu!olivea!news.hal.COM!decwrl!amd!netcomsv!proact!jra
From: j...@proactive.com (Jeremy Allison)
Subject: Re: MSmail from a service anyone?
Message-ID: <1994Aug18.162444.12457@proactive.com>
Keywords: mail,service
Organization: The Vantive Corporation
References: <1994Aug17.193637.20553@simplot.com>
Date: Thu, 18 Aug 1994 16:24:44 GMT
Lines: 29

In article <1994Aug17.193637.20...@simplot.com> lhob...@simplot.COM (Logan Hobdey) writes:
>
>Does anyone know of a way to reliably send mail (MSmail that is) from a
>service? I have a MAPI implementation that works well in debug from MSVCNT v1.10, 
>but as a service the MAPILogon call returns MAPI_E_FAILURE.
>
>Does anyone have any experience or insights that might help here?
>

Yes, I also have been attempting to do this and it appears to be impossible.
The reason is that the MAPI dll attempts to open a window on the screen (only
God and Microsoft know why :-). It is not possible to do this from a service as
the running thread has no Desktop object (child of a Window Station object).
In fact calling GetThreadDesktop for a service thread returns null.

I know this is possible (just as it is possible to change the current userid when
you are running as administrator) as I see it done when the service puts up a dialog
box when I get a SEGV (my UNIXdom coming out here). However, good luck in getting
that info out of MS - we had to sign a non disclosure (by the VP of engineering)
just to get the security API info.

Sigh. Why do I feel things would be much better if the Dpt. of Justice had decreed
that the only way for the MS applications group and the MS OS group to communicate
would be though published books :-(.


Jeremy Allison
j...@vantive.com.