diff --git a/include/atom.h b/include/atom.h deleted file mode 100644 index 6177dfd9e8c..00000000000 --- a/include/atom.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Atom table definitions - * - * Copyright 1993 Alexandre Julliard - */ - -#ifndef __WINE_ATOM_H -#define __WINE_ATOM_H - -#include "windows.h" - -extern BOOL32 ATOM_Init( WORD globalTableSel ); - -typedef struct -{ - HANDLE16 next; - WORD refCount; - BYTE length; - BYTE str[1]; -} ATOMENTRY; - -typedef struct -{ - WORD size; - HANDLE16 entries[1]; -} ATOMTABLE; - -#endif /* __WINE_ATOM_H */ diff --git a/include/global.h b/include/global.h index 3e643a0f394..6933b98fb2f 100644 --- a/include/global.h +++ b/include/global.h @@ -39,4 +39,7 @@ typedef BOOL32 (*HANDLERPROC)(LPVOID, LPVOID); extern BOOL32 VIRTUAL_SetFaultHandler(LPVOID addr, HANDLERPROC proc, LPVOID arg); extern BOOL32 VIRTUAL_HandleFault(LPVOID addr); +/* memory/atom.c */ +extern BOOL32 ATOM_Init( WORD globalTableSel ); + #endif /* __WINE_GLOBAL_H */ diff --git a/loader/main.c b/loader/main.c index 68c0a78abf1..a2af5639036 100644 --- a/loader/main.c +++ b/loader/main.c @@ -17,7 +17,6 @@ #include "menu.h" #include "message.h" #include "multimedia.h" -#include "atom.h" #include "dialog.h" #include "drive.h" #include "queue.h" diff --git a/memory/atom.c b/memory/atom.c index e6f17be63e7..ac51afcbec8 100644 --- a/memory/atom.c +++ b/memory/atom.c @@ -16,7 +16,6 @@ #include #include -#include "atom.h" #include "instance.h" #include "ldt.h" #include "stackframe.h" @@ -39,6 +38,20 @@ #define GET_ATOM_TABLE(sel) ((ATOMTABLE*)PTR_SEG_OFF_TO_LIN(sel, \ ((INSTANCEDATA*)PTR_SEG_OFF_TO_LIN(sel,0))->atomtable)) + +typedef struct +{ + HANDLE16 next; + WORD refCount; + BYTE length; + BYTE str[1]; +} ATOMENTRY; + +typedef struct +{ + WORD size; + HANDLE16 entries[1]; +} ATOMTABLE; static WORD ATOM_GlobalTable = 0; @@ -107,16 +120,18 @@ BOOL32 ATOM_Init( WORD globalTableSel ) */ static ATOMTABLE *ATOM_GetTable( WORD selector, /* [in] Segment */ - BOOL32 create /* [in] Create */ -) { + BOOL32 create /* [in] Create */ ) +{ INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 ); - if (!ptr->atomtable) + if (ptr->atomtable) { - if (!create) return NULL; - if (!ATOM_InitTable( selector, DEFAULT_ATOMTABLE_SIZE )) return NULL; - /* Reload ptr in case it moved in linear memory */ - ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 ); + ATOMTABLE *table = (ATOMTABLE *)((char *)ptr + ptr->atomtable); + if (table->size) return table; } + if (!create) return NULL; + if (!ATOM_InitTable( selector, DEFAULT_ATOMTABLE_SIZE )) return NULL; + /* Reload ptr in case it moved in linear memory */ + ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 ); return (ATOMTABLE *)((char *)ptr + ptr->atomtable); } @@ -339,6 +354,7 @@ static UINT32 ATOM_GetAtomName( */ WORD WINAPI InitAtomTable16( WORD entries ) { + if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */ return ATOM_InitTable( CURRENT_DS, entries ); } diff --git a/misc/ddeml.c b/misc/ddeml.c index 9916ae143db..fdd421557ae 100644 --- a/misc/ddeml.c +++ b/misc/ddeml.c @@ -9,7 +9,7 @@ #include "ddeml.h" #include "debug.h" -#include "atom.h" +#include "windows.h" /* FIXME: What are these values? */ #define DMLERR_NO_ERROR 0 diff --git a/windows/class.c b/windows/class.c index a69d7a77bfc..2f15ee47981 100644 --- a/windows/class.c +++ b/windows/class.c @@ -18,7 +18,6 @@ #include "heap.h" #include "win.h" #include "dce.h" -#include "atom.h" #include "ldt.h" #include "toolhelp.h" #include "winproc.h" diff --git a/windows/message.c b/windows/message.c index 907c7c44bd9..f3b0c96f64b 100644 --- a/windows/message.c +++ b/windows/message.c @@ -19,7 +19,6 @@ #include "input.h" #include "spy.h" #include "winpos.h" -#include "atom.h" #include "dde.h" #include "queue.h" #include "winproc.h"