1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: uwinapi.h,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
41 # pragma warning(push,1) /* disable warnings within system headers */
58 The GetUserDomain function retrieves the name of the NT domain the user is
63 [out] Pointer to a buffer that receives a null-terminated string
64 containing the domain name.
66 [in] Specifies the size, in TCHARs, of the buffer pointed to
67 by the lpBuffer parameter.
72 If the function succeeds, the return value is the number of TCHARs stored
73 into the buffer pointed to by lpBuffer, not including the terminating
76 If the domain name can't be retrieved, the return value is zero.
78 If the buffer pointed to by lpBuffer is not large enough, the return value
79 is the buffer size, in TCHARs, required to hold the value string and its
80 terminating null character.
83 Windows 95/98/Me: If the user is not logged in onto a NT domain server
84 the name of the workgroup is returned.
87 Windows NT/2000/XP: Included in Windows NT 4 and later.
88 Windows 95/98/Me: Included in Windows 95 and later.
89 Header: Declared in Uwinapi.h; include Uwinapi.h.
90 Library: Use Uwinapi.lib.
91 Unicode: Implemented as Unicode and ANSI versions on Windows 95/98/Me/NT/2000/XP.
97 EXTERN_C WINBASEAPI DWORD WINAPI
GetUserDomainA( LPSTR lpBuffer
, DWORD nBuffserSize
);
98 EXTERN_C WINBASEAPI DWORD WINAPI
GetUserDomainW( LPWSTR lpBuffer
, DWORD nBuffserSize
);
101 #define GetUserDomain GetUserDomainW
103 #define GetUserDomain GetUserDomainA
106 EXTERN_C WINBASEAPI DWORD WINAPI
GetProcessId( HANDLE hProcess
);
108 /* macro that calculates the count of elements of a static array */
110 #define elementsof(buf) (sizeof(buf) / sizeof((buf)[0]))
114 inline bool IsValidHandle(HANDLE handle
)
116 return handle
!= INVALID_HANDLE_VALUE
&& handle
!= NULL
;
119 #else /* __cplusplus */
121 #define IsValidHandle(Handle) ((DWORD)(Handle) + 1 > 1)
123 #endif /* __cplusplus */