1*c2c66affSColin Finck /*
2*c2c66affSColin Finck * ReactOS kernel
3*c2c66affSColin Finck * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
4*c2c66affSColin Finck *
5*c2c66affSColin Finck * This program is free software; you can redistribute it and/or modify
6*c2c66affSColin Finck * it under the terms of the GNU General Public License as published by
7*c2c66affSColin Finck * the Free Software Foundation; either version 2 of the License, or
8*c2c66affSColin Finck * (at your option) any later version.
9*c2c66affSColin Finck *
10*c2c66affSColin Finck * This program is distributed in the hope that it will be useful,
11*c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*c2c66affSColin Finck * GNU General Public License for more details.
14*c2c66affSColin Finck *
15*c2c66affSColin Finck * You should have received a copy of the GNU General Public License
16*c2c66affSColin Finck * along with this program; if not, write to the Free Software
17*c2c66affSColin Finck * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18*c2c66affSColin Finck */
19*c2c66affSColin Finck /*
20*c2c66affSColin Finck * PROJECT: ReactOS user32.dll
21*c2c66affSColin Finck * FILE: win32ss/user/user32/misc/object.c
22*c2c66affSColin Finck * PURPOSE: DDE
23*c2c66affSColin Finck * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
24*c2c66affSColin Finck * UPDATE HISTORY:
25*c2c66affSColin Finck * 09-05-2001 CSH Created
26*c2c66affSColin Finck */
27*c2c66affSColin Finck
28*c2c66affSColin Finck #include <user32.h>
29*c2c66affSColin Finck
30*c2c66affSColin Finck WINE_DEFAULT_DEBUG_CHANNEL(user32);
31*c2c66affSColin Finck
32*c2c66affSColin Finck /*
33*c2c66affSColin Finck * @implemented
34*c2c66affSColin Finck */
35*c2c66affSColin Finck BOOL
36*c2c66affSColin Finck WINAPI
GetUserObjectInformationA(HANDLE hObj,int nIndex,PVOID pvInfo,DWORD nLength,LPDWORD lpnLengthNeeded)37*c2c66affSColin Finck GetUserObjectInformationA(
38*c2c66affSColin Finck HANDLE hObj,
39*c2c66affSColin Finck int nIndex,
40*c2c66affSColin Finck PVOID pvInfo,
41*c2c66affSColin Finck DWORD nLength,
42*c2c66affSColin Finck LPDWORD lpnLengthNeeded)
43*c2c66affSColin Finck {
44*c2c66affSColin Finck LPWSTR buffer;
45*c2c66affSColin Finck BOOL ret = FALSE;
46*c2c66affSColin Finck DWORD LengthNeeded;
47*c2c66affSColin Finck
48*c2c66affSColin Finck TRACE("GetUserObjectInformationA(%x %d %x %d %x)\n", hObj, nIndex,
49*c2c66affSColin Finck pvInfo, nLength, lpnLengthNeeded);
50*c2c66affSColin Finck
51*c2c66affSColin Finck if (nIndex != UOI_NAME && nIndex != UOI_TYPE)
52*c2c66affSColin Finck return GetUserObjectInformationW(hObj, nIndex, pvInfo, nLength, lpnLengthNeeded);
53*c2c66affSColin Finck
54*c2c66affSColin Finck /* allocate unicode buffer */
55*c2c66affSColin Finck buffer = HeapAlloc(GetProcessHeap(), 0, nLength*2);
56*c2c66affSColin Finck if (buffer == NULL)
57*c2c66affSColin Finck {
58*c2c66affSColin Finck SetLastError(ERROR_NOT_ENOUGH_MEMORY);
59*c2c66affSColin Finck return FALSE;
60*c2c66affSColin Finck }
61*c2c66affSColin Finck
62*c2c66affSColin Finck /* get unicode string */
63*c2c66affSColin Finck if (GetUserObjectInformationW(hObj, nIndex, buffer, nLength*2, lpnLengthNeeded))
64*c2c66affSColin Finck {
65*c2c66affSColin Finck /* convert string */
66*c2c66affSColin Finck LengthNeeded = WideCharToMultiByte(CP_THREAD_ACP, 0, buffer, -1,
67*c2c66affSColin Finck pvInfo, nLength, NULL, NULL);
68*c2c66affSColin Finck
69*c2c66affSColin Finck if (LengthNeeded != 0)
70*c2c66affSColin Finck {
71*c2c66affSColin Finck if (lpnLengthNeeded)
72*c2c66affSColin Finck *lpnLengthNeeded = LengthNeeded;
73*c2c66affSColin Finck ret = TRUE;
74*c2c66affSColin Finck }
75*c2c66affSColin Finck }
76*c2c66affSColin Finck
77*c2c66affSColin Finck /* free resources */
78*c2c66affSColin Finck HeapFree(GetProcessHeap(), 0, buffer);
79*c2c66affSColin Finck return ret;
80*c2c66affSColin Finck }
81