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
64f6fdc5
Commit
64f6fdc5
authored
Jul 19, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Move activation context creation to ntdll (based on a patch by Eric Pouech).
parent
44c9758d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
154 additions
and
74 deletions
+154
-74
actctx.c
dlls/kernel32/actctx.c
+9
-70
Makefile.in
dlls/ntdll/Makefile.in
+1
-0
actctx.c
dlls/ntdll/actctx.c
+137
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+3
-3
winternl.h
include/winternl.h
+4
-1
No files found.
dlls/kernel32/actctx.c
View file @
64f6fdc5
...
...
@@ -28,32 +28,15 @@
#include "winbase.h"
#include "winerror.h"
#include "winnls.h"
#include "winternl.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
actctx
);
#define ACTCTX_FLAGS_ALL (\
ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID |\
ACTCTX_FLAG_LANGID_VALID |\
ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID |\
ACTCTX_FLAG_RESOURCE_NAME_VALID |\
ACTCTX_FLAG_SET_PROCESS_DEFAULT |\
ACTCTX_FLAG_APPLICATION_NAME_VALID |\
ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF |\
ACTCTX_FLAG_HMODULE_VALID )
#define ACTCTX_FAKE_HANDLE ((HANDLE) 0xf00baa)
#define ACTCTX_FAKE_COOKIE ((ULONG_PTR) 0xf00bad)
#define ACTCTX_MAGIC 0xC07E3E11
struct
actctx
{
ULONG
magic
;
LONG
ref_count
;
};
/***********************************************************************
* CreateActCtxA (KERNEL32.@)
*
...
...
@@ -68,8 +51,7 @@ HANDLE WINAPI CreateActCtxA(PCACTCTXA pActCtx)
TRACE
(
"%p %08x
\n
"
,
pActCtx
,
pActCtx
?
pActCtx
->
dwFlags
:
0
);
if
(
!
pActCtx
||
pActCtx
->
cbSize
!=
sizeof
(
*
pActCtx
)
||
(
pActCtx
->
dwFlags
&
~
ACTCTX_FLAGS_ALL
))
if
(
!
pActCtx
||
pActCtx
->
cbSize
!=
sizeof
(
*
pActCtx
))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
INVALID_HANDLE_VALUE
;
...
...
@@ -138,44 +120,17 @@ done:
*/
HANDLE
WINAPI
CreateActCtxW
(
PCACTCTXW
pActCtx
)
{
struct
actctx
*
actctx
;
DWORD
ret
=
ERROR_SUCCESS
;
NTSTATUS
status
;
HANDLE
hActCtx
;
TRACE
(
"%p %08x
\n
"
,
pActCtx
,
pActCtx
?
pActCtx
->
dwFlags
:
0
);
if
(
!
pActCtx
||
pActCtx
->
cbSize
!=
sizeof
(
*
pActCtx
)
||
(
pActCtx
->
dwFlags
&
~
ACTCTX_FLAGS_ALL
))
if
((
status
=
RtlCreateActivationContext
(
&
hActCtx
,
pActCtx
)))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
SetLastError
(
RtlNtStatusToDosError
(
status
)
);
return
INVALID_HANDLE_VALUE
;
}
actctx
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
actctx
));
if
(
!
actctx
)
return
INVALID_HANDLE_VALUE
;
actctx
->
magic
=
ACTCTX_MAGIC
;
actctx
->
ref_count
=
1
;
if
(
ret
==
ERROR_SUCCESS
)
{
return
(
HANDLE
)
actctx
;
}
ReleaseActCtx
((
HANDLE
)
actctx
);
SetLastError
(
ret
);
return
INVALID_HANDLE_VALUE
;
}
static
struct
actctx
*
check_actctx
(
HANDLE
h
)
{
struct
actctx
*
actctx
=
(
struct
actctx
*
)
h
;
switch
(
actctx
->
magic
)
{
case
ACTCTX_MAGIC
:
return
actctx
;
default:
SetLastError
(
ERROR_INVALID_HANDLE
);
return
NULL
;
}
return
hActCtx
;
}
/***********************************************************************
...
...
@@ -241,12 +196,7 @@ BOOL WINAPI GetCurrentActCtx(HANDLE* phActCtx)
*/
void
WINAPI
AddRefActCtx
(
HANDLE
hActCtx
)
{
struct
actctx
*
actctx
;
TRACE
(
"%p
\n
"
,
hActCtx
);
if
((
actctx
=
check_actctx
(
hActCtx
)))
InterlockedIncrement
(
&
actctx
->
ref_count
);
RtlAddRefActivationContext
(
hActCtx
);
}
/***********************************************************************
...
...
@@ -256,18 +206,7 @@ void WINAPI AddRefActCtx(HANDLE hActCtx)
*/
void
WINAPI
ReleaseActCtx
(
HANDLE
hActCtx
)
{
struct
actctx
*
actctx
;
TRACE
(
"%p
\n
"
,
hActCtx
);
if
((
actctx
=
check_actctx
(
hActCtx
)))
{
if
(
!
InterlockedDecrement
(
&
actctx
->
ref_count
))
{
actctx
->
magic
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
actctx
);
}
}
RtlReleaseActivationContext
(
hActCtx
);
}
/***********************************************************************
...
...
dlls/ntdll/Makefile.in
View file @
64f6fdc5
...
...
@@ -9,6 +9,7 @@ EXTRALIBS = @IOKITLIB@
BASEADDRESS
=
0x7bc00000
C_SRCS
=
\
actctx.c
\
atom.c
\
cdrom.c
\
critsection.c
\
...
...
dlls/ntdll/actctx.c
0 → 100644
View file @
64f6fdc5
/*
* Activation contexts
*
* Copyright 2004 Jon Griffiths
* Copyright 2007 Eric Pouech
* Copyright 2007 Jacek Caban for CodeWeavers
* Copyright 2007 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "winternl.h"
#include "ntdll_misc.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
actctx
);
#define ACTCTX_FLAGS_ALL (\
ACTCTX_FLAG_PROCESSOR_ARCHITECTURE_VALID |\
ACTCTX_FLAG_LANGID_VALID |\
ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID |\
ACTCTX_FLAG_RESOURCE_NAME_VALID |\
ACTCTX_FLAG_SET_PROCESS_DEFAULT |\
ACTCTX_FLAG_APPLICATION_NAME_VALID |\
ACTCTX_FLAG_SOURCE_IS_ASSEMBLYREF |\
ACTCTX_FLAG_HMODULE_VALID )
#define ACTCTX_MAGIC 0xC07E3E11
typedef
struct
_ACTIVATION_CONTEXT
{
ULONG
magic
;
int
ref_count
;
}
ACTIVATION_CONTEXT
;
static
ACTIVATION_CONTEXT
*
check_actctx
(
HANDLE
h
)
{
ACTIVATION_CONTEXT
*
actctx
=
h
;
if
(
!
h
||
h
==
INVALID_HANDLE_VALUE
)
return
NULL
;
switch
(
actctx
->
magic
)
{
case
ACTCTX_MAGIC
:
return
actctx
;
default:
return
NULL
;
}
}
static
inline
void
actctx_addref
(
ACTIVATION_CONTEXT
*
actctx
)
{
interlocked_xchg_add
(
&
actctx
->
ref_count
,
1
);
}
static
void
actctx_release
(
ACTIVATION_CONTEXT
*
actctx
)
{
if
(
interlocked_xchg_add
(
&
actctx
->
ref_count
,
-
1
)
==
1
)
{
actctx
->
magic
=
0
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
actctx
);
}
}
/***********************************************************************
* RtlCreateActivationContext (NTDLL.@)
*
* Create an activation context.
*
* FIXME: function signature/prototype is wrong
*/
NTSTATUS
WINAPI
RtlCreateActivationContext
(
HANDLE
*
handle
,
const
void
*
ptr
)
{
const
ACTCTXW
*
pActCtx
=
ptr
;
/* FIXME: not the right structure */
ACTIVATION_CONTEXT
*
actctx
;
TRACE
(
"%p %08x
\n
"
,
pActCtx
,
pActCtx
?
pActCtx
->
dwFlags
:
0
);
if
(
!
pActCtx
||
pActCtx
->
cbSize
!=
sizeof
(
*
pActCtx
)
||
(
pActCtx
->
dwFlags
&
~
ACTCTX_FLAGS_ALL
))
return
STATUS_INVALID_PARAMETER
;
if
(
!
(
actctx
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
actctx
)
)))
return
STATUS_NO_MEMORY
;
actctx
->
magic
=
ACTCTX_MAGIC
;
actctx
->
ref_count
=
1
;
*
handle
=
actctx
;
return
STATUS_SUCCESS
;
}
/***********************************************************************
* RtlAddRefActivationContext (NTDLL.@)
*/
void
WINAPI
RtlAddRefActivationContext
(
HANDLE
handle
)
{
ACTIVATION_CONTEXT
*
actctx
;
if
((
actctx
=
check_actctx
(
handle
)))
actctx_addref
(
actctx
);
}
/******************************************************************
* RtlReleaseActivationContext (NTDLL.@)
*/
void
WINAPI
RtlReleaseActivationContext
(
HANDLE
handle
)
{
ACTIVATION_CONTEXT
*
actctx
;
if
((
actctx
=
check_actctx
(
handle
)))
actctx_release
(
actctx
);
}
dlls/ntdll/ntdll.spec
View file @
64f6fdc5
...
...
@@ -407,7 +407,7 @@
# @ stub RtlAddAuditAccessObjectAce
# @ stub RtlAddCompoundAce
# @ stub RtlAddRange
# @ stub RtlAddRefActivationContext
@ stdcall RtlAddRefActivationContext(ptr)
# @ stub RtlAddRefMemoryStream
@ stdcall RtlAddVectoredExceptionHandler(long ptr)
# @ stub RtlAddressInSectionTable
...
...
@@ -475,7 +475,7 @@
@ stdcall RtlCopyString(ptr ptr)
@ stdcall RtlCopyUnicodeString(ptr ptr)
@ stdcall RtlCreateAcl(ptr long long)
# @ stub RtlCreateActivationContext
@ stdcall RtlCreateActivationContext(ptr ptr)
@ stub RtlCreateAndSetSD
@ stdcall RtlCreateAtomTable(long ptr)
# @ stub RtlCreateBootStatusDataFile
...
...
@@ -794,7 +794,7 @@
@ stub RtlRealSuccessor
@ stub RtlRegisterSecureMemoryCacheCallback
@ stub RtlRegisterWait
@ st
ub RtlReleaseActivationContext
@ st
dcall RtlReleaseActivationContext(ptr)
@ stub RtlReleaseMemoryStream
@ stdcall RtlReleasePebLock()
@ stdcall RtlReleaseResource(ptr)
...
...
include/winternl.h
View file @
64f6fdc5
...
...
@@ -1985,7 +1985,8 @@ NTSTATUS WINAPI RtlAddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID);
NTSTATUS
WINAPI
RtlAddAccessDeniedAce
(
PACL
,
DWORD
,
DWORD
,
PSID
);
NTSTATUS
WINAPI
RtlAddAccessDeniedAceEx
(
PACL
,
DWORD
,
DWORD
,
DWORD
,
PSID
);
NTSTATUS
WINAPI
RtlAddAtomToAtomTable
(
RTL_ATOM_TABLE
,
const
WCHAR
*
,
RTL_ATOM
*
);
NTSTATUS
WINAPI
RtlAddAuditAccessAce
(
PACL
,
DWORD
,
DWORD
,
PSID
,
BOOL
,
BOOL
);
NTSTATUS
WINAPI
RtlAddAuditAccessAce
(
PACL
,
DWORD
,
DWORD
,
PSID
,
BOOL
,
BOOL
);
void
WINAPI
RtlAddRefActivationContext
(
HANDLE
);
PVOID
WINAPI
RtlAddVectoredExceptionHandler
(
ULONG
,
PVECTORED_EXCEPTION_HANDLER
);
NTSTATUS
WINAPI
RtlAdjustPrivilege
(
ULONG
,
BOOLEAN
,
BOOLEAN
,
PBOOLEAN
);
NTSTATUS
WINAPI
RtlAllocateAndInitializeSid
(
PSID_IDENTIFIER_AUTHORITY
,
BYTE
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
PSID
*
);
...
...
@@ -2007,6 +2008,7 @@ NTSTATUS WINAPI RtlCharToInteger(PCSZ,ULONG,PULONG);
NTSTATUS
WINAPI
RtlCheckRegistryKey
(
ULONG
,
PWSTR
);
void
WINAPI
RtlClearAllBits
(
PRTL_BITMAP
);
void
WINAPI
RtlClearBits
(
PRTL_BITMAP
,
ULONG
,
ULONG
);
NTSTATUS
WINAPI
RtlCreateActivationContext
(
HANDLE
*
,
const
void
*
);
PDEBUG_BUFFER
WINAPI
RtlCreateQueryDebugBuffer
(
ULONG
,
BOOLEAN
);
ULONG
WINAPI
RtlCompactHeap
(
HANDLE
,
ULONG
);
LONG
WINAPI
RtlCompareString
(
const
STRING
*
,
const
STRING
*
,
BOOLEAN
);
...
...
@@ -2196,6 +2198,7 @@ void WINAPI RtlRaiseException(PEXCEPTION_RECORD);
void
WINAPI
RtlRaiseStatus
(
NTSTATUS
);
ULONG
WINAPI
RtlRandom
(
PULONG
);
PVOID
WINAPI
RtlReAllocateHeap
(
HANDLE
,
ULONG
,
PVOID
,
SIZE_T
);
void
WINAPI
RtlReleaseActivationContext
(
HANDLE
);
void
WINAPI
RtlReleasePebLock
(
void
);
void
WINAPI
RtlReleaseResource
(
LPRTL_RWLOCK
);
ULONG
WINAPI
RtlRemoveVectoredExceptionHandler
(
PVOID
);
...
...
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