2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: User Atom helper routines
5 * FILE: subsys/win32k/ntuser/useratom.c
6 * PROGRAMER: Filip Navara <xnavara@volny.cz>
10 DBG_DEFAULT_CHANNEL(UserMisc
);
13 IntAddAtom(LPWSTR AtomName
)
15 NTSTATUS Status
= STATUS_SUCCESS
;
19 pti
= PsGetCurrentThreadWin32Thread();
20 if (pti
->rpdesk
== NULL
)
22 SetLastNtError(Status
);
26 Status
= RtlAddAtomToAtomTable(gAtomTable
, AtomName
, &Atom
);
28 if (!NT_SUCCESS(Status
))
30 SetLastNtError(Status
);
37 IntGetAtomName(RTL_ATOM nAtom
, LPWSTR lpBuffer
, ULONG nSize
)
39 NTSTATUS Status
= STATUS_SUCCESS
;
43 pti
= PsGetCurrentThreadWin32Thread();
44 if (pti
->rpdesk
== NULL
)
46 SetLastNtError(Status
);
50 Status
= RtlQueryAtomInAtomTable(gAtomTable
, nAtom
, NULL
, NULL
, lpBuffer
, &Size
);
53 *(lpBuffer
+ Size
/sizeof(WCHAR
)) = 0;
54 if (!NT_SUCCESS(Status
))
56 SetLastNtError(Status
);
63 IntAddGlobalAtom(LPWSTR lpBuffer
, BOOL PinAtom
)
66 NTSTATUS Status
= STATUS_SUCCESS
;
68 Status
= RtlAddAtomToAtomTable(gAtomTable
, lpBuffer
, &Atom
);
70 if (!NT_SUCCESS(Status
))
72 ERR("Error init Global Atom.\n");
76 if ( Atom
&& PinAtom
) RtlPinAtomInAtomTable(gAtomTable
, Atom
);
85 PUNICODE_STRING pBuffer
)
89 UNICODE_STRING CapturedName
= {0};
91 CapturedName
.Buffer
= (LPWSTR
)&Buffer
;
92 CapturedName
.MaximumLength
= sizeof(Buffer
);
93 Ret
= IntGetAtomName((RTL_ATOM
)nAtom
, CapturedName
.Buffer
, (ULONG
)CapturedName
.Length
);
96 RtlCopyMemory(pBuffer
->Buffer
, &Buffer
, pBuffer
->MaximumLength
);
98 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)