Commit 737fa07d authored by Alexandre Julliard's avatar Alexandre Julliard

Small atom fixes.

parent f1ac4ef7
/*
* 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 */
......@@ -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 */
......@@ -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"
......
......@@ -16,7 +16,6 @@
#include <string.h>
#include <ctype.h>
#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 );
}
......
......@@ -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
......
......@@ -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"
......
......@@ -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"
......
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