mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
- advapi32: Small implementation RegConnectRegistryW (from wine)
- Add inetcomm.dll from wine - Add nddeapi.dll from wine - Sync imm32 with wine svn path=/trunk/; revision=33314
This commit is contained in:
parent
ec6486f26c
commit
5e86e269b0
14 changed files with 5477 additions and 1090 deletions
|
@ -843,8 +843,35 @@ RegConnectRegistryW (LPCWSTR lpMachineName,
|
|||
HKEY hKey,
|
||||
PHKEY phkResult)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
LONG ret;
|
||||
|
||||
TRACE("(%s,%p,%p): stub\n",debugstr_w(lpMachineName),hKey,phkResult);
|
||||
|
||||
if (!lpMachineName || !*lpMachineName) {
|
||||
/* Use the local machine name */
|
||||
ret = RegOpenKeyW( hKey, NULL, phkResult );
|
||||
}
|
||||
else {
|
||||
WCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
DWORD len = sizeof(compName) / sizeof(WCHAR);
|
||||
|
||||
/* MSDN says lpMachineName must start with \\ : not so */
|
||||
if( lpMachineName[0] == '\\' && lpMachineName[1] == '\\')
|
||||
lpMachineName += 2;
|
||||
if (GetComputerNameW(compName, &len))
|
||||
{
|
||||
if (!_wcsicmp(lpMachineName, compName))
|
||||
ret = RegOpenKeyW(hKey, NULL, phkResult);
|
||||
else
|
||||
{
|
||||
FIXME("Connect to %s is not supported.\n",debugstr_w(lpMachineName));
|
||||
ret = ERROR_BAD_NETPATH;
|
||||
}
|
||||
}
|
||||
else
|
||||
ret = GetLastError();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5,10 +5,10 @@
|
|||
@ stdcall ImmConfigureIMEW(long long long ptr)
|
||||
@ stdcall ImmCreateContext()
|
||||
@ stdcall ImmCreateIMCC(long)
|
||||
@ stub ImmCreateSoftKeyboard
|
||||
@ stdcall ImmCreateSoftKeyboard(long long long long)
|
||||
@ stdcall ImmDestroyContext(long)
|
||||
@ stdcall ImmDestroyIMCC(long)
|
||||
@ stub ImmDestroySoftKeyboard
|
||||
@ stdcall ImmDestroySoftKeyboard(long)
|
||||
@ stdcall ImmDisableIME(long)
|
||||
@ stdcall ImmDisableIme(long) ImmDisableIME
|
||||
@ stub ImmEnumInputContext
|
||||
|
@ -72,15 +72,15 @@
|
|||
@ stub ImmLockImeDpi
|
||||
@ stdcall ImmNotifyIME(long long long long)
|
||||
@ stub ImmPenAuxInput
|
||||
@ stub ImmProcessKey
|
||||
@ stdcall ImmProcessKey(long long long long long)
|
||||
@ stub ImmPutImeMenuItemsIntoMappedFile
|
||||
@ stdcall ImmReSizeIMCC(long long)
|
||||
@ stub ImmRegisterClient
|
||||
@ stdcall ImmRegisterWordA(long str long str)
|
||||
@ stdcall ImmRegisterWordW(long wstr long wstr)
|
||||
@ stdcall ImmReleaseContext(long long)
|
||||
@ stub ImmRequestMessageA
|
||||
@ stub ImmRequestMessageW
|
||||
@ stdcall ImmRequestMessageA(ptr long long)
|
||||
@ stdcall ImmRequestMessageW(ptr long long)
|
||||
@ stub ImmSendIMEMessageExA
|
||||
@ stub ImmSendIMEMessageExW
|
||||
@ stub ImmSendMessageToActiveDefImeWndW
|
||||
|
@ -96,10 +96,10 @@
|
|||
#@ stdcall ImmSetHotKey(long long long ptr) user32.CliImmSetHotKey
|
||||
@ stdcall ImmSetOpenStatus(long long)
|
||||
@ stdcall ImmSetStatusWindowPos(long ptr)
|
||||
@ stub ImmShowSoftKeyboard
|
||||
@ stdcall ImmShowSoftKeyboard(long long)
|
||||
@ stdcall ImmSimulateHotKey(long long)
|
||||
@ stub ImmSystemHandler
|
||||
@ stub ImmTranslateMessage
|
||||
@ stdcall ImmTranslateMessage(long long long long)
|
||||
@ stub ImmUnlockClientImc
|
||||
@ stdcall ImmUnlockIMC(long)
|
||||
@ stdcall ImmUnlockIMCC(long)
|
||||
|
|
24
reactos/dll/win32/inetcomm/inetcomm.rbuild
Normal file
24
reactos/dll/win32/inetcomm/inetcomm.rbuild
Normal file
|
@ -0,0 +1,24 @@
|
|||
<module name="inetcomm" type="win32dll" baseaddress="${BASEADDRESS_INETCOMM}" installbase="system32" installname="inetcomm.dll" allowwarnings="true" entrypoint="0">
|
||||
<importlibrary definition="inetcomm.spec.def" />
|
||||
<include base="inetcomm">.</include>
|
||||
<include base="ReactOS">include/reactos/wine</include>
|
||||
<define name="__REACTOS__" />
|
||||
<define name="__WINESRC__" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x600</define>
|
||||
<define name="WINVER">0x600</define>
|
||||
<library>wine</library>
|
||||
<library>uuid</library>
|
||||
<library>ole32</library>
|
||||
<library>ws2_32</library>
|
||||
<library>user32</library>
|
||||
<library>advapi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
<file>inetcomm_main.c</file>
|
||||
<file>internettransport.c</file>
|
||||
<file>mimeole.c</file>
|
||||
<file>regsvr.c</file>
|
||||
<file>inetcomm.spec</file>
|
||||
</module>
|
106
reactos/dll/win32/inetcomm/inetcomm.spec
Normal file
106
reactos/dll/win32/inetcomm/inetcomm.spec
Normal file
|
@ -0,0 +1,106 @@
|
|||
@ stub CreateIMAPTransport2
|
||||
@ stub CreateIMAPTransport
|
||||
@ stub CreateNNTPTransport
|
||||
@ stub CreatePOP3Transport
|
||||
@ stub CreateRASTransport
|
||||
@ stub CreateRangeList
|
||||
@ stub CreateSMTPTransport
|
||||
@ stdcall -private DllCanUnloadNow()
|
||||
@ stdcall -private DllGetClassObject(ptr ptr ptr)
|
||||
@ stdcall -private DllRegisterServer()
|
||||
@ stdcall -private DllUnregisterServer()
|
||||
@ stub EssContentHintDecodeEx
|
||||
@ stub EssContentHintEncodeEx
|
||||
@ stub EssKeyExchPreferenceDecodeEx
|
||||
@ stub EssKeyExchPreferenceEncodeEx
|
||||
@ stub EssMLHistoryDecodeEx
|
||||
@ stub EssMLHistoryEncodeEx
|
||||
@ stub EssReceiptDecodeEx
|
||||
@ stub EssReceiptEncodeEx
|
||||
@ stub EssReceiptRequestDecodeEx
|
||||
@ stub EssReceiptRequestEncodeEx
|
||||
@ stub EssSecurityLabelDecodeEx
|
||||
@ stub EssSecurityLabelEncodeEx
|
||||
@ stub EssSignCertificateDecodeEx
|
||||
@ stub EssSignCertificateEncodeEx
|
||||
@ stub GetDllMajorVersion
|
||||
@ stub HrAthGetFileName
|
||||
@ stub HrAthGetFileNameW
|
||||
@ stub HrAttachDataFromBodyPart
|
||||
@ stub HrAttachDataFromFile
|
||||
@ stub HrDoAttachmentVerb
|
||||
@ stub HrFreeAttachData
|
||||
@ stub HrGetAttachIcon
|
||||
@ stub HrGetAttachIconByFile
|
||||
@ stub HrGetDisplayNameWithSizeForFile
|
||||
@ stub HrGetLastOpenFileDirectory
|
||||
@ stub HrGetLastOpenFileDirectoryW
|
||||
@ stub HrSaveAttachToFile
|
||||
@ stub HrSaveAttachmentAs
|
||||
@ stub MimeEditCreateMimeDocument
|
||||
@ stub MimeEditDocumentFromStream
|
||||
@ stub MimeEditGetBackgroundImageUrl
|
||||
@ stub MimeEditIsSafeToRun
|
||||
@ stub MimeEditViewSource
|
||||
@ stub MimeGetAddressFormatW
|
||||
@ stub MimeOleAlgNameFromSMimeCap
|
||||
@ stub MimeOleAlgStrengthFromSMimeCap
|
||||
@ stub MimeOleClearDirtyTree
|
||||
@ stub MimeOleConvertEnrichedToHTML
|
||||
@ stub MimeOleCreateBody
|
||||
@ stub MimeOleCreateByteStream
|
||||
@ stub MimeOleCreateHashTable
|
||||
@ stub MimeOleCreateHeaderTable
|
||||
@ stdcall MimeOleCreateMessage(ptr ptr)
|
||||
@ stub MimeOleCreateMessageParts
|
||||
@ stub MimeOleCreatePropertySet
|
||||
@ stdcall MimeOleCreateSecurity(ptr)
|
||||
@ stdcall MimeOleCreateVirtualStream(ptr)
|
||||
@ stub MimeOleDecodeHeader
|
||||
@ stub MimeOleEncodeHeader
|
||||
@ stub MimeOleFileTimeToInetDate
|
||||
@ stub MimeOleFindCharset
|
||||
@ stub MimeOleGenerateCID
|
||||
@ stub MimeOleGenerateFileName
|
||||
@ stub MimeOleGenerateMID
|
||||
@ stdcall MimeOleGetAllocator(ptr)
|
||||
@ stub MimeOleGetBodyPropA
|
||||
@ stub MimeOleGetBodyPropW
|
||||
@ stub MimeOleGetCertsFromThumbprints
|
||||
@ stdcall MimeOleGetCharsetInfo(ptr ptr)
|
||||
@ stub MimeOleGetCodePageCharset
|
||||
@ stub MimeOleGetCodePageInfo
|
||||
@ stub MimeOleGetContentTypeExt
|
||||
@ stub MimeOleGetDefaultCharset
|
||||
@ stub MimeOleGetExtContentType
|
||||
@ stub MimeOleGetFileExtension
|
||||
@ stub MimeOleGetFileInfo
|
||||
@ stub MimeOleGetFileInfoW
|
||||
@ stub MimeOleGetInternat
|
||||
@ stub MimeOleGetPropA
|
||||
@ stub MimeOleGetPropW
|
||||
@ stub MimeOleGetPropertySchema
|
||||
@ stub MimeOleGetRelatedSection
|
||||
@ stub MimeOleInetDateToFileTime
|
||||
@ stub MimeOleObjectFromMoniker
|
||||
@ stub MimeOleOpenFileStream
|
||||
@ stub MimeOleParseMhtmlUrl
|
||||
@ stub MimeOleParseRfc822Address
|
||||
@ stub MimeOleParseRfc822AddressW
|
||||
@ stub MimeOleSMimeCapAddCert
|
||||
@ stub MimeOleSMimeCapAddSMimeCap
|
||||
@ stub MimeOleSMimeCapGetEncAlg
|
||||
@ stub MimeOleSMimeCapGetHashAlg
|
||||
@ stub MimeOleSMimeCapInit
|
||||
@ stub MimeOleSMimeCapRelease
|
||||
@ stub MimeOleSMimeCapsFromDlg
|
||||
@ stub MimeOleSMimeCapsFull
|
||||
@ stub MimeOleSMimeCapsToDlg
|
||||
@ stub MimeOleSetBodyPropA
|
||||
@ stub MimeOleSetBodyPropW
|
||||
@ stdcall MimeOleSetCompatMode(long)
|
||||
@ stub MimeOleSetDefaultCharset
|
||||
@ stub MimeOleSetPropA
|
||||
@ stub MimeOleSetPropW
|
||||
@ stub MimeOleStripHeaders
|
||||
@ stub MimeOleUnEscapeStringInPlace
|
171
reactos/dll/win32/inetcomm/inetcomm_main.c
Normal file
171
reactos/dll/win32/inetcomm/inetcomm_main.c
Normal file
|
@ -0,0 +1,171 @@
|
|||
/*
|
||||
* Internet Messaging APIs
|
||||
*
|
||||
* Copyright 2006 Robert Shearman for CodeWeavers
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnt.h"
|
||||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "mimeole.h"
|
||||
|
||||
#include "inetcomm_private.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(inetcomm);
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
|
||||
|
||||
switch (fdwReason)
|
||||
{
|
||||
case DLL_WINE_PREATTACH:
|
||||
return FALSE;
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
if (!InternetTransport_RegisterClass(hinstDLL))
|
||||
return FALSE;
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
InternetTransport_UnregisterClass(hinstDLL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* ClassFactory
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
const struct IClassFactoryVtbl *lpVtbl;
|
||||
HRESULT (*create_object)(IUnknown *, void **);
|
||||
} cf;
|
||||
|
||||
static inline cf *impl_from_IClassFactory( IClassFactory *iface )
|
||||
{
|
||||
return (cf *)((char*)iface - FIELD_OFFSET(cf, lpVtbl));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI cf_QueryInterface( IClassFactory *iface, REFIID riid, LPVOID *ppobj )
|
||||
{
|
||||
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
||||
IsEqualGUID(riid, &IID_IClassFactory))
|
||||
{
|
||||
IClassFactory_AddRef( iface );
|
||||
*ppobj = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
FIXME("interface %s not implemented\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI cf_AddRef( IClassFactory *iface )
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI cf_Release( IClassFactory *iface )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI cf_CreateInstance( IClassFactory *iface, LPUNKNOWN pOuter,
|
||||
REFIID riid, LPVOID *ppobj )
|
||||
{
|
||||
cf *This = impl_from_IClassFactory( iface );
|
||||
HRESULT r;
|
||||
IUnknown *punk;
|
||||
|
||||
TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj );
|
||||
|
||||
*ppobj = NULL;
|
||||
|
||||
r = This->create_object( pOuter, (LPVOID*) &punk );
|
||||
if (FAILED(r))
|
||||
return r;
|
||||
|
||||
r = IUnknown_QueryInterface( punk, riid, ppobj );
|
||||
IUnknown_Release( punk );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI cf_LockServer( IClassFactory *iface, BOOL dolock)
|
||||
{
|
||||
FIXME("(%p)->(%d),stub!\n",iface,dolock);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const struct IClassFactoryVtbl cf_vtbl =
|
||||
{
|
||||
cf_QueryInterface,
|
||||
cf_AddRef,
|
||||
cf_Release,
|
||||
cf_CreateInstance,
|
||||
cf_LockServer
|
||||
};
|
||||
|
||||
static cf mime_body_cf = { &cf_vtbl, MimeBody_create };
|
||||
static cf mime_allocator_cf = { &cf_vtbl, MimeAllocator_create };
|
||||
|
||||
/***********************************************************************
|
||||
* DllGetClassObject (INETCOMM.@)
|
||||
*/
|
||||
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
|
||||
{
|
||||
IClassFactory *cf = NULL;
|
||||
|
||||
TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv );
|
||||
|
||||
if( IsEqualCLSID( rclsid, &CLSID_IMimeBody ))
|
||||
{
|
||||
cf = (IClassFactory*) &mime_body_cf.lpVtbl;
|
||||
}
|
||||
else if( IsEqualCLSID( rclsid, &CLSID_IMimeAllocator ))
|
||||
{
|
||||
cf = (IClassFactory*) &mime_allocator_cf.lpVtbl;
|
||||
}
|
||||
|
||||
if ( !cf )
|
||||
{
|
||||
FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
|
||||
return IClassFactory_QueryInterface( cf, iid, ppv );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllCanUnloadNow (INETCOMM.@)
|
||||
*/
|
||||
HRESULT WINAPI DllCanUnloadNow(void)
|
||||
{
|
||||
FIXME("\n");
|
||||
return S_FALSE;
|
||||
}
|
73
reactos/dll/win32/inetcomm/inetcomm_private.h
Normal file
73
reactos/dll/win32/inetcomm/inetcomm_private.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Internet Messaging APIs
|
||||
*
|
||||
* Copyright 2006 Robert Shearman for CodeWeavers
|
||||
*
|
||||
* 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 "winsock2.h"
|
||||
#include "winuser.h"
|
||||
#include "objbase.h"
|
||||
#include "imnxport.h"
|
||||
|
||||
typedef struct InternetTransport InternetTransport;
|
||||
|
||||
typedef void (*INETXPORT_COMPLETION_FUNCTION)(IInternetTransport *, char *, int);
|
||||
|
||||
struct InternetTransport
|
||||
{
|
||||
union
|
||||
{
|
||||
const IInternetTransportVtbl *vtbl;
|
||||
const ISMTPTransportVtbl *vtblSMTP;
|
||||
} u;
|
||||
|
||||
ITransportCallback *pCallback;
|
||||
IXPSTATUS Status;
|
||||
INETSERVER ServerInfo;
|
||||
SOCKET Socket;
|
||||
boolean fCommandLogging;
|
||||
boolean fInitialised;
|
||||
INETXPORT_COMPLETION_FUNCTION fnCompletion;
|
||||
char *pBuffer;
|
||||
int cbBuffer;
|
||||
int iCurrentBufferOffset;
|
||||
HWND hwnd;
|
||||
};
|
||||
|
||||
HRESULT InternetTransport_Init(InternetTransport *This);
|
||||
HRESULT InternetTransport_GetServerInfo(InternetTransport *This, LPINETSERVER pInetServer);
|
||||
HRESULT InternetTransport_InetServerFromAccount(InternetTransport *This,
|
||||
IImnAccount *pAccount, LPINETSERVER pInetServer);
|
||||
HRESULT InternetTransport_Connect(InternetTransport *This,
|
||||
LPINETSERVER pInetServer, boolean fAuthenticate, boolean fCommandLogging);
|
||||
HRESULT InternetTransport_HandsOffCallback(InternetTransport *This);
|
||||
HRESULT InternetTransport_DropConnection(InternetTransport *This);
|
||||
HRESULT InternetTransport_GetStatus(InternetTransport *This,
|
||||
IXPSTATUS *pCurrentStatus);
|
||||
HRESULT InternetTransport_ChangeStatus(InternetTransport *This, IXPSTATUS Status);
|
||||
HRESULT InternetTransport_Read(InternetTransport *This, int cbBuffer,
|
||||
INETXPORT_COMPLETION_FUNCTION fnCompletion);
|
||||
HRESULT InternetTransport_ReadLine(InternetTransport *This,
|
||||
INETXPORT_COMPLETION_FUNCTION fnCompletion);
|
||||
HRESULT InternetTransport_Write(InternetTransport *This, const char *pvData,
|
||||
int cbSize, INETXPORT_COMPLETION_FUNCTION fnCompletion);
|
||||
|
||||
BOOL InternetTransport_RegisterClass(HINSTANCE hInstance);
|
||||
void InternetTransport_UnregisterClass(HINSTANCE hInstance);
|
||||
|
||||
HRESULT MimeBody_create(IUnknown *outer, void **obj);
|
||||
HRESULT MimeAllocator_create(IUnknown *outer, void **obj);
|
395
reactos/dll/win32/inetcomm/internettransport.c
Normal file
395
reactos/dll/win32/inetcomm/internettransport.c
Normal file
|
@ -0,0 +1,395 @@
|
|||
/*
|
||||
* Internet Messaging Transport Base Class
|
||||
*
|
||||
* Copyright 2006 Robert Shearman for CodeWeavers
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winnt.h"
|
||||
#include "winsock2.h"
|
||||
#include "ws2tcpip.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "inetcomm_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(inetcomm);
|
||||
|
||||
static const WCHAR wszClassName[] = {'T','h','o','r','C','o','n','n','W','n','d','C','l','a','s','s',0};
|
||||
|
||||
#define IX_READ (WM_USER + 0)
|
||||
#define IX_READLINE (WM_USER + 1)
|
||||
#define IX_WRITE (WM_USER + 2)
|
||||
|
||||
HRESULT InternetTransport_Init(InternetTransport *This)
|
||||
{
|
||||
This->pCallback = NULL;
|
||||
This->Status = IXP_DISCONNECTED;
|
||||
This->Socket = -1;
|
||||
This->fCommandLogging = FALSE;
|
||||
This->fnCompletion = NULL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_GetServerInfo(InternetTransport *This, LPINETSERVER pInetServer)
|
||||
{
|
||||
if (This->Status == IXP_DISCONNECTED)
|
||||
return IXP_E_NOT_CONNECTED;
|
||||
|
||||
*pInetServer = This->ServerInfo;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_InetServerFromAccount(InternetTransport *This,
|
||||
IImnAccount *pAccount, LPINETSERVER pInetServer)
|
||||
{
|
||||
FIXME("(%p, %p): stub\n", pAccount, pInetServer);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_Connect(InternetTransport *This,
|
||||
LPINETSERVER pInetServer, boolean fAuthenticate, boolean fCommandLogging)
|
||||
{
|
||||
struct addrinfo *ai;
|
||||
struct addrinfo *ai_cur;
|
||||
struct addrinfo hints;
|
||||
int ret;
|
||||
char szPort[10];
|
||||
|
||||
if (This->Status != IXP_DISCONNECTED)
|
||||
return IXP_E_ALREADY_CONNECTED;
|
||||
|
||||
This->ServerInfo = *pInetServer;
|
||||
This->fCommandLogging = fCommandLogging;
|
||||
|
||||
This->hwnd = CreateWindowW(wszClassName, wszClassName, 0, 0, 0, 0, 0, NULL, NULL, NULL, 0);
|
||||
if (!This->hwnd)
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
SetWindowLongPtrW(This->hwnd, GWLP_USERDATA, (LONG_PTR)This);
|
||||
|
||||
hints.ai_flags = 0;
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
hints.ai_addrlen = 0;
|
||||
hints.ai_addr = NULL;
|
||||
hints.ai_canonname = NULL;
|
||||
hints.ai_next = NULL;
|
||||
|
||||
snprintf(szPort, sizeof(szPort), "%d", (unsigned short)pInetServer->dwPort);
|
||||
|
||||
InternetTransport_ChangeStatus(This, IXP_FINDINGHOST);
|
||||
|
||||
ret = getaddrinfo(pInetServer->szServerName, szPort, &hints, &ai);
|
||||
if (ret)
|
||||
{
|
||||
ERR("getaddrinfo failed: %d\n", ret);
|
||||
return IXP_E_CANT_FIND_HOST;
|
||||
}
|
||||
|
||||
for (ai_cur = ai; ai_cur; ai_cur = ai->ai_next)
|
||||
{
|
||||
int so;
|
||||
|
||||
if (TRACE_ON(inetcomm))
|
||||
{
|
||||
char host[256];
|
||||
char service[256];
|
||||
getnameinfo(ai_cur->ai_addr, ai_cur->ai_addrlen,
|
||||
host, sizeof(host), service, sizeof(service),
|
||||
NI_NUMERICHOST | NI_NUMERICSERV);
|
||||
TRACE("trying %s:%s\n", host, service);
|
||||
}
|
||||
|
||||
InternetTransport_ChangeStatus(This, IXP_CONNECTING);
|
||||
|
||||
so = socket(ai_cur->ai_family, ai_cur->ai_socktype, ai_cur->ai_protocol);
|
||||
if (so == -1)
|
||||
{
|
||||
WARN("socket() failed\n");
|
||||
continue;
|
||||
}
|
||||
This->Socket = so;
|
||||
|
||||
/* FIXME: set to async */
|
||||
|
||||
if (0 > connect(This->Socket, ai_cur->ai_addr, ai_cur->ai_addrlen))
|
||||
{
|
||||
WARN("connect() failed\n");
|
||||
closesocket(This->Socket);
|
||||
continue;
|
||||
}
|
||||
InternetTransport_ChangeStatus(This, IXP_CONNECTED);
|
||||
|
||||
/* FIXME: call WSAAsyncSelect */
|
||||
|
||||
freeaddrinfo(ai);
|
||||
TRACE("connected\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
freeaddrinfo(ai);
|
||||
|
||||
return IXP_E_CANT_FIND_HOST;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_HandsOffCallback(InternetTransport *This)
|
||||
{
|
||||
if (!This->pCallback)
|
||||
return S_FALSE;
|
||||
|
||||
ITransportCallback_Release(This->pCallback);
|
||||
This->pCallback = NULL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_DropConnection(InternetTransport *This)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (This->Status == IXP_DISCONNECTED)
|
||||
return IXP_E_NOT_CONNECTED;
|
||||
|
||||
ret = shutdown(This->Socket, SD_BOTH);
|
||||
|
||||
ret = closesocket(This->Socket);
|
||||
|
||||
DestroyWindow(This->hwnd);
|
||||
This->hwnd = NULL;
|
||||
|
||||
InternetTransport_ChangeStatus(This, IXP_DISCONNECTED);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_GetStatus(InternetTransport *This,
|
||||
IXPSTATUS *pCurrentStatus)
|
||||
{
|
||||
*pCurrentStatus = This->Status;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_ChangeStatus(InternetTransport *This, IXPSTATUS Status)
|
||||
{
|
||||
This->Status = Status;
|
||||
if (This->pCallback)
|
||||
ITransportCallback_OnStatus(This->pCallback, Status,
|
||||
(IInternetTransport *)&This->u.vtbl);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_Read(InternetTransport *This, int cbBuffer,
|
||||
INETXPORT_COMPLETION_FUNCTION fnCompletion)
|
||||
{
|
||||
if (This->Status == IXP_DISCONNECTED)
|
||||
return IXP_E_NOT_CONNECTED;
|
||||
|
||||
if (This->fnCompletion)
|
||||
return IXP_E_BUSY;
|
||||
|
||||
This->fnCompletion = fnCompletion;
|
||||
|
||||
This->cbBuffer = cbBuffer;
|
||||
This->pBuffer = HeapAlloc(GetProcessHeap(), 0, This->cbBuffer);
|
||||
This->iCurrentBufferOffset = 0;
|
||||
|
||||
if (WSAAsyncSelect(This->Socket, This->hwnd, IX_READ, FD_READ) == SOCKET_ERROR)
|
||||
{
|
||||
ERR("WSAAsyncSelect failed with error %d\n", WSAGetLastError());
|
||||
/* FIXME: handle error */
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_ReadLine(InternetTransport *This,
|
||||
INETXPORT_COMPLETION_FUNCTION fnCompletion)
|
||||
{
|
||||
if (This->Status == IXP_DISCONNECTED)
|
||||
return IXP_E_NOT_CONNECTED;
|
||||
|
||||
if (This->fnCompletion)
|
||||
return IXP_E_BUSY;
|
||||
|
||||
This->fnCompletion = fnCompletion;
|
||||
|
||||
This->cbBuffer = 1024;
|
||||
This->pBuffer = HeapAlloc(GetProcessHeap(), 0, This->cbBuffer);
|
||||
This->iCurrentBufferOffset = 0;
|
||||
|
||||
if (WSAAsyncSelect(This->Socket, This->hwnd, IX_READLINE, FD_READ) == SOCKET_ERROR)
|
||||
{
|
||||
ERR("WSAAsyncSelect failed with error %d\n", WSAGetLastError());
|
||||
/* FIXME: handle error */
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT InternetTransport_Write(InternetTransport *This, const char *pvData,
|
||||
int cbSize, INETXPORT_COMPLETION_FUNCTION fnCompletion)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (This->Status == IXP_DISCONNECTED)
|
||||
return IXP_E_NOT_CONNECTED;
|
||||
|
||||
if (This->fnCompletion)
|
||||
return IXP_E_BUSY;
|
||||
|
||||
/* FIXME: do this asynchronously */
|
||||
ret = send(This->Socket, pvData, cbSize, 0);
|
||||
if (ret == SOCKET_ERROR)
|
||||
{
|
||||
ERR("send failed with error %d\n", WSAGetLastError());
|
||||
/* FIXME: handle error */
|
||||
}
|
||||
|
||||
fnCompletion((IInternetTransport *)&This->u.vtbl, NULL, 0);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK InternetTransport_WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (uMsg == IX_READ)
|
||||
{
|
||||
InternetTransport *This = (InternetTransport *)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
||||
|
||||
/* no work to do */
|
||||
if (!This->fnCompletion)
|
||||
return 0;
|
||||
|
||||
while (This->iCurrentBufferOffset < This->cbBuffer)
|
||||
{
|
||||
if (recv(This->Socket, &This->pBuffer[This->iCurrentBufferOffset], 1, 0) <= 0)
|
||||
{
|
||||
if (WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
break;
|
||||
|
||||
ERR("recv failed with error %d\n", WSAGetLastError());
|
||||
/* FIXME: handle error */
|
||||
}
|
||||
|
||||
This->iCurrentBufferOffset++;
|
||||
}
|
||||
if (This->iCurrentBufferOffset == This->cbBuffer)
|
||||
{
|
||||
INETXPORT_COMPLETION_FUNCTION fnCompletion = This->fnCompletion;
|
||||
char *pBuffer;
|
||||
|
||||
This->fnCompletion = NULL;
|
||||
pBuffer = This->pBuffer;
|
||||
This->pBuffer = NULL;
|
||||
fnCompletion((IInternetTransport *)&This->u.vtbl, pBuffer,
|
||||
This->iCurrentBufferOffset);
|
||||
HeapFree(GetProcessHeap(), 0, pBuffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (WSAAsyncSelect(This->Socket, hwnd, uMsg, FD_READ) == SOCKET_ERROR)
|
||||
{
|
||||
ERR("WSAAsyncSelect failed with error %d\n", WSAGetLastError());
|
||||
/* FIXME: handle error */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (uMsg == IX_READLINE)
|
||||
{
|
||||
InternetTransport *This = (InternetTransport *)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
|
||||
|
||||
/* no work to do */
|
||||
if (!This->fnCompletion)
|
||||
return 0;
|
||||
|
||||
while (This->iCurrentBufferOffset < This->cbBuffer - 1)
|
||||
{
|
||||
fd_set infd;
|
||||
|
||||
if (recv(This->Socket, &This->pBuffer[This->iCurrentBufferOffset], 1, 0) <= 0)
|
||||
{
|
||||
if (WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
break;
|
||||
|
||||
ERR("recv failed with error %d\n", WSAGetLastError());
|
||||
/* FIXME: handle error */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (This->pBuffer[This->iCurrentBufferOffset] == '\n')
|
||||
{
|
||||
INETXPORT_COMPLETION_FUNCTION fnCompletion = This->fnCompletion;
|
||||
char *pBuffer;
|
||||
|
||||
This->fnCompletion = NULL;
|
||||
This->pBuffer[This->iCurrentBufferOffset++] = '\0';
|
||||
pBuffer = This->pBuffer;
|
||||
This->pBuffer = NULL;
|
||||
|
||||
fnCompletion((IInternetTransport *)&This->u.vtbl, pBuffer,
|
||||
This->iCurrentBufferOffset);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, pBuffer);
|
||||
return 0;
|
||||
}
|
||||
if (This->pBuffer[This->iCurrentBufferOffset] != '\r')
|
||||
This->iCurrentBufferOffset++;
|
||||
|
||||
FD_ZERO(&infd);
|
||||
FD_SET(This->Socket, &infd);
|
||||
}
|
||||
if (This->iCurrentBufferOffset == This->cbBuffer - 1)
|
||||
return 0;
|
||||
|
||||
if (WSAAsyncSelect(This->Socket, hwnd, uMsg, FD_READ) == SOCKET_ERROR)
|
||||
{
|
||||
ERR("WSAAsyncSelect failed with error %d\n", WSAGetLastError());
|
||||
/* FIXME: handle error */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
BOOL InternetTransport_RegisterClass(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASSW cls;
|
||||
WSADATA wsadata;
|
||||
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsadata))
|
||||
return FALSE;
|
||||
|
||||
memset(&cls, 0, sizeof(cls));
|
||||
cls.hInstance = hInstance;
|
||||
cls.lpfnWndProc = InternetTransport_WndProc;
|
||||
cls.lpszClassName = wszClassName;
|
||||
|
||||
return RegisterClassW(&cls);
|
||||
}
|
||||
|
||||
void InternetTransport_UnregisterClass(HINSTANCE hInstance)
|
||||
{
|
||||
UnregisterClassW(wszClassName, hInstance);
|
||||
WSACleanup();
|
||||
}
|
2939
reactos/dll/win32/inetcomm/mimeole.c
Normal file
2939
reactos/dll/win32/inetcomm/mimeole.c
Normal file
File diff suppressed because it is too large
Load diff
493
reactos/dll/win32/inetcomm/regsvr.c
Normal file
493
reactos/dll/win32/inetcomm/regsvr.c
Normal file
|
@ -0,0 +1,493 @@
|
|||
/*
|
||||
* self-registerable dll functions for inetcomm.dll
|
||||
*
|
||||
* Copyright (C) 2003 John K. Hohm
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "winerror.h"
|
||||
#include "objbase.h"
|
||||
#include "ocidl.h"
|
||||
|
||||
#include "initguid.h"
|
||||
#include "inetcomm_private.h"
|
||||
#include "mimeole.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(inetcomm);
|
||||
|
||||
/*
|
||||
* Near the bottom of this file are the exported DllRegisterServer and
|
||||
* DllUnregisterServer, which make all this worthwhile.
|
||||
*/
|
||||
|
||||
/***********************************************************************
|
||||
* interface for self-registering
|
||||
*/
|
||||
struct regsvr_interface
|
||||
{
|
||||
IID const *iid; /* NULL for end of list */
|
||||
LPCSTR name; /* can be NULL to omit */
|
||||
IID const *base_iid; /* can be NULL to omit */
|
||||
int num_methods; /* can be <0 to omit */
|
||||
CLSID const *ps_clsid; /* can be NULL to omit */
|
||||
CLSID const *ps_clsid32; /* can be NULL to omit */
|
||||
};
|
||||
|
||||
static HRESULT register_interfaces(struct regsvr_interface const *list);
|
||||
static HRESULT unregister_interfaces(struct regsvr_interface const *list);
|
||||
|
||||
struct regsvr_coclass
|
||||
{
|
||||
CLSID const *clsid; /* NULL for end of list */
|
||||
LPCSTR name; /* can be NULL to omit */
|
||||
LPCSTR ips; /* can be NULL to omit */
|
||||
LPCSTR ips32; /* can be NULL to omit */
|
||||
LPCSTR ips32_tmodel; /* can be NULL to omit */
|
||||
LPCSTR clsid_str; /* can be NULL to omit */
|
||||
LPCSTR progid; /* can be NULL to omit */
|
||||
};
|
||||
|
||||
static HRESULT register_coclasses(struct regsvr_coclass const *list);
|
||||
static HRESULT unregister_coclasses(struct regsvr_coclass const *list);
|
||||
|
||||
/***********************************************************************
|
||||
* static string constants
|
||||
*/
|
||||
static WCHAR const interface_keyname[10] = {
|
||||
'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 };
|
||||
static WCHAR const base_ifa_keyname[14] = {
|
||||
'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c',
|
||||
'e', 0 };
|
||||
static WCHAR const num_methods_keyname[11] = {
|
||||
'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 };
|
||||
static WCHAR const ps_clsid_keyname[15] = {
|
||||
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
|
||||
'i', 'd', 0 };
|
||||
static WCHAR const ps_clsid32_keyname[17] = {
|
||||
'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's',
|
||||
'i', 'd', '3', '2', 0 };
|
||||
static WCHAR const clsid_keyname[6] = {
|
||||
'C', 'L', 'S', 'I', 'D', 0 };
|
||||
static WCHAR const ips_keyname[13] = {
|
||||
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
|
||||
0 };
|
||||
static WCHAR const ips32_keyname[15] = {
|
||||
'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
|
||||
'3', '2', 0 };
|
||||
static WCHAR const progid_keyname[7] = {
|
||||
'P', 'r', 'o', 'g', 'I', 'D', 0 };
|
||||
static char const tmodel_valuename[] = "ThreadingModel";
|
||||
|
||||
/***********************************************************************
|
||||
* static helper functions
|
||||
*/
|
||||
static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid);
|
||||
static LONG register_key_defvalueW(HKEY base, WCHAR const *name,
|
||||
WCHAR const *value);
|
||||
static LONG register_key_defvalueA(HKEY base, WCHAR const *name,
|
||||
char const *value);
|
||||
|
||||
/***********************************************************************
|
||||
* register_interfaces
|
||||
*/
|
||||
static HRESULT register_interfaces(struct regsvr_interface const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY interface_key;
|
||||
|
||||
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &interface_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_return;
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->iid; ++list) {
|
||||
WCHAR buf[39];
|
||||
HKEY iid_key;
|
||||
|
||||
StringFromGUID2(list->iid, buf, 39);
|
||||
res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &iid_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_interface_key;
|
||||
|
||||
if (list->name) {
|
||||
res = RegSetValueExA(iid_key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)(list->name),
|
||||
strlen(list->name) + 1);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
if (list->base_iid) {
|
||||
res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
if (0 <= list->num_methods) {
|
||||
static WCHAR const fmt[3] = { '%', 'd', 0 };
|
||||
HKEY key;
|
||||
|
||||
res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
|
||||
wsprintfW(buf, fmt, list->num_methods);
|
||||
res = RegSetValueExW(key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)buf,
|
||||
(lstrlenW(buf) + 1) * sizeof(WCHAR));
|
||||
RegCloseKey(key);
|
||||
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
if (list->ps_clsid) {
|
||||
res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
if (list->ps_clsid32) {
|
||||
res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32);
|
||||
if (res != ERROR_SUCCESS) goto error_close_iid_key;
|
||||
}
|
||||
|
||||
error_close_iid_key:
|
||||
RegCloseKey(iid_key);
|
||||
}
|
||||
|
||||
error_close_interface_key:
|
||||
RegCloseKey(interface_key);
|
||||
error_return:
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* unregister_interfaces
|
||||
*/
|
||||
static HRESULT unregister_interfaces(struct regsvr_interface const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY interface_key;
|
||||
|
||||
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0,
|
||||
KEY_READ | KEY_WRITE, &interface_key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
|
||||
if (res != ERROR_SUCCESS) goto error_return;
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->iid; ++list) {
|
||||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(list->iid, buf, 39);
|
||||
res = RegDeleteTreeW(interface_key, buf);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
RegCloseKey(interface_key);
|
||||
error_return:
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* register_coclasses
|
||||
*/
|
||||
static HRESULT register_coclasses(struct regsvr_coclass const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY coclass_key;
|
||||
|
||||
res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_return;
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->clsid; ++list) {
|
||||
WCHAR buf[39];
|
||||
HKEY clsid_key;
|
||||
|
||||
StringFromGUID2(list->clsid, buf, 39);
|
||||
res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
|
||||
|
||||
if (list->name) {
|
||||
res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)(list->name),
|
||||
strlen(list->name) + 1);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
}
|
||||
|
||||
if (list->ips) {
|
||||
res = register_key_defvalueA(clsid_key, ips_keyname, list->ips);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
}
|
||||
|
||||
if (list->ips32) {
|
||||
HKEY ips32_key;
|
||||
|
||||
res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL,
|
||||
&ips32_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
|
||||
res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ,
|
||||
(CONST BYTE*)list->ips32,
|
||||
lstrlenA(list->ips32) + 1);
|
||||
if (res == ERROR_SUCCESS && list->ips32_tmodel)
|
||||
res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ,
|
||||
(CONST BYTE*)list->ips32_tmodel,
|
||||
strlen(list->ips32_tmodel) + 1);
|
||||
RegCloseKey(ips32_key);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
}
|
||||
|
||||
if (list->clsid_str) {
|
||||
res = register_key_defvalueA(clsid_key, clsid_keyname,
|
||||
list->clsid_str);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
}
|
||||
|
||||
if (list->progid) {
|
||||
HKEY progid_key;
|
||||
|
||||
res = register_key_defvalueA(clsid_key, progid_keyname,
|
||||
list->progid);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
|
||||
res = RegCreateKeyExA(HKEY_CLASSES_ROOT, list->progid, 0,
|
||||
NULL, 0, KEY_READ | KEY_WRITE, NULL,
|
||||
&progid_key, NULL);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
|
||||
res = register_key_defvalueW(progid_key, clsid_keyname, buf);
|
||||
RegCloseKey(progid_key);
|
||||
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
|
||||
}
|
||||
|
||||
error_close_clsid_key:
|
||||
RegCloseKey(clsid_key);
|
||||
}
|
||||
|
||||
error_close_coclass_key:
|
||||
RegCloseKey(coclass_key);
|
||||
error_return:
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* unregister_coclasses
|
||||
*/
|
||||
static HRESULT unregister_coclasses(struct regsvr_coclass const *list)
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
HKEY coclass_key;
|
||||
|
||||
res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0,
|
||||
KEY_READ | KEY_WRITE, &coclass_key);
|
||||
if (res == ERROR_FILE_NOT_FOUND) return S_OK;
|
||||
if (res != ERROR_SUCCESS) goto error_return;
|
||||
|
||||
for (; res == ERROR_SUCCESS && list->clsid; ++list) {
|
||||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(list->clsid, buf, 39);
|
||||
res = RegDeleteTreeW(coclass_key, buf);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
|
||||
|
||||
if (list->progid) {
|
||||
res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid);
|
||||
if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS;
|
||||
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
|
||||
}
|
||||
}
|
||||
|
||||
error_close_coclass_key:
|
||||
RegCloseKey(coclass_key);
|
||||
error_return:
|
||||
return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* regsvr_key_guid
|
||||
*/
|
||||
static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid)
|
||||
{
|
||||
WCHAR buf[39];
|
||||
|
||||
StringFromGUID2(guid, buf, 39);
|
||||
return register_key_defvalueW(base, name, buf);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* regsvr_key_defvalueW
|
||||
*/
|
||||
static LONG register_key_defvalueW(
|
||||
HKEY base,
|
||||
WCHAR const *name,
|
||||
WCHAR const *value)
|
||||
{
|
||||
LONG res;
|
||||
HKEY key;
|
||||
|
||||
res = RegCreateKeyExW(base, name, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res != ERROR_SUCCESS) return res;
|
||||
res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
|
||||
(lstrlenW(value) + 1) * sizeof(WCHAR));
|
||||
RegCloseKey(key);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* regsvr_key_defvalueA
|
||||
*/
|
||||
static LONG register_key_defvalueA(
|
||||
HKEY base,
|
||||
WCHAR const *name,
|
||||
char const *value)
|
||||
{
|
||||
LONG res;
|
||||
HKEY key;
|
||||
|
||||
res = RegCreateKeyExW(base, name, 0, NULL, 0,
|
||||
KEY_READ | KEY_WRITE, NULL, &key, NULL);
|
||||
if (res != ERROR_SUCCESS) return res;
|
||||
res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value,
|
||||
lstrlenA(value) + 1);
|
||||
RegCloseKey(key);
|
||||
return res;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* coclass list
|
||||
*/
|
||||
static struct regsvr_coclass const coclass_list[] = {
|
||||
{ &CLSID_IHTTPMailTransport,
|
||||
"CLSID_IHTTPMailTransport",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_IPropFindRequest,
|
||||
"CLSID_IPropFindRequest",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_IPropPatchRequest,
|
||||
"CLSID_IPropPatchRequest",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_ISMTPTransport,
|
||||
"CLSID_ISMTPTransport",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_IPOP3Transport,
|
||||
"CLSID_IPOP3Transport",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_INNTPTransport,
|
||||
"CLSID_INNTPTransport",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_IRASTransport,
|
||||
"CLSID_IRASTransport",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_IRangeList,
|
||||
"CLSID_IRangeList",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_IIMAPTransport,
|
||||
"CLSID_IIMAPTransport",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_IMimeBody,
|
||||
"CLSID_IMimeBody",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_IMimeAllocator,
|
||||
"CLSID_IMimeAllocator",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ &CLSID_IMimeMessage,
|
||||
"CLSID_IMimeMessage",
|
||||
NULL,
|
||||
"inetcomm.dll",
|
||||
"Both"
|
||||
},
|
||||
{ NULL } /* list terminator */
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* interface list
|
||||
*/
|
||||
static struct regsvr_interface const interface_list[] = {
|
||||
{ NULL } /* list terminator */
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
* DllRegisterServer (INETCOMM.@)
|
||||
*/
|
||||
HRESULT WINAPI DllRegisterServer(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
hr = register_coclasses(coclass_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = register_interfaces(interface_list);
|
||||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* DllUnregisterServer (INETCOMM.@)
|
||||
*/
|
||||
HRESULT WINAPI DllUnregisterServer(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
hr = unregister_coclasses(coclass_list);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = unregister_interfaces(interface_list);
|
||||
return hr;
|
||||
}
|
49
reactos/dll/win32/nddeapi/nddeapi.c
Normal file
49
reactos/dll/win32/nddeapi/nddeapi.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* nddeapi main
|
||||
*
|
||||
* Copyright 2006 Benjamin Arai (Google)
|
||||
*
|
||||
* 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 <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(nddeapi);
|
||||
|
||||
/***********************************************************************
|
||||
* NDdeGetErrorStringA (NDDEAPI.@)
|
||||
*
|
||||
*/
|
||||
UINT WINAPI NDdeGetErrorStringA(UINT uErrorCode, LPSTR lpszErrorString, DWORD cBufSize)
|
||||
{
|
||||
FIXME("(%u, %s, %d): stub!\n",uErrorCode,debugstr_a(lpszErrorString), cBufSize);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* NDdeGetErrorStringW (NDDEAPI.@)
|
||||
*
|
||||
*/
|
||||
UINT WINAPI NDdeGetErrorStringW(UINT uErrorCode, LPWSTR lpszErrorString, DWORD cBufSize)
|
||||
{
|
||||
FIXME("(%u, %s, %d): stub!\n",uErrorCode,debugstr_w(lpszErrorString), cBufSize);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
16
reactos/dll/win32/nddeapi/nddeapi.rbuild
Normal file
16
reactos/dll/win32/nddeapi/nddeapi.rbuild
Normal file
|
@ -0,0 +1,16 @@
|
|||
<module name="nddeapi" type="win32dll" baseaddress="${BASEADDRESS_NDDEAPI}" installbase="system32" installname="nddeapi.dll" allowwarnings="true" entrypoint="0">
|
||||
<importlibrary definition="nddeapi.spec.def" />
|
||||
<include base="nddeapi">.</include>
|
||||
<include base="ReactOS">include/reactos/wine</include>
|
||||
<define name="__REACTOS__" />
|
||||
<define name="__WINESRC__" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x501</define>
|
||||
<define name="WINVER">0x501</define>
|
||||
<library>wine</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
<file>nddeapi.c</file>
|
||||
<file>nddeapi.spec</file>
|
||||
</module>
|
28
reactos/dll/win32/nddeapi/nddeapi.spec
Normal file
28
reactos/dll/win32/nddeapi/nddeapi.spec
Normal file
|
@ -0,0 +1,28 @@
|
|||
@ stdcall NDdeGetErrorStringA(long str long)
|
||||
@ stdcall NDdeGetErrorStringW(long wstr long)
|
||||
@ stub NDdeGetShareSecurityA
|
||||
@ stub NDdeGetShareSecurityW
|
||||
@ stub NDdeGetTrustedShareA
|
||||
@ stub NDdeGetTrustedShareW
|
||||
@ stub NDdeIsValidAppTopicListA
|
||||
@ stub NDdeIsValidAppTopicListW
|
||||
@ stub NDdeIsValidShareNameA
|
||||
@ stub NDdeIsValidShareNameW
|
||||
@ stub NDdeSetShareSecurityA
|
||||
@ stub NDdeSetShareSecurityW
|
||||
@ stub NDdeSetTrustedShareA
|
||||
@ stub NDdeSetTrustedShareW
|
||||
@ stub NDdeShareAddA
|
||||
@ stub NDdeShareAddW
|
||||
@ stub NDdeShareDelA
|
||||
@ stub NDdeShareDelW
|
||||
@ stub NDdeShareEnumA
|
||||
@ stub NDdeShareEnumW
|
||||
@ stub NDdeShareGetInfoA
|
||||
@ stub NDdeShareGetInfoW
|
||||
@ stub NDdeShareSetInfoA
|
||||
@ stub NDdeShareSetInfoW
|
||||
@ stub NDdeSpecialCommandA
|
||||
@ stub NDdeSpecialCommandW
|
||||
@ stub NDdeTrustedShareEnumA
|
||||
@ stub NDdeTrustedShareEnumW
|
|
@ -109,6 +109,9 @@
|
|||
<directory name="imm32">
|
||||
<xi:include href="imm32/imm32.rbuild" />
|
||||
</directory>
|
||||
<directory name="inetcomm">
|
||||
<xi:include href="inetcomm/inetcomm.rbuild" />
|
||||
</directory>
|
||||
<directory name="iphlpapi">
|
||||
<xi:include href="iphlpapi/iphlpapi.rbuild" />
|
||||
</directory>
|
||||
|
@ -169,6 +172,9 @@
|
|||
<directory name="msxml3">
|
||||
<xi:include href="msxml3/msxml3.rbuild" />
|
||||
</directory>
|
||||
<directory name="nddeapi">
|
||||
<xi:include href="nddeapi/nddeapi.rbuild" />
|
||||
</directory>
|
||||
<directory name="netapi32">
|
||||
<xi:include href="netapi32/netapi32.rbuild" />
|
||||
</directory>
|
||||
|
|
Loading…
Reference in a new issue