2005-06-13 13:47:46 +02:00
|
|
|
/*
|
|
|
|
* Implementation of the Active Directory Service Interface
|
|
|
|
*
|
|
|
|
* Copyright 2005 Detlef Riekenberg
|
2020-02-11 09:40:30 +01:00
|
|
|
* Copyright 2019 Dmitry Timoshkov
|
2005-06-13 13:47:46 +02:00
|
|
|
*
|
|
|
|
* This file contains only stubs to get the printui.dll up and running
|
|
|
|
* activeds.dll is much much more than this
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-06-13 13:47:46 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
|
2005-09-26 18:43:20 +02:00
|
|
|
#include "objbase.h"
|
2020-02-11 09:40:30 +01:00
|
|
|
#include "initguid.h"
|
2005-09-26 18:43:20 +02:00
|
|
|
#include "iads.h"
|
|
|
|
#include "adshlp.h"
|
2020-02-11 09:40:30 +01:00
|
|
|
#include "adserr.h"
|
2005-09-26 18:43:20 +02:00
|
|
|
|
2005-06-13 13:47:46 +02:00
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(activeds);
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* DllMain
|
|
|
|
*/
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
|
|
{
|
2006-10-04 11:50:01 +02:00
|
|
|
TRACE("(%p, %d, %p)\n",hinstDLL, fdwReason, lpvReserved);
|
2006-03-21 16:18:24 +01:00
|
|
|
|
|
|
|
switch(fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_WINE_PREATTACH:
|
|
|
|
return FALSE; /* prefer native version */
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
DisableThreadLibraryCalls( hinstDLL );
|
|
|
|
break;
|
|
|
|
}
|
2005-06-13 13:47:46 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* ADsGetObject [ACTIVEDS.3]
|
|
|
|
*/
|
2005-09-26 18:43:20 +02:00
|
|
|
HRESULT WINAPI ADsGetObject(LPCWSTR lpszPathName, REFIID riid, VOID** ppObject)
|
2005-06-13 13:47:46 +02:00
|
|
|
{
|
|
|
|
FIXME("(%s)->(%s,%p)!stub\n",debugstr_w(lpszPathName), debugstr_guid(riid), ppObject);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* ADsBuildEnumerator [ACTIVEDS.4]
|
|
|
|
*/
|
2005-09-26 18:43:20 +02:00
|
|
|
HRESULT WINAPI ADsBuildEnumerator(IADsContainer * pADsContainer, IEnumVARIANT** ppEnumVariant)
|
2005-06-13 13:47:46 +02:00
|
|
|
{
|
|
|
|
FIXME("(%p)->(%p)!stub\n",pADsContainer, ppEnumVariant);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2010-11-12 19:21:23 +01:00
|
|
|
/*****************************************************
|
|
|
|
* ADsFreeEnumerator [ACTIVEDS.5]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI ADsFreeEnumerator(IEnumVARIANT* pEnumVariant)
|
|
|
|
{
|
|
|
|
FIXME("(%p)!stub\n",pEnumVariant);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-06-13 13:47:46 +02:00
|
|
|
/*****************************************************
|
|
|
|
* ADsEnumerateNext [ACTIVEDS.6]
|
|
|
|
*/
|
2005-09-26 18:43:20 +02:00
|
|
|
HRESULT WINAPI ADsEnumerateNext(IEnumVARIANT* pEnumVariant, ULONG cElements, VARIANT* pvar, ULONG * pcElementsFetched)
|
2005-06-13 13:47:46 +02:00
|
|
|
{
|
2006-10-04 11:50:01 +02:00
|
|
|
FIXME("(%p)->(%u, %p, %p)!stub\n",pEnumVariant, cElements, pvar, pcElementsFetched);
|
2005-06-13 13:47:46 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2010-11-12 19:21:23 +01:00
|
|
|
/*****************************************************
|
|
|
|
* ADsBuildVarArrayStr [ACTIVEDS.7]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI ADsBuildVarArrayStr(LPWSTR *lppPathNames, DWORD dwPathNames, VARIANT* pvar)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d, %p)!stub\n",*lppPathNames, dwPathNames, pvar);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* ADsBuildVarArrayInt [ACTIVEDS.8]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI ADsBuildVarArrayInt(LPDWORD lpdwObjectTypes, DWORD dwObjectTypes, VARIANT* pvar)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d, %p)!stub\n",lpdwObjectTypes, dwObjectTypes, pvar);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-06-13 13:47:46 +02:00
|
|
|
/*****************************************************
|
|
|
|
* ADsOpenObject [ACTIVEDS.9]
|
|
|
|
*/
|
2020-02-11 09:40:30 +01:00
|
|
|
HRESULT WINAPI ADsOpenObject(LPCWSTR path, LPCWSTR user, LPCWSTR password, DWORD reserved, REFIID riid, void **obj)
|
2005-06-13 13:47:46 +02:00
|
|
|
{
|
2020-02-11 09:40:30 +01:00
|
|
|
HRESULT hr;
|
|
|
|
HKEY hkey, hprov;
|
|
|
|
WCHAR provider[MAX_PATH], progid[MAX_PATH];
|
|
|
|
DWORD idx = 0;
|
|
|
|
|
|
|
|
TRACE("(%s,%s,%u,%s,%p)\n", debugstr_w(path), debugstr_w(user), reserved, debugstr_guid(riid), obj);
|
|
|
|
|
|
|
|
if (!path || !riid || !obj)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\ADs\\Providers", 0, KEY_READ, &hkey))
|
|
|
|
return E_ADS_BAD_PATHNAME;
|
|
|
|
|
|
|
|
hr = E_ADS_BAD_PATHNAME;
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if (RegEnumKeyW(hkey, idx++, provider, ARRAY_SIZE(provider)))
|
|
|
|
break;
|
|
|
|
|
|
|
|
TRACE("provider %s\n", debugstr_w(provider));
|
|
|
|
|
|
|
|
if (!wcsnicmp(path, provider, wcslen(provider)) && path[wcslen(provider)] == ':')
|
|
|
|
{
|
|
|
|
LONG size;
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(hkey, provider, 0, KEY_READ, &hprov))
|
|
|
|
break;
|
|
|
|
|
|
|
|
size = ARRAY_SIZE(progid);
|
|
|
|
if (!RegQueryValueW(hprov, NULL, progid, &size))
|
|
|
|
{
|
|
|
|
CLSID clsid;
|
|
|
|
|
|
|
|
if (CLSIDFromProgID(progid, &clsid) == S_OK)
|
|
|
|
{
|
|
|
|
IADsOpenDSObject *adsopen;
|
|
|
|
IDispatch *disp;
|
|
|
|
|
|
|
|
TRACE("ns %s => clsid %s\n", debugstr_w(progid), wine_dbgstr_guid(&clsid));
|
|
|
|
if (CoCreateInstance(&clsid, 0, CLSCTX_INPROC_SERVER, &IID_IADsOpenDSObject, (void **)&adsopen) == S_OK)
|
|
|
|
{
|
|
|
|
BSTR bpath, buser, bpassword;
|
|
|
|
|
|
|
|
bpath = SysAllocString(path);
|
|
|
|
buser = SysAllocString(user);
|
|
|
|
bpassword = SysAllocString(password);
|
|
|
|
|
|
|
|
hr = IADsOpenDSObject_OpenDSObject(adsopen, bpath, buser, bpassword, reserved, &disp);
|
|
|
|
if (hr == S_OK)
|
|
|
|
{
|
|
|
|
hr = IDispatch_QueryInterface(disp, riid, obj);
|
|
|
|
IDispatch_Release(disp);
|
|
|
|
}
|
|
|
|
|
|
|
|
SysFreeString(bpath);
|
|
|
|
SysFreeString(buser);
|
|
|
|
SysFreeString(bpassword);
|
|
|
|
|
|
|
|
IADsOpenDSObject_Release(adsopen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hprov);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
|
|
|
return hr;
|
2005-06-13 13:47:46 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 19:21:23 +01:00
|
|
|
/*****************************************************
|
|
|
|
* ADsSetLastError [ACTIVEDS.12]
|
|
|
|
*/
|
|
|
|
VOID WINAPI ADsSetLastError(DWORD dwErr, LPWSTR pszError, LPWSTR pszProvider)
|
|
|
|
{
|
|
|
|
FIXME("(%d,%p,%p)!stub\n", dwErr, pszError, pszProvider);
|
|
|
|
}
|
|
|
|
|
2010-03-05 12:00:37 +01:00
|
|
|
/*****************************************************
|
|
|
|
* ADsGetLastError [ACTIVEDS.13]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI ADsGetLastError(LPDWORD perror, LPWSTR errorbuf, DWORD errorbuflen, LPWSTR namebuf, DWORD namebuflen)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%d,%p,%d)!stub\n", perror, errorbuf, errorbuflen, namebuf, namebuflen);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2010-11-12 19:21:23 +01:00
|
|
|
/*****************************************************
|
|
|
|
* AllocADsMem [ACTIVEDS.14]
|
|
|
|
*/
|
|
|
|
LPVOID WINAPI AllocADsMem(DWORD cb)
|
|
|
|
{
|
2020-02-12 11:17:40 +01:00
|
|
|
return HeapAlloc(GetProcessHeap(), 0, cb);
|
2010-11-12 19:21:23 +01:00
|
|
|
}
|
|
|
|
|
2005-06-13 13:47:46 +02:00
|
|
|
/*****************************************************
|
|
|
|
* FreeADsMem [ACTIVEDS.15]
|
|
|
|
*/
|
2005-06-17 22:56:21 +02:00
|
|
|
BOOL WINAPI FreeADsMem(LPVOID pMem)
|
2005-06-13 13:47:46 +02:00
|
|
|
{
|
2020-02-12 11:17:40 +01:00
|
|
|
return HeapFree(GetProcessHeap(), 0, pMem);
|
2005-06-13 13:47:46 +02:00
|
|
|
}
|
2010-11-12 19:21:23 +01:00
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* ReallocADsMem [ACTIVEDS.16]
|
|
|
|
*/
|
|
|
|
LPVOID WINAPI ReallocADsMem(LPVOID pOldMem, DWORD cbOld, DWORD cbNew)
|
|
|
|
{
|
2020-02-18 12:33:38 +01:00
|
|
|
return HeapReAlloc(GetProcessHeap(), 0, pOldMem, cbNew);
|
2010-11-12 19:21:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* AllocADsStr [ACTIVEDS.17]
|
|
|
|
*/
|
|
|
|
LPWSTR WINAPI AllocADsStr(LPWSTR pStr)
|
|
|
|
{
|
2020-02-18 12:33:41 +01:00
|
|
|
LPWSTR ret;
|
|
|
|
SIZE_T len;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", pStr);
|
|
|
|
|
|
|
|
if (!pStr) return NULL;
|
|
|
|
|
|
|
|
len = (wcslen(pStr) + 1) * sizeof(WCHAR);
|
|
|
|
ret = AllocADsMem(len);
|
|
|
|
if (ret) memcpy(ret, pStr, len);
|
|
|
|
|
|
|
|
return ret;
|
2010-11-12 19:21:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* FreeADsStr [ACTIVEDS.18]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI FreeADsStr(LPWSTR pStr)
|
|
|
|
{
|
2020-02-18 12:33:41 +01:00
|
|
|
TRACE("(%p)\n", pStr);
|
|
|
|
|
|
|
|
return FreeADsMem(pStr);
|
2010-11-12 19:21:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* ReallocADsStr [ACTIVEDS.19]
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ReallocADsStr(LPWSTR *ppStr, LPWSTR pStr)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p)!stub\n",*ppStr, pStr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* ADsEncodeBinaryData [ACTIVEDS.20]
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI ADsEncodeBinaryData(PBYTE pbSrcData, DWORD dwSrcLen, LPWSTR *ppszDestData)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%d,%p)!stub\n", pbSrcData, dwSrcLen, *ppszDestData);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|