Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygends.c
Go to the documentation of this file.
00001 /* 00002 * Copyright 2005 Paul Vriens 00003 * 00004 * netapi32 directory service functions 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include <stdarg.h> 00022 00023 #include "ntstatus.h" 00024 #define WIN32_NO_STATUS 00025 #include "windef.h" 00026 #include "winbase.h" 00027 #include "winerror.h" 00028 #include "ntsecapi.h" 00029 #include "wine/debug.h" 00030 #include "dsrole.h" 00031 #include "dsgetdc.h" 00032 00033 WINE_DEFAULT_DEBUG_CHANNEL(ds); 00034 00035 DWORD WINAPI DsGetDcNameW(LPCWSTR ComputerName, LPCWSTR AvoidDCName, 00036 GUID* DomainGuid, LPCWSTR SiteName, ULONG Flags, 00037 PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo) 00038 { 00039 FIXME("(%s, %s, %s, %s, %08x, %p): stub\n", debugstr_w(ComputerName), 00040 debugstr_w(AvoidDCName), debugstr_guid(DomainGuid), 00041 debugstr_w(SiteName), Flags, DomainControllerInfo); 00042 return ERROR_CALL_NOT_IMPLEMENTED; 00043 } 00044 00045 DWORD WINAPI DsGetDcNameA(LPCSTR ComputerName, LPCSTR AvoidDCName, 00046 GUID* DomainGuid, LPCSTR SiteName, ULONG Flags, 00047 PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo) 00048 { 00049 FIXME("(%s, %s, %s, %s, %08x, %p): stub\n", debugstr_a(ComputerName), 00050 debugstr_a(AvoidDCName), debugstr_guid(DomainGuid), 00051 debugstr_a(SiteName), Flags, DomainControllerInfo); 00052 return ERROR_CALL_NOT_IMPLEMENTED; 00053 } 00054 00055 DWORD WINAPI DsGetSiteNameW(LPCWSTR ComputerName, LPWSTR *SiteName) 00056 { 00057 FIXME("(%s, %p): stub\n", debugstr_w(ComputerName), SiteName); 00058 return ERROR_CALL_NOT_IMPLEMENTED; 00059 } 00060 00061 /************************************************************ 00062 * DsRoleFreeMemory (NETAPI32.@) 00063 * 00064 * PARAMS 00065 * Buffer [I] Pointer to the to-be-freed buffer. 00066 * 00067 * RETURNS 00068 * Nothing 00069 */ 00070 VOID WINAPI DsRoleFreeMemory(PVOID Buffer) 00071 { 00072 TRACE("(%p)\n", Buffer); 00073 HeapFree(GetProcessHeap(), 0, Buffer); 00074 } 00075 00076 /************************************************************ 00077 * DsRoleGetPrimaryDomainInformation (NETAPI32.@) 00078 * 00079 * PARAMS 00080 * lpServer [I] Pointer to UNICODE string with ComputerName 00081 * InfoLevel [I] Type of data to retrieve 00082 * Buffer [O] Pointer to to the requested data 00083 * 00084 * RETURNS 00085 * 00086 * NOTES 00087 * When lpServer is NULL, use the local computer 00088 */ 00089 DWORD WINAPI DsRoleGetPrimaryDomainInformation( 00090 LPCWSTR lpServer, DSROLE_PRIMARY_DOMAIN_INFO_LEVEL InfoLevel, 00091 PBYTE* Buffer) 00092 { 00093 DWORD ret; 00094 00095 FIXME("(%p, %d, %p) stub\n", lpServer, InfoLevel, Buffer); 00096 00097 /* Check some input parameters */ 00098 00099 if (!Buffer) return ERROR_INVALID_PARAMETER; 00100 if ((InfoLevel < DsRolePrimaryDomainInfoBasic) || (InfoLevel > DsRoleOperationState)) return ERROR_INVALID_PARAMETER; 00101 00102 *Buffer = NULL; 00103 switch (InfoLevel) 00104 { 00105 case DsRolePrimaryDomainInfoBasic: 00106 { 00107 LSA_OBJECT_ATTRIBUTES ObjectAttributes; 00108 LSA_HANDLE PolicyHandle; 00109 PPOLICY_ACCOUNT_DOMAIN_INFO DomainInfo; 00110 NTSTATUS NtStatus; 00111 int logon_domain_sz; 00112 DWORD size; 00113 PDSROLE_PRIMARY_DOMAIN_INFO_BASIC basic; 00114 00115 ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes)); 00116 NtStatus = LsaOpenPolicy(NULL, &ObjectAttributes, 00117 POLICY_VIEW_LOCAL_INFORMATION, &PolicyHandle); 00118 if (NtStatus != STATUS_SUCCESS) 00119 { 00120 TRACE("LsaOpenPolicyFailed with NT status %x\n", 00121 LsaNtStatusToWinError(NtStatus)); 00122 return ERROR_OUTOFMEMORY; 00123 } 00124 LsaQueryInformationPolicy(PolicyHandle, 00125 PolicyAccountDomainInformation, (PVOID*)&DomainInfo); 00126 logon_domain_sz = lstrlenW(DomainInfo->DomainName.Buffer) + 1; 00127 LsaClose(PolicyHandle); 00128 00129 size = sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC) + 00130 logon_domain_sz * sizeof(WCHAR); 00131 basic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); 00132 if (basic) 00133 { 00134 basic->MachineRole = DsRole_RoleStandaloneWorkstation; 00135 basic->DomainNameFlat = (LPWSTR)((LPBYTE)basic + 00136 sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC)); 00137 lstrcpyW(basic->DomainNameFlat, DomainInfo->DomainName.Buffer); 00138 ret = ERROR_SUCCESS; 00139 } 00140 else 00141 ret = ERROR_OUTOFMEMORY; 00142 *Buffer = (PBYTE)basic; 00143 LsaFreeMemory(DomainInfo); 00144 } 00145 break; 00146 default: 00147 ret = ERROR_CALL_NOT_IMPLEMENTED; 00148 } 00149 return ret; 00150 } Generated on Sat May 26 2012 04:23:58 for ReactOS by
1.7.6.1
|