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
762f51cf
Commit
762f51cf
authored
Mar 09, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Use wide character string literals in the remaining files.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b8fe9124
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
43 deletions
+22
-43
loader.c
dlls/kernelbase/loader.c
+1
-3
main.c
dlls/kernelbase/main.c
+3
-8
memory.c
dlls/kernelbase/memory.c
+2
-8
sync.c
dlls/kernelbase/sync.c
+12
-15
version.c
dlls/kernelbase/version.c
+4
-9
No files found.
dlls/kernelbase/loader.c
View file @
762f51cf
...
...
@@ -81,8 +81,6 @@ FARPROC WINAPI get_proc_address( HMODULE module, LPCSTR function )
*/
static
BOOL
load_library_as_datafile
(
LPCWSTR
load_path
,
DWORD
flags
,
LPCWSTR
name
,
HMODULE
*
mod_ret
)
{
static
const
WCHAR
dotDLL
[]
=
{
'.'
,
'd'
,
'l'
,
'l'
,
0
};
WCHAR
filenameW
[
MAX_PATH
];
HANDLE
mapping
,
file
=
INVALID_HANDLE_VALUE
;
HMODULE
module
=
0
;
...
...
@@ -92,7 +90,7 @@ static BOOL load_library_as_datafile( LPCWSTR load_path, DWORD flags, LPCWSTR na
if
(
flags
&
LOAD_LIBRARY_AS_IMAGE_RESOURCE
)
protect
|=
SEC_IMAGE
;
if
(
SearchPathW
(
NULL
,
name
,
dotDLL
,
ARRAY_SIZE
(
filenameW
),
filenameW
,
NULL
))
if
(
SearchPathW
(
NULL
,
name
,
L".dll"
,
ARRAY_SIZE
(
filenameW
),
filenameW
,
NULL
))
{
file
=
CreateFileW
(
filenameW
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_DELETE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
...
...
dlls/kernelbase/main.c
View file @
762f51cf
...
...
@@ -320,12 +320,6 @@ static HRESULT lcid_to_rfc1766(LCID lcid, WCHAR *rfc1766, INT len)
HRESULT
WINAPI
GetAcceptLanguagesW
(
WCHAR
*
langbuf
,
DWORD
*
buflen
)
{
static
const
WCHAR
keyW
[]
=
{
'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
};
DWORD
mystrlen
,
mytype
;
WCHAR
*
mystr
;
LCID
mylcid
;
...
...
@@ -342,8 +336,9 @@ HRESULT WINAPI GetAcceptLanguagesW(WCHAR *langbuf, DWORD *buflen)
len
=
mystrlen
*
sizeof
(
WCHAR
);
mystr
=
heap_alloc
(
len
);
mystr
[
0
]
=
0
;
RegOpenKeyExW
(
HKEY_CURRENT_USER
,
keyW
,
0
,
KEY_QUERY_VALUE
,
&
mykey
);
lres
=
RegQueryValueExW
(
mykey
,
valueW
,
0
,
&
mytype
,
(
PBYTE
)
mystr
,
&
len
);
RegOpenKeyExW
(
HKEY_CURRENT_USER
,
L"Software
\\
Microsoft
\\
Internet Explorer
\\
International"
,
0
,
KEY_QUERY_VALUE
,
&
mykey
);
lres
=
RegQueryValueExW
(
mykey
,
L"AcceptLanguage"
,
0
,
&
mytype
,
(
PBYTE
)
mystr
,
&
len
);
RegCloseKey
(
mykey
);
len
=
lstrlenW
(
mystr
);
...
...
dlls/kernelbase/memory.c
View file @
762f51cf
...
...
@@ -888,12 +888,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH LocalUnlock( HLOCAL hmem )
*/
HANDLE
WINAPI
DECLSPEC_HOTPATCH
CreateMemoryResourceNotification
(
MEMORY_RESOURCE_NOTIFICATION_TYPE
type
)
{
static
const
WCHAR
lowmemW
[]
=
{
'\\'
,
'K'
,
'e'
,
'r'
,
'n'
,
'e'
,
'l'
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
's'
,
'\\'
,
'L'
,
'o'
,
'w'
,
'M'
,
'e'
,
'm'
,
'o'
,
'r'
,
'y'
,
'C'
,
'o'
,
'n'
,
'd'
,
'i'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
highmemW
[]
=
{
'\\'
,
'K'
,
'e'
,
'r'
,
'n'
,
'e'
,
'l'
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
's'
,
'\\'
,
'H'
,
'i'
,
'g'
,
'h'
,
'M'
,
'e'
,
'm'
,
'o'
,
'r'
,
'y'
,
'C'
,
'o'
,
'n'
,
'd'
,
'i'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
HANDLE
ret
;
UNICODE_STRING
nameW
;
OBJECT_ATTRIBUTES
attr
;
...
...
@@ -901,10 +895,10 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateMemoryResourceNotification( MEMORY_RESOURC
switch
(
type
)
{
case
LowMemoryResourceNotification
:
RtlInitUnicodeString
(
&
nameW
,
lowmemW
);
RtlInitUnicodeString
(
&
nameW
,
L"
\\
KernelObjects
\\
LowMemoryCondition"
);
break
;
case
HighMemoryResourceNotification
:
RtlInitUnicodeString
(
&
nameW
,
highmemW
);
RtlInitUnicodeString
(
&
nameW
,
L"
\\
KernelObjects
\\
HighMemoryCondition"
);
break
;
default:
SetLastError
(
ERROR_INVALID_PARAMETER
);
...
...
dlls/kernelbase/sync.c
View file @
762f51cf
...
...
@@ -63,8 +63,6 @@ static inline LARGE_INTEGER *get_nt_timeout( LARGE_INTEGER *time, DWORD timeout
NTSTATUS
WINAPI
BaseGetNamedObjectDirectory
(
HANDLE
*
dir
)
{
static
HANDLE
handle
;
static
const
WCHAR
basenameW
[]
=
{
'\\'
,
'S'
,
'e'
,
's'
,
's'
,
'i'
,
'o'
,
'n'
,
's'
,
'\\'
,
'%'
,
'u'
,
'\\'
,
'B'
,
'a'
,
's'
,
'e'
,
'N'
,
'a'
,
'm'
,
'e'
,
'd'
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
's'
,
0
};
WCHAR
buffer
[
64
];
UNICODE_STRING
str
;
OBJECT_ATTRIBUTES
attr
;
...
...
@@ -74,7 +72,8 @@ NTSTATUS WINAPI BaseGetNamedObjectDirectory( HANDLE *dir )
{
HANDLE
dir
;
swprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
basenameW
,
NtCurrentTeb
()
->
Peb
->
SessionId
);
swprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
L"
\\
Sessions
\\
%u
\\
BaseNamedObjects"
,
NtCurrentTeb
()
->
Peb
->
SessionId
);
RtlInitUnicodeString
(
&
str
,
buffer
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
NtOpenDirectoryObject
(
&
dir
,
DIRECTORY_CREATE_OBJECT
|
DIRECTORY_TRAVERSE
,
&
attr
);
...
...
@@ -1170,10 +1169,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreatePipe( HANDLE *read_pipe, HANDLE *write_pipe,
/* generate a unique pipe name (system wide) */
for
(;;)
{
static
const
WCHAR
fmtW
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
'p'
,
'i'
,
'p'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'3'
,
'2'
,
'.'
,
'P'
,
'i'
,
'p'
,
'e'
,
's'
,
'.'
,
'%'
,
'0'
,
'8'
,
'l'
,
'u'
,
'.'
,
'%'
,
'0'
,
'8'
,
'u'
,
'\0'
};
swprintf
(
name
,
ARRAY_SIZE
(
name
),
fmtW
,
GetCurrentProcessId
(),
++
index
);
swprintf
(
name
,
ARRAY_SIZE
(
name
),
L"
\\
??
\\
pipe
\\
Win32.Pipes.%08lu.%08u"
,
GetCurrentProcessId
(),
++
index
);
RtlInitUnicodeString
(
&
nt_name
,
name
);
if
(
!
NtCreateNamedPipeFile
(
read_pipe
,
GENERIC_READ
|
FILE_WRITE_ATTRIBUTES
|
SYNCHRONIZE
,
&
attr
,
&
iosb
,
FILE_SHARE_WRITE
,
FILE_OVERWRITE_IF
,
...
...
@@ -1336,7 +1333,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH TransactNamedPipe( HANDLE handle, LPVOID write_buf
*/
BOOL
WINAPI
DECLSPEC_HOTPATCH
WaitNamedPipeW
(
LPCWSTR
name
,
DWORD
timeout
)
{
static
const
WCHAR
leadin
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
'P'
,
'I'
,
'P'
,
'E'
,
'\\'
}
;
static
const
int
prefix_len
=
sizeof
(
L"
\\
??
\\
PIPE
\\
"
)
-
sizeof
(
WCHAR
)
;
NTSTATUS
status
;
UNICODE_STRING
nt_name
,
pipe_dev_name
;
FILE_PIPE_WAIT_FOR_BUFFER
*
pipe_wait
;
...
...
@@ -1350,15 +1347,15 @@ BOOL WINAPI DECLSPEC_HOTPATCH WaitNamedPipeW( LPCWSTR name, DWORD timeout )
if
(
!
RtlDosPathNameToNtPathName_U
(
name
,
&
nt_name
,
NULL
,
NULL
))
return
FALSE
;
if
(
nt_name
.
Length
>=
MAX_PATH
*
sizeof
(
WCHAR
)
||
nt_name
.
Length
<
sizeof
(
leadin
)
||
wcsnicmp
(
nt_name
.
Buffer
,
leadin
,
ARRAY_SIZE
(
leadin
))
!=
0
)
nt_name
.
Length
<
prefix_len
||
wcsnicmp
(
nt_name
.
Buffer
,
L"
\\
??
\\
PIPE
\\
"
,
prefix_len
/
sizeof
(
WCHAR
)
)
)
{
RtlFreeUnicodeString
(
&
nt_name
);
SetLastError
(
ERROR_PATH_NOT_FOUND
);
return
FALSE
;
}
wait_size
=
sizeof
(
*
pipe_wait
)
+
nt_name
.
Length
-
sizeof
(
leadin
)
-
sizeof
(
WCHAR
);
wait_size
=
offsetof
(
FILE_PIPE_WAIT_FOR_BUFFER
,
Name
[(
nt_name
.
Length
-
prefix_len
)
/
sizeof
(
WCHAR
)]
);
if
(
!
(
pipe_wait
=
HeapAlloc
(
GetProcessHeap
(),
0
,
wait_size
)))
{
RtlFreeUnicodeString
(
&
nt_name
);
...
...
@@ -1367,8 +1364,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH WaitNamedPipeW( LPCWSTR name, DWORD timeout )
}
pipe_dev_name
.
Buffer
=
nt_name
.
Buffer
;
pipe_dev_name
.
Length
=
sizeof
(
leadin
)
;
pipe_dev_name
.
MaximumLength
=
sizeof
(
leadin
)
;
pipe_dev_name
.
Length
=
prefix_len
;
pipe_dev_name
.
MaximumLength
=
prefix_len
;
InitializeObjectAttributes
(
&
attr
,
&
pipe_dev_name
,
OBJ_CASE_INSENSITIVE
,
NULL
,
NULL
);
status
=
NtOpenFile
(
&
pipe_dev
,
FILE_READ_ATTRIBUTES
|
SYNCHRONIZE
,
&
attr
,
&
iosb
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
...
...
@@ -1386,8 +1383,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH WaitNamedPipeW( LPCWSTR name, DWORD timeout )
pipe_wait
->
Timeout
.
QuadPart
=
((
ULONGLONG
)
0x7fffffff
<<
32
)
|
0xffffffff
;
else
pipe_wait
->
Timeout
.
QuadPart
=
(
ULONGLONG
)
timeout
*
-
10000
;
pipe_wait
->
NameLength
=
nt_name
.
Length
-
sizeof
(
leadin
)
;
memcpy
(
pipe_wait
->
Name
,
nt_name
.
Buffer
+
ARRAY_SIZE
(
leadin
),
pipe_wait
->
NameLength
);
pipe_wait
->
NameLength
=
nt_name
.
Length
-
prefix_len
;
memcpy
(
pipe_wait
->
Name
,
nt_name
.
Buffer
+
prefix_len
/
sizeof
(
WCHAR
),
pipe_wait
->
NameLength
);
RtlFreeUnicodeString
(
&
nt_name
);
status
=
NtFsControlFile
(
pipe_dev
,
NULL
,
NULL
,
NULL
,
&
iosb
,
FSCTL_PIPE_WAIT
,
...
...
dlls/kernelbase/version.c
View file @
762f51cf
...
...
@@ -1017,10 +1017,6 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock,
BOOL
WINAPI
VerQueryValueW
(
LPCVOID
pBlock
,
LPCWSTR
lpSubBlock
,
LPVOID
*
lplpBuffer
,
PUINT
puLen
)
{
static
const
WCHAR
rootW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
varfileinfoW
[]
=
{
'\\'
,
'V'
,
'a'
,
'r'
,
'F'
,
'i'
,
'l'
,
'e'
,
'I'
,
'n'
,
'f'
,
'o'
,
'\\'
,
'T'
,
'r'
,
'a'
,
'n'
,
's'
,
'l'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
const
VS_VERSION_INFO_STRUCT32
*
info
=
pBlock
;
TRACE
(
"(%p,%s,%p,%p)
\n
"
,
...
...
@@ -1030,7 +1026,7 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock,
return
FALSE
;
if
(
!
lpSubBlock
||
!
lpSubBlock
[
0
])
lpSubBlock
=
rootW
;
lpSubBlock
=
L"
\\
"
;
if
(
VersionInfoIs16
(
info
)
)
{
...
...
@@ -1050,7 +1046,7 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock,
HeapFree
(
GetProcessHeap
(),
0
,
lpSubBlockA
);
if
(
ret
&&
wcs
icmp
(
lpSubBlock
,
rootW
)
&&
wcsicmp
(
lpSubBlock
,
varfileinfoW
))
if
(
ret
&&
wcs
cmp
(
lpSubBlock
,
L"
\\
"
)
&&
wcsicmp
(
lpSubBlock
,
L"
\\
VarFileInfo
\\
Translation"
))
{
/* Set lpBuffer so it points to the 'empty' area where we store
* the converted strings
...
...
@@ -1219,7 +1215,6 @@ DWORD WINAPI VerFindFileA( DWORD flags, LPCSTR filename, LPCSTR win_dir, LPCSTR
DWORD
WINAPI
VerFindFileW
(
DWORD
flags
,
LPCWSTR
filename
,
LPCWSTR
win_dir
,
LPCWSTR
app_dir
,
LPWSTR
cur_dir
,
PUINT
curdir_len
,
LPWSTR
dest
,
PUINT
dest_len
)
{
static
const
WCHAR
emptyW
;
DWORD
retval
=
0
;
const
WCHAR
*
curDir
;
const
WCHAR
*
destDir
;
...
...
@@ -1231,7 +1226,7 @@ DWORD WINAPI VerFindFileW( DWORD flags, LPCWSTR filename, LPCWSTR win_dir, LPCWS
/* Figure out where the file should go; shared files default to the
system directory */
curDir
=
&
emptyW
;
curDir
=
L""
;
if
(
flags
&
VFFF_ISSHAREDFILE
)
{
...
...
@@ -1249,7 +1244,7 @@ DWORD WINAPI VerFindFileW( DWORD flags, LPCWSTR filename, LPCWSTR win_dir, LPCWS
}
else
/* not a shared file */
{
destDir
=
app_dir
?
app_dir
:
&
emptyW
;
destDir
=
app_dir
?
app_dir
:
L""
;
if
(
filename
)
{
if
(
file_existsW
(
destDir
,
filename
,
FALSE
))
curDir
=
destDir
;
...
...
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