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
0eae5d3a
Commit
0eae5d3a
authored
Jul 17, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move the atom system calls to the Unix library.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
76e48978
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
190 additions
and
151 deletions
+190
-151
atom.c
dlls/ntdll/atom.c
+0
-143
ntdll.spec
dlls/ntdll/ntdll.spec
+8
-8
sync.c
dlls/ntdll/unix/sync.c
+182
-0
No files found.
dlls/ntdll/atom.c
View file @
0eae5d3a
...
...
@@ -300,146 +300,3 @@ NTSTATUS WINAPI RtlPinAtomInAtomTable( RTL_ATOM_TABLE table, RTL_ATOM atom )
return
status
;
}
/*************************************************
* Global handle table management
*************************************************/
/******************************************************************
* NtAddAtom (NTDLL.@)
*/
NTSTATUS
WINAPI
NtAddAtom
(
const
WCHAR
*
name
,
ULONG
length
,
RTL_ATOM
*
atom
)
{
NTSTATUS
status
;
status
=
is_integral_atom
(
name
,
length
/
sizeof
(
WCHAR
),
atom
);
if
(
status
==
STATUS_MORE_ENTRIES
)
{
SERVER_START_REQ
(
add_atom
)
{
wine_server_add_data
(
req
,
name
,
length
);
req
->
table
=
0
;
status
=
wine_server_call
(
req
);
*
atom
=
reply
->
atom
;
}
SERVER_END_REQ
;
}
TRACE
(
"%s -> %x
\n
"
,
debugstr_wn
(
name
,
length
/
sizeof
(
WCHAR
)),
status
==
STATUS_SUCCESS
?
*
atom
:
0
);
return
status
;
}
/******************************************************************
* NtDeleteAtom (NTDLL.@)
*/
NTSTATUS
WINAPI
NtDeleteAtom
(
RTL_ATOM
atom
)
{
NTSTATUS
status
;
SERVER_START_REQ
(
delete_atom
)
{
req
->
atom
=
atom
;
req
->
table
=
0
;
status
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
return
status
;
}
/******************************************************************
* NtFindAtom (NTDLL.@)
*/
NTSTATUS
WINAPI
NtFindAtom
(
const
WCHAR
*
name
,
ULONG
length
,
RTL_ATOM
*
atom
)
{
NTSTATUS
status
;
status
=
is_integral_atom
(
name
,
length
/
sizeof
(
WCHAR
),
atom
);
if
(
status
==
STATUS_MORE_ENTRIES
)
{
SERVER_START_REQ
(
find_atom
)
{
wine_server_add_data
(
req
,
name
,
length
);
req
->
table
=
0
;
status
=
wine_server_call
(
req
);
*
atom
=
reply
->
atom
;
}
SERVER_END_REQ
;
}
TRACE
(
"%s -> %x
\n
"
,
debugstr_wn
(
name
,
length
/
sizeof
(
WCHAR
)),
status
==
STATUS_SUCCESS
?
*
atom
:
0
);
return
status
;
}
/******************************************************************
* NtQueryInformationAtom (NTDLL.@)
*/
NTSTATUS
WINAPI
NtQueryInformationAtom
(
RTL_ATOM
atom
,
ATOM_INFORMATION_CLASS
class
,
PVOID
ptr
,
ULONG
size
,
PULONG
psize
)
{
NTSTATUS
status
;
switch
(
class
)
{
case
AtomBasicInformation
:
{
ULONG
name_len
;
ATOM_BASIC_INFORMATION
*
abi
=
ptr
;
if
(
size
<
sizeof
(
ATOM_BASIC_INFORMATION
))
return
STATUS_INVALID_PARAMETER
;
name_len
=
size
-
sizeof
(
ATOM_BASIC_INFORMATION
);
if
(
atom
<
MAXINTATOM
)
{
if
(
atom
)
{
abi
->
NameLength
=
integral_atom_name
(
abi
->
Name
,
name_len
,
atom
);
status
=
(
name_len
)
?
STATUS_SUCCESS
:
STATUS_BUFFER_TOO_SMALL
;
abi
->
ReferenceCount
=
1
;
abi
->
Pinned
=
1
;
}
else
status
=
STATUS_INVALID_PARAMETER
;
}
else
{
SERVER_START_REQ
(
get_atom_information
)
{
req
->
atom
=
atom
;
req
->
table
=
0
;
if
(
name_len
)
wine_server_set_reply
(
req
,
abi
->
Name
,
name_len
);
status
=
wine_server_call
(
req
);
if
(
status
==
STATUS_SUCCESS
)
{
name_len
=
wine_server_reply_size
(
reply
);
if
(
name_len
)
{
abi
->
NameLength
=
name_len
;
abi
->
Name
[
name_len
/
sizeof
(
WCHAR
)]
=
'\0'
;
}
else
{
name_len
=
reply
->
total
;
abi
->
NameLength
=
name_len
;
status
=
STATUS_BUFFER_TOO_SMALL
;
}
abi
->
ReferenceCount
=
reply
->
count
;
abi
->
Pinned
=
reply
->
pinned
;
}
else
name_len
=
0
;
}
SERVER_END_REQ
;
}
TRACE
(
"%x -> %s (%u)
\n
"
,
atom
,
debugstr_wn
(
abi
->
Name
,
abi
->
NameLength
/
sizeof
(
WCHAR
)),
status
);
if
(
psize
)
*
psize
=
sizeof
(
ATOM_BASIC_INFORMATION
)
+
name_len
;
}
break
;
default:
FIXME
(
"Unsupported class %u
\n
"
,
class
);
status
=
STATUS_INVALID_INFO_CLASS
;
break
;
}
return
status
;
}
dlls/ntdll/ntdll.spec
View file @
0eae5d3a
...
...
@@ -131,7 +131,7 @@
# @ stub NtAccessCheckByTypeResultList
# @ stub NtAccessCheckByTypeResultListAndAuditAlarm
# @ stub NtAccessCheckByTypeResultListAndAuditAlarmByHandle
@ stdcall NtAddAtom(ptr long ptr)
@ stdcall
-syscall
NtAddAtom(ptr long ptr)
# @ stub NtAddBootEntry
@ stdcall NtAdjustGroupsToken(long long ptr long ptr ptr)
@ stdcall NtAdjustPrivilegesToken(long long ptr long ptr ptr)
...
...
@@ -192,7 +192,7 @@
# @ stub NtDebugActiveProcess
# @ stub NtDebugContinue
@ stdcall -syscall NtDelayExecution(long ptr)
@ stdcall NtDeleteAtom(long)
@ stdcall
-syscall
NtDeleteAtom(long)
# @ stub NtDeleteBootEntry
@ stdcall -syscall NtDeleteFile(ptr)
@ stdcall -syscall NtDeleteKey(long)
...
...
@@ -209,7 +209,7 @@
@ stdcall -syscall NtEnumerateValueKey(long long long ptr long ptr)
@ stub NtExtendSection
# @ stub NtFilterToken
@ stdcall NtFindAtom(ptr long ptr)
@ stdcall
-syscall
NtFindAtom(ptr long ptr)
@ stdcall -syscall NtFlushBuffersFile(long ptr)
@ stdcall -syscall NtFlushInstructionCache(long ptr long)
@ stdcall -syscall NtFlushKey(long)
...
...
@@ -291,7 +291,7 @@
@ stdcall -syscall NtQueryEaFile(long ptr ptr long long ptr long ptr long)
@ stdcall -syscall NtQueryEvent(long long ptr long ptr)
@ stdcall -syscall NtQueryFullAttributesFile(ptr ptr)
@ stdcall NtQueryInformationAtom(long long ptr long ptr)
@ stdcall
-syscall
NtQueryInformationAtom(long long ptr long ptr)
@ stdcall -syscall NtQueryInformationFile(long ptr ptr long long)
@ stdcall -syscall NtQueryInformationJobObject(long long ptr long ptr)
@ stub NtQueryInformationPort
...
...
@@ -1120,7 +1120,7 @@
# @ stub ZwAccessCheckByTypeResultList
# @ stub ZwAccessCheckByTypeResultListAndAuditAlarm
# @ stub ZwAccessCheckByTypeResultListAndAuditAlarmByHandle
@ stdcall -private ZwAddAtom(ptr long ptr) NtAddAtom
@ stdcall -private
-syscall
ZwAddAtom(ptr long ptr) NtAddAtom
# @ stub ZwAddBootEntry
@ stdcall -private ZwAdjustGroupsToken(long long ptr long ptr ptr) NtAdjustGroupsToken
@ stdcall -private ZwAdjustPrivilegesToken(long long ptr long ptr ptr) NtAdjustPrivilegesToken
...
...
@@ -1179,7 +1179,7 @@
# @ stub ZwDebugActiveProcess
# @ stub ZwDebugContinue
@ stdcall -private -syscall ZwDelayExecution(long ptr) NtDelayExecution
@ stdcall -private ZwDeleteAtom(long) NtDeleteAtom
@ stdcall -private
-syscall
ZwDeleteAtom(long) NtDeleteAtom
# @ stub ZwDeleteBootEntry
@ stdcall -private -syscall ZwDeleteFile(ptr) NtDeleteFile
@ stdcall -private -syscall ZwDeleteKey(long) NtDeleteKey
...
...
@@ -1196,7 +1196,7 @@
@ stdcall -private -syscall ZwEnumerateValueKey(long long long ptr long ptr) NtEnumerateValueKey
@ stub ZwExtendSection
# @ stub ZwFilterToken
@ stdcall -private ZwFindAtom(ptr long ptr) NtFindAtom
@ stdcall -private
-syscall
ZwFindAtom(ptr long ptr) NtFindAtom
@ stdcall -private -syscall ZwFlushBuffersFile(long ptr) NtFlushBuffersFile
@ stdcall -private -syscall ZwFlushInstructionCache(long ptr long) NtFlushInstructionCache
@ stdcall -private -syscall ZwFlushKey(long) NtFlushKey
...
...
@@ -1278,7 +1278,7 @@
@ stdcall -private -syscall ZwQueryEaFile(long ptr ptr long long ptr long ptr long) NtQueryEaFile
@ stdcall -private -syscall ZwQueryEvent(long long ptr long ptr) NtQueryEvent
@ stdcall -private -syscall ZwQueryFullAttributesFile(ptr ptr) NtQueryFullAttributesFile
@ stdcall -private ZwQueryInformationAtom(long long ptr long ptr) NtQueryInformationAtom
@ stdcall -private
-syscall
ZwQueryInformationAtom(long long ptr long ptr) NtQueryInformationAtom
@ stdcall -private -syscall ZwQueryInformationFile(long ptr ptr long long) NtQueryInformationFile
@ stdcall -private -syscall ZwQueryInformationJobObject(long long ptr long ptr) NtQueryInformationJobObject
@ stub ZwQueryInformationPort
...
...
dlls/ntdll/unix/sync.c
View file @
0eae5d3a
...
...
@@ -1804,6 +1804,188 @@ NTSTATUS WINAPI NtOpenSection( HANDLE *handle, ACCESS_MASK access, const OBJECT_
}
#define MAX_ATOM_LEN 255
#define IS_INTATOM(x) (((ULONG_PTR)(x) >> 16) == 0)
static
NTSTATUS
is_integral_atom
(
const
WCHAR
*
atomstr
,
ULONG
len
,
RTL_ATOM
*
ret_atom
)
{
RTL_ATOM
atom
;
if
((
ULONG_PTR
)
atomstr
>>
16
)
{
const
WCHAR
*
ptr
=
atomstr
;
if
(
!
len
)
return
STATUS_OBJECT_NAME_INVALID
;
if
(
*
ptr
++
==
'#'
)
{
atom
=
0
;
while
(
ptr
<
atomstr
+
len
&&
*
ptr
>=
'0'
&&
*
ptr
<=
'9'
)
{
atom
=
atom
*
10
+
*
ptr
++
-
'0'
;
}
if
(
ptr
>
atomstr
+
1
&&
ptr
==
atomstr
+
len
)
goto
done
;
}
if
(
len
>
MAX_ATOM_LEN
)
return
STATUS_INVALID_PARAMETER
;
return
STATUS_MORE_ENTRIES
;
}
else
atom
=
LOWORD
(
atomstr
);
done:
if
(
!
atom
||
atom
>=
MAXINTATOM
)
return
STATUS_INVALID_PARAMETER
;
*
ret_atom
=
atom
;
return
STATUS_SUCCESS
;
}
static
ULONG
integral_atom_name
(
WCHAR
*
buffer
,
ULONG
len
,
RTL_ATOM
atom
)
{
char
tmp
[
16
];
int
ret
=
sprintf
(
tmp
,
"#%u"
,
atom
);
len
/=
sizeof
(
WCHAR
);
if
(
len
)
{
if
(
len
<=
ret
)
ret
=
len
-
1
;
ascii_to_unicode
(
buffer
,
tmp
,
ret
);
buffer
[
ret
]
=
0
;
}
return
ret
*
sizeof
(
WCHAR
);
}
/***********************************************************************
* NtAddAtom (NTDLL.@)
*/
NTSTATUS
WINAPI
NtAddAtom
(
const
WCHAR
*
name
,
ULONG
length
,
RTL_ATOM
*
atom
)
{
NTSTATUS
status
=
is_integral_atom
(
name
,
length
/
sizeof
(
WCHAR
),
atom
);
if
(
status
==
STATUS_MORE_ENTRIES
)
{
SERVER_START_REQ
(
add_atom
)
{
wine_server_add_data
(
req
,
name
,
length
);
req
->
table
=
0
;
status
=
wine_server_call
(
req
);
*
atom
=
reply
->
atom
;
}
SERVER_END_REQ
;
}
TRACE
(
"%s -> %x
\n
"
,
debugstr_wn
(
name
,
length
/
sizeof
(
WCHAR
)),
status
==
STATUS_SUCCESS
?
*
atom
:
0
);
return
status
;
}
/***********************************************************************
* NtDeleteAtom (NTDLL.@)
*/
NTSTATUS
WINAPI
NtDeleteAtom
(
RTL_ATOM
atom
)
{
NTSTATUS
status
;
SERVER_START_REQ
(
delete_atom
)
{
req
->
atom
=
atom
;
req
->
table
=
0
;
status
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
return
status
;
}
/***********************************************************************
* NtFindAtom (NTDLL.@)
*/
NTSTATUS
WINAPI
NtFindAtom
(
const
WCHAR
*
name
,
ULONG
length
,
RTL_ATOM
*
atom
)
{
NTSTATUS
status
=
is_integral_atom
(
name
,
length
/
sizeof
(
WCHAR
),
atom
);
if
(
status
==
STATUS_MORE_ENTRIES
)
{
SERVER_START_REQ
(
find_atom
)
{
wine_server_add_data
(
req
,
name
,
length
);
req
->
table
=
0
;
status
=
wine_server_call
(
req
);
*
atom
=
reply
->
atom
;
}
SERVER_END_REQ
;
}
TRACE
(
"%s -> %x
\n
"
,
debugstr_wn
(
name
,
length
/
sizeof
(
WCHAR
)),
status
==
STATUS_SUCCESS
?
*
atom
:
0
);
return
status
;
}
/***********************************************************************
* NtQueryInformationAtom (NTDLL.@)
*/
NTSTATUS
WINAPI
NtQueryInformationAtom
(
RTL_ATOM
atom
,
ATOM_INFORMATION_CLASS
class
,
void
*
ptr
,
ULONG
size
,
ULONG
*
retsize
)
{
NTSTATUS
status
;
switch
(
class
)
{
case
AtomBasicInformation
:
{
ULONG
name_len
;
ATOM_BASIC_INFORMATION
*
abi
=
ptr
;
if
(
size
<
sizeof
(
ATOM_BASIC_INFORMATION
))
return
STATUS_INVALID_PARAMETER
;
name_len
=
size
-
sizeof
(
ATOM_BASIC_INFORMATION
);
if
(
atom
<
MAXINTATOM
)
{
if
(
atom
)
{
abi
->
NameLength
=
integral_atom_name
(
abi
->
Name
,
name_len
,
atom
);
status
=
name_len
?
STATUS_SUCCESS
:
STATUS_BUFFER_TOO_SMALL
;
abi
->
ReferenceCount
=
1
;
abi
->
Pinned
=
1
;
}
else
status
=
STATUS_INVALID_PARAMETER
;
}
else
{
SERVER_START_REQ
(
get_atom_information
)
{
req
->
atom
=
atom
;
if
(
name_len
)
wine_server_set_reply
(
req
,
abi
->
Name
,
name_len
);
status
=
wine_server_call
(
req
);
if
(
status
==
STATUS_SUCCESS
)
{
name_len
=
wine_server_reply_size
(
reply
);
if
(
name_len
)
{
abi
->
NameLength
=
name_len
;
abi
->
Name
[
name_len
/
sizeof
(
WCHAR
)]
=
0
;
}
else
{
name_len
=
reply
->
total
;
abi
->
NameLength
=
name_len
;
status
=
STATUS_BUFFER_TOO_SMALL
;
}
abi
->
ReferenceCount
=
reply
->
count
;
abi
->
Pinned
=
reply
->
pinned
;
}
else
name_len
=
0
;
}
SERVER_END_REQ
;
}
TRACE
(
"%x -> %s (%u)
\n
"
,
atom
,
debugstr_wn
(
abi
->
Name
,
abi
->
NameLength
/
sizeof
(
WCHAR
)),
status
);
if
(
retsize
)
*
retsize
=
sizeof
(
ATOM_BASIC_INFORMATION
)
+
name_len
;
break
;
}
default:
FIXME
(
"Unsupported class %u
\n
"
,
class
);
status
=
STATUS_INVALID_INFO_CLASS
;
break
;
}
return
status
;
}
static
void
*
no_debug_info_marker
=
(
void
*
)(
ULONG_PTR
)
-
1
;
static
BOOL
crit_section_has_debuginfo
(
const
RTL_CRITICAL_SECTION
*
crit
)
...
...
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