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: GetUserDomain_WINDOWS.cpp,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 ************************************************************************/
37 if ( ERROR_SUCCESS
== RegOpenKeyEx(
39 TEXT("Network\\Logon"),
40 0, KEY_READ
, &hkeyLogon
) )
43 DWORD dwLogonSize
= sizeof(dwLogon
);
44 RegQueryValueEx( hkeyLogon
, TEXT("LMLogon"), 0, NULL
, (LPBYTE
)&dwLogon
, &dwLogonSize
);
45 RegCloseKey( hkeyLogon
);
49 HKEY hkeyNetworkProvider
;
51 if ( ERROR_SUCCESS
== RegOpenKeyEx(
53 TEXT("SYSTEM\\CurrentControlSet\\Services\\MSNP32\\NetworkProvider"),
54 0, KEY_READ
, &hkeyNetworkProvider
) )
56 DWORD dwBufferSize
= nSize
;
57 LONG lResult
= RegQueryValueEx( hkeyNetworkProvider
, TEXT("AuthenticatingAgent"), 0, NULL
, (LPBYTE
)lpBuffer
, &dwBufferSize
);
59 if ( ERROR_SUCCESS
== lResult
|| ERROR_MORE_DATA
== lResult
)
60 dwResult
= dwBufferSize
/ sizeof(TCHAR
);
62 RegCloseKey( hkeyNetworkProvider
);
66 else if ( ERROR_SUCCESS
== RegOpenKeyEx(
68 TEXT("SYSTEM\\CurrentControlSet\\Services\\VxD\\VNETSUP"),
69 0, KEY_READ
, &hkeyWorkgroup
) )
71 DWORD dwBufferSize
= nSize
;
72 LONG lResult
= RegQueryValueEx( hkeyWorkgroup
, TEXT("Workgroup"), 0, NULL
, (LPBYTE
)lpBuffer
, &dwBufferSize
);
74 if ( ERROR_SUCCESS
== lResult
|| ERROR_MORE_DATA
== lResult
)
75 dwResult
= dwBufferSize
/ sizeof(TCHAR
);
77 RegCloseKey( hkeyWorkgroup
);