forked from Mirrors/wine-wine
Moved global atoms to the server (based on the work of Sergei
Turchanov <turchanov@otvprim.ru>).oldstable
parent
4ecb75b050
commit
b849d79104
|
@ -69,8 +69,8 @@ file krnl386.exe
|
||||||
66 pascal16 AllocResource(word word long) AllocResource16
|
66 pascal16 AllocResource(word word long) AllocResource16
|
||||||
67 pascal SetResourceHandler(word segstr segptr) SetResourceHandler16
|
67 pascal SetResourceHandler(word segstr segptr) SetResourceHandler16
|
||||||
68 pascal16 InitAtomTable(word) InitAtomTable16
|
68 pascal16 InitAtomTable(word) InitAtomTable16
|
||||||
69 pascal16 FindAtom(segstr) FindAtom16
|
69 pascal16 FindAtom(str) FindAtom16
|
||||||
70 pascal16 AddAtom(segstr) AddAtom16
|
70 pascal16 AddAtom(str) AddAtom16
|
||||||
71 pascal16 DeleteAtom(word) DeleteAtom16
|
71 pascal16 DeleteAtom(word) DeleteAtom16
|
||||||
72 pascal16 GetAtomName(word ptr word) GetAtomName16
|
72 pascal16 GetAtomName(word ptr word) GetAtomName16
|
||||||
73 pascal16 GetAtomHandle(word) GetAtomHandle16
|
73 pascal16 GetAtomHandle(word) GetAtomHandle16
|
||||||
|
|
|
@ -51,7 +51,7 @@ file user.exe
|
||||||
47 pascal16 IsWindow(word) IsWindow16
|
47 pascal16 IsWindow(word) IsWindow16
|
||||||
48 pascal16 IsChild(word word) IsChild16
|
48 pascal16 IsChild(word word) IsChild16
|
||||||
49 pascal16 IsWindowVisible(word) IsWindowVisible16
|
49 pascal16 IsWindowVisible(word) IsWindowVisible16
|
||||||
50 pascal16 FindWindow(segstr str) FindWindow16
|
50 pascal16 FindWindow(str str) FindWindow16
|
||||||
51 stub BEAR51 # IsTwoByteCharPrefix
|
51 stub BEAR51 # IsTwoByteCharPrefix
|
||||||
52 pascal16 AnyPopup() AnyPopup16
|
52 pascal16 AnyPopup() AnyPopup16
|
||||||
53 pascal16 DestroyWindow(word) DestroyWindow16
|
53 pascal16 DestroyWindow(word) DestroyWindow16
|
||||||
|
@ -118,7 +118,7 @@ file user.exe
|
||||||
114 pascal DispatchMessage(ptr) DispatchMessage16
|
114 pascal DispatchMessage(ptr) DispatchMessage16
|
||||||
115 pascal16 ReplyMessage(long) ReplyMessage16
|
115 pascal16 ReplyMessage(long) ReplyMessage16
|
||||||
116 pascal16 PostAppMessage(word word word long) PostAppMessage16
|
116 pascal16 PostAppMessage(word word word long) PostAppMessage16
|
||||||
118 pascal16 RegisterWindowMessage(segstr) RegisterWindowMessage16
|
118 pascal16 RegisterWindowMessage(str) RegisterWindowMessageA
|
||||||
117 pascal16 WindowFromDC(word) WindowFromDC16
|
117 pascal16 WindowFromDC(word) WindowFromDC16
|
||||||
119 pascal GetMessagePos() GetMessagePos
|
119 pascal GetMessagePos() GetMessagePos
|
||||||
120 pascal GetMessageTime() GetMessageTime
|
120 pascal GetMessageTime() GetMessageTime
|
||||||
|
@ -273,10 +273,10 @@ file user.exe
|
||||||
265 pascal16 ShowOwnedPopups(word word) ShowOwnedPopups16
|
265 pascal16 ShowOwnedPopups(word word) ShowOwnedPopups16
|
||||||
266 pascal16 SetMessageQueue(word) SetMessageQueue16
|
266 pascal16 SetMessageQueue(word) SetMessageQueue16
|
||||||
267 pascal16 ShowScrollBar(word word word) ShowScrollBar16
|
267 pascal16 ShowScrollBar(word word word) ShowScrollBar16
|
||||||
268 pascal16 GlobalAddAtom(segstr) GlobalAddAtom16
|
268 pascal16 GlobalAddAtom(str) GlobalAddAtomA
|
||||||
269 pascal16 GlobalDeleteAtom(word) GlobalDeleteAtom
|
269 pascal16 GlobalDeleteAtom(word) GlobalDeleteAtom
|
||||||
270 pascal16 GlobalFindAtom(segstr) GlobalFindAtom16
|
270 pascal16 GlobalFindAtom(str) GlobalFindAtomA
|
||||||
271 pascal16 GlobalGetAtomName(word ptr s_word) GlobalGetAtomName16
|
271 pascal16 GlobalGetAtomName(word ptr s_word) GlobalGetAtomNameA
|
||||||
272 pascal16 IsZoomed(word) IsZoomed16
|
272 pascal16 IsZoomed(word) IsZoomed16
|
||||||
273 stub ControlPanelInfo
|
273 stub ControlPanelInfo
|
||||||
274 stub GetNextQueueWindow
|
274 stub GetNextQueueWindow
|
||||||
|
@ -366,12 +366,12 @@ file user.exe
|
||||||
394 pascal16 DrawIconEx(word word word word word word word word word) DrawIconEx16
|
394 pascal16 DrawIconEx(word word word word word word word word word) DrawIconEx16
|
||||||
395 pascal16 GetIconInfo(word ptr) GetIconInfo16
|
395 pascal16 GetIconInfo(word ptr) GetIconInfo16
|
||||||
397 pascal16 RegisterClassEx(ptr) RegisterClassEx16
|
397 pascal16 RegisterClassEx(ptr) RegisterClassEx16
|
||||||
398 pascal16 GetClassInfoEx(word segstr ptr) GetClassInfoEx16
|
398 pascal16 GetClassInfoEx(word str ptr) GetClassInfoEx16
|
||||||
399 pascal16 ChildWindowFromPointEx(word long word) ChildWindowFromPointEx16
|
399 pascal16 ChildWindowFromPointEx(word long word) ChildWindowFromPointEx16
|
||||||
400 pascal16 FinalUserInit() FinalUserInit16
|
400 pascal16 FinalUserInit() FinalUserInit16
|
||||||
402 pascal16 GetPriorityClipboardFormat(ptr s_word) GetPriorityClipboardFormat16
|
402 pascal16 GetPriorityClipboardFormat(ptr s_word) GetPriorityClipboardFormat16
|
||||||
403 pascal16 UnregisterClass(segstr word) UnregisterClass16
|
403 pascal16 UnregisterClass(str word) UnregisterClass16
|
||||||
404 pascal16 GetClassInfo(word segstr ptr) GetClassInfo16
|
404 pascal16 GetClassInfo(word str ptr) GetClassInfo16
|
||||||
406 pascal16 CreateCursor(word word word word word ptr ptr) CreateCursor16
|
406 pascal16 CreateCursor(word word word word word ptr ptr) CreateCursor16
|
||||||
407 pascal16 CreateIcon(word word word word word ptr ptr) CreateIcon16
|
407 pascal16 CreateIcon(word word word word word ptr ptr) CreateIcon16
|
||||||
408 pascal16 CreateCursorIconIndirect(word ptr ptr ptr)
|
408 pascal16 CreateCursorIconIndirect(word ptr ptr ptr)
|
||||||
|
@ -390,7 +390,7 @@ file user.exe
|
||||||
421 pascal16 wvsprintf(ptr str ptr) wvsprintf16
|
421 pascal16 wvsprintf(ptr str ptr) wvsprintf16
|
||||||
422 pascal16 DlgDirSelectEx(word ptr word word) DlgDirSelectEx16
|
422 pascal16 DlgDirSelectEx(word ptr word word) DlgDirSelectEx16
|
||||||
423 pascal16 DlgDirSelectComboBoxEx(word ptr word word) DlgDirSelectComboBoxEx16
|
423 pascal16 DlgDirSelectComboBoxEx(word ptr word word) DlgDirSelectComboBoxEx16
|
||||||
427 pascal16 FindWindowEx(word word segstr str) FindWindowEx16
|
427 pascal16 FindWindowEx(word word str str) FindWindowEx16
|
||||||
428 stub TileWindows
|
428 stub TileWindows
|
||||||
429 stub CascadeWindows
|
429 stub CascadeWindows
|
||||||
430 pascal16 lstrcmp(str str) lstrcmp16
|
430 pascal16 lstrcmp(str str) lstrcmp16
|
||||||
|
|
|
@ -1044,6 +1044,37 @@ struct get_selector_entry_request
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Add a global atom */
|
||||||
|
struct add_atom_request
|
||||||
|
{
|
||||||
|
OUT int atom; /* resulting atom */
|
||||||
|
IN WCHAR name[1]; /* atom name */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Delete a global atom */
|
||||||
|
struct delete_atom_request
|
||||||
|
{
|
||||||
|
IN int atom; /* atom handle */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Find a global atom */
|
||||||
|
struct find_atom_request
|
||||||
|
{
|
||||||
|
OUT int atom; /* atom handle */
|
||||||
|
IN WCHAR name[1]; /* atom name */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Get a global atom name */
|
||||||
|
struct get_atom_name_request
|
||||||
|
{
|
||||||
|
IN int atom; /* atom handle */
|
||||||
|
OUT int count; /* atom lock count */
|
||||||
|
OUT WCHAR name[1]; /* atom name */
|
||||||
|
};
|
||||||
|
|
||||||
/* Everything below this line is generated automatically by tools/make_requests */
|
/* Everything below this line is generated automatically by tools/make_requests */
|
||||||
/* ### make_requests begin ### */
|
/* ### make_requests begin ### */
|
||||||
|
|
||||||
|
@ -1142,6 +1173,10 @@ enum request
|
||||||
REQ_GET_THREAD_CONTEXT,
|
REQ_GET_THREAD_CONTEXT,
|
||||||
REQ_SET_THREAD_CONTEXT,
|
REQ_SET_THREAD_CONTEXT,
|
||||||
REQ_GET_SELECTOR_ENTRY,
|
REQ_GET_SELECTOR_ENTRY,
|
||||||
|
REQ_ADD_ATOM,
|
||||||
|
REQ_DELETE_ATOM,
|
||||||
|
REQ_FIND_ATOM,
|
||||||
|
REQ_GET_ATOM_NAME,
|
||||||
REQ_NB_REQUESTS
|
REQ_NB_REQUESTS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -107,14 +107,14 @@ VOID WINAPI hmemcpy16(LPVOID,LPCVOID,LONG);
|
||||||
#endif /* __WINE__ */
|
#endif /* __WINE__ */
|
||||||
|
|
||||||
INT16 WINAPI AccessResource16(HINSTANCE16,HRSRC16);
|
INT16 WINAPI AccessResource16(HINSTANCE16,HRSRC16);
|
||||||
ATOM WINAPI AddAtom16(SEGPTR);
|
ATOM WINAPI AddAtom16(LPCSTR);
|
||||||
BOOL16 WINAPI CreateDirectory16(LPCSTR,LPVOID);
|
BOOL16 WINAPI CreateDirectory16(LPCSTR,LPVOID);
|
||||||
BOOL16 WINAPI DefineHandleTable16(WORD);
|
BOOL16 WINAPI DefineHandleTable16(WORD);
|
||||||
ATOM WINAPI DeleteAtom16(ATOM);
|
ATOM WINAPI DeleteAtom16(ATOM);
|
||||||
BOOL16 WINAPI DeleteFile16(LPCSTR);
|
BOOL16 WINAPI DeleteFile16(LPCSTR);
|
||||||
void WINAPI ExitKernel16(void);
|
void WINAPI ExitKernel16(void);
|
||||||
void WINAPI FatalAppExit16(UINT16,LPCSTR);
|
void WINAPI FatalAppExit16(UINT16,LPCSTR);
|
||||||
ATOM WINAPI FindAtom16(SEGPTR);
|
ATOM WINAPI FindAtom16(LPCSTR);
|
||||||
BOOL16 WINAPI FindClose16(HANDLE16);
|
BOOL16 WINAPI FindClose16(HANDLE16);
|
||||||
HRSRC16 WINAPI FindResource16(HINSTANCE16,SEGPTR,SEGPTR);
|
HRSRC16 WINAPI FindResource16(HINSTANCE16,SEGPTR,SEGPTR);
|
||||||
BOOL16 WINAPI FreeModule16(HMODULE16);
|
BOOL16 WINAPI FreeModule16(HMODULE16);
|
||||||
|
|
|
@ -709,8 +709,8 @@ LONG WINAPI EscapeCommFunction16(UINT16,UINT16);
|
||||||
INT16 WINAPI ExcludeUpdateRgn16(HDC16,HWND16);
|
INT16 WINAPI ExcludeUpdateRgn16(HDC16,HWND16);
|
||||||
BOOL16 WINAPI ExitWindows16(DWORD,UINT16);
|
BOOL16 WINAPI ExitWindows16(DWORD,UINT16);
|
||||||
INT16 WINAPI FillRect16(HDC16,const RECT16*,HBRUSH16);
|
INT16 WINAPI FillRect16(HDC16,const RECT16*,HBRUSH16);
|
||||||
HWND16 WINAPI FindWindow16(SEGPTR,LPCSTR);
|
HWND16 WINAPI FindWindow16(LPCSTR,LPCSTR);
|
||||||
HWND16 WINAPI FindWindowEx16(HWND16,HWND16,SEGPTR,LPCSTR);
|
HWND16 WINAPI FindWindowEx16(HWND16,HWND16,LPCSTR,LPCSTR);
|
||||||
BOOL16 WINAPI FlashWindow16(HWND16,BOOL16);
|
BOOL16 WINAPI FlashWindow16(HWND16,BOOL16);
|
||||||
DWORD WINAPI FormatMessage16(DWORD,SEGPTR,WORD,WORD,LPSTR,WORD,LPDWORD);
|
DWORD WINAPI FormatMessage16(DWORD,SEGPTR,WORD,WORD,LPSTR,WORD,LPDWORD);
|
||||||
INT16 WINAPI FrameRect16(HDC16,const RECT16*,HBRUSH16);
|
INT16 WINAPI FrameRect16(HDC16,const RECT16*,HBRUSH16);
|
||||||
|
@ -719,8 +719,8 @@ WORD WINAPI GetAsyncKeyState16(INT16);
|
||||||
HWND16 WINAPI GetCapture16(void);
|
HWND16 WINAPI GetCapture16(void);
|
||||||
UINT16 WINAPI GetCaretBlinkTime16(void);
|
UINT16 WINAPI GetCaretBlinkTime16(void);
|
||||||
VOID WINAPI GetCaretPos16(LPPOINT16);
|
VOID WINAPI GetCaretPos16(LPPOINT16);
|
||||||
BOOL16 WINAPI GetClassInfo16(HINSTANCE16,SEGPTR,WNDCLASS16 *);
|
BOOL16 WINAPI GetClassInfo16(HINSTANCE16,LPCSTR,WNDCLASS16 *);
|
||||||
BOOL16 WINAPI GetClassInfoEx16(HINSTANCE16,SEGPTR,WNDCLASSEX16 *);
|
BOOL16 WINAPI GetClassInfoEx16(HINSTANCE16,LPCSTR,WNDCLASSEX16 *);
|
||||||
LONG WINAPI GetClassLong16(HWND16,INT16);
|
LONG WINAPI GetClassLong16(HWND16,INT16);
|
||||||
INT16 WINAPI GetClassName16(HWND16,LPSTR,INT16);
|
INT16 WINAPI GetClassName16(HWND16,LPSTR,INT16);
|
||||||
WORD WINAPI GetClassWord16(HWND16,INT16);
|
WORD WINAPI GetClassWord16(HWND16,INT16);
|
||||||
|
@ -789,9 +789,6 @@ HTASK16 WINAPI GetWindowTask16(HWND16);
|
||||||
INT16 WINAPI GetWindowText16(HWND16,SEGPTR,INT16);
|
INT16 WINAPI GetWindowText16(HWND16,SEGPTR,INT16);
|
||||||
INT16 WINAPI GetWindowTextLength16(HWND16);
|
INT16 WINAPI GetWindowTextLength16(HWND16);
|
||||||
WORD WINAPI GetWindowWord16(HWND16,INT16);
|
WORD WINAPI GetWindowWord16(HWND16,INT16);
|
||||||
ATOM WINAPI GlobalAddAtom16(SEGPTR);
|
|
||||||
ATOM WINAPI GlobalFindAtom16(SEGPTR);
|
|
||||||
UINT16 WINAPI GlobalGetAtomName16(ATOM,LPSTR,INT16);
|
|
||||||
VOID WINAPI HideCaret16(HWND16);
|
VOID WINAPI HideCaret16(HWND16);
|
||||||
BOOL16 WINAPI HiliteMenuItem16(HWND16,HMENU16,UINT16,UINT16);
|
BOOL16 WINAPI HiliteMenuItem16(HWND16,HMENU16,UINT16,UINT16);
|
||||||
void WINAPI InflateRect16(LPRECT16,INT16,INT16);
|
void WINAPI InflateRect16(LPRECT16,INT16,INT16);
|
||||||
|
@ -846,7 +843,6 @@ BOOL16 WINAPI RedrawWindow16(HWND16,const RECT16*,HRGN16,UINT16);
|
||||||
ATOM WINAPI RegisterClass16(const WNDCLASS16*);
|
ATOM WINAPI RegisterClass16(const WNDCLASS16*);
|
||||||
ATOM WINAPI RegisterClassEx16(const WNDCLASSEX16*);
|
ATOM WINAPI RegisterClassEx16(const WNDCLASSEX16*);
|
||||||
UINT16 WINAPI RegisterClipboardFormat16(LPCSTR);
|
UINT16 WINAPI RegisterClipboardFormat16(LPCSTR);
|
||||||
WORD WINAPI RegisterWindowMessage16(SEGPTR);
|
|
||||||
INT16 WINAPI ReleaseDC16(HWND16,HDC16);
|
INT16 WINAPI ReleaseDC16(HWND16,HDC16);
|
||||||
BOOL16 WINAPI RemoveMenu16(HMENU16,UINT16,UINT16);
|
BOOL16 WINAPI RemoveMenu16(HMENU16,UINT16,UINT16);
|
||||||
HANDLE16 WINAPI RemoveProp16(HWND16,LPCSTR);
|
HANDLE16 WINAPI RemoveProp16(HWND16,LPCSTR);
|
||||||
|
@ -917,7 +913,7 @@ BOOL16 WINAPI TranslateMessage16(const MSG16*);
|
||||||
BOOL16 WINAPI TranslateMessage32_16(const MSG32_16*,BOOL16);
|
BOOL16 WINAPI TranslateMessage32_16(const MSG32_16*,BOOL16);
|
||||||
INT16 WINAPI TransmitCommChar16(INT16,CHAR);
|
INT16 WINAPI TransmitCommChar16(INT16,CHAR);
|
||||||
BOOL16 WINAPI UnionRect16(LPRECT16,const RECT16*,const RECT16*);
|
BOOL16 WINAPI UnionRect16(LPRECT16,const RECT16*,const RECT16*);
|
||||||
BOOL16 WINAPI UnregisterClass16(SEGPTR,HINSTANCE16);
|
BOOL16 WINAPI UnregisterClass16(LPCSTR,HINSTANCE16);
|
||||||
VOID WINAPI UpdateWindow16(HWND16);
|
VOID WINAPI UpdateWindow16(HWND16);
|
||||||
VOID WINAPI ValidateRect16(HWND16,const RECT16*);
|
VOID WINAPI ValidateRect16(HWND16,const RECT16*);
|
||||||
VOID WINAPI ValidateRgn16(HWND16,HRGN16);
|
VOID WINAPI ValidateRgn16(HWND16,HRGN16);
|
||||||
|
|
749
memory/atom.c
749
memory/atom.c
|
@ -21,14 +21,15 @@
|
||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "wine/winbase16.h"
|
#include "wine/winbase16.h"
|
||||||
#include "wine/winuser16.h"
|
#include "wine/winuser16.h"
|
||||||
#include "global.h"
|
#include "winerror.h"
|
||||||
#include "instance.h"
|
#include "instance.h"
|
||||||
#include "ldt.h"
|
#include "ldt.h"
|
||||||
#include "stackframe.h"
|
#include "stackframe.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "debugtools.h"
|
#include "debugtools.h"
|
||||||
|
#include "server.h"
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(atom)
|
DEFAULT_DEBUG_CHANNEL(atom);
|
||||||
|
|
||||||
#define DEFAULT_ATOMTABLE_SIZE 37
|
#define DEFAULT_ATOMTABLE_SIZE 37
|
||||||
#define MIN_STR_ATOM 0xc000
|
#define MIN_STR_ATOM 0xc000
|
||||||
|
@ -37,12 +38,6 @@ DEFAULT_DEBUG_CHANNEL(atom)
|
||||||
#define ATOMTOHANDLE(atom) ((HANDLE16)(atom) << 2)
|
#define ATOMTOHANDLE(atom) ((HANDLE16)(atom) << 2)
|
||||||
#define HANDLETOATOM(handle) ((ATOM)(0xc000 | ((handle) >> 2)))
|
#define HANDLETOATOM(handle) ((ATOM)(0xc000 | ((handle) >> 2)))
|
||||||
|
|
||||||
#define HAS_ATOM_TABLE(sel) \
|
|
||||||
((INSTANCEDATA*)PTR_SEG_OFF_TO_LIN(sel,0))->atomtable != 0)
|
|
||||||
|
|
||||||
#define GET_ATOM_TABLE(sel) ((ATOMTABLE*)PTR_SEG_OFF_TO_LIN(sel, \
|
|
||||||
((INSTANCEDATA*)PTR_SEG_OFF_TO_LIN(sel,0))->atomtable))
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
HANDLE16 next;
|
HANDLE16 next;
|
||||||
|
@ -57,49 +52,7 @@ typedef struct
|
||||||
HANDLE16 entries[1];
|
HANDLE16 entries[1];
|
||||||
} ATOMTABLE;
|
} ATOMTABLE;
|
||||||
|
|
||||||
static WORD ATOM_GlobalTable = 0;
|
static WORD ATOM_UserDS = 0; /* USER data segment */
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* ATOM_InitTable
|
|
||||||
*
|
|
||||||
* NOTES
|
|
||||||
* Should this validate the value of entries to be 0 < x < 0x3fff?
|
|
||||||
*
|
|
||||||
* RETURNS
|
|
||||||
* Handle: Success
|
|
||||||
* 0: Failure
|
|
||||||
*/
|
|
||||||
static HANDLE16 ATOM_InitTable(
|
|
||||||
WORD selector, /* [in] Segment */
|
|
||||||
WORD entries /* [in] Size of atom table */
|
|
||||||
) {
|
|
||||||
int i;
|
|
||||||
HANDLE16 handle;
|
|
||||||
ATOMTABLE *table;
|
|
||||||
|
|
||||||
/* We consider the first table to be initialized as the global table.
|
|
||||||
* This works, as USER (both built-in and native) is the first one to
|
|
||||||
* register ...
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!ATOM_GlobalTable) ATOM_GlobalTable = selector;
|
|
||||||
|
|
||||||
|
|
||||||
/* Allocate the table */
|
|
||||||
|
|
||||||
handle = LOCAL_Alloc( selector, LMEM_FIXED,
|
|
||||||
sizeof(ATOMTABLE) + (entries-1) * sizeof(HANDLE16) );
|
|
||||||
if (!handle) return 0;
|
|
||||||
table = (ATOMTABLE *)PTR_SEG_OFF_TO_LIN( selector, handle );
|
|
||||||
table->size = entries;
|
|
||||||
for (i = 0; i < entries; i++) table->entries[i] = 0;
|
|
||||||
|
|
||||||
/* Store a pointer to the table in the instance data */
|
|
||||||
|
|
||||||
((INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 ))->atomtable = handle;
|
|
||||||
return handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ATOM_Init
|
* ATOM_Init
|
||||||
|
@ -108,7 +61,8 @@ static HANDLE16 ATOM_InitTable(
|
||||||
*/
|
*/
|
||||||
BOOL ATOM_Init( WORD globalTableSel )
|
BOOL ATOM_Init( WORD globalTableSel )
|
||||||
{
|
{
|
||||||
return ATOM_InitTable( globalTableSel, DEFAULT_ATOMTABLE_SIZE ) != 0;
|
ATOM_UserDS = globalTableSel;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -122,37 +76,22 @@ BOOL ATOM_Init( WORD globalTableSel )
|
||||||
* Pointer to table: Success
|
* Pointer to table: Success
|
||||||
* NULL: Failure
|
* NULL: Failure
|
||||||
*/
|
*/
|
||||||
static ATOMTABLE *ATOM_GetTable(
|
static ATOMTABLE *ATOM_GetTable( BOOL create /* [in] Create */ )
|
||||||
WORD selector, /* [in] Segment */
|
|
||||||
BOOL create /* [in] Create */ )
|
|
||||||
{
|
{
|
||||||
INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 );
|
INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 );
|
||||||
if (ptr->atomtable)
|
if (ptr->atomtable)
|
||||||
{
|
{
|
||||||
ATOMTABLE *table = (ATOMTABLE *)((char *)ptr + ptr->atomtable);
|
ATOMTABLE *table = (ATOMTABLE *)((char *)ptr + ptr->atomtable);
|
||||||
if (table->size) return table;
|
if (table->size) return table;
|
||||||
}
|
}
|
||||||
if (!create) return NULL;
|
if (!create) return NULL;
|
||||||
if (!ATOM_InitTable( selector, DEFAULT_ATOMTABLE_SIZE )) return NULL;
|
if (!InitAtomTable16( 0 )) return NULL;
|
||||||
/* Reload ptr in case it moved in linear memory */
|
/* Reload ptr in case it moved in linear memory */
|
||||||
ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 );
|
ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 );
|
||||||
return (ATOMTABLE *)((char *)ptr + ptr->atomtable);
|
return (ATOMTABLE *)((char *)ptr + ptr->atomtable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* ATOM_MakePtr
|
|
||||||
*
|
|
||||||
* Make an ATOMENTRY pointer from a handle (obtained from GetAtomHandle()).
|
|
||||||
*/
|
|
||||||
static ATOMENTRY *ATOM_MakePtr(
|
|
||||||
WORD selector, /* [in] Segment */
|
|
||||||
HANDLE16 handle /* [in] Handle */
|
|
||||||
) {
|
|
||||||
return (ATOMENTRY *)PTR_SEG_OFF_TO_LIN( selector, handle );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ATOM_Hash
|
* ATOM_Hash
|
||||||
* RETURNS
|
* RETURNS
|
||||||
|
@ -171,206 +110,69 @@ static WORD ATOM_Hash(
|
||||||
return hash % entries;
|
return hash % entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL ATOM_IsIntAtom(LPCSTR atomstr,WORD *atomid) {
|
|
||||||
LPSTR xend;
|
|
||||||
|
|
||||||
if (!HIWORD(atomstr)) {
|
|
||||||
*atomid = LOWORD(atomstr);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
if (atomstr[0]!='#')
|
|
||||||
return FALSE;
|
|
||||||
*atomid=strtol(atomstr+1,&xend,10);
|
|
||||||
if (*xend) {
|
|
||||||
/* atom has a name like '## some name ##' */
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* ATOM_AddAtom
|
* ATOM_IsIntAtomA
|
||||||
*
|
|
||||||
* Windows DWORD aligns the atom entry size.
|
|
||||||
* The remaining unused string space created by the alignment
|
|
||||||
* gets padded with '\0's in a certain way to ensure
|
|
||||||
* that at least one trailing '\0' remains.
|
|
||||||
*
|
|
||||||
* RETURNS
|
|
||||||
* Atom: Success
|
|
||||||
* 0: Failure
|
|
||||||
*/
|
*/
|
||||||
static ATOM ATOM_AddAtom(
|
static BOOL ATOM_IsIntAtomA(LPCSTR atomstr,WORD *atomid)
|
||||||
WORD selector, /* [in] Segment */
|
{
|
||||||
LPCSTR str /* [in] Pointer to the string to add */
|
UINT atom = 0;
|
||||||
) {
|
if (!HIWORD(atomstr)) atom = LOWORD(atomstr);
|
||||||
WORD hash;
|
|
||||||
HANDLE16 entry;
|
|
||||||
ATOMENTRY * entryPtr;
|
|
||||||
ATOMTABLE * table;
|
|
||||||
int len, ae_len;
|
|
||||||
WORD iatom;
|
|
||||||
|
|
||||||
TRACE("0x%x, %s\n", selector, str);
|
|
||||||
|
|
||||||
if (ATOM_IsIntAtom(str,&iatom))
|
|
||||||
return iatom;
|
|
||||||
if ((len = strlen( str )) > MAX_ATOM_LEN) len = MAX_ATOM_LEN;
|
|
||||||
if (!(table = ATOM_GetTable( selector, TRUE ))) return 0;
|
|
||||||
hash = ATOM_Hash( table->size, str, len );
|
|
||||||
entry = table->entries[hash];
|
|
||||||
while (entry)
|
|
||||||
{
|
|
||||||
entryPtr = ATOM_MakePtr( selector, entry );
|
|
||||||
if ((entryPtr->length == len) &&
|
|
||||||
(!lstrncmpiA( entryPtr->str, str, len )))
|
|
||||||
{
|
|
||||||
entryPtr->refCount++;
|
|
||||||
TRACE("-- existing 0x%x\n", entry);
|
|
||||||
return HANDLETOATOM( entry );
|
|
||||||
}
|
|
||||||
entry = entryPtr->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
ae_len = (sizeof(ATOMENTRY)+len+3) & ~3;
|
|
||||||
entry = LOCAL_Alloc( selector, LMEM_FIXED, ae_len);
|
|
||||||
if (!entry) return 0;
|
|
||||||
/* Reload the table ptr in case it moved in linear memory */
|
|
||||||
table = ATOM_GetTable( selector, FALSE );
|
|
||||||
entryPtr = ATOM_MakePtr( selector, entry );
|
|
||||||
entryPtr->next = table->entries[hash];
|
|
||||||
entryPtr->refCount = 1;
|
|
||||||
entryPtr->length = len;
|
|
||||||
/* Some applications _need_ the '\0' padding provided by this strncpy */
|
|
||||||
strncpy( entryPtr->str, str, ae_len - sizeof(ATOMENTRY) + 1 );
|
|
||||||
entryPtr->str[ae_len - sizeof(ATOMENTRY)] = '\0';
|
|
||||||
table->entries[hash] = entry;
|
|
||||||
TRACE("-- new 0x%x\n", entry);
|
|
||||||
return HANDLETOATOM( entry );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* ATOM_DeleteAtom
|
|
||||||
* RETURNS
|
|
||||||
* 0: Success
|
|
||||||
* Atom: Failure
|
|
||||||
*/
|
|
||||||
static ATOM ATOM_DeleteAtom(
|
|
||||||
WORD selector, /* [in] Segment */
|
|
||||||
ATOM atom /* [in] Atom to delete */
|
|
||||||
) {
|
|
||||||
ATOMENTRY * entryPtr;
|
|
||||||
ATOMTABLE * table;
|
|
||||||
HANDLE16 entry, *prevEntry;
|
|
||||||
WORD hash;
|
|
||||||
|
|
||||||
TRACE("0x%x, 0x%x\n", selector, atom);
|
|
||||||
|
|
||||||
if (atom < MIN_STR_ATOM) return 0; /* Integer atom */
|
|
||||||
|
|
||||||
if (!(table = ATOM_GetTable( selector, FALSE ))) return 0;
|
|
||||||
entry = ATOMTOHANDLE( atom );
|
|
||||||
entryPtr = ATOM_MakePtr( selector, entry );
|
|
||||||
|
|
||||||
/* Find previous atom */
|
|
||||||
hash = ATOM_Hash( table->size, entryPtr->str, entryPtr->length );
|
|
||||||
prevEntry = &table->entries[hash];
|
|
||||||
while (*prevEntry && *prevEntry != entry)
|
|
||||||
{
|
|
||||||
ATOMENTRY * prevEntryPtr = ATOM_MakePtr( selector, *prevEntry );
|
|
||||||
prevEntry = &prevEntryPtr->next;
|
|
||||||
}
|
|
||||||
if (!*prevEntry) return atom;
|
|
||||||
|
|
||||||
/* Delete atom */
|
|
||||||
if (--entryPtr->refCount == 0)
|
|
||||||
{
|
|
||||||
*prevEntry = entryPtr->next;
|
|
||||||
LOCAL_Free( selector, entry );
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* ATOM_FindAtom
|
|
||||||
* RETURNS
|
|
||||||
* Atom: Success
|
|
||||||
* 0: Failure
|
|
||||||
*/
|
|
||||||
static ATOM ATOM_FindAtom(
|
|
||||||
WORD selector, /* [in] Segment */
|
|
||||||
LPCSTR str /* [in] Pointer to string to find */
|
|
||||||
) {
|
|
||||||
ATOMTABLE * table;
|
|
||||||
WORD hash,iatom;
|
|
||||||
HANDLE16 entry;
|
|
||||||
int len;
|
|
||||||
|
|
||||||
TRACE("%x, %s\n", selector, str);
|
|
||||||
if (ATOM_IsIntAtom(str,&iatom))
|
|
||||||
return iatom;
|
|
||||||
if ((len = strlen( str )) > 255) len = 255;
|
|
||||||
if (!(table = ATOM_GetTable( selector, FALSE ))) return 0;
|
|
||||||
hash = ATOM_Hash( table->size, str, len );
|
|
||||||
entry = table->entries[hash];
|
|
||||||
while (entry)
|
|
||||||
{
|
|
||||||
ATOMENTRY * entryPtr = ATOM_MakePtr( selector, entry );
|
|
||||||
if ((entryPtr->length == len) &&
|
|
||||||
(!lstrncmpiA( entryPtr->str, str, len )))
|
|
||||||
{ TRACE("-- found %x\n", entry);
|
|
||||||
return HANDLETOATOM( entry );
|
|
||||||
}
|
|
||||||
entry = entryPtr->next;
|
|
||||||
}
|
|
||||||
TRACE("-- not found\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* ATOM_GetAtomName
|
|
||||||
* RETURNS
|
|
||||||
* Length of string copied to buffer: Success
|
|
||||||
* 0: Failure
|
|
||||||
*/
|
|
||||||
static UINT ATOM_GetAtomName(
|
|
||||||
WORD selector, /* [in] Segment */
|
|
||||||
ATOM atom, /* [in] Atom identifier */
|
|
||||||
LPSTR buffer, /* [out] Pointer to buffer for atom string */
|
|
||||||
INT count /* [in] Size of buffer */
|
|
||||||
) {
|
|
||||||
ATOMTABLE * table;
|
|
||||||
ATOMENTRY * entryPtr;
|
|
||||||
HANDLE16 entry;
|
|
||||||
char * strPtr;
|
|
||||||
UINT len;
|
|
||||||
char text[8];
|
|
||||||
|
|
||||||
TRACE("%x, %x\n", selector, atom);
|
|
||||||
|
|
||||||
if (!count) return 0;
|
|
||||||
if (atom < MIN_STR_ATOM)
|
|
||||||
{
|
|
||||||
sprintf( text, "#%d", atom );
|
|
||||||
len = strlen(text);
|
|
||||||
strPtr = text;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(table = ATOM_GetTable( selector, FALSE ))) return 0;
|
if (*atomstr++ != '#') return FALSE;
|
||||||
entry = ATOMTOHANDLE( atom );
|
while (*atomstr >= '0' && *atomstr <= '9')
|
||||||
entryPtr = ATOM_MakePtr( selector, entry );
|
{
|
||||||
len = entryPtr->length;
|
atom = atom * 10 + *atomstr - '0';
|
||||||
strPtr = entryPtr->str;
|
atomstr++;
|
||||||
|
}
|
||||||
|
if (*atomstr) return FALSE;
|
||||||
}
|
}
|
||||||
if (len >= count) len = count-1;
|
if (!atom || (atom >= MIN_STR_ATOM))
|
||||||
memcpy( buffer, strPtr, len );
|
{
|
||||||
buffer[len] = '\0';
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
return len;
|
atom = 0;
|
||||||
|
}
|
||||||
|
*atomid = atom;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* ATOM_IsIntAtomW
|
||||||
|
*/
|
||||||
|
static BOOL ATOM_IsIntAtomW(LPCWSTR atomstr,WORD *atomid)
|
||||||
|
{
|
||||||
|
UINT atom = 0;
|
||||||
|
if (!HIWORD(atomstr)) atom = LOWORD(atomstr);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (*atomstr++ != '#') return FALSE;
|
||||||
|
while (*atomstr >= '0' && *atomstr <= '9')
|
||||||
|
{
|
||||||
|
atom = atom * 10 + *atomstr - '0';
|
||||||
|
atomstr++;
|
||||||
|
}
|
||||||
|
if (*atomstr) return FALSE;
|
||||||
|
}
|
||||||
|
if (!atom || (atom >= MIN_STR_ATOM))
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
atom = 0;
|
||||||
|
}
|
||||||
|
*atomid = atom;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* ATOM_MakePtr
|
||||||
|
*
|
||||||
|
* Make an ATOMENTRY pointer from a handle (obtained from GetAtomHandle()).
|
||||||
|
*/
|
||||||
|
static inline ATOMENTRY *ATOM_MakePtr( HANDLE16 handle /* [in] Handle */ )
|
||||||
|
{
|
||||||
|
return (ATOMENTRY *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, handle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,8 +181,35 @@ static UINT ATOM_GetAtomName(
|
||||||
*/
|
*/
|
||||||
WORD WINAPI InitAtomTable16( WORD entries )
|
WORD WINAPI InitAtomTable16( WORD entries )
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
HANDLE16 handle;
|
||||||
|
ATOMTABLE *table;
|
||||||
|
|
||||||
|
/* We consider the first table to be initialized as the global table.
|
||||||
|
* This works, as USER (both built-in and native) is the first one to
|
||||||
|
* register ...
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!ATOM_UserDS)
|
||||||
|
{
|
||||||
|
ATOM_UserDS = CURRENT_DS;
|
||||||
|
/* return dummy local handle */
|
||||||
|
return LocalAlloc16( LMEM_FIXED, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Allocate the table */
|
||||||
|
|
||||||
if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */
|
if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */
|
||||||
return ATOM_InitTable( CURRENT_DS, entries );
|
handle = LocalAlloc16( LMEM_FIXED, sizeof(ATOMTABLE) + (entries-1) * sizeof(HANDLE16) );
|
||||||
|
if (!handle) return 0;
|
||||||
|
table = (ATOMTABLE *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, handle );
|
||||||
|
table->size = entries;
|
||||||
|
for (i = 0; i < entries; i++) table->entries[i] = 0;
|
||||||
|
|
||||||
|
/* Store a pointer to the table in the instance data */
|
||||||
|
|
||||||
|
((INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( CURRENT_DS, 0 ))->atomtable = handle;
|
||||||
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -396,23 +225,178 @@ HANDLE16 WINAPI GetAtomHandle16( ATOM atom )
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* AddAtom16 (KERNEL.70)
|
* AddAtom16 (KERNEL.70)
|
||||||
|
*
|
||||||
|
* Windows DWORD aligns the atom entry size.
|
||||||
|
* The remaining unused string space created by the alignment
|
||||||
|
* gets padded with '\0's in a certain way to ensure
|
||||||
|
* that at least one trailing '\0' remains.
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* Atom: Success
|
||||||
|
* 0: Failure
|
||||||
*/
|
*/
|
||||||
ATOM WINAPI AddAtom16( SEGPTR str )
|
ATOM WINAPI AddAtom16( LPCSTR str )
|
||||||
{
|
{
|
||||||
ATOM atom;
|
char buffer[MAX_ATOM_LEN+1];
|
||||||
HANDLE16 ds = CURRENT_DS;
|
WORD hash;
|
||||||
|
HANDLE16 entry;
|
||||||
|
ATOMENTRY * entryPtr;
|
||||||
|
ATOMTABLE * table;
|
||||||
|
int len, ae_len;
|
||||||
|
WORD iatom;
|
||||||
|
|
||||||
if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */
|
if (CURRENT_DS == ATOM_UserDS) return GlobalAddAtomA( str );
|
||||||
if (SELECTOR_TO_ENTRY(LOWORD(str)) == SELECTOR_TO_ENTRY(ds))
|
if (ATOM_IsIntAtomA( str, &iatom )) return iatom;
|
||||||
|
|
||||||
|
TRACE("%s\n",debugstr_a(buffer));
|
||||||
|
|
||||||
|
/* Make a copy of the string to be sure it doesn't move in linear memory. */
|
||||||
|
lstrcpynA( buffer, str, sizeof(buffer) );
|
||||||
|
|
||||||
|
len = strlen( buffer );
|
||||||
|
if (!(table = ATOM_GetTable( TRUE ))) return 0;
|
||||||
|
hash = ATOM_Hash( table->size, buffer, len );
|
||||||
|
entry = table->entries[hash];
|
||||||
|
while (entry)
|
||||||
{
|
{
|
||||||
/* If the string is in the same data segment as the atom table, make */
|
entryPtr = ATOM_MakePtr( entry );
|
||||||
/* a copy of the string to be sure it doesn't move in linear memory. */
|
if ((entryPtr->length == len) &&
|
||||||
char buffer[MAX_ATOM_LEN+1];
|
(!lstrncmpiA( entryPtr->str, buffer, len )))
|
||||||
lstrcpynA( buffer, (char *)PTR_SEG_TO_LIN(str), sizeof(buffer) );
|
{
|
||||||
atom = ATOM_AddAtom( ds, buffer );
|
entryPtr->refCount++;
|
||||||
|
TRACE("-- existing 0x%x\n", entry);
|
||||||
|
return HANDLETOATOM( entry );
|
||||||
|
}
|
||||||
|
entry = entryPtr->next;
|
||||||
}
|
}
|
||||||
else atom = ATOM_AddAtom( ds, (LPCSTR)PTR_SEG_TO_LIN(str) );
|
|
||||||
return atom;
|
ae_len = (sizeof(ATOMENTRY)+len+3) & ~3;
|
||||||
|
entry = LocalAlloc16( LMEM_FIXED, ae_len );
|
||||||
|
if (!entry) return 0;
|
||||||
|
/* Reload the table ptr in case it moved in linear memory */
|
||||||
|
table = ATOM_GetTable( FALSE );
|
||||||
|
entryPtr = ATOM_MakePtr( entry );
|
||||||
|
entryPtr->next = table->entries[hash];
|
||||||
|
entryPtr->refCount = 1;
|
||||||
|
entryPtr->length = len;
|
||||||
|
/* Some applications _need_ the '\0' padding provided by this strncpy */
|
||||||
|
strncpy( entryPtr->str, buffer, ae_len - sizeof(ATOMENTRY) + 1 );
|
||||||
|
entryPtr->str[ae_len - sizeof(ATOMENTRY)] = '\0';
|
||||||
|
table->entries[hash] = entry;
|
||||||
|
TRACE("-- new 0x%x\n", entry);
|
||||||
|
return HANDLETOATOM( entry );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* DeleteAtom16 (KERNEL.71)
|
||||||
|
*/
|
||||||
|
ATOM WINAPI DeleteAtom16( ATOM atom )
|
||||||
|
{
|
||||||
|
ATOMENTRY * entryPtr;
|
||||||
|
ATOMTABLE * table;
|
||||||
|
HANDLE16 entry, *prevEntry;
|
||||||
|
WORD hash;
|
||||||
|
|
||||||
|
if (atom < MIN_STR_ATOM) return 0; /* Integer atom */
|
||||||
|
if (CURRENT_DS == ATOM_UserDS) return GlobalDeleteAtom( atom );
|
||||||
|
|
||||||
|
TRACE("0x%x\n",atom);
|
||||||
|
|
||||||
|
if (!(table = ATOM_GetTable( FALSE ))) return 0;
|
||||||
|
entry = ATOMTOHANDLE( atom );
|
||||||
|
entryPtr = ATOM_MakePtr( entry );
|
||||||
|
|
||||||
|
/* Find previous atom */
|
||||||
|
hash = ATOM_Hash( table->size, entryPtr->str, entryPtr->length );
|
||||||
|
prevEntry = &table->entries[hash];
|
||||||
|
while (*prevEntry && *prevEntry != entry)
|
||||||
|
{
|
||||||
|
ATOMENTRY * prevEntryPtr = ATOM_MakePtr( *prevEntry );
|
||||||
|
prevEntry = &prevEntryPtr->next;
|
||||||
|
}
|
||||||
|
if (!*prevEntry) return atom;
|
||||||
|
|
||||||
|
/* Delete atom */
|
||||||
|
if (--entryPtr->refCount == 0)
|
||||||
|
{
|
||||||
|
*prevEntry = entryPtr->next;
|
||||||
|
LocalFree16( entry );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* FindAtom16 (KERNEL.69)
|
||||||
|
*/
|
||||||
|
ATOM WINAPI FindAtom16( LPCSTR str )
|
||||||
|
{
|
||||||
|
ATOMTABLE * table;
|
||||||
|
WORD hash,iatom;
|
||||||
|
HANDLE16 entry;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if (CURRENT_DS == ATOM_UserDS) return GlobalFindAtomA( str );
|
||||||
|
|
||||||
|
TRACE("%s\n",debugres_a(str));
|
||||||
|
|
||||||
|
if (ATOM_IsIntAtomA( str, &iatom )) return iatom;
|
||||||
|
if ((len = strlen( str )) > 255) len = 255;
|
||||||
|
if (!(table = ATOM_GetTable( FALSE ))) return 0;
|
||||||
|
hash = ATOM_Hash( table->size, str, len );
|
||||||
|
entry = table->entries[hash];
|
||||||
|
while (entry)
|
||||||
|
{
|
||||||
|
ATOMENTRY * entryPtr = ATOM_MakePtr( entry );
|
||||||
|
if ((entryPtr->length == len) &&
|
||||||
|
(!lstrncmpiA( entryPtr->str, str, len )))
|
||||||
|
{
|
||||||
|
TRACE("-- found %x\n", entry);
|
||||||
|
return HANDLETOATOM( entry );
|
||||||
|
}
|
||||||
|
entry = entryPtr->next;
|
||||||
|
}
|
||||||
|
TRACE("-- not found\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* GetAtomName16 (KERNEL.72)
|
||||||
|
*/
|
||||||
|
UINT16 WINAPI GetAtomName16( ATOM atom, LPSTR buffer, INT16 count )
|
||||||
|
{
|
||||||
|
ATOMTABLE * table;
|
||||||
|
ATOMENTRY * entryPtr;
|
||||||
|
HANDLE16 entry;
|
||||||
|
char * strPtr;
|
||||||
|
UINT len;
|
||||||
|
char text[8];
|
||||||
|
|
||||||
|
if (CURRENT_DS == ATOM_UserDS) return GlobalGetAtomNameA( atom, buffer, count );
|
||||||
|
|
||||||
|
TRACE("%x\n",atom);
|
||||||
|
|
||||||
|
if (!count) return 0;
|
||||||
|
if (atom < MIN_STR_ATOM)
|
||||||
|
{
|
||||||
|
sprintf( text, "#%d", atom );
|
||||||
|
len = strlen(text);
|
||||||
|
strPtr = text;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!(table = ATOM_GetTable( FALSE ))) return 0;
|
||||||
|
entry = ATOMTOHANDLE( atom );
|
||||||
|
entryPtr = ATOM_MakePtr( entry );
|
||||||
|
len = entryPtr->length;
|
||||||
|
strPtr = entryPtr->str;
|
||||||
|
}
|
||||||
|
if (len >= count) len = count-1;
|
||||||
|
memcpy( buffer, strPtr, len );
|
||||||
|
buffer[len] = '\0';
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -442,15 +426,6 @@ ATOM WINAPI AddAtomW( LPCWSTR str )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* DeleteAtom16 (KERNEL.71)
|
|
||||||
*/
|
|
||||||
ATOM WINAPI DeleteAtom16( ATOM atom )
|
|
||||||
{
|
|
||||||
return ATOM_DeleteAtom( CURRENT_DS, atom );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DeleteAtom32 (KERNEL32.69)
|
* DeleteAtom32 (KERNEL32.69)
|
||||||
* Decrements the reference count of a string atom. If count becomes
|
* Decrements the reference count of a string atom. If count becomes
|
||||||
|
@ -467,16 +442,6 @@ ATOM WINAPI DeleteAtom(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* FindAtom16 (KERNEL.69)
|
|
||||||
*/
|
|
||||||
ATOM WINAPI FindAtom16( SEGPTR str )
|
|
||||||
{
|
|
||||||
if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */
|
|
||||||
return ATOM_FindAtom( CURRENT_DS, (LPCSTR)PTR_SEG_TO_LIN(str) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* FindAtom32A (KERNEL32.117)
|
* FindAtom32A (KERNEL32.117)
|
||||||
* Searches the local atom table for the string and returns the atom
|
* Searches the local atom table for the string and returns the atom
|
||||||
|
@ -503,15 +468,6 @@ ATOM WINAPI FindAtomW( LPCWSTR str )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* GetAtomName16 (KERNEL.72)
|
|
||||||
*/
|
|
||||||
UINT16 WINAPI GetAtomName16( ATOM atom, LPSTR buffer, INT16 count )
|
|
||||||
{
|
|
||||||
return (UINT16)ATOM_GetAtomName( CURRENT_DS, atom, buffer, count );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetAtomName32A (KERNEL32.149)
|
* GetAtomName32A (KERNEL32.149)
|
||||||
* Retrieves a copy of the string associated with the atom.
|
* Retrieves a copy of the string associated with the atom.
|
||||||
|
@ -540,17 +496,8 @@ UINT WINAPI GetAtomNameW( ATOM atom, LPWSTR buffer, INT count )
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GlobalAddAtom16 (USER.268)
|
* GlobalAddAtomA (USER.268) (KERNEL32.313)
|
||||||
*/
|
*
|
||||||
ATOM WINAPI GlobalAddAtom16( SEGPTR str )
|
|
||||||
{
|
|
||||||
if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */
|
|
||||||
return ATOM_AddAtom( ATOM_GlobalTable, (LPCSTR)PTR_SEG_TO_LIN(str) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* GlobalAddAtom32A (KERNEL32.313)
|
|
||||||
* Adds a character string to the global atom table and returns a unique
|
* Adds a character string to the global atom table and returns a unique
|
||||||
* value identifying the string.
|
* value identifying the string.
|
||||||
*
|
*
|
||||||
|
@ -558,24 +505,34 @@ ATOM WINAPI GlobalAddAtom16( SEGPTR str )
|
||||||
* Atom: Success
|
* Atom: Success
|
||||||
* 0: Failure
|
* 0: Failure
|
||||||
*/
|
*/
|
||||||
ATOM WINAPI GlobalAddAtomA(
|
ATOM WINAPI GlobalAddAtomA( LPCSTR str /* [in] Pointer to string to add */ )
|
||||||
LPCSTR str /* [in] Pointer to string to add */
|
{
|
||||||
) {
|
ATOM atom = 0;
|
||||||
if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */
|
if (!ATOM_IsIntAtomA( str, &atom ))
|
||||||
return ATOM_AddAtom( ATOM_GlobalTable, str );
|
{
|
||||||
|
struct add_atom_request *req = get_req_buffer();
|
||||||
|
server_strcpyAtoW( req->name, str );
|
||||||
|
if (!server_call( REQ_ADD_ATOM )) atom = req->atom + MIN_STR_ATOM;
|
||||||
|
}
|
||||||
|
TRACE( "%s -> %x\n", debugres_a(str), atom );
|
||||||
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GlobalAddAtom32W (KERNEL32.314)
|
* GlobalAddAtomW (KERNEL32.314)
|
||||||
* See GlobalAddAtom32A
|
|
||||||
*/
|
*/
|
||||||
ATOM WINAPI GlobalAddAtomW( LPCWSTR str )
|
ATOM WINAPI GlobalAddAtomW( LPCWSTR str )
|
||||||
{
|
{
|
||||||
char buffer[MAX_ATOM_LEN+1];
|
ATOM atom = 0;
|
||||||
if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */
|
if (!ATOM_IsIntAtomW( str, &atom ))
|
||||||
lstrcpynWtoA( buffer, str, sizeof(buffer) );
|
{
|
||||||
return ATOM_AddAtom( ATOM_GlobalTable, buffer );
|
struct add_atom_request *req = get_req_buffer();
|
||||||
|
server_strcpyW( req->name, str );
|
||||||
|
if (!server_call( REQ_ADD_ATOM )) atom = req->atom + MIN_STR_ATOM;
|
||||||
|
}
|
||||||
|
TRACE( "%s -> %x\n", debugres_w(str), atom );
|
||||||
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -588,25 +545,23 @@ ATOM WINAPI GlobalAddAtomW( LPCWSTR str )
|
||||||
* 0: Success
|
* 0: Success
|
||||||
* Atom: Failure
|
* Atom: Failure
|
||||||
*/
|
*/
|
||||||
ATOM WINAPI GlobalDeleteAtom(
|
ATOM WINAPI GlobalDeleteAtom( ATOM atom /* [in] Atom to delete */ )
|
||||||
ATOM atom /* [in] Atom to delete */
|
|
||||||
) {
|
|
||||||
return ATOM_DeleteAtom( ATOM_GlobalTable, atom );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* GlobalFindAtom16 (USER.270)
|
|
||||||
*/
|
|
||||||
ATOM WINAPI GlobalFindAtom16( SEGPTR str )
|
|
||||||
{
|
{
|
||||||
if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */
|
TRACE( "%x\n", atom );
|
||||||
return ATOM_FindAtom( ATOM_GlobalTable, (LPCSTR)PTR_SEG_TO_LIN(str) );
|
if (atom < MIN_STR_ATOM) atom = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct delete_atom_request *req = get_req_buffer();
|
||||||
|
req->atom = atom - MIN_STR_ATOM;
|
||||||
|
if (!server_call( REQ_DELETE_ATOM )) atom = 0;
|
||||||
|
}
|
||||||
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GlobalFindAtom32A (KERNEL32.318)
|
* GlobalFindAtomA (USER.270) (KERNEL32.318)
|
||||||
|
*
|
||||||
* Searches the atom table for the string and returns the atom
|
* Searches the atom table for the string and returns the atom
|
||||||
* associated with it.
|
* associated with it.
|
||||||
*
|
*
|
||||||
|
@ -614,38 +569,40 @@ ATOM WINAPI GlobalFindAtom16( SEGPTR str )
|
||||||
* Atom: Success
|
* Atom: Success
|
||||||
* 0: Failure
|
* 0: Failure
|
||||||
*/
|
*/
|
||||||
ATOM WINAPI GlobalFindAtomA(
|
ATOM WINAPI GlobalFindAtomA( LPCSTR str /* [in] Pointer to string to search for */ )
|
||||||
LPCSTR str /* [in] Pointer to string to search for */
|
{
|
||||||
) {
|
ATOM atom = 0;
|
||||||
if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */
|
if (!ATOM_IsIntAtomA( str, &atom ))
|
||||||
return ATOM_FindAtom( ATOM_GlobalTable, str );
|
{
|
||||||
|
struct find_atom_request *req = get_req_buffer();
|
||||||
|
server_strcpyAtoW( req->name, str );
|
||||||
|
if (!server_call( REQ_FIND_ATOM )) atom = req->atom + MIN_STR_ATOM;
|
||||||
|
}
|
||||||
|
TRACE( "%s -> %x\n", debugres_a(str), atom );
|
||||||
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GlobalFindAtom32W (KERNEL32.319)
|
* GlobalFindAtomW (KERNEL32.319)
|
||||||
* See GlobalFindAtom32A
|
|
||||||
*/
|
*/
|
||||||
ATOM WINAPI GlobalFindAtomW( LPCWSTR str )
|
ATOM WINAPI GlobalFindAtomW( LPCWSTR str )
|
||||||
{
|
{
|
||||||
char buffer[MAX_ATOM_LEN+1];
|
ATOM atom = 0;
|
||||||
if (!HIWORD(str)) return (ATOM)LOWORD(str); /* Integer atom */
|
if (!ATOM_IsIntAtomW( str, &atom ))
|
||||||
lstrcpynWtoA( buffer, str, sizeof(buffer) );
|
{
|
||||||
return ATOM_FindAtom( ATOM_GlobalTable, buffer );
|
struct find_atom_request *req = get_req_buffer();
|
||||||
|
server_strcpyW( req->name, str );
|
||||||
|
if (!server_call( REQ_FIND_ATOM )) atom = req->atom + MIN_STR_ATOM;
|
||||||
|
}
|
||||||
|
TRACE( "%s -> %x\n", debugres_w(str), atom );
|
||||||
|
return atom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GlobalGetAtomName16 (USER.271)
|
* GlobalGetAtomNameA (USER.271) (KERNEL32.323)
|
||||||
*/
|
*
|
||||||
UINT16 WINAPI GlobalGetAtomName16( ATOM atom, LPSTR buffer, INT16 count )
|
|
||||||
{
|
|
||||||
return (UINT16)ATOM_GetAtomName( ATOM_GlobalTable, atom, buffer, count );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* GlobalGetAtomName32A (KERNEL32.323)
|
|
||||||
* Retrieves a copy of the string associated with an atom.
|
* Retrieves a copy of the string associated with an atom.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
|
@ -655,20 +612,68 @@ UINT16 WINAPI GlobalGetAtomName16( ATOM atom, LPSTR buffer, INT16 count )
|
||||||
UINT WINAPI GlobalGetAtomNameA(
|
UINT WINAPI GlobalGetAtomNameA(
|
||||||
ATOM atom, /* [in] Atom identifier */
|
ATOM atom, /* [in] Atom identifier */
|
||||||
LPSTR buffer, /* [out] Pointer to buffer for atom string */
|
LPSTR buffer, /* [out] Pointer to buffer for atom string */
|
||||||
INT count /* [in] Size of buffer */
|
INT count ) /* [in] Size of buffer */
|
||||||
) {
|
{
|
||||||
return ATOM_GetAtomName( ATOM_GlobalTable, atom, buffer, count );
|
INT len;
|
||||||
|
if (atom < MIN_STR_ATOM)
|
||||||
|
{
|
||||||
|
char name[8];
|
||||||
|
if (!atom)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
len = sprintf( name, "#%d", atom );
|
||||||
|
lstrcpynA( buffer, name, count );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct get_atom_name_request *req = get_req_buffer();
|
||||||
|
req->atom = atom - MIN_STR_ATOM;
|
||||||
|
if (server_call( REQ_GET_ATOM_NAME )) return 0;
|
||||||
|
lstrcpynWtoA( buffer, req->name, count );
|
||||||
|
len = lstrlenW( req->name );
|
||||||
|
}
|
||||||
|
if (count <= len)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_MORE_DATA );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
TRACE( "%x -> %s\n", atom, debugstr_a(buffer) );
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GlobalGetAtomName32W (KERNEL32.324)
|
* GlobalGetAtomNameW (KERNEL32.324)
|
||||||
* See GlobalGetAtomName32A
|
|
||||||
*/
|
*/
|
||||||
UINT WINAPI GlobalGetAtomNameW( ATOM atom, LPWSTR buffer, INT count )
|
UINT WINAPI GlobalGetAtomNameW( ATOM atom, LPWSTR buffer, INT count )
|
||||||
{
|
{
|
||||||
char tmp[MAX_ATOM_LEN+1];
|
INT len;
|
||||||
ATOM_GetAtomName( ATOM_GlobalTable, atom, tmp, sizeof(tmp) );
|
if (atom < MIN_STR_ATOM)
|
||||||
lstrcpynAtoW( buffer, tmp, count );
|
{
|
||||||
return lstrlenW( buffer );
|
char name[8];
|
||||||
|
if (!atom)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
len = sprintf( name, "#%d", atom );
|
||||||
|
lstrcpynAtoW( buffer, name, count );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct get_atom_name_request *req = get_req_buffer();
|
||||||
|
req->atom = atom - MIN_STR_ATOM;
|
||||||
|
if (server_call( REQ_GET_ATOM_NAME )) return 0;
|
||||||
|
lstrcpynW( buffer, req->name, count );
|
||||||
|
len = lstrlenW( req->name );
|
||||||
|
}
|
||||||
|
if (count <= len)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_MORE_DATA );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
TRACE( "%x -> %s\n", atom, debugstr_w(buffer) );
|
||||||
|
return len;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ VPATH = @srcdir@
|
||||||
MODULE = none
|
MODULE = none
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
|
atom.c \
|
||||||
change.c \
|
change.c \
|
||||||
console.c \
|
console.c \
|
||||||
context_i386.c \
|
context_i386.c \
|
||||||
|
|
|
@ -0,0 +1,281 @@
|
||||||
|
/*
|
||||||
|
* Server-side atom management
|
||||||
|
*
|
||||||
|
* Copyright (C) 1999, 2000 Alexandre Julliard
|
||||||
|
* Copyright (C) 2000 Turchanov Sergei
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "unicode.h"
|
||||||
|
#include "request.h"
|
||||||
|
#include "object.h"
|
||||||
|
|
||||||
|
#define HASH_SIZE 37
|
||||||
|
#define MAX_ATOM_LEN 255
|
||||||
|
#define MAX_ATOMS 0x4000
|
||||||
|
|
||||||
|
struct atom_entry
|
||||||
|
{
|
||||||
|
struct atom_entry *next; /* hash table list */
|
||||||
|
struct atom_entry *prev; /* hash table list */
|
||||||
|
int atom; /* atom handle */
|
||||||
|
int count; /* reference count */
|
||||||
|
int hash; /* string hash */
|
||||||
|
WCHAR str[1]; /* atom string */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct atom_table
|
||||||
|
{
|
||||||
|
struct object obj; /* object header */
|
||||||
|
int count; /* count of atom handles */
|
||||||
|
int last; /* last handle in-use */
|
||||||
|
struct atom_entry **handles; /* atom handles */
|
||||||
|
struct atom_entry *entries[HASH_SIZE]; /* hash table entries */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void atom_table_dump( struct object *obj, int verbose );
|
||||||
|
static void atom_table_destroy( struct object *obj );
|
||||||
|
|
||||||
|
static const struct object_ops atom_table_ops =
|
||||||
|
{
|
||||||
|
sizeof(struct atom_table), /* size */
|
||||||
|
atom_table_dump, /* dump */
|
||||||
|
no_add_queue, /* add_queue */
|
||||||
|
NULL, /* remove_queue */
|
||||||
|
NULL, /* signaled */
|
||||||
|
NULL, /* satified */
|
||||||
|
NULL, /* get_poll_events */
|
||||||
|
NULL, /* poll_event */
|
||||||
|
no_read_fd, /* get_read_fd */
|
||||||
|
no_write_fd, /* get_write_fd */
|
||||||
|
no_flush, /* flush */
|
||||||
|
no_get_file_info, /* get_file_info */
|
||||||
|
atom_table_destroy /* destroy */
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct atom_table *global_table;
|
||||||
|
|
||||||
|
|
||||||
|
/* copy an atom name to a temporary area */
|
||||||
|
static const WCHAR *copy_name( const WCHAR *str )
|
||||||
|
{
|
||||||
|
static WCHAR buffer[MAX_ATOM_LEN+1];
|
||||||
|
WCHAR *p = buffer;
|
||||||
|
|
||||||
|
while (p < buffer + sizeof(buffer) - 1) if (!(*p++ = *str++)) break;
|
||||||
|
*p = 0;
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* create an atom table */
|
||||||
|
static struct atom_table *create_table(void)
|
||||||
|
{
|
||||||
|
struct atom_table *table;
|
||||||
|
|
||||||
|
if ((table = alloc_object( &atom_table_ops, -1 )))
|
||||||
|
{
|
||||||
|
table->count = 64;
|
||||||
|
table->last = -1;
|
||||||
|
memset( table->entries, 0, sizeof(table->entries) );
|
||||||
|
if ((table->handles = mem_alloc( sizeof(*table->handles) * table->count )))
|
||||||
|
return table;
|
||||||
|
release_object( table );
|
||||||
|
table = NULL;
|
||||||
|
}
|
||||||
|
return table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* retrieve an entry pointer from its atom */
|
||||||
|
static struct atom_entry *get_atom_entry( struct atom_table *table, int atom )
|
||||||
|
{
|
||||||
|
struct atom_entry *entry = NULL;
|
||||||
|
if (table && (atom >= 0) && (atom <= table->last)) entry = table->handles[atom];
|
||||||
|
if (!entry) set_error( STATUS_INVALID_HANDLE );
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add an atom entry in the table and return its handle */
|
||||||
|
static int add_atom_entry( struct atom_table *table, struct atom_entry *entry )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i <= table->last; i++)
|
||||||
|
if (!table->handles[i]) goto found;
|
||||||
|
if (i == table->count)
|
||||||
|
{
|
||||||
|
struct atom_entry **new_table = NULL;
|
||||||
|
int new_size = table->count + table->count / 2;
|
||||||
|
if (new_size > MAX_ATOMS) new_size = MAX_ATOMS;
|
||||||
|
if (new_size > table->count)
|
||||||
|
new_table = realloc( table->handles, sizeof(*table->handles) * new_size );
|
||||||
|
if (!new_table)
|
||||||
|
{
|
||||||
|
set_error( STATUS_NO_MEMORY );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
table->count = new_size;
|
||||||
|
table->handles = new_table;
|
||||||
|
}
|
||||||
|
table->last = i;
|
||||||
|
found:
|
||||||
|
table->handles[i] = entry;
|
||||||
|
entry->atom = i;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compute the hash code for a string */
|
||||||
|
static int atom_hash( const WCHAR *str )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
WCHAR hash = 0;
|
||||||
|
for (i = 0; str[i]; i++) hash ^= towupper(str[i]) + i;
|
||||||
|
return hash % HASH_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* dump an atom table */
|
||||||
|
static void atom_table_dump( struct object *obj, int verbose )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct atom_table *table = (struct atom_table *)obj;
|
||||||
|
assert( obj->ops == &atom_table_ops );
|
||||||
|
|
||||||
|
fprintf( stderr, "Atom table size=%d\n", table->last + 1 );
|
||||||
|
if (!verbose) return;
|
||||||
|
for (i = 0; i <= table->last; i++)
|
||||||
|
{
|
||||||
|
struct atom_entry *entry = table->handles[i];
|
||||||
|
if (!entry) continue;
|
||||||
|
fprintf( stderr, " %5d: ref=%d hash=%d \"", i, entry->count, entry->hash );
|
||||||
|
dump_strW( entry->str, strlenW(entry->str), stderr, "\"\"");
|
||||||
|
fprintf( stderr, "\"\n" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* destroy the atom table */
|
||||||
|
static void atom_table_destroy( struct object *obj )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
struct atom_table *table = (struct atom_table *)obj;
|
||||||
|
assert( obj->ops == &atom_table_ops );
|
||||||
|
for (i = 0; i <= table->last; i++) free( table->handles[i] );
|
||||||
|
free( table->handles );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* find an atom entry in its hash list */
|
||||||
|
static struct atom_entry *find_atom_entry( struct atom_table *table, const WCHAR *str, int hash )
|
||||||
|
{
|
||||||
|
struct atom_entry *entry = table->entries[hash];
|
||||||
|
while (entry)
|
||||||
|
{
|
||||||
|
if (!strcmpiW( entry->str, str )) break;
|
||||||
|
entry = entry->next;
|
||||||
|
}
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* close the atom table; used on server exit */
|
||||||
|
void close_atom_table(void)
|
||||||
|
{
|
||||||
|
if (global_table) release_object( global_table );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add an atom to the table */
|
||||||
|
static int add_atom( struct atom_table *table, const WCHAR *str )
|
||||||
|
{
|
||||||
|
struct atom_entry *entry;
|
||||||
|
int hash = atom_hash( str );
|
||||||
|
int atom = -1;
|
||||||
|
|
||||||
|
if (!*str)
|
||||||
|
{
|
||||||
|
set_error( STATUS_OBJECT_NAME_INVALID );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if ((entry = find_atom_entry( table, str, hash ))) /* exists already */
|
||||||
|
{
|
||||||
|
entry->count++;
|
||||||
|
return entry->atom;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((entry = mem_alloc( sizeof(*entry) + strlenW(str) * sizeof(WCHAR) )))
|
||||||
|
{
|
||||||
|
if ((atom = add_atom_entry( table, entry )) != -1)
|
||||||
|
{
|
||||||
|
entry->prev = NULL;
|
||||||
|
if ((entry->next = table->entries[hash])) entry->next->prev = entry;
|
||||||
|
table->entries[hash] = entry;
|
||||||
|
entry->count = 1;
|
||||||
|
entry->hash = hash;
|
||||||
|
strcpyW( entry->str, str );
|
||||||
|
}
|
||||||
|
else free( entry );
|
||||||
|
}
|
||||||
|
else set_error( STATUS_NO_MEMORY );
|
||||||
|
return atom;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* delete an atom from the table */
|
||||||
|
static void delete_atom( struct atom_table *table, int atom )
|
||||||
|
{
|
||||||
|
struct atom_entry *entry = get_atom_entry( table, atom );
|
||||||
|
if (entry && !--entry->count)
|
||||||
|
{
|
||||||
|
if (entry->next) entry->next->prev = entry->prev;
|
||||||
|
if (entry->prev) entry->prev->next = entry->next;
|
||||||
|
else table->entries[entry->hash] = entry->next;
|
||||||
|
table->handles[atom] = NULL;
|
||||||
|
free( entry );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* find an atom in the table */
|
||||||
|
static int find_atom( struct atom_table *table, const WCHAR *str )
|
||||||
|
{
|
||||||
|
struct atom_entry *entry;
|
||||||
|
|
||||||
|
if (table && ((entry = find_atom_entry( table, str, atom_hash(str) )))) return entry->atom;
|
||||||
|
if (!*str) set_error( STATUS_OBJECT_NAME_INVALID );
|
||||||
|
else set_error( STATUS_OBJECT_NAME_NOT_FOUND );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get an atom name and refcount*/
|
||||||
|
static int get_atom_name( struct atom_table *table, int atom, WCHAR *str )
|
||||||
|
{
|
||||||
|
int count = -1;
|
||||||
|
struct atom_entry *entry = get_atom_entry( table, atom );
|
||||||
|
if (entry)
|
||||||
|
{
|
||||||
|
strcpyW( str, entry->str );
|
||||||
|
count = entry->count;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add a global atom */
|
||||||
|
DECL_HANDLER(add_atom)
|
||||||
|
{
|
||||||
|
if (!global_table) global_table = create_table();
|
||||||
|
if (global_table) req->atom = add_atom( global_table, copy_name( req->name ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* delete a global atom */
|
||||||
|
DECL_HANDLER(delete_atom)
|
||||||
|
{
|
||||||
|
delete_atom( global_table, req->atom );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* find a global atom */
|
||||||
|
DECL_HANDLER(find_atom)
|
||||||
|
{
|
||||||
|
req->atom = find_atom( global_table, copy_name( req->name ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get global atom name */
|
||||||
|
DECL_HANDLER(get_atom_name)
|
||||||
|
{
|
||||||
|
req->count = get_atom_name( global_table, req->atom, req->name );
|
||||||
|
}
|
|
@ -95,6 +95,7 @@ int main( int argc, char *argv[] )
|
||||||
|
|
||||||
#ifdef DEBUG_OBJECTS
|
#ifdef DEBUG_OBJECTS
|
||||||
close_registry();
|
close_registry();
|
||||||
|
close_atom_table();
|
||||||
dump_objects(); /* dump any remaining objects */
|
dump_objects(); /* dump any remaining objects */
|
||||||
#endif
|
#endif
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
@ -165,6 +165,10 @@ extern int get_page_size(void);
|
||||||
|
|
||||||
extern void close_registry(void);
|
extern void close_registry(void);
|
||||||
|
|
||||||
|
/* atom functions */
|
||||||
|
|
||||||
|
extern void close_atom_table(void);
|
||||||
|
|
||||||
/* global variables (command-line options) */
|
/* global variables (command-line options) */
|
||||||
|
|
||||||
extern int debug_level;
|
extern int debug_level;
|
||||||
|
|
|
@ -163,6 +163,10 @@ DECL_HANDLER(cancel_timer);
|
||||||
DECL_HANDLER(get_thread_context);
|
DECL_HANDLER(get_thread_context);
|
||||||
DECL_HANDLER(set_thread_context);
|
DECL_HANDLER(set_thread_context);
|
||||||
DECL_HANDLER(get_selector_entry);
|
DECL_HANDLER(get_selector_entry);
|
||||||
|
DECL_HANDLER(add_atom);
|
||||||
|
DECL_HANDLER(delete_atom);
|
||||||
|
DECL_HANDLER(find_atom);
|
||||||
|
DECL_HANDLER(get_atom_name);
|
||||||
|
|
||||||
#ifdef WANT_REQUEST_HANDLERS
|
#ifdef WANT_REQUEST_HANDLERS
|
||||||
|
|
||||||
|
@ -263,6 +267,10 @@ static const struct handler {
|
||||||
{ (void(*)())req_get_thread_context, sizeof(struct get_thread_context_request) },
|
{ (void(*)())req_get_thread_context, sizeof(struct get_thread_context_request) },
|
||||||
{ (void(*)())req_set_thread_context, sizeof(struct set_thread_context_request) },
|
{ (void(*)())req_set_thread_context, sizeof(struct set_thread_context_request) },
|
||||||
{ (void(*)())req_get_selector_entry, sizeof(struct get_selector_entry_request) },
|
{ (void(*)())req_get_selector_entry, sizeof(struct get_selector_entry_request) },
|
||||||
|
{ (void(*)())req_add_atom, sizeof(struct add_atom_request) },
|
||||||
|
{ (void(*)())req_delete_atom, sizeof(struct delete_atom_request) },
|
||||||
|
{ (void(*)())req_find_atom, sizeof(struct find_atom_request) },
|
||||||
|
{ (void(*)())req_get_atom_name, sizeof(struct get_atom_name_request) },
|
||||||
};
|
};
|
||||||
#endif /* WANT_REQUEST_HANDLERS */
|
#endif /* WANT_REQUEST_HANDLERS */
|
||||||
|
|
||||||
|
|
|
@ -1182,6 +1182,45 @@ static void dump_get_selector_entry_reply( const struct get_selector_entry_reque
|
||||||
fprintf( stderr, " flags=%02x", req->flags );
|
fprintf( stderr, " flags=%02x", req->flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dump_add_atom_request( const struct add_atom_request *req )
|
||||||
|
{
|
||||||
|
fprintf( stderr, " name=" );
|
||||||
|
dump_unicode_string( req->name );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dump_add_atom_reply( const struct add_atom_request *req )
|
||||||
|
{
|
||||||
|
fprintf( stderr, " atom=%d", req->atom );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dump_delete_atom_request( const struct delete_atom_request *req )
|
||||||
|
{
|
||||||
|
fprintf( stderr, " atom=%d", req->atom );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dump_find_atom_request( const struct find_atom_request *req )
|
||||||
|
{
|
||||||
|
fprintf( stderr, " name=" );
|
||||||
|
dump_unicode_string( req->name );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dump_find_atom_reply( const struct find_atom_request *req )
|
||||||
|
{
|
||||||
|
fprintf( stderr, " atom=%d", req->atom );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dump_get_atom_name_request( const struct get_atom_name_request *req )
|
||||||
|
{
|
||||||
|
fprintf( stderr, " atom=%d", req->atom );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dump_get_atom_name_reply( const struct get_atom_name_request *req )
|
||||||
|
{
|
||||||
|
fprintf( stderr, " count=%d,", req->count );
|
||||||
|
fprintf( stderr, " name=" );
|
||||||
|
dump_unicode_string( req->name );
|
||||||
|
}
|
||||||
|
|
||||||
static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
||||||
(dump_func)dump_new_process_request,
|
(dump_func)dump_new_process_request,
|
||||||
(dump_func)dump_new_thread_request,
|
(dump_func)dump_new_thread_request,
|
||||||
|
@ -1276,6 +1315,10 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
||||||
(dump_func)dump_get_thread_context_request,
|
(dump_func)dump_get_thread_context_request,
|
||||||
(dump_func)dump_set_thread_context_request,
|
(dump_func)dump_set_thread_context_request,
|
||||||
(dump_func)dump_get_selector_entry_request,
|
(dump_func)dump_get_selector_entry_request,
|
||||||
|
(dump_func)dump_add_atom_request,
|
||||||
|
(dump_func)dump_delete_atom_request,
|
||||||
|
(dump_func)dump_find_atom_request,
|
||||||
|
(dump_func)dump_get_atom_name_request,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
||||||
|
@ -1372,6 +1415,10 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
||||||
(dump_func)dump_get_thread_context_reply,
|
(dump_func)dump_get_thread_context_reply,
|
||||||
(dump_func)0,
|
(dump_func)0,
|
||||||
(dump_func)dump_get_selector_entry_reply,
|
(dump_func)dump_get_selector_entry_reply,
|
||||||
|
(dump_func)dump_add_atom_reply,
|
||||||
|
(dump_func)0,
|
||||||
|
(dump_func)dump_find_atom_reply,
|
||||||
|
(dump_func)dump_get_atom_name_reply,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const req_names[REQ_NB_REQUESTS] = {
|
static const char * const req_names[REQ_NB_REQUESTS] = {
|
||||||
|
@ -1468,6 +1515,10 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
|
||||||
"get_thread_context",
|
"get_thread_context",
|
||||||
"set_thread_context",
|
"set_thread_context",
|
||||||
"get_selector_entry",
|
"get_selector_entry",
|
||||||
|
"add_atom",
|
||||||
|
"delete_atom",
|
||||||
|
"find_atom",
|
||||||
|
"get_atom_name",
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ### make_requests end ### */
|
/* ### make_requests end ### */
|
||||||
|
|
|
@ -45,10 +45,10 @@ static inline int strcmpiW( const WCHAR *str1, const WCHAR *str2 )
|
||||||
return towupper(*str1) - towupper(*str2);
|
return towupper(*str1) - towupper(*str2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline WCHAR *strcpyW( WCHAR *src, const WCHAR *dst )
|
static inline WCHAR *strcpyW( WCHAR *dst, const WCHAR *src )
|
||||||
{
|
{
|
||||||
const WCHAR *ret = dst;
|
const WCHAR *ret = dst;
|
||||||
while ((*src++ = *dst++));
|
while ((*dst++ = *src++));
|
||||||
return (WCHAR *)ret;
|
return (WCHAR *)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -417,7 +417,7 @@ ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
|
||||||
int iSmIconWidth, iSmIconHeight;
|
int iSmIconWidth, iSmIconHeight;
|
||||||
HINSTANCE16 hInstance=GetExePtr(wc->hInstance);
|
HINSTANCE16 hInstance=GetExePtr(wc->hInstance);
|
||||||
|
|
||||||
if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0;
|
if (!(atom = GlobalAddAtomA( PTR_SEG_TO_LIN(wc->lpszClassName) ))) return 0;
|
||||||
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
|
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
|
||||||
wc->cbClsExtra, wc->cbWndExtra,
|
wc->cbClsExtra, wc->cbWndExtra,
|
||||||
wc->lpfnWndProc, WIN_PROC_16 )))
|
wc->lpfnWndProc, WIN_PROC_16 )))
|
||||||
|
@ -556,7 +556,7 @@ ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
|
||||||
CLASS *classPtr;
|
CLASS *classPtr;
|
||||||
HINSTANCE16 hInstance = GetExePtr( wc->hInstance );
|
HINSTANCE16 hInstance = GetExePtr( wc->hInstance );
|
||||||
|
|
||||||
if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0;
|
if (!(atom = GlobalAddAtomA( PTR_SEG_TO_LIN(wc->lpszClassName) ))) return 0;
|
||||||
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
|
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
|
||||||
wc->cbClsExtra, wc->cbWndExtra,
|
wc->cbClsExtra, wc->cbWndExtra,
|
||||||
wc->lpfnWndProc, WIN_PROC_16 )))
|
wc->lpfnWndProc, WIN_PROC_16 )))
|
||||||
|
@ -662,16 +662,9 @@ ATOM WINAPI RegisterClassExW( const WNDCLASSEXW* wc )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* UnregisterClass16 (USER.403)
|
* UnregisterClass16 (USER.403)
|
||||||
*/
|
*/
|
||||||
BOOL16 WINAPI UnregisterClass16( SEGPTR className, HINSTANCE16 hInstance )
|
BOOL16 WINAPI UnregisterClass16( LPCSTR className, HINSTANCE16 hInstance )
|
||||||
{
|
{
|
||||||
CLASS *classPtr;
|
return UnregisterClassA( className, GetExePtr( hInstance ) );
|
||||||
ATOM atom;
|
|
||||||
|
|
||||||
hInstance = GetExePtr( hInstance );
|
|
||||||
if (!(atom = GlobalFindAtom16( className ))) return FALSE;
|
|
||||||
if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
|
|
||||||
(classPtr->hInstance != hInstance)) return FALSE;
|
|
||||||
return CLASS_FreeClass( classPtr );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1076,12 +1069,7 @@ LONG WINAPI SetClassLongW( HWND hwnd, INT offset, LONG newval )
|
||||||
*/
|
*/
|
||||||
INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
|
INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
|
||||||
{
|
{
|
||||||
WND *wndPtr;
|
return GetClassNameA( hwnd, buffer, count );
|
||||||
INT16 retvalue;
|
|
||||||
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
|
|
||||||
retvalue = GlobalGetAtomName16( wndPtr->class->atomName, buffer, count );
|
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
|
||||||
return retvalue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1120,16 +1108,15 @@ INT WINAPI GetClassNameW( HWND hwnd, LPWSTR buffer, INT count )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* GetClassInfo16 (USER.404)
|
* GetClassInfo16 (USER.404)
|
||||||
*/
|
*/
|
||||||
BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name,
|
BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, LPCSTR name, WNDCLASS16 *wc )
|
||||||
WNDCLASS16 *wc )
|
|
||||||
{
|
{
|
||||||
ATOM atom;
|
ATOM atom;
|
||||||
CLASS *classPtr;
|
CLASS *classPtr;
|
||||||
|
|
||||||
TRACE("%x %p %p\n",hInstance, PTR_SEG_TO_LIN (name), wc);
|
TRACE("%x %s %p\n",hInstance, debugres_a(name), wc);
|
||||||
|
|
||||||
hInstance = GetExePtr( hInstance );
|
hInstance = GetExePtr( hInstance );
|
||||||
if (!(atom = GlobalFindAtom16( name )) ||
|
if (!(atom = GlobalFindAtomA( name )) ||
|
||||||
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )))
|
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if ((hInstance != classPtr->hInstance) &&
|
if ((hInstance != classPtr->hInstance) &&
|
||||||
|
@ -1237,16 +1224,15 @@ BOOL WINAPI GetClassInfoW( HINSTANCE hInstance, LPCWSTR name,
|
||||||
* FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
|
* FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
|
||||||
* same in Win16 as in Win32. --AJ
|
* same in Win16 as in Win32. --AJ
|
||||||
*/
|
*/
|
||||||
BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name,
|
BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, LPCSTR name, WNDCLASSEX16 *wc )
|
||||||
WNDCLASSEX16 *wc )
|
|
||||||
{
|
{
|
||||||
ATOM atom;
|
ATOM atom;
|
||||||
CLASS *classPtr;
|
CLASS *classPtr;
|
||||||
|
|
||||||
TRACE("%x %p %p\n",hInstance,PTR_SEG_TO_LIN( name ), wc);
|
TRACE("%x %s %p\n",hInstance,debugres_a( name ), wc);
|
||||||
|
|
||||||
hInstance = GetExePtr( hInstance );
|
hInstance = GetExePtr( hInstance );
|
||||||
if (!(atom = GlobalFindAtom16( name )) ||
|
if (!(atom = GlobalFindAtomA( name )) ||
|
||||||
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
|
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
|
||||||
(hInstance != classPtr->hInstance)) return FALSE;
|
(hInstance != classPtr->hInstance)) return FALSE;
|
||||||
wc->style = classPtr->style;
|
wc->style = classPtr->style;
|
||||||
|
|
|
@ -2452,17 +2452,7 @@ END:
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* RegisterWindowMessage16 (USER.118)
|
* RegisterWindowMessageA (USER.118) (USER32.437)
|
||||||
*/
|
|
||||||
WORD WINAPI RegisterWindowMessage16( SEGPTR str )
|
|
||||||
{
|
|
||||||
TRACE("%08lx\n", (DWORD)str );
|
|
||||||
return GlobalAddAtom16( str );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* RegisterWindowMessage32A (USER32.437)
|
|
||||||
*/
|
*/
|
||||||
WORD WINAPI RegisterWindowMessageA( LPCSTR str )
|
WORD WINAPI RegisterWindowMessageA( LPCSTR str )
|
||||||
{
|
{
|
||||||
|
|
|
@ -284,7 +284,7 @@ void WIN_WalkWindows( HWND hwnd, int indent )
|
||||||
{
|
{
|
||||||
DPRINTF( "%*s%04x%*s", indent, "", ptr->hwndSelf, 13-indent,"");
|
DPRINTF( "%*s%04x%*s", indent, "", ptr->hwndSelf, 13-indent,"");
|
||||||
|
|
||||||
GlobalGetAtomName16(ptr->class->atomName,className,sizeof(className));
|
GlobalGetAtomNameA(ptr->class->atomName,className,sizeof(className));
|
||||||
|
|
||||||
DPRINTF( "%08lx %-6.4x %-17.17s %08x %08x %.14s\n",
|
DPRINTF( "%08lx %-6.4x %-17.17s %08x %08x %.14s\n",
|
||||||
(DWORD)ptr, ptr->hmemTaskQ, className,
|
(DWORD)ptr, ptr->hmemTaskQ, className,
|
||||||
|
@ -1560,31 +1560,18 @@ end:
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* FindWindow16 (USER.50)
|
* FindWindow16 (USER.50)
|
||||||
*/
|
*/
|
||||||
HWND16 WINAPI FindWindow16( SEGPTR className, LPCSTR title )
|
HWND16 WINAPI FindWindow16( LPCSTR className, LPCSTR title )
|
||||||
{
|
{
|
||||||
return FindWindowEx16( 0, 0, className, title );
|
return FindWindowA( className, title );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* FindWindowEx16 (USER.427)
|
* FindWindowEx16 (USER.427)
|
||||||
*/
|
*/
|
||||||
HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child,
|
HWND16 WINAPI FindWindowEx16( HWND16 parent, HWND16 child, LPCSTR className, LPCSTR title )
|
||||||
SEGPTR className, LPCSTR title )
|
|
||||||
{
|
{
|
||||||
ATOM atom = 0;
|
return FindWindowExA( parent, child, className, title );
|
||||||
|
|
||||||
TRACE("%04x %04x '%s' '%s'\n", parent,
|
|
||||||
child, HIWORD(className)?(char *)PTR_SEG_TO_LIN(className):"",
|
|
||||||
title ? title : "");
|
|
||||||
|
|
||||||
if (className)
|
|
||||||
{
|
|
||||||
/* If the atom doesn't exist, then no class */
|
|
||||||
/* with this name exists either. */
|
|
||||||
if (!(atom = GlobalFindAtom16( className ))) return 0;
|
|
||||||
}
|
|
||||||
return WIN_FindWindow( parent, child, atom, title );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue