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
dea8c6a9
Commit
dea8c6a9
authored
Sep 21, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user: Fix handling of high bits of resource id in LoadString, reported by Andrey Turkin.
parent
b421b608
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
resource.c
dlls/user/resource.c
+2
-8
resource.c
dlls/user/tests/resource.c
+15
-0
resource.rc
dlls/user/tests/resource.rc
+2
-0
No files found.
dlls/user/resource.c
View file @
dea8c6a9
...
@@ -364,14 +364,11 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
...
@@ -364,14 +364,11 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
int
string_num
;
int
string_num
;
int
i
;
int
i
;
if
(
HIWORD
(
resource_id
)
==
0xFFFF
)
/* netscape 3 passes this */
resource_id
=
(
UINT
)(
-
((
INT
)
resource_id
));
TRACE
(
"instance = %p, id = %04x, buffer = %p, length = %d
\n
"
,
TRACE
(
"instance = %p, id = %04x, buffer = %p, length = %d
\n
"
,
instance
,
resource_id
,
buffer
,
buflen
);
instance
,
resource_id
,
buffer
,
buflen
);
/* Use bits 4 - 19 (incremented by 1) as resourceid, mask out
/* Use loword (incremented by 1) as resourceid */
* 20 - 31. */
hrsrc
=
FindResourceW
(
instance
,
MAKEINTRESOURCEW
((
LOWORD
(
resource_id
)
>>
4
)
+
1
),
hrsrc
=
FindResourceW
(
instance
,
MAKEINTRESOURCEW
(((
resource_id
>>
4
)
&
0xffff
)
+
1
),
(
LPWSTR
)
RT_STRING
);
(
LPWSTR
)
RT_STRING
);
if
(
!
hrsrc
)
return
0
;
if
(
!
hrsrc
)
return
0
;
hmem
=
LoadResource
(
instance
,
hrsrc
);
hmem
=
LoadResource
(
instance
,
hrsrc
);
...
@@ -394,9 +391,6 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
...
@@ -394,9 +391,6 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
buffer
[
0
]
=
(
WCHAR
)
0
;
buffer
[
0
]
=
(
WCHAR
)
0
;
return
0
;
return
0
;
}
}
#if 0
WARN("Don't know why caller gave buflen=%d *p=%d trying to obtain string '%s'\n", buflen, *p, p + 1);
#endif
}
}
TRACE
(
"%s loaded !
\n
"
,
debugstr_w
(
buffer
));
TRACE
(
"%s loaded !
\n
"
,
debugstr_w
(
buffer
));
...
...
dlls/user/tests/resource.c
View file @
dea8c6a9
...
@@ -46,6 +46,7 @@ static void test_LoadStringA (void)
...
@@ -46,6 +46,7 @@ static void test_LoadStringA (void)
{
sizeof
str
,
sizeof
str
-
1
},
{
sizeof
str
,
sizeof
str
-
1
},
{
sizeof
str
-
1
,
sizeof
str
-
2
}};
{
sizeof
str
-
1
,
sizeof
str
-
2
}};
unsigned
int
i
;
unsigned
int
i
;
int
ret
;
assert
(
sizeof
str
<
sizeof
buf
);
assert
(
sizeof
str
<
sizeof
buf
);
for
(
i
=
0
;
i
<
sizeof
tests
/
sizeof
tests
[
0
];
i
++
)
{
for
(
i
=
0
;
i
<
sizeof
tests
/
sizeof
tests
[
0
];
i
++
)
{
...
@@ -61,6 +62,20 @@ static void test_LoadStringA (void)
...
@@ -61,6 +62,20 @@ static void test_LoadStringA (void)
ok
(
buf
[
len
]
==
0
,
"bufsiz=%d: NUL termination missing
\n
"
,
ok
(
buf
[
len
]
==
0
,
"bufsiz=%d: NUL termination missing
\n
"
,
bufsiz
);
bufsiz
);
}
}
ret
=
LoadStringA
(
hInst
,
1
,
buf
,
sizeof
(
buf
)
);
ok
(
ret
>
0
,
"LoadString failed: ret %d err %ld
\n
"
,
ret
,
GetLastError
());
ok
(
LoadStringA
(
hInst
,
MAKELONG
(
1
,
0x8000
),
buf
,
sizeof
(
buf
))
==
ret
,
"LoadString failed: ret %d err %ld
\n
"
,
ret
,
GetLastError
());
ok
(
LoadStringA
(
hInst
,
MAKELONG
(
1
,
0xffff
),
buf
,
sizeof
(
buf
))
==
ret
,
"LoadString failed: ret %d err %ld
\n
"
,
ret
,
GetLastError
());
ret
=
LoadStringA
(
hInst
,
65534
,
buf
,
sizeof
(
buf
)
);
ok
(
ret
>
0
,
"LoadString failed: ret %d err %ld
\n
"
,
ret
,
GetLastError
());
ok
(
LoadStringA
(
hInst
,
MAKELONG
(
65534
,
0x8000
),
buf
,
sizeof
(
buf
))
==
ret
,
"LoadString failed: ret %d err %ld
\n
"
,
ret
,
GetLastError
());
ok
(
LoadStringA
(
hInst
,
MAKELONG
(
65534
,
0xffff
),
buf
,
sizeof
(
buf
))
==
ret
,
"LoadString failed: ret %d err %ld
\n
"
,
ret
,
GetLastError
());
}
}
static
void
test_accel1
(
void
)
static
void
test_accel1
(
void
)
...
...
dlls/user/tests/resource.rc
View file @
dea8c6a9
...
@@ -40,6 +40,8 @@
...
@@ -40,6 +40,8 @@
STRINGTABLE
STRINGTABLE
{
{
0 "String resource"
0 "String resource"
1 "Another string resource"
65534 "Test high id"
}
}
TEST_DIALOG DIALOG DISCARDABLE 0, 0, 60, 30
TEST_DIALOG DIALOG DISCARDABLE 0, 0, 60, 30
...
...
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