Microsoft KB Archive/128125

{|
 * width="100%"|

Trusted DDE Shares

 * }

Q128125

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * the operating system: Microsoft Windows NT 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:

"Q114089 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 query words: 3.50

Keywords :

Issue type :

Technology : kbAudDeveloper kbWin32sSearch kbWin32API