Commit dc4b0c76 authored by Alexandre Julliard's avatar Alexandre Julliard

Moved tape.c to dlls/kernel.

Moved critical section and resource update functions to dlls/kernel. Started moving some of the thread functions too.
parent 69ac76d0
......@@ -40,6 +40,8 @@ C_SRCS = \
stress.c \
string.c \
sync.c \
tape.c \
thread.c \
thunk.c \
time.c \
toolhelp.c \
......
......@@ -560,3 +560,81 @@ DWORD WINAPI SizeofResource( HINSTANCE hModule, HRSRC hRsrc )
if (!hRsrc) return 0;
return ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->Size;
}
/***********************************************************************
* BeginUpdateResourceA (KERNEL32.@)
*/
HANDLE WINAPI BeginUpdateResourceA( LPCSTR pFileName, BOOL bDeleteExistingResources )
{
FIXME("(%s,%d): stub\n",debugstr_a(pFileName),bDeleteExistingResources);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/***********************************************************************
* BeginUpdateResourceW (KERNEL32.@)
*/
HANDLE WINAPI BeginUpdateResourceW( LPCWSTR pFileName, BOOL bDeleteExistingResources )
{
FIXME("(%s,%d): stub\n",debugstr_w(pFileName),bDeleteExistingResources);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/***********************************************************************
* EndUpdateResourceA (KERNEL32.@)
*/
BOOL WINAPI EndUpdateResourceA( HANDLE hUpdate, BOOL fDiscard )
{
FIXME("(%p,%d): stub\n",hUpdate, fDiscard);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* EndUpdateResourceW (KERNEL32.@)
*/
BOOL WINAPI EndUpdateResourceW( HANDLE hUpdate, BOOL fDiscard )
{
FIXME("(%p,%d): stub\n",hUpdate, fDiscard);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* UpdateResourceA (KERNEL32.@)
*/
BOOL WINAPI UpdateResourceA(
HANDLE hUpdate,
LPCSTR lpType,
LPCSTR lpName,
WORD wLanguage,
LPVOID lpData,
DWORD cbData)
{
FIXME(": stub\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* UpdateResourceW (KERNEL32.@)
*/
BOOL WINAPI UpdateResourceW(
HANDLE hUpdate,
LPCWSTR lpType,
LPCWSTR lpName,
WORD wLanguage,
LPVOID lpData,
DWORD cbData)
{
FIXME(": stub\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
......@@ -54,6 +54,69 @@ inline static int is_version_nt(void)
/***********************************************************************
* InitializeCriticalSection (KERNEL32.@)
*/
void WINAPI InitializeCriticalSection( CRITICAL_SECTION *crit )
{
NTSTATUS ret = RtlInitializeCriticalSection( crit );
if (ret) RtlRaiseStatus( ret );
}
/***********************************************************************
* InitializeCriticalSectionAndSpinCount (KERNEL32.@)
*/
BOOL WINAPI InitializeCriticalSectionAndSpinCount( CRITICAL_SECTION *crit, DWORD spincount )
{
NTSTATUS ret = RtlInitializeCriticalSectionAndSpinCount( crit, spincount );
if (ret) RtlRaiseStatus( ret );
return !ret;
}
/***********************************************************************
* SetCriticalSectionSpinCount (KERNEL32.@)
* This function is available on NT4SP3 or later, but not Win98
* It is SMP related
*/
DWORD WINAPI SetCriticalSectionSpinCount( CRITICAL_SECTION *crit, DWORD spincount )
{
ULONG_PTR oldspincount = crit->SpinCount;
if(spincount) FIXME("critsection=%p: spincount=%ld not supported\n", crit, spincount);
crit->SpinCount = spincount;
return oldspincount;
}
/***********************************************************************
* MakeCriticalSectionGlobal (KERNEL32.@)
*/
void WINAPI MakeCriticalSectionGlobal( CRITICAL_SECTION *crit )
{
/* let's assume that only one thread at a time will try to do this */
HANDLE sem = crit->LockSemaphore;
if (!sem) NtCreateSemaphore( &sem, SEMAPHORE_ALL_ACCESS, NULL, 0, 1 );
crit->LockSemaphore = ConvertToGlobalHandle( sem );
}
/***********************************************************************
* ReinitializeCriticalSection (KERNEL32.@)
*/
void WINAPI ReinitializeCriticalSection( CRITICAL_SECTION *crit )
{
if ( !crit->LockSemaphore )
RtlInitializeCriticalSection( crit );
}
/***********************************************************************
* UninitializeCriticalSection (KERNEL32.@)
*/
void WINAPI UninitializeCriticalSection( CRITICAL_SECTION *crit )
{
RtlDeleteCriticalSection( crit );
}
/***********************************************************************
* CreateEventA (KERNEL32.@)
*/
HANDLE WINAPI CreateEventA( SECURITY_ATTRIBUTES *sa, BOOL manual_reset,
......@@ -1105,3 +1168,102 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
*hWritePipe = hw;
return TRUE;
}
#ifdef __i386__
/***********************************************************************
* InterlockedCompareExchange (KERNEL32.@)
*/
/* LONG WINAPI InterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare ); */
__ASM_GLOBAL_FUNC(InterlockedCompareExchange,
"movl 12(%esp),%eax\n\t"
"movl 8(%esp),%ecx\n\t"
"movl 4(%esp),%edx\n\t"
"lock; cmpxchgl %ecx,(%edx)\n\t"
"ret $12");
/***********************************************************************
* InterlockedExchange (KERNEL32.@)
*/
/* LONG WINAPI InterlockedExchange( PLONG dest, LONG val ); */
__ASM_GLOBAL_FUNC(InterlockedExchange,
"movl 8(%esp),%eax\n\t"
"movl 4(%esp),%edx\n\t"
"lock; xchgl %eax,(%edx)\n\t"
"ret $8");
/***********************************************************************
* InterlockedExchangeAdd (KERNEL32.@)
*/
/* LONG WINAPI InterlockedExchangeAdd( PLONG dest, LONG incr ); */
__ASM_GLOBAL_FUNC(InterlockedExchangeAdd,
"movl 8(%esp),%eax\n\t"
"movl 4(%esp),%edx\n\t"
"lock; xaddl %eax,(%edx)\n\t"
"ret $8");
/***********************************************************************
* InterlockedIncrement (KERNEL32.@)
*/
/* LONG WINAPI InterlockedIncrement( PLONG dest ); */
__ASM_GLOBAL_FUNC(InterlockedIncrement,
"movl 4(%esp),%edx\n\t"
"movl $1,%eax\n\t"
"lock; xaddl %eax,(%edx)\n\t"
"incl %eax\n\t"
"ret $4");
/***********************************************************************
* InterlockedDecrement (KERNEL32.@)
*/
__ASM_GLOBAL_FUNC(InterlockedDecrement,
"movl 4(%esp),%edx\n\t"
"movl $-1,%eax\n\t"
"lock; xaddl %eax,(%edx)\n\t"
"decl %eax\n\t"
"ret $4");
#else /* __i386__ */
/***********************************************************************
* InterlockedCompareExchange (KERNEL32.@)
*/
LONG WINAPI InterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare )
{
return interlocked_cmpxchg( dest, xchg, compare );
}
/***********************************************************************
* InterlockedExchange (KERNEL32.@)
*/
LONG WINAPI InterlockedExchange( PLONG dest, LONG val )
{
return interlocked_xchg( dest, val );
}
/***********************************************************************
* InterlockedExchangeAdd (KERNEL32.@)
*/
LONG WINAPI InterlockedExchangeAdd( PLONG dest, LONG incr )
{
return interlocked_xchg_add( dest, incr );
}
/***********************************************************************
* InterlockedIncrement (KERNEL32.@)
*/
LONG WINAPI InterlockedIncrement( PLONG dest )
{
return interlocked_xchg_add( dest, 1 ) + 1;
}
/***********************************************************************
* InterlockedDecrement (KERNEL32.@)
*/
LONG WINAPI InterlockedDecrement( PLONG dest )
{
return interlocked_xchg_add( dest, -1 ) - 1;
}
#endif /* __i386__ */
......@@ -13,7 +13,6 @@ C_SRCS = \
$(TOPOBJDIR)/files/file.c \
$(TOPOBJDIR)/files/profile.c \
$(TOPOBJDIR)/files/smb.c \
$(TOPOBJDIR)/files/tape.c \
$(TOPOBJDIR)/if1632/builtin.c \
$(TOPOBJDIR)/if1632/relay.c \
$(TOPOBJDIR)/if1632/snoop.c \
......@@ -45,7 +44,6 @@ C_SRCS = \
$(TOPOBJDIR)/relay32/relay386.c \
$(TOPOBJDIR)/relay32/snoop.c \
$(TOPOBJDIR)/scheduler/client.c \
$(TOPOBJDIR)/scheduler/critsection.c \
$(TOPOBJDIR)/scheduler/fiber.c \
$(TOPOBJDIR)/scheduler/handle.c \
$(TOPOBJDIR)/scheduler/process.c \
......@@ -56,7 +54,6 @@ C_SRCS = \
$(TOPOBJDIR)/scheduler/thread.c \
$(TOPOBJDIR)/win32/device.c \
$(TOPOBJDIR)/win32/except.c \
$(TOPOBJDIR)/win32/kernel32.c \
$(TOPOBJDIR)/win32/newfns.c \
cdrom.c \
critsection.c \
......
/*
* Win32 critical sections
*
* Copyright 1998 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <stdio.h>
#include <sys/types.h>
#include "winerror.h"
#include "winbase.h"
#include "winternl.h"
#include "wine/debug.h"
#include "thread.h"
WINE_DEFAULT_DEBUG_CHANNEL(win32);
WINE_DECLARE_DEBUG_CHANNEL(relay);
/***********************************************************************
* InitializeCriticalSection (KERNEL32.@)
*/
void WINAPI InitializeCriticalSection( CRITICAL_SECTION *crit )
{
NTSTATUS ret = RtlInitializeCriticalSection( crit );
if (ret) RtlRaiseStatus( ret );
}
/***********************************************************************
* InitializeCriticalSectionAndSpinCount (KERNEL32.@)
*/
BOOL WINAPI InitializeCriticalSectionAndSpinCount( CRITICAL_SECTION *crit, DWORD spincount )
{
NTSTATUS ret = RtlInitializeCriticalSectionAndSpinCount( crit, spincount );
if (ret) RtlRaiseStatus( ret );
return !ret;
}
/***********************************************************************
* SetCriticalSectionSpinCount (KERNEL32.@)
* This function is available on NT4SP3 or later, but not Win98
* It is SMP related
*/
DWORD WINAPI SetCriticalSectionSpinCount( CRITICAL_SECTION *crit, DWORD spincount )
{
ULONG_PTR oldspincount = crit->SpinCount;
if(spincount) FIXME("critsection=%p: spincount=%ld not supported\n", crit, spincount);
crit->SpinCount = spincount;
return oldspincount;
}
/***********************************************************************
* MakeCriticalSectionGlobal (KERNEL32.@)
*/
void WINAPI MakeCriticalSectionGlobal( CRITICAL_SECTION *crit )
{
/* let's assume that only one thread at a time will try to do this */
HANDLE sem = crit->LockSemaphore;
if (!sem) NtCreateSemaphore( &sem, SEMAPHORE_ALL_ACCESS, NULL, 0, 1 );
crit->LockSemaphore = ConvertToGlobalHandle( sem );
}
/***********************************************************************
* ReinitializeCriticalSection (KERNEL32.@)
*/
void WINAPI ReinitializeCriticalSection( CRITICAL_SECTION *crit )
{
if ( !crit->LockSemaphore )
RtlInitializeCriticalSection( crit );
}
/***********************************************************************
* UninitializeCriticalSection (KERNEL32.@)
*/
void WINAPI UninitializeCriticalSection( CRITICAL_SECTION *crit )
{
RtlDeleteCriticalSection( crit );
}
#ifdef __i386__
/***********************************************************************
* InterlockedCompareExchange (KERNEL32.@)
*/
/* LONG WINAPI InterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare ); */
__ASM_GLOBAL_FUNC(InterlockedCompareExchange,
"movl 12(%esp),%eax\n\t"
"movl 8(%esp),%ecx\n\t"
"movl 4(%esp),%edx\n\t"
"lock; cmpxchgl %ecx,(%edx)\n\t"
"ret $12");
/***********************************************************************
* InterlockedExchange (KERNEL32.@)
*/
/* LONG WINAPI InterlockedExchange( PLONG dest, LONG val ); */
__ASM_GLOBAL_FUNC(InterlockedExchange,
"movl 8(%esp),%eax\n\t"
"movl 4(%esp),%edx\n\t"
"lock; xchgl %eax,(%edx)\n\t"
"ret $8");
/***********************************************************************
* InterlockedExchangeAdd (KERNEL32.@)
*/
/* LONG WINAPI InterlockedExchangeAdd( PLONG dest, LONG incr ); */
__ASM_GLOBAL_FUNC(InterlockedExchangeAdd,
"movl 8(%esp),%eax\n\t"
"movl 4(%esp),%edx\n\t"
"lock; xaddl %eax,(%edx)\n\t"
"ret $8");
/***********************************************************************
* InterlockedIncrement (KERNEL32.@)
*/
/* LONG WINAPI InterlockedIncrement( PLONG dest ); */
__ASM_GLOBAL_FUNC(InterlockedIncrement,
"movl 4(%esp),%edx\n\t"
"movl $1,%eax\n\t"
"lock; xaddl %eax,(%edx)\n\t"
"incl %eax\n\t"
"ret $4");
/***********************************************************************
* InterlockedDecrement (KERNEL32.@)
*/
__ASM_GLOBAL_FUNC(InterlockedDecrement,
"movl 4(%esp),%edx\n\t"
"movl $-1,%eax\n\t"
"lock; xaddl %eax,(%edx)\n\t"
"decl %eax\n\t"
"ret $4");
#else /* __i386__ */
/***********************************************************************
* InterlockedCompareExchange (KERNEL32.@)
*/
LONG WINAPI InterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare )
{
return interlocked_cmpxchg( dest, xchg, compare );
}
/***********************************************************************
* InterlockedExchange (KERNEL32.@)
*/
LONG WINAPI InterlockedExchange( PLONG dest, LONG val )
{
return interlocked_xchg( dest, val );
}
/***********************************************************************
* InterlockedExchangeAdd (KERNEL32.@)
*/
LONG WINAPI InterlockedExchangeAdd( PLONG dest, LONG incr )
{
return interlocked_xchg_add( dest, incr );
}
/***********************************************************************
* InterlockedIncrement (KERNEL32.@)
*/
LONG WINAPI InterlockedIncrement( PLONG dest )
{
return interlocked_xchg_add( dest, 1 ) + 1;
}
/***********************************************************************
* InterlockedDecrement (KERNEL32.@)
*/
LONG WINAPI InterlockedDecrement( PLONG dest )
{
return interlocked_xchg_add( dest, -1 ) - 1;
}
#endif /* __i386__ */
/*
* KERNEL32 thunks and other undocumented stuff
*
* Copyright 1997-1998 Marcus Meissner
* Copyright 1998 Ulrich Weigand
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include "windef.h"
#include "winbase.h"
#include "wine/winbase16.h"
#include "winerror.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(win32);
/***********************************************************************
* BeginUpdateResourceA (KERNEL32.@)
*/
HANDLE WINAPI BeginUpdateResourceA( LPCSTR pFileName, BOOL bDeleteExistingResources )
{
FIXME("(%s,%d): stub\n",debugstr_a(pFileName),bDeleteExistingResources);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/***********************************************************************
* BeginUpdateResourceW (KERNEL32.@)
*/
HANDLE WINAPI BeginUpdateResourceW( LPCWSTR pFileName, BOOL bDeleteExistingResources )
{
FIXME("(%s,%d): stub\n",debugstr_w(pFileName),bDeleteExistingResources);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/***********************************************************************
* EndUpdateResourceA (KERNEL32.@)
*/
BOOL WINAPI EndUpdateResourceA( HANDLE hUpdate, BOOL fDiscard )
{
FIXME("(%p,%d): stub\n",hUpdate, fDiscard);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* EndUpdateResourceW (KERNEL32.@)
*/
BOOL WINAPI EndUpdateResourceW( HANDLE hUpdate, BOOL fDiscard )
{
FIXME("(%p,%d): stub\n",hUpdate, fDiscard);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* UpdateResourceA (KERNEL32.@)
*/
BOOL WINAPI UpdateResourceA(
HANDLE hUpdate,
LPCSTR lpType,
LPCSTR lpName,
WORD wLanguage,
LPVOID lpData,
DWORD cbData) {
FIXME(": stub\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
/***********************************************************************
* UpdateResourceW (KERNEL32.@)
*/
BOOL WINAPI UpdateResourceW(
HANDLE hUpdate,
LPCWSTR lpType,
LPCWSTR lpName,
WORD wLanguage,
LPVOID lpData,
DWORD cbData) {
FIXME(": stub\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return FALSE;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment