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 /*****************************************************
46 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
48 TRACE("(%p, %d, %p)\n",hinstDLL
, fdwReason
, lpvReserved
);
52 case DLL_WINE_PREATTACH
:
53 return FALSE
; /* prefer native version */
54 case DLL_PROCESS_ATTACH
:
55 DisableThreadLibraryCalls( hinstDLL
);
61 /*****************************************************
62 * ADsGetObject [ACTIVEDS.3]
64 HRESULT WINAPI
ADsGetObject(LPCWSTR path
, REFIID riid
, void **obj
)
68 hr
= ADsOpenObject(path
, NULL
, NULL
, ADS_SECURE_AUTHENTICATION
, riid
, obj
);
70 hr
= ADsOpenObject(path
, NULL
, NULL
, 0, riid
, obj
);
74 /*****************************************************
75 * ADsBuildEnumerator [ACTIVEDS.4]
77 HRESULT WINAPI
ADsBuildEnumerator(IADsContainer
* pADsContainer
, IEnumVARIANT
** ppEnumVariant
)
79 FIXME("(%p)->(%p)!stub\n",pADsContainer
, ppEnumVariant
);
83 /*****************************************************
84 * ADsFreeEnumerator [ACTIVEDS.5]
86 HRESULT WINAPI
ADsFreeEnumerator(IEnumVARIANT
* pEnumVariant
)
88 FIXME("(%p)!stub\n",pEnumVariant
);
92 /*****************************************************
93 * ADsEnumerateNext [ACTIVEDS.6]
95 HRESULT WINAPI
ADsEnumerateNext(IEnumVARIANT
* pEnumVariant
, ULONG cElements
, VARIANT
* pvar
, ULONG
* pcElementsFetched
)
97 FIXME("(%p)->(%u, %p, %p)!stub\n",pEnumVariant
, cElements
, pvar
, pcElementsFetched
);
101 /*****************************************************
102 * ADsBuildVarArrayStr [ACTIVEDS.7]
104 HRESULT WINAPI
ADsBuildVarArrayStr(LPWSTR
*str
, DWORD count
, VARIANT
*var
)
108 LONG idx
, end
= count
;
110 TRACE("(%p, %u, %p)\n", str
, count
, var
);
112 if (!var
) return E_ADS_BAD_PARAMETER
;
114 sa
= SafeArrayCreateVector(VT_VARIANT
, 0, count
);
115 if (!sa
) return E_OUTOFMEMORY
;
118 for (idx
= 0; idx
< end
; idx
++)
122 V_VT(&item
) = VT_BSTR
;
123 V_BSTR(&item
) = SysAllocString(str
[idx
]);
130 hr
= SafeArrayPutElement(sa
, &idx
, &item
);
131 SysFreeString(V_BSTR(&item
));
132 if (hr
!= S_OK
) goto fail
;
135 V_VT(var
) = VT_ARRAY
| VT_VARIANT
;
140 SafeArrayDestroy(sa
);
144 /*****************************************************
145 * ADsBuildVarArrayInt [ACTIVEDS.8]
147 HRESULT WINAPI
ADsBuildVarArrayInt(LPDWORD lpdwObjectTypes
, DWORD dwObjectTypes
, VARIANT
* pvar
)
149 FIXME("(%p, %d, %p)!stub\n",lpdwObjectTypes
, dwObjectTypes
, pvar
);
153 /*****************************************************
154 * ADsOpenObject [ACTIVEDS.9]
156 HRESULT WINAPI
ADsOpenObject(LPCWSTR path
, LPCWSTR user
, LPCWSTR password
, DWORD reserved
, REFIID riid
, void **obj
)
160 WCHAR provider
[MAX_PATH
], progid
[MAX_PATH
];
163 TRACE("(%s,%s,%u,%s,%p)\n", debugstr_w(path
), debugstr_w(user
), reserved
, debugstr_guid(riid
), obj
);
165 if (!path
|| !riid
|| !obj
)
170 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, L
"Software\\Microsoft\\ADs\\Providers", 0, KEY_READ
, &hkey
))
175 if (RegEnumKeyW(hkey
, idx
++, provider
, ARRAY_SIZE(provider
)))
178 TRACE("provider %s\n", debugstr_w(provider
));
180 if (!wcsnicmp(path
, provider
, wcslen(provider
)) && path
[wcslen(provider
)] == ':')
184 if (RegOpenKeyExW(hkey
, provider
, 0, KEY_READ
, &hprov
))
187 size
= ARRAY_SIZE(progid
);
188 if (!RegQueryValueW(hprov
, NULL
, progid
, &size
))
192 if (CLSIDFromProgID(progid
, &clsid
) == S_OK
)
194 IADsOpenDSObject
*adsopen
;
197 TRACE("ns %s => clsid %s\n", debugstr_w(progid
), wine_dbgstr_guid(&clsid
));
198 if (CoCreateInstance(&clsid
, 0, CLSCTX_INPROC_SERVER
, &IID_IADsOpenDSObject
, (void **)&adsopen
) == S_OK
)
200 BSTR bpath
, buser
, bpassword
;
202 bpath
= SysAllocString(path
);
203 buser
= SysAllocString(user
);
204 bpassword
= SysAllocString(password
);
206 hr
= IADsOpenDSObject_OpenDSObject(adsopen
, bpath
, buser
, bpassword
, reserved
, &disp
);
209 hr
= IDispatch_QueryInterface(disp
, riid
, obj
);
210 IDispatch_Release(disp
);
213 SysFreeString(bpath
);
214 SysFreeString(buser
);
215 SysFreeString(bpassword
);
217 IADsOpenDSObject_Release(adsopen
);
232 /*****************************************************
233 * ADsSetLastError [ACTIVEDS.12]
235 VOID WINAPI
ADsSetLastError(DWORD dwErr
, LPWSTR pszError
, LPWSTR pszProvider
)
237 FIXME("(%d,%p,%p)!stub\n", dwErr
, pszError
, pszProvider
);
240 /*****************************************************
241 * ADsGetLastError [ACTIVEDS.13]
243 HRESULT WINAPI
ADsGetLastError(LPDWORD perror
, LPWSTR errorbuf
, DWORD errorbuflen
, LPWSTR namebuf
, DWORD namebuflen
)
245 FIXME("(%p,%p,%d,%p,%d)!stub\n", perror
, errorbuf
, errorbuflen
, namebuf
, namebuflen
);
249 /*****************************************************
250 * AllocADsMem [ACTIVEDS.14]
252 LPVOID WINAPI
AllocADsMem(DWORD cb
)
254 return HeapAlloc(GetProcessHeap(), 0, cb
);
257 /*****************************************************
258 * FreeADsMem [ACTIVEDS.15]
260 BOOL WINAPI
FreeADsMem(LPVOID pMem
)
262 return HeapFree(GetProcessHeap(), 0, pMem
);
265 /*****************************************************
266 * ReallocADsMem [ACTIVEDS.16]
268 LPVOID WINAPI
ReallocADsMem(LPVOID pOldMem
, DWORD cbOld
, DWORD cbNew
)
270 return HeapReAlloc(GetProcessHeap(), 0, pOldMem
, cbNew
);
273 /*****************************************************
274 * AllocADsStr [ACTIVEDS.17]
276 LPWSTR WINAPI
AllocADsStr(LPWSTR pStr
)
281 TRACE("(%p)\n", pStr
);
283 if (!pStr
) return NULL
;
285 len
= (wcslen(pStr
) + 1) * sizeof(WCHAR
);
286 ret
= AllocADsMem(len
);
287 if (ret
) memcpy(ret
, pStr
, len
);
292 /*****************************************************
293 * FreeADsStr [ACTIVEDS.18]
295 BOOL WINAPI
FreeADsStr(LPWSTR pStr
)
297 TRACE("(%p)\n", pStr
);
299 return FreeADsMem(pStr
);
302 /*****************************************************
303 * ReallocADsStr [ACTIVEDS.19]
305 BOOL WINAPI
ReallocADsStr(LPWSTR
*ppStr
, LPWSTR pStr
)
307 FIXME("(%p,%p)!stub\n",*ppStr
, pStr
);
311 /*****************************************************
312 * ADsEncodeBinaryData [ACTIVEDS.20]
314 HRESULT WINAPI
ADsEncodeBinaryData(PBYTE pbSrcData
, DWORD dwSrcLen
, LPWSTR
*ppszDestData
)
316 FIXME("(%p,%d,%p)!stub\n", pbSrcData
, dwSrcLen
, *ppszDestData
);