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
31ea1266
Commit
31ea1266
authored
Feb 11, 2010
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Feb 12, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Return the correct results in GetAcceptLanguagesW.
parent
7aac2c07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
31 deletions
+33
-31
ordinal.c
dlls/shlwapi/ordinal.c
+33
-31
No files found.
dlls/shlwapi/ordinal.c
View file @
31ea1266
...
...
@@ -46,6 +46,7 @@
#include "shlwapi.h"
#include "shellapi.h"
#include "commdlg.h"
#include "mlang.h"
#include "mshtmhst.h"
#include "wine/unicode.h"
#include "wine/debug.h"
...
...
@@ -450,14 +451,14 @@ RegisterDefaultAcceptHeaders_Exit:
*
* PARAMS
* langbuf [O] Destination for language string
* buflen [I] Length of langbuf
* buflen [I] Length of langbuf
in characters
* [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.
*
E_INVALIDARG
, If the buffer is not big enough
*
HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER)
, If the buffer is not big enough
*/
HRESULT
WINAPI
GetAcceptLanguagesW
(
LPWSTR
langbuf
,
LPDWORD
buflen
)
{
...
...
@@ -468,49 +469,50 @@ HRESULT WINAPI GetAcceptLanguagesW( LPWSTR langbuf, LPDWORD buflen)
'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
;
DWORD
len
;
HKEY
mykey
;
HRESULT
retval
;
LCID
mylcid
;
WCHAR
*
mystr
;
LONG
lres
;
TRACE
(
"(%p, %p) *%p: %d
\n
"
,
langbuf
,
buflen
,
buflen
,
buflen
?
*
buflen
:
-
1
);
if
(
!
langbuf
||
!
buflen
||
!*
buflen
)
return
E_FAIL
;
mystrlen
=
(
*
buflen
>
20
)
?
*
buflen
:
20
;
mystr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WCHAR
)
*
mystrlen
);
len
=
mystrlen
*
sizeof
(
WCHAR
);
mystr
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
mystr
[
0
]
=
0
;
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
)
);
lres
=
RegQueryValueExW
(
mykey
,
valueW
,
0
,
&
mytype
,
(
PBYTE
)
mystr
,
&
len
);
RegCloseKey
(
mykey
);
len
=
lstrlenW
(
mystr
);
if
(
*
buflen
>
strlenW
(
mystr
))
{
*
buflen
=
strlenW
(
mystr
);
retval
=
S_OK
;
}
else
{
*
buflen
=
0
;
retval
=
E_INVALIDARG
;
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
if
(
!
lres
&&
(
*
buflen
>
len
))
{
lstrcpyW
(
langbuf
,
mystr
);
*
buflen
=
len
;
HeapFree
(
GetProcessHeap
(),
0
,
mystr
);
return
S_OK
;
}
RegCloseKey
(
mykey
);
/* Did not find a value in the registry or the user buffer is to small */
mylcid
=
GetUserDefaultLCID
();
retval
=
LcidToRfc1766W
(
mylcid
,
mystr
,
mystrlen
);
len
=
lstrlenW
(
mystr
);
memcpy
(
langbuf
,
mystr
,
min
(
*
buflen
,
len
+
1
)
*
sizeof
(
WCHAR
)
);
HeapFree
(
GetProcessHeap
(),
0
,
mystr
);
return
retval
;
if
(
*
buflen
>
len
)
{
*
buflen
=
len
;
return
S_OK
;
}
*
buflen
=
0
;
return
__HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
}
/*************************************************************************
...
...
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