Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
3f7749a6
Commit
3f7749a6
authored
20 years ago
by
Stefan Leichter
Committed by
Alexandre Julliard
20 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Removed the crosscalls (unicode to ascii) from GetAcceptLanguagesW.
Removed todo_wine from GetAcceptLanguagesA tests.
parent
86a0e50a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/shlwapi/ordinal.c
+78
-92
78 additions, 92 deletions
dlls/shlwapi/ordinal.c
dlls/shlwapi/tests/ordinal.c
+7
-7
7 additions, 7 deletions
dlls/shlwapi/tests/ordinal.c
with
85 additions
and
99 deletions
dlls/shlwapi/ordinal.c
+
78
−
92
View file @
3f7749a6
...
...
@@ -518,113 +518,99 @@ RegisterDefaultAcceptHeaders_Exit:
}
/*************************************************************************
* @ [SHLWAPI.1
4
]
* @ [SHLWAPI.1
5
]
*
* Get Explorers "AcceptLanguage" setting.
*
* PARAMS
* langbuf [O] Destination for language string
* buflen [I] Length of langbuf
* [0] Success: used length of langbuf
*
* RETURNS
* Success: S_OK. langbuf is set to the language string found.
* Failure: E_FAIL, If any arguments are invalid, error occurred, or Explorer
* does not contain the setting.
*/
HRESULT
WINAPI
GetAcceptLanguagesA
(
LPSTR
langbuf
,
LPDWORD
buflen
)
{
CHAR
*
mystr
;
DWORD
mystrlen
,
mytype
;
HKEY
mykey
;
LCID
mylcid
;
if
(
!
langbuf
||
!
buflen
||
!*
buflen
)
return
E_FAIL
;
mystrlen
=
(
*
buflen
>
6
)
?
*
buflen
:
6
;
mystr
=
(
CHAR
*
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
mystrlen
);
RegOpenKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Microsoft
\\
Internet Explorer
\\
International"
,
&
mykey
);
if
(
RegQueryValueExA
(
mykey
,
"AcceptLanguage"
,
0
,
&
mytype
,
(
PBYTE
)
mystr
,
&
mystrlen
))
{
/* Did not find value */
mylcid
=
GetUserDefaultLCID
();
/* somehow the mylcid translates into "en-us"
* this is similar to "LOCALE_SABBREVLANGNAME"
* which could be gotten via GetLocaleInfo.
* The only problem is LOCALE_SABBREVLANGUAGE" is
* a 3 char string (first 2 are country code and third is
* letter for "sublanguage", which does not come close to
* "en-us"
*/
lstrcpyA
(
mystr
,
"en-us"
);
mystrlen
=
lstrlenA
(
mystr
);
}
else
{
/* handle returned string */
FIXME
(
"missing code
\n
"
);
}
if
(
mystrlen
>
*
buflen
)
lstrcpynA
(
langbuf
,
mystr
,
*
buflen
);
else
{
lstrcpyA
(
langbuf
,
mystr
);
*
buflen
=
lstrlenA
(
langbuf
);
}
RegCloseKey
(
mykey
);
HeapFree
(
GetProcessHeap
(),
0
,
mystr
);
TRACE
(
"language is %s
\n
"
,
debugstr_a
(
langbuf
));
return
0
;
* E_INVALIDARG, If the buffer is not big enough
*/
HRESULT
WINAPI
GetAcceptLanguagesW
(
LPWSTR
langbuf
,
LPDWORD
buflen
)
{
static
const
WCHAR
szkeyW
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'I'
,
'n'
,
't'
,
'e'
,
'r'
,
'n'
,
'e'
,
't'
,
' '
,
'E'
,
'x'
,
'p'
,
'l'
,
'o'
,
'r'
,
'e'
,
'r'
,
'\\'
,
'I'
,
'n'
,
't'
,
'e'
,
'r'
,
'n'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
'a'
,
'l'
,
0
};
static
const
WCHAR
valueW
[]
=
{
'A'
,
'c'
,
'c'
,
'e'
,
'p'
,
't'
,
'L'
,
'a'
,
'n'
,
'g'
,
'u'
,
'a'
,
'g'
,
'e'
,
0
};
static
const
WCHAR
enusW
[]
=
{
'e'
,
'n'
,
'-'
,
'u'
,
's'
,
0
};
DWORD
mystrlen
,
mytype
;
HKEY
mykey
;
HRESULT
retval
;
LCID
mylcid
;
WCHAR
*
mystr
;
if
(
!
langbuf
||
!
buflen
||
!*
buflen
)
return
E_FAIL
;
mystrlen
=
(
*
buflen
>
20
)
?
*
buflen
:
20
;
mystr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
mystrlen
);
RegOpenKeyW
(
HKEY_CURRENT_USER
,
szkeyW
,
&
mykey
);
if
(
RegQueryValueExW
(
mykey
,
valueW
,
0
,
&
mytype
,
(
PBYTE
)
mystr
,
&
mystrlen
))
{
/* Did not find value */
mylcid
=
GetUserDefaultLCID
();
/* somehow the mylcid translates into "en-us"
* this is similar to "LOCALE_SABBREVLANGNAME"
* which could be gotten via GetLocaleInfo.
* The only problem is LOCALE_SABBREVLANGUAGE" is
* a 3 char string (first 2 are country code and third is
* letter for "sublanguage", which does not come close to
* "en-us"
*/
lstrcpyW
(
mystr
,
enusW
);
mystrlen
=
lstrlenW
(
mystr
);
}
else
{
/* handle returned string */
FIXME
(
"missing code
\n
"
);
}
memcpy
(
langbuf
,
mystr
,
min
(
*
buflen
,
strlenW
(
mystr
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
*
buflen
>
lstrlenW
(
mystr
))
{
*
buflen
=
lstrlenW
(
mystr
);
retval
=
S_OK
;
}
else
{
*
buflen
=
0
;
retval
=
E_INVALIDARG
;
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
}
RegCloseKey
(
mykey
);
HeapFree
(
GetProcessHeap
(),
0
,
mystr
);
return
retval
;
}
/*************************************************************************
* @ [SHLWAPI.1
5
]
* @ [SHLWAPI.1
4
]
*
* Unicode version of GetAcceptLanguagesA.
*/
HRESULT
WINAPI
GetAcceptLanguagesW
(
LPWSTR
langbuf
,
LPDWORD
buflen
)
{
CHAR
*
mystr
;
DWORD
mystrlen
,
mytype
;
HKEY
mykey
;
LCID
mylcid
;
if
(
!
langbuf
||
!
buflen
||
!*
buflen
)
return
E_FAIL
;
mystrlen
=
(
*
buflen
>
6
)
?
*
buflen
:
6
;
mystr
=
(
CHAR
*
)
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
mystrlen
);
RegOpenKeyA
(
HKEY_CURRENT_USER
,
"Software
\\
Microsoft
\\
Internet Explorer
\\
International"
,
&
mykey
);
if
(
RegQueryValueExA
(
mykey
,
"AcceptLanguage"
,
0
,
&
mytype
,
(
PBYTE
)
mystr
,
&
mystrlen
))
{
/* Did not find value */
mylcid
=
GetUserDefaultLCID
();
/* somehow the mylcid translates into "en-us"
* this is similar to "LOCALE_SABBREVLANGNAME"
* which could be gotten via GetLocaleInfo.
* The only problem is LOCALE_SABBREVLANGUAGE" is
* a 3 char string (first 2 are country code and third is
* letter for "sublanguage", which does not come close to
* "en-us"
*/
lstrcpyA
(
mystr
,
"en-us"
);
mystrlen
=
lstrlenA
(
mystr
);
}
else
{
/* handle returned string */
FIXME
(
"missing code
\n
"
);
}
RegCloseKey
(
mykey
);
*
buflen
=
MultiByteToWideChar
(
0
,
0
,
mystr
,
-
1
,
langbuf
,
(
*
buflen
)
-
1
);
HeapFree
(
GetProcessHeap
(),
0
,
mystr
);
TRACE
(
"language is %s
\n
"
,
debugstr_w
(
langbuf
));
return
0
;
* Ascii version of GetAcceptLanguagesW.
*/
HRESULT
WINAPI
GetAcceptLanguagesA
(
LPSTR
langbuf
,
LPDWORD
buflen
)
{
WCHAR
*
langbufW
;
DWORD
buflenW
,
convlen
;
HRESULT
retval
;
if
(
!
langbuf
||
!
buflen
||
!*
buflen
)
return
E_FAIL
;
buflenW
=
*
buflen
;
langbufW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
buflenW
);
retval
=
GetAcceptLanguagesW
(
langbufW
,
&
buflenW
);
/* FIXME: this is wrong, the string may not be null-terminated */
convlen
=
WideCharToMultiByte
(
CP_ACP
,
0
,
langbufW
,
-
1
,
langbuf
,
*
buflen
,
NULL
,
NULL
);
*
buflen
=
buflenW
?
convlen
:
0
;
if
(
langbufW
)
HeapFree
(
GetProcessHeap
(),
0
,
langbufW
);
return
retval
;
}
/*************************************************************************
...
...
This diff is collapsed.
Click to expand it.
dlls/shlwapi/tests/ordinal.c
+
7
−
7
View file @
3f7749a6
...
...
@@ -90,22 +90,22 @@ static void test_GetAcceptLanguagesA(void)
buffersize
=
buffersize2
=
1
;
memset
(
buffer
,
0
,
sizeof
(
buffer
));
retval
=
pGetAcceptLanguagesA
(
buffer
,
&
buffersize
);
todo_wine
ok
(
retval
==
E_INVALIDARG
,
"function result wrong: got %08lx; expected E_INVALIDARG
\n
"
,
retval
);
todo_wine
ok
(
buffersize
==
0
,
ok
(
retval
==
E_INVALIDARG
,
"function result wrong: got %08lx; expected E_INVALIDARG
\n
"
,
retval
);
ok
(
buffersize
==
0
,
"buffersize wrong: got %08lx, expected 0 (2nd parameter;Win2k)
\n
"
,
buffersize
);
todo_wine
ok
(
ERROR_INSUFFICIENT_BUFFER
==
GetLastError
(),
ok
(
ERROR_INSUFFICIENT_BUFFER
==
GetLastError
(),
"last error wrong: got %08lx; expected ERROR_INSUFFICIENT_BUFFER
\n
"
,
GetLastError
());
todo_wine
ok
(
buffersize2
==
strlen
(
buffer
),
ok
(
buffersize2
==
strlen
(
buffer
),
"buffer content (length) wrong: got %08x, expected %08lx
\n
"
,
strlen
(
buffer
),
buffersize2
);
buffersize
=
buffersize2
=
exactsize
;
memset
(
buffer
,
0
,
sizeof
(
buffer
));
SetLastError
(
ERROR_SUCCESS
);
retval
=
pGetAcceptLanguagesA
(
buffer
,
&
buffersize
);
todo_wine
ok
(
retval
==
E_INVALIDARG
,
"function result wrong: got %08lx; expected E_INVALIDARG
\n
"
,
retval
);
todo_wine
ok
(
buffersize
==
0
,
ok
(
retval
==
E_INVALIDARG
,
"function result wrong: got %08lx; expected E_INVALIDARG
\n
"
,
retval
);
ok
(
buffersize
==
0
,
"buffersize wrong: got %08lx, expected 0 (2nd parameter;Win2k)
\n
"
,
buffersize
);
todo_wine
ok
(
ERROR_INSUFFICIENT_BUFFER
==
GetLastError
(),
ok
(
ERROR_INSUFFICIENT_BUFFER
==
GetLastError
(),
"last error wrong: got %08lx; expected ERROR_INSUFFICIENT_BUFFER
\n
"
,
GetLastError
());
ok
(
buffersize2
==
strlen
(
buffer
),
"buffer content (length) wrong: got %08x, expected %08lx
\n
"
,
strlen
(
buffer
),
buffersize2
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment