ImpersonateDdeClientWindow function (dde.h)

Enables a Dynamic Data Exchange (DDE) server application to impersonate a DDE client application's security context. This protects secure server data from unauthorized DDE clients.

Syntax

BOOL ImpersonateDdeClientWindow(
  [in] HWND hWndClient,
  [in] HWND hWndServer
);

Parameters

[in] hWndClient

Type: HWND

A handle to the DDE client window to be impersonated. The client window must have established a DDE conversation with the server window identified by the hWndServer parameter.

[in] hWndServer

Type: HWND

A handle to the DDE server window. An application must create the server window before calling this function.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

An application should call the RevertToSelf function to undo the impersonation set by the ImpersonateDdeClientWindow function.

A DDEML application should use the DdeImpersonateClient function.

Security Considerations

Using this function incorrectly might compromise the security of your program. It is very important to check the return value of the call. If the function fails for any reason, the client is not impersonated and any subsequent client request is made in the security context of the calling process. If the calling process is running as a highly privileged account, such as LocalSystem or as a member of an administrative group, the user may be able to perform actions that would otherwise be disallowed. Therefore, if the call fails or raises an error do not continue execution of the client request.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header dde.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

About Dynamic Data Exchange

Conceptual

DdeImpersonateClient

Other Resources

Reference

RevertToSelf