diff --git a/reactos/include/ddk/winddi.h b/reactos/include/ddk/winddi.h index 8fe9bf8cbf6..405b144b792 100644 --- a/reactos/include/ddk/winddi.h +++ b/reactos/include/ddk/winddi.h @@ -1159,10 +1159,6 @@ CLIPOBJ_cEnumStart(IN PCLIPOBJ ClipObj, PPATHOBJ STDCALL CLIPOBJ_ppoGetPath(PCLIPOBJ ClipObj); -/* -EngAcquireSemaphore -*/ - /* FIXME: find correct defines for following symbols */ #define FL_ZERO_MEMORY 1 @@ -1239,6 +1235,30 @@ EngCreatePalette(IN ULONG Mode, IN ULONG Green, IN ULONG Blue); +HSEMAPHORE +STDCALL +EngCreateSemaphore ( VOID ); + +VOID +STDCALL +EngAcquireSemaphore ( IN HSEMAPHORE hsem ); + +VOID +STDCALL +EngReleaseSemaphore ( IN HSEMAPHORE hsem ); + +VOID +STDCALL +EngDeleteSemaphore ( IN HSEMAPHORE hsem ); + +BOOL +STDCALL +EngIsSemaphoreOwned ( IN HSEMAPHORE hsem ); + +BOOL +STDCALL +EngIsSemaphoreOwnedByCurrentThread ( IN HSEMAPHORE hsem ); + /* EngCreatePath EngCreateSemaphore @@ -1266,7 +1286,6 @@ EngDeletePalette(IN HPALETTE Palette); /* EngDeletePath -EngDeleteSemaphore */ BOOL STDCALL @@ -1388,7 +1407,6 @@ EngQueryLocalTime EngQueryPalette EngQueryPerformanceCounter EngQueryPerformanceFrequency -EngReleaseSemaphore EngRestoreFloatingPointState EngSaveFloatingPointState EngSecureMem diff --git a/reactos/subsys/win32k/makefile b/reactos/subsys/win32k/makefile index ec5d220197b..3aeb93d6303 100644 --- a/reactos/subsys/win32k/makefile +++ b/reactos/subsys/win32k/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.77 2003/08/13 20:25:41 chorns Exp $ +# $Id: makefile,v 1.78 2003/08/13 22:43:15 royce Exp $ PATH_TO_TOP = ../.. @@ -65,7 +65,7 @@ OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \ objects/region.o objects/text.o objects/wingl.o \ objects/bezier.o objects/objconv.o objects/dib.o \ objects/palette.o objects/rect.o objects/polyfill.o \ - objects/cursoricon.o + objects/cursoricon.o objects/semaphor.o DIB_OBJECTS = dib/dib.o dib/dib1bpp.o dib/dib4bpp.o dib/dib8bpp.o dib/dib16bpp.o \ dib/dib24bpp.o dib/dib32bpp.o diff --git a/reactos/subsys/win32k/objects/semaphor.c b/reactos/subsys/win32k/objects/semaphor.c new file mode 100644 index 00000000000..cb6e1a1515e --- /dev/null +++ b/reactos/subsys/win32k/objects/semaphor.c @@ -0,0 +1,90 @@ + +#undef WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include +#include +#include "../eng/objects.h" +#include + +/* + * @implemented + */ +HSEMAPHORE +STDCALL +EngCreateSemaphore ( VOID ) +{ + // www.osr.com/ddk/graphics/gdifncs_95lz.htm + PERESOURCE psem = ExAllocatePool ( NonPagedPool, sizeof(ERESOURCE) ); + if ( !psem ) + return NULL; + if ( !NT_SUCCESS(ExInitializeResourceLite ( psem )) ) + { + ExFreePool ( psem ); + return NULL; + } + return (HSEMAPHORE)psem; +} + +/* + * @implemented + */ +VOID +STDCALL +EngAcquireSemaphore ( IN HSEMAPHORE hsem ) +{ + // www.osr.com/ddk/graphics/gdifncs_14br.htm + ASSERT(hsem); + ExAcquireResourceExclusiveLite ( (PERESOURCE)hsem, TRUE ); +} + +/* + * @implemented + */ +VOID +STDCALL +EngReleaseSemaphore ( IN HSEMAPHORE hsem ) +{ + // www.osr.com/ddk/graphics/gdifncs_5u3r.htm + ASSERT(hsem); + ExReleaseResourceLite ( (PERESOURCE)hsem ); +} + +/* + * @implemented + */ +VOID +STDCALL +EngDeleteSemaphore ( IN HSEMAPHORE hsem ) +{ + // www.osr.com/ddk/graphics/gdifncs_13c7.htm + ASSERT ( hsem ); + ExFreePool ( (PVOID)hsem ); +} + +/* + * @implemented + */ +BOOL +STDCALL +EngIsSemaphoreOwned ( IN HSEMAPHORE hsem ) +{ + // www.osr.com/ddk/graphics/gdifncs_6wmf.htm + ASSERT(hsem); + return (((PERESOURCE)hsem)->ActiveCount > 0); +} + +/* + * @implemented + */ +BOOL +STDCALL +EngIsSemaphoreOwnedByCurrentThread ( IN HSEMAPHORE hsem ) +{ + // www.osr.com/ddk/graphics/gdifncs_9yxz.htm + ASSERT(hsem); + return ExIsResourceAcquiredExclusiveLite ( (PERESOURCE)hsem ); +} diff --git a/reactos/subsys/win32k/stubs/stubs.c b/reactos/subsys/win32k/stubs/stubs.c index 5d2ef23201b..b687304407d 100644 --- a/reactos/subsys/win32k/stubs/stubs.c +++ b/reactos/subsys/win32k/stubs/stubs.c @@ -71,75 +71,6 @@ EngUnmapFontFile ( ULONG_PTR iFile ) return EngUnmapFontFileFD ( iFile ); } -/* - * @unimplemented - */ -HSEMAPHORE -STDCALL -EngCreateSemaphore ( VOID ) -{ - // www.osr.com/ddk/graphics/gdifncs_95lz.htm - UNIMPLEMENTED; - return NULL; -} - -/* - * @unimplemented - */ -VOID -STDCALL -EngAcquireSemaphore ( IN HSEMAPHORE hsem ) -{ - // www.osr.com/ddk/graphics/gdifncs_14br.htm - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -VOID -STDCALL -EngReleaseSemaphore ( IN HSEMAPHORE hsem ) -{ - // www.osr.com/ddk/graphics/gdifncs_5u3r.htm - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -VOID -STDCALL -EngDeleteSemaphore ( IN HSEMAPHORE hsem ) -{ - // www.osr.com/ddk/graphics/gdifncs_13c7.htm - UNIMPLEMENTED; -} - -/* - * @unimplemented - */ -BOOL -STDCALL -EngIsSemaphoreOwned ( IN HSEMAPHORE hsem ) -{ - // www.osr.com/ddk/graphics/gdifncs_6wmf.htm - UNIMPLEMENTED; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -STDCALL -EngIsSemaphoreOwnedByCurrentThread ( IN HSEMAPHORE hsem ) -{ - // www.osr.com/ddk/graphics/gdifncs_9yxz.htm - UNIMPLEMENTED; - return FALSE; -} - /* * @unimplemented */