kernel32: Move activation context functions to kernelbase.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-07-02 16:07:20 +02:00
parent 5129c45982
commit 5b5c5df676
4 changed files with 152 additions and 208 deletions

View File

@ -109,108 +109,6 @@ done:
return ret;
}
/***********************************************************************
* CreateActCtxW (KERNEL32.@)
*
* Create an activation context.
*/
HANDLE WINAPI DECLSPEC_HOTPATCH CreateActCtxW(PCACTCTXW pActCtx)
{
NTSTATUS status;
HANDLE hActCtx;
TRACE("%p %08x\n", pActCtx, pActCtx ? pActCtx->dwFlags : 0);
if ((status = RtlCreateActivationContext(&hActCtx, pActCtx)))
{
SetLastError(RtlNtStatusToDosError(status));
return INVALID_HANDLE_VALUE;
}
return hActCtx;
}
/***********************************************************************
* ActivateActCtx (KERNEL32.@)
*
* Activate an activation context.
*/
BOOL WINAPI ActivateActCtx(HANDLE hActCtx, ULONG_PTR *ulCookie)
{
NTSTATUS status;
if ((status = RtlActivateActivationContext( 0, hActCtx, ulCookie )))
{
SetLastError(RtlNtStatusToDosError(status));
return FALSE;
}
return TRUE;
}
/***********************************************************************
* DeactivateActCtx (KERNEL32.@)
*
* Deactivate an activation context.
*/
BOOL WINAPI DeactivateActCtx(DWORD dwFlags, ULONG_PTR ulCookie)
{
RtlDeactivateActivationContext( dwFlags, ulCookie );
return TRUE;
}
/***********************************************************************
* GetCurrentActCtx (KERNEL32.@)
*
* Get the current activation context.
*/
BOOL WINAPI GetCurrentActCtx(HANDLE* phActCtx)
{
NTSTATUS status;
if ((status = RtlGetActiveActivationContext(phActCtx)))
{
SetLastError(RtlNtStatusToDosError(status));
return FALSE;
}
return TRUE;
}
/***********************************************************************
* AddRefActCtx (KERNEL32.@)
*
* Add a reference to an activation context.
*/
void WINAPI AddRefActCtx(HANDLE hActCtx)
{
RtlAddRefActivationContext(hActCtx);
}
/***********************************************************************
* ReleaseActCtx (KERNEL32.@)
*
* Release a reference to an activation context.
*/
void WINAPI ReleaseActCtx(HANDLE hActCtx)
{
RtlReleaseActivationContext(hActCtx);
}
/***********************************************************************
* ZombifyActCtx (KERNEL32.@)
*
* Deactivate context without releasing it.
*/
BOOL WINAPI ZombifyActCtx(HANDLE hActCtx)
{
NTSTATUS status;
if ((status = RtlZombifyActivationContext(hActCtx)))
{
SetLastError(RtlNtStatusToDosError(status));
return FALSE;
}
return TRUE;
}
/***********************************************************************
* FindActCtxSectionStringA (KERNEL32.@)
*
@ -242,87 +140,3 @@ BOOL WINAPI FindActCtxSectionStringA(DWORD dwFlags, const GUID* lpExtGuid,
HeapFree(GetProcessHeap(), 0, search_str);
return ret;
}
/***********************************************************************
* FindActCtxSectionStringW (KERNEL32.@)
*
* Find information about a string in an activation context.
*/
BOOL WINAPI FindActCtxSectionStringW(DWORD dwFlags, const GUID* lpExtGuid,
ULONG ulId, LPCWSTR lpSearchStr,
PACTCTX_SECTION_KEYED_DATA pInfo)
{
UNICODE_STRING us;
NTSTATUS status;
if (!pInfo)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
RtlInitUnicodeString(&us, lpSearchStr);
if ((status = RtlFindActivationContextSectionString(dwFlags, lpExtGuid, ulId, &us, pInfo)))
{
SetLastError(RtlNtStatusToDosError(status));
return FALSE;
}
return TRUE;
}
/***********************************************************************
* FindActCtxSectionGuid (KERNEL32.@)
*
* Find information about a GUID in an activation context.
*/
BOOL WINAPI FindActCtxSectionGuid(DWORD dwFlags, const GUID* lpExtGuid,
ULONG ulId, const GUID* lpSearchGuid,
PACTCTX_SECTION_KEYED_DATA pInfo)
{
NTSTATUS status;
if ((status = RtlFindActivationContextSectionGuid(dwFlags, lpExtGuid, ulId, lpSearchGuid, pInfo)))
{
SetLastError(RtlNtStatusToDosError(status));
return FALSE;
}
return TRUE;
}
/***********************************************************************
* QueryActCtxW (KERNEL32.@)
*
* Get information about an activation context.
*/
BOOL WINAPI QueryActCtxW(DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInst,
ULONG ulClass, PVOID pvBuff, SIZE_T cbBuff,
SIZE_T *pcbLen)
{
NTSTATUS status;
if ((status = RtlQueryInformationActivationContext( dwFlags, hActCtx, pvSubInst, ulClass,
pvBuff, cbBuff, pcbLen )))
{
SetLastError(RtlNtStatusToDosError(status));
return FALSE;
}
return TRUE;
}
/***********************************************************************
* QueryActCtxSettingsW (KERNEL32.@)
*/
BOOL WINAPI QueryActCtxSettingsW( DWORD flags, HANDLE ctx, const WCHAR *ns, const WCHAR *settings,
WCHAR *buffer, SIZE_T size, SIZE_T *written )
{
NTSTATUS status;
if ((status = RtlQueryActivationContextApplicationSettings( flags, ctx, ns, settings,
buffer, size, written )))
{
SetLastError( RtlNtStatusToDosError( status ));
return FALSE;
}
return TRUE;
}

View File

@ -135,7 +135,7 @@
@ stdcall AcquireSRWLockExclusive(ptr) ntdll.RtlAcquireSRWLockExclusive
@ stdcall AcquireSRWLockShared(ptr) ntdll.RtlAcquireSRWLockShared
@ stdcall ActivateActCtx(ptr ptr)
@ stdcall -import ActivateActCtx(ptr ptr)
@ stdcall AddAtomA(str)
@ stdcall AddAtomW(wstr)
@ stdcall AddConsoleAliasA(str str str)
@ -144,7 +144,7 @@
# @ stub AddIntegrityLabelToBoundaryDescriptor
# @ stub AddLocalAlternateComputerNameA
# @ stub AddLocalAlternateComputerNameW
@ stdcall AddRefActCtx(ptr)
@ stdcall -import AddRefActCtx(ptr)
# @ stub AddSIDToBoundaryDescriptor
# @ stub AddSecureMemoryCacheCallback
@ stdcall AddVectoredContinueHandler(long ptr) ntdll.RtlAddVectoredContinueHandler
@ -264,7 +264,7 @@
@ stdcall CopyFileW(wstr wstr long)
@ stdcall CopyLZFile(long long) LZCopy
@ stdcall CreateActCtxA(ptr)
@ stdcall CreateActCtxW(ptr)
@ stdcall -import CreateActCtxW(ptr)
# @ stub CreateBoundaryDescriptorA
# @ stub CreateBoundaryDescriptorW
@ stdcall CreateConsoleScreenBuffer(long long ptr long ptr)
@ -346,7 +346,7 @@
@ stdcall -import CreateWaitableTimerExW(ptr wstr long long)
@ stdcall -import CreateWaitableTimerW(ptr long wstr)
# @ stub CtrlRoutine
@ stdcall DeactivateActCtx(long long)
@ stdcall -import DeactivateActCtx(long long)
@ stdcall DebugActiveProcess(long)
@ stdcall DebugActiveProcessStop(long)
@ stdcall DebugBreak()
@ -470,9 +470,9 @@
@ stdcall FillConsoleOutputAttribute(long long long long ptr)
@ stdcall FillConsoleOutputCharacterA(long long long long ptr)
@ stdcall FillConsoleOutputCharacterW(long long long long ptr)
@ stdcall FindActCtxSectionGuid(long ptr long ptr ptr)
@ stdcall -import FindActCtxSectionGuid(long ptr long ptr ptr)
@ stdcall FindActCtxSectionStringA(long ptr long str ptr)
@ stdcall FindActCtxSectionStringW(long ptr long wstr ptr)
@ stdcall -import FindActCtxSectionStringW(long ptr long wstr ptr)
@ stdcall FindAtomA(str)
@ stdcall FindAtomW(wstr)
@ stdcall FindClose(long)
@ -621,7 +621,7 @@
@ stdcall GetCurrencyFormatA(long long str ptr ptr long)
@ stdcall GetCurrencyFormatEx(wstr long wstr ptr ptr long)
@ stdcall GetCurrencyFormatW(long long wstr ptr ptr long)
@ stdcall GetCurrentActCtx(ptr)
@ stdcall -import GetCurrentActCtx(ptr)
@ stdcall GetCurrentConsoleFont(long long ptr)
# @ stub GetCurrentConsoleFontEx
@ stdcall GetCurrentDirectoryA(long ptr)
@ -1156,8 +1156,8 @@
@ stdcall -import PulseEvent(long)
@ stdcall PurgeComm(long long)
@ stdcall -i386 -private -norelay QT_Thunk() krnl386.exe16.QT_Thunk
@ stdcall QueryActCtxSettingsW(long ptr wstr wstr ptr long ptr)
@ stdcall QueryActCtxW(long ptr ptr long ptr long ptr)
@ stdcall -import QueryActCtxSettingsW(long ptr wstr wstr ptr long ptr)
@ stdcall -import QueryActCtxW(long ptr ptr long ptr long ptr)
@ stdcall QueryDepthSList(ptr) ntdll.RtlQueryDepthSList
@ stdcall QueryDosDeviceA(str ptr long)
@ stdcall QueryDosDeviceW(wstr ptr long)
@ -1255,7 +1255,7 @@
@ stub RegisterWowBaseHandlers
@ stub RegisterWowExec
@ stdcall ReinitializeCriticalSection(ptr)
@ stdcall ReleaseActCtx(ptr)
@ stdcall -import ReleaseActCtx(ptr)
@ stdcall -import ReleaseMutex(long)
@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) ntdll.TpCallbackReleaseMutexOnCompletion
@ stdcall -import ReleaseSemaphore(long long ptr)
@ -1633,7 +1633,7 @@
@ stdcall WriteProfileStringA(str str str)
@ stdcall WriteProfileStringW(wstr wstr wstr)
@ stdcall WriteTapemark(ptr long long long)
@ stdcall ZombifyActCtx(ptr)
@ stdcall -import ZombifyActCtx(ptr)
@ stdcall -arch=x86_64 -private __C_specific_handler(ptr long ptr ptr) ntdll.__C_specific_handler
@ stdcall -arch=arm,x86_64 -private -norelay __chkstk() ntdll.__chkstk
@ stub _DebugOut

View File

@ -8,7 +8,7 @@
@ stdcall AcquireSRWLockExclusive(ptr) ntdll.RtlAcquireSRWLockExclusive
@ stdcall AcquireSRWLockShared(ptr) ntdll.RtlAcquireSRWLockShared
# @ stub AcquireStateLock
@ stdcall ActivateActCtx(ptr ptr) kernel32.ActivateActCtx
@ stdcall ActivateActCtx(ptr ptr)
@ stdcall AddAccessAllowedAce(ptr long long ptr)
@ stdcall AddAccessAllowedAceEx(ptr long long long ptr)
@ stdcall AddAccessAllowedObjectAce(ptr long long long ptr ptr ptr)
@ -21,7 +21,7 @@
@ stdcall AddAuditAccessObjectAce(ptr long long long ptr ptr ptr long long)
@ stdcall AddDllDirectory(wstr) kernel32.AddDllDirectory
@ stdcall AddMandatoryAce(ptr long long long ptr)
@ stdcall AddRefActCtx(ptr) kernel32.AddRefActCtx
@ stdcall AddRefActCtx(ptr)
# @ stub AddResourceAttributeAce
# @ stub AddSIDToBoundaryDescriptor
# @ stub AddScopedPolicyIDAce
@ -171,7 +171,7 @@
# @ stub -arch=x86_64 CopyMemoryNonTemporal
@ stdcall CopySid(long ptr ptr)
# @ stub CouldMultiUserAppsBehaviorBePossibleForPackage
@ stdcall CreateActCtxW(ptr) kernel32.CreateActCtxW
@ stdcall CreateActCtxW(ptr)
# @ stub CreateAppContainerToken
# @ stub CreateBoundaryDescriptorW
@ stdcall CreateConsoleScreenBuffer(long long ptr long ptr) kernel32.CreateConsoleScreenBuffer
@ -236,7 +236,7 @@
@ stdcall CreateWellKnownSid(long ptr ptr ptr)
# @ stub CtrlRoutine
# @ stub CveEventWrite
@ stdcall DeactivateActCtx(long long) kernel32.DeactivateActCtx
@ stdcall DeactivateActCtx(long long)
@ stdcall DebugActiveProcess(long) kernel32.DebugActiveProcess
@ stdcall DebugActiveProcessStop(long) kernel32.DebugActiveProcessStop
@ stdcall DebugBreak() kernel32.DebugBreak
@ -348,8 +348,8 @@
@ stdcall FillConsoleOutputAttribute(long long long long ptr) kernel32.FillConsoleOutputAttribute
@ stdcall FillConsoleOutputCharacterA(long long long long ptr) kernel32.FillConsoleOutputCharacterA
@ stdcall FillConsoleOutputCharacterW(long long long long ptr) kernel32.FillConsoleOutputCharacterW
@ stdcall FindActCtxSectionGuid(long ptr long ptr ptr) kernel32.FindActCtxSectionGuid
@ stdcall FindActCtxSectionStringW(long ptr long wstr ptr) kernel32.FindActCtxSectionStringW
@ stdcall FindActCtxSectionGuid(long ptr long ptr ptr)
@ stdcall FindActCtxSectionStringW(long ptr long wstr ptr)
@ stdcall FindClose(long) kernel32.FindClose
@ stdcall FindCloseChangeNotification(long) kernel32.FindCloseChangeNotification
@ stdcall FindFirstChangeNotificationA(str long long) kernel32.FindFirstChangeNotificationA
@ -450,7 +450,7 @@
@ stdcall GetConsoleTitleW(ptr long) kernel32.GetConsoleTitleW
@ stdcall GetCurrencyFormatEx(wstr long wstr ptr ptr long) kernel32.GetCurrencyFormatEx
@ stdcall GetCurrencyFormatW(long long wstr ptr ptr long) kernel32.GetCurrencyFormatW
@ stdcall GetCurrentActCtx(ptr) kernel32.GetCurrentActCtx
@ stdcall GetCurrentActCtx(ptr)
# @ stub GetCurrentApplicationUserModelId
@ stdcall GetCurrentDirectoryA(long ptr) kernel32.GetCurrentDirectoryA
@ stdcall GetCurrentDirectoryW(long ptr) kernel32.GetCurrentDirectoryW
@ -1192,8 +1192,8 @@
@ stdcall PulseEvent(long)
@ stdcall PurgeComm(long long) kernel32.PurgeComm
@ stdcall QISearch(ptr ptr ptr ptr)
@ stdcall QueryActCtxSettingsW(long ptr wstr wstr ptr long ptr) kernel32.QueryActCtxSettingsW
@ stdcall QueryActCtxW(long ptr ptr long ptr long ptr) kernel32.QueryActCtxW
@ stdcall QueryActCtxSettingsW(long ptr wstr wstr ptr long ptr)
@ stdcall QueryActCtxW(long ptr ptr long ptr long ptr)
@ stdcall QueryDepthSList(ptr) ntdll.RtlQueryDepthSList
@ stdcall QueryDosDeviceW(wstr ptr long) kernel32.QueryDosDeviceW
@ stdcall QueryFullProcessImageNameA(ptr long ptr ptr) kernel32.QueryFullProcessImageNameA
@ -1323,7 +1323,7 @@
# @ stub RegisterStateLock
@ stdcall RegisterTraceGuidsW(ptr ptr ptr long ptr wstr wstr ptr) ntdll.EtwRegisterTraceGuidsW
@ stdcall RegisterWaitForSingleObjectEx(long ptr ptr long long)
@ stdcall ReleaseActCtx(ptr) kernel32.ReleaseActCtx
@ stdcall ReleaseActCtx(ptr)
@ stdcall ReleaseMutex(long)
@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) ntdll.TpCallbackReleaseMutexOnCompletion
@ stdcall ReleaseSRWLockExclusive(ptr) ntdll.RtlReleaseSRWLockExclusive
@ -1732,7 +1732,7 @@
@ stdcall WriteProcessMemory(long ptr ptr long ptr) kernel32.WriteProcessMemory
# @ stub WriteStateAtomValue
# @ stub WriteStateContainerValue
@ stdcall ZombifyActCtx(ptr) kernel32.ZombifyActCtx
@ stdcall ZombifyActCtx(ptr)
# @ stub _AddMUIStringToCache
# @ stub _GetMUIStringFromCache
# @ stub _OpenMuiStringCache

View File

@ -577,3 +577,133 @@ DWORD WINAPI DECLSPEC_HOTPATCH SizeofResource( HINSTANCE module, HRSRC rsrc )
if (!rsrc) return 0;
return ((IMAGE_RESOURCE_DATA_ENTRY *)rsrc)->Size;
}
/***********************************************************************
* Activation contexts
***********************************************************************/
/***********************************************************************
* ActivateActCtx (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH ActivateActCtx( HANDLE context, ULONG_PTR *cookie )
{
return set_ntstatus( RtlActivateActivationContext( 0, context, cookie ));
}
/***********************************************************************
* AddRefActCtx (kernelbase.@)
*/
void WINAPI DECLSPEC_HOTPATCH AddRefActCtx( HANDLE context )
{
RtlAddRefActivationContext( context );
}
/***********************************************************************
* CreateActCtxW (kernelbase.@)
*/
HANDLE WINAPI DECLSPEC_HOTPATCH CreateActCtxW( PCACTCTXW ctx )
{
NTSTATUS status;
HANDLE context;
TRACE( "%p %08x\n", ctx, ctx ? ctx->dwFlags : 0 );
if ((status = RtlCreateActivationContext( &context, ctx )))
{
SetLastError( RtlNtStatusToDosError(status) );
return INVALID_HANDLE_VALUE;
}
return context;
}
/***********************************************************************
* DeactivateActCtx (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH DeactivateActCtx( DWORD flags, ULONG_PTR cookie )
{
RtlDeactivateActivationContext( flags, cookie );
return TRUE;
}
/***********************************************************************
* FindActCtxSectionGuid (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH FindActCtxSectionGuid( DWORD flags, const GUID *ext_guid, ULONG id,
const GUID *guid, PACTCTX_SECTION_KEYED_DATA info )
{
return set_ntstatus( RtlFindActivationContextSectionGuid( flags, ext_guid, id, guid, info ));
}
/***********************************************************************
* FindActCtxSectionStringW (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH FindActCtxSectionStringW( DWORD flags, const GUID *ext_guid, ULONG id,
LPCWSTR str, PACTCTX_SECTION_KEYED_DATA info )
{
UNICODE_STRING us;
if (!info)
{
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
RtlInitUnicodeString( &us, str );
return set_ntstatus( RtlFindActivationContextSectionString( flags, ext_guid, id, &us, info ));
}
/***********************************************************************
* GetCurrentActCtx (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH GetCurrentActCtx( HANDLE *pcontext )
{
return set_ntstatus( RtlGetActiveActivationContext( pcontext ));
}
/***********************************************************************
* QueryActCtxSettingsW (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH QueryActCtxSettingsW( DWORD flags, HANDLE ctx, const WCHAR *ns,
const WCHAR *settings, WCHAR *buffer, SIZE_T size,
SIZE_T *written )
{
return set_ntstatus( RtlQueryActivationContextApplicationSettings( flags, ctx, ns, settings,
buffer, size, written ));
}
/***********************************************************************
* QueryActCtxW (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH QueryActCtxW( DWORD flags, HANDLE context, PVOID inst, ULONG class,
PVOID buffer, SIZE_T size, SIZE_T *written )
{
return set_ntstatus( RtlQueryInformationActivationContext( flags, context, inst, class,
buffer, size, written ));
}
/***********************************************************************
* ReleaseActCtx (kernelbase.@)
*/
void WINAPI DECLSPEC_HOTPATCH ReleaseActCtx( HANDLE context )
{
RtlReleaseActivationContext( context );
}
/***********************************************************************
* ZombifyActCtx (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH ZombifyActCtx( HANDLE context )
{
return set_ntstatus( RtlZombifyActivationContext( context ));
}