2 * Implementation of the Active Directory Service Interface
4 * Copyright 2005 Detlef Riekenberg
5 * Copyright 2019 Dmitry Timoshkov
7 * This file contains only stubs to get the printui.dll up and running
8 * activeds.dll is much much more than this
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(activeds
);
43 /*****************************************************
44 * ADsGetObject [ACTIVEDS.3]
46 HRESULT WINAPI
ADsGetObject(LPCWSTR path
, REFIID riid
, void **obj
)
50 hr
= ADsOpenObject(path
, NULL
, NULL
, ADS_SECURE_AUTHENTICATION
, riid
, obj
);
52 hr
= ADsOpenObject(path
, NULL
, NULL
, 0, riid
, obj
);
56 /*****************************************************
57 * ADsBuildEnumerator [ACTIVEDS.4]
59 HRESULT WINAPI
ADsBuildEnumerator(IADsContainer
* pADsContainer
, IEnumVARIANT
** ppEnumVariant
)
61 FIXME("(%p)->(%p)!stub\n",pADsContainer
, ppEnumVariant
);
65 /*****************************************************
66 * ADsFreeEnumerator [ACTIVEDS.5]
68 HRESULT WINAPI
ADsFreeEnumerator(IEnumVARIANT
* pEnumVariant
)
70 FIXME("(%p)!stub\n",pEnumVariant
);
74 /*****************************************************
75 * ADsEnumerateNext [ACTIVEDS.6]
77 HRESULT WINAPI
ADsEnumerateNext(IEnumVARIANT
* pEnumVariant
, ULONG cElements
, VARIANT
* pvar
, ULONG
* pcElementsFetched
)
79 FIXME("(%p)->(%u, %p, %p)!stub\n",pEnumVariant
, cElements
, pvar
, pcElementsFetched
);
83 /*****************************************************
84 * ADsBuildVarArrayStr [ACTIVEDS.7]
86 HRESULT WINAPI
ADsBuildVarArrayStr(LPWSTR
*str
, DWORD count
, VARIANT
*var
)
90 LONG idx
, end
= count
;
92 TRACE("(%p, %u, %p)\n", str
, count
, var
);
94 if (!var
) return E_ADS_BAD_PARAMETER
;
96 sa
= SafeArrayCreateVector(VT_VARIANT
, 0, count
);
97 if (!sa
) return E_OUTOFMEMORY
;
100 for (idx
= 0; idx
< end
; idx
++)
104 V_VT(&item
) = VT_BSTR
;
105 V_BSTR(&item
) = SysAllocString(str
[idx
]);
112 hr
= SafeArrayPutElement(sa
, &idx
, &item
);
113 SysFreeString(V_BSTR(&item
));
114 if (hr
!= S_OK
) goto fail
;
117 V_VT(var
) = VT_ARRAY
| VT_VARIANT
;
122 SafeArrayDestroy(sa
);
126 /*****************************************************
127 * ADsBuildVarArrayInt [ACTIVEDS.8]
129 HRESULT WINAPI
ADsBuildVarArrayInt(LPDWORD lpdwObjectTypes
, DWORD dwObjectTypes
, VARIANT
* pvar
)
131 FIXME("(%p, %d, %p)!stub\n",lpdwObjectTypes
, dwObjectTypes
, pvar
);
135 /*****************************************************
136 * ADsOpenObject [ACTIVEDS.9]
138 HRESULT WINAPI
ADsOpenObject(LPCWSTR path
, LPCWSTR user
, LPCWSTR password
, DWORD reserved
, REFIID riid
, void **obj
)
142 WCHAR provider
[MAX_PATH
], progid
[MAX_PATH
];
145 TRACE("(%s,%s,%u,%s,%p)\n", debugstr_w(path
), debugstr_w(user
), reserved
, debugstr_guid(riid
), obj
);
147 if (!path
|| !riid
|| !obj
)
152 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, L
"Software\\Microsoft\\ADs\\Providers", 0, KEY_READ
, &hkey
))
157 if (RegEnumKeyW(hkey
, idx
++, provider
, ARRAY_SIZE(provider
)))
160 TRACE("provider %s\n", debugstr_w(provider
));
162 if (!wcsnicmp(path
, provider
, wcslen(provider
)) && path
[wcslen(provider
)] == ':')
166 if (RegOpenKeyExW(hkey
, provider
, 0, KEY_READ
, &hprov
))
169 size
= ARRAY_SIZE(progid
);
170 if (!RegQueryValueW(hprov
, NULL
, progid
, &size
))
174 if (CLSIDFromProgID(progid
, &clsid
) == S_OK
)
176 IADsOpenDSObject
*adsopen
;
179 TRACE("ns %s => clsid %s\n", debugstr_w(progid
), wine_dbgstr_guid(&clsid
));
180 if (CoCreateInstance(&clsid
, 0, CLSCTX_INPROC_SERVER
, &IID_IADsOpenDSObject
, (void **)&adsopen
) == S_OK
)
182 BSTR bpath
, buser
, bpassword
;
184 bpath
= SysAllocString(path
);
185 buser
= SysAllocString(user
);
186 bpassword
= SysAllocString(password
);
188 hr
= IADsOpenDSObject_OpenDSObject(adsopen
, bpath
, buser
, bpassword
, reserved
, &disp
);
191 hr
= IDispatch_QueryInterface(disp
, riid
, obj
);
192 IDispatch_Release(disp
);
195 SysFreeString(bpath
);
196 SysFreeString(buser
);
197 SysFreeString(bpassword
);
199 IADsOpenDSObject_Release(adsopen
);
214 /*****************************************************
215 * ADsSetLastError [ACTIVEDS.12]
217 VOID WINAPI
ADsSetLastError(DWORD dwErr
, LPWSTR pszError
, LPWSTR pszProvider
)
219 FIXME("(%d,%p,%p)!stub\n", dwErr
, pszError
, pszProvider
);
222 /*****************************************************
223 * ADsGetLastError [ACTIVEDS.13]
225 HRESULT WINAPI
ADsGetLastError(LPDWORD perror
, LPWSTR errorbuf
, DWORD errorbuflen
, LPWSTR namebuf
, DWORD namebuflen
)
227 FIXME("(%p,%p,%d,%p,%d)!stub\n", perror
, errorbuf
, errorbuflen
, namebuf
, namebuflen
);
231 /*****************************************************
232 * AllocADsMem [ACTIVEDS.14]
234 LPVOID WINAPI
AllocADsMem(DWORD cb
)
236 return HeapAlloc(GetProcessHeap(), 0, cb
);
239 /*****************************************************
240 * FreeADsMem [ACTIVEDS.15]
242 BOOL WINAPI
FreeADsMem(LPVOID pMem
)
244 return HeapFree(GetProcessHeap(), 0, pMem
);
247 /*****************************************************
248 * ReallocADsMem [ACTIVEDS.16]
250 LPVOID WINAPI
ReallocADsMem(LPVOID pOldMem
, DWORD cbOld
, DWORD cbNew
)
252 return HeapReAlloc(GetProcessHeap(), 0, pOldMem
, cbNew
);
255 /*****************************************************
256 * AllocADsStr [ACTIVEDS.17]
258 LPWSTR WINAPI
AllocADsStr(LPWSTR pStr
)
263 TRACE("(%p)\n", pStr
);
265 if (!pStr
) return NULL
;
267 len
= (wcslen(pStr
) + 1) * sizeof(WCHAR
);
268 ret
= AllocADsMem(len
);
269 if (ret
) memcpy(ret
, pStr
, len
);
274 /*****************************************************
275 * FreeADsStr [ACTIVEDS.18]
277 BOOL WINAPI
FreeADsStr(LPWSTR pStr
)
279 TRACE("(%p)\n", pStr
);
281 return FreeADsMem(pStr
);
284 /*****************************************************
285 * ReallocADsStr [ACTIVEDS.19]
287 BOOL WINAPI
ReallocADsStr(LPWSTR
*ppStr
, LPWSTR pStr
)
289 FIXME("(%p,%p)!stub\n",*ppStr
, pStr
);
293 /*****************************************************
294 * ADsEncodeBinaryData [ACTIVEDS.20]
296 HRESULT WINAPI
ADsEncodeBinaryData(PBYTE pbSrcData
, DWORD dwSrcLen
, LPWSTR
*ppszDestData
)
298 FIXME("(%p,%d,%p)!stub\n", pbSrcData
, dwSrcLen
, *ppszDestData
);