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
cc9cfdff
Commit
cc9cfdff
authored
Sep 29, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed a few dependencies on kernel32 functions.
parent
baa15566
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
32 deletions
+47
-32
nt.c
dlls/ntdll/nt.c
+10
-5
rtl.c
dlls/ntdll/rtl.c
+15
-18
sec.c
dlls/ntdll/sec.c
+22
-9
No files found.
dlls/ntdll/nt.c
View file @
cc9cfdff
...
@@ -584,12 +584,17 @@ NTSTATUS WINAPI NtCreatePagingFile(
...
@@ -584,12 +584,17 @@ NTSTATUS WINAPI NtCreatePagingFile(
*
*
* writes a string to the nt-textmode screen eg. during startup
* writes a string to the nt-textmode screen eg. during startup
*/
*/
NTSTATUS
WINAPI
NtDisplayString
(
NTSTATUS
WINAPI
NtDisplayString
(
PUNICODE_STRING
string
)
PUNICODE_STRING
string
)
{
{
TRACE
(
"%p(%s)
\n
"
,
string
->
Buffer
,
debugstr_w
(
string
->
Buffer
));
STRING
stringA
;
WriteConsoleW
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
string
->
Buffer
,
string
->
Length
,
0
,
0
);
NTSTATUS
ret
;
return
0
;
if
(
!
(
ret
=
RtlUnicodeStringToAnsiString
(
&
stringA
,
string
,
TRUE
)))
{
MESSAGE
(
"%.*s"
,
stringA
.
Length
,
stringA
.
Buffer
);
RtlFreeAnsiString
(
&
stringA
);
}
return
ret
;
}
}
/******************************************************************************
/******************************************************************************
...
...
dlls/ntdll/rtl.c
View file @
cc9cfdff
...
@@ -41,7 +41,7 @@ void WINAPI RtlInitializeResource(LPRTL_RWLOCK rwl)
...
@@ -41,7 +41,7 @@ void WINAPI RtlInitializeResource(LPRTL_RWLOCK rwl)
rwl
->
uSharedWaiters
=
0
;
rwl
->
uSharedWaiters
=
0
;
rwl
->
hOwningThreadId
=
0
;
rwl
->
hOwningThreadId
=
0
;
rwl
->
dwTimeoutBoost
=
0
;
/* no info on this one, default value is 0 */
rwl
->
dwTimeoutBoost
=
0
;
/* no info on this one, default value is 0 */
InitializeCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
InitializeCriticalSection
(
&
rwl
->
rtlCS
);
NtCreateSemaphore
(
&
rwl
->
hExclusiveReleaseSemaphore
,
0
,
NULL
,
0
,
65535
);
NtCreateSemaphore
(
&
rwl
->
hExclusiveReleaseSemaphore
,
0
,
NULL
,
0
,
65535
);
NtCreateSemaphore
(
&
rwl
->
hSharedReleaseSemaphore
,
0
,
NULL
,
0
,
65535
);
NtCreateSemaphore
(
&
rwl
->
hSharedReleaseSemaphore
,
0
,
NULL
,
0
,
65535
);
}
}
...
@@ -55,7 +55,7 @@ void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl)
...
@@ -55,7 +55,7 @@ void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl)
{
{
if
(
rwl
)
if
(
rwl
)
{
{
EnterCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
EnterCriticalSection
(
&
rwl
->
rtlCS
);
if
(
rwl
->
iNumberActive
||
rwl
->
uExclusiveWaiters
||
rwl
->
uSharedWaiters
)
if
(
rwl
->
iNumberActive
||
rwl
->
uExclusiveWaiters
||
rwl
->
uSharedWaiters
)
MESSAGE
(
"Deleting active MRSW lock (%p), expect failure
\n
"
,
rwl
);
MESSAGE
(
"Deleting active MRSW lock (%p), expect failure
\n
"
,
rwl
);
rwl
->
hOwningThreadId
=
0
;
rwl
->
hOwningThreadId
=
0
;
...
@@ -63,8 +63,8 @@ void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl)
...
@@ -63,8 +63,8 @@ void WINAPI RtlDeleteResource(LPRTL_RWLOCK rwl)
rwl
->
iNumberActive
=
0
;
rwl
->
iNumberActive
=
0
;
NtClose
(
rwl
->
hExclusiveReleaseSemaphore
);
NtClose
(
rwl
->
hExclusiveReleaseSemaphore
);
NtClose
(
rwl
->
hSharedReleaseSemaphore
);
NtClose
(
rwl
->
hSharedReleaseSemaphore
);
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
DeleteCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
DeleteCriticalSection
(
&
rwl
->
rtlCS
);
}
}
}
}
...
@@ -78,7 +78,7 @@ BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK rwl, BYTE fWait)
...
@@ -78,7 +78,7 @@ BYTE WINAPI RtlAcquireResourceExclusive(LPRTL_RWLOCK rwl, BYTE fWait)
if
(
!
rwl
)
return
0
;
if
(
!
rwl
)
return
0
;
start:
start:
EnterCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
EnterCriticalSection
(
&
rwl
->
rtlCS
);
if
(
rwl
->
iNumberActive
==
0
)
/* lock is free */
if
(
rwl
->
iNumberActive
==
0
)
/* lock is free */
{
{
rwl
->
iNumberActive
=
-
1
;
rwl
->
iNumberActive
=
-
1
;
...
@@ -97,7 +97,7 @@ wait:
...
@@ -97,7 +97,7 @@ wait:
{
{
rwl
->
uExclusiveWaiters
++
;
rwl
->
uExclusiveWaiters
++
;
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
if
(
WaitForSingleObject
(
rwl
->
hExclusiveReleaseSemaphore
,
INFINITE
)
==
WAIT_FAILED
)
if
(
WaitForSingleObject
(
rwl
->
hExclusiveReleaseSemaphore
,
INFINITE
)
==
WAIT_FAILED
)
goto
done
;
goto
done
;
goto
start
;
/* restart the acquisition to avoid deadlocks */
goto
start
;
/* restart the acquisition to avoid deadlocks */
...
@@ -110,7 +110,7 @@ wait:
...
@@ -110,7 +110,7 @@ wait:
if
(
retVal
==
1
)
if
(
retVal
==
1
)
rwl
->
hOwningThreadId
=
GetCurrentThreadId
();
rwl
->
hOwningThreadId
=
GetCurrentThreadId
();
done:
done:
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
return
retVal
;
return
retVal
;
}
}
...
@@ -124,7 +124,7 @@ BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl, BYTE fWait)
...
@@ -124,7 +124,7 @@ BYTE WINAPI RtlAcquireResourceShared(LPRTL_RWLOCK rwl, BYTE fWait)
if
(
!
rwl
)
return
0
;
if
(
!
rwl
)
return
0
;
start:
start:
EnterCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
EnterCriticalSection
(
&
rwl
->
rtlCS
);
if
(
rwl
->
iNumberActive
<
0
)
if
(
rwl
->
iNumberActive
<
0
)
{
{
if
(
rwl
->
hOwningThreadId
==
GetCurrentThreadId
()
)
if
(
rwl
->
hOwningThreadId
==
GetCurrentThreadId
()
)
...
@@ -137,7 +137,7 @@ start:
...
@@ -137,7 +137,7 @@ start:
if
(
fWait
)
if
(
fWait
)
{
{
rwl
->
uSharedWaiters
++
;
rwl
->
uSharedWaiters
++
;
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
if
(
(
dwWait
=
WaitForSingleObject
(
rwl
->
hSharedReleaseSemaphore
,
INFINITE
))
==
WAIT_FAILED
)
if
(
(
dwWait
=
WaitForSingleObject
(
rwl
->
hSharedReleaseSemaphore
,
INFINITE
))
==
WAIT_FAILED
)
goto
done
;
goto
done
;
goto
start
;
goto
start
;
...
@@ -150,7 +150,7 @@ start:
...
@@ -150,7 +150,7 @@ start:
retVal
=
1
;
retVal
=
1
;
}
}
done:
done:
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
return
retVal
;
return
retVal
;
}
}
...
@@ -160,7 +160,7 @@ done:
...
@@ -160,7 +160,7 @@ done:
*/
*/
void
WINAPI
RtlReleaseResource
(
LPRTL_RWLOCK
rwl
)
void
WINAPI
RtlReleaseResource
(
LPRTL_RWLOCK
rwl
)
{
{
EnterCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
EnterCriticalSection
(
&
rwl
->
rtlCS
);
if
(
rwl
->
iNumberActive
>
0
)
/* have one or more readers */
if
(
rwl
->
iNumberActive
>
0
)
/* have one or more readers */
{
{
...
@@ -193,7 +193,7 @@ wake_exclusive:
...
@@ -193,7 +193,7 @@ wake_exclusive:
}
}
}
}
}
}
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
Rtl
LeaveCriticalSection
(
&
rwl
->
rtlCS
);
}
}
...
@@ -421,12 +421,9 @@ LARGE_INTEGER WINAPI RtlExtendedIntegerMultiply(
...
@@ -421,12 +421,9 @@ LARGE_INTEGER WINAPI RtlExtendedIntegerMultiply(
BOOLEAN
WINAPI
RtlDosPathNameToNtPathName_U
(
BOOLEAN
WINAPI
RtlDosPathNameToNtPathName_U
(
LPWSTR
from
,
PUNICODE_STRING
us
,
DWORD
x2
,
DWORD
x3
)
LPWSTR
from
,
PUNICODE_STRING
us
,
DWORD
x2
,
DWORD
x3
)
{
{
LPSTR
fromA
=
HEAP_strdupWtoA
(
GetProcessHeap
(),
0
,
from
);
FIXME
(
"(%s,%p,%08lx,%08lx)
\n
"
,
debugstr_w
(
from
),
us
,
x2
,
x3
);
if
(
us
)
RtlCreateUnicodeString
(
us
,
from
);
FIXME
(
"(%s,%p,%08lx,%08lx)
\n
"
,
fromA
,
us
,
x2
,
x3
);
return
TRUE
;
if
(
us
)
RtlInitUnicodeString
(
us
,
HEAP_strdupW
(
GetProcessHeap
(),
0
,
from
));
return
TRUE
;
}
}
...
...
dlls/ntdll/sec.c
View file @
cc9cfdff
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include <math.h>
#include <math.h>
#include "windef.h"
#include "windef.h"
#include "winbase.h"
#include "winbase.h"
#include "wine/exception.h"
#include "wine/winestring.h"
#include "wine/winestring.h"
#include "file.h"
#include "file.h"
#include "heap.h"
#include "heap.h"
...
@@ -27,6 +28,14 @@ DEFAULT_DEBUG_CHANNEL(ntdll);
...
@@ -27,6 +28,14 @@ DEFAULT_DEBUG_CHANNEL(ntdll);
#define NT_SUCCESS(status) (status == STATUS_SUCCESS)
#define NT_SUCCESS(status) (status == STATUS_SUCCESS)
/* filter for page-fault exceptions */
static
WINE_EXCEPTION_FILTER
(
page_fault
)
{
if
(
GetExceptionCode
()
==
EXCEPTION_ACCESS_VIOLATION
)
return
EXCEPTION_EXECUTE_HANDLER
;
return
EXCEPTION_CONTINUE_SEARCH
;
}
/*
/*
* SID FUNCTIONS
* SID FUNCTIONS
*/
*/
...
@@ -226,19 +235,23 @@ DWORD WINAPI RtlCopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID
...
@@ -226,19 +235,23 @@ DWORD WINAPI RtlCopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID
BOOL
WINAPI
BOOL
WINAPI
RtlValidSid
(
PSID
pSid
)
RtlValidSid
(
PSID
pSid
)
{
{
if
(
IsBadReadPtr
(
pSid
,
4
))
BOOL
ret
;
__TRY
{
ret
=
TRUE
;
if
(
!
pSid
||
pSid
->
Revision
!=
SID_REVISION
||
pSid
->
SubAuthorityCount
>
SID_MAX_SUB_AUTHORITIES
)
{
ret
=
FALSE
;
}
}
__EXCEPT
(
page_fault
)
{
{
WARN
(
"(%p): invalid pointer!
\n
"
,
pSid
);
WARN
(
"(%p): invalid pointer!
\n
"
,
pSid
);
return
FALSE
;
return
FALSE
;
}
}
__ENDTRY
if
(
pSid
->
SubAuthorityCount
>
SID_MAX_SUB_AUTHORITIES
)
return
ret
;
return
FALSE
;
if
(
!
pSid
||
pSid
->
Revision
!=
SID_REVISION
)
return
FALSE
;
return
TRUE
;
}
}
...
...
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