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
9978cc9c
Commit
9978cc9c
authored
Mar 05, 2008
by
Christopher Berner
Committed by
Alexandre Julliard
Mar 11, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Make LoadStringW pass tests.
parent
17bf0d91
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
32 deletions
+38
-32
oid.c
dlls/crypt32/oid.c
+5
-5
help.c
dlls/hhctrl.ocx/help.c
+5
-4
wnet.c
dlls/mpr/wnet.c
+6
-4
resource.c
dlls/user32/resource.c
+11
-1
resource.c
dlls/user32/tests/resource.c
+11
-18
No files found.
dlls/crypt32/oid.c
View file @
9978cc9c
...
...
@@ -1402,8 +1402,9 @@ static void init_oid_info(HINSTANCE hinst)
}
else
{
LPCWSTR
stringresource
;
int
len
=
LoadStringW
(
hinst
,
(
UINT_PTR
)
oidInfoConstructors
[
i
].
pwszName
,
NULL
,
0
);
(
LPWSTR
)
&
stringresource
,
0
);
if
(
len
)
{
...
...
@@ -1415,12 +1416,11 @@ static void init_oid_info(HINSTANCE hinst)
memset
(
info
,
0
,
sizeof
(
*
info
));
info
->
info
.
cbSize
=
sizeof
(
CRYPT_OID_INFO
);
info
->
info
.
pszOID
=
oidInfoConstructors
[
i
].
pszOID
;
info
->
info
.
pwszName
=
(
LPWSTR
)((
LPBYTE
)
info
+
sizeof
(
struct
OIDInfo
));
info
->
info
.
pwszName
=
(
LPWSTR
)(
info
+
1
);
info
->
info
.
dwGroupId
=
oidInfoConstructors
[
i
].
dwGroupId
;
info
->
info
.
u
.
Algid
=
oidInfoConstructors
[
i
].
Algid
;
LoadStringW
(
hinst
,
(
UINT_PTR
)
oidInfoConstructors
[
i
].
pwszName
,
(
LPWSTR
)
info
->
info
.
pwszName
,
len
+
1
)
;
memcpy
(
info
+
1
,
stringresource
,
len
*
sizeof
(
WCHAR
));
((
LPWSTR
)(
info
+
1
))[
len
]
=
0
;
if
(
oidInfoConstructors
[
i
].
blob
)
{
info
->
info
.
ExtraInfo
.
cbData
=
...
...
dlls/hhctrl.ocx/help.c
View file @
9978cc9c
...
...
@@ -51,13 +51,14 @@ static const WCHAR szEmpty[] = {0};
static
LPWSTR
HH_LoadString
(
DWORD
dwID
)
{
LPWSTR
string
=
NULL
;
LPCWSTR
stringresource
;
int
iSize
;
iSize
=
LoadStringW
(
hhctrl_hinstance
,
dwID
,
NULL
,
0
);
iSize
+=
2
;
/* some strings (tab text) needs double-null termination */
iSize
=
LoadStringW
(
hhctrl_hinstance
,
dwID
,
(
LPWSTR
)
&
stringresource
,
0
);
string
=
heap_alloc
(
iSize
*
sizeof
(
WCHAR
));
LoadStringW
(
hhctrl_hinstance
,
dwID
,
string
,
iSize
);
string
=
heap_alloc
((
iSize
+
2
)
*
sizeof
(
WCHAR
));
/* some strings (tab text) needs double-null termination */
memcpy
(
string
,
stringresource
,
iSize
*
sizeof
(
WCHAR
));
string
[
iSize
]
=
0
;
return
string
;
}
...
...
dlls/mpr/wnet.c
View file @
9978cc9c
...
...
@@ -279,16 +279,18 @@ void wnetInit(HINSTANCE hInstDll)
{
PWSTR
ptrPrev
;
int
entireNetworkLen
;
LPCWSTR
stringresource
;
entireNetworkLen
=
LoadStringW
(
hInstDll
,
IDS_ENTIRENETWORK
,
NULL
,
0
);
IDS_ENTIRENETWORK
,
(
LPWSTR
)
&
stringresource
,
0
);
providerTable
->
entireNetwork
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
entireNetworkLen
+
1
)
*
sizeof
(
WCHAR
));
if
(
providerTable
->
entireNetwork
)
LoadStringW
(
hInstDll
,
IDS_ENTIRENETWORK
,
providerTable
->
entireNetwork
,
entireNetworkLen
+
1
);
{
memcpy
(
providerTable
->
entireNetwork
,
stringresource
,
entireNetworkLen
*
sizeof
(
WCHAR
));
providerTable
->
entireNetwork
[
entireNetworkLen
]
=
0
;
}
providerTable
->
numAllocated
=
numToAllocate
;
for
(
ptr
=
providers
;
ptr
;
)
{
...
...
dlls/user32/resource.c
View file @
9978cc9c
...
...
@@ -368,6 +368,9 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
TRACE
(
"instance = %p, id = %04x, buffer = %p, length = %d
\n
"
,
instance
,
resource_id
,
buffer
,
buflen
);
if
(
buffer
==
NULL
)
return
0
;
/* Use loword (incremented by 1) as resourceid */
hrsrc
=
FindResourceW
(
instance
,
MAKEINTRESOURCEW
((
LOWORD
(
resource_id
)
>>
4
)
+
1
),
(
LPWSTR
)
RT_STRING
);
...
...
@@ -382,7 +385,14 @@ INT WINAPI LoadStringW( HINSTANCE instance, UINT resource_id,
TRACE
(
"strlen = %d
\n
"
,
(
int
)
*
p
);
if
(
buffer
==
NULL
)
return
*
p
;
/*if buflen == 0, then return a read-only pointer to the resource itself in buffer
it is assumed that buffer is actually a (LPWSTR *) */
if
(
buflen
==
0
)
{
*
((
LPWSTR
*
)
buffer
)
=
p
+
1
;
return
*
p
;
}
i
=
min
(
buflen
-
1
,
*
p
);
if
(
i
>
0
)
{
memcpy
(
buffer
,
p
+
1
,
i
*
sizeof
(
WCHAR
));
...
...
dlls/user32/tests/resource.c
View file @
9978cc9c
...
...
@@ -43,13 +43,10 @@ static void test_LoadStringW(void)
length1
=
LoadStringW
(
hInst
,
2
,
(
WCHAR
*
)
&
resourcepointer
,
0
);
/* get pointer to resource. */
length2
=
LoadStringW
(
hInst
,
2
,
returnedstringw
,
sizeof
(
returnedstringw
)
/
sizeof
(
WCHAR
));
/* get resource string */
ok
(
length2
>
0
,
"LoadStringW failed to load resource 2, ret %d, err %d
\n
"
,
length2
,
GetLastError
());
todo_wine
{
ok
(
length1
==
length2
,
"LoadStringW returned different values dependent on buflen. ret1 %d, ret2 %d
\n
"
,
length1
,
length2
);
ok
(
length1
>
0
&&
resourcepointer
!=
NULL
,
"LoadStringW failed to get pointer to resource 2, ret %d, err %d
\n
"
,
length1
,
GetLastError
());
}
ok
(
length1
==
length2
,
"LoadStringW returned different values dependent on buflen. ret1 %d, ret2 %d
\n
"
,
length1
,
length2
);
ok
(
length1
>
0
&&
resourcepointer
!=
NULL
,
"LoadStringW failed to get pointer to resource 2, ret %d, err %d
\n
"
,
length1
,
GetLastError
());
/* Copy the resource since it is not '\0' terminated, and add '\0' to the end */
if
(
resourcepointer
!=
NULL
)
/* Check that the resource pointer was loaded to avoid access violation */
...
...
@@ -62,17 +59,13 @@ static void test_LoadStringW(void)
ok
(
!
memcmp
(
copiedstringw
,
returnedstringw
,
(
length2
+
1
)
*
sizeof
(
WCHAR
)),
"strings don't match: returnedstring = %s, copiedstring = %s
\n
"
,
returnedstring
,
copiedstring
);
}
todo_wine
{
/* check that calling LoadStringW with buffer = NULL returns zero */
retvalue
=
LoadStringW
(
hInst
,
2
,
NULL
,
0
);
ok
(
!
retvalue
,
"LoadStringW returned a non-zero value when called with buffer = NULL, retvalue = %d
\n
"
,
retvalue
);
/* check again, with a different buflen value, that calling LoadStringW with buffer = NULL returns zero */
retvalue
=
LoadStringW
(
hInst
,
2
,
NULL
,
128
);
ok
(
!
retvalue
,
"LoadStringW returned a non-zero value when called with buffer = NULL, retvalue = %d
\n
"
,
retvalue
);
}
/* check that calling LoadStringW with buffer = NULL returns zero */
retvalue
=
LoadStringW
(
hInst
,
2
,
NULL
,
0
);
ok
(
!
retvalue
,
"LoadStringW returned a non-zero value when called with buffer = NULL, retvalue = %d
\n
"
,
retvalue
);
/* check again, with a different buflen value, that calling LoadStringW with buffer = NULL returns zero */
retvalue
=
LoadStringW
(
hInst
,
2
,
NULL
,
128
);
ok
(
!
retvalue
,
"LoadStringW returned a non-zero value when called with buffer = NULL, retvalue = %d
\n
"
,
retvalue
);
}
static
void
test_LoadStringA
(
void
)
...
...
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