Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
d2b217e9
Commit
d2b217e9
authored
Jan 14, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32/tests: Add a test case for calling WriteFile with the DIB section bits as buffer.
parent
8de57bd5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
bitmap.c
dlls/gdi32/tests/bitmap.c
+58
-0
No files found.
dlls/gdi32/tests/bitmap.c
View file @
d2b217e9
...
...
@@ -396,6 +396,62 @@ static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER
test_color_todo(c, exp, GetPixel, todo_getp); \
}
static
void
test_dib_bits_access
(
HBITMAP
hdib
,
void
*
bits
)
{
MEMORY_BASIC_INFORMATION
info
;
char
bmibuf
[
sizeof
(
BITMAPINFO
)
+
256
*
sizeof
(
RGBQUAD
)];
DWORD
data
[
256
];
BITMAPINFO
*
pbmi
=
(
BITMAPINFO
*
)
bmibuf
;
HDC
hdc
=
GetDC
(
0
);
char
filename
[
MAX_PATH
];
HANDLE
file
;
DWORD
written
;
INT
ret
;
ok
(
VirtualQuery
(
bits
,
&
info
,
sizeof
(
info
))
==
sizeof
(
info
),
"VirtualQuery failed
\n
"
);
ok
(
info
.
BaseAddress
==
bits
,
"%p != %p
\n
"
,
info
.
BaseAddress
,
bits
);
ok
(
info
.
AllocationBase
==
bits
,
"%p != %p
\n
"
,
info
.
AllocationBase
,
bits
);
ok
(
info
.
AllocationProtect
==
PAGE_READWRITE
,
"%x != PAGE_READWRITE
\n
"
,
info
.
AllocationProtect
);
ok
(
info
.
State
==
MEM_COMMIT
,
"%x != MEM_COMMIT
\n
"
,
info
.
State
);
ok
(
info
.
Protect
==
PAGE_READWRITE
,
"%x != PAGE_READWRITE
\n
"
,
info
.
Protect
);
ok
(
info
.
Type
==
MEM_PRIVATE
,
"%x != MEM_PRIVATE
\n
"
,
info
.
Type
);
memset
(
pbmi
,
0
,
sizeof
(
bmibuf
)
);
memset
(
data
,
0xcc
,
sizeof
(
data
)
);
pbmi
->
bmiHeader
.
biSize
=
sizeof
(
pbmi
->
bmiHeader
);
pbmi
->
bmiHeader
.
biHeight
=
16
;
pbmi
->
bmiHeader
.
biWidth
=
16
;
pbmi
->
bmiHeader
.
biBitCount
=
32
;
pbmi
->
bmiHeader
.
biPlanes
=
1
;
pbmi
->
bmiHeader
.
biCompression
=
BI_RGB
;
ret
=
SetDIBits
(
hdc
,
hdib
,
0
,
16
,
data
,
pbmi
,
DIB_RGB_COLORS
);
ok
(
ret
==
16
,
"SetDIBits failed
\n
"
);
ok
(
VirtualQuery
(
bits
,
&
info
,
sizeof
(
info
))
==
sizeof
(
info
),
"VirtualQuery failed
\n
"
);
ok
(
info
.
BaseAddress
==
bits
,
"%p != %p
\n
"
,
info
.
BaseAddress
,
bits
);
ok
(
info
.
AllocationBase
==
bits
,
"%p != %p
\n
"
,
info
.
AllocationBase
,
bits
);
ok
(
info
.
AllocationProtect
==
PAGE_READWRITE
,
"%x != PAGE_READWRITE
\n
"
,
info
.
AllocationProtect
);
ok
(
info
.
State
==
MEM_COMMIT
,
"%x != MEM_COMMIT
\n
"
,
info
.
State
);
ok
(
info
.
Type
==
MEM_PRIVATE
,
"%x != MEM_PRIVATE
\n
"
,
info
.
Type
);
/* it has been protected now */
todo_wine
ok
(
info
.
Protect
==
PAGE_READWRITE
,
"%x != PAGE_READWRITE
\n
"
,
info
.
Protect
);
/* try writing protected bits to a file */
GetTempFileNameA
(
"."
,
"dib"
,
0
,
filename
);
file
=
CreateFileA
(
filename
,
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"failed to open %s error %u
\n
"
,
filename
,
GetLastError
()
);
ret
=
WriteFile
(
file
,
bits
,
8192
,
&
written
,
NULL
);
ok
(
ret
,
"WriteFile failed error %u
\n
"
,
GetLastError
()
);
if
(
ret
)
ok
(
written
==
8192
,
"only wrote %u bytes
\n
"
,
written
);
CloseHandle
(
file
);
DeleteFileA
(
filename
);
}
static
void
test_dibsections
(
void
)
{
HDC
hdc
,
hdcmem
,
hdcmem2
;
...
...
@@ -455,6 +511,8 @@ static void test_dibsections(void)
ok
(
info
.
Protect
==
PAGE_READWRITE
,
"%x != PAGE_READWRITE
\n
"
,
info
.
Protect
);
ok
(
info
.
Type
==
MEM_PRIVATE
,
"%x != MEM_PRIVATE
\n
"
,
info
.
Type
);
test_dib_bits_access
(
hdib
,
bits
);
test_dib_info
(
hdib
,
bits
,
&
pbmi
->
bmiHeader
);
DeleteObject
(
hdib
);
...
...
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