mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 20:59:54 +00:00
77b9918e0e
Thu Sep 11 18:24:56 1997 Philippe De Muyter <phdm@info.ucl.ac.be> * [objects/dc.c] In DC_SetupGCForPatBlt, replace R2_NOT by GXxor with (black xor white). Tue Sep 9 23:04:02 1997 U. Bonnes <bon@elektron.ikp.physik.th-darmstadt.de> * [memory/virtual.c] Do not write debugging info unconditionally to stderr. * [files/profile.c] Call PROFILE_GetSection in PROFILE_GetString for key_name "" too. * [misc/crtdll.c] Many new functions. * [include/windows.h] [windows/winpos.c] ClientToScreen16 doesn't have a return value. Sun Sep 7 10:06:39 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [misc/main.c] [AUTHORS] Update the list of contributors. Please let me know if I forgot someone. * [if1632/*.spec] [if1632/builtin.c] [tools/build.c] Ordinal base for Win32 DLLs is now computed automatically from the lowest ordinal found. * [include/wintypes.h] WINAPI is now defined as attribute((stdcall)). This will require gcc to compile. * [if1632/thunk.c] Removed Win32 thunks (no longer needed with stdcall). * [if1632/crtdll.spec] [misc/crtdll.c] Make sure we only reference cdecl functions in the spec file. * [objects/dc.c] Use CapNotLast drawing style for 1-pixel wide lines. * [tools/build.c] Added 'double' argument type. Added 'varargs' function type for Win32. Made CallTo16_xxx functions stdcall. Fri Sep 5 14:50:49 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu> * [tools/build.c] [windows/win.c] [windows/event.c] [windows/message.c] More fixes to get message exchange closer to the original. * [misc/spy.c] Message logs now contain window names. * [loader/resource.c] [loader/ne_resource.c] [loader/task.c] [objects/cursoricon.c] [windows/user.c] Added some obscure features to fix memory leaks. Fri Sep 5 00:46:28 1997 Jan Willamowius <jan@janhh.shnet.org> * [if1632/kernel32.spec] [win32/newfns.c] Added stub for UTRegister() and UTUnRegister(). Thu Sep 4 12:03:12 1997 Frans van Dorsselaer <dorssel@rulhmpc49.LeidenUniv.nl> * [controls/edit.c] Allow ASCII codes > 127 in WM_CHAR. Mon Sep 1 17:23:24 1997 Dimitrie O. Paun <dimi@mail.cs.toronto.edu> * [controls/widgets.c] In InitCommonControls, remember the name of the class because lpszClassName was made to point to a local array Added the ProgressBar to the list of implemented controls. Call InitCommonControls from WIDGETS_Init to register all implemented Common Controls. * [include/commctrl.h] Added misc decl for the Progress Bar. * [controls/progress.c] [include/progress.h] First attempt at implementiong the Progress Bar class. * [objects/brush.h] Implementation for GetSysColorBrush[16|32] * [controls/status.c] Use DrawEdge to draw the borders and fill the background * [controls/uitools.c] Added DrawDiagEdge32 and DrawRectEdge32 * [graphics/painting.c] Implement DrawEdge[16|32] Started DrawFrameControl32 Mon Sep 1 10:07:09 1997 Lawson Whitney <lawson_whitney@juno.com> * [misc/comm.c] [include/windows.h] SetCommEventMask returns a SEGPTR. Sun Aug 31 23:28:32 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [loader/pe_image.c][loader/module.c][include/pe_image.h] [include/module.h] Cleaned up the whole Win32 library mess (a bit). * [debugger/stabs.c] If 'wine' has no absolute path and isn't found, check $PATH too. * [misc/ole2nls.c] Some fixes. * [misc/ver.c] Added support for PE style version resources. * [memory/string.c] Check for NULL pointers to _lstr* functions, just as Windows95 does. * [multimedia/time.c] Made list of timers a simple linked list. * [loader/resource.c] Netscape 3 seems to pass NEGATIVE resource Ids (in an unsigned int, yes). Don't know why, fixed it anyway. * [objects/bitmap.c] LoadImageW added. * [include/win.h][windows/win.c] Change wIDmenu from UINT16 to UINT32 and changed the SetWindow(Long|Word) accordingly. Thu Aug 28 19:30:08 1997 Morten Welinder <terra@diku.dk> * [include/windows.h] Add a few more colors defined for Win95. Add a few more brush styles. * [windows/syscolor.c] Add error checks for SYSCOLOR_SetColor, SYSCOLOR_Init, GetSysColor16, GetSysColor32. Add support for above colors. Sun Aug 24 16:22:57 1997 Andrew Taylor <andrew@riscan.com> * [multimedia/mmsystem.c] Changed mmioDescend to use mmio functions for file I/O, neccessary for memory files.
227 lines
6.1 KiB
C
227 lines
6.1 KiB
C
/*
|
|
* KERNEL32 objects
|
|
*
|
|
* Copyright 1996 Alexandre Julliard
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include "winerror.h"
|
|
#include "handle32.h"
|
|
#include "heap.h"
|
|
#include "file.h"
|
|
#include "process.h"
|
|
#include "thread.h"
|
|
|
|
typedef void (*destroy_object)(K32OBJ *);
|
|
|
|
extern void VIRTUAL_DestroyMapping( K32OBJ *obj );
|
|
|
|
static const destroy_object K32OBJ_Destroy[K32OBJ_NBOBJECTS] =
|
|
{
|
|
NULL,
|
|
NULL, /* K32OBJ_SEMAPHORE */
|
|
NULL, /* K32OBJ_EVENT */
|
|
NULL, /* K32OBJ_MUTEX */
|
|
NULL, /* K32OBJ_CRITICAL_SECTION */
|
|
PROCESS_Destroy, /* K32OBJ_PROCESS */
|
|
THREAD_Destroy, /* K32OBJ_THREAD */
|
|
FILE_Destroy, /* K32OBJ_FILE */
|
|
NULL, /* K32OBJ_CHANGE */
|
|
NULL, /* K32OBJ_CONSOLE */
|
|
NULL, /* K32OBJ_SCREEN_BUFFER */
|
|
VIRTUAL_DestroyMapping, /* K32OBJ_MEM_MAPPED_FILE */
|
|
NULL, /* K32OBJ_SERIAL */
|
|
NULL, /* K32OBJ_DEVICE_IOCTL */
|
|
NULL, /* K32OBJ_PIPE */
|
|
NULL, /* K32OBJ_MAILSLOT */
|
|
NULL, /* K32OBJ_TOOLHELP_SNAPSHOT */
|
|
NULL /* K32OBJ_SOCKET */
|
|
};
|
|
|
|
typedef struct _NE
|
|
{
|
|
struct _NE *next;
|
|
K32OBJ *obj;
|
|
UINT32 len;
|
|
char name[1];
|
|
} NAME_ENTRY;
|
|
|
|
static NAME_ENTRY *K32OBJ_FirstEntry = NULL;
|
|
|
|
|
|
/***********************************************************************
|
|
* K32OBJ_IncCount
|
|
*/
|
|
void K32OBJ_IncCount( K32OBJ *ptr )
|
|
{
|
|
/* FIXME: not atomic */
|
|
assert( ptr->type && ((unsigned)ptr->type < K32OBJ_NBOBJECTS) );
|
|
ptr->refcount++;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* K32OBJ_DecCount
|
|
*/
|
|
void K32OBJ_DecCount( K32OBJ *ptr )
|
|
{
|
|
NAME_ENTRY **pptr;
|
|
|
|
/* FIXME: not atomic */
|
|
assert( ptr->type && ((unsigned)ptr->type < K32OBJ_NBOBJECTS) );
|
|
assert( ptr->refcount );
|
|
if (--ptr->refcount) return;
|
|
|
|
/* Check if the object has a name entry and free it */
|
|
|
|
pptr = &K32OBJ_FirstEntry;
|
|
while (*pptr && ((*pptr)->obj != ptr)) pptr = &(*pptr)->next;
|
|
if (*pptr)
|
|
{
|
|
NAME_ENTRY *entry = *pptr;
|
|
*pptr = entry->next;
|
|
HeapFree( SystemHeap, 0, entry );
|
|
}
|
|
|
|
/* Free the object */
|
|
|
|
if (K32OBJ_Destroy[ptr->type]) K32OBJ_Destroy[ptr->type]( ptr );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* K32OBJ_AddHead
|
|
*
|
|
* Add an object at the head of the list and increment its ref count.
|
|
*/
|
|
void K32OBJ_AddHead( K32OBJ_LIST *list, K32OBJ *ptr )
|
|
{
|
|
K32OBJ_ENTRY *entry = HeapAlloc( SystemHeap, 0, sizeof(*entry) );
|
|
assert(entry);
|
|
K32OBJ_IncCount( ptr );
|
|
entry->obj = ptr;
|
|
if ((entry->next = list->head) != NULL) entry->next->prev = entry;
|
|
else list->tail = entry;
|
|
entry->prev = NULL;
|
|
list->head = entry;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* K32OBJ_AddTail
|
|
*
|
|
* Add an object at the tail of the list and increment its ref count.
|
|
*/
|
|
void K32OBJ_AddTail( K32OBJ_LIST *list, K32OBJ *ptr )
|
|
{
|
|
K32OBJ_ENTRY *entry = HeapAlloc( SystemHeap, 0, sizeof(*entry) );
|
|
assert(entry);
|
|
K32OBJ_IncCount( ptr );
|
|
entry->obj = ptr;
|
|
if ((entry->prev = list->tail) != NULL) entry->prev->next = entry;
|
|
else list->head = entry;
|
|
entry->next = NULL;
|
|
list->tail = entry;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* K32OBJ_Remove
|
|
*
|
|
* Remove an object from the list and decrement its ref count.
|
|
*/
|
|
void K32OBJ_Remove( K32OBJ_LIST *list, K32OBJ *ptr )
|
|
{
|
|
K32OBJ_ENTRY *entry = list->head;
|
|
while ((entry && (entry->obj != ptr))) entry = entry->next;
|
|
assert(entry);
|
|
if (entry->next) entry->next->prev = entry->prev;
|
|
else list->tail = entry->prev;
|
|
if (entry->prev) entry->prev->next = entry->next;
|
|
else list->head = entry->next;
|
|
HeapFree( SystemHeap, 0, entry );
|
|
K32OBJ_DecCount( ptr );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* K32OBJ_RemoveHead
|
|
*
|
|
* Remove the head of the list; its ref count is NOT decremented.
|
|
*/
|
|
K32OBJ *K32OBJ_RemoveHead( K32OBJ_LIST *list )
|
|
{
|
|
K32OBJ *ptr;
|
|
K32OBJ_ENTRY *entry = list->head;
|
|
assert(entry);
|
|
assert(!entry->prev);
|
|
if ((list->head = entry->next) != NULL) entry->next->prev = NULL;
|
|
else list->tail = NULL;
|
|
ptr = entry->obj;
|
|
HeapFree( SystemHeap, 0, entry );
|
|
return ptr;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* K32OBJ_AddName
|
|
*
|
|
* Add a name entry for an object. We don't check for duplicates here.
|
|
* FIXME: should use some sort of hashing.
|
|
*/
|
|
BOOL32 K32OBJ_AddName( K32OBJ *obj, LPCSTR name )
|
|
{
|
|
NAME_ENTRY *entry;
|
|
UINT32 len = strlen( name );
|
|
|
|
if (!(entry = HeapAlloc( SystemHeap, 0, sizeof(NAME_ENTRY) + len )))
|
|
{
|
|
SetLastError( ERROR_OUTOFMEMORY );
|
|
return FALSE;
|
|
}
|
|
entry->next = K32OBJ_FirstEntry;
|
|
entry->obj = obj;
|
|
lstrcpy32A( entry->name, name );
|
|
K32OBJ_FirstEntry = entry;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* K32OBJ_FindName
|
|
*
|
|
* Find the object referenced by a given name.
|
|
* The reference count is not incremented.
|
|
*/
|
|
K32OBJ *K32OBJ_FindName( LPCSTR name )
|
|
{
|
|
NAME_ENTRY *entry = K32OBJ_FirstEntry;
|
|
UINT32 len;
|
|
|
|
if (!name) return NULL; /* Anonymous object */
|
|
len = strlen( name );
|
|
while (entry)
|
|
{
|
|
if ((len == entry->len) && !lstrcmp32A( name, entry->name))
|
|
return entry->obj;
|
|
entry = entry->next;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* K32OBJ_FindNameType
|
|
*
|
|
* Find an object by name and check its type.
|
|
* The reference count is not incremented.
|
|
*/
|
|
K32OBJ *K32OBJ_FindNameType( LPCSTR name, K32OBJ_TYPE type )
|
|
{
|
|
K32OBJ *obj = K32OBJ_FindName( name );
|
|
if (!obj) return NULL;
|
|
if (obj->type == type) return obj;
|
|
SetLastError( ERROR_DUP_NAME );
|
|
return NULL;
|
|
}
|