Small atom fixes.

This commit is contained in:
Alexandre Julliard 1998-11-15 17:29:15 +00:00
parent f1ac4ef72b
commit 737fa07db7
7 changed files with 28 additions and 40 deletions

View File

@ -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 */

View File

@ -39,4 +39,7 @@ typedef BOOL32 (*HANDLERPROC)(LPVOID, LPVOID);
extern BOOL32 VIRTUAL_SetFaultHandler(LPVOID addr, HANDLERPROC proc, LPVOID arg); extern BOOL32 VIRTUAL_SetFaultHandler(LPVOID addr, HANDLERPROC proc, LPVOID arg);
extern BOOL32 VIRTUAL_HandleFault(LPVOID addr); extern BOOL32 VIRTUAL_HandleFault(LPVOID addr);
/* memory/atom.c */
extern BOOL32 ATOM_Init( WORD globalTableSel );
#endif /* __WINE_GLOBAL_H */ #endif /* __WINE_GLOBAL_H */

View File

@ -17,7 +17,6 @@
#include "menu.h" #include "menu.h"
#include "message.h" #include "message.h"
#include "multimedia.h" #include "multimedia.h"
#include "atom.h"
#include "dialog.h" #include "dialog.h"
#include "drive.h" #include "drive.h"
#include "queue.h" #include "queue.h"

View File

@ -16,7 +16,6 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "atom.h"
#include "instance.h" #include "instance.h"
#include "ldt.h" #include "ldt.h"
#include "stackframe.h" #include "stackframe.h"
@ -39,6 +38,20 @@
#define GET_ATOM_TABLE(sel) ((ATOMTABLE*)PTR_SEG_OFF_TO_LIN(sel, \ #define GET_ATOM_TABLE(sel) ((ATOMTABLE*)PTR_SEG_OFF_TO_LIN(sel, \
((INSTANCEDATA*)PTR_SEG_OFF_TO_LIN(sel,0))->atomtable)) ((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; static WORD ATOM_GlobalTable = 0;
@ -107,16 +120,18 @@ BOOL32 ATOM_Init( WORD globalTableSel )
*/ */
static ATOMTABLE *ATOM_GetTable( static ATOMTABLE *ATOM_GetTable(
WORD selector, /* [in] Segment */ WORD selector, /* [in] Segment */
BOOL32 create /* [in] Create */ BOOL32 create /* [in] Create */ )
) { {
INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 ); INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 );
if (!ptr->atomtable) if (ptr->atomtable)
{ {
if (!create) return NULL; ATOMTABLE *table = (ATOMTABLE *)((char *)ptr + ptr->atomtable);
if (!ATOM_InitTable( selector, DEFAULT_ATOMTABLE_SIZE )) return NULL; if (table->size) return table;
/* Reload ptr in case it moved in linear memory */
ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 );
} }
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); return (ATOMTABLE *)((char *)ptr + ptr->atomtable);
} }
@ -339,6 +354,7 @@ static UINT32 ATOM_GetAtomName(
*/ */
WORD WINAPI InitAtomTable16( WORD entries ) WORD WINAPI InitAtomTable16( WORD entries )
{ {
if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */
return ATOM_InitTable( CURRENT_DS, entries ); return ATOM_InitTable( CURRENT_DS, entries );
} }

View File

@ -9,7 +9,7 @@
#include "ddeml.h" #include "ddeml.h"
#include "debug.h" #include "debug.h"
#include "atom.h" #include "windows.h"
/* FIXME: What are these values? */ /* FIXME: What are these values? */
#define DMLERR_NO_ERROR 0 #define DMLERR_NO_ERROR 0

View File

@ -18,7 +18,6 @@
#include "heap.h" #include "heap.h"
#include "win.h" #include "win.h"
#include "dce.h" #include "dce.h"
#include "atom.h"
#include "ldt.h" #include "ldt.h"
#include "toolhelp.h" #include "toolhelp.h"
#include "winproc.h" #include "winproc.h"

View File

@ -19,7 +19,6 @@
#include "input.h" #include "input.h"
#include "spy.h" #include "spy.h"
#include "winpos.h" #include "winpos.h"
#include "atom.h"
#include "dde.h" #include "dde.h"
#include "queue.h" #include "queue.h"
#include "winproc.h" #include "winproc.h"