From 5e436637fe33b866d096b8a79810104e8103bed3 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Tue, 28 Apr 2026 12:03:20 +0300 Subject: [PATCH] [ACTIVEDS] Sync to Wine-10.0 Also add it's COM registration, so it actually works. --- dll/win32/activeds/CMakeLists.txt | 12 +- dll/win32/activeds/activeds.idl | 27 ++ dll/win32/activeds/activeds.spec | 35 +- dll/win32/activeds/activeds_main.c | 179 ++++++--- dll/win32/activeds/pathname.c | 561 +++++++++++++++++++++++++++++ dll/win32/activeds/precomp.h | 6 +- dll/win32/activeds/stubs.c | 37 ++ media/doc/WINESYNC.txt | 2 +- media/inf/syssetup.inf | 1 + 9 files changed, 790 insertions(+), 70 deletions(-) create mode 100644 dll/win32/activeds/activeds.idl create mode 100644 dll/win32/activeds/pathname.c diff --git a/dll/win32/activeds/CMakeLists.txt b/dll/win32/activeds/CMakeLists.txt index 566a3b271c6..029085c7edb 100644 --- a/dll/win32/activeds/CMakeLists.txt +++ b/dll/win32/activeds/CMakeLists.txt @@ -3,6 +3,7 @@ spec2def(activeds.dll activeds.spec ADD_IMPORTLIB) list(APPEND SOURCE activeds_main.c + pathname.c stubs.c precomp.h) @@ -10,9 +11,14 @@ add_library(activeds MODULE ${SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/activeds.def) +if(MSVC) + target_compile_options(activeds PRIVATE /wd4267) # conversion from 'size_t' to 'int', possible loss of data +endif() + set_module_type(activeds win32dll) -target_link_libraries(activeds wine) -add_importlibs(activeds msvcrt kernel32 ntdll) +add_idl_reg_scripts(activeds registry activeds.idl) +target_link_libraries(activeds wine wine_dll_register wine_dll_canunload uuid oldnames) +add_importlibs(activeds ole32 oleaut32 advapi32 msvcrt kernel32 ntdll) add_pch(activeds precomp.h SOURCE) add_cd_file(TARGET activeds DESTINATION reactos/system32 FOR all) -set_wine_module(activeds) +set_wine_module_FIXME(activeds) # CORE-5743: No ARRAY_SIZE macro diff --git a/dll/win32/activeds/activeds.idl b/dll/win32/activeds/activeds.idl new file mode 100644 index 00000000000..561c47ce0ea --- /dev/null +++ b/dll/win32/activeds/activeds.idl @@ -0,0 +1,27 @@ +/* + * Copyright 2020 Dmitry Timoshkov + * + * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#pragma makedep register + +[ + helpstring("ADs LDAP Pathname Descriptor Object"), + progid("Pathname"), + uuid(080d0d78-f421-11d0-a36e-00c04fb950dc), + threading(both) +] +coclass Pathname { interface IADsPathname; } diff --git a/dll/win32/activeds/activeds.spec b/dll/win32/activeds/activeds.spec index 4fad6c966df..f1da746fc39 100644 --- a/dll/win32/activeds/activeds.spec +++ b/dll/win32/activeds/activeds.spec @@ -5,27 +5,28 @@ 7 stdcall ADsBuildVarArrayStr(ptr long ptr) 8 stdcall ADsBuildVarArrayInt(ptr long ptr) 9 stdcall ADsOpenObject(wstr wstr wstr long ptr ptr) -#@ stdcall -private DllCanUnloadNow() -#@ stdcall -private DllGetClassObject(ptr ptr ptr) -12 stdcall ADsSetLastError(long ptr ptr) -13 stdcall ADsGetLastError(ptr ptr long ptr long) -14 stdcall AllocADsMem(long) -15 stdcall FreeADsMem(ptr) -16 stdcall ReallocADsMem(ptr long long) -17 stdcall AllocADsStr(ptr) -18 stdcall FreeADsStr(ptr) -19 stdcall ReallocADsStr(ptr ptr) -20 stdcall ADsEncodeBinaryData(ptr long ptr) +12 stdcall ADsSetLastError(long ptr ptr) # adsldpc.ADsSetLastError +13 stdcall ADsGetLastError(ptr ptr long ptr long) # adsldpc.ADsGetLastError +14 stdcall AllocADsMem(long) # adsldpc.AllocADsMem +15 stdcall FreeADsMem(ptr) # adsldpc.FreeADsMem +16 stdcall ReallocADsMem(ptr long long) # adsldpc.ReallocADsMem +17 stdcall AllocADsStr(ptr) # adsldpc.AllocADsStr +18 stdcall FreeADsStr(ptr) # adsldpc.FreeADsStr +19 stdcall ReallocADsStr(ptr ptr) # adsldpc.ReallocADsStr +20 stdcall ADsEncodeBinaryData(ptr long ptr) # adsldpc.ADsEncodeBinaryData 21 stdcall PropVariantToAdsType(ptr long ptr ptr) 22 stdcall AdsTypeToPropVariant(ptr long ptr) 23 stdcall AdsFreeAdsValues(ptr long) -24 stdcall ADsDecodeBinaryData(wstr ptr long) +24 stdcall ADsDecodeBinaryData(wstr ptr long) # adsldpc.ADsDecodeBinaryData 25 cdecl AdsTypeToPropVariant2() # unknown prototype 26 cdecl PropVariantToAdsType2() # unknown prototype 27 cdecl ConvertSecDescriptorToVariant() # unknown prototype 28 cdecl ConvertSecurityDescriptorToSecDes() # unknown prototype -# BinarySDToSecurityDescriptor -# SecurityDescriptorToBinarySD -# ConvertTrusteeToSid -#@ stdcall -private DllRegisterServer() -#@ stdcall -private DllUnregisterServer() +29 stdcall BinarySDToSecurityDescriptor(ptr ptr wstr wstr wstr long) +30 stdcall SecurityDescriptorToBinarySD(long long long long ptr ptr wstr wstr wstr long) +31 cdecl -version=0x600+ ConvertTrusteeToSid() # unknown prototype + +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/dll/win32/activeds/activeds_main.c b/dll/win32/activeds/activeds_main.c index 5407ea9dc6e..0f13a5629b6 100644 --- a/dll/win32/activeds/activeds_main.c +++ b/dll/win32/activeds/activeds_main.c @@ -2,6 +2,7 @@ * Implementation of the Active Directory Service Interface * * Copyright 2005 Detlef Riekenberg + * Copyright 2019 Dmitry Timoshkov * * This file contains only stubs to get the printui.dll up and running * activeds.dll is much much more than this @@ -30,40 +31,26 @@ #include "winuser.h" #include "objbase.h" +#include "initguid.h" #include "iads.h" #include "adshlp.h" +#include "adserr.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(activeds); -/***************************************************** - * DllMain - */ -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - TRACE("(%p, %d, %p)\n",hinstDLL, fdwReason, lpvReserved); - - switch(fdwReason) - { -#ifndef __REACTOS__ - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ -#endif - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls( hinstDLL ); - break; - } - return TRUE; -} - /***************************************************** * ADsGetObject [ACTIVEDS.3] */ -HRESULT WINAPI ADsGetObject(LPCWSTR lpszPathName, REFIID riid, VOID** ppObject) +HRESULT WINAPI ADsGetObject(LPCWSTR path, REFIID riid, void **obj) { - FIXME("(%s)->(%s,%p)!stub\n",debugstr_w(lpszPathName), debugstr_guid(riid), ppObject); - return E_NOTIMPL; + HRESULT hr; + + hr = ADsOpenObject(path, NULL, NULL, ADS_SECURE_AUTHENTICATION, riid, obj); + if (hr != S_OK) + hr = ADsOpenObject(path, NULL, NULL, 0, riid, obj); + return hr; } /***************************************************** @@ -89,17 +76,51 @@ HRESULT WINAPI ADsFreeEnumerator(IEnumVARIANT* pEnumVariant) */ HRESULT WINAPI ADsEnumerateNext(IEnumVARIANT* pEnumVariant, ULONG cElements, VARIANT* pvar, ULONG * pcElementsFetched) { - FIXME("(%p)->(%u, %p, %p)!stub\n",pEnumVariant, cElements, pvar, pcElementsFetched); + FIXME("(%p)->(%lu, %p, %p)!stub\n",pEnumVariant, cElements, pvar, pcElementsFetched); return E_NOTIMPL; } /***************************************************** * ADsBuildVarArrayStr [ACTIVEDS.7] */ -HRESULT WINAPI ADsBuildVarArrayStr(LPWSTR *lppPathNames, DWORD dwPathNames, VARIANT* pvar) +HRESULT WINAPI ADsBuildVarArrayStr(LPWSTR *str, DWORD count, VARIANT *var) { - FIXME("(%p, %d, %p)!stub\n",*lppPathNames, dwPathNames, pvar); - return E_NOTIMPL; + HRESULT hr; + SAFEARRAY *sa; + LONG idx, end = count; + + TRACE("(%p, %lu, %p)\n", str, count, var); + + if (!var) return E_ADS_BAD_PARAMETER; + + sa = SafeArrayCreateVector(VT_VARIANT, 0, count); + if (!sa) return E_OUTOFMEMORY; + + VariantInit(var); + for (idx = 0; idx < end; idx++) + { + VARIANT item; + + V_VT(&item) = VT_BSTR; + V_BSTR(&item) = SysAllocString(str[idx]); + if (!V_BSTR(&item)) + { + hr = E_OUTOFMEMORY; + goto fail; + } + + hr = SafeArrayPutElement(sa, &idx, &item); + SysFreeString(V_BSTR(&item)); + if (hr != S_OK) goto fail; + } + + V_VT(var) = VT_ARRAY | VT_VARIANT; + V_ARRAY(var) = sa; + return S_OK; + +fail: + SafeArrayDestroy(sa); + return hr; } /***************************************************** @@ -107,18 +128,87 @@ HRESULT WINAPI ADsBuildVarArrayStr(LPWSTR *lppPathNames, DWORD dwPathNames, VARI */ HRESULT WINAPI ADsBuildVarArrayInt(LPDWORD lpdwObjectTypes, DWORD dwObjectTypes, VARIANT* pvar) { - FIXME("(%p, %d, %p)!stub\n",lpdwObjectTypes, dwObjectTypes, pvar); + FIXME("(%p, %ld, %p)!stub\n",lpdwObjectTypes, dwObjectTypes, pvar); return E_NOTIMPL; } /***************************************************** * ADsOpenObject [ACTIVEDS.9] */ -HRESULT WINAPI ADsOpenObject(LPCWSTR lpszPathName, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwReserved, REFIID riid, VOID** ppObject) +HRESULT WINAPI ADsOpenObject(LPCWSTR path, LPCWSTR user, LPCWSTR password, DWORD reserved, REFIID riid, void **obj) { - FIXME("(%s,%s,%u,%s,%p)!stub\n", debugstr_w(lpszPathName), - debugstr_w(lpszUserName), dwReserved, debugstr_guid(riid), ppObject); - return E_NOTIMPL; + HRESULT hr; + HKEY hkey, hprov; + WCHAR provider[MAX_PATH], progid[MAX_PATH]; + DWORD idx = 0; + + TRACE("(%s,%s,%lu,%s,%p)\n", debugstr_w(path), debugstr_w(user), reserved, debugstr_guid(riid), obj); + + if (!path || !riid || !obj) + return E_INVALIDARG; + + hr = E_FAIL; + + if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\ADs\\Providers", 0, KEY_READ, &hkey)) + return hr; + + 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; } /***************************************************** @@ -126,7 +216,7 @@ HRESULT WINAPI ADsOpenObject(LPCWSTR lpszPathName, LPCWSTR lpszUserName, LPCWSTR */ VOID WINAPI ADsSetLastError(DWORD dwErr, LPWSTR pszError, LPWSTR pszProvider) { - FIXME("(%d,%p,%p)!stub\n", dwErr, pszError, pszProvider); + FIXME("(%ld,%p,%p)!stub\n", dwErr, pszError, pszProvider); } /***************************************************** @@ -134,7 +224,7 @@ VOID WINAPI ADsSetLastError(DWORD dwErr, LPWSTR pszError, LPWSTR pszProvider) */ 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); + FIXME("(%p,%p,%ld,%p,%ld)!stub\n", perror, errorbuf, errorbuflen, namebuf, namebuflen); return E_NOTIMPL; } @@ -143,8 +233,7 @@ HRESULT WINAPI ADsGetLastError(LPDWORD perror, LPWSTR errorbuf, DWORD errorbufle */ LPVOID WINAPI AllocADsMem(DWORD cb) { - FIXME("(%d)!stub\n",cb); - return NULL; + return malloc(cb); } /***************************************************** @@ -152,8 +241,8 @@ LPVOID WINAPI AllocADsMem(DWORD cb) */ BOOL WINAPI FreeADsMem(LPVOID pMem) { - FIXME("(%p)!stub\n",pMem); - return FALSE; + free(pMem); + return TRUE; } /***************************************************** @@ -161,8 +250,7 @@ BOOL WINAPI FreeADsMem(LPVOID pMem) */ LPVOID WINAPI ReallocADsMem(LPVOID pOldMem, DWORD cbOld, DWORD cbNew) { - FIXME("(%p,%d,%d)!stub\n", pOldMem, cbOld, cbNew); - return NULL; + return realloc(pOldMem, cbNew); } /***************************************************** @@ -170,8 +258,8 @@ LPVOID WINAPI ReallocADsMem(LPVOID pOldMem, DWORD cbOld, DWORD cbNew) */ LPWSTR WINAPI AllocADsStr(LPWSTR pStr) { - FIXME("(%p)!stub\n",pStr); - return NULL; + TRACE("(%p)\n", pStr); + return wcsdup(pStr); } /***************************************************** @@ -179,8 +267,9 @@ LPWSTR WINAPI AllocADsStr(LPWSTR pStr) */ BOOL WINAPI FreeADsStr(LPWSTR pStr) { - FIXME("(%p)!stub\n",pStr); - return FALSE; + TRACE("(%p)\n", pStr); + + return FreeADsMem(pStr); } /***************************************************** @@ -197,6 +286,6 @@ BOOL WINAPI ReallocADsStr(LPWSTR *ppStr, LPWSTR pStr) */ HRESULT WINAPI ADsEncodeBinaryData(PBYTE pbSrcData, DWORD dwSrcLen, LPWSTR *ppszDestData) { - FIXME("(%p,%d,%p)!stub\n", pbSrcData, dwSrcLen, *ppszDestData); + FIXME("(%p,%ld,%p)!stub\n", pbSrcData, dwSrcLen, *ppszDestData); return E_NOTIMPL; } diff --git a/dll/win32/activeds/pathname.c b/dll/win32/activeds/pathname.c new file mode 100644 index 00000000000..8142e47e244 --- /dev/null +++ b/dll/win32/activeds/pathname.c @@ -0,0 +1,561 @@ +/* + * Copyright 2020 Dmitry Timoshkov + * + * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "iads.h" +#include "adserr.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(activeds); + +#include "initguid.h" +DEFINE_GUID(CLSID_Pathname,0x080d0d78,0xf421,0x11d0,0xa3,0x6e,0x00,0xc0,0x4f,0xb9,0x50,0xdc); + +typedef struct +{ + IADsPathname IADsPathname_iface; + LONG ref; + BSTR provider, server, dn; +} Pathname; + +static inline Pathname *impl_from_IADsPathname(IADsPathname *iface) +{ + return CONTAINING_RECORD(iface, Pathname, IADsPathname_iface); +} + +static HRESULT WINAPI path_QueryInterface(IADsPathname *iface, REFIID riid, void **obj) +{ + TRACE("%p,%s,%p\n", iface, debugstr_guid(riid), obj); + + if (!riid || !obj) return E_INVALIDARG; + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IDispatch) || + IsEqualGUID(riid, &IID_IADsPathname)) + { + IADsPathname_AddRef(iface); + *obj = iface; + return S_OK; + } + + FIXME("interface %s is not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI path_AddRef(IADsPathname *iface) +{ + Pathname *path = impl_from_IADsPathname(iface); + return InterlockedIncrement(&path->ref); +} + +static ULONG WINAPI path_Release(IADsPathname *iface) +{ + Pathname *path = impl_from_IADsPathname(iface); + LONG ref = InterlockedDecrement(&path->ref); + + if (!ref) + { + TRACE("destroying %p\n", iface); + SysFreeString(path->provider); + SysFreeString(path->server); + SysFreeString(path->dn); + free(path); + } + + return ref; +} + +static HRESULT WINAPI path_GetTypeInfoCount(IADsPathname *iface, UINT *count) +{ + FIXME("%p,%p: stub\n", iface, count); + return E_NOTIMPL; +} + +static HRESULT WINAPI path_GetTypeInfo(IADsPathname *iface, UINT index, LCID lcid, ITypeInfo **info) +{ + FIXME("%p,%u,%#lx,%p: stub\n", iface, index, lcid, info); + return E_NOTIMPL; +} + +static HRESULT WINAPI path_GetIDsOfNames(IADsPathname *iface, REFIID riid, LPOLESTR *names, + UINT count, LCID lcid, DISPID *dispid) +{ + FIXME("%p,%s,%p,%u,%lu,%p: stub\n", iface, debugstr_guid(riid), names, count, lcid, dispid); + return E_NOTIMPL; +} + +static HRESULT WINAPI path_Invoke(IADsPathname *iface, DISPID dispid, REFIID riid, LCID lcid, WORD flags, + DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *argerr) +{ + FIXME("%p,%ld,%s,%04lx,%04x,%p,%p,%p,%p: stub\n", iface, dispid, debugstr_guid(riid), lcid, flags, + params, result, excepinfo, argerr); + return E_NOTIMPL; +} + +static HRESULT parse_path(BSTR path, BSTR *provider, BSTR *server, BSTR *dn) +{ + WCHAR *p, *p_server; + int server_len; + + *provider = NULL; + *server = NULL; + *dn = NULL; + + if (wcsnicmp(path, L"LDAP:", 5) != 0) + return E_ADS_BAD_PATHNAME; + + *provider = SysAllocStringLen(path, 4); + if (!*provider) return E_OUTOFMEMORY; + + p = path + 5; + if (!*p) return S_OK; + + if (*p++ != '/' || *p++ != '/' || !*p) + { + SysFreeString(*provider); + return E_ADS_BAD_PATHNAME; + } + + p_server = p; + server_len = 0; + while (*p && *p != '/') + { + p++; + server_len++; + } + if (server_len == 0) + { + SysFreeString(*provider); + return E_ADS_BAD_PATHNAME; + } + + *server = SysAllocStringLen(p_server, server_len); + if (!*server) + { + SysFreeString(*provider); + return E_OUTOFMEMORY; + } + + if (!*p) return S_OK; + + if (*p++ != '/' || !*p) + { + SysFreeString(*provider); + SysFreeString(*server); + return E_ADS_BAD_PATHNAME; + } + + *dn = SysAllocString(p); + if (!*dn) + { + SysFreeString(*provider); + SysFreeString(*server); + return E_OUTOFMEMORY; + } + + return S_OK; +} + +static HRESULT WINAPI path_Set(IADsPathname *iface, BSTR adspath, LONG type) +{ + Pathname *path = impl_from_IADsPathname(iface); + HRESULT hr; + BSTR provider, server, dn; + + TRACE("%p,%s,%ld\n", iface, debugstr_w(adspath), type); + + if (!adspath) return E_INVALIDARG; + + if (type == ADS_SETTYPE_PROVIDER) + { + SysFreeString(path->provider); + path->provider = SysAllocString(adspath); + return path->provider ? S_OK : E_OUTOFMEMORY; + } + + if (type == ADS_SETTYPE_SERVER) + { + SysFreeString(path->server); + path->server = SysAllocString(adspath); + return path->server ? S_OK : E_OUTOFMEMORY; + } + + if (type == ADS_SETTYPE_DN) + { + SysFreeString(path->dn); + path->dn = SysAllocString(adspath); + return path->dn ? S_OK : E_OUTOFMEMORY; + } + + if (type != ADS_SETTYPE_FULL) + { + FIXME("type %ld not implemented\n", type); + return E_INVALIDARG; + } + + hr = parse_path(adspath, &provider, &server, &dn); + if (hr == S_OK) + { + SysFreeString(path->provider); + SysFreeString(path->server); + SysFreeString(path->dn); + + path->provider = provider; + path->server = server; + path->dn = dn; + } + return hr; +} + +static HRESULT WINAPI path_SetDisplayType(IADsPathname *iface, LONG type) +{ + FIXME("%p,%ld: stub\n", iface, type); + return E_NOTIMPL; +} + +static HRESULT WINAPI path_Retrieve(IADsPathname *iface, LONG type, BSTR *adspath) +{ + Pathname *path = impl_from_IADsPathname(iface); + int len; + + TRACE("%p,%ld,%p\n", iface, type, adspath); + + if (!adspath) return E_INVALIDARG; + + switch (type) + { + default: + FIXME("type %ld not implemented\n", type); + /* fall through */ + + case ADS_FORMAT_X500: + len = wcslen(path->provider) + 3; + if (path->server) len += wcslen(path->server) + 1; + if (path->dn) len += wcslen(path->dn); + + *adspath = SysAllocStringLen(NULL, len); + if (!*adspath) break; + + wcscpy(*adspath, path->provider); + wcscat(*adspath, L"://"); + if (path->server) + { + wcscat(*adspath, path->server); + wcscat(*adspath, L"/"); + } + if (path->dn) wcscat(*adspath, path->dn); + break; + + case ADS_FORMAT_PROVIDER: + *adspath = SysAllocString(path->provider); + break; + + case ADS_FORMAT_SERVER: + *adspath = path->provider ? SysAllocString(path->server) : SysAllocStringLen(NULL, 0); + break; + + case ADS_FORMAT_X500_DN: + *adspath = path->dn ? SysAllocString(path->dn) : SysAllocStringLen(NULL, 0); + break; + + case ADS_FORMAT_LEAF: + if (!path->dn) + *adspath = SysAllocStringLen(NULL, 0); + else + { + WCHAR *p = wcschr(path->dn, ','); + *adspath = p ? SysAllocStringLen(path->dn, p - path->dn) : SysAllocString(path->dn); + } + break; + } + + TRACE("=> %s\n", debugstr_w(*adspath)); + return *adspath ? S_OK : E_OUTOFMEMORY; +} + +static HRESULT WINAPI path_GetNumElements(IADsPathname *iface, LONG *count) +{ + Pathname *path = impl_from_IADsPathname(iface); + WCHAR *p; + + TRACE("%p,%p\n", iface, count); + + if (!count) return E_INVALIDARG; + + *count = 0; + + p = path->dn; + while (p) + { + *count += 1; + p = wcschr(p, ','); + if (p) p++; + } + + return S_OK; +} + +static HRESULT WINAPI path_GetElement(IADsPathname *iface, LONG index, BSTR *element) +{ + Pathname *path = impl_from_IADsPathname(iface); + HRESULT hr; + WCHAR *p, *end; + LONG count; + + TRACE("%p,%ld,%p\n", iface, index, element); + + if (!element) return E_INVALIDARG; + + count = 0; + hr = HRESULT_FROM_WIN32(ERROR_INVALID_INDEX); + + p = path->dn; + while (p) + { + end = wcschr(p, ','); + + if (index == count) + { + *element = end ? SysAllocStringLen(p, end - p) : SysAllocString(p); + hr = *element ? S_OK : E_OUTOFMEMORY; + break; + } + + p = end ? end + 1 : NULL; + count++; + } + + return hr; +} + +static HRESULT WINAPI path_AddLeafElement(IADsPathname *iface, BSTR element) +{ + FIXME("%p,%s: stub\n", iface, debugstr_w(element)); + return E_NOTIMPL; +} + +static HRESULT WINAPI path_RemoveLeafElement(IADsPathname *iface) +{ + FIXME("%p: stub\n", iface); + return E_NOTIMPL; +} + +static HRESULT WINAPI path_CopyPath(IADsPathname *iface, IDispatch **path) +{ + FIXME("%p,%p: stub\n", iface, path); + return E_NOTIMPL; +} + +static HRESULT WINAPI path_GetEscapedElement(IADsPathname *iface, LONG reserved, BSTR element, BSTR *str) +{ + FIXME("%p,%ld,%s,%p: stub\n", iface, reserved, debugstr_w(element), str); + return E_NOTIMPL; +} + +static HRESULT WINAPI path_get_EscapedMode(IADsPathname *iface, LONG *mode) +{ + FIXME("%p,%p: stub\n", iface, mode); + return E_NOTIMPL; +} + +static HRESULT WINAPI path_put_EscapedMode(IADsPathname *iface, LONG mode) +{ + FIXME("%p,%ld: stub\n", iface, mode); + return E_NOTIMPL; +} + +static const IADsPathnameVtbl IADsPathname_vtbl = +{ + path_QueryInterface, + path_AddRef, + path_Release, + path_GetTypeInfoCount, + path_GetTypeInfo, + path_GetIDsOfNames, + path_Invoke, + path_Set, + path_SetDisplayType, + path_Retrieve, + path_GetNumElements, + path_GetElement, + path_AddLeafElement, + path_RemoveLeafElement, + path_CopyPath, + path_GetEscapedElement, + path_get_EscapedMode, + path_put_EscapedMode +}; + +static HRESULT Pathname_create(REFIID riid, void **obj) +{ + Pathname *path; + HRESULT hr; + + path = malloc(sizeof(*path)); + if (!path) return E_OUTOFMEMORY; + + path->IADsPathname_iface.lpVtbl = &IADsPathname_vtbl; + path->ref = 1; + path->provider = SysAllocString(L"LDAP"); + path->server = NULL; + path->dn = NULL; + + hr = IADsPathname_QueryInterface(&path->IADsPathname_iface, riid, obj); + IADsPathname_Release(&path->IADsPathname_iface); + + return hr; +} + +static const struct class_info +{ + const CLSID *clsid; + HRESULT (*constructor)(REFIID, void **); +} class_info[] = +{ + { &CLSID_Pathname, Pathname_create } +}; + +typedef struct +{ + IClassFactory IClassFactory_iface; + LONG ref; + const struct class_info *info; +} class_factory; + +static inline class_factory *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, class_factory, IClassFactory_iface); +} + +static HRESULT WINAPI factory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *obj) +{ + TRACE("%p,%s,%p\n", iface, debugstr_guid(riid), obj); + + if (!riid || !obj) return E_INVALIDARG; + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IClassFactory)) + { + IClassFactory_AddRef(iface); + *obj = iface; + return S_OK; + } + + *obj = NULL; + FIXME("interface %s is not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI factory_AddRef(IClassFactory *iface) +{ + class_factory *factory = impl_from_IClassFactory(iface); + ULONG ref = InterlockedIncrement(&factory->ref); + + TRACE("(%p) ref %lu\n", iface, ref); + + return ref; +} + +static ULONG WINAPI factory_Release(IClassFactory *iface) +{ + class_factory *factory = impl_from_IClassFactory(iface); + ULONG ref = InterlockedDecrement(&factory->ref); + + TRACE("(%p) ref %lu\n", iface, ref); + + if (!ref) + free(factory); + + return ref; +} + +static HRESULT WINAPI factory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **obj) +{ + class_factory *factory = impl_from_IClassFactory(iface); + + TRACE("%p,%s,%p\n", outer, debugstr_guid(riid), obj); + + if (!riid || !obj) return E_INVALIDARG; + + *obj = NULL; + if (outer) return CLASS_E_NOAGGREGATION; + + return factory->info->constructor(riid, obj); +} + +static HRESULT WINAPI factory_LockServer(IClassFactory *iface, BOOL lock) +{ + FIXME("%p,%d: stub\n", iface, lock); + return S_OK; +} + +static const struct IClassFactoryVtbl factory_vtbl = +{ + factory_QueryInterface, + factory_AddRef, + factory_Release, + factory_CreateInstance, + factory_LockServer +}; + +static HRESULT factory_constructor(const struct class_info *info, REFIID riid, void **obj) +{ + class_factory *factory; + HRESULT hr; + + factory = malloc(sizeof(*factory)); + if (!factory) return E_OUTOFMEMORY; + + factory->IClassFactory_iface.lpVtbl = &factory_vtbl; + factory->ref = 1; + factory->info = info; + + hr = IClassFactory_QueryInterface(&factory->IClassFactory_iface, riid, obj); + IClassFactory_Release(&factory->IClassFactory_iface); + + return hr; +} + +HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID *obj) +{ + int i; + + TRACE("%s,%s,%p\n", debugstr_guid(clsid), debugstr_guid(iid), obj); + + if (!clsid || !iid || !obj) return E_INVALIDARG; + + *obj = NULL; + + for (i = 0; i < ARRAY_SIZE(class_info); i++) + { + if (IsEqualCLSID(class_info[i].clsid, clsid)) + return factory_constructor(&class_info[i], iid, obj); + } + + FIXME("class %s/%s is not implemented\n", debugstr_guid(clsid), debugstr_guid(iid)); + return CLASS_E_CLASSNOTAVAILABLE; +} diff --git a/dll/win32/activeds/precomp.h b/dll/win32/activeds/precomp.h index e91f4cf153d..b5d766413a4 100644 --- a/dll/win32/activeds/precomp.h +++ b/dll/win32/activeds/precomp.h @@ -6,13 +6,11 @@ #define WIN32_NO_STATUS #define _INC_WINDOWS -#define COM_NO_WINDOWS_H - #define COBJMACROS -#define NONAMELESSUNION #include #include -#include +#include +#include #endif /* !_ACTIVEDS_PCH_ */ diff --git a/dll/win32/activeds/stubs.c b/dll/win32/activeds/stubs.c index c43ffac2ee3..92ff0f44188 100644 --- a/dll/win32/activeds/stubs.c +++ b/dll/win32/activeds/stubs.c @@ -75,3 +75,40 @@ int ConvertSecurityDescriptorToSecDes() __wine_spec_unimplemented_stub("activeds.dll", __FUNCTION__); return 0; } + +int ConvertTrusteeToSid() +{ + DbgPrint("WARNING: calling stub ConvertTrusteeToSid()\n"); + __wine_spec_unimplemented_stub("activeds.dll", __FUNCTION__); + return 0; +} + +HRESULT +WINAPI +BinarySDToSecurityDescriptor( + _In_ PSECURITY_DESCRIPTOR pSecurityDescriptor, + _Out_ VARIANT* pVarsec, + _In_ LPCWSTR pszServerName, + _In_ LPCWSTR userName, + _In_ LPCWSTR passWord, + _In_ DWORD dwFlags) +{ + DbgPrint("ACTIVEDS: %s is unimplemented, please try again later.\n", __FUNCTION__); + return E_NOTIMPL; +} + +HRESULT +WINAPI +SecurityDescriptorToBinarySD( + _In_ VARIANT vVarSecDes, + _Out_ PSECURITY_DESCRIPTOR *ppSecurityDescriptor, + _Out_ PDWORD pdwSDLength, + _In_ LPCWSTR pszServerName, + _In_ LPCWSTR userName, + _In_ LPCWSTR passWord, + _In_ DWORD dwFlags) +{ + DbgPrint("ACTIVEDS: %s is unimplemented, please try again later.\n", __FUNCTION__); + return E_NOTIMPL; +} + diff --git a/media/doc/WINESYNC.txt b/media/doc/WINESYNC.txt index 2fc78dced5b..fcaac32f4fd 100644 --- a/media/doc/WINESYNC.txt +++ b/media/doc/WINESYNC.txt @@ -49,7 +49,7 @@ dll/directx/wine/qedit # Synced to WineStaging-3.17 dll/directx/wine/quartz # Synced to WineStaging-3.9 dll/directx/wine/wined3d # Synced to WineStaging-3.3 -dll/win32/activeds # Synced to WineStaging-4.18 +dll/win32/activeds # Synced to Wine-10.0 dll/win32/actxprxy # Synced to WineStaging-3.3 dll/win32/advpack # Synced to WineStaging-4.18 dll/win32/atl # Synced to WineStaging-4.18 diff --git a/media/inf/syssetup.inf b/media/inf/syssetup.inf index 5f12090cba1..f500e9b4590 100644 --- a/media/inf/syssetup.inf +++ b/media/inf/syssetup.inf @@ -45,6 +45,7 @@ RegisterDlls = OleControlDlls AddReg=Classes [OleControlDlls] +11,,activeds.dll,1 11,,atl.dll,1 11,,actxprxy.dll,1 11,,acppage.dll,1