ReactOS 0.4.16-dev-2473-gb34a1f1
dde.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "dde.h"
#include "ddeml.h"
#include "winerror.h"
#include "wine/test.h"
Include dependency graph for dde.c:

Go to the source code of this file.

Functions

static HANDLE create_process (const char *arg)
 
static BOOL is_cjk (void)
 
static void flush_events (void)
 
static void create_dde_window (HWND *hwnd, LPCSTR name, WNDPROC wndproc)
 
static void destroy_dde_window (HWND *hwnd, LPCSTR name)
 
static LRESULT WINAPI dde_server_wndproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_msg_server (void)
 
static HDDEDATA CALLBACK client_ddeml_callback (UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
 
static void test_ddeml_client (void)
 
static HDDEDATA CALLBACK server_ddeml_callback (UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
 
static void test_ddeml_server (void)
 
static LRESULT WINAPI dde_msg_client_wndproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static HGLOBAL create_poke (void)
 
static HGLOBAL create_execute (LPCSTR command)
 
static void test_msg_client (void)
 
static LRESULT WINAPI hook_dde_client_wndprocA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI hook_dde_client_wndprocW (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI dde_server_wndprocA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI dde_server_wndprocW (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static HWND create_dde_server (BOOL unicode)
 
static HDDEDATA CALLBACK client_dde_callback (UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
 
static void test_dde_aw_transaction (BOOL client_unicode, BOOL server_unicode)
 
static void test_initialisation (void)
 
static void test_DdeCreateStringHandleW (DWORD dde_inst, int codepage)
 
static void test_DdeCreateDataHandle (void)
 
static void test_DdeCreateStringHandle (void)
 
static void test_FreeDDElParam (void)
 
static void test_PackDDElParam (void)
 
static void test_UnpackDDElParam (void)
 
static HDDEDATA CALLBACK server_end_to_end_callback (UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
 
static HDDEDATA CALLBACK client_end_to_end_callback (UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
 
static void test_end_to_end_client (BOOL type_a)
 
static void test_end_to_end_server (void)
 
 START_TEST (dde)
 

Variables

static const WCHAR TEST_DDE_SERVICE [] = {'T','e','s','t','D','D','E','S','e','r','v','i','c','e',0}
 
static char exec_cmdA [] = "ANSI dde command"
 
static WCHAR exec_cmdAW [] = {'A','N','S','I',' ','d','d','e',' ','c','o','m','m','a','n','d',0}
 
static WCHAR exec_cmdW [] = {'u','n','i','c','o','d','e',' ','d','d','e',' ','c','o','m','m','a','n','d',0}
 
static char exec_cmdWA [] = "unicode dde command"
 
static WNDPROC old_dde_client_wndproc
 
static const DWORD default_timeout = 200
 
static DWORD server_pid
 
static HWND client_hwnd
 
static HWND server_hwnd
 
static ATOM server
 
static ATOM topic
 
static ATOM item
 
static HGLOBAL execute_hglobal
 
static char test_cmd_a_to_a [] = "Test dde command"
 
static WCHAR test_cmd_w_to_w [][32]
 
static int msg_index
 
static BOOL unicode_server
 
static BOOL unicode_client
 

Function Documentation

◆ client_dde_callback()

static HDDEDATA CALLBACK client_dde_callback ( UINT  uType,
UINT  uFmt,
HCONV  hconv,
HSZ  hsz1,
HSZ  hsz2,
HDDEDATA  hdata,
ULONG_PTR  dwData1,
ULONG_PTR  dwData2 
)
static

Definition at line 1528 of file dde.c.

1531{
1532 static const char * const cmd_type[15] = {
1533 "XTYP_ERROR", "XTYP_ADVDATA", "XTYP_ADVREQ", "XTYP_ADVSTART",
1534 "XTYP_ADVSTOP", "XTYP_EXECUTE", "XTYP_CONNECT", "XTYP_CONNECT_CONFIRM",
1535 "XTYP_XACT_COMPLETE", "XTYP_POKE", "XTYP_REGISTER", "XTYP_REQUEST",
1536 "XTYP_DISCONNECT", "XTYP_UNREGISTER", "XTYP_WILDCONNECT" };
1537 UINT type;
1538 const char *cmd_name;
1539
1540 type = (uType & XTYP_MASK) >> XTYP_SHIFT;
1541 cmd_name = (type <= 14) ? cmd_type[type] : "unknown";
1542
1543 if (winetest_debug > 1)
1544 trace("client_dde_callback: %04x (%s) %d %p %p %p %p %08Ix %08Ix\n",
1545 uType, cmd_name, uFmt, hconv, hsz1, hsz2, hdata, dwData1, dwData2);
1546 return 0;
1547}
#define trace
Definition: atltest.h:70
INT cmd_type(LPTSTR)
Definition: type.c:221
#define XTYP_SHIFT
Definition: ddeml.h:198
#define XTYP_MASK
Definition: ddeml.h:197
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
int winetest_debug
unsigned int UINT
Definition: ndis.h:50

Referenced by test_dde_aw_transaction().

◆ client_ddeml_callback()

static HDDEDATA CALLBACK client_ddeml_callback ( UINT  uType,
UINT  uFmt,
HCONV  hconv,
HSZ  hsz1,
HSZ  hsz2,
HDDEDATA  hdata,
ULONG_PTR  dwData1,
ULONG_PTR  dwData2 
)
static

Definition at line 288 of file dde.c.

291{
292 ok(FALSE, "Unhandled msg: %08x\n", uType);
293 return 0;
294}
#define ok(value,...)
Definition: atltest.h:57
#define FALSE
Definition: types.h:117

Referenced by START_TEST(), test_DdeCreateDataHandle(), test_DdeCreateStringHandle(), test_ddeml_client(), and test_initialisation().

◆ client_end_to_end_callback()

static HDDEDATA CALLBACK client_end_to_end_callback ( UINT  uType,
UINT  uFmt,
HCONV  hconv,
HSZ  hsz1,
HSZ  hsz2,
HDDEDATA  hdata,
ULONG_PTR  dwData1,
ULONG_PTR  dwData2 
)
static

Definition at line 2597 of file dde.c.

2600{
2601 switch (uType)
2602 {
2603 case XTYP_DISCONNECT:
2604 return (HDDEDATA) TRUE;
2605
2606 default:
2607 ok(FALSE, "Unhandled msg: %08x\n", uType);
2608 }
2609
2610 return NULL;
2611}
#define XTYP_DISCONNECT
Definition: ddeml.h:192
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120

Referenced by test_end_to_end_client().

◆ create_dde_server()

static HWND create_dde_server ( BOOL  unicode)
static

Definition at line 1492 of file dde.c.

1493{
1494 WNDCLASSA wcA;
1495 WNDCLASSW wcW;
1496 HWND server;
1497 static const char server_class_nameA[] = "dde_server_windowA";
1498 static const WCHAR server_class_nameW[] = {'d','d','e','_','s','e','r','v','e','r','_','w','i','n','d','o','w','W',0};
1499
1500 if (unicode)
1501 {
1502 memset(&wcW, 0, sizeof(wcW));
1504 wcW.lpszClassName = server_class_nameW;
1505 wcW.hInstance = GetModuleHandleA(0);
1506 RegisterClassW(&wcW);
1507
1508 server = CreateWindowExW(0, server_class_nameW, NULL, WS_POPUP,
1509 100, 100, CW_USEDEFAULT, CW_USEDEFAULT,
1511 }
1512 else
1513 {
1514 memset(&wcA, 0, sizeof(wcA));
1516 wcA.lpszClassName = server_class_nameA;
1517 wcA.hInstance = GetModuleHandleA(0);
1518 RegisterClassA(&wcA);
1519
1520 server = CreateWindowExA(0, server_class_nameA, NULL, WS_POPUP,
1521 100, 100, CW_USEDEFAULT, CW_USEDEFAULT,
1523 }
1524 ok(!IsWindowUnicode(server) == !unicode, "wrong unicode type\n");
1525 return server;
1526}
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static LRESULT WINAPI dde_server_wndprocA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dde.c:1220
static ATOM server
Definition: dde.c:849
static LRESULT WINAPI dde_server_wndprocW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dde.c:1351
#define WS_POPUP
Definition: pedump.c:616
#define memset(x, y, z)
Definition: compat.h:39
HINSTANCE hInstance
Definition: winuser.h:3274
LPCSTR lpszClassName
Definition: winuser.h:3279
WNDPROC lpfnWndProc
Definition: winuser.h:3271
LPCWSTR lpszClassName
Definition: winuser.h:3292
HINSTANCE hInstance
Definition: winuser.h:3287
WNDPROC lpfnWndProc
Definition: winuser.h:3284
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
BOOL WINAPI IsWindowUnicode(_In_ HWND)
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define CW_USEDEFAULT
Definition: winuser.h:225
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_dde_aw_transaction().

◆ create_dde_window()

static void create_dde_window ( HWND hwnd,
LPCSTR  name,
WNDPROC  wndproc 
)
static

Definition at line 87 of file dde.c.

88{
89 WNDCLASSA wcA;
90 ATOM aclass;
91
92 memset(&wcA, 0, sizeof(wcA));
93 wcA.lpfnWndProc = wndproc;
94 wcA.lpszClassName = name;
96 aclass = RegisterClassA(&wcA);
97 ok (aclass, "RegisterClass failed\n");
98
100 500, 500, CW_USEDEFAULT, CW_USEDEFAULT,
102 ok(*hwnd != NULL, "CreateWindowExA failed\n");
103}
WORD ATOM
Definition: dimm.idl:113
Definition: name.c:39
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by test_msg_client(), and test_msg_server().

◆ create_execute()

static HGLOBAL create_execute ( LPCSTR  command)
static

Definition at line 1043 of file dde.c.

1044{
1045 HGLOBAL hglobal;
1046 LPSTR ptr;
1047
1048 hglobal = GlobalAlloc(GMEM_DDESHARE, lstrlenA(command) + 1);
1049 ok(hglobal != 0, "Expected non-NULL hglobal\n");
1050
1051 ptr = GlobalLock(hglobal);
1053 GlobalUnlock(hglobal);
1054
1055 return hglobal;
1056}
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static PVOID ptr
Definition: dispmode.c:27
#define GMEM_DDESHARE
Definition: winbase.h:322
char * LPSTR
Definition: xmlstorage.h:182

Referenced by test_msg_client().

◆ create_poke()

static HGLOBAL create_poke ( void  )
static

Definition at line 1022 of file dde.c.

1023{
1024 HGLOBAL hglobal;
1025 DDEPOKE *poke;
1026 DWORD size;
1027
1028 size = FIELD_OFFSET(DDEPOKE, Value[sizeof("poke data\r\n")]);
1029 hglobal = GlobalAlloc(GMEM_DDESHARE, size);
1030 ok(hglobal != 0, "Expected non-NULL hglobal\n");
1031
1032 poke = GlobalLock(hglobal);
1033 poke->unused = 0;
1034 poke->fRelease = TRUE;
1035 poke->fReserved = TRUE;
1036 poke->cfFormat = CF_TEXT;
1037 lstrcpyA((LPSTR)poke->Value, "poke data\r\n");
1038 GlobalUnlock(hglobal);
1039
1040 return hglobal;
1041}
#define CF_TEXT
Definition: constants.h:396
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
Definition: dde.h:72
short cfFormat
Definition: dde.h:74
BYTE Value[1]
Definition: dde.h:75
unsigned short unused
Definition: dde.h:73
unsigned short fReserved
Definition: dde.h:73
unsigned short fRelease
Definition: dde.h:73
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by test_msg_client().

◆ create_process()

static HANDLE create_process ( const char arg)
static

Definition at line 46 of file dde.c.

47{
48 STARTUPINFOA si = {.cb = sizeof(si)};
50 char cmdline[200];
51 char **argv;
52 BOOL ret;
53
55 sprintf(cmdline, "\"%s\" %s %s", argv[0], argv[1], arg);
57 ok(ret, "CreateProcess failed: %lu\n", GetLastError());
59 return pi.hProcess;
60}
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:686
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
#define sprintf
Definition: sprintf.c:45
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
#define argv
Definition: mplay32.c:18
int winetest_get_mainargs(char ***pargv)
TCHAR * cmdline
Definition: stretchblt.cpp:32
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ dde_msg_client_wndproc()

static LRESULT WINAPI dde_msg_client_wndproc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 852 of file dde.c.

853{
854 char str[MAX_PATH];
855 UINT_PTR lo, hi;
856 DDEDATA *data;
857 DDEACK *ack;
858 DWORD size;
859 LPSTR ptr;
860
861 static int msg_index = 0;
862
863 if (msg < WM_DDE_FIRST || msg > WM_DDE_LAST)
865
866 msg_index++;
867
868 switch (msg)
869 {
870 case WM_DDE_INITIATE:
871 {
872 ok(msg_index == 1, "Expected 1, got %d\n", msg_index);
873 ok(wparam == (WPARAM)client_hwnd, "Expected client hwnd, got %08Ix\n", wparam);
874
876 ok(LOWORD(lparam) == server, "Expected server atom, got %08x\n", LOWORD(lparam));
877 ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
878 ok(size == 13, "Expected 13, got %ld\n", size);
879
881 ok(HIWORD(lparam) == topic, "Expected topic atom, got %08x\n", HIWORD(lparam));
882 ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
883 ok(size == 12, "Expected 12, got %ld\n", size);
884
885 break;
886 }
887
888 case WM_DDE_ACK:
889 {
890 ok((msg_index >= 2 && msg_index <= 4) || (msg_index >= 6 && msg_index <= 11),
891 "Expected 2, 3, 4, 6, 7, 8, 9, 10 or 11, got %d\n", msg_index);
892
893 if (msg_index == 2)
894 {
896 ok(wparam != 0, "Expected non-NULL wparam, got %08Ix\n", wparam);
897
899 ok(LOWORD(lparam) == server, "Expected server atom, got %08x\n", LOWORD(lparam));
900 ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
901 ok(size == 13, "Expected 13, got %ld\n", size);
902
904 ok(HIWORD(lparam) == topic, "Expected topic atom, got %08x\n", HIWORD(lparam));
905 ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
906 ok(size == 12, "Expected 12, got %ld\n", size);
907 }
908 else if (msg_index >= 9 && msg_index <= 11)
909 {
910 ok(wparam == (WPARAM)server_hwnd, "Expected server hwnd, got %08Ix\n", wparam);
911
913
914 ack = (DDEACK *)&lo;
915 ok(ack->bAppReturnCode == 0, "Expected 0, got %d\n", ack->bAppReturnCode);
916 ok(ack->reserved == 0, "Expected 0, got %d\n", ack->reserved);
917 ok(ack->fBusy == FALSE, "Expected FALSE, got %d\n", ack->fBusy);
918
919 ok(hi == (UINT_PTR)execute_hglobal, "Expected execute hglobal, got %08Ix\n", hi);
920 ptr = GlobalLock((HGLOBAL)hi);
921
922 if (msg_index == 9)
923 {
924 ok(ack->fAck == TRUE, "Expected TRUE, got %d\n", ack->fAck);
925 ok(!lstrcmpA(ptr, "[Command(Var)]"), "Expected '[Command(Var)]', got %s\n", ptr);
926 } else if (msg_index == 10)
927 {
928 ok(ack->fAck == TRUE, "Expected TRUE, got %d\n", ack->fAck);
929 ok(!lstrcmpA(ptr, "[Command-2(Var)]"), "Expected '[Command-2(Var)]', got %s\n", ptr);
930 }
931 else
932 {
933 ok(ack->fAck == FALSE, "Expected FALSE, got %d\n", ack->fAck);
934 ok(!lstrcmpA(ptr, "[BadCommand(Var)]"), "Expected '[BadCommand(Var)]', got %s\n", ptr);
935 }
936
938 }
939 else
940 {
941 ok(wparam == (WPARAM)server_hwnd, "Expected server hwnd, got %08Ix\n", wparam);
942
944
945 ack = (DDEACK *)&lo;
946 ok(ack->bAppReturnCode == 0, "Expected 0, got %d\n", ack->bAppReturnCode);
947 ok(ack->reserved == 0, "Expected 0, got %d\n", ack->reserved);
948 ok(ack->fBusy == FALSE, "Expected FALSE, got %d\n", ack->fBusy);
949
950 if (msg_index >= 7)
951 ok(ack->fAck == TRUE, "Expected TRUE, got %d\n", ack->fAck);
952 else
953 {
954 if (msg_index == 6) todo_wine
955 ok(ack->fAck == FALSE, "Expected FALSE, got %d\n", ack->fAck);
956 }
957
959 if (msg_index == 3)
960 {
961 ok(hi == item, "Expected item atom, got %08Ix\n", hi);
962 ok(!lstrcmpA(str, "request"), "Expected request, got %s\n", str);
963 ok(size == 7, "Expected 7, got %ld\n", size);
964 }
965 else if (msg_index == 4 || msg_index == 7)
966 {
967 ok(hi == 0, "Expected 0, got %08Ix\n", hi);
968 ok(size == 0, "Expected empty string, got %ld\n", size);
969 }
970 else
971 {
972 ok(hi == item, "Expected item atom, got %08Ix\n", hi);
973 if (msg_index == 6) todo_wine
974 {
975 ok(!lstrcmpA(str, "poke"), "Expected poke, got %s\n", str);
976 ok(size == 4, "Expected 4, got %ld\n", size);
977 }
978 }
979 }
980
981 break;
982 }
983
984 case WM_DDE_DATA:
985 {
986 ok(msg_index == 5, "Expected 5, got %d\n", msg_index);
987 ok(wparam == (WPARAM)server_hwnd, "Expected server hwnd, got %08Ix\n", wparam);
988
990
991 data = GlobalLock((HGLOBAL)lo);
992 ok(data->unused == 0, "Expected 0, got %d\n", data->unused);
993 ok(data->fResponse == TRUE, "Expected TRUE, got %d\n", data->fResponse);
995 {
996 ok(data->fRelease == TRUE, "Expected TRUE, got %d\n", data->fRelease);
997 }
998 ok(data->fAckReq == 0, "Expected 0, got %d\n", data->fAckReq);
999 ok(data->cfFormat == CF_TEXT, "Expected CF_TEXT, got %d\n", data->cfFormat);
1000 ok(!lstrcmpA((LPSTR)data->Value, "requested data\r\n"),
1001 "Expected 'requested data\\r\\n', got %s\n", data->Value);
1002 GlobalUnlock((HGLOBAL)lo);
1003
1005 ok(hi == item, "Expected item atom, got %08x\n", HIWORD(lparam));
1006 ok(!lstrcmpA(str, "request"), "Expected request, got %s\n", str);
1007 ok(size == 7, "Expected 7, got %ld\n", size);
1008
1009 GlobalFree((HGLOBAL)lo);
1010 GlobalDeleteAtom(hi);
1011
1012 break;
1013 }
1014
1015 default:
1016 ok(FALSE, "Unhandled msg: %08x\n", msg);
1017 }
1018
1019 return DefWindowProcA(hwnd, msg, wparam, lparam);
1020}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI UnpackDDElParam(UINT, LPARAM, PUINT_PTR, PUINT_PTR)
Definition: ddemisc.c:105
#define WM_DDE_DATA
Definition: dde.h:42
#define WM_DDE_LAST
Definition: dde.h:46
#define WM_DDE_ACK
Definition: dde.h:41
#define WM_DDE_INITIATE
Definition: dde.h:37
HANDLE HWND
Definition: compat.h:19
#define MAX_PATH
Definition: compat.h:34
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:444
UINT WINAPI GlobalGetAtomNameA(ATOM nAtom, LPSTR lpBuffer, int nSize)
Definition: atom.c:464
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4104
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define todo_wine
Definition: minitest.h:80
UINT_PTR WPARAM
Definition: minwindef.h:174
static int msg_index
Definition: dde.c:2390
static HWND client_hwnd
Definition: dde.c:848
static HWND server_hwnd
Definition: dde.c:848
static ATOM topic
Definition: dde.c:849
static HGLOBAL execute_hglobal
Definition: dde.c:850
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define LOWORD(l)
Definition: pedump.c:82
const WCHAR * str
Definition: dde.h:51
unsigned short fBusy
Definition: dde.h:52
unsigned short fAck
Definition: dde.h:52
unsigned short reserved
Definition: dde.h:52
unsigned short bAppReturnCode
Definition: dde.h:52
Definition: dde.h:57
#define HIWORD(l)
Definition: typedefs.h:247
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_msg_client().

◆ dde_server_wndproc()

static LRESULT WINAPI dde_server_wndproc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 111 of file dde.c.

112{
113 UINT_PTR lo, hi;
114 char str[MAX_PATH], *ptr;
115 HGLOBAL hglobal;
116 DDEDATA *data;
117 DDEPOKE *poke;
118 DWORD size;
119
120 static int msg_index = 0;
121 static HWND client = 0;
122 static BOOL executed = FALSE;
123
124 if (msg < WM_DDE_FIRST || msg > WM_DDE_LAST)
126
127 msg_index++;
128
129 switch (msg)
130 {
131 case WM_DDE_INITIATE:
132 {
133 client = (HWND)wparam;
134 ok(msg_index == 1, "Expected 1, got %d\n", msg_index);
135
137 ok(!lstrcmpA(str, "TestDDEService"), "Expected TestDDEService, got %s\n", str);
138
140 ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
141
143
144 break;
145 }
146
147 case WM_DDE_REQUEST:
148 {
149 ok((msg_index >= 2 && msg_index <= 4) ||
150 (msg_index >= 7 && msg_index <= 8),
151 "Expected 2, 3, 4, 7 or 8, got %d\n", msg_index);
152 ok(wparam == (WPARAM)client, "Expected client hwnd, got %08Ix\n", wparam);
153 ok(LOWORD(lparam) == CF_TEXT, "Expected CF_TEXT, got %d\n", LOWORD(lparam));
154
156 if (msg_index < 8)
157 ok(!lstrcmpA(str, "request"), "Expected request, got %s\n", str);
158 else
159 ok(!lstrcmpA(str, "executed"), "Expected executed, got %s\n", str);
160
161 if (msg_index == 8)
162 {
163 if (executed)
164 lstrcpyA(str, "command executed\r\n");
165 else
166 lstrcpyA(str, "command not executed\r\n");
167 }
168 else
169 lstrcpyA(str, "requested data\r\n");
170
172 hglobal = GlobalAlloc(GMEM_MOVEABLE, size);
173 ok(hglobal != NULL, "Expected non-NULL hglobal\n");
174
175 data = GlobalLock(hglobal);
177
178 /* setting fResponse to FALSE at this point destroys
179 * the internal messaging state of native dde
180 */
181 data->fResponse = TRUE;
182
183 if (msg_index == 2)
184 data->fRelease = TRUE;
185 else if (msg_index == 3)
186 data->fAckReq = TRUE;
187
188 data->cfFormat = CF_TEXT;
189 lstrcpyA((LPSTR)data->Value, str);
190 GlobalUnlock(hglobal);
191
194
195 break;
196 }
197
198 case WM_DDE_POKE:
199 {
200 ok(msg_index == 5 || msg_index == 6, "Expected 5 or 6, got %d\n", msg_index);
201 ok(wparam == (WPARAM)client, "Expected client hwnd, got %08Ix\n", wparam);
202
204
206 ok(!lstrcmpA(str, "poker"), "Expected poker, got %s\n", str);
207
208 poke = GlobalLock((HGLOBAL)lo);
209 ok(poke != NULL, "Expected non-NULL poke\n");
210 ok(poke->fReserved == 0, "Expected 0, got %d\n", poke->fReserved);
211 ok(poke->unused == 0, "Expected 0, got %d\n", poke->unused);
212 ok(poke->fRelease == TRUE, "Expected TRUE, got %d\n", poke->fRelease);
213 ok(poke->cfFormat == CF_TEXT, "Expected CF_TEXT, got %d\n", poke->cfFormat);
214
215 if (msg_index == 5)
216 {
217 size = GlobalSize((HGLOBAL)lo);
218 ok(size == 4, "got %ld\n", size);
219 }
220 else
221 ok(!lstrcmpA((LPSTR)poke->Value, "poke data\r\n"),
222 "Expected 'poke data\\r\\n', got %s\n", poke->Value);
223
225
228
229 break;
230 }
231
232 case WM_DDE_EXECUTE:
233 {
234 ok(msg_index == 7, "Expected 7, got %d\n", msg_index);
235 ok(wparam == (WPARAM)client, "Expected client hwnd, got %08Ix\n", wparam);
236
238 ok(!lstrcmpA(ptr, "[Command(Var)]"), "Expected [Command(Var)], got %s\n", ptr);
240
241 executed = TRUE;
242
245
246 break;
247 }
248
249 case WM_DDE_TERMINATE:
250 {
251 ok(msg_index == 9, "Expected 9, got %d\n", msg_index);
252 ok(wparam == (WPARAM)client, "Expected client hwnd, got %08Ix\n", wparam);
253 ok(lparam == 0, "Expected 0, got %08Ix\n", lparam);
254
256
257 break;
258 }
259
260 default:
261 ok(FALSE, "Unhandled msg: %08x\n", msg);
262 }
263
265}
#define WM_DDE_REQUEST
Definition: dde.h:43
LPARAM WINAPI ReuseDDElParam(LPARAM, UINT, UINT, UINT_PTR, UINT_PTR)
Definition: ddemisc.c:171
#define WM_DDE_POKE
Definition: dde.h:44
#define WM_DDE_EXECUTE
Definition: dde.h:45
LPARAM WINAPI PackDDElParam(UINT, UINT_PTR, UINT_PTR)
Definition: ddemisc.c:63
#define WM_DDE_TERMINATE
Definition: dde.h:38
#define DDE_FACK
Definition: ddeml.h:216
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
#define ZeroMemory
Definition: minwinbase.h:31
static FILE * client
Definition: client.c:37
#define GMEM_MOVEABLE
Definition: winbase.h:318
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_msg_server().

◆ dde_server_wndprocA()

static LRESULT WINAPI dde_server_wndprocA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1220 of file dde.c.

1221{
1222 static BOOL client_unicode, conv_unicode;
1223 static int step;
1224
1225 switch (msg)
1226 {
1227 case WM_DDE_INITIATE:
1228 {
1230
1231 if (winetest_debug > 1) trace("server A: got WM_DDE_INITIATE from %p (%s) with %08Ix\n",
1232 (HWND)wparam, client_unicode ? "Unicode" : "ANSI", lparam);
1233
1234 if (LOWORD(lparam) == aService)
1235 {
1236 client_unicode = IsWindowUnicode((HWND)wparam);
1237 conv_unicode = client_unicode;
1238 if (step >= 10) client_unicode = !client_unicode; /* change the client window type */
1239
1240 if (client_unicode)
1243 else
1247 }
1248 else
1249 GlobalDeleteAtom(aService);
1250 return 0;
1251 }
1252
1253 case WM_DDE_EXECUTE:
1254 {
1255 DDEACK ack;
1256 WORD status;
1257 LPCSTR cmd;
1258 UINT_PTR lo, hi;
1259
1260 if (winetest_debug > 1) trace("server A: got WM_DDE_EXECUTE from %p with %08Ix\n", (HWND)wparam, lparam);
1261
1263 if (winetest_debug > 1) trace("%08Ix => lo %04Ix hi %04Ix\n", lparam, lo, hi);
1264
1265 ack.bAppReturnCode = 0;
1266 ack.reserved = 0;
1267 ack.fBusy = 0;
1268 /* We have to send a negative acknowledge even if we don't
1269 * accept the command, otherwise Windows goes mad and next time
1270 * we send an acknowledge DDEML drops the connection.
1271 * Not sure how to call it: a bug or a feature.
1272 */
1273 ack.fAck = 0;
1274
1275 if ((cmd = GlobalLock((HGLOBAL)hi)))
1276 {
1278
1279 switch (step % 5)
1280 {
1281 case 0: /* bad command */
1282 break;
1283
1284 case 1: /* ANSI command */
1285 if (!conv_unicode)
1286 ok( !lstrcmpA(cmd, exec_cmdA), "server A got wrong command '%s'\n", cmd );
1287 else /* we get garbage as the A command was mapped W->A */
1288 ok( cmd[0] != exec_cmdA[0], "server A got wrong command '%s'\n", cmd );
1289 break;
1290
1291 case 2: /* ANSI command in Unicode format */
1292 if (conv_unicode)
1293 ok( !lstrcmpA(cmd, exec_cmdA), "server A got wrong command '%s'\n", cmd );
1294 else
1295 ok( !lstrcmpW((LPCWSTR)cmd, exec_cmdAW), "server A got wrong command '%s'\n", cmd );
1296 break;
1297
1298 case 3: /* Unicode command */
1299 if (!conv_unicode)
1300 ok( !lstrcmpW((LPCWSTR)cmd, exec_cmdW), "server A got wrong command '%s'\n", cmd );
1301 else /* correctly mapped W->A */
1302 ok( !lstrcmpA(cmd, exec_cmdWA), "server A got wrong command '%s'\n", cmd );
1303 break;
1304
1305 case 4: /* Unicode command in ANSI format */
1306 if (!conv_unicode)
1307 ok( !lstrcmpA(cmd, exec_cmdWA), "server A got wrong command '%s'\n", cmd );
1308 else /* we get garbage as the A command was mapped W->A */
1309 ok( cmd[0] != exec_cmdWA[0], "server A got wrong command '%s'\n", cmd );
1310 break;
1311 }
1312 GlobalUnlock((HGLOBAL)hi);
1313 }
1314 else ok( 0, "bad command data %Ix\n", hi );
1315
1316 step++;
1317
1318 status = *((WORD *)&ack);
1320
1322 return 0;
1323 }
1324
1325 case WM_DDE_TERMINATE:
1326 {
1327 DDEACK ack;
1328 WORD status;
1329
1330 if (winetest_debug > 1) trace("server A: got WM_DDE_TERMINATE from %#Ix with %08Ix\n", wparam, lparam);
1331
1332 ack.bAppReturnCode = 0;
1333 ack.reserved = 0;
1334 ack.fBusy = 0;
1335 ack.fAck = 1;
1336
1337 status = *((WORD *)&ack);
1339
1341 return 0;
1342 }
1343
1344 default:
1345 break;
1346 }
1347
1348 return DefWindowProcA(hwnd, msg, wparam, lparam);
1349}
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:434
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
#define ULONG_PTR
Definition: config.h:101
unsigned short WORD
Definition: ntddk_ex.h:93
static char exec_cmdWA[]
Definition: dde.c:40
static WCHAR exec_cmdW[]
Definition: dde.c:39
static LRESULT WINAPI hook_dde_client_wndprocA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dde.c:1182
static const WCHAR TEST_DDE_SERVICE[]
Definition: dde.c:35
static LRESULT WINAPI hook_dde_client_wndprocW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dde.c:1201
static WNDPROC old_dde_client_wndproc
Definition: dde.c:42
static char exec_cmdA[]
Definition: dde.c:37
static WCHAR exec_cmdAW[]
Definition: dde.c:38
Definition: ftp_var.h:139
Definition: ps.c:97
#define GWLP_WNDPROC
Definition: treelist.c:66
#define SetWindowLongPtrA
Definition: winuser.h:5510
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3013
#define SetWindowLongPtrW
Definition: winuser.h:5511
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
const char * LPCSTR
Definition: xmlstorage.h:183
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by create_dde_server().

◆ dde_server_wndprocW()

static LRESULT WINAPI dde_server_wndprocW ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1351 of file dde.c.

1352{
1353 static BOOL client_unicode, conv_unicode;
1354 static int step;
1355
1356 switch (msg)
1357 {
1358 case WM_DDE_INITIATE:
1359 {
1361
1362 if (LOWORD(lparam) == aService)
1363 {
1364 client_unicode = IsWindowUnicode((HWND)wparam);
1365 conv_unicode = client_unicode;
1366 if (step >= 10) client_unicode = !client_unicode; /* change the client window type */
1367
1368 if (client_unicode)
1371 else
1375 }
1376 else
1377 GlobalDeleteAtom(aService);
1378
1379 if (winetest_debug > 1)
1380 trace("server W: got WM_DDE_INITIATE from %p with %08Ix (client %s conv %s)\n", (HWND)wparam,
1381 lparam, client_unicode ? "Unicode" : "ANSI", conv_unicode ? "Unicode" : "ANSI" );
1382
1383 return 0;
1384 }
1385
1386 case WM_DDE_EXECUTE:
1387 {
1388 DDEACK ack;
1389 WORD status;
1390 LPCSTR cmd;
1391 UINT_PTR lo, hi;
1392
1393 if (winetest_debug > 1) trace("server W: got WM_DDE_EXECUTE from %#Ix with %08Ix\n", wparam, lparam);
1394
1396 if (winetest_debug > 1) trace("%08Ix => lo %04Ix hi %04Ix\n", lparam, lo, hi);
1397
1398 ack.bAppReturnCode = 0;
1399 ack.reserved = 0;
1400 ack.fBusy = 0;
1401 /* We have to send a negative acknowledge even if we don't
1402 * accept the command, otherwise Windows goes mad and next time
1403 * we send an acknowledge DDEML drops the connection.
1404 * Not sure how to call it: a bug or a feature.
1405 */
1406 ack.fAck = 0;
1407
1408 if ((cmd = GlobalLock((HGLOBAL)hi)))
1409 {
1411
1412 switch (step % 5)
1413 {
1414 case 0: /* bad command */
1415 break;
1416
1417 case 1: /* ANSI command */
1418 if (conv_unicode && !client_unicode) /* W->A mapping -> garbage */
1419 ok( cmd[0] != exec_cmdA[0], "server W got wrong command '%s'\n", cmd );
1420 else if (!conv_unicode && client_unicode) /* A->W mapping */
1421 ok( !lstrcmpW((LPCWSTR)cmd, exec_cmdAW), "server W got wrong command '%s'\n", cmd );
1422 else
1423 ok( !lstrcmpA(cmd, exec_cmdA), "server W got wrong command '%s'\n", cmd );
1424 break;
1425
1426 case 2: /* ANSI command in Unicode format */
1427 if (conv_unicode && !client_unicode) /* W->A mapping */
1428 ok( !lstrcmpA(cmd, exec_cmdA), "server W got wrong command '%s'\n", cmd );
1429 else if (!conv_unicode && client_unicode) /* A->W mapping */
1430 ok( *(WCHAR *)cmd == exec_cmdAW[0], "server W got wrong command '%s'\n", cmd );
1431 else
1432 ok( !lstrcmpW((LPCWSTR)cmd, exec_cmdAW), "server W got wrong command '%s'\n", cmd );
1433 break;
1434
1435 case 3: /* Unicode command */
1436 if (conv_unicode && !client_unicode) /* W->A mapping */
1437 ok( !lstrcmpA(cmd, exec_cmdWA), "server W got wrong command '%s'\n", cmd );
1438 else if (!conv_unicode && client_unicode) /* A->W mapping */
1439 ok( *(WCHAR *)cmd == exec_cmdW[0], "server W got wrong command '%s'\n", cmd );
1440 else
1441 ok( !lstrcmpW((LPCWSTR)cmd, exec_cmdW), "server W got wrong command '%s'\n", cmd );
1442 break;
1443
1444 case 4: /* Unicode command in ANSI format */
1445 if (conv_unicode && !client_unicode) /* W->A mapping -> garbage */
1446 ok( cmd[0] != exec_cmdWA[0], "server W got wrong command '%s'\n", cmd );
1447 else if (!conv_unicode && client_unicode) /* A->W mapping */
1448 ok( !lstrcmpW((LPCWSTR)cmd, exec_cmdW), "server W got wrong command '%s'\n", cmd );
1449 else
1450 ok( !lstrcmpA(cmd, exec_cmdWA), "server W got wrong command '%s'\n", cmd );
1451 break;
1452 }
1453 GlobalUnlock((HGLOBAL)hi);
1454 }
1455 else ok( 0, "bad command data %Ix\n", hi );
1456
1457 step++;
1458
1459 status = *((WORD *)&ack);
1461
1463 return 0;
1464 }
1465
1466 case WM_DDE_TERMINATE:
1467 {
1468 DDEACK ack;
1469 WORD status;
1470
1471 if (winetest_debug > 1) trace("server W: got WM_DDE_TERMINATE from %#Ix with %08Ix\n", wparam, lparam);
1472
1473 ack.bAppReturnCode = 0;
1474 ack.reserved = 0;
1475 ack.fBusy = 0;
1476 ack.fAck = 1;
1477
1478 status = *((WORD *)&ack);
1480
1482 return 0;
1483 }
1484
1485 default:
1486 break;
1487 }
1488
1489 return DefWindowProcW(hwnd, msg, wparam, lparam);
1490}
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by create_dde_server().

◆ destroy_dde_window()

static void destroy_dde_window ( HWND hwnd,
LPCSTR  name 
)
static

Definition at line 105 of file dde.c.

106{
109}
BOOL WINAPI UnregisterClassA(_In_ LPCSTR, HINSTANCE)
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by test_msg_client(), and test_msg_server().

◆ flush_events()

static void flush_events ( void  )
static

Definition at line 71 of file dde.c.

72{
73 MSG msg;
74 int diff = default_timeout;
75 int min_timeout = 50;
76 DWORD time = GetTickCount() + diff;
77
78 while (diff > 0)
79 {
80 if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
81 while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
82 diff = time - GetTickCount();
83 min_timeout = 10;
84 }
85}
#define WAIT_TIMEOUT
Definition: dderror.h:14
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
__u16 time
Definition: mkdosfs.c:8
static const DWORD default_timeout
Definition: dde.c:44
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define QS_ALLINPUT
Definition: winuser.h:914
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define PM_REMOVE
Definition: winuser.h:1207
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)

Referenced by test_msg_client().

◆ hook_dde_client_wndprocA()

static LRESULT WINAPI hook_dde_client_wndprocA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1182 of file dde.c.

1183{
1184 UINT_PTR lo, hi;
1185
1186 if (winetest_debug > 1) trace("hook_dde_client_wndprocA: %p %04x %08Ix %08Ix\n", hwnd, msg, wparam, lparam);
1187
1188 switch (msg)
1189 {
1190 case WM_DDE_ACK:
1191 UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
1192 if (winetest_debug > 1) trace("WM_DDE_ACK: status %04Ix hglobal %p\n", lo, (HGLOBAL)hi);
1193 break;
1194
1195 default:
1196 break;
1197 }
1199}
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by dde_server_wndprocA(), and dde_server_wndprocW().

◆ hook_dde_client_wndprocW()

static LRESULT WINAPI hook_dde_client_wndprocW ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1201 of file dde.c.

1202{
1203 UINT_PTR lo, hi;
1204
1205 if (winetest_debug > 1) trace("hook_dde_client_wndprocW: %p %04x %08Ix %08Ix\n", hwnd, msg, wparam, lparam);
1206
1207 switch (msg)
1208 {
1209 case WM_DDE_ACK:
1210 UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
1211 if (winetest_debug > 1) trace("WM_DDE_ACK: status %04Ix hglobal %p\n", lo, (HGLOBAL)hi);
1212 break;
1213
1214 default:
1215 break;
1216 }
1218}
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by dde_server_wndprocA(), and dde_server_wndprocW().

◆ is_cjk()

static BOOL is_cjk ( void  )
static

Definition at line 62 of file dde.c.

63{
64 int lang_id = PRIMARYLANGID(GetUserDefaultLangID());
65
66 if (lang_id == LANG_CHINESE || lang_id == LANG_JAPANESE || lang_id == LANG_KOREAN)
67 return TRUE;
68 return FALSE;
69}
LANGID WINAPI GetUserDefaultLangID(void)
Definition: locale.c:1182
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_KOREAN
Definition: nls.h:84

Referenced by EDIT_EM_SetMargins(), get_font_margins(), server_end_to_end_callback(), and test_margins_default().

◆ server_ddeml_callback()

static HDDEDATA CALLBACK server_ddeml_callback ( UINT  uType,
UINT  uFmt,
HCONV  hconv,
HSZ  hsz1,
HSZ  hsz2,
HDDEDATA  hdata,
ULONG_PTR  dwData1,
ULONG_PTR  dwData2 
)
static

Definition at line 586 of file dde.c.

589{
590 char str[MAX_PATH], *ptr;
591 HDDEDATA ret = NULL;
592 DWORD size;
593
594 static int msg_index = 0;
595 static HCONV conversation = 0;
596
597 msg_index++;
598
599 switch (uType)
600 {
601 case XTYP_REGISTER:
602 {
603 ok(msg_index == 1, "Expected 1, got %d\n", msg_index);
604 ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
605 ok(hconv == 0, "Expected 0, got %p\n", hconv);
606 ok(hdata == 0, "Expected 0, got %p\n", hdata);
607 ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
608 ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
609
611 ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
612 ok(size == 13, "Expected 13, got %ld\n", size);
613
615 ok(!strncmp(str, "TestDDEServer(", 14), "Expected TestDDEServer(, got %s\n", str);
616 ok(size == 17 + 2*sizeof(ULONG_PTR), "Got size %ld for %s\n", size, str);
617 ok(str[size - 1] == ')', "Expected ')', got %c\n", str[size - 1]);
618
619 return (HDDEDATA)TRUE;
620 }
621
622 case XTYP_CONNECT:
623 {
624 ok(msg_index == 2, "Expected 2, got %d\n", msg_index);
625 ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
626 ok(hconv == 0, "Expected 0, got %p\n", hconv);
627 ok(hdata == 0, "Expected 0, got %p\n", hdata);
628 ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
629 ok(dwData2 == FALSE, "Expected FALSE, got %08Ix\n", dwData2);
630
632 ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
633 ok(size == 12, "Expected 12, got %ld\n", size);
634
636 ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
637 ok(size == 13, "Expected 13, got %ld\n", size);
638
639 return (HDDEDATA)TRUE;
640 }
641
643 {
644 conversation = hconv;
645
646 ok(msg_index == 3, "Expected 3, got %d\n", msg_index);
647 ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
648 ok(hconv != NULL, "Expected non-NULL hconv\n");
649 ok(hdata == 0, "Expected 0, got %p\n", hdata);
650 ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
651 ok(dwData2 == FALSE, "Expected FALSE, got %08Ix\n", dwData2);
652
654 ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
655 ok(size == 12, "Expected 12, got %ld\n", size);
656
658 ok(!lstrcmpA(str, "TestDDEServer"), "Expected TestDDEServer, got %s\n", str);
659 ok(size == 13, "Expected 13, got %ld\n", size);
660
661 return (HDDEDATA)TRUE;
662 }
663
664 case XTYP_REQUEST:
665 {
666 ok(msg_index == 4 || msg_index == 5 || msg_index == 6,
667 "Expected 4, 5 or 6, got %d\n", msg_index);
668 ok(hconv == conversation, "Expected conversation handle, got %p\n", hconv);
669 ok(hdata == 0, "Expected 0, got %p\n", hdata);
670 ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
671 ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
672
673 if (msg_index == 4)
674 ok(uFmt == 0xbeef, "Expected 0xbeef, got %08x\n", uFmt);
675 else
676 ok(uFmt == CF_TEXT, "Expected CF_TEXT, got %08x\n", uFmt);
677
679 ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
680 ok(size == 12, "Expected 12, got %ld\n", size);
681
683
684 if (msg_index == 5)
685 {
686 {
687 ok(!lstrcmpA(str, ""), "Expected empty string, got %s\n", str);
688 ok(size == 1, "Expected 1, got %ld\n", size);
689 }
690 }
691 else if (msg_index == 6)
692 {
693 ok(!lstrcmpA(str, "request"), "Expected request, got %s\n", str);
694 ok(size == 7, "Expected 7, got %ld\n", size);
695 }
696
697 if (msg_index == 6)
698 {
699 lstrcpyA(str, "requested data\r\n");
701 0, hsz2, CF_TEXT, 0);
702 }
703
704 return NULL;
705 }
706
707 case XTYP_POKE:
708 {
709 ok(msg_index == 7 || msg_index == 8, "Expected 7 or 8, got %d\n", msg_index);
710 ok(uFmt == CF_TEXT, "Expected CF_TEXT, got %d\n", uFmt);
711 ok(hconv == conversation, "Expected conversation handle, got %p\n", hconv);
712 ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
713 ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
714
716 ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
717 ok(size == 12, "Expected 12, got %ld\n", size);
718
719 ptr = (LPSTR)DdeAccessData(hdata, &size);
720 ok(!lstrcmpA(ptr, "poke data\r\n"), "Expected 'poke data\\r\\n', got %s\n", ptr);
721 ok(size == 12, "Expected 12, got %ld\n", size);
722 DdeUnaccessData(hdata);
723
725 if (msg_index == 7)
726 {
727 {
728 ok(!lstrcmpA(str, ""), "Expected empty string, got %s\n", str);
729 ok(size == 1, "Expected 1, got %ld\n", size);
730 }
731 }
732 else
733 {
734 ok(!lstrcmpA(str, "poke"), "Expected poke, got %s\n", str);
735 ok(size == 4, "Expected 4, got %ld\n", size);
736 }
737
738 return (HDDEDATA)DDE_FACK;
739 }
740
741 case XTYP_EXECUTE:
742 {
743 ok(msg_index >= 9 && msg_index <= 11, "Expected 9 or 11, got %d\n", msg_index);
744 ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
745 ok(hconv == conversation, "Expected conversation handle, got %p\n", hconv);
746 ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
747 ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
748 ok(hsz2 == 0, "Expected 0, got %p\n", hsz2);
749
751 ok(!lstrcmpA(str, "TestDDETopic"), "Expected TestDDETopic, got %s\n", str);
752 ok(size == 12, "Expected 12, got %ld\n", size);
753
754 if (msg_index == 9 || msg_index == 11)
755 {
756 ptr = (LPSTR)DdeAccessData(hdata, &size);
757
758 if (msg_index == 9)
759 {
760 ok(!lstrcmpA(ptr, "[Command(Var)]"), "Expected '[Command(Var)]', got %s\n", ptr);
761 ok(size == 15, "Expected 15, got %ld\n", size);
762 ret = (HDDEDATA)DDE_FACK;
763 }
764 else
765 {
766 ok(!lstrcmpA(ptr, "[BadCommand(Var)]"), "Expected '[BadCommand(Var)]', got %s\n", ptr);
767 ok(size == 18, "Expected 18, got %ld\n", size);
769 }
770
771 DdeUnaccessData(hdata);
772 }
773 else if (msg_index == 10)
774 {
775 DWORD rsize = 0;
776
777 size = DdeGetData(hdata, NULL, 0, 0);
778 ok(size == 17, "DdeGetData should have returned 17 not %ld\n", size);
779 ptr = malloc(size);
780 ok(ptr != NULL, "malloc should have returned ptr not NULL\n");
781 rsize = DdeGetData(hdata, (LPBYTE)ptr, size, 0);
782 ok(rsize == size, "DdeGetData did not return %ld bytes but %ld\n", size, rsize);
783
784 ok(!lstrcmpA(ptr, "[Command-2(Var)]"), "Expected '[Command-2(Var)]' got %s\n", ptr);
785 ok(size == 17, "Expected 17, got %ld\n", size);
786 ret = (HDDEDATA)DDE_FACK;
787
788 free(ptr);
789 }
790
791 return ret;
792 }
793
794 case XTYP_DISCONNECT:
795 {
796 ok(msg_index == 12, "Expected 12, got %d\n", msg_index);
797 ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
798 ok(hconv == conversation, "Expected conversation handle, got %p\n", hconv);
799 ok(dwData1 == 0, "Expected 0, got %08Ix\n", dwData1);
800 ok(dwData2 == 0, "Expected 0, got %08Ix\n", dwData2);
801 ok(hsz1 == 0, "Expected 0, got %p\n", hsz2);
802 ok(hsz2 == 0, "Expected 0, got %p\n", hsz2);
803
804 return 0;
805 }
806
807 default:
808 ok(FALSE, "Unhandled msg: %08x\n", uType);
809 }
810
811 return 0;
812}
HDDEDATA WINAPI DdeCreateDataHandle(DWORD, LPBYTE, DWORD, DWORD, HSZ, UINT, UINT)
Definition: ddemisc.c:1275
#define XTYP_CONNECT
Definition: ddeml.h:186
#define XTYP_REQUEST
Definition: ddeml.h:191
#define XTYP_CONNECT_CONFIRM
Definition: ddeml.h:187
#define XTYP_REGISTER
Definition: ddeml.h:190
#define DDE_FNOTPROCESSED
Definition: ddeml.h:223
DWORD WINAPI DdeQueryStringA(DWORD, HSZ, LPSTR, DWORD, INT)
Definition: ddemisc.c:501
#define XTYP_POKE
Definition: ddeml.h:189
#define CP_WINANSI
Definition: ddeml.h:32
#define XTYP_EXECUTE
Definition: ddeml.h:185
BOOL WINAPI DdeUnaccessData(HDDEDATA)
Definition: ddemisc.c:1447
LPBYTE WINAPI DdeAccessData(HDDEDATA, LPDWORD)
Definition: ddemisc.c:1422
DWORD WINAPI DdeGetData(HDDEDATA, LPBYTE, DWORD, DWORD)
Definition: ddemisc.c:1379
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3330
static DWORD server_pid
Definition: dde.c:584
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by test_ddeml_server().

◆ server_end_to_end_callback()

static HDDEDATA CALLBACK server_end_to_end_callback ( UINT  uType,
UINT  uFmt,
HCONV  hconv,
HSZ  hsz1,
HSZ  hsz2,
HDDEDATA  hdata,
ULONG_PTR  dwData1,
ULONG_PTR  dwData2 
)
static

Definition at line 2393 of file dde.c.

2396{
2397 DWORD size, rsize;
2398 char str[MAX_PATH];
2399 static HCONV conversation = 0;
2400 static const char test_service [] = "TestDDEService";
2401 static const char test_topic [] = "TestDDETopic";
2402
2403 if (winetest_debug > 1) trace("type %#x, fmt %#x\n", uType, uFmt);
2404
2405 ok(msg_index < 5 + ARRAY_SIZE(test_cmd_w_to_w), "Got unexpected message type %#x.\n", uType);
2406 msg_index++;
2407
2408 switch (uType)
2409 {
2410 case XTYP_REGISTER:
2411 {
2412 ok(msg_index == 1, "Expected 1, got %d\n", msg_index);
2413 return (HDDEDATA)TRUE;
2414 }
2415
2416 case XTYP_CONNECT:
2417 {
2418 ok(msg_index == 2, "Expected 2, got %d\n", msg_index);
2419 ok(uFmt == 0, "Expected 0, got %d, msg_index=%d\n", uFmt, msg_index);
2420 ok(hconv == 0, "Expected 0, got %p, msg_index=%d\n", hconv, msg_index);
2421 ok(hdata == 0, "Expected 0, got %p, msg_index=%d\n", hdata, msg_index);
2422 ok(dwData1 != 0, "Expected not 0, got %08Ix, msg_index=%d\n", dwData1, msg_index);
2423 ok(dwData2 == FALSE, "Expected FALSE, got %08Ix, msg_index=%d\n", dwData2, msg_index);
2424
2426 ok(!lstrcmpA(str, test_topic), "Expected %s, got %s, msg_index=%d\n",
2427 test_topic, str, msg_index);
2428 ok(size == 12, "Expected 12, got %ld, msg_index=%d\n", size, msg_index);
2429
2431 ok(!lstrcmpA(str, test_service), "Expected %s, got %s, msg_index=%d\n",
2433 ok(size == 14, "Expected 14, got %ld, msg_index=%d\n", size, msg_index);
2434
2435 return (HDDEDATA) TRUE;
2436 }
2438 {
2439 ok(msg_index == 3, "Expected 3, got %d\n", msg_index);
2440 conversation = hconv;
2441 return (HDDEDATA) TRUE;
2442 }
2443 case XTYP_EXECUTE:
2444 {
2445 BYTE *buffer = NULL;
2446 WCHAR *cmd_w;
2447 char test_cmd_w_to_a[64];
2448 WCHAR test_cmd_a_to_w[64];
2449 DWORD size_a, size_w, size_w_to_a, size_a_to_w;
2450 BOOL str_index;
2451
2452 ok(uFmt == 0, "Expected 0, got %d\n", uFmt);
2453 ok(hconv == conversation, "Expected conversation handle, got %p, msg_index=%d\n",
2454 hconv, msg_index);
2455 ok(dwData1 == 0, "Expected 0, got %08Ix, msg_index=%d\n", dwData1, msg_index);
2456 ok(dwData2 == 0, "Expected 0, got %08Ix, msg_index=%d\n", dwData2, msg_index);
2457 ok(hsz2 == 0, "Expected 0, got %p, msg_index=%d\n", hsz2, msg_index);
2459 ok(!lstrcmpA(str, test_topic), "Expected %s, got %s, msg_index=%d\n",
2460 test_topic, str, msg_index);
2461 ok(size == 12, "Expected 12, got %ld, msg_index=%d\n", size, msg_index);
2462
2463 size = DdeGetData(hdata, NULL, 0, 0);
2464 ok((buffer = calloc(1, size)) != NULL, "should not be null\n");
2465 rsize = DdeGetData(hdata, buffer, size, 0);
2466 ok(rsize == size, "Incorrect size returned, expected %ld got %ld, msg_index=%d\n",
2467 size, rsize, msg_index);
2468 if (winetest_debug > 1) trace("msg %u strA \"%s\" strW %s\n", msg_index, buffer, wine_dbgstr_w((WCHAR*)buffer));
2469
2470 str_index = msg_index - 4;
2471 cmd_w = test_cmd_w_to_w[str_index - 1];
2472 size_a = strlen(test_cmd_a_to_a) + 1;
2473 size_w = (lstrlenW(cmd_w) + 1) * sizeof(WCHAR);
2474 size_a_to_w = MultiByteToWideChar( CP_ACP, 0, test_cmd_a_to_a, -1, test_cmd_a_to_w,
2475 ARRAY_SIZE(test_cmd_a_to_w)) * sizeof(WCHAR);
2476 size_w_to_a = WideCharToMultiByte( CP_ACP, 0, cmd_w, -1,
2477 test_cmd_w_to_a, sizeof(test_cmd_w_to_a), NULL, NULL );
2478 switch (str_index)
2479 {
2480 case 0: /* ANSI string */
2481 if (unicode_server)
2482 {
2483 ok(size == size_a_to_w, "Wrong size %ld/%ld, msg_index=%d\n", size, size_a_to_w, msg_index);
2484 ok(!lstrcmpW((WCHAR*)buffer, test_cmd_a_to_w),
2485 "Expected %s, msg_index=%d\n", wine_dbgstr_w(test_cmd_a_to_w), msg_index);
2486 }
2487 else if (unicode_client)
2488 {
2489 /* ANSI string mapped W->A -> garbage */
2490 }
2491 else
2492 {
2493 ok(size == size_a, "Wrong size %ld/%ld, msg_index=%d\n", size, size_a, msg_index);
2494 ok(!lstrcmpA((CHAR*)buffer, test_cmd_a_to_a), "Expected %s, got %s, msg_index=%d\n",
2496 }
2497 break;
2498
2499 case 1: /* Unicode string with only 8-bit chars */
2500 if (unicode_server)
2501 {
2502 ok(size == size_w, "Wrong size %ld/%ld, msg_index=%d\n", size, size_w, msg_index);
2503 ok(!lstrcmpW((WCHAR*)buffer, cmd_w),
2504 "Expected %s, msg_index=%d\n", wine_dbgstr_w(cmd_w), msg_index);
2505 }
2506 else
2507 {
2508 ok(size == size_w_to_a, "Wrong size %ld/%ld, msg_index=%d\n",
2509 size, size_w_to_a, msg_index);
2510 ok(!lstrcmpA((CHAR*)buffer, test_cmd_w_to_a), "Expected %s, got %s, msg_index=%d\n",
2511 test_cmd_w_to_a, buffer, msg_index);
2512 }
2513 break;
2514
2515 case 2: /* normal Unicode string */
2516 case 3: /* IsTextUnicode false negative */
2517 case 4: /* Chinese chars */
2518 if (unicode_server)
2519 {
2520 /* double A->W mapping */
2521 /* NT uses the full size, XP+ only until the first null */
2522 DWORD nt_size = MultiByteToWideChar( CP_ACP, 0, (char *)cmd_w, size_w, test_cmd_a_to_w,
2523 ARRAY_SIZE(test_cmd_a_to_w)) * sizeof(WCHAR);
2524 DWORD xp_size = MultiByteToWideChar( CP_ACP, 0, (char *)cmd_w, -1, NULL, 0 ) * sizeof(WCHAR);
2525 ok(size == xp_size || broken(size == nt_size) ||
2526 broken(str_index == 4 && IsDBCSLeadByte(cmd_w[0])) /* East Asian */,
2527 "Wrong size %ld/%ld, msg_index=%d\n", size, size_a_to_w, msg_index);
2528 ok(!lstrcmpW((WCHAR*)buffer, test_cmd_a_to_w),
2529 "Expected %s, msg_index=%d\n", wine_dbgstr_w(test_cmd_a_to_w), msg_index);
2530 }
2531 else if (unicode_client)
2532 {
2533 ok(size == size_w_to_a, "Wrong size %ld/%ld, msg_index=%d\n", size, size_w_to_a, msg_index);
2534 ok(!lstrcmpA((CHAR*)buffer, test_cmd_w_to_a), "Expected %s, got %s, msg_index=%d\n",
2535 test_cmd_w_to_a, buffer, msg_index);
2536 }
2537 else
2538 {
2539 ok(size == size_w, "Wrong size %ld/%ld, msg_index=%d\n", size, size_w, msg_index);
2540 ok(!lstrcmpW((WCHAR*)buffer, cmd_w),
2541 "Expected %s, msg_index=%d\n", wine_dbgstr_w(cmd_w), msg_index);
2542 }
2543 break;
2544 case 5: /* Chinese with latin characters begin */
2546 {
2547 todo_wine ok(size == size_w, "Wrong size %ld expected %ld, msg_index=%d\n", size, size_w, msg_index);
2548 MultiByteToWideChar(CP_ACP, 0, test_cmd_w_to_a, size_w, test_cmd_a_to_w,
2549 ARRAY_SIZE(test_cmd_a_to_w));
2550 todo_wine ok(!lstrcmpW((WCHAR*)buffer, cmd_w),
2551 "Expected %s got %s, msg_index=%d\n", wine_dbgstr_w(cmd_w), wine_dbgstr_w((WCHAR *)buffer), msg_index);
2552 }
2553 else if (unicode_server)
2554 {
2555 todo_wine ok(size == size_w, "Wrong size %ld expected %ld, msg_index=%d\n", size, size_w, msg_index);
2556 MultiByteToWideChar(CP_ACP, 0, test_cmd_w_to_a, size_w, test_cmd_a_to_w,
2557 ARRAY_SIZE(test_cmd_a_to_w));
2558 if (!is_cjk())
2559 todo_wine ok(!lstrcmpW((WCHAR*)buffer, test_cmd_a_to_w), "Expected %s, got %s, msg_index=%d\n",
2560 wine_dbgstr_w(test_cmd_a_to_w), wine_dbgstr_w((WCHAR*)buffer), msg_index);
2561 else
2562 todo_wine ok(!lstrcmpW((WCHAR*)buffer, cmd_w),
2563 "Expected %s got %s, msg_index=%d\n", wine_dbgstr_w(cmd_w), wine_dbgstr_w((WCHAR *)buffer), msg_index);
2564 }
2565 else if (unicode_client)
2566 {
2567 ok(size == size_w_to_a, "Wrong size %ld expected %ld, msg_index=%d\n", size, size_w_to_a, msg_index);
2568 ok(!lstrcmpA((CHAR*)buffer, test_cmd_w_to_a), "Expected %s, got %s, msg_index=%d\n",
2569 test_cmd_w_to_a, buffer, msg_index);
2570 }
2571 else
2572 {
2573 todo_wine ok(size == size_w_to_a || size == (size_w_to_a - 1), "Wrong size %ld expected %ld or %ld, msg_index=%d\n",
2574 size, size_w_to_a, size_w_to_a - 1, msg_index);
2575 todo_wine ok(!lstrcmpA((CHAR*)buffer, test_cmd_w_to_a), "Expected %s, got %s, msg_index=%d\n",
2576 test_cmd_w_to_a, buffer, msg_index);
2577 }
2578 break;
2579
2580 default:
2581 ok( 0, "Invalid message %u\n", msg_index );
2582 break;
2583 }
2584 free(buffer);
2585 return (HDDEDATA) DDE_FACK;
2586 }
2587 case XTYP_DISCONNECT:
2588 return (HDDEDATA) TRUE;
2589
2590 default:
2591 ok(FALSE, "Unhandled msg: %08x, msg_index=%d\n", uType, msg_index);
2592 }
2593
2594 return NULL;
2595}
#define broken(x)
Definition: atltest.h:178
#define ARRAY_SIZE(A)
Definition: main.h:20
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI IsDBCSLeadByte(BYTE testchar)
Definition: locale.c:2126
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
GLuint buffer
Definition: glext.h:5915
#define wine_dbgstr_w
Definition: kernel32.h:34
static void test_service(void)
Definition: service.c:441
static WCHAR test_cmd_w_to_w[][32]
Definition: dde.c:2383
static char test_cmd_a_to_a[]
Definition: dde.c:2382
static BOOL is_cjk(void)
Definition: dde.c:62
static BOOL unicode_client
Definition: dde.c:2391
static BOOL unicode_server
Definition: dde.c:2391
#define calloc
Definition: rosglue.h:14
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_end_to_end_server().

◆ START_TEST()

START_TEST ( dde  )

Definition at line 2722 of file dde.c.

2723{
2724 int argc;
2725 char **argv;
2726 DWORD dde_inst = 0xdeadbeef;
2727
2729 if (argc == 3)
2730 {
2731 if (!lstrcmpA(argv[2], "ddeml"))
2733 else if (!lstrcmpA(argv[2], "msg"))
2735 else if (!lstrcmpA(argv[2], "enda"))
2737 else if (!lstrcmpA(argv[2], "endw"))
2739
2740 return;
2741 }
2742
2744
2746
2749
2750 /* Test the combinations of A and W interfaces with A and W data
2751 end to end to ensure that data conversions are accurate */
2762
2767
2768#if defined(__REACTOS__) && defined(__GNUC__)
2769 if (is_reactos()) {
2770 ok(FALSE, "FIXME: Running these test_dde_aw_transaction() tests again crashes GCC ReactOS but not MSVC ReactOS!\n");
2771 } else {
2772#endif
2775#if defined(__REACTOS__) && defined(__GNUC__)
2776 }
2777#endif
2780
2786}
UINT WINAPI DdeInitializeW(LPDWORD, PFNCALLBACK, DWORD, DWORD)
Definition: ddemisc.c:1095
#define APPCMD_CLIENTONLY
Definition: ddeml.h:122
MonoAssembly int argc
Definition: metahost.c:107
static DWORD dde_inst
Definition: iexplore.c:59
static void test_PackDDElParam(void)
Definition: dde.c:2129
static void test_end_to_end_client(BOOL type_a)
Definition: dde.c:2613
static void test_dde_aw_transaction(BOOL client_unicode, BOOL server_unicode)
Definition: dde.c:1549
static void test_DdeCreateDataHandle(void)
Definition: dde.c:1881
static void test_DdeCreateStringHandle(void)
Definition: dde.c:2058
static void test_msg_server(void)
Definition: dde.c:267
static HDDEDATA CALLBACK client_ddeml_callback(UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
Definition: dde.c:288
static void test_ddeml_server(void)
Definition: dde.c:814
static void test_end_to_end_server(void)
Definition: dde.c:2681
static void test_FreeDDElParam(void)
Definition: dde.c:2080
static void test_ddeml_client(void)
Definition: dde.c:296
static void test_initialisation(void)
Definition: dde.c:1752
static void test_UnpackDDElParam(void)
Definition: dde.c:2269
static void test_msg_client(void)
Definition: dde.c:1058

◆ test_dde_aw_transaction()

static void test_dde_aw_transaction ( BOOL  client_unicode,
BOOL  server_unicode 
)
static

Definition at line 1549 of file dde.c.

1550{
1551 HSZ hsz_server;
1553 HCONV hconv;
1554 HWND hwnd_server;
1555 CONVINFO info;
1556 HDDEDATA hdata;
1557 BOOL conv_unicode = client_unicode;
1558 BOOL got;
1559 static char test_cmd[] = "test dde command";
1560
1561 if (!(hwnd_server = create_dde_server( server_unicode ))) return;
1562
1563 dde_inst = 0;
1564 if (client_unicode)
1566 else
1568 ok(ret == DMLERR_NO_ERROR, "DdeInitializeA failed with error %04lx (%x)\n",
1570
1572
1573 hconv = DdeConnect(dde_inst, hsz_server, 0, NULL);
1574 if (broken(!hconv)) /* Windows 10 version 1607 */
1575 {
1576 win_skip("Failed to connect; error %#x.\n", DdeGetLastError(dde_inst));
1578 return;
1579 }
1581 ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
1582
1583 info.cb = sizeof(info);
1584 ret = DdeQueryConvInfo(hconv, QID_SYNC, &info);
1585 ok(ret, "wrong info size %ld, DdeQueryConvInfo error %x\n", ret, DdeGetLastError(dde_inst));
1586#if !defined(__REACTOS__) || !defined(_WIN64)
1587 ok(info.ConvCtxt.iCodePage == (client_unicode ? CP_WINUNICODE : CP_WINANSI),
1588 "wrong iCodePage %d\n", info.ConvCtxt.iCodePage);
1589 ok(!info.hConvPartner, "unexpected info.hConvPartner: %p\n", info.hConvPartner);
1590todo_wine {
1591 ok((info.wStatus & DDE_FACK), "unexpected info.wStatus: %04x\n", info.wStatus);
1592}
1593 ok((info.wStatus & (ST_CONNECTED | ST_CLIENT)) == (ST_CONNECTED | ST_CLIENT), "unexpected info.wStatus: %04x\n", info.wStatus);
1594 ok(info.wConvst == XST_CONNECTED, "unexpected info.wConvst: %04x\n", info.wConvst);
1595#endif
1596 ok(info.wType == 0, "unexpected info.wType: %04x\n", info.wType);
1597
1598 client_unicode = IsWindowUnicode( info.hwnd );
1599
1600 ret = 0xdeadbeef;
1601 hdata = DdeClientTransaction((LPBYTE)test_cmd, strlen(test_cmd) + 1, hconv, (HSZ)0xdead, 0xbeef, XTYP_EXECUTE, 1000, &ret);
1602 ok(!hdata, "DdeClientTransaction succeeded\n");
1603 ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
1605 ok(err == DMLERR_NOTPROCESSED, "wrong dde error %lx\n", err);
1606
1607 ret = 0xdeadbeef;
1608 hdata = DdeClientTransaction((LPBYTE)exec_cmdA, lstrlenA(exec_cmdA) + 1, hconv, 0, 0, XTYP_EXECUTE, 1000, &ret);
1610 if (conv_unicode && (!client_unicode || !server_unicode)) /* W->A mapping -> garbage */
1611 {
1612#ifdef __REACTOS__
1613 ok(!hdata || broken(hdata != 0) /* WS03 */, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1614 ok(ret == DDE_FNOTPROCESSED || broken(ret == DDE_FACKREQ) /* WS03 */, "wrong status code %04lx\n", ret);
1615 ok(err == DMLERR_NOTPROCESSED || broken(err == DMLERR_NO_ERROR) /* WS03 */, "DdeClientTransaction returned error %lx\n", err);
1616#else
1617 ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1618 ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
1619 ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
1620#endif
1621 }
1622 else if (!conv_unicode && client_unicode && server_unicode) /* A->W mapping -> wrong cmd */
1623 {
1624 ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1625 ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
1626 ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
1627 }
1628 else /* no mapping */
1629 {
1630#ifdef __REACTOS__
1631 ok(hdata != 0 || broken(!hdata) /* WS03 */, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1632 ok(ret == DDE_FACK || broken(ret == DDE_FNOTPROCESSED) /* WS03 */, "wrong status code %04lx\n", ret);
1633 ok(err == DMLERR_NO_ERROR || broken(err == DMLERR_NOTPROCESSED) /* WS03 */, "wrong dde error %lx\n", err);
1634#else
1635 ok(hdata != 0, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1636 ok(ret == DDE_FACK, "wrong status code %04lx\n", ret);
1637 ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
1638#endif
1639 }
1640
1641 ret = 0xdeadbeef;
1643 hconv, 0, 0, XTYP_EXECUTE, 1000, &ret);
1645 if (conv_unicode && (!client_unicode || !server_unicode)) /* W->A mapping */
1646 {
1647#ifdef __REACTOS__
1648 ok(hdata != 0 || broken(!hdata) /* WS03 */, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1649 ok(ret == DDE_FACK || broken(ret == DDE_FNOTPROCESSED) /* WS03 */, "wrong status code %04lx\n", ret);
1650 ok(err == DMLERR_NO_ERROR || broken(err == DMLERR_NOTPROCESSED) /* WS03 */, "wrong dde error %lx\n", err);
1651#else
1652 ok(hdata != 0, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1653 ok(ret == DDE_FACK, "wrong status code %04lx\n", ret);
1654 ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
1655#endif
1656 }
1657 else if (!conv_unicode && client_unicode && server_unicode) /* A->W mapping -> garbage */
1658 {
1659 ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1660 ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
1661 ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
1662 }
1663 else /* no mapping */
1664 {
1665 ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1666 ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
1667 ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
1668 }
1669
1670 ret = 0xdeadbeef;
1671 hdata = DdeClientTransaction((LPBYTE)exec_cmdW, (lstrlenW(exec_cmdW) + 1) * sizeof(WCHAR), hconv, 0, 0, XTYP_EXECUTE, 1000, &ret);
1673 if (conv_unicode && (!client_unicode || !server_unicode)) /* W->A mapping -> wrong cmd */
1674 {
1675#ifdef __REACTOS__
1676 ok(!hdata || broken(hdata) /* WS03 */, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1677 ok(ret == DDE_FNOTPROCESSED || broken(ret == DDE_FACKREQ) /* WS03 */, "wrong status code %04lx\n", ret);
1678 ok(err == DMLERR_NOTPROCESSED || broken(err == DMLERR_NO_ERROR) /* WS03 */, "DdeClientTransaction returned error %lx\n", err);
1679#else
1680 ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1681 ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
1682 ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
1683#endif
1684 }
1685 else if (!conv_unicode && client_unicode && server_unicode) /* A->W mapping -> garbage */
1686 {
1687 ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1688 ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
1689 ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
1690 }
1691 else /* no mapping */
1692 {
1693#ifdef __REACTOS__
1694 ok(hdata != 0 || broken(!hdata) /* WS03 */, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1695 ok(ret == DDE_FACK || broken(ret == DDE_FNOTPROCESSED) /* WS03 */, "wrong status code %04lx\n", ret);
1696 ok(err == DMLERR_NO_ERROR || broken(err == DMLERR_NOTPROCESSED) /* WS03 */, "wrong dde error %lx\n", err);
1697#else
1698 ok(hdata != 0, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1699 ok(ret == DDE_FACK, "wrong status code %04lx\n", ret);
1700 ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
1701#endif
1702 }
1703
1704 ret = 0xdeadbeef;
1705 hdata = DdeClientTransaction((LPBYTE)exec_cmdWA, lstrlenA(exec_cmdWA) + 1, hconv, 0, 0, XTYP_EXECUTE, 1000, &ret);
1707 if (conv_unicode && (!client_unicode || !server_unicode)) /* W->A mapping -> garbage */
1708 {
1709 ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1710 ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
1711 ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
1712 }
1713 else if (!conv_unicode && client_unicode && server_unicode) /* A->W mapping */
1714 {
1715 ok(hdata != 0, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1716 ok(ret == DDE_FACK, "wrong status code %04lx\n", ret);
1717 ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
1718 }
1719 else /* no mapping */
1720 {
1721#ifdef __REACTOS__
1722 ok(!hdata || broken(hdata) /* WS03 */, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1723 ok(ret == DDE_FNOTPROCESSED || broken(ret == DDE_FACKREQ) /* WS03 */, "wrong status code %04lx\n", ret);
1724 ok(err == DMLERR_NOTPROCESSED || broken(err == DMLERR_NO_ERROR) /* WS03 */, "DdeClientTransaction returned error %lx\n", err);
1725#else
1726 ok(!hdata, "DdeClientTransaction returned %p, error %lx\n", hdata, err);
1727 ok(ret == DDE_FNOTPROCESSED, "wrong status code %04lx\n", ret);
1728 ok(err == DMLERR_NOTPROCESSED, "DdeClientTransaction returned error %lx\n", err);
1729#endif
1730 }
1731
1732 got = DdeDisconnect(hconv);
1733 ok(got, "DdeDisconnect error %x\n", DdeGetLastError(dde_inst));
1734
1735 info.cb = sizeof(info);
1736 ret = DdeQueryConvInfo(hconv, QID_SYNC, &info);
1737 ok(!ret, "DdeQueryConvInfo should fail\n");
1739todo_wine {
1740 ok(err == DMLERR_INVALIDPARAMETER, "wrong dde error %lx\n", err);
1741}
1742
1743 got = DdeFreeStringHandle(dde_inst, hsz_server);
1744 ok(got, "DdeFreeStringHandle error %x\n", DdeGetLastError(dde_inst));
1745
1746 /* This call hangs on win2k SP4 and XP SP1.
1747 DdeUninitialize(dde_inst);*/
1748
1749 DestroyWindow(hwnd_server);
1750}
HDDEDATA WINAPI DdeClientTransaction(LPBYTE, DWORD, HCONV, HSZ, UINT, UINT, DWORD, LPDWORD)
Definition: ddeclient.c:1122
UINT WINAPI DdeQueryConvInfo(HCONV, DWORD, PCONVINFO)
Definition: ddemisc.c:2426
#define ST_CONNECTED
Definition: ddeml.h:80
#define ST_CLIENT
Definition: ddeml.h:84
#define DMLERR_NO_ERROR
Definition: ddeml.h:242
BOOL WINAPI DdeUninitialize(DWORD)
Definition: ddemisc.c:1112
HCONV WINAPI DdeConnect(DWORD, HSZ, HSZ, PCONVCONTEXT)
Definition: ddeclient.c:84
#define DMLERR_NOTPROCESSED
Definition: ddeml.h:255
UINT WINAPI DdeGetLastError(DWORD)
Definition: ddemisc.c:253
HSZ WINAPI DdeCreateStringHandleW(DWORD, LPCWSTR, INT)
Definition: ddemisc.c:608
BOOL WINAPI DdeFreeStringHandle(DWORD, HSZ)
Definition: ddemisc.c:631
BOOL WINAPI DdeDisconnect(HCONV)
Definition: ddeclient.c:1363
#define QID_SYNC
Definition: ddeml.h:40
#define XST_CONNECTED
Definition: ddeml.h:64
#define CP_WINUNICODE
Definition: ddeml.h:33
#define DMLERR_INVALIDPARAMETER
Definition: ddeml.h:252
UINT WINAPI DdeInitializeA(LPDWORD, PFNCALLBACK, DWORD, DWORD)
Definition: ddemisc.c:1075
#define DDE_FACKREQ
Definition: ddeml.h:219
#define win_skip
Definition: minitest.h:67
static HWND create_dde_server(BOOL unicode)
Definition: dde.c:1492
static HDDEDATA CALLBACK client_dde_callback(UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
Definition: dde.c:1528
#define err(...)

Referenced by START_TEST().

◆ test_DdeCreateDataHandle()

static void test_DdeCreateDataHandle ( void  )
static

Definition at line 1881 of file dde.c.

1882{
1883 HDDEDATA hdata;
1884 DWORD dde_inst, dde_inst2;
1885 DWORD size;
1886 UINT res, err;
1887 BOOL ret;
1888 HSZ item;
1889 LPBYTE ptr;
1890 WCHAR item_str[] = {'i','t','e','m',0};
1891
1892 dde_inst = 0;
1893 dde_inst2 = 0;
1895 ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
1896
1898 ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
1899
1900 /* 0 instance id
1901 * This block tests an invalid instance Id. The correct behaviour is that if the instance Id
1902 * is invalid then the lastError of all instances is set to the error. There are two instances
1903 * created, lastError is cleared, an error is generated and then both instances are checked to
1904 * ensure that they both have the same error set
1905 */
1907 ok(item == NULL, "Expected NULL hsz got %p\n", item);
1909 ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
1910 err = DdeGetLastError(dde_inst2);
1911 ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
1913 ok(item == NULL, "Expected NULL hsz got %p\n", item);
1915 ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
1916 err = DdeGetLastError(dde_inst2);
1917 ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
1918
1920 ok(item != NULL, "Expected non-NULL hsz\n");
1921 item = DdeCreateStringHandleA(dde_inst2, "item", CP_WINANSI);
1922 ok(item != NULL, "Expected non-NULL hsz\n");
1923
1924 hdata = DdeCreateDataHandle(0xdeadbeef, (LPBYTE)"data", MAX_PATH, 0, item, CF_TEXT, 0);
1925
1926 /* 0 instance id
1927 * This block tests an invalid instance Id. The correct behaviour is that if the instance Id
1928 * is invalid then the lastError of all instances is set to the error. There are two instances
1929 * created, lastError is cleared, an error is generated and then both instances are checked to
1930 * ensure that they both have the same error set
1931 */
1933 DdeGetLastError(dde_inst2);
1934 hdata = DdeCreateDataHandle(0, (LPBYTE)"data", MAX_PATH, 0, item, CF_TEXT, 0);
1936 ok(hdata == NULL, "Expected NULL, got %p\n", hdata);
1937 ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
1938 err = DdeGetLastError(dde_inst2);
1939 ok(err == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", err);
1940
1941 ret = DdeUninitialize(dde_inst2);
1942 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1943
1944
1945 /* NULL pSrc */
1949 ok(hdata != NULL, "Expected non-NULL hdata\n");
1950 ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
1951
1952 ptr = DdeAccessData(hdata, &size);
1953 ok(ptr != NULL, "Expected non-NULL ptr\n");
1954 ok(size == 260, "Expected 260, got %ld\n", size);
1955
1956 ret = DdeUnaccessData(hdata);
1957 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1958
1959 ret = DdeFreeDataHandle(hdata);
1960 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1961
1962 /* cb is zero */
1964 hdata = DdeCreateDataHandle(dde_inst, (LPBYTE)"data", 0, 0, item, CF_TEXT, 0);
1966 ok(hdata != NULL, "Expected non-NULL hdata\n");
1967 ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
1968
1969 ptr = DdeAccessData(hdata, &size);
1970 ok(ptr != NULL, "Expected non-NULL ptr\n");
1971 ok(size == 0, "Expected 0, got %ld\n", size);
1972
1973 ret = DdeUnaccessData(hdata);
1974 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1975
1976 ret = DdeFreeDataHandle(hdata);
1977 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1978
1979 /* cbOff is non-zero */
1981 hdata = DdeCreateDataHandle(dde_inst, (LPBYTE)"data", MAX_PATH, 2, item, CF_TEXT, 0);
1983 ok(hdata != NULL, "Expected non-NULL hdata\n");
1984 ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
1985
1986 ptr = DdeAccessData(hdata, &size);
1987 ok(ptr != NULL, "Expected non-NULL ptr\n");
1988 ok(size == 262, "Expected 262, got %ld\n", size);
1989 todo_wine
1990 {
1991 ok(ptr && !*ptr, "Expected 0, got %d\n", lstrlenA((LPSTR)ptr));
1992 }
1993
1994 ret = DdeUnaccessData(hdata);
1995 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1996
1997 ret = DdeFreeDataHandle(hdata);
1998 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1999
2000 /* NULL item */
2002 hdata = DdeCreateDataHandle(dde_inst, (LPBYTE)"data", MAX_PATH, 0, 0, CF_TEXT, 0);
2004 ok(hdata != NULL, "Expected non-NULL hdata\n");
2005 ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
2006
2007 ptr = DdeAccessData(hdata, &size);
2008 ok(ptr != NULL, "Expected non-NULL ptr\n");
2009 ok(!lstrcmpA((LPSTR)ptr, "data"), "Expected data, got %s\n", ptr);
2010 ok(size == 260, "Expected 260, got %ld\n", size);
2011
2012 ret = DdeUnaccessData(hdata);
2013 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2014
2015 ret = DdeFreeDataHandle(hdata);
2016 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2017
2018 /* NULL item */
2020 hdata = DdeCreateDataHandle(dde_inst, (LPBYTE)"data", MAX_PATH, 0, (HSZ)0xdeadbeef, CF_TEXT, 0);
2022 ok(hdata != NULL, "Expected non-NULL hdata\n");
2023 ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
2024
2025 ptr = DdeAccessData(hdata, &size);
2026 ok(ptr != NULL, "Expected non-NULL ptr\n");
2027 ok(!lstrcmpA((LPSTR)ptr, "data"), "Expected data, got %s\n", ptr);
2028 ok(size == 260, "Expected 260, got %ld\n", size);
2029
2030 ret = DdeUnaccessData(hdata);
2031 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2032
2033 ret = DdeFreeDataHandle(hdata);
2034 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2035
2036 /* invalid clipboard format */
2038 hdata = DdeCreateDataHandle(dde_inst, (LPBYTE)"data", MAX_PATH, 0, item, 0xdeadbeef, 0);
2040 ok(hdata != NULL, "Expected non-NULL hdata\n");
2041 ok(err == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", err);
2042
2043 ptr = DdeAccessData(hdata, &size);
2044 ok(ptr != NULL, "Expected non-NULL ptr\n");
2045 ok(!lstrcmpA((LPSTR)ptr, "data"), "Expected data, got %s\n", ptr);
2046 ok(size == 260, "Expected 260, got %ld\n", size);
2047
2048 ret = DdeUnaccessData(hdata);
2049 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2050
2051 ret = DdeFreeDataHandle(hdata);
2052 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2053
2055 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2056}
HSZ WINAPI DdeCreateStringHandleA(DWORD, LPCSTR, INT)
Definition: ddemisc.c:577
BOOL WINAPI DdeFreeDataHandle(HDDEDATA)
Definition: ddemisc.c:1461
GLuint res
Definition: glext.h:9613
static ATOM item
Definition: dde.c:849

Referenced by START_TEST().

◆ test_DdeCreateStringHandle()

static void test_DdeCreateStringHandle ( void  )
static

Definition at line 2058 of file dde.c.

2059{
2061
2062 dde_inst = 0xdeadbeef;
2063 SetLastError(0xdeadbeef);
2065 ok(ret == DMLERR_INVALIDPARAMETER, "DdeInitializeW should fail, but got %04lx instead\n", ret);
2066 ok(DdeGetLastError(dde_inst) == DMLERR_INVALIDPARAMETER, "expected DMLERR_INVALIDPARAMETER\n");
2067
2068 dde_inst = 0;
2070 ok(ret == DMLERR_NO_ERROR, "DdeInitializeW failed with error %04lx (%08x)\n",
2072
2076
2077 ok(DdeUninitialize(dde_inst), "DdeUninitialize failed\n");
2078}
#define SetLastError(x)
Definition: compat.h:752
static void test_DdeCreateStringHandleW(DWORD dde_inst, int codepage)
Definition: dde.c:1800

Referenced by START_TEST().

◆ test_DdeCreateStringHandleW()

static void test_DdeCreateStringHandleW ( DWORD  dde_inst,
int  codepage 
)
static

Definition at line 1800 of file dde.c.

1801{
1802 static const WCHAR dde_string[] = {'D','D','E',' ','S','t','r','i','n','g',0};
1803 HSZ str_handle;
1804 WCHAR bufW[256];
1805 char buf[256];
1806 ATOM atom;
1807 int ret;
1808
1809 str_handle = DdeCreateStringHandleW(dde_inst, dde_string, codepage);
1810 ok(str_handle != 0, "DdeCreateStringHandleW failed with error %08x\n",
1812
1813 ret = DdeQueryStringW(dde_inst, str_handle, NULL, 0, codepage);
1814 if (codepage == CP_WINANSI)
1815 ok(ret == 1, "DdeQueryStringW returned wrong length %d\n", ret);
1816 else
1817 ok(ret == lstrlenW(dde_string), "DdeQueryStringW returned wrong length %d\n", ret);
1818
1819 ret = DdeQueryStringW(dde_inst, str_handle, bufW, 256, codepage);
1820 if (codepage == CP_WINANSI)
1821 {
1822 ok(ret == 1, "DdeQueryStringW returned wrong length %d\n", ret);
1823 ok(!lstrcmpA("D", (LPCSTR)bufW), "DdeQueryStringW returned wrong string\n");
1824 }
1825 else
1826 {
1827 ok(ret == lstrlenW(dde_string), "DdeQueryStringW returned wrong length %d\n", ret);
1828 ok(!lstrcmpW(dde_string, bufW), "DdeQueryStringW returned wrong string\n");
1829 }
1830
1831 ret = DdeQueryStringA(dde_inst, str_handle, buf, 256, CP_WINANSI);
1832 if (codepage == CP_WINANSI)
1833 {
1834 ok(ret == 1, "DdeQueryStringA returned wrong length %d\n", ret);
1835 ok(!lstrcmpA("D", buf), "DdeQueryStringW returned wrong string\n");
1836 }
1837 else
1838 {
1839 ok(ret == lstrlenA("DDE String"), "DdeQueryStringA returned wrong length %d\n", ret);
1840 ok(!lstrcmpA("DDE String", buf), "DdeQueryStringA returned wrong string %s\n", buf);
1841 }
1842
1843 ret = DdeQueryStringA(dde_inst, str_handle, buf, 256, CP_WINUNICODE);
1844 if (codepage == CP_WINANSI)
1845 {
1846 ok(ret == 1, "DdeQueryStringA returned wrong length %d\n", ret);
1847 ok(!lstrcmpA("D", buf), "DdeQueryStringA returned wrong string %s\n", buf);
1848 }
1849 else
1850 {
1851 ok(ret == lstrlenA("DDE String"), "DdeQueryStringA returned wrong length %d\n", ret);
1852 ok(!lstrcmpW(dde_string, (LPCWSTR)buf), "DdeQueryStringW returned wrong string\n");
1853 }
1854
1855 if (codepage == CP_WINANSI)
1856 {
1857 atom = FindAtomA((LPSTR)dde_string);
1858 ok(atom != 0, "Expected a valid atom\n");
1859
1860 SetLastError(0xdeadbeef);
1861 atom = GlobalFindAtomA((LPSTR)dde_string);
1862 ok(atom == 0, "Expected 0, got %d\n", atom);
1864 "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
1865 }
1866 else
1867 {
1868 atom = FindAtomW(dde_string);
1869 ok(atom != 0, "Expected a valid atom\n");
1870
1871 SetLastError(0xdeadbeef);
1872 atom = GlobalFindAtomW(dde_string);
1873 ok(atom == 0, "Expected 0, got %d\n", atom);
1875 "Expected ERROR_FILE_NOT_FOUND, got %ld\n", GetLastError());
1876 }
1877
1878 ok(DdeFreeStringHandle(dde_inst, str_handle), "DdeFreeStringHandle failed\n");
1879}
ATOM WINAPI GlobalFindAtomA(LPCSTR lpString)
Definition: atomansi.c:33
DWORD WINAPI DdeQueryStringW(DWORD, HSZ, LPWSTR, DWORD, INT)
Definition: ddemisc.c:525
ATOM WINAPI FindAtomW(LPCWSTR lpString)
Definition: atom.c:546
ATOM WINAPI GlobalFindAtomW(LPCWSTR lpString)
Definition: atom.c:454
ATOM WINAPI FindAtomA(LPCSTR lpString)
Definition: atom.c:536
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
int codepage
Definition: win_iconv.c:156

Referenced by test_DdeCreateStringHandle().

◆ test_ddeml_client()

static void test_ddeml_client ( void  )
static

Definition at line 296 of file dde.c.

297{
298 UINT ret;
299 char buffer[32];
300 LPSTR str;
301 DWORD size, res;
302 HDDEDATA hdata, op;
303 HSZ server, topic, item;
305 HCONV conversation;
306
307 client_pid = 0;
309 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
310
311 /* FIXME: make these atoms global and check them in the server */
312
315
317 conversation = DdeConnect(client_pid, server, topic, NULL);
318 if (broken(!conversation)) /* Windows 10 version 1607 */
319 {
320 win_skip("Failed to connect; error %#x.\n", DdeGetLastError(client_pid));
322 return;
323 }
325 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
326
328
330
331 /* XTYP_REQUEST, fRelease = TRUE */
332 res = 0xdeadbeef;
334 hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
336 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
337 ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %08lx\n", res);
338 ok( hdata != NULL, "hdata is NULL\n" );
339 if (hdata)
340 {
341 str = (LPSTR)DdeAccessData(hdata, &size);
342 ok(!lstrcmpA(str, "requested data\r\n"), "Expected 'requested data\\r\\n', got %s\n", str);
343 ok(size == 17, "Expected 17, got %ld\n", size);
344
345 ret = DdeUnaccessData(hdata);
346 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
347 }
348
349 /* XTYP_REQUEST, fAckReq = TRUE */
350 res = 0xdeadbeef;
352 hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
354 ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %lx\n", res);
356 ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret);
357 ok( hdata != NULL, "hdata is NULL\n" );
358 if (hdata)
359 {
360 str = (LPSTR)DdeAccessData(hdata, &size);
361 ok(!lstrcmpA(str, "requested data\r\n"), "Expected 'requested data\\r\\n', got %s\n", str);
362 ok(size == 17, "Expected 17, got %ld\n", size);
363
364 ret = DdeUnaccessData(hdata);
365 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
366 }
367
368 /* XTYP_REQUEST, all params normal */
369 res = 0xdeadbeef;
371 hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
373 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
374 ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %lx\n", res);
375 if (hdata == NULL)
376 ok(FALSE, "hdata is NULL\n");
377 else
378 {
379 str = (LPSTR)DdeAccessData(hdata, &size);
380 ok(!lstrcmpA(str, "requested data\r\n"), "Expected 'requested data\\r\\n', got %s\n", str);
381 ok(size == 17, "Expected 17, got %ld\n", size);
382
383 ret = DdeUnaccessData(hdata);
384 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
385 }
386
387 /* XTYP_REQUEST, no item */
388 res = 0xdeadbeef;
390 hdata = DdeClientTransaction(NULL, 0, conversation, 0, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
392 ok(hdata == NULL, "Expected NULL hdata, got %p\n", hdata);
393 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %08lx\n", res);
394 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
395
397
399
400 lstrcpyA(buffer, "poke data\r\n");
402 0, item, CF_TEXT, 0);
403 ok(hdata != NULL, "Expected non-NULL hdata\n");
404
405 /* XTYP_POKE, no item */
406 res = 0xdeadbeef;
408 op = DdeClientTransaction((LPBYTE)hdata, -1, conversation, 0, CF_TEXT, XTYP_POKE, default_timeout, &res);
410 ok(op == NULL, "Expected NULL, got %p\n", op);
411 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
412 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
413
414 /* XTYP_POKE, no data */
415 res = 0xdeadbeef;
417 op = DdeClientTransaction(NULL, 0, conversation, 0, CF_TEXT, XTYP_POKE, default_timeout, &res);
419 ok(op == NULL, "Expected NULL, got %p\n", op);
420 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
421 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
422
423 /* XTYP_POKE, wrong size */
424 res = 0xdeadbeef;
426 op = DdeClientTransaction((LPBYTE)hdata, 0, conversation, item, CF_TEXT, XTYP_POKE, default_timeout, &res);
428 ok(op == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", op);
429 ok(res == DDE_FACK, "Expected DDE_FACK, got %lx\n", res);
430 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
431
432 /* XTYP_POKE, correct params */
433 res = 0xdeadbeef;
435 op = DdeClientTransaction((LPBYTE)hdata, -1, conversation, item, CF_TEXT, XTYP_POKE, default_timeout, &res);
437 ok(op == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", op);
438 ok(res == DDE_FACK, "Expected DDE_FACK, got %lx\n", res);
439 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
440
441 DdeFreeDataHandle(hdata);
442
443 lstrcpyA(buffer, "[Command(Var)]");
445 0, NULL, CF_TEXT, 0);
446 ok(hdata != NULL, "Expected non-NULL hdata\n");
447
448 /* XTYP_EXECUTE, correct params */
449 res = 0xdeadbeef;
451 op = DdeClientTransaction((LPBYTE)hdata, -1, conversation, NULL, 0, XTYP_EXECUTE, default_timeout, &res);
453 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
454 ok(op == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", op);
455 ok(res == DDE_FACK, "Expected DDE_FACK, got %lx\n", res);
456
457 /* XTYP_EXECUTE, no data */
458 res = 0xdeadbeef;
460 op = DdeClientTransaction(NULL, 0, conversation, NULL, 0, XTYP_EXECUTE, default_timeout, &res);
462 ok(op == NULL, "Expected NULL, got %p\n", op);
463 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
464 ok(ret == DMLERR_MEMORY_ERROR, "Expected DMLERR_MEMORY_ERROR, got %d\n", ret);
465
466 /* XTYP_EXECUTE, no data, -1 size */
467 res = 0xdeadbeef;
469 op = DdeClientTransaction(NULL, -1, conversation, NULL, 0, XTYP_EXECUTE, default_timeout, &res);
471 ok(op == NULL, "Expected NULL, got %p\n", op);
472 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
473 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
474
476 DdeFreeDataHandle(hdata);
477
479
480 /* verify the execute */
481 res = 0xdeadbeef;
483 hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
485 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
486 ok(res == DDE_FNOTPROCESSED, "Expected DDE_FNOTPROCESSED, got %ld\n", res);
487 str = (LPSTR)DdeAccessData(hdata, &size);
488 ok(!strcmp(str, "command executed\r\n"), "Expected 'command executed\\r\\n', got %s\n", str);
489 ok(size == 19, "Expected 19, got %ld\n", size);
490
491 ret = DdeUnaccessData(hdata);
492 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
493
494 /* invalid transactions */
495 res = 0xdeadbeef;
499 ok(op == NULL, "Expected NULL, got %p\n", op);
500 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
501 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
502
503 res = 0xdeadbeef;
507 ok(op == NULL, "Expected NULL, got %p\n", op);
508 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
509 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
510
511 res = 0xdeadbeef;
515 ok(op == NULL, "Expected NULL, got %p\n", op);
516 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
517 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
518
519 res = 0xdeadbeef;
523 ok(op == NULL, "Expected NULL, got %p\n", op);
524 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
525 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
526
527 res = 0xdeadbeef;
531 ok(op == NULL, "Expected NULL, got %p\n", op);
532 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
533 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
534
535 res = 0xdeadbeef;
539 ok(op == NULL, "Expected NULL, got %p\n", op);
540 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
541 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
542
543 res = 0xdeadbeef;
547 ok(op == NULL, "Expected NULL, got %p\n", op);
548 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
549 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
550
551 res = 0xdeadbeef;
555 ok(op == NULL, "Expected NULL, got %p\n", op);
556 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
557 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
558
559 res = 0xdeadbeef;
563 ok(op == NULL, "Expected NULL, got %p\n", op);
564 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
565 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
566
567 res = 0xdeadbeef;
571 ok(op == NULL, "Expected NULL, got %p\n", op);
572 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", res);
573 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
574
576
577 ret = DdeDisconnect(conversation);
578 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
579
581 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
582}
#define XTYP_ADVREQ
Definition: ddeml.h:182
#define XTYP_MONITOR
Definition: ddeml.h:195
#define XTYP_XACT_COMPLETE
Definition: ddeml.h:188
#define XTYP_ERROR
Definition: ddeml.h:180
#define DMLERR_MEMORY_ERROR
Definition: ddeml.h:254
#define XTYP_UNREGISTER
Definition: ddeml.h:193
#define XTYP_WILDCONNECT
Definition: ddeml.h:194
UINT op
Definition: effect.c:236
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
static DWORD client_pid
Definition: msiexec.c:401

Referenced by START_TEST().

◆ test_ddeml_server()

static void test_ddeml_server ( void  )
static

Definition at line 814 of file dde.c.

815{
817 MSG msg;
818 UINT res;
820 BOOL ret;
821 HSZ server;
822 HDDEDATA hdata;
823
824 client = create_process("msg");
825
826 /* set up DDE server */
827 server_pid = 0;
829 ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", res);
830
832 ok(server != NULL, "Expected non-NULL string handle\n");
833
835 ok(hdata == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", hdata);
836
838 {
839 while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
840 }
842 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
844 ok( !res, "client failed with %lu error(s)\n", exit_code );
846}
#define DNS_REGISTER
Definition: ddeml.h:152
HDDEDATA WINAPI DdeNameService(DWORD, HSZ, HSZ, UINT)
Definition: ddeserver.c:154
#define APPCLASS_STANDARD
Definition: ddeml.h:130
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1166
#define INFINITE
Definition: serial.h:102
static UINT exit_code
Definition: process.c:80
#define create_process(cmd, pi)
Definition: process.c:2637
static HDDEDATA CALLBACK server_ddeml_callback(UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
Definition: dde.c:586

Referenced by START_TEST().

◆ test_end_to_end_client()

static void test_end_to_end_client ( BOOL  type_a)
static

Definition at line 2613 of file dde.c.

2614{
2615 DWORD i, ret, err;
2616 DWORD client_pid = 0;
2617 HSZ server, topic;
2618 HCONV hconv;
2619 HDDEDATA hdata;
2620 static const char test_service[] = "TestDDEService";
2621 static const WCHAR test_service_w[] = {'T','e','s','t','D','D','E','S','e','r','v','i','c','e',0};
2622 static const char test_topic[] = "TestDDETopic";
2623 static const WCHAR test_topic_w[] = {'T','e','s','t','D','D','E','T','o','p','i','c',0};
2624
2625 if (type_a)
2627 else
2629 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %lx\n", ret);
2630
2631 if (type_a)
2632 {
2635 }
2636 else {
2639 }
2640
2643 if (broken(!hconv)) /* Windows 10 version 1607 */
2644 {
2645 win_skip("Failed to connect; error %#x.\n", DdeGetLastError(client_pid));
2647 return;
2648 }
2650 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %lx\n", ret);
2652
2653 /* Test both A and W data being passed to DdeClientTransaction */
2655 hconv, (HSZ)0xdead, 0xbeef, XTYP_EXECUTE, 1000, &ret);
2656 ok(hdata != NULL, "DdeClientTransaction failed\n");
2657 ok(ret == DDE_FACK, "wrong status code %lx\n", ret);
2659 ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
2660
2661 for (i = 0; i < ARRAY_SIZE(test_cmd_w_to_w); i++)
2662 {
2664 (lstrlenW(test_cmd_w_to_w[i]) + 1) * sizeof(WCHAR),
2665 hconv, (HSZ)0xdead, 0xbeef, XTYP_EXECUTE, 1000, &ret);
2666 ok(hdata != NULL, "DdeClientTransaction failed\n");
2667 ok(ret == DDE_FACK, "wrong status code %lx\n", ret);
2669 ok(err == DMLERR_NO_ERROR, "wrong dde error %lx\n", err);
2670 }
2671
2673 ret = DdeDisconnect(hconv);
2674 ok(ret == TRUE, "Expected TRUE, got %lx\n", ret);
2675
2677 ok(ret == TRUE, "Expected TRUE, got %lx\n", ret);
2678
2679}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static HDDEDATA CALLBACK client_end_to_end_callback(UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
Definition: dde.c:2597

Referenced by START_TEST().

◆ test_end_to_end_server()

static void test_end_to_end_server ( void  )
static

Definition at line 2681 of file dde.c.

2682{
2683 HANDLE client;
2684 MSG msg;
2685 HSZ server;
2686 BOOL ret;
2687 DWORD res;
2688 HDDEDATA hdata;
2689 static const char test_service[] = "TestDDEService";
2690
2691 trace("client %s, server %s\n", unicode_client ? "unicode" : "ansi",
2692 unicode_server ? "unicode" : "ansi");
2693 server_pid = 0;
2694 msg_index = 0;
2695
2696 if (unicode_server)
2698 else
2700 ok(res == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %ld\n", res);
2701
2703 ok(server != NULL, "Expected non-NULL string handle\n");
2704
2706 ok(hdata == (HDDEDATA)TRUE, "Expected TRUE, got %p\n", hdata);
2707
2708 client = create_process(unicode_client ? "endw" : "enda");
2709
2711 {
2712 while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
2713 }
2714
2716 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2718 ok( !res, "client failed with %lu error(s)\n", res );
2720}
static HDDEDATA CALLBACK server_end_to_end_callback(UINT uType, UINT uFmt, HCONV hconv, HSZ hsz1, HSZ hsz2, HDDEDATA hdata, ULONG_PTR dwData1, ULONG_PTR dwData2)
Definition: dde.c:2393

Referenced by START_TEST().

◆ test_FreeDDElParam()

static void test_FreeDDElParam ( void  )
static

Definition at line 2080 of file dde.c.

2081{
2082 HGLOBAL val, hglobal;
2083 BOOL ret;
2084
2086 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2087
2088 hglobal = GlobalAlloc(GMEM_DDESHARE, 100);
2090 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2091 val = GlobalFree(hglobal);
2092 ok(val == NULL, "Expected NULL, got %p\n", val);
2093
2094 hglobal = GlobalAlloc(GMEM_DDESHARE, 100);
2096 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2097
2098 hglobal = GlobalAlloc(GMEM_DDESHARE, 100);
2100 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2101 val = GlobalFree(hglobal);
2102 ok(val == NULL, "Expected NULL, got %p\n", val);
2103
2104 hglobal = GlobalAlloc(GMEM_DDESHARE, 100);
2105 ret = FreeDDElParam(WM_DDE_ACK, (LPARAM)hglobal);
2106 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2107
2108 hglobal = GlobalAlloc(GMEM_DDESHARE, 100);
2109 ret = FreeDDElParam(WM_DDE_DATA, (LPARAM)hglobal);
2110 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2111
2112 hglobal = GlobalAlloc(GMEM_DDESHARE, 100);
2114 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2115 val = GlobalFree(hglobal);
2116 ok(val == NULL, "Expected NULL, got %p\n", val);
2117
2118 hglobal = GlobalAlloc(GMEM_DDESHARE, 100);
2119 ret = FreeDDElParam(WM_DDE_POKE, (LPARAM)hglobal);
2120 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2121
2122 hglobal = GlobalAlloc(GMEM_DDESHARE, 100);
2124 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2125 val = GlobalFree(hglobal);
2126 ok(val == NULL, "Expected NULL, got %p\n", val);
2127}
#define WM_DDE_ADVISE
Definition: dde.h:39
BOOL WINAPI FreeDDElParam(UINT, LPARAM)
Definition: ddemisc.c:147
#define WM_DDE_UNADVISE
Definition: dde.h:40
GLuint GLfloat * val
Definition: glext.h:7180
LONG_PTR LPARAM
Definition: minwindef.h:175

Referenced by START_TEST().

◆ test_initialisation()

static void test_initialisation ( void  )
static

Definition at line 1752 of file dde.c.

1753{
1754 UINT ret;
1755 DWORD res;
1756 HDDEDATA hdata;
1757 HSZ server, topic, item;
1759 HCONV conversation;
1760
1761 /* Initialise without a valid server window. */
1762 client_pid = 0;
1764 ok(ret == DMLERR_NO_ERROR, "Expected DMLERR_NO_ERROR, got %d\n", ret);
1765
1766
1767 server = DdeCreateStringHandleA(client_pid, "TestDDEService", CP_WINANSI);
1769
1771
1772 /* There is no server window so no conversation can be extracted */
1773 conversation = DdeConnect(client_pid, server, topic, NULL);
1774 ok(conversation == NULL, "Expected NULL conversation, %p\n", conversation);
1776 ok(ret == DMLERR_NO_CONV_ESTABLISHED, "Expected DMLERR_NO_CONV_ESTABLISHED, got %d\n", ret);
1777
1779
1781
1782 /* There is no conversation so an invalid parameter results */
1783 res = 0xdeadbeef;
1785 hdata = DdeClientTransaction(NULL, 0, conversation, item, CF_TEXT, XTYP_REQUEST, default_timeout, &res);
1786 ok(hdata == NULL, "Expected NULL, got %p\n", hdata);
1788 todo_wine
1789 ok(ret == DMLERR_INVALIDPARAMETER, "Expected DMLERR_INVALIDPARAMETER, got %d\n", ret);
1790 ok(res == 0xdeadbeef, "Expected 0xdeadbeef, got %08lx\n", res);
1791
1793 ret = DdeDisconnect(conversation);
1794 ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
1795
1797 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
1798}
#define DMLERR_NO_CONV_ESTABLISHED
Definition: ddeml.h:256

Referenced by START_TEST().

◆ test_msg_client()

static void test_msg_client ( void  )
static

Definition at line 1058 of file dde.c.

1059{
1060 HGLOBAL hglobal;
1061 LPARAM lparam;
1062
1064
1065 server = GlobalAddAtomA("TestDDEServer");
1066 ok(server != 0, "Expected non-NULL server\n");
1067
1068 topic = GlobalAddAtomA("TestDDETopic");
1069 ok(topic != 0, "Expected non-NULL topic\n");
1070
1072
1075
1076 flush_events();
1077
1078 item = GlobalAddAtomA("request");
1079 ok(item != 0, "Expected non-NULL item\n");
1080
1081 /* WM_DDE_REQUEST, bad clipboard format */
1082 lparam = PackDDElParam(WM_DDE_REQUEST, 0xdeadbeef, item);
1084
1085 flush_events();
1086
1087 /* WM_DDE_REQUEST, no item */
1090
1091 flush_events();
1092
1093 /* WM_DDE_REQUEST, no client hwnd */
1096
1097 flush_events();
1098
1099 /* WM_DDE_REQUEST, correct params */
1102
1103 flush_events();
1104
1106 item = GlobalAddAtomA("poke");
1107 ok(item != 0, "Expected non-NULL item\n");
1108
1109 hglobal = create_poke();
1110
1111 /* WM_DDE_POKE, no ddepoke */
1114 flush_events();
1115
1116 /* WM_DDE_POKE, no item */
1117 lparam = PackDDElParam(WM_DDE_POKE, (UINT_PTR)hglobal, 0);
1119
1120 flush_events();
1121
1122 hglobal = create_poke();
1123
1124 /* WM_DDE_POKE, no client hwnd */
1127
1128 flush_events();
1129
1130 /* WM_DDE_POKE, all params correct */
1133
1134 flush_events();
1135
1136 execute_hglobal = create_execute("[Command(Var)]");
1137
1138 /* WM_DDE_EXECUTE, no lparam */
1140
1141 flush_events();
1142
1143 /* WM_DDE_EXECUTE, no hglobal */
1146
1147 flush_events();
1148
1149 /* WM_DDE_EXECUTE, no client hwnd */
1152
1153 flush_events();
1154
1155 /* WM_DDE_EXECUTE, all params correct */
1158
1159 flush_events();
1160
1162 execute_hglobal = create_execute("[Command-2(Var)]");
1163
1164 /* WM_DDE_EXECUTE, all params correct */
1167
1168 flush_events();
1169
1171 execute_hglobal = create_execute("[BadCommand(Var)]");
1172
1173 /* WM_DDE_EXECUTE that will get rejected */
1176
1177 flush_events();
1178
1179 destroy_dde_window(&client_hwnd, "dde_client");
1180}
ATOM WINAPI GlobalAddAtomA(LPCSTR lpString)
Definition: atomansi.c:23
static LRESULT WINAPI dde_msg_client_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dde.c:852
static HGLOBAL create_poke(void)
Definition: dde.c:1022
static void flush_events(void)
Definition: dde.c:71
static HGLOBAL create_execute(LPCSTR command)
Definition: dde.c:1043
static void destroy_dde_window(HWND *hwnd, LPCSTR name)
Definition: dde.c:105
static void create_dde_window(HWND *hwnd, LPCSTR name, WNDPROC wndproc)
Definition: dde.c:87
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define HWND_BROADCAST
Definition: winuser.h:1215

Referenced by START_TEST().

◆ test_msg_server()

static void test_msg_server ( void  )
static

Definition at line 267 of file dde.c.

268{
270 MSG msg;
271 HWND hwnd;
272 DWORD res;
273
275 client = create_process("ddeml");
276
278 {
279 while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
280 }
281
282 destroy_dde_window(&hwnd, "dde_server");
284 ok( !res, "client failed with %lu error(s)\n", res );
286}
static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dde.c:111

Referenced by START_TEST().

◆ test_PackDDElParam()

static void test_PackDDElParam ( void  )
static

Definition at line 2129 of file dde.c.

2130{
2131 UINT_PTR lo, hi, *ptr;
2132 LPARAM lparam;
2133 BOOL ret;
2134
2135 lparam = PackDDElParam(WM_DDE_INITIATE, 0xcafe, 0xbeef);
2136 /* value gets sign-extended despite being an LPARAM */
2137 ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08Ix\n", lparam);
2138
2139 lo = hi = 0;
2141 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2142 ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
2143 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2144
2146 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2147
2148 lparam = PackDDElParam(WM_DDE_TERMINATE, 0xcafe, 0xbeef);
2149 ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08Ix\n", lparam);
2150
2151 lo = hi = 0;
2153 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2154 ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
2155 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2156
2158 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2159
2160 lparam = PackDDElParam(WM_DDE_ADVISE, 0xcafe, 0xbeef);
2162 ok(ptr != NULL, "Expected non-NULL ptr\n");
2163 ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08Ix\n", ptr[0]);
2164 ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08Ix\n", ptr[1]);
2165
2167 ok(ret == 1, "Expected 1, got %d\n", ret);
2168
2169 lo = hi = 0;
2171 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2172 ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
2173 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2174
2176 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2177
2178 lparam = PackDDElParam(WM_DDE_UNADVISE, 0xcafe, 0xbeef);
2179 ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08Ix\n", lparam);
2180
2181 lo = hi = 0;
2183 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2184 ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
2185 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2186
2188 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2189
2190 lparam = PackDDElParam(WM_DDE_ACK, 0xcafe, 0xbeef);
2192 ok(ptr != NULL, "Expected non-NULL ptr\n");
2193 ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08Ix\n", ptr[0]);
2194 ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08Ix\n", ptr[1]);
2195
2197 ok(ret == 1, "Expected 1, got %d\n", ret);
2198
2199 lo = hi = 0;
2200 ret = UnpackDDElParam(WM_DDE_ACK, lparam, &lo, &hi);
2201 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2202 ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
2203 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2204
2206 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2207
2208 lparam = PackDDElParam(WM_DDE_DATA, 0xcafe, 0xbeef);
2210 ok(ptr != NULL, "Expected non-NULL ptr\n");
2211 ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08Ix\n", ptr[0]);
2212 ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08Ix\n", ptr[1]);
2213
2215 ok(ret == 1, "Expected 1, got %d\n", ret);
2216
2217 lo = hi = 0;
2218 ret = UnpackDDElParam(WM_DDE_DATA, lparam, &lo, &hi);
2219 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2220 ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
2221 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2222
2224 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2225
2226 lparam = PackDDElParam(WM_DDE_REQUEST, 0xcafe, 0xbeef);
2227 ok(lparam == (int)0xbeefcafe, "Expected 0xbeefcafe, got %08Ix\n", lparam);
2228
2229 lo = hi = 0;
2231 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2232 ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
2233 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2234
2236 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2237
2238 lparam = PackDDElParam(WM_DDE_POKE, 0xcafe, 0xbeef);
2240 ok(ptr != NULL, "Expected non-NULL ptr\n");
2241 ok(ptr[0] == 0xcafe, "Expected 0xcafe, got %08Ix\n", ptr[0]);
2242 ok(ptr[1] == 0xbeef, "Expected 0xbeef, got %08Ix\n", ptr[1]);
2243
2245 ok(ret == 1, "Expected 1, got %d\n", ret);
2246
2247 lo = hi = 0;
2248 ret = UnpackDDElParam(WM_DDE_POKE, lparam, &lo, &hi);
2249 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2250 ok(lo == 0xcafe, "Expected 0xcafe, got %08Ix\n", lo);
2251 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2252
2254 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2255
2256 lparam = PackDDElParam(WM_DDE_EXECUTE, 0xcafe, 0xbeef);
2257 ok(lparam == 0xbeef, "Expected 0xbeef, got %08Ix\n", lparam);
2258
2259 lo = hi = 0;
2261 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2262 ok(lo == 0, "Expected 0, got %08Ix\n", lo);
2263 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2264
2266 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2267}

Referenced by START_TEST().

◆ test_UnpackDDElParam()

static void test_UnpackDDElParam ( void  )
static

Definition at line 2269 of file dde.c.

2270{
2271 UINT_PTR lo, hi, *ptr;
2272 HGLOBAL hglobal;
2273 BOOL ret;
2274
2275 /* NULL lParam */
2276 lo = 0xdead;
2277 hi = 0xbeef;
2278 ret = UnpackDDElParam(WM_DDE_INITIATE, 0, &lo, &hi);
2279 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2280 ok(lo == 0, "Expected 0, got %08Ix\n", lo);
2281 ok(hi == 0, "Expected 0, got %08Ix\n", hi);
2282
2283 /* NULL lo */
2284 lo = 0xdead;
2285 hi = 0xbeef;
2286 ret = UnpackDDElParam(WM_DDE_INITIATE, 0xcafebabe, NULL, &hi);
2287 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2288 ok(lo == 0xdead, "Expected 0xdead, got %08Ix\n", lo);
2289 ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
2290
2291 /* NULL hi */
2292 lo = 0xdead;
2293 hi = 0xbeef;
2294 ret = UnpackDDElParam(WM_DDE_INITIATE, 0xcafebabe, &lo, NULL);
2295 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2296 ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
2297 ok(hi == 0xbeef, "Expected 0xbeef, got %08Ix\n", hi);
2298
2299 lo = 0xdead;
2300 hi = 0xbeef;
2301 ret = UnpackDDElParam(WM_DDE_INITIATE, 0xcafebabe, &lo, &hi);
2302 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2303 ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
2304 ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
2305
2306 lo = 0xdead;
2307 hi = 0xbeef;
2308 ret = UnpackDDElParam(WM_DDE_TERMINATE, 0xcafebabe, &lo, &hi);
2309 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2310 ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
2311 ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
2312
2313 lo = 0xdead;
2314 hi = 0xbeef;
2315 ret = UnpackDDElParam(WM_DDE_ADVISE, 0, &lo, &hi);
2316 ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
2317 ok(lo == 0 ||
2318 broken(lo == 0xdead), /* win2k */
2319 "Expected 0, got %08Ix\n", lo);
2320 ok(hi == 0 ||
2321 broken(hi == 0xbeef), /* win2k */
2322 "Expected 0, got %08Ix\n", hi);
2323
2324 hglobal = GlobalAlloc(GMEM_DDESHARE, 2 * sizeof(*ptr));
2325 ptr = GlobalLock(hglobal);
2326 ptr[0] = 0xcafebabe;
2327 ptr[1] = 0xdeadbeef;
2328 GlobalUnlock(hglobal);
2329
2330 lo = 0xdead;
2331 hi = 0xbeef;
2332 ret = UnpackDDElParam(WM_DDE_ADVISE, (LPARAM)hglobal, &lo, &hi);
2333 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2334 ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", lo);
2335 ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08Ix\n", hi);
2336
2337 lo = 0xdead;
2338 hi = 0xbeef;
2339 ret = UnpackDDElParam(WM_DDE_UNADVISE, 0xcafebabe, &lo, &hi);
2340 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2341 ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
2342 ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
2343
2344 lo = 0xdead;
2345 hi = 0xbeef;
2346 ret = UnpackDDElParam(WM_DDE_ACK, (LPARAM)hglobal, &lo, &hi);
2347 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2348 ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", lo);
2349 ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08Ix\n", hi);
2350
2351 lo = 0xdead;
2352 hi = 0xbeef;
2353 ret = UnpackDDElParam(WM_DDE_DATA, (LPARAM)hglobal, &lo, &hi);
2354 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2355 ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", lo);
2356 ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08Ix\n", hi);
2357
2358 lo = 0xdead;
2359 hi = 0xbeef;
2360 ret = UnpackDDElParam(WM_DDE_REQUEST, 0xcafebabe, &lo, &hi);
2361 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2362 ok(lo == 0xbabe, "Expected 0xbabe, got %08Ix\n", lo);
2363 ok(hi == 0xcafe, "Expected 0xcafe, got %08Ix\n", hi);
2364
2365 lo = 0xdead;
2366 hi = 0xbeef;
2367 ret = UnpackDDElParam(WM_DDE_POKE, (LPARAM)hglobal, &lo, &hi);
2368 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2369 ok(lo == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", lo);
2370 ok(hi == 0xdeadbeef, "Expected 0xdeadbeef, got %08Ix\n", hi);
2371
2372 lo = 0xdead;
2373 hi = 0xbeef;
2374 ret = UnpackDDElParam(WM_DDE_EXECUTE, 0xcafebabe, &lo, &hi);
2375 ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
2376 ok(lo == 0, "Expected 0, got %08Ix\n", lo);
2377 ok(hi == 0xcafebabe, "Expected 0xcafebabe, got %08Ix\n", hi);
2378
2379 GlobalFree(hglobal);
2380}

Referenced by START_TEST().

Variable Documentation

◆ client_hwnd

HWND client_hwnd
static

Definition at line 848 of file dde.c.

Referenced by dde_msg_client_wndproc(), and test_msg_client().

◆ default_timeout

const DWORD default_timeout = 200
static

Definition at line 44 of file dde.c.

Referenced by flush_events(), test_ddeml_client(), and test_initialisation().

◆ exec_cmdA

char exec_cmdA[] = "ANSI dde command"
static

Definition at line 37 of file dde.c.

Referenced by dde_server_wndprocA(), dde_server_wndprocW(), and test_dde_aw_transaction().

◆ exec_cmdAW

WCHAR exec_cmdAW[] = {'A','N','S','I',' ','d','d','e',' ','c','o','m','m','a','n','d',0}
static

Definition at line 38 of file dde.c.

Referenced by dde_server_wndprocA(), dde_server_wndprocW(), and test_dde_aw_transaction().

◆ exec_cmdW

WCHAR exec_cmdW[] = {'u','n','i','c','o','d','e',' ','d','d','e',' ','c','o','m','m','a','n','d',0}
static

Definition at line 39 of file dde.c.

Referenced by dde_server_wndprocA(), dde_server_wndprocW(), and test_dde_aw_transaction().

◆ exec_cmdWA

char exec_cmdWA[] = "unicode dde command"
static

Definition at line 40 of file dde.c.

Referenced by dde_server_wndprocA(), dde_server_wndprocW(), and test_dde_aw_transaction().

◆ execute_hglobal

HGLOBAL execute_hglobal
static

Definition at line 850 of file dde.c.

Referenced by dde_msg_client_wndproc(), and test_msg_client().

◆ item

ATOM item
static

Definition at line 849 of file dde.c.

Referenced by test_DdeCreateDataHandle(), test_ddeml_client(), and test_initialisation().

◆ msg_index

◆ old_dde_client_wndproc

WNDPROC old_dde_client_wndproc
static

◆ server

◆ server_hwnd

HWND server_hwnd
static

Definition at line 848 of file dde.c.

Referenced by dde_msg_client_wndproc(), and test_msg_client().

◆ server_pid

◆ test_cmd_a_to_a

char test_cmd_a_to_a[] = "Test dde command"
static

Definition at line 2382 of file dde.c.

Referenced by server_end_to_end_callback(), and test_end_to_end_client().

◆ test_cmd_w_to_w

WCHAR test_cmd_w_to_w[][32]
static
Initial value:
= {
{'t','e','s','t',' ','d','d','e',' ','c','o','m','m','a','n','d',0},
{ 0x2018, 0x2019, 0x0161, 0x0041, 0x02dc, 0 },
{ 0x2026, 0x2020, 0x2021, 0x0d0a, 0 },
{ 0x4efa, 0x4efc, 0x0061, 0x4efe, 0 },
{ 0x0061, 0x0062, 0x0063, 0x9152, 0 },
}

Definition at line 2383 of file dde.c.

Referenced by server_end_to_end_callback(), and test_end_to_end_client().

◆ TEST_DDE_SERVICE

const WCHAR TEST_DDE_SERVICE[] = {'T','e','s','t','D','D','E','S','e','r','v','i','c','e',0}
static

Definition at line 35 of file dde.c.

Referenced by dde_server_wndprocA(), dde_server_wndprocW(), and test_dde_aw_transaction().

◆ topic

◆ unicode_client

BOOL unicode_client
static

Definition at line 2391 of file dde.c.

Referenced by server_end_to_end_callback(), START_TEST(), and test_end_to_end_server().

◆ unicode_server

BOOL unicode_server
static

Definition at line 2391 of file dde.c.

Referenced by server_end_to_end_callback(), START_TEST(), and test_end_to_end_server().