Trusted DDE Shares

Last reviewed: September 29, 1995
Article ID: Q128125
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT version 3.5
    

SUMMARY

To allow someone else to connect to DDE shares when you are logged in, you have to trust your existing DDE share. The reason is that when the other person connects to the share remotely, the application he will connect to is running in your security context, not the remote user's, because you are the logged-on user. You need to give permission for the other person to access the share. Even another person who is an administrator cannot trust a share for your account.

In your code, you would use NDdeShareAdd() to create the share and NDdeSetTrustedShare() to trust the share.

Alternatively, you can use DDESHARE to create the share. For more information on DDESHARE, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q114089
   TITLE     : Using the Windows NT NetDDE Share Manager

If you have a DDE share that always needs to be available, you can write a program that trusts the specific shares and sets up a logon script to trust the share for every user. The logon script should be a .BAT file that calls the .EXE file, so that you can add other things to the logon script as necessary.

MORE INFORMATION

The online documentation for NDdeSetTrustedShare says:

   The NDdeSetTrustedShare function is called to promote the
   referenced DDE share to trusted status within the current
   user's context.

DDE shares are a machine resource, not an account resource, just as shared drives are. However, NetDDE runs an application that must run in the context of the current user. This is the reason that the share must be trusted, so that the application can run in the user's context.

The prototype for the function is:

   UINT NDdeSetTrustedShare(lpszServer, lpszShareName, dwTrustOptions)

The parameter lpszServer is the address of the server name on which the DDE share resides. The DDE Share Database (DSDM) will be modified. This service manages the shared DDE conversations and is used by the NetDDE service. This parameter will generally be the current machine, because you can't trust a share for someone else.

The dwTrustOptions are NDDE_TRUST_SHARE_START and NDDE_TRUST_SHARE_INIT. NDDE_TRUST_SHARE_START allows the DDE server, such as Excel, to be started in the user's context. This allows a DDE client to make a NetDDE connection without the DDE server already running. When the NetDDE agent on the server machine detects the attempted connection, it launches the associated DDE server application if it is not already running.

NDDE_TRUST_SHARE_INIT allows a client to initiate to the DDE server if it is already executing in the user's context. This allows a DDE client to make a NetDDE connection to a DDE server already running on the server machine. If the DDE server is not already running, the connection will fail.


Additional reference words: 3.50
KBCategory: kbui
KBSubcategory: UsrNetDde


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 29, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.