Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
88913f09
Commit
88913f09
authored
Oct 12, 2007
by
James Hawkins
Committed by
Alexandre Julliard
Oct 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add tests for DdeCreateDataHandle.
parent
4fb3518e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
192 additions
and
0 deletions
+192
-0
dde.c
dlls/user32/tests/dde.c
+192
-0
No files found.
dlls/user32/tests/dde.c
View file @
88913f09
...
...
@@ -1454,6 +1454,197 @@ static void test_DdeCreateStringHandleW(DWORD dde_inst, int codepage)
ok
(
DdeFreeStringHandle
(
dde_inst
,
str_handle
),
"DdeFreeStringHandle failed
\n
"
);
}
static
void
test_DdeCreateDataHandle
(
void
)
{
HDDEDATA
hdata
;
DWORD
dde_inst
;
DWORD
size
;
UINT
res
,
err
;
BOOL
ret
;
HSZ
item
;
LPBYTE
ptr
;
dde_inst
=
0
;
res
=
DdeInitializeA
(
&
dde_inst
,
client_ddeml_callback
,
APPCMD_CLIENTONLY
,
0
);
ok
(
res
==
DMLERR_NO_ERROR
,
"Expected DMLERR_NO_ERROR, got %d
\n
"
,
res
);
item
=
DdeCreateStringHandleA
(
dde_inst
,
"item"
,
CP_WINANSI
);
ok
(
item
!=
NULL
,
"Expected non-NULL hsz
\n
"
);
/* invalid instance id */
DdeGetLastError
(
dde_inst
);
hdata
=
DdeCreateDataHandle
(
0xdeadbeef
,
(
LPBYTE
)
"data"
,
MAX_PATH
,
0
,
item
,
CF_TEXT
,
0
);
err
=
DdeGetLastError
(
dde_inst
);
todo_wine
{
ok
(
hdata
==
NULL
,
"Expected NULL, got %p
\n
"
,
hdata
);
ok
(
err
==
DMLERR_INVALIDPARAMETER
,
"Expected DMLERR_INVALIDPARAMETER, got %d
\n
"
,
err
);
}
/* 0 instance id */
DdeGetLastError
(
dde_inst
);
hdata
=
DdeCreateDataHandle
(
0
,
(
LPBYTE
)
"data"
,
MAX_PATH
,
0
,
item
,
CF_TEXT
,
0
);
err
=
DdeGetLastError
(
dde_inst
);
todo_wine
{
ok
(
hdata
==
NULL
,
"Expected NULL, got %p
\n
"
,
hdata
);
ok
(
err
==
DMLERR_INVALIDPARAMETER
,
"Expected DMLERR_INVALIDPARAMETER, got %d
\n
"
,
err
);
}
/* NULL pSrc */
DdeGetLastError
(
dde_inst
);
hdata
=
DdeCreateDataHandle
(
dde_inst
,
NULL
,
MAX_PATH
,
0
,
item
,
CF_TEXT
,
0
);
err
=
DdeGetLastError
(
dde_inst
);
ok
(
hdata
!=
NULL
,
"Expected non-NULL hdata
\n
"
);
ok
(
err
==
DMLERR_NO_ERROR
,
"Expected DMLERR_NO_ERROR, got %d
\n
"
,
err
);
ptr
=
GlobalLock
(
hdata
);
todo_wine
{
ok
(
ptr
==
NULL
,
"Expected NULL, got %p
\n
"
,
ptr
);
}
ptr
=
DdeAccessData
(
hdata
,
&
size
);
ok
(
ptr
!=
NULL
,
"Expected non-NULL ptr
\n
"
);
ok
(
lstrlenA
((
LPSTR
)
ptr
)
==
0
,
"Expected 0, got %d
\n
"
,
lstrlenA
((
LPSTR
)
ptr
));
ok
(
size
==
260
,
"Expected 260, got %d
\n
"
,
size
);
ret
=
DdeUnaccessData
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
ret
=
DdeFreeDataHandle
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
/* cb is zero */
DdeGetLastError
(
dde_inst
);
hdata
=
DdeCreateDataHandle
(
dde_inst
,
(
LPBYTE
)
"data"
,
0
,
0
,
item
,
CF_TEXT
,
0
);
err
=
DdeGetLastError
(
dde_inst
);
ok
(
hdata
!=
NULL
,
"Expected non-NULL hdata
\n
"
);
ok
(
err
==
DMLERR_NO_ERROR
,
"Expected DMLERR_NO_ERROR, got %d
\n
"
,
err
);
ptr
=
GlobalLock
(
hdata
);
todo_wine
{
ok
(
ptr
==
NULL
,
"Expected NULL, got %p
\n
"
,
ptr
);
}
ptr
=
DdeAccessData
(
hdata
,
&
size
);
ok
(
ptr
!=
NULL
,
"Expected non-NULL ptr
\n
"
);
ok
(
lstrlenA
((
LPSTR
)
ptr
)
!=
0
,
"Expected non-empty string
\n
"
);
ok
(
lstrcmpA
((
LPSTR
)
ptr
,
"data"
),
"Did not expect data
\n
"
);
ok
(
size
==
0
,
"Expected 0, got %d
\n
"
,
size
);
ret
=
DdeUnaccessData
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
ret
=
DdeFreeDataHandle
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
/* cbOff is non-zero */
DdeGetLastError
(
dde_inst
);
hdata
=
DdeCreateDataHandle
(
dde_inst
,
(
LPBYTE
)
"data"
,
MAX_PATH
,
2
,
item
,
CF_TEXT
,
0
);
err
=
DdeGetLastError
(
dde_inst
);
ok
(
hdata
!=
NULL
,
"Expected non-NULL hdata
\n
"
);
ok
(
err
==
DMLERR_NO_ERROR
,
"Expected DMLERR_NO_ERROR, got %d
\n
"
,
err
);
ptr
=
GlobalLock
(
hdata
);
todo_wine
{
ok
(
ptr
==
NULL
,
"Expected NULL, got %p
\n
"
,
ptr
);
}
ptr
=
DdeAccessData
(
hdata
,
&
size
);
ok
(
ptr
!=
NULL
,
"Expected non-NULL ptr
\n
"
);
ok
(
size
==
262
,
"Expected 262, got %d
\n
"
,
size
);
todo_wine
{
ok
(
lstrlenA
((
LPSTR
)
ptr
)
==
0
,
"Expected 0, got %d
\n
"
,
lstrlenA
((
LPSTR
)
ptr
));
}
ret
=
DdeUnaccessData
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
ret
=
DdeFreeDataHandle
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
/* NULL item */
DdeGetLastError
(
dde_inst
);
hdata
=
DdeCreateDataHandle
(
dde_inst
,
(
LPBYTE
)
"data"
,
MAX_PATH
,
0
,
0
,
CF_TEXT
,
0
);
err
=
DdeGetLastError
(
dde_inst
);
ok
(
hdata
!=
NULL
,
"Expected non-NULL hdata
\n
"
);
ok
(
err
==
DMLERR_NO_ERROR
,
"Expected DMLERR_NO_ERROR, got %d
\n
"
,
err
);
ptr
=
GlobalLock
(
hdata
);
todo_wine
{
ok
(
ptr
==
NULL
,
"Expected NULL, got %p
\n
"
,
ptr
);
}
ptr
=
DdeAccessData
(
hdata
,
&
size
);
ok
(
ptr
!=
NULL
,
"Expected non-NULL ptr
\n
"
);
ok
(
!
lstrcmpA
((
LPSTR
)
ptr
,
"data"
),
"Expected data, got %s
\n
"
,
ptr
);
ok
(
size
==
260
,
"Expected 260, got %d
\n
"
,
size
);
ret
=
DdeUnaccessData
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
ret
=
DdeFreeDataHandle
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
/* NULL item */
DdeGetLastError
(
dde_inst
);
hdata
=
DdeCreateDataHandle
(
dde_inst
,
(
LPBYTE
)
"data"
,
MAX_PATH
,
0
,
(
HSZ
)
0xdeadbeef
,
CF_TEXT
,
0
);
err
=
DdeGetLastError
(
dde_inst
);
ok
(
hdata
!=
NULL
,
"Expected non-NULL hdata
\n
"
);
ok
(
err
==
DMLERR_NO_ERROR
,
"Expected DMLERR_NO_ERROR, got %d
\n
"
,
err
);
ptr
=
GlobalLock
(
hdata
);
todo_wine
{
ok
(
ptr
==
NULL
,
"Expected NULL, got %p
\n
"
,
ptr
);
}
ptr
=
DdeAccessData
(
hdata
,
&
size
);
ok
(
ptr
!=
NULL
,
"Expected non-NULL ptr
\n
"
);
ok
(
!
lstrcmpA
((
LPSTR
)
ptr
,
"data"
),
"Expected data, got %s
\n
"
,
ptr
);
ok
(
size
==
260
,
"Expected 260, got %d
\n
"
,
size
);
ret
=
DdeUnaccessData
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
ret
=
DdeFreeDataHandle
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
/* invalid clipboard format */
DdeGetLastError
(
dde_inst
);
hdata
=
DdeCreateDataHandle
(
dde_inst
,
(
LPBYTE
)
"data"
,
MAX_PATH
,
0
,
item
,
0xdeadbeef
,
0
);
err
=
DdeGetLastError
(
dde_inst
);
ok
(
hdata
!=
NULL
,
"Expected non-NULL hdata
\n
"
);
ok
(
err
==
DMLERR_NO_ERROR
,
"Expected DMLERR_NO_ERROR, got %d
\n
"
,
err
);
ptr
=
GlobalLock
(
hdata
);
todo_wine
{
ok
(
ptr
==
NULL
,
"Expected NULL, got %p
\n
"
,
ptr
);
}
ptr
=
DdeAccessData
(
hdata
,
&
size
);
ok
(
ptr
!=
NULL
,
"Expected non-NULL ptr
\n
"
);
ok
(
!
lstrcmpA
((
LPSTR
)
ptr
,
"data"
),
"Expected data, got %s
\n
"
,
ptr
);
ok
(
size
==
260
,
"Expected 260, got %d
\n
"
,
size
);
ret
=
DdeUnaccessData
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
ret
=
DdeFreeDataHandle
(
hdata
);
ok
(
ret
==
TRUE
,
"Expected TRUE, got %d
\n
"
,
ret
);
ret
=
DdeUninitialize
(
dde_inst
);
ok
(
res
==
DMLERR_NO_ERROR
,
"Expected DMLERR_NO_ERROR, got %d
\n
"
,
res
);
}
static
void
test_DdeCreateStringHandle
(
void
)
{
DWORD
dde_inst
,
ret
;
...
...
@@ -1900,6 +2091,7 @@ START_TEST(dde)
test_dde_aw_transaction
();
test_DdeCreateDataHandle
();
test_DdeCreateStringHandle
();
test_FreeDDElParam
();
test_PackDDElParam
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment