Sync with trunk r58740.

svn path=/branches/ros-csrss/; revision=58741
This commit is contained in:
Hermès Bélusca-Maïto
2013-04-13 18:49:50 +00:00
96 changed files with 6607 additions and 4672 deletions
@@ -472,7 +472,7 @@ AddDeviceToTree(HWND hTreeView,
TCHAR ClassGuidString[MAX_GUID_STRING_LEN];
GUID ClassGuid;
ULONG ulLength;
LPTSTR DeviceID;
LPTSTR DeviceID = NULL;
INT ClassImage = 24;
CONFIGRET cr;
@@ -8,9 +8,9 @@ BOOL CreateHiddenConsoleProcess(LPCTSTR szChildName, PROCESS_INFORMATION* ppi,
BOOL fCreated;
STARTUPINFO si;
SECURITY_ATTRIBUTES sa;
HANDLE hInRead;
HANDLE hOutWrite;
HANDLE hErrWrite;
HANDLE hInRead = INVALID_HANDLE_VALUE;
HANDLE hOutWrite = INVALID_HANDLE_VALUE;
HANDLE hErrWrite = INVALID_HANDLE_VALUE;
// Create pipes
// initialize security attributes for handle inheritance (for WinNT)
@@ -19,16 +19,22 @@ BOOL CreateHiddenConsoleProcess(LPCTSTR szChildName, PROCESS_INFORMATION* ppi,
sa.lpSecurityDescriptor = NULL;
// create STDIN pipe
if( !CreatePipe( &hInRead, phInWrite, &sa, 0 ))
if( !CreatePipe( &hInRead, phInWrite, &sa, 0 )) {
hInRead = INVALID_HANDLE_VALUE;
goto error;
}
// create STDOUT pipe
if( !CreatePipe( phOutRead, &hOutWrite, &sa, 0 ))
if( !CreatePipe( phOutRead, &hOutWrite, &sa, 0 )) {
hOutWrite = INVALID_HANDLE_VALUE;
goto error;
}
// create STDERR pipe
if( !CreatePipe( phErrRead, &hErrWrite, &sa, 0 ))
if( !CreatePipe( phErrRead, &hErrWrite, &sa, 0 )) {
hErrWrite = INVALID_HANDLE_VALUE;
goto error;
}
// process startup information
memset( &si, 0, sizeof( si ));
@@ -63,9 +69,9 @@ BOOL CreateHiddenConsoleProcess(LPCTSTR szChildName, PROCESS_INFORMATION* ppi,
return TRUE;
error:
CloseHandle( hInRead );
CloseHandle( hOutWrite );
CloseHandle( hErrWrite );
if (hInRead != INVALID_HANDLE_VALUE) CloseHandle( hInRead );
if (hOutWrite != INVALID_HANDLE_VALUE) CloseHandle( hOutWrite );
if (hErrWrite != INVALID_HANDLE_VALUE) CloseHandle( hErrWrite );
CloseHandle( ppi->hProcess );
CloseHandle( ppi->hThread );
+4
View File
@@ -105,9 +105,13 @@ static LPTSTR ReadFileContents(FILE *InputFile, TCHAR *Buffer)
ULONG_PTR CharsRead = _tcslen(Buffer);
while (Len + CharsRead >= AllocLen)
{
LPTSTR OldContents = Contents;
Contents = cmd_realloc(Contents, (AllocLen *= 2) * sizeof(TCHAR));
if (!Contents)
{
cmd_free(OldContents);
return NULL;
}
}
_tcscpy(&Contents[Len], Buffer);
Len += CharsRead;
+3 -2
View File
@@ -54,13 +54,14 @@ INT cmd_path (LPTSTR param)
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
if (dwBuffer == 0)
{
ConOutResPrintf(STRING_VOL_HELP2, _T("PATH"));
cmd_free(pszBuffer);
ConOutResPrintf(STRING_VOL_HELP2, _T("PATH"));
return 0;
}
else if (dwBuffer > ENV_BUFFER_SIZE)
{
pszBuffer = (LPTSTR)cmd_realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
GetEnvironmentVariable (_T("PATH"), pszBuffer, dwBuffer);
}
ConOutPrintf (_T("PATH=%s\n"), pszBuffer);
+2
View File
@@ -193,9 +193,11 @@ INT cmd_start (LPTSTR Rest)
{
if (size > MAX_PATH)
{
LPTSTR Oldcomspec = comspec;
comspec = cmd_realloc(comspec,size * sizeof(TCHAR) );
if (comspec==NULL)
{
cmd_free(Oldcomspec);
return 1;
}
size = GetEnvironmentVariable (_T("COMSPEC"), comspec, size);
+2 -1
View File
@@ -229,7 +229,8 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
set(CMAKE_${lang}_LINK_EXECUTABLE "${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> <OBJECTS> /link /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_LINK_EXECUTABLE
"${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
set(CMAKE_${lang}_FLAGS_INIT "")
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "")
+5 -22
View File
@@ -1,44 +1,27 @@
add_definitions(-D__WINESRC__)
remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(dmusic.dll dmusic.spec)
add_library(dmusic SHARED
list(APPEND SOURCE
buffer.c
clock.c
collection.c
dmusic.c
dmusic_main.c
download.c
downloadedinstrument.c
instrument.c
port.c
regsvr.c
version.rc
${CMAKE_CURRENT_BINARY_DIR}/dmusic.def)
add_library(dmusic SHARED ${SOURCE})
set_module_type(dmusic win32dll UNICODE)
target_link_libraries(dmusic
dxguid
uuid
wine)
add_importlibs(dmusic
msvcrt
user32
advapi32
ole32
dsound
kernel32
ntdll)
target_link_libraries(dmusic dxguid uuid wine)
add_importlibs(dmusic ole32 advapi32 winmm msvcrt kernel32 ntdll)
add_dependencies(dmusic psdk)
add_pch(dmusic dmusic_private.h)
add_cd_file(TARGET dmusic DESTINATION reactos/system32 FOR all)
+233 -93
View File
@@ -1,6 +1,8 @@
/* IDirectMusicBuffer Implementation
/*
* IDirectMusicBuffer Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2012 Christian Costa
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,126 +20,241 @@
*/
#include "dmusic_private.h"
//#include "initguid.h"
#include "dmksctrl.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static inline IDirectMusicBufferImpl *impl_from_IDirectMusicBuffer(IDirectMusicBuffer *iface)
{
return CONTAINING_RECORD(iface, IDirectMusicBufferImpl, IDirectMusicBuffer_iface);
}
/* IDirectMusicBufferImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicBufferImpl_QueryInterface (LPDIRECTMUSICBUFFER iface, REFIID riid, LPVOID *ppobj) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
TRACE("(%p, (%s, %p)\n",This,debugstr_dmguid(riid),ppobj);
if (IsEqualIID (riid, &IID_IUnknown)
|| IsEqualIID (riid, &IID_IDirectMusicBuffer)) {
IUnknown_AddRef(iface);
*ppobj = This;
return S_OK;
}
WARN("(%p, (%s, %p): not found\n",This,debugstr_dmguid(riid),ppobj);
return E_NOINTERFACE;
static HRESULT WINAPI IDirectMusicBufferImpl_QueryInterface(LPDIRECTMUSICBUFFER iface, REFIID riid, LPVOID *ret_iface)
{
TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IDirectMusicBuffer))
{
IDirectMusicBuffer_AddRef(iface);
*ret_iface = iface;
return S_OK;
}
*ret_iface = NULL;
WARN("(%p)->(%s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicBufferImpl_AddRef (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
static ULONG WINAPI IDirectMusicBufferImpl_AddRef(LPDIRECTMUSICBUFFER iface)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
DMUSIC_LockModule();
DMUSIC_LockModule();
return refCount;
return ref;
}
static ULONG WINAPI IDirectMusicBufferImpl_Release (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
static ULONG WINAPI IDirectMusicBufferImpl_Release(LPDIRECTMUSICBUFFER iface)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
if (!ref) {
HeapFree(GetProcessHeap(), 0, This->data);
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
DMUSIC_UnlockModule();
return ref;
}
/* IDirectMusicBufferImpl IDirectMusicBuffer part: */
static HRESULT WINAPI IDirectMusicBufferImpl_Flush (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p): stub\n", This);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_Flush(LPDIRECTMUSICBUFFER iface)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
TRACE("(%p)->()\n", iface);
This->write_pos = 0;
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_TotalTime (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prtTime) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, prtTime);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_TotalTime(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prtTime)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
FIXME("(%p, %p): stub\n", This, prtTime);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD dwChannelMessage) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, 0x%s, %d, %d): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, dwChannelMessage);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_PackStructured(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME ref_time, DWORD channel_group, DWORD channel_message)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
DWORD new_write_pos = This->write_pos + sizeof(DMUS_EVENTHEADER) + sizeof(DWORD);
DMUS_EVENTHEADER header;
TRACE("(%p)->(0x%s, %u, 0x%x)\n", iface, wine_dbgstr_longlong(ref_time), channel_group, channel_message);
if (new_write_pos > This->size)
return DMUS_E_BUFFER_FULL;
/* Channel_message 0xZZYYXX (3 bytes) is a midi message where XX = status byte, YY = byte 1 and ZZ = byte 2 */
if (!(channel_message & 0x80))
{
/* Status byte MSB is always set */
return DMUS_E_INVALID_EVENT;
}
if (!This->write_pos)
This->start_time = ref_time;
header.cbEvent = 3; /* Midi message takes 4 bytes space but only 3 are relevant */
header.dwChannelGroup = channel_group;
header.rtDelta = ref_time - This->start_time;
header.dwFlags = DMUS_EVENT_STRUCTURED;
memcpy(This->data + This->write_pos, &header, sizeof(header));
*(DWORD*)(This->data + This->write_pos + sizeof(header)) = channel_message;
This->write_pos = new_write_pos;
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD cb, LPBYTE lpb) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, 0x%s, %d, %d, %p): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, cb, lpb);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_PackUnstructured(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt, DWORD dwChannelGroup, DWORD cb, LPBYTE lpb)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
FIXME("(%p, 0x%s, %d, %d, %p): stub\n", This, wine_dbgstr_longlong(rt), dwChannelGroup, cb, lpb);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_ResetReadPtr (LPDIRECTMUSICBUFFER iface) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p): stub\n", This);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_ResetReadPtr(LPDIRECTMUSICBUFFER iface)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
FIXME("(%p): stub\n", This);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetNextEvent (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt, LPDWORD pdwChannelGroup, LPDWORD pdwLength, LPBYTE* ppData) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p, %p, %p, %p): stub\n", This, prt, pdwChannelGroup, pdwLength, ppData);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_GetNextEvent(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt, LPDWORD pdwChannelGroup, LPDWORD pdwLength, LPBYTE* ppData)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
FIXME("(%p, %p, %p, %p, %p): stub\n", This, prt, pdwChannelGroup, pdwLength, ppData);
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetRawBufferPtr (LPDIRECTMUSICBUFFER iface, LPBYTE* ppData) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, ppData);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_GetRawBufferPtr(LPDIRECTMUSICBUFFER iface, LPBYTE* data)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
TRACE("(%p)->(%p)\n", iface, data);
if (!data)
return E_POINTER;
*data = This->data;
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetStartTime (LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME prt) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, prt);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_GetStartTime(LPDIRECTMUSICBUFFER iface, LPREFERENCE_TIME ref_time)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
TRACE("(%p)->(%p)\n", iface, ref_time);
if (!ref_time)
return E_POINTER;
if (!This->write_pos)
return DMUS_E_BUFFER_EMPTY;
*ref_time = This->start_time;
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetUsedBytes (LPDIRECTMUSICBUFFER iface, LPDWORD pcb) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, pcb);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_GetUsedBytes(LPDIRECTMUSICBUFFER iface, LPDWORD used_bytes)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
TRACE("(%p)->(%p)\n", iface, used_bytes);
if (!used_bytes)
return E_POINTER;
*used_bytes = This->write_pos;
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetMaxBytes (LPDIRECTMUSICBUFFER iface, LPDWORD pcb) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, pcb);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_GetMaxBytes(LPDIRECTMUSICBUFFER iface, LPDWORD max_bytes)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
TRACE("(%p)->(%p)\n", iface, max_bytes);
if (!max_bytes)
return E_POINTER;
*max_bytes = This->size;
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_GetBufferFormat (LPDIRECTMUSICBUFFER iface, LPGUID pGuidFormat) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %p): stub\n", This, pGuidFormat);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_GetBufferFormat(LPDIRECTMUSICBUFFER iface, LPGUID format)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
TRACE("(%p)->(%p)\n", iface, format);
if (!format)
return E_POINTER;
*format = This->format;
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_SetStartTime (LPDIRECTMUSICBUFFER iface, REFERENCE_TIME rt) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, 0x%s): stub\n", This, wine_dbgstr_longlong(rt));
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_SetStartTime(LPDIRECTMUSICBUFFER iface, REFERENCE_TIME ref_time)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
TRACE("(%p)->(0x%s)\n", This, wine_dbgstr_longlong(ref_time));
This->start_time = ref_time;
return S_OK;
}
static HRESULT WINAPI IDirectMusicBufferImpl_SetUsedBytes (LPDIRECTMUSICBUFFER iface, DWORD cb) {
IDirectMusicBufferImpl *This = (IDirectMusicBufferImpl *)iface;
FIXME("(%p, %d): stub\n", This, cb);
return S_OK;
static HRESULT WINAPI IDirectMusicBufferImpl_SetUsedBytes(LPDIRECTMUSICBUFFER iface, DWORD used_bytes)
{
IDirectMusicBufferImpl *This = impl_from_IDirectMusicBuffer(iface);
TRACE("(%p)->(%u)\n", iface, used_bytes);
if (used_bytes > This->size)
return DMUS_E_BUFFER_FULL;
This->write_pos = used_bytes;
return S_OK;
}
static const IDirectMusicBufferVtbl DirectMusicBuffer_Vtbl = {
@@ -159,17 +276,40 @@ static const IDirectMusicBufferVtbl DirectMusicBuffer_Vtbl = {
IDirectMusicBufferImpl_SetUsedBytes
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicBufferImpl* dmbuff;
dmbuff = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl));
if (NULL == dmbuff) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dmbuff->lpVtbl = &DirectMusicBuffer_Vtbl;
dmbuff->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicBufferImpl_QueryInterface ((LPDIRECTMUSICBUFFER)dmbuff, lpcGUID, ppobj);
HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface)
{
IDirectMusicBufferImpl* dmbuffer;
HRESULT hr;
TRACE("(%p, %p)\n", desc, ret_iface);
*ret_iface = NULL;
dmbuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl));
if (!dmbuffer)
return E_OUTOFMEMORY;
dmbuffer->IDirectMusicBuffer_iface.lpVtbl = &DirectMusicBuffer_Vtbl;
dmbuffer->ref = 0; /* Will be inited by QueryInterface */
if (IsEqualGUID(&desc->guidBufferFormat, &GUID_NULL))
dmbuffer->format = KSDATAFORMAT_SUBTYPE_MIDI;
else
dmbuffer->format = desc->guidBufferFormat;
dmbuffer->size = (desc->cbBuffer + 3) & ~3; /* Buffer size must be multiple of 4 bytes */
dmbuffer->data = HeapAlloc(GetProcessHeap(), 0, dmbuffer->size);
if (!dmbuffer->data) {
HeapFree(GetProcessHeap(), 0, dmbuffer);
return E_OUTOFMEMORY;
}
hr = IDirectMusicBufferImpl_QueryInterface((LPDIRECTMUSICBUFFER)dmbuffer, &IID_IDirectMusicBuffer, ret_iface);
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, dmbuffer->data);
HeapFree(GetProcessHeap(), 0, dmbuffer);
}
return hr;
}
+73 -48
View File
@@ -1,4 +1,5 @@
/* IReferenceClock Implementation
/*
* IReferenceClock Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
@@ -21,9 +22,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static inline IReferenceClockImpl *impl_from_IReferenceClock(IReferenceClock *iface)
{
return CONTAINING_RECORD(iface, IReferenceClockImpl, IReferenceClock_iface);
}
/* IReferenceClockImpl IUnknown part: */
static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFIID riid, LPVOID *ppobj) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
static HRESULT WINAPI IReferenceClockImpl_QueryInterface(IReferenceClock *iface, REFIID riid, LPVOID *ppobj)
{
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown) ||
@@ -36,56 +43,70 @@ static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface
return E_NOINTERFACE;
}
static ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface)
{
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
TRACE("(%p)->(): new ref = %u\n", This, ref);
DMUSIC_LockModule();
DMUSIC_LockModule();
return refCount;
return ref;
}
static ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface)
{
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
TRACE("(%p)->(): new ref = %u\n", This, ref);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
DMUSIC_UnlockModule();
DMUSIC_UnlockModule();
return refCount;
return ref;
}
/* IReferenceClockImpl IReferenceClock part: */
static HRESULT WINAPI IReferenceClockImpl_GetTime (IReferenceClock *iface, REFERENCE_TIME* pTime) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
TRACE("(%p, %p)\n", This, pTime);
*pTime = This->rtTime;
return S_OK;
static HRESULT WINAPI IReferenceClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME* pTime)
{
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
TRACE("(%p)->(%p)\n", This, pTime);
*pTime = This->rtTime;
return S_OK;
}
static HRESULT WINAPI IReferenceClockImpl_AdviseTime (IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie);
return S_OK;
static HRESULT WINAPI IReferenceClockImpl_AdviseTime(IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie)
{
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie);
return S_OK;
}
static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic (IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie);
return S_OK;
static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie)
{
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie);
return S_OK;
}
static HRESULT WINAPI IReferenceClockImpl_Unadvise (IReferenceClock *iface, DWORD dwAdviseCookie) {
IReferenceClockImpl *This = (IReferenceClockImpl *)iface;
FIXME("(%p, %d): stub\n", This, dwAdviseCookie);
return S_OK;
static HRESULT WINAPI IReferenceClockImpl_Unadvise(IReferenceClock *iface, DWORD dwAdviseCookie)
{
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
FIXME("(%p)->(%d): stub\n", This, dwAdviseCookie);
return S_OK;
}
static const IReferenceClockVtbl ReferenceClock_Vtbl = {
@@ -99,18 +120,22 @@ static const IReferenceClockVtbl ReferenceClock_Vtbl = {
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IReferenceClockImpl* clock;
HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter)
{
IReferenceClockImpl* clock;
clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
if (NULL == clock) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
clock->lpVtbl = &ReferenceClock_Vtbl;
clock->ref = 0; /* will be inited by QueryInterface */
clock->rtTime = 0;
clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
return IReferenceClockImpl_QueryInterface ((IReferenceClock *)clock, lpcGUID, ppobj);
TRACE("(%p,%p,%p)\n", riid, ret_iface, unkouter);
clock = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IReferenceClockImpl));
if (!clock) {
*ret_iface = NULL;
return E_OUTOFMEMORY;
}
clock->IReferenceClock_iface.lpVtbl = &ReferenceClock_Vtbl;
clock->ref = 0; /* Will be inited by QueryInterface */
clock->rtTime = 0;
clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
return IReferenceClockImpl_QueryInterface((IReferenceClock*)clock, riid, ret_iface);
}
File diff suppressed because it is too large Load Diff
+364 -187
View File
@@ -1,6 +1,8 @@
/* IDirectMusic8 Implementation
/*
* IDirectMusic8 Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2012 Christian Costa
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -16,245 +18,420 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
//#include <stdio.h>
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static inline IDirectMusic8Impl *impl_from_IDirectMusic8(IDirectMusic8 *iface)
{
return CONTAINING_RECORD(iface, IDirectMusic8Impl, IDirectMusic8_iface);
}
/* IDirectMusic8Impl IUnknown part: */
static HRESULT WINAPI IDirectMusic8Impl_QueryInterface (LPDIRECTMUSIC8 iface, REFIID riid, LPVOID *ppobj) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
static HRESULT WINAPI IDirectMusic8Impl_QueryInterface(LPDIRECTMUSIC8 iface, REFIID riid, LPVOID *ret_iface)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
if (IsEqualIID (riid, &IID_IUnknown) ||
IsEqualIID (riid, &IID_IDirectMusic) ||
IsEqualIID (riid, &IID_IDirectMusic2) ||
IsEqualIID (riid, &IID_IDirectMusic8)) {
IUnknown_AddRef(iface);
*ppobj = This;
return S_OK;
}
TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
if (IsEqualIID (riid, &IID_IUnknown) ||
IsEqualIID (riid, &IID_IDirectMusic) ||
IsEqualIID (riid, &IID_IDirectMusic2) ||
IsEqualIID (riid, &IID_IDirectMusic8))
{
IDirectMusic8_AddRef(iface);
*ret_iface = iface;
return S_OK;
}
*ret_iface = NULL;
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusic8Impl_AddRef (LPDIRECTMUSIC8 iface) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
static ULONG WINAPI IDirectMusic8Impl_AddRef(LPDIRECTMUSIC8 iface)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
TRACE("(%p)->(): new ref = %u\n", This, ref);
DMUSIC_LockModule();
DMUSIC_LockModule();
return refCount;
return ref;
}
static ULONG WINAPI IDirectMusic8Impl_Release (LPDIRECTMUSIC8 iface) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
static ULONG WINAPI IDirectMusic8Impl_Release(LPDIRECTMUSIC8 iface)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
TRACE("(%p)->(): new ref = %u\n", This, ref);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
if (!ref) {
HeapFree(GetProcessHeap(), 0, This->system_ports);
HeapFree(GetProcessHeap(), 0, This->ppPorts);
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
DMUSIC_UnlockModule();
return ref;
}
/* IDirectMusic8Impl IDirectMusic part: */
static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
TRACE("(%p, %d, %p)\n", This, dwIndex, pPortCaps);
if (NULL == pPortCaps) { return E_POINTER; }
/* i guess the first port shown is always software synthesizer */
if (dwIndex == 0)
{
IDirectMusicSynth8* synth;
TRACE("enumerating 'Microsoft Software Synthesizer' port\n");
CoCreateInstance (&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth8, (void**)&synth);
IDirectMusicSynth8_GetPortCaps (synth, pPortCaps);
IDirectMusicSynth8_Release (synth);
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD index, LPDMUS_PORTCAPS port_caps)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
/* it seems that the rest of devices are obtained thru dmusic32.EnumLegacyDevices...*sigh*...which is undocumented*/
#if 0
int numMIDI = midiOutGetNumDevs();
int numWAVE = waveOutGetNumDevs();
int i;
/* then return digital sound ports */
for (i = 1; i <= numWAVE; i++)
{
TRACE("enumerating 'digital sound' ports\n");
if (i == dwIndex)
{
DirectSoundEnumerateA(register_waveport, pPortCaps);
return S_OK;
}
}
/* finally, list all *real* MIDI ports*/
for (i = numWAVE + 1; i <= numWAVE + numMIDI; i++)
{
TRACE("enumerating 'real MIDI' ports\n");
if (i == dwIndex)
FIXME("Found MIDI port, but *real* MIDI ports not supported yet\n");
}
#endif
return S_FALSE;
TRACE("(%p, %d, %p)\n", This, index, port_caps);
if (!port_caps)
return E_POINTER;
if (index >= This->nb_system_ports)
return S_FALSE;
*port_caps = This->system_ports[index].caps;
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer (LPDIRECTMUSIC8 iface, LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER** ppBuffer, LPUNKNOWN pUnkOuter) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
static HRESULT WINAPI IDirectMusic8Impl_CreateMusicBuffer(LPDIRECTMUSIC8 iface, LPDMUS_BUFFERDESC buffer_desc, LPDIRECTMUSICBUFFER* buffer, LPUNKNOWN unkouter)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
TRACE("(%p, %p, %p, %p)\n", This, pBufferDesc, ppBuffer, pUnkOuter);
TRACE("(%p)->(%p, %p, %p)\n", This, buffer_desc, buffer, unkouter);
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
if (unkouter)
return CLASS_E_NOAGGREGATION;
if (!pBufferDesc || !ppBuffer)
return E_POINTER;
if (!buffer_desc || !buffer)
return E_POINTER;
return DMUSIC_CreateDirectMusicBufferImpl(&IID_IDirectMusicBuffer, (LPVOID)ppBuffer, NULL);
return DMUSIC_CreateDirectMusicBufferImpl(buffer_desc, (LPVOID)buffer);
}
static HRESULT WINAPI IDirectMusic8Impl_CreatePort (LPDIRECTMUSIC8 iface, REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT* ppPort, LPUNKNOWN pUnkOuter) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
int i/*, j*/;
DMUS_PORTCAPS PortCaps;
IDirectMusicPort* pNewPort = NULL;
HRESULT hr = E_FAIL;
static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSID rclsid_port, LPDMUS_PORTPARAMS port_params, LPDIRECTMUSICPORT* port, LPUNKNOWN unkouter)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
int i;
DMUS_PORTCAPS port_caps;
IDirectMusicPort* new_port = NULL;
HRESULT hr;
GUID default_port;
const GUID *request_port = rclsid_port;
TRACE("(%p, %s, %p, %p, %p)\n", This, debugstr_dmguid(rclsidPort), pPortParams, ppPort, pUnkOuter);
ZeroMemory(&PortCaps, sizeof(DMUS_PORTCAPS));
PortCaps.dwSize = sizeof(DMUS_PORTCAPS);
TRACE("(%p)->(%s, %p, %p, %p)\n", This, debugstr_dmguid(rclsid_port), port_params, port, unkouter);
for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &PortCaps); i++) {
if (IsEqualCLSID (rclsidPort, &PortCaps.guidPort)) {
hr = DMUSIC_CreateDirectMusicPortImpl(&IID_IDirectMusicPort, (LPVOID*) &pNewPort, (LPUNKNOWN) This, pPortParams, &PortCaps);
if (FAILED(hr)) {
*ppPort = NULL;
return hr;
}
This->nrofports++;
if (!This->ppPorts) This->ppPorts = HeapAlloc(GetProcessHeap(), 0, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
else This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
This->ppPorts[This->nrofports - 1] = pNewPort;
*ppPort = pNewPort;
return S_OK;
}
}
/* FIXME: place correct error here */
return E_NOINTERFACE;
if (!rclsid_port)
return E_POINTER;
if (!port_params)
return E_INVALIDARG;
if (!port)
return E_POINTER;
if (unkouter)
return CLASS_E_NOAGGREGATION;
if (TRACE_ON(dmusic))
dump_DMUS_PORTPARAMS(port_params);
ZeroMemory(&port_caps, sizeof(DMUS_PORTCAPS));
port_caps.dwSize = sizeof(DMUS_PORTCAPS);
if (IsEqualGUID(request_port, &GUID_NULL)) {
hr = IDirectMusic8_GetDefaultPort(iface, &default_port);
if(FAILED(hr))
return hr;
request_port = &default_port;
}
for (i = 0; S_FALSE != IDirectMusic8Impl_EnumPort(iface, i, &port_caps); i++) {
if (IsEqualCLSID(request_port, &port_caps.guidPort)) {
hr = This->system_ports[i].create(&IID_IDirectMusicPort, (LPVOID*)&new_port, (LPUNKNOWN)This, port_params, &port_caps, This->system_ports[i].device);
if (FAILED(hr)) {
*port = NULL;
return hr;
}
This->nrofports++;
if (!This->ppPorts)
This->ppPorts = HeapAlloc(GetProcessHeap(), 0, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
else
This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports);
This->ppPorts[This->nrofports - 1] = new_port;
*port = new_port;
return S_OK;
}
}
return E_NOINTERFACE;
}
static HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock (LPDIRECTMUSIC8 iface, DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
FIXME("(%p, %d, %p): stub\n", This, dwIndex, lpClockInfo);
return S_FALSE;
static HRESULT WINAPI IDirectMusic8Impl_EnumMasterClock(LPDIRECTMUSIC8 iface, DWORD index, LPDMUS_CLOCKINFO clock_info)
{
TRACE("(%p)->(%d, %p)\n", iface, index, clock_info);
if (!clock_info)
return E_POINTER;
if (index > 1)
return S_FALSE;
if (!index)
{
static const GUID guid_system_clock = { 0x58d58419, 0x71b4, 0x11d1, { 0xa7, 0x4c, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12 } };
static const WCHAR name_system_clock[] = { 'S','y','s','t','e','m',' ','C','l','o','c','k',0 };
clock_info->ctType = 0;
clock_info->guidClock = guid_system_clock;
strcpyW(clock_info->wszDescription, name_system_clock);
}
else
{
static const GUID guid_dsound_clock = { 0x58d58420, 0x71b4, 0x11d1, { 0xa7, 0x4c, 0x00, 0x00, 0xf8, 0x75, 0xac, 0x12 } };
static const WCHAR name_dsound_clock[] = { 'D','i','r','e','c','t','S','o','u','n','d',' ','C','l','o','c','k',0 };
clock_info->ctType = 0;
clock_info->guidClock = guid_dsound_clock;
strcpyW(clock_info->wszDescription, name_dsound_clock);
}
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_GetMasterClock (LPDIRECTMUSIC8 iface, LPGUID pguidClock, IReferenceClock** ppReferenceClock) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
static HRESULT WINAPI IDirectMusic8Impl_GetMasterClock(LPDIRECTMUSIC8 iface, LPGUID guid_clock, IReferenceClock** reference_clock)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
TRACE("(%p, %p, %p)\n", This, pguidClock, ppReferenceClock);
if (pguidClock)
*pguidClock = This->pMasterClock->pClockInfo.guidClock;
if(ppReferenceClock)
*ppReferenceClock = (IReferenceClock *)This->pMasterClock;
TRACE("(%p)->(%p, %p)\n", This, guid_clock, reference_clock);
return S_OK;
if (guid_clock)
*guid_clock = This->pMasterClock->pClockInfo.guidClock;
if (reference_clock)
*reference_clock = (IReferenceClock*)This->pMasterClock;
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_SetMasterClock (LPDIRECTMUSIC8 iface, REFGUID rguidClock) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
FIXME("(%p, %s): stub\n", This, debugstr_dmguid(rguidClock));
return S_OK;
static HRESULT WINAPI IDirectMusic8Impl_SetMasterClock(LPDIRECTMUSIC8 iface, REFGUID rguidClock)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
FIXME("(%p)->(%s): stub\n", This, debugstr_dmguid(rguidClock));
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_Activate (LPDIRECTMUSIC8 iface, BOOL fEnable) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
int i;
FIXME("(%p, %d): stub\n", This, fEnable);
for (i = 0; i < This->nrofports; i++) {
IDirectMusicPortImpl_Activate(This->ppPorts[i], fEnable);
}
return S_OK;
static HRESULT WINAPI IDirectMusic8Impl_Activate(LPDIRECTMUSIC8 iface, BOOL enable)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
int i;
HRESULT hr;
TRACE("(%p)->(%u)\n", This, enable);
for (i = 0; i < This->nrofports; i++)
{
hr = IDirectMusicPort_Activate(This->ppPorts[i], enable);
if (FAILED(hr))
return hr;
}
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort (LPDIRECTMUSIC8 iface, LPGUID pguidPort) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
HKEY hkGUID;
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
char returnBuffer[51];
GUID defaultPortGUID;
WCHAR buff[51];
static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort(LPDIRECTMUSIC8 iface, LPGUID guid_port)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
HKEY hkGUID;
DWORD returnTypeGUID, sizeOfReturnBuffer = 50;
char returnBuffer[51];
GUID defaultPortGUID;
WCHAR buff[51];
TRACE("(%p, %p)\n", This, pguidPort);
if ((RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic\\Defaults" , 0, KEY_READ, &hkGUID) != ERROR_SUCCESS) ||
(RegQueryValueExA(hkGUID, "DefaultOutputPort", NULL, &returnTypeGUID, (LPBYTE)returnBuffer, &sizeOfReturnBuffer) != ERROR_SUCCESS))
{
WARN(": registry entry missing\n" );
*pguidPort = CLSID_DirectMusicSynth;
return S_OK;
}
/* FIXME: Check return types to ensure we're interpreting data right */
MultiByteToWideChar(CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff) / sizeof(WCHAR));
CLSIDFromString(buff, &defaultPortGUID);
*pguidPort = defaultPortGUID;
return S_OK;
TRACE("(%p)->(%p)\n", This, guid_port);
if ((RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\DirectMusic\\Defaults" , 0, KEY_READ, &hkGUID) != ERROR_SUCCESS) ||
(RegQueryValueExA(hkGUID, "DefaultOutputPort", NULL, &returnTypeGUID, (LPBYTE)returnBuffer, &sizeOfReturnBuffer) != ERROR_SUCCESS))
{
WARN(": registry entry missing\n" );
*guid_port = CLSID_DirectMusicSynth;
return S_OK;
}
/* FIXME: Check return types to ensure we're interpreting data right */
MultiByteToWideChar(CP_ACP, 0, returnBuffer, -1, buff, sizeof(buff) / sizeof(WCHAR));
CLSIDFromString(buff, &defaultPortGUID);
*guid_port = defaultPortGUID;
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound (LPDIRECTMUSIC8 iface, LPDIRECTSOUND pDirectSound, HWND hWnd) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
FIXME("(%p, %p, %p): stub\n", This, pDirectSound, hWnd);
return S_OK;
static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound(LPDIRECTMUSIC8 iface, LPDIRECTSOUND dsound, HWND wnd)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
FIXME("(%p)->(%p, %p): stub\n", This, dsound, wnd);
return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_SetExternalMasterClock (LPDIRECTMUSIC8 iface, IReferenceClock* pClock) {
IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
FIXME("(%p, %p): stub\n", This, pClock);
return S_OK;
static HRESULT WINAPI IDirectMusic8Impl_SetExternalMasterClock(LPDIRECTMUSIC8 iface, IReferenceClock* clock)
{
IDirectMusic8Impl *This = impl_from_IDirectMusic8(iface);
FIXME("(%p)->(%p): stub\n", This, clock);
return S_OK;
}
static const IDirectMusic8Vtbl DirectMusic8_Vtbl = {
IDirectMusic8Impl_QueryInterface,
IDirectMusic8Impl_AddRef,
IDirectMusic8Impl_Release,
IDirectMusic8Impl_EnumPort,
IDirectMusic8Impl_CreateMusicBuffer,
IDirectMusic8Impl_CreatePort,
IDirectMusic8Impl_EnumMasterClock,
IDirectMusic8Impl_GetMasterClock,
IDirectMusic8Impl_SetMasterClock,
IDirectMusic8Impl_Activate,
IDirectMusic8Impl_GetDefaultPort,
IDirectMusic8Impl_SetDirectSound,
IDirectMusic8Impl_SetExternalMasterClock
IDirectMusic8Impl_QueryInterface,
IDirectMusic8Impl_AddRef,
IDirectMusic8Impl_Release,
IDirectMusic8Impl_EnumPort,
IDirectMusic8Impl_CreateMusicBuffer,
IDirectMusic8Impl_CreatePort,
IDirectMusic8Impl_EnumMasterClock,
IDirectMusic8Impl_GetMasterClock,
IDirectMusic8Impl_SetMasterClock,
IDirectMusic8Impl_Activate,
IDirectMusic8Impl_GetDefaultPort,
IDirectMusic8Impl_SetDirectSound,
IDirectMusic8Impl_SetExternalMasterClock
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusic8Impl *dmusic;
static void create_system_ports_list(IDirectMusic8Impl* object)
{
port_info * port;
const WCHAR emulated[] = {' ','[','E','m','u','l','a','t','e','d',']',0};
ULONG nb_ports;
ULONG nb_midi_out;
ULONG nb_midi_in;
MIDIOUTCAPSW caps_out;
MIDIINCAPSW caps_in;
IDirectMusicSynth8* synth;
HRESULT hr;
ULONG i;
TRACE("(%p,%p,%p)\n",lpcGUID, ppobj, pUnkOuter);
TRACE("(%p)\n", object);
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl));
if (NULL == dmusic) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dmusic->lpVtbl = &DirectMusic8_Vtbl;
dmusic->ref = 0; /* will be inited with QueryInterface */
dmusic->pMasterClock = NULL;
dmusic->ppPorts = NULL;
dmusic->nrofports = 0;
DMUSIC_CreateReferenceClockImpl (&IID_IReferenceClock, (LPVOID*)&dmusic->pMasterClock, NULL);
return IDirectMusic8Impl_QueryInterface ((LPDIRECTMUSIC8)dmusic, lpcGUID, ppobj);
/* NOTE:
- it seems some native versions get the rest of devices through dmusic32.EnumLegacyDevices...*sigh*...which is undocumented
- should we enum wave devices ? Native does not seem to
*/
nb_midi_out = midiOutGetNumDevs();
nb_midi_in = midiInGetNumDevs();
nb_ports = 1 /* midi mapper */ + nb_midi_out + nb_midi_in + 1 /* synth port */;
port = object->system_ports = HeapAlloc(GetProcessHeap(), 0, nb_ports * sizeof(port_info));
if (!object->system_ports)
return;
/* Fill common port caps for all winmm ports */
for (i = 0; i < (nb_ports - 1 /* synth port*/); i++)
{
object->system_ports[i].caps.dwSize = sizeof(DMUS_PORTCAPS);
object->system_ports[i].caps.dwType = DMUS_PORT_WINMM_DRIVER;
object->system_ports[i].caps.dwMemorySize = 0;
object->system_ports[i].caps.dwMaxChannelGroups = 1;
object->system_ports[i].caps.dwMaxVoices = 0;
object->system_ports[i].caps.dwMaxAudioChannels = 0;
object->system_ports[i].caps.dwEffectFlags = DMUS_EFFECT_NONE;
/* Fake port GUID */
object->system_ports[i].caps.guidPort = IID_IUnknown;
object->system_ports[i].caps.guidPort.Data1 = i + 1;
}
/* Fill midi mapper port info */
port->device = MIDI_MAPPER;
port->create = DMUSIC_CreateMidiOutPortImpl;
midiOutGetDevCapsW(MIDI_MAPPER, &caps_out, sizeof(caps_out));
strcpyW(port->caps.wszDescription, caps_out.szPname);
strcatW(port->caps.wszDescription, emulated);
port->caps.dwFlags = DMUS_PC_SHAREABLE;
port->caps.dwClass = DMUS_PC_OUTPUTCLASS;
port++;
/* Fill midi out port info */
for (i = 0; i < nb_midi_out; i++)
{
port->device = i;
port->create = DMUSIC_CreateMidiOutPortImpl;
midiOutGetDevCapsW(i, &caps_out, sizeof(caps_out));
strcpyW(port->caps.wszDescription, caps_out.szPname);
strcatW(port->caps.wszDescription, emulated);
port->caps.dwFlags = DMUS_PC_SHAREABLE | DMUS_PC_EXTERNAL;
port->caps.dwClass = DMUS_PC_OUTPUTCLASS;
port++;
}
/* Fill midi in port info */
for (i = 0; i < nb_midi_in; i++)
{
port->device = i;
port->create = DMUSIC_CreateMidiInPortImpl;
midiInGetDevCapsW(i, &caps_in, sizeof(caps_in));
strcpyW(port->caps.wszDescription, caps_in.szPname);
strcatW(port->caps.wszDescription, emulated);
port->caps.dwFlags = DMUS_PC_EXTERNAL;
port->caps.dwClass = DMUS_PC_INPUTCLASS;
port++;
}
/* Fill synth port info */
port->create = DMUSIC_CreateSynthPortImpl;
hr = CoCreateInstance(&CLSID_DirectMusicSynth, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectMusicSynth8, (void**)&synth);
if (SUCCEEDED(hr))
{
port->caps.dwSize = sizeof(port->caps);
hr = IDirectMusicSynth8_GetPortCaps(synth, &port->caps);
IDirectMusicSynth8_Release(synth);
}
if (FAILED(hr))
nb_ports--;
object->nb_system_ports = nb_ports;
}
/* For ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNOWN unkouter)
{
IDirectMusic8Impl *dmusic;
HRESULT ret;
TRACE("(%p,%p,%p)\n", riid, ret_iface, unkouter);
*ret_iface = NULL;
dmusic = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusic8Impl));
if (!dmusic)
return E_OUTOFMEMORY;
dmusic->IDirectMusic8_iface.lpVtbl = &DirectMusic8_Vtbl;
dmusic->ref = 0; /* Will be inited by QueryInterface */
dmusic->pMasterClock = NULL;
dmusic->ppPorts = NULL;
dmusic->nrofports = 0;
ret = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (LPVOID*)&dmusic->pMasterClock, NULL);
if (FAILED(ret)) {
HeapFree(GetProcessHeap(), 0, dmusic);
return ret;
}
ret = IDirectMusic8Impl_QueryInterface(&dmusic->IDirectMusic8_iface, riid, ret_iface);
if (FAILED(ret)) {
IReferenceClock_Release(&dmusic->pMasterClock->IReferenceClock_iface);
HeapFree(GetProcessHeap(), 0, dmusic);
return ret;
}
create_system_ports_list(dmusic);
return S_OK;
}
+35
View File
@@ -0,0 +1,35 @@
/*
* COM Classes for dmusic
*
* Copyright 2010 Alexandre Julliard
*
* 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
*/
[
threading(both),
progid("Microsoft.DirectMusic.1"),
vi_progid("Microsoft.DirectMusic"),
uuid(636b9f10-0c7d-11d1-95b2-0020afdc7421)
]
coclass DirectMusic { interface IDirectMusic; }
[
threading(both),
progid("Microsoft.DirectMusicCollection.1"),
vi_progid("Microsoft.DirectMusicCollection"),
uuid(480ff4b0-28b2-11d1-bef7-00c04fbf8fef)
]
coclass DirectMusicCollection { interface IDirectMusicCollection; }
+39
View File
@@ -0,0 +1,39 @@
HKCR
{
NoRemove Interface
{
}
NoRemove CLSID
{
'{636B9F10-0C7D-11D1-95B2-0020AFDC7421}' = s 'DirectMusic'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
ProgId = s 'Microsoft.DirectMusic.1'
VersionIndependentProgId = s 'Microsoft.DirectMusic'
}
'{480FF4B0-28B2-11D1-BEF7-00C04FBF8FEF}' = s 'DirectMusicCollection'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
ProgId = s 'Microsoft.DirectMusicCollection.1'
VersionIndependentProgId = s 'Microsoft.DirectMusicCollection'
}
}
'Microsoft.DirectMusic.1' = s 'DirectMusic'
{
CLSID = s '{636B9F10-0C7D-11D1-95B2-0020AFDC7421}'
}
'Microsoft.DirectMusic' = s 'DirectMusic'
{
CLSID = s '{636B9F10-0C7D-11D1-95B2-0020AFDC7421}'
CurVer = s 'Microsoft.DirectMusic.1'
}
'Microsoft.DirectMusicCollection.1' = s 'DirectMusicCollection'
{
CLSID = s '{480FF4B0-28B2-11D1-BEF7-00C04FBF8FEF}'
}
'Microsoft.DirectMusicCollection' = s 'DirectMusicCollection'
{
CLSID = s '{480FF4B0-28B2-11D1-BEF7-00C04FBF8FEF}'
CurVer = s 'Microsoft.DirectMusicCollection.1'
}
}
+123 -105
View File
@@ -23,112 +23,93 @@
#include <stdio.h>
#include "dmusic_private.h"
#include "rpcproxy.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static HINSTANCE instance;
LONG DMUSIC_refCount = 0;
typedef struct {
const IClassFactoryVtbl *lpVtbl;
IClassFactory IClassFactory_iface;
HRESULT (WINAPI *fnCreateInstance)(REFIID riid, void **ppv, IUnknown *pUnkOuter);
} IClassFactoryImpl;
/******************************************************************
* DirectMusic ClassFactory
* IClassFactory implementation
*/
static HRESULT WINAPI DirectMusicCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
}
static ULONG WINAPI DirectMusicCF_AddRef(LPCLASSFACTORY iface) {
DMUSIC_LockModule();
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{
if (ppv == NULL)
return E_POINTER;
return 2; /* non-heap based object */
if (IsEqualGUID(&IID_IUnknown, riid))
TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
else if (IsEqualGUID(&IID_IClassFactory, riid))
TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
else {
FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
*ppv = NULL;
return E_NOINTERFACE;
}
*ppv = iface;
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI DirectMusicCF_Release(LPCLASSFACTORY iface) {
DMUSIC_UnlockModule();
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
{
DMUSIC_LockModule();
return 1; /* non-heap based object */
return 2; /* non-heap based object */
}
static HRESULT WINAPI DirectMusicCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicImpl (riid, ppobj, pOuter);
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
{
DMUSIC_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI DirectMusicCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
TRACE("(%d)\n", dolock);
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
REFIID riid, void **ppv)
{
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
if (dolock)
DMUSIC_LockModule();
else
DMUSIC_UnlockModule();
return S_OK;
TRACE ("(%p, %s, %p)\n", pUnkOuter, debugstr_dmguid(riid), ppv);
return This->fnCreateInstance(riid, ppv, pUnkOuter);
}
static const IClassFactoryVtbl DirectMusicCF_Vtbl = {
DirectMusicCF_QueryInterface,
DirectMusicCF_AddRef,
DirectMusicCF_Release,
DirectMusicCF_CreateInstance,
DirectMusicCF_LockServer
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
{
TRACE("(%d)\n", dolock);
if (dolock)
DMUSIC_LockModule();
else
DMUSIC_UnlockModule();
return S_OK;
}
static const IClassFactoryVtbl classfactory_vtbl = {
ClassFactory_QueryInterface,
ClassFactory_AddRef,
ClassFactory_Release,
ClassFactory_CreateInstance,
ClassFactory_LockServer
};
static IClassFactoryImpl DirectMusic_CF = {&DirectMusicCF_Vtbl};
/******************************************************************
* DirectMusicCollection ClassFactory
*/
static HRESULT WINAPI CollectionCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid));
if (ppobj == NULL) return E_POINTER;
return E_NOINTERFACE;
}
static ULONG WINAPI CollectionCF_AddRef(LPCLASSFACTORY iface) {
DMUSIC_LockModule();
return 2; /* non-heap based object */
}
static ULONG WINAPI CollectionCF_Release(LPCLASSFACTORY iface) {
DMUSIC_UnlockModule();
return 1; /* non-heap based object */
}
static HRESULT WINAPI CollectionCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) {
TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj);
return DMUSIC_CreateDirectMusicCollectionImpl (riid, ppobj, pOuter);
}
static HRESULT WINAPI CollectionCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
TRACE("(%d)\n", dolock);
if (dolock)
DMUSIC_LockModule();
else
DMUSIC_UnlockModule();
return S_OK;
}
static const IClassFactoryVtbl CollectionCF_Vtbl = {
CollectionCF_QueryInterface,
CollectionCF_AddRef,
CollectionCF_Release,
CollectionCF_CreateInstance,
CollectionCF_LockServer
};
static IClassFactoryImpl Collection_CF = {&CollectionCF_Vtbl};
static IClassFactoryImpl DirectMusic_CF = {{&classfactory_vtbl}, DMUSIC_CreateDirectMusicImpl};
static IClassFactoryImpl Collection_CF = {{&classfactory_vtbl},
DMUSIC_CreateDirectMusicCollectionImpl};
/******************************************************************
* DllMain
@@ -137,6 +118,7 @@ static IClassFactoryImpl Collection_CF = {&CollectionCF_Vtbl};
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
if (fdwReason == DLL_PROCESS_ATTACH) {
instance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
/* FIXME: Initialisation */
} else if (fdwReason == DLL_PROCESS_DETACH) {
@@ -180,6 +162,21 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return CLASS_E_CLASSNOTAVAILABLE;
}
/***********************************************************************
* DllRegisterServer (DMUSIC.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( instance );
}
/***********************************************************************
* DllUnregisterServer (DMUSIC.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( instance );
}
/******************************************************************
* Helper functions
@@ -187,7 +184,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
*
*/
/* dwPatch from MIDILOCALE */
DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale) {
DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) {
DWORD dwPatch = 0;
if (!pLocale) return 0;
dwPatch |= (pLocale->ulBank & F_INSTRUMENT_DRUMS); /* set drum bit */
@@ -449,27 +446,48 @@ static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0]));
}
/* dump whole DMUS_OBJECTDESC struct */
const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc) {
if (pDesc) {
char buffer[1024] = "", *ptr = &buffer[0];
ptr += sprintf(ptr, "DMUS_OBJECTDESC (%p):\n", pDesc);
ptr += sprintf(ptr, " - dwSize = %d\n", pDesc->dwSize);
ptr += sprintf(ptr, " - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (pDesc->dwValidData));
if (pDesc->dwValidData & DMUS_OBJ_CLASS) ptr += sprintf(ptr, " - guidClass = %s\n", debugstr_dmguid(&pDesc->guidClass));
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) ptr += sprintf(ptr, " - guidObject = %s\n", debugstr_guid(&pDesc->guidObject));
if (pDesc->dwValidData & DMUS_OBJ_DATE) ptr += sprintf(ptr, " - ftDate = FIXME\n");
if (pDesc->dwValidData & DMUS_OBJ_VERSION) ptr += sprintf(ptr, " - vVersion = %s\n", debugstr_dmversion(&pDesc->vVersion));
if (pDesc->dwValidData & DMUS_OBJ_NAME) ptr += sprintf(ptr, " - wszName = %s\n", debugstr_w(pDesc->wszName));
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) ptr += sprintf(ptr, " - wszCategory = %s\n", debugstr_w(pDesc->wszCategory));
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) ptr += sprintf(ptr, " - wszFileName = %s\n", debugstr_w(pDesc->wszFileName));
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = 0x%s\n - pbMemData = %p\n",
wine_dbgstr_longlong(pDesc->llMemLength), pDesc->pbMemData);
if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p", pDesc->pStream);
return wine_dbg_sprintf("%s", buffer);
} else {
return wine_dbg_sprintf("(NULL)");
}
/* Dump whole DMUS_OBJECTDESC struct */
void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc)
{
TRACE("DMUS_OBJECTDESC (%p):\n", desc);
TRACE(" - dwSize = %d\n", desc->dwSize);
TRACE(" - dwValidData = %s\n", debugstr_DMUS_OBJ_FLAGS (desc->dwValidData));
if (desc->dwValidData & DMUS_OBJ_CLASS) TRACE(" - guidClass = %s\n", debugstr_dmguid(&desc->guidClass));
if (desc->dwValidData & DMUS_OBJ_OBJECT) TRACE(" - guidObject = %s\n", debugstr_guid(&desc->guidObject));
if (desc->dwValidData & DMUS_OBJ_DATE) TRACE(" - ftDate = FIXME\n");
if (desc->dwValidData & DMUS_OBJ_VERSION) TRACE(" - vVersion = %s\n", debugstr_dmversion(&desc->vVersion));
if (desc->dwValidData & DMUS_OBJ_NAME) TRACE(" - wszName = %s\n", debugstr_w(desc->wszName));
if (desc->dwValidData & DMUS_OBJ_CATEGORY) TRACE(" - wszCategory = %s\n", debugstr_w(desc->wszCategory));
if (desc->dwValidData & DMUS_OBJ_FILENAME) TRACE(" - wszFileName = %s\n", debugstr_w(desc->wszFileName));
if (desc->dwValidData & DMUS_OBJ_MEMORY) TRACE(" - llMemLength = 0x%s\n - pbMemData = %p\n",
wine_dbgstr_longlong(desc->llMemLength), desc->pbMemData);
if (desc->dwValidData & DMUS_OBJ_STREAM) TRACE(" - pStream = %p\n", desc->pStream);
}
/* Dump DMUS_PORTPARAMS flags */
static const char* debugstr_DMUS_PORTPARAMS_FLAGS(DWORD flagmask)
{
static const flag_info flags[] = {
FE(DMUS_PORTPARAMS_VOICES),
FE(DMUS_PORTPARAMS_CHANNELGROUPS),
FE(DMUS_PORTPARAMS_AUDIOCHANNELS),
FE(DMUS_PORTPARAMS_SAMPLERATE),
FE(DMUS_PORTPARAMS_EFFECTS),
FE(DMUS_PORTPARAMS_SHARE)
};
return debugstr_flags(flagmask, flags, sizeof(flags)/sizeof(flags[0]));
}
/* Dump whole DMUS_PORTPARAMS struct */
void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params)
{
TRACE("DMUS_PORTPARAMS (%p):\n", params);
TRACE(" - dwSize = %d\n", params->dwSize);
TRACE(" - dwValidParams = %s\n", debugstr_DMUS_PORTPARAMS_FLAGS(params->dwValidParams));
if (params->dwValidParams & DMUS_PORTPARAMS_VOICES) TRACE(" - dwVoices = %u\n", params->dwVoices);
if (params->dwValidParams & DMUS_PORTPARAMS_CHANNELGROUPS) TRACE(" - dwChannelGroup = %u\n", params->dwChannelGroups);
if (params->dwValidParams & DMUS_PORTPARAMS_AUDIOCHANNELS) TRACE(" - dwAudioChannels = %u\n", params->dwAudioChannels);
if (params->dwValidParams & DMUS_PORTPARAMS_SAMPLERATE) TRACE(" - dwSampleRate = %u\n", params->dwSampleRate);
if (params->dwValidParams & DMUS_PORTPARAMS_EFFECTS) TRACE(" - dwEffectFlags = %x\n", params->dwEffectFlags);
if (params->dwValidParams & DMUS_PORTPARAMS_SHARE) TRACE(" - fShare = %u\n", params->fShare);
}
+133 -92
View File
@@ -1,6 +1,8 @@
/* DirectMusic Private Include
/*
* DirectMusic Private Include
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2012 Christian Costa
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -50,14 +52,12 @@ typedef struct IDirectMusic8Impl IDirectMusic8Impl;
typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl;
typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl;
typedef struct IDirectMusicDownloadImpl IDirectMusicDownloadImpl;
typedef struct IDirectMusicPortDownloadImpl IDirectMusicPortDownloadImpl;
typedef struct IDirectMusicPortImpl IDirectMusicPortImpl;
typedef struct IDirectMusicThruImpl IDirectMusicThruImpl;
typedef struct IReferenceClockImpl IReferenceClockImpl;
typedef struct IDirectMusicCollectionImpl IDirectMusicCollectionImpl;
typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl;
typedef struct SynthPortImpl SynthPortImpl;
/*****************************************************************************
* Some stuff to make my life easier :=)
@@ -74,102 +74,133 @@ typedef struct DMUSIC_PRIVATE_CHANNEL_GROUP_ {
DMUSIC_PRIVATE_MCHANNEL channel[16]; /* 16 channels in a group */
} DMUSIC_PRIVATE_CHANNEL_GROUP, *LPDMUSIC_PRIVATE_CHANNEL_GROUP;
typedef struct port_info {
DMUS_PORTCAPS caps;
HRESULT (*create)(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device);
ULONG device;
} port_info;
typedef struct instrument_region {
RGNHEADER header;
WAVELINK wave_link;
WSMPL wave_sample;
WLOOP wave_loop;
BOOL loop_present;
} instrument_region;
typedef struct instrument_articulation {
CONNECTIONLIST connections_list;
CONNECTION *connections;
} instrument_articulation;
/*****************************************************************************
* ClassFactory
*/
extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicBufferImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
/* CLSID */
extern HRESULT WINAPI DMUSIC_CreateDirectMusicImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
extern HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
/* Internal */
extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN;
/*****************************************************************************
* IDirectMusic8Impl implementation structure
*/
struct IDirectMusic8Impl {
/* IUnknown fields */
const IDirectMusic8Vtbl *lpVtbl;
LONG ref;
/* IUnknown fields */
IDirectMusic8 IDirectMusic8_iface;
LONG ref;
/* IDirectMusicImpl fields */
IReferenceClockImpl* pMasterClock;
IDirectMusicPort** ppPorts;
int nrofports;
/* IDirectMusicImpl fields */
IReferenceClockImpl* pMasterClock;
IDirectMusicPort** ppPorts;
int nrofports;
port_info* system_ports;
int nb_system_ports;
};
/*****************************************************************************
* IDirectMusicBufferImpl implementation structure
*/
struct IDirectMusicBufferImpl {
/* IUnknown fields */
const IDirectMusicBufferVtbl *lpVtbl;
LONG ref;
/* IUnknown fields */
IDirectMusicBuffer IDirectMusicBuffer_iface;
LONG ref;
/* IDirectMusicBufferImpl fields */
/* IDirectMusicBufferImpl fields */
GUID format;
DWORD size;
LPBYTE data;
DWORD write_pos;
REFERENCE_TIME start_time;
};
/*****************************************************************************
* IDirectMusicDownloadedInstrumentImpl implementation structure
*/
struct IDirectMusicDownloadedInstrumentImpl {
/* IUnknown fields */
const IDirectMusicDownloadedInstrumentVtbl *lpVtbl;
LONG ref;
/* IUnknown fields */
IDirectMusicDownloadedInstrument IDirectMusicDownloadedInstrument_iface;
LONG ref;
/* IDirectMusicDownloadedInstrumentImpl fields */
/* IDirectMusicDownloadedInstrumentImpl fields */
BOOL downloaded;
void *data;
};
/*****************************************************************************
* IDirectMusicDownloadImpl implementation structure
*/
struct IDirectMusicDownloadImpl {
/* IUnknown fields */
const IDirectMusicDownloadVtbl *lpVtbl;
LONG ref;
/* IUnknown fields */
IDirectMusicDownload IDirectMusicDownload_iface;
LONG ref;
/* IDirectMusicDownloadImpl fields */
/* IDirectMusicDownloadImpl fields */
};
/*****************************************************************************
* IDirectMusicPortImpl implementation structure
* SynthPortImpl implementation structure
*/
struct IDirectMusicPortImpl {
/* IUnknown fields */
const IDirectMusicPortVtbl *lpVtbl;
const IDirectMusicPortDownloadVtbl *lpDownloadVtbl;
const IDirectMusicThruVtbl *lpThruVtbl;
LONG ref;
struct SynthPortImpl {
/* IUnknown fields */
IDirectMusicPort IDirectMusicPort_iface;
IDirectMusicPortDownload IDirectMusicPortDownload_iface;
IDirectMusicThru IDirectMusicThru_iface;
LONG ref;
/* IDirectMusicPortImpl fields */
IDirectSound* pDirectSound;
IReferenceClock* pLatencyClock;
BOOL fActive;
DMUS_PORTCAPS caps;
DMUS_PORTPARAMS params;
int nrofgroups;
DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
/* IDirectMusicPort fields */
IDirectSound* pDirectSound;
IReferenceClock* pLatencyClock;
IDirectMusicSynth* synth;
IDirectMusicSynthSink* synth_sink;
BOOL fActive;
DMUS_PORTCAPS caps;
DMUS_PORTPARAMS params;
int nrofgroups;
DMUSIC_PRIVATE_CHANNEL_GROUP group[1];
};
extern HRESULT WINAPI IDirectMusicPortImpl_Activate (LPDIRECTMUSICPORT iface, BOOL fActive);
/** Internal factory */
extern HRESULT WINAPI DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter, LPDMUS_PORTPARAMS pPortParams, LPDMUS_PORTCAPS pPortCaps);
extern HRESULT DMUSIC_CreateSynthPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateMidiOutPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
extern HRESULT DMUSIC_CreateMidiInPortImpl(LPCGUID guid, LPVOID *object, LPUNKNOWN unkouter, LPDMUS_PORTPARAMS port_params, LPDMUS_PORTCAPS port_caps, DWORD device) DECLSPEC_HIDDEN;
/*****************************************************************************
* IReferenceClockImpl implementation structure
*/
struct IReferenceClockImpl {
/* IUnknown fields */
const IReferenceClockVtbl *lpVtbl;
LONG ref;
/* IUnknown fields */
IReferenceClock IReferenceClock_iface;
LONG ref;
/* IReferenceClockImpl fields */
REFERENCE_TIME rtTime;
DMUS_CLOCKINFO pClockInfo;
/* IReferenceClockImpl fields */
REFERENCE_TIME rtTime;
DMUS_CLOCKINFO pClockInfo;
};
typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {
@@ -185,51 +216,59 @@ typedef struct _DMUS_PRIVATE_POOLCUE {
* IDirectMusicCollectionImpl implementation structure
*/
struct IDirectMusicCollectionImpl {
/* IUnknown fields */
const IUnknownVtbl *UnknownVtbl;
const IDirectMusicCollectionVtbl *CollectionVtbl;
const IDirectMusicObjectVtbl *ObjectVtbl;
const IPersistStreamVtbl *PersistStreamVtbl;
LONG ref;
/* IUnknown fields */
IDirectMusicCollection IDirectMusicCollection_iface;
IDirectMusicObject IDirectMusicObject_iface;
IPersistStream IPersistStream_iface;
LONG ref;
/* IDirectMusicCollectionImpl fields */
IStream *pStm; /* stream from which we load collection and later instruments */
LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
LPDMUS_OBJECTDESC pDesc;
CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
LPDLSHEADER pHeader;
/* pool table */
LPPOOLTABLE pPoolTable;
LPPOOLCUE pPoolCues;
/* instruments */
struct list Instruments;
/* IDirectMusicCollectionImpl fields */
IStream *pStm; /* stream from which we load collection and later instruments */
LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */
LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */
LPDMUS_OBJECTDESC pDesc;
CHAR* szCopyright; /* FIXME: should probably placed somewhere else */
LPDLSHEADER pHeader;
/* pool table */
LPPOOLTABLE pPoolTable;
LPPOOLCUE pPoolCues;
/* instruments */
struct list Instruments;
};
/*****************************************************************************
* IDirectMusicInstrumentImpl implementation structure
*/
struct IDirectMusicInstrumentImpl {
/* IUnknown fields */
const IUnknownVtbl *UnknownVtbl;
const IDirectMusicInstrumentVtbl *InstrumentVtbl;
LONG ref;
/* IUnknown fields */
IDirectMusicInstrument IDirectMusicInstrument_iface;
LONG ref;
/* IDirectMusicInstrumentImpl fields */
LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
LPGUID pInstrumentID;
LPINSTHEADER pHeader;
WCHAR wszName[DMUS_MAX_NAME];
/* instrument data */
/* IDirectMusicInstrumentImpl fields */
LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */
ULONG length; /* Length of the instrument in the stream */
GUID id;
INSTHEADER header;
WCHAR wszName[DMUS_MAX_NAME];
/* instrument data */
BOOL loaded;
instrument_region *regions;
ULONG nb_articulations;
instrument_articulation *articulations;
};
static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface)
{
return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface);
}
/* custom :) */
extern HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm);
extern HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream) DECLSPEC_HIDDEN;
/**********************************************************************
* Dll lifetime tracking declaration for dmusic.dll
*/
extern LONG DMUSIC_refCount;
extern LONG DMUSIC_refCount DECLSPEC_HIDDEN;
static inline void DMUSIC_LockModule(void) { InterlockedIncrement( &DMUSIC_refCount ); }
static inline void DMUSIC_UnlockModule(void) { InterlockedDecrement( &DMUSIC_refCount ); }
@@ -269,17 +308,19 @@ typedef struct {
#define GE(x) { &x, #x }
/* dwPatch from MIDILOCALE */
extern DWORD MIDILOCALE2Patch (LPMIDILOCALE pLocale);
extern DWORD MIDILOCALE2Patch (const MIDILOCALE *pLocale) DECLSPEC_HIDDEN;
/* MIDILOCALE from dwPatch */
extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale);
extern void Patch2MIDILOCALE (DWORD dwPatch, LPMIDILOCALE pLocale) DECLSPEC_HIDDEN;
/* check whether the given DWORD is even (return 0) or odd (return 1) */
extern int even_or_odd (DWORD number);
extern int even_or_odd (DWORD number) DECLSPEC_HIDDEN;
/* FOURCC to string conversion for debug messages */
extern const char *debugstr_fourcc (DWORD fourcc);
extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
/* returns name of given GUID */
extern const char *debugstr_dmguid (const GUID *id);
/* dump whole DMUS_OBJECTDESC struct */
extern const char *debugstr_DMUS_OBJECTDESC (LPDMUS_OBJECTDESC pDesc);
extern const char *debugstr_dmguid (const GUID *id) DECLSPEC_HIDDEN;
/* Dump whole DMUS_OBJECTDESC struct */
extern void dump_DMUS_OBJECTDESC(LPDMUS_OBJECTDESC desc) DECLSPEC_HIDDEN;
/* Dump whole DMUS_PORTPARAMS struct */
extern void dump_DMUS_PORTPARAMS(LPDMUS_PORTPARAMS params) DECLSPEC_HIDDEN;
#endif /* __WINE_DMUSIC_PRIVATE_H */
#endif /* __WINE_DMUSIC_PRIVATE_H */
+62 -48
View File
@@ -1,4 +1,5 @@
/* IDirectMusicDownload Implementation
/*
* IDirectMusicDownload Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
@@ -21,72 +22,85 @@
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static inline IDirectMusicDownloadImpl* impl_from_IDirectMusicDownload(IDirectMusicDownload *iface)
{
return CONTAINING_RECORD(iface, IDirectMusicDownloadImpl, IDirectMusicDownload_iface);
}
/* IDirectMusicDownloadImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface (LPDIRECTMUSICDOWNLOAD iface, REFIID riid, LPVOID *ppobj) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
static HRESULT WINAPI IDirectMusicDownloadImpl_QueryInterface(IDirectMusicDownload *iface, REFIID riid, void **ret_iface)
{
TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
if (IsEqualIID (riid, &IID_IUnknown)
|| IsEqualIID (riid, &IID_IDirectMusicDownload)) {
IUnknown_AddRef(iface);
*ppobj = This;
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IDirectMusicDownload))
{
IDirectMusicDownload_AddRef(iface);
*ret_iface = iface;
return S_OK;
}
*ret_iface = NULL;
WARN("(%p, %s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef (LPDIRECTMUSICDOWNLOAD iface) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
static ULONG WINAPI IDirectMusicDownloadImpl_AddRef(IDirectMusicDownload *iface)
{
IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
DMUSIC_LockModule();
DMUSIC_LockModule();
return refCount;
return ref;
}
static ULONG WINAPI IDirectMusicDownloadImpl_Release (LPDIRECTMUSICDOWNLOAD iface) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
static ULONG WINAPI IDirectMusicDownloadImpl_Release(IDirectMusicDownload *iface)
{
IDirectMusicDownloadImpl *This = impl_from_IDirectMusicDownload(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
if (!ref)
HeapFree(GetProcessHeap(), 0, This);
DMUSIC_UnlockModule();
return refCount;
DMUSIC_UnlockModule();
return ref;
}
/* IDirectMusicDownloadImpl IDirectMusicDownload part: */
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer (LPDIRECTMUSICDOWNLOAD iface, void** ppvBuffer, DWORD* pdwSize) {
IDirectMusicDownloadImpl *This = (IDirectMusicDownloadImpl *)iface;
FIXME("(%p, %p, %p): stub\n", This, ppvBuffer, pdwSize);
return S_OK;
static HRESULT WINAPI IDirectMusicDownloadImpl_GetBuffer(IDirectMusicDownload *iface, void **buffer, DWORD *size)
{
FIXME("(%p, %p, %p): stub\n", iface, buffer, size);
return S_OK;
}
static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
IDirectMusicDownloadImpl_QueryInterface,
IDirectMusicDownloadImpl_AddRef,
IDirectMusicDownloadImpl_Release,
IDirectMusicDownloadImpl_GetBuffer
IDirectMusicDownloadImpl_QueryInterface,
IDirectMusicDownloadImpl_AddRef,
IDirectMusicDownloadImpl_Release,
IDirectMusicDownloadImpl_GetBuffer
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicDownloadImpl* dmdl;
dmdl = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadImpl));
if (NULL == dmdl) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dmdl->lpVtbl = &DirectMusicDownload_Vtbl;
dmdl->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicDownloadImpl_QueryInterface ((LPDIRECTMUSICDOWNLOAD)dmdl, lpcGUID, ppobj);
HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer)
{
IDirectMusicDownloadImpl *download;
download = HeapAlloc(GetProcessHeap(), 0, sizeof(*download));
if (!download)
{
*ret_iface = NULL;
return E_OUTOFMEMORY;
}
download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl;
download->ref = 1;
*ret_iface = download;
return S_OK;
}
-88
View File
@@ -1,88 +0,0 @@
/* IDirectMusicDownloadedInstrument Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program 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 program 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 program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
/* IDirectMusicDownloadedInstrumentImpl IUnknown part: */
static HRESULT WINAPI IDirectMusicDownloadedInstrumentImpl_QueryInterface (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface, REFIID riid, LPVOID *ppobj) {
IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)
|| IsEqualIID (riid, &IID_IDirectMusicDownloadedInstrument)
|| IsEqualIID (riid, &IID_IDirectMusicDownloadedInstrument8)) {
IUnknown_AddRef(iface);
*ppobj = This;
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_AddRef (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) {
IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
DMUSIC_LockModule();
return refCount;
}
static ULONG WINAPI IDirectMusicDownloadedInstrumentImpl_Release (LPDIRECTMUSICDOWNLOADEDINSTRUMENT iface) {
IDirectMusicDownloadedInstrumentImpl *This = (IDirectMusicDownloadedInstrumentImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return refCount;
}
/* IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrument part: */
/* none at this time */
static const IDirectMusicDownloadedInstrumentVtbl DirectMusicDownloadedInstrument_Vtbl = {
IDirectMusicDownloadedInstrumentImpl_QueryInterface,
IDirectMusicDownloadedInstrumentImpl_AddRef,
IDirectMusicDownloadedInstrumentImpl_Release
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicDownloadedInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicDownloadedInstrumentImpl* dmdlinst;
dmdlinst = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadedInstrumentImpl));
if (NULL == dmdlinst) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dmdlinst->lpVtbl = &DirectMusicDownloadedInstrument_Vtbl;
dmdlinst->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicDownloadedInstrumentImpl_QueryInterface ((LPDIRECTMUSICDOWNLOADEDINSTRUMENT)dmdlinst, lpcGUID, ppobj);
}
+383 -371
View File
@@ -1,4 +1,5 @@
/* IDirectMusicInstrument Implementation
/*
* IDirectMusicInstrument Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
@@ -20,113 +21,109 @@
#include "dmusic_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
static const GUID IID_IDirectMusicInstrumentPRIVATE = {0xbcb20080,0xa40c,0x11d1,{0x86,0xbc,0x00,0xc0,0x4f,0xbf,0x8f,0xef}};
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface);
static ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef (LPDIRECTMUSICINSTRUMENT iface);
static const GUID IID_IDirectMusicInstrumentPRIVATE = { 0xbcb20080, 0xa40c, 0x11d1, { 0x86, 0xbc, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef } };
/* IDirectMusicInstrument IUnknown part: */
static HRESULT WINAPI IDirectMusicInstrumentImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown)) {
*ppobj = &This->UnknownVtbl;
IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicInstrument)) {
*ppobj = &This->InstrumentVtbl;
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef ((LPDIRECTMUSICINSTRUMENT)&This->InstrumentVtbl);
return S_OK;
} else if (IsEqualIID (riid, &IID_IDirectMusicInstrumentPRIVATE)) {
/* it seems to me that this interface is only basic IUnknown, without any
other inherited functions... *sigh* this is the worst scenario, since it means
that whoever calls it knows the layout of original implementation table and therefore
tries to get data by direct access... expect crashes */
FIXME("*sigh*... requested private/unspecified interface\n");
*ppobj = &This->UnknownVtbl;
IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
return S_OK;
}
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
return E_NOINTERFACE;
static HRESULT WINAPI IDirectMusicInstrumentImpl_QueryInterface(LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ret_iface)
{
TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IDirectMusicInstrument))
{
*ret_iface = iface;
IDirectMusicInstrument_AddRef(iface);
return S_OK;
}
else if (IsEqualIID(riid, &IID_IDirectMusicInstrumentPRIVATE))
{
/* it seems to me that this interface is only basic IUnknown, without any
* other inherited functions... *sigh* this is the worst scenario, since it means
* that whoever calls it knows the layout of original implementation table and therefore
* tries to get data by direct access... expect crashes
*/
FIXME("*sigh*... requested private/unspecified interface\n");
*ret_iface = iface;
IDirectMusicInstrument_AddRef(iface);
return S_OK;
}
WARN("(%p)->(%s, %p): not found\n", iface, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
}
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_AddRef (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
ULONG refCount = InterlockedIncrement(&This->ref);
static ULONG WINAPI IDirectMusicInstrumentImpl_AddRef(LPDIRECTMUSICINSTRUMENT iface)
{
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount - 1);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
DMUSIC_LockModule();
DMUSIC_LockModule();
return refCount;
return ref;
}
static ULONG WINAPI IDirectMusicInstrumentImpl_IUnknown_Release (LPUNKNOWN iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, UnknownVtbl, iface);
ULONG refCount = InterlockedDecrement(&This->ref);
static ULONG WINAPI IDirectMusicInstrumentImpl_Release(LPDIRECTMUSICINSTRUMENT iface)
{
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
TRACE("(%p)->(): new ref = %u\n", iface, ref);
if (!refCount) {
HeapFree(GetProcessHeap(), 0, This);
}
if (!ref)
{
ULONG i;
DMUSIC_UnlockModule();
return refCount;
HeapFree(GetProcessHeap(), 0, This->regions);
for (i = 0; i < This->nb_articulations; i++)
HeapFree(GetProcessHeap(), 0, This->articulations->connections);
HeapFree(GetProcessHeap(), 0, This->articulations);
HeapFree(GetProcessHeap(), 0, This);
}
DMUSIC_UnlockModule();
return ref;
}
static const IUnknownVtbl DirectMusicInstrument_Unknown_Vtbl = {
IDirectMusicInstrumentImpl_IUnknown_QueryInterface,
IDirectMusicInstrumentImpl_IUnknown_AddRef,
IDirectMusicInstrumentImpl_IUnknown_Release
};
/* IDirectMusicInstrumentImpl IDirectMusicInstrument part: */
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_QueryInterface (LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
return IDirectMusicInstrumentImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj);
static HRESULT WINAPI IDirectMusicInstrumentImpl_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch)
{
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
TRACE("(%p)->(%p)\n", This, pdwPatch);
*pdwPatch = MIDILOCALE2Patch(&This->header.Locale);
return S_OK;
}
static ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef (LPDIRECTMUSICINSTRUMENT iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
return IDirectMusicInstrumentImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl);
static HRESULT WINAPI IDirectMusicInstrumentImpl_SetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch)
{
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
TRACE("(%p)->(%d): stub\n", This, dwPatch);
Patch2MIDILOCALE(dwPatch, &This->header.Locale);
return S_OK;
}
static ULONG WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_Release (LPDIRECTMUSICINSTRUMENT iface) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
return IDirectMusicInstrumentImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl);
}
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_GetPatch (LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
TRACE("(%p, %p)\n", This, pdwPatch);
*pdwPatch = MIDILOCALE2Patch(&This->pHeader->Locale);
return S_OK;
}
static HRESULT WINAPI IDirectMusicInstrumentImpl_IDirectMusicInstrument_SetPatch (LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
TRACE("(%p, %d): stub\n", This, dwPatch);
Patch2MIDILOCALE(dwPatch, &This->pHeader->Locale);
return S_OK;
}
static const IDirectMusicInstrumentVtbl DirectMusicInstrument_Instrument_Vtbl = {
IDirectMusicInstrumentImpl_IDirectMusicInstrument_QueryInterface,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_AddRef,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_Release,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_GetPatch,
IDirectMusicInstrumentImpl_IDirectMusicInstrument_SetPatch
static const IDirectMusicInstrumentVtbl DirectMusicInstrument_Vtbl =
{
IDirectMusicInstrumentImpl_QueryInterface,
IDirectMusicInstrumentImpl_AddRef,
IDirectMusicInstrumentImpl_Release,
IDirectMusicInstrumentImpl_GetPatch,
IDirectMusicInstrumentImpl_SetPatch
};
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) {
IDirectMusicInstrumentImpl* dminst;
dminst = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicInstrumentImpl));
@@ -134,296 +131,311 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID*
*ppobj = NULL;
return E_OUTOFMEMORY;
}
dminst->UnknownVtbl = &DirectMusicInstrument_Unknown_Vtbl;
dminst->InstrumentVtbl = &DirectMusicInstrument_Instrument_Vtbl;
dminst->IDirectMusicInstrument_iface.lpVtbl = &DirectMusicInstrument_Vtbl;
dminst->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicInstrumentImpl_IUnknown_QueryInterface ((LPUNKNOWN)&dminst->UnknownVtbl, lpcGUID, ppobj);
return IDirectMusicInstrument_QueryInterface(&dminst->IDirectMusicInstrument_iface, lpcGUID, ppobj);
}
/* aux. function that completely loads instrument; my tests indicate that it's
called somewhere around IDirectMusicCollection_GetInstrument */
HRESULT WINAPI IDirectMusicInstrumentImpl_Custom_Load (LPDIRECTMUSICINSTRUMENT iface, LPSTREAM pStm) {
ICOM_THIS_MULTI(IDirectMusicInstrumentImpl, InstrumentVtbl, iface);
DMUS_PRIVATE_CHUNK Chunk;
DWORD ListSize[4], ListCount[4];
LARGE_INTEGER liMove; /* used when skipping chunks */
TRACE("(%p, %p, offset = %s)\n", This, pStm, wine_dbgstr_longlong(This->liInstrumentPosition.QuadPart));
static HRESULT read_from_stream(IStream *stream, void *data, ULONG size)
{
ULONG bytes_read;
HRESULT hr;
/* goto the beginning of chunk */
IStream_Seek (pStm, This->liInstrumentPosition, STREAM_SEEK_SET, NULL);
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[0] = Chunk.dwSize - sizeof(FOURCC);
ListCount[0] = 0;
switch (Chunk.fccID) {
case FOURCC_INS: {
TRACE_(dmfile)(": instrument list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[0] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_INSH: {
TRACE_(dmfile)(": instrument header chunk\n");
/* should be already initialised */
IStream_Read (pStm, This->pHeader, Chunk.dwSize, NULL);
break;
}
case FOURCC_DLID: {
TRACE_(dmfile)(": DLID (GUID) chunk\n");
/* should be already initialised */
IStream_Read (pStm, This->pInstrumentID, Chunk.dwSize, NULL);
break;
}
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[1] = Chunk.dwSize - sizeof(FOURCC);
ListCount[1] = 0;
switch (Chunk.fccID) {
case FOURCC_LRGN: {
TRACE_(dmfile)(": regions list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_LIST: {
IStream_Read (pStm, &Chunk.fccID, sizeof(FOURCC), NULL);
TRACE_(dmfile)(": LIST chunk of type %s", debugstr_fourcc(Chunk.fccID));
ListSize[2] = Chunk.dwSize - sizeof(FOURCC);
ListCount[2] = 0;
switch (Chunk.fccID) {
case FOURCC_RGN: {
/* temporary structures */
RGNHEADER tmpRegionHeader;
WSMPL tmpWaveSample;
WLOOP tmpWaveLoop;
WAVELINK tmpWaveLink;
TRACE_(dmfile)(": region list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[2] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_RGNH: {
TRACE_(dmfile)(": region header chunk\n");
memset (&tmpRegionHeader, 0, sizeof(RGNHEADER)); /* reset */
IStream_Read (pStm, &tmpRegionHeader, Chunk.dwSize, NULL);
break;
}
case FOURCC_WSMP: {
TRACE_(dmfile)(": wave sample chunk\n");
memset (&tmpWaveSample, 0, sizeof(WSMPL)); /* reset */
memset (&tmpWaveLoop, 0, sizeof(WLOOP)); /* reset */
if (Chunk.dwSize != (sizeof(WSMPL) + sizeof(WLOOP))) ERR(": incorrect chunk size\n");
IStream_Read (pStm, &tmpWaveSample, sizeof(WSMPL), NULL);
IStream_Read (pStm, &tmpWaveLoop, sizeof(WLOOP), NULL);
break;
}
case FOURCC_WLNK: {
TRACE_(dmfile)(": wave link chunk\n");
memset (&tmpWaveLink, 0, sizeof(WAVELINK)); /* reset */
IStream_Read (pStm, &tmpWaveLink, Chunk.dwSize, NULL);
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[2] = %d < ListSize[2] = %d\n", ListCount[2], ListSize[2]);
} while (ListCount[2] < ListSize[2]);
FIXME(": need to write temporary data to instrument data\n");
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
} while (ListCount[1] < ListSize[1]);
break;
}
case FOURCC_LART: {
TRACE_(dmfile)(": articulators list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case FOURCC_ART1: {
/* temporary structures */
CONNECTIONLIST tmpConnectionList;
LPCONNECTION tmpConnections;
TRACE_(dmfile)(": level 1 articulator chunk\n");
memset (&tmpConnectionList, 0, sizeof(CONNECTIONLIST)); /* reset */
tmpConnections = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(CONNECTION)*tmpConnectionList.cConnections);
if (Chunk.dwSize != (sizeof(CONNECTIONLIST) + sizeof(CONNECTION)*tmpConnectionList.cConnections)) ERR(": incorrect chunk size\n");
IStream_Read (pStm, &tmpConnectionList, sizeof(CONNECTIONLIST), NULL);
IStream_Read (pStm, tmpConnections, sizeof(CONNECTION)*tmpConnectionList.cConnections, NULL);
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
} while (ListCount[1] < ListSize[1]);
break;
}
case mmioFOURCC('I','N','F','O'): {
TRACE_(dmfile)(": INFO list\n");
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
switch (Chunk.fccID) {
case mmioFOURCC('I','N','A','M'): {
TRACE_(dmfile)(": name chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','A','R','T'): {
TRACE_(dmfile)(": artist chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','C','O','P'): {
/* temporary structures */
CHAR tmpCopyright[DMUS_MAX_NAME];
TRACE_(dmfile)(": copyright chunk\n");
IStream_Read (pStm, tmpCopyright, Chunk.dwSize, NULL);
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
liMove.QuadPart = 1;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
}
break;
}
case mmioFOURCC('I','S','B','J'): {
TRACE_(dmfile)(": subject chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
case mmioFOURCC('I','C','M','T'): {
TRACE_(dmfile)(": comment chunk (ignored)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
if (even_or_odd(Chunk.dwSize)) {
ListCount[1] ++;
Chunk.dwSize++;
}
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[1] = %d < ListSize[1] = %d\n", ListCount[1], ListSize[1]);
} while (ListCount[1] < ListSize[1]);
break;
}
default: {
TRACE_(dmfile)(": unknown (skipping)\n");
liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC);
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
TRACE_(dmfile)(": ListCount[0] = %d < ListSize[0] = %d\n", ListCount[0], ListSize[0]);
} while (ListCount[0] < ListSize[0]);
break;
}
default: {
TRACE_(dmfile)(": unknown chunk (irrevelant & skipping)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL);
break;
}
}
break;
}
default: {
TRACE_(dmfile)(": unexpected chunk; loading failed)\n");
liMove.QuadPart = Chunk.dwSize;
IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); /* skip the rest of the chunk */
return E_FAIL;
}
}
/* DEBUG: dumps whole instrument object tree: */
/* if (TRACE_ON(dmusic)) {
TRACE("*** IDirectMusicInstrument (%p) ***\n", This);
if (This->pInstrumentID)
TRACE(" - GUID = %s\n", debugstr_dmguid(This->pInstrumentID));
TRACE(" - Instrument header:\n");
TRACE(" - cRegions: %ld\n", This->pHeader->cRegions);
TRACE(" - Locale:\n");
TRACE(" - ulBank: %ld\n", This->pHeader->Locale.ulBank);
TRACE(" - ulInstrument: %ld\n", This->pHeader->Locale.ulInstrument);
TRACE(" => dwPatch: %ld\n", MIDILOCALE2Patch(&This->pHeader->Locale));
}*/
hr = IStream_Read(stream, data, size, &bytes_read);
if(FAILED(hr)){
TRACE("IStream_Read failed: %08x\n", hr);
return hr;
}
if (bytes_read < size) {
TRACE("Didn't read full chunk: %u < %u\n", bytes_read, size);
return E_FAIL;
}
return S_OK;
return S_OK;
}
static inline DWORD subtract_bytes(DWORD len, DWORD bytes)
{
if(bytes > len){
TRACE("Apparent mismatch in chunk lengths? %u bytes remaining, %u bytes read\n", len, bytes);
return 0;
}
return len - bytes;
}
static inline HRESULT advance_stream(IStream *stream, ULONG bytes)
{
LARGE_INTEGER move;
HRESULT ret;
move.QuadPart = bytes;
ret = IStream_Seek(stream, move, STREAM_SEEK_CUR, NULL);
if (FAILED(ret))
WARN("IStream_Seek failed: %08x\n", ret);
return ret;
}
static HRESULT load_region(IDirectMusicInstrumentImpl *This, IStream *stream, instrument_region *region, ULONG length)
{
HRESULT ret;
DMUS_PRIVATE_CHUNK chunk;
TRACE("(%p, %p, %p, %u)\n", This, stream, region, length);
while (length)
{
ret = read_from_stream(stream, &chunk, sizeof(chunk));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(chunk));
switch (chunk.fccID)
{
case FOURCC_RGNH:
TRACE("RGNH chunk (region header): %u bytes\n", chunk.dwSize);
ret = read_from_stream(stream, &region->header, sizeof(region->header));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(region->header));
break;
case FOURCC_WSMP:
TRACE("WSMP chunk (wave sample): %u bytes\n", chunk.dwSize);
ret = read_from_stream(stream, &region->wave_sample, sizeof(region->wave_sample));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(region->wave_sample));
if (!(region->loop_present = (chunk.dwSize != sizeof(region->wave_sample))))
break;
ret = read_from_stream(stream, &region->wave_loop, sizeof(region->wave_loop));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(region->wave_loop));
break;
case FOURCC_WLNK:
TRACE("WLNK chunk (wave link): %u bytes\n", chunk.dwSize);
ret = read_from_stream(stream, &region->wave_link, sizeof(region->wave_link));
if (FAILED(ret))
return ret;
length = subtract_bytes(length, sizeof(region->wave_link));
break;
default:
TRACE("Unknown chunk %s (skipping): %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
ret = advance_stream(stream, chunk.dwSize);
if (FAILED(ret))
return ret;
length = subtract_bytes(length, chunk.dwSize);
break;
}
}
return S_OK;
}
static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stream, ULONG length)
{
HRESULT ret;
instrument_articulation *articulation;
if (!This->articulations)
This->articulations = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->articulations));
else
This->articulations = HeapReAlloc(GetProcessHeap(), 0, This->articulations, sizeof(*This->articulations) * (This->nb_articulations + 1));
if (!This->articulations)
return E_OUTOFMEMORY;
articulation = &This->articulations[This->nb_articulations];
ret = read_from_stream(stream, &articulation->connections_list, sizeof(CONNECTIONLIST));
if (FAILED(ret))
return ret;
articulation->connections = HeapAlloc(GetProcessHeap(), 0, sizeof(CONNECTION) * articulation->connections_list.cConnections);
if (!articulation->connections)
return E_OUTOFMEMORY;
ret = read_from_stream(stream, articulation->connections, sizeof(CONNECTION) * articulation->connections_list.cConnections);
if (FAILED(ret))
{
HeapFree(GetProcessHeap(), 0, articulation->connections);
return ret;
}
subtract_bytes(length, sizeof(CONNECTIONLIST) + sizeof(CONNECTION) * articulation->connections_list.cConnections);
This->nb_articulations++;
return S_OK;
}
/* Function that loads all instrument data and which is called from IDirectMusicCollection_GetInstrument as in native */
HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream)
{
IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
HRESULT hr;
DMUS_PRIVATE_CHUNK chunk;
ULONG i = 0;
ULONG length = This->length;
TRACE("(%p, %p): offset = 0x%s, length = %u)\n", This, stream, wine_dbgstr_longlong(This->liInstrumentPosition.QuadPart), This->length);
if (This->loaded)
return S_OK;
hr = IStream_Seek(stream, This->liInstrumentPosition, STREAM_SEEK_SET, NULL);
if (FAILED(hr))
{
WARN("IStream_Seek failed: %08x\n", hr);
return DMUS_E_UNSUPPORTED_STREAM;
}
This->regions = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->regions) * This->header.cRegions);
if (!This->regions)
return E_OUTOFMEMORY;
while (length)
{
hr = read_from_stream(stream, &chunk, sizeof(chunk));
if (FAILED(hr))
goto error;
length = subtract_bytes(length, sizeof(chunk) + chunk.dwSize);
switch (chunk.fccID)
{
case FOURCC_INSH:
case FOURCC_DLID:
TRACE("Chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
/* Instrument header and id are already set so just skip */
hr = advance_stream(stream, chunk.dwSize);
if (FAILED(hr))
goto error;
break;
case FOURCC_LIST: {
DWORD size = chunk.dwSize;
TRACE("LIST chunk: %u bytes\n", chunk.dwSize);
hr = read_from_stream(stream, &chunk.fccID, sizeof(chunk.fccID));
if (FAILED(hr))
goto error;
size = subtract_bytes(size, sizeof(chunk.fccID));
switch (chunk.fccID)
{
case FOURCC_LRGN:
TRACE("LRGN chunk (regions list): %u bytes\n", size);
while (size)
{
hr = read_from_stream(stream, &chunk, sizeof(chunk));
if (FAILED(hr))
goto error;
if (chunk.fccID != FOURCC_LIST)
{
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
goto error;
}
hr = read_from_stream(stream, &chunk.fccID, sizeof(chunk.fccID));
if (FAILED(hr))
goto error;
if (chunk.fccID == FOURCC_RGN)
{
TRACE("RGN chunk (region): %u bytes\n", chunk.dwSize);
hr = load_region(This, stream, &This->regions[i++], chunk.dwSize - sizeof(chunk.fccID));
}
else
{
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
hr = advance_stream(stream, chunk.dwSize - sizeof(chunk.fccID));
}
if (FAILED(hr))
goto error;
size = subtract_bytes(size, chunk.dwSize + sizeof(chunk));
}
break;
case FOURCC_LART:
TRACE("LART chunk (articulations list): %u bytes\n", size);
while (size)
{
hr = read_from_stream(stream, &chunk, sizeof(chunk));
if (FAILED(hr))
goto error;
if (chunk.fccID == FOURCC_ART1)
{
TRACE("ART1 chunk (level 1 articulation): %u bytes\n", chunk.dwSize);
hr = load_articulation(This, stream, chunk.dwSize);
}
else
{
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
hr = advance_stream(stream, chunk.dwSize);
}
if (FAILED(hr))
goto error;
size = subtract_bytes(size, chunk.dwSize + sizeof(chunk));
}
break;
default:
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
hr = advance_stream(stream, chunk.dwSize - sizeof(chunk.fccID));
if (FAILED(hr))
goto error;
size = subtract_bytes(size, chunk.dwSize - sizeof(chunk.fccID));
break;
}
break;
}
default:
TRACE("Unknown chunk %s: %u bytes\n", debugstr_fourcc(chunk.fccID), chunk.dwSize);
hr = advance_stream(stream, chunk.dwSize);
if (FAILED(hr))
goto error;
break;
}
}
This->loaded = TRUE;
return S_OK;
error:
HeapFree(GetProcessHeap(), 0, This->regions);
This->regions = NULL;
return DMUS_E_UNSUPPORTED_STREAM;
}
+638 -266
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -16,12 +16,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_OLESELFREGISTER
1 WINE_REGISTRY dmusic.rgs
#define WINE_FILEDESCRIPTION_STR "Wine DirectMusic"
#define WINE_FILENAME_STR "dmusic.dll"
#define WINE_FILEVERSION 5,3,1,904
#define WINE_FILEVERSION_STR "5.3.1.904"
#define WINE_PRODUCTVERSION 5,3,1,904
#define WINE_PRODUCTVERSION_STR "5.3.1.904"
#define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
#include "wine/wine_common_ver.rc"
#include <wine/wine_common_ver.rc>
+1 -19
View File
@@ -1,5 +1,4 @@
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(dplay.dll dplay.spec)
@@ -10,23 +9,6 @@ add_library(dplay SHARED
${CMAKE_CURRENT_BINARY_DIR}/dplay.def)
set_module_type(dplay win32dll UNICODE)
target_link_libraries(dplay
uuid
wine)
add_importlibs(dplay
msvcrt
user32
advapi32
ole32
winmm
dinput
dplayx
kernel32
ntdll)
add_importlibs(dplay dplayx msvcrt kernel32 ntdll)
add_dependencies(dplay psdk)
add_cd_file(TARGET dplay DESTINATION reactos/system32 FOR all)
+3 -3
View File
@@ -13,15 +13,15 @@
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_OLESELFREGISTER
#define WINE_FILEDESCRIPTION_STR "Wine DirectPlay"
#define WINE_FILENAME_STR "dplay.dll"
#define WINE_FILEVERSION 5,3,0,900
#define WINE_FILEVERSION_STR "5.3.0.900"
#define WINE_PRODUCTVERSION 5,3,0,900
#define WINE_PRODUCTVERSION_STR "5.3"
#define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
#include "wine/wine_common_ver.rc"
#include <wine/wine_common_ver.rc>
+9 -16
View File
@@ -1,4 +1,10 @@
add_definitions(
-DCOM_NO_WINDOWS_H
-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(dplayx.dll dplayx.spec ADD_IMPORTLIB)
list(APPEND SOURCE
@@ -11,23 +17,10 @@ list(APPEND SOURCE
dplobby.c
lobbysp.c
name_server.c
regsvr.c
version.rc
${CMAKE_CURRENT_BINARY_DIR}/dplayx.def)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
add_library(dplayx SHARED ${SOURCE})
add_library(dplayx SHARED ${SOURCE} version.rc)
set_module_type(dplayx win32dll)
target_link_libraries(dplayx wine uuid dxguid)
add_importlibs(dplayx
advapi32
ole32
user32
winmm
msvcrt
kernel32
ntdll)
target_link_libraries(dplayx dxguid uuid wine)
add_importlibs(dplayx winmm ole32 user32 advapi32 msvcrt kernel32 ntdll)
add_cd_file(TARGET dplayx DESTINATION reactos/system32 FOR all)
+20 -12
View File
@@ -14,7 +14,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
//#include <stdarg.h>
@@ -27,6 +27,9 @@
//#include "objbase.h"
//#include "winerror.h"
#include <wine/debug.h>
//#include "dplay.h"
//#include "dplobby.h"
//#include "initguid.h"
#include "dpinit.h"
WINE_DEFAULT_DEBUG_CHANNEL(dplay);
@@ -39,13 +42,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(dplay);
typedef struct
{
/* IUnknown fields */
const IClassFactoryVtbl *lpVtbl;
LONG ref;
IClassFactory IClassFactory_iface;
LONG ref;
} IClassFactoryImpl;
static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
{
return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
}
static HRESULT WINAPI
DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
@@ -54,12 +62,12 @@ DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
static ULONG WINAPI
DP_and_DPL_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
/* static class (reference starts @ 1), won't ever be freed */
return InterlockedDecrement(&This->ref);
}
@@ -67,7 +75,7 @@ static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) {
static HRESULT WINAPI DP_and_DPL_CreateInstance(
LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
@@ -84,7 +92,7 @@ static HRESULT WINAPI DP_and_DPL_CreateInstance(
}
static HRESULT WINAPI DP_and_DPL_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
IClassFactoryImpl *This = impl_from_IClassFactory(iface);
FIXME("(%p)->(%d),stub!\n",This,dolock);
return S_OK;
}
@@ -97,7 +105,7 @@ static const IClassFactoryVtbl DP_and_DPL_Vtbl = {
DP_and_DPL_LockServer
};
static IClassFactoryImpl DP_and_DPL_CF = {&DP_and_DPL_Vtbl, 1 };
static IClassFactoryImpl DP_and_DPL_CF = {{&DP_and_DPL_Vtbl}, 1 };
/*******************************************************************************
@@ -119,16 +127,16 @@ static IClassFactoryImpl DP_and_DPL_CF = {&DP_and_DPL_Vtbl, 1 };
*/
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
if ( IsEqualCLSID( riid, &IID_IClassFactory ) )
{
*ppv = (LPVOID)&DP_and_DPL_CF;
*ppv = &DP_and_DPL_CF;
IClassFactory_AddRef( (IClassFactory*)*ppv );
return S_OK;
}
ERR("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
ERR("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return CLASS_E_CLASSNOTAVAILABLE;
}
+5 -5
View File
@@ -13,7 +13,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DPINIT_H
@@ -26,12 +26,12 @@
//#include "wtypes.h"
#include "dplay_global.h"
extern HRESULT DP_CreateInterface( REFIID riid, LPVOID* ppvObj );
extern HRESULT DPL_CreateInterface( REFIID riid, LPVOID* ppvObj );
extern HRESULT DP_CreateInterface( REFIID riid, LPVOID* ppvObj ) DECLSPEC_HIDDEN;
extern HRESULT DPL_CreateInterface( REFIID riid, LPVOID* ppvObj ) DECLSPEC_HIDDEN;
extern HRESULT DPSP_CreateInterface( REFIID riid, LPVOID* ppvObj,
IDirectPlay2Impl* dp );
IDirectPlay2Impl* dp ) DECLSPEC_HIDDEN;
extern HRESULT DPLSP_CreateInterface( REFIID riid, LPVOID* ppvObj,
IDirectPlay2Impl* dp );
IDirectPlay2Impl* dp ) DECLSPEC_HIDDEN;
#endif
+421 -375
View File
File diff suppressed because it is too large Load Diff
+12 -10
View File
@@ -13,12 +13,15 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DPLAY_GLOBAL_INCLUDED
#define __WINE_DPLAY_GLOBAL_INCLUDED
#define WIN32_NO_STATUS
#define _INC_WINDOWS
//#include <stdarg.h>
//#include "windef.h"
@@ -29,9 +32,7 @@
extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback,
LPCVOID lpAddress, DWORD dwAddressSize,
LPVOID lpContext );
extern DWORD DP_CalcSessionDescSize( LPCDPSESSIONDESC2 lpSessDesc, BOOL bAnsi );
LPVOID lpContext ) DECLSPEC_HIDDEN;
/*****************************************************************************
* Predeclare the interface implementation structures
@@ -69,7 +70,7 @@ typedef struct tagDP_MSG_REPLY_STRUCT
typedef struct tagDP_MSG_REPLY_STRUCT_LIST
{
DPQ_ENTRY(tagDP_MSG_REPLY_STRUCT_LIST) replysExpected;
DPQ_ENTRY(tagDP_MSG_REPLY_STRUCT_LIST) repliesExpected;
DP_MSG_REPLY_STRUCT replyExpected;
} DP_MSG_REPLY_STRUCT_LIST, *LPDP_MSG_REPLY_STRUCT_LIST;
@@ -164,6 +165,7 @@ typedef struct tagDirectPlay2Data
/* For async EnumSessions requests */
HANDLE hEnumSessionThread;
HANDLE hKillEnumSessionThreadEvent;
DWORD dwEnumSessionLock;
LPVOID lpNameServerData; /* DPlay interface doesn't know contents */
@@ -194,7 +196,7 @@ typedef struct tagDirectPlay2Data
enum SPSTATE connectionInitialized;
/* Expected messages queue */
DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST ) replysExpected;
DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST ) repliesExpected;
} DirectPlay2Data;
typedef struct tagDirectPlay3Data
@@ -234,13 +236,13 @@ struct IDirectPlay4Impl
HRESULT DP_HandleMessage( IDirectPlay2Impl* This, LPCVOID lpMessageBody,
DWORD dwMessageBodySize, LPCVOID lpMessageHeader,
WORD wCommandId, WORD wVersion,
LPVOID* lplpReply, LPDWORD lpdwMsgSize );
LPVOID* lplpReply, LPDWORD lpdwMsgSize ) DECLSPEC_HIDDEN;
/* DP SP external interfaces into DirectPlay */
extern HRESULT DP_GetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID* lplpData );
extern HRESULT DP_SetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID lpData );
extern HRESULT DP_GetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID* lplpData ) DECLSPEC_HIDDEN;
extern HRESULT DP_SetSPPlayerData( IDirectPlay2Impl* lpDP, DPID idPlayer, LPVOID lpData ) DECLSPEC_HIDDEN;
/* DP external interfaces to call into DPSP interface */
extern LPVOID DPSP_CreateSPPlayerData(void);
extern LPVOID DPSP_CreateSPPlayerData(void) DECLSPEC_HIDDEN;
#endif /* __WINE_DPLAY_GLOBAL_INCLUDED */
+46 -45
View File
@@ -15,7 +15,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
//#include <string.h>
@@ -86,7 +86,6 @@ typedef struct tagDP_SPPLAYERDATA
} DP_SPPLAYERDATA, *LPDP_SPPLAYERDATA;
/* Create the SP interface */
extern
HRESULT DPSP_CreateInterface( REFIID riid, LPVOID* ppvObj, IDirectPlay2Impl* dp )
{
TRACE( " for %s\n", debugstr_guid( riid ) );
@@ -101,7 +100,7 @@ HRESULT DPSP_CreateInterface( REFIID riid, LPVOID* ppvObj, IDirectPlay2Impl* dp
if( IsEqualGUID( &IID_IDirectPlaySP, riid ) )
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)*ppvObj;
IDirectPlaySPImpl *This = *ppvObj;
This->lpVtbl = &directPlaySPVT;
}
else
@@ -134,7 +133,7 @@ HRESULT DPSP_CreateInterface( REFIID riid, LPVOID* ppvObj, IDirectPlay2Impl* dp
static BOOL DPSP_CreateIUnknown( LPVOID lpSP )
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)lpSP;
IDirectPlaySPImpl *This = lpSP;
This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) );
@@ -144,14 +143,16 @@ static BOOL DPSP_CreateIUnknown( LPVOID lpSP )
}
InitializeCriticalSection( &This->unk->DPSP_lock );
This->unk->DPSP_lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectPlaySPImpl*->DirectPlaySPIUnknownData*->DPSP_lock");
return TRUE;
}
static BOOL DPSP_DestroyIUnknown( LPVOID lpSP )
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)lpSP;
IDirectPlaySPImpl *This = lpSP;
This->unk->DPSP_lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &This->unk->DPSP_lock );
HeapFree( GetProcessHeap(), 0, This->unk );
@@ -161,7 +162,7 @@ static BOOL DPSP_DestroyIUnknown( LPVOID lpSP )
static BOOL DPSP_CreateDirectPlaySP( LPVOID lpSP, IDirectPlay2Impl* dp )
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)lpSP;
IDirectPlaySPImpl *This = lpSP;
This->sp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->sp) ) );
@@ -192,7 +193,7 @@ static BOOL DPSP_CreateDirectPlaySP( LPVOID lpSP, IDirectPlay2Impl* dp )
static BOOL DPSP_DestroyDirectPlaySP( LPVOID lpSP )
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)lpSP;
IDirectPlaySPImpl *This = lpSP;
/* Normally we should be keeping a reference, but since only the dplay
* interface that created us can destroy us, we do not keep a reference
@@ -234,7 +235,7 @@ static HRESULT WINAPI DPSP_QueryInterface
if( IsEqualGUID( &IID_IDirectPlaySP, riid ) )
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)*ppvObj;
IDirectPlaySPImpl *This = *ppvObj;
This->lpVtbl = &directPlaySPVT;
}
else
@@ -260,7 +261,7 @@ static ULONG WINAPI DPSP_AddRef
ulObjRefCount = InterlockedIncrement( &This->unk->ulObjRef );
ulInterfaceRefCount = InterlockedIncrement( &This->ulInterfaceRef );
TRACE( "ref count incremented to %lu:%lu for %p\n",
TRACE( "ref count incremented to %u:%u for %p\n",
ulInterfaceRefCount, ulObjRefCount, This );
return ulObjRefCount;
@@ -275,7 +276,7 @@ static ULONG WINAPI DPSP_Release
ulObjRefCount = InterlockedDecrement( &This->unk->ulObjRef );
ulInterfaceRefCount = InterlockedDecrement( &This->ulInterfaceRef );
TRACE( "ref count decremented to %lu:%lu for %p\n",
TRACE( "ref count decremented to %u:%u for %p\n",
ulInterfaceRefCount, ulObjRefCount, This );
/* Deallocate if this is the last reference to the object */
@@ -306,7 +307,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_AddMRUEntry
/* Should be able to call the comctl32 undocumented MRU routines.
I suspect that the interface works appropriately */
FIXME( "(%p)->(%p,%p%p,0x%08lx,0x%08lx): stub\n",
FIXME( "(%p)->(%p,%p%p,0x%08x,0x%08x): stub\n",
This, lpSection, lpKey, lpData, dwDataSize, dwMaxEntries );
return DP_OK;
@@ -324,7 +325,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_CreateAddress
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
FIXME( "(%p)->(%s,%s,%p,0x%08lx,%p,%p): stub\n",
FIXME( "(%p)->(%s,%s,%p,0x%08x,%p,%p): stub\n",
This, debugstr_guid(guidSP), debugstr_guid(guidDataType),
lpData, dwDataSize, lpAddress, lpdwAddressSize );
@@ -341,7 +342,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_EnumAddress
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
TRACE( "(%p)->(%p,%p,0x%08lx,%p)\n",
TRACE( "(%p)->(%p,%p,0x%08x,%p)\n",
This, lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
@@ -375,7 +376,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_GetPlayerFlags
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
FIXME( "(%p)->(0x%08lx,%p): stub\n",
FIXME( "(%p)->(0x%08x,%p): stub\n",
This, idPlayer, lpdwPlayerFlags );
return DP_OK;
@@ -393,7 +394,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_GetSPPlayerData
LPDP_SPPLAYERDATA lpPlayerData;
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
TRACE( "(%p)->(0x%08lx,%p,%p,0x%08lx)\n",
TRACE( "(%p)->(0x%08x,%p,%p,0x%08x)\n",
This, idPlayer, lplpData, lpdwDataSize, dwFlags );
hr = DP_GetSPPlayerData( This->sp->dplay, idPlayer, (LPVOID*)&lpPlayerData );
@@ -433,7 +434,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
LPVOID lpMessageHeader
)
{
LPDPMSG_SENDENVELOPE lpMsg = (LPDPMSG_SENDENVELOPE)lpMessageBody;
LPDPMSG_SENDENVELOPE lpMsg = lpMessageBody;
HRESULT hr = DPERR_GENERIC;
WORD wCommandId;
WORD wVersion;
@@ -441,24 +442,24 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
FIXME( "(%p)->(%p,0x%08lx,%p): mostly stub\n",
FIXME( "(%p)->(%p,0x%08x,%p): mostly stub\n",
This, lpMessageBody, dwMessageBodySize, lpMessageHeader );
wCommandId = lpMsg->wCommandId;
wVersion = lpMsg->wVersion;
TRACE( "Incoming message has envelope of 0x%08lx, %u, %u\n",
TRACE( "Incoming message has envelope of 0x%08x, %u, %u\n",
lpMsg->dwMagic, wCommandId, wVersion );
if( lpMsg->dwMagic != DPMSGMAGIC_DPLAYMSG )
{
ERR( "Unknown magic 0x%08lx!\n", lpMsg->dwMagic );
ERR( "Unknown magic 0x%08x!\n", lpMsg->dwMagic );
return DPERR_GENERIC;
}
#if 0
{
const LPDWORD lpcHeader = (LPDWORD)lpMessageHeader;
const LPDWORD lpcHeader = lpMessageHeader;
TRACE( "lpMessageHeader = [0x%08lx] [0x%08lx] [0x%08lx] [0x%08lx] [0x%08lx]\n",
lpcHeader[0], lpcHeader[1], lpcHeader[2], lpcHeader[3], lpcHeader[4] );
@@ -499,7 +500,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
#if 0
HRESULT hr = DP_OK;
HANDLE hReceiveEvent = 0;
/* FIXME: Aquire some sort of interface lock */
/* FIXME: Acquire some sort of interface lock */
/* FIXME: Need some sort of context for this callback. Need to determine
* how this is actually done with the SP
*/
@@ -508,7 +509,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
{
case DPSYS_CREATEPLAYERORGROUP:
{
LPDPMSG_CREATEPLAYERORGROUP msg = (LPDPMSG_CREATEPLAYERORGROUP)lpMsg;
LPDPMSG_CREATEPLAYERORGROUP msg = lpMsg;
if( msg->dwPlayerType == DPPLAYERTYPE_PLAYER )
{
@@ -543,7 +544,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_DESTROYPLAYERORGROUP:
{
LPDPMSG_DESTROYPLAYERORGROUP msg = (LPDPMSG_DESTROYPLAYERORGROUP)lpMsg;
LPDPMSG_DESTROYPLAYERORGROUP msg = lpMsg;
if( msg->dwPlayerType == DPPLAYERTYPE_PLAYER )
{
@@ -564,7 +565,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_ADDPLAYERTOGROUP:
{
LPDPMSG_ADDPLAYERTOGROUP msg = (LPDPMSG_ADDPLAYERTOGROUP)lpMsg;
LPDPMSG_ADDPLAYERTOGROUP msg = lpMsg;
hr = DP_IF_AddPlayerToGroup( This, msg->dpIdGroup, msg->dpIdPlayer, ... );
break;
@@ -572,7 +573,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_DELETEPLAYERFROMGROUP:
{
LPDPMSG_DELETEPLAYERFROMGROUP msg = (LPDPMSG_DELETEPLAYERFROMGROUP)lpMsg;
LPDPMSG_DELETEPLAYERFROMGROUP msg = lpMsg;
hr = DP_IF_DeletePlayerFromGroup( This, msg->dpIdGroup, msg->dpIdPlayer,
... );
@@ -582,7 +583,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_SESSIONLOST:
{
LPDPMSG_SESSIONLOST msg = (LPDPMSG_SESSIONLOST)lpMsg;
LPDPMSG_SESSIONLOST msg = lpMsg;
FIXME( "DPSYS_SESSIONLOST not handled\n" );
@@ -591,7 +592,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_HOST:
{
LPDPMSG_HOST msg = (LPDPMSG_HOST)lpMsg;
LPDPMSG_HOST msg = lpMsg;
FIXME( "DPSYS_HOST not handled\n" );
@@ -600,7 +601,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_SETPLAYERORGROUPDATA:
{
LPDPMSG_SETPLAYERORGROUPDATA msg = (LPDPMSG_SETPLAYERORGROUPDATA)lpMsg;
LPDPMSG_SETPLAYERORGROUPDATA msg = lpMsg;
if( msg->dwPlayerType == DPPLAYERTYPE_PLAYER )
{
@@ -622,7 +623,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_SETPLAYERORGROUPNAME:
{
LPDPMSG_SETPLAYERORGROUPNAME msg = (LPDPMSG_SETPLAYERORGROUPNAME)lpMsg;
LPDPMSG_SETPLAYERORGROUPNAME msg = lpMsg;
if( msg->dwPlayerType == DPPLAYERTYPE_PLAYER )
{
@@ -643,7 +644,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_SETSESSIONDESC;
{
LPDPMSG_SETSESSIONDESC msg = (LPDPMSG_SETSESSIONDESC)lpMsg;
LPDPMSG_SETSESSIONDESC msg = lpMsg;
hr = DP_IF_SetSessionDesc( This, &msg->dpDesc );
@@ -652,7 +653,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_ADDGROUPTOGROUP:
{
LPDPMSG_ADDGROUPTOGROUP msg = (LPDPMSG_ADDGROUPTOGROUP)lpMsg;
LPDPMSG_ADDGROUPTOGROUP msg = lpMsg;
hr = DP_IF_AddGroupToGroup( This, msg->dpIdParentGroup, msg->dpIdGroup,
... );
@@ -662,7 +663,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_DELETEGROUPFROMGROUP:
{
LPDPMSG_DELETEGROUPFROMGROUP msg = (LPDPMSG_DELETEGROUPFROMGROUP)lpMsg;
LPDPMSG_DELETEGROUPFROMGROUP msg = lpMsg;
hr = DP_IF_DeleteGroupFromGroup( This, msg->dpIdParentGroup,
msg->dpIdGroup, ... );
@@ -672,7 +673,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_SECUREMESSAGE:
{
LPDPMSG_SECUREMESSAGE msg = (LPDPMSG_SECUREMESSAGE)lpMsg;
LPDPMSG_SECUREMESSAGE msg = lpMsg;
FIXME( "DPSYS_SECUREMESSAGE not implemented\n" );
@@ -681,7 +682,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_STARTSESSION:
{
LPDPMSG_STARTSESSION msg = (LPDPMSG_STARTSESSION)lpMsg;
LPDPMSG_STARTSESSION msg = lpMsg;
FIXME( "DPSYS_STARTSESSION not implemented\n" );
@@ -690,7 +691,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_CHAT:
{
LPDPMSG_CHAT msg = (LPDPMSG_CHAT)lpMsg;
LPDPMSG_CHAT msg = lpMsg;
FIXME( "DPSYS_CHAT not implemeneted\n" );
@@ -699,7 +700,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_SETGROUPOWNER:
{
LPDPMSG_SETGROUPOWNER msg = (LPDPMSG_SETGROUPOWNER)lpMsg;
LPDPMSG_SETGROUPOWNER msg = lpMsg;
FIXME( "DPSYS_SETGROUPOWNER not implemented\n" );
@@ -708,7 +709,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_HandleMessage
case DPSYS_SENDCOMPLETE:
{
LPDPMSG_SENDCOMPLETE msg = (LPDPMSG_SENDCOMPLETE)lpMsg;
LPDPMSG_SENDCOMPLETE msg = lpMsg;
FIXME( "DPSYS_SENDCOMPLETE not implemented\n" );
@@ -755,7 +756,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPPlayerData
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
/* TRACE( "Called on process 0x%08lx\n", GetCurrentProcessId() ); */
TRACE( "(%p)->(0x%08lx,%p,0x%08lx,0x%08lx)\n",
TRACE( "(%p)->(0x%08x,%p,0x%08x,0x%08x)\n",
This, idPlayer, lpData, dwDataSize, dwFlags );
hr = DP_GetSPPlayerData( This->sp->dplay, idPlayer, (LPVOID*)&lpPlayerEntry );
@@ -794,7 +795,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_CreateCompoundAddress
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
FIXME( "(%p)->(%p,0x%08lx,%p,%p): stub\n",
FIXME( "(%p)->(%p,0x%08x,%p,%p): stub\n",
This, lpElements, dwElementCount, lpAddress, lpdwAddressSize );
return DP_OK;
@@ -811,7 +812,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_GetSPData
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
/* TRACE( "Called on process 0x%08lx\n", GetCurrentProcessId() ); */
TRACE( "(%p)->(%p,%p,0x%08lx)\n",
TRACE( "(%p)->(%p,%p,0x%08x)\n",
This, lplpData, lpdwDataSize, dwFlags );
#if 0
@@ -827,7 +828,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_GetSPData
*/
if( dwFlags != DPSET_REMOTE )
{
TRACE( "Undocumented dwFlags 0x%08lx used\n", dwFlags );
TRACE( "Undocumented dwFlags 0x%08x used\n", dwFlags );
}
#endif
@@ -870,7 +871,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPData
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
/* TRACE( "Called on process 0x%08lx\n", GetCurrentProcessId() ); */
TRACE( "(%p)->(%p,0x%08lx,0x%08lx)\n",
TRACE( "(%p)->(%p,0x%08x,0x%08x)\n",
This, lpData, dwDataSize, dwFlags );
#if 0
@@ -886,7 +887,7 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPData
*/
if( dwFlags != DPSET_REMOTE )
{
TRACE( "Undocumented dwFlags 0x%08lx used\n", dwFlags );
TRACE( "Undocumented dwFlags 0x%08x used\n", dwFlags );
}
#endif
@@ -918,7 +919,7 @@ static VOID WINAPI IDirectPlaySPImpl_SendComplete
{
IDirectPlaySPImpl *This = (IDirectPlaySPImpl *)iface;
FIXME( "(%p)->(%p,0x%08lx): stub\n",
FIXME( "(%p)->(%p,0x%08x): stub\n",
This, unknownA, unknownB );
}
@@ -947,7 +948,7 @@ static const IDirectPlaySPVtbl directPlaySPVT =
/* DP external interfaces to call into DPSP interface */
/* Allocate the structure */
extern LPVOID DPSP_CreateSPPlayerData(void)
LPVOID DPSP_CreateSPPlayerData(void)
{
TRACE( "Creating SPPlayer data struct\n" );
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
@@ -1,8 +1,7 @@
/*
* Version information for hhctrl.ocx
* COM Classes for dplayx
*
* Copyright 2004 Hans Leidekker
* Copyright 2004 Tom Wickline
* Copyright 2010 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,11 +18,16 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_FILEDESCRIPTION_STR "Wine htmlhelp OCX"
#define WINE_FILENAME_STR "hhctrl.ocx"
#define WINE_FILEVERSION 5,2,3790,2744
#define WINE_FILEVERSION_STR "5.2.3790.2744"
#define WINE_PRODUCTVERSION 5,2,3790,2744
#define WINE_PRODUCTVERSION_STR "5.2.3790.2744"
[
helpstring("DirectPlay Object"),
threading(both),
uuid(d1eb6d20-8923-11d0-9d97-00a0c90a43cb)
]
coclass DirectPlay { interface IDirectPlay; }
#include <wine/wine_common_ver.rc>
[
helpstring("DirectPlayLobby Object"),
threading(both),
uuid(2fe8f810-b2a5-11d0-a787-0000f803abfc)
]
coclass DirectPlayLobby { interface IDirectPlayLobby; }
+17
View File
@@ -0,0 +1,17 @@
HKCR
{
NoRemove Interface
{
}
NoRemove CLSID
{
'{D1EB6D20-8923-11D0-9D97-00A0C90A43CB}' = s 'DirectPlay Object'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
}
'{2FE8F810-B2A5-11D0-A787-0000F803ABFC}' = s 'DirectPlayLobby Object'
{
InprocServer32 = s '%MODULE%' { val ThreadingModel = s 'Both' }
}
}
}
File diff suppressed because it is too large Load Diff
+13 -30
View File
@@ -13,7 +13,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DPLAYX_GLOBAL
@@ -21,7 +21,6 @@
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#include <stdarg.h>
@@ -30,51 +29,35 @@
//#include "winuser.h"
#include <dplay.h>
BOOL DPLAYX_ConstructData(void);
BOOL DPLAYX_DestructData(void);
BOOL DPLAYX_ConstructData(void) DECLSPEC_HIDDEN;
BOOL DPLAYX_DestructData(void) DECLSPEC_HIDDEN;
HRESULT DPLAYX_GetConnectionSettingsA ( DWORD dwAppID,
LPVOID lpData,
LPDWORD lpdwDataSize );
LPDWORD lpdwDataSize ) DECLSPEC_HIDDEN;
HRESULT DPLAYX_GetConnectionSettingsW ( DWORD dwAppID,
LPVOID lpData,
LPDWORD lpdwDataSize );
LPDWORD lpdwDataSize ) DECLSPEC_HIDDEN;
HRESULT DPLAYX_SetConnectionSettingsA ( DWORD dwFlags,
DWORD dwAppID,
LPDPLCONNECTION lpConn );
const DPLCONNECTION *lpConn ) DECLSPEC_HIDDEN;
HRESULT DPLAYX_SetConnectionSettingsW ( DWORD dwFlags,
DWORD dwAppID,
LPDPLCONNECTION lpConn );
const DPLCONNECTION *lpConn ) DECLSPEC_HIDDEN;
BOOL DPLAYX_CreateLobbyApplication( DWORD dwAppID );
BOOL DPLAYX_DestroyLobbyApplication( DWORD dwAppID );
BOOL DPLAYX_CreateLobbyApplication( DWORD dwAppID ) DECLSPEC_HIDDEN;
BOOL DPLAYX_WaitForConnectionSettings( BOOL bWait );
BOOL DPLAYX_AnyLobbiesWaitingForConnSettings(void);
BOOL DPLAYX_WaitForConnectionSettings( BOOL bWait ) DECLSPEC_HIDDEN;
BOOL DPLAYX_AnyLobbiesWaitingForConnSettings(void) DECLSPEC_HIDDEN;
BOOL DPLAYX_SetLobbyHandles( DWORD dwAppID,
HANDLE hStart, HANDLE hDeath, HANDLE hConnRead );
BOOL DPLAYX_GetThisLobbyHandles( LPHANDLE lphStart,
LPHANDLE lphDeath,
LPHANDLE lphConnRead, BOOL bClearSetHandles );
HANDLE hStart, HANDLE hDeath, HANDLE hConnRead ) DECLSPEC_HIDDEN;
LPDPSESSIONDESC2 DPLAYX_CopyAndAllocateLocalSession( UINT* index );
BOOL DPLAYX_CopyLocalSession( UINT* index, LPDPSESSIONDESC2 lpsd );
void DPLAYX_SetLocalSession( LPCDPSESSIONDESC2 lpsd );
BOOL DPLAYX_SetLobbyMsgThreadId( DWORD dwAppId, DWORD dwThreadId );
/* FIXME: This should not be here */
LPVOID DPLAYX_PrivHeapAlloc( DWORD flags, DWORD size );
void DPLAYX_PrivHeapFree( LPVOID addr );
LPSTR DPLAYX_strdupA( DWORD flags, LPCSTR str );
LPWSTR DPLAYX_strdupW( DWORD flags, LPCWSTR str );
/* FIXME: End shared data alloc which should be local */
BOOL DPLAYX_SetLobbyMsgThreadId( DWORD dwAppId, DWORD dwThreadId ) DECLSPEC_HIDDEN;
/* Convert a DP or DPL HRESULT code into a string for human consumption */
LPCSTR DPLAYX_HresultToString( HRESULT hr );
LPCSTR DPLAYX_HresultToString( HRESULT hr ) DECLSPEC_HIDDEN;
#endif /* __WINE_DPLAYX_GLOBAL */
+42 -17
View File
@@ -16,21 +16,21 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
* o DPMSGCMD_ENUMSESSIONSREPLY & DPMSGCMD_ENUMSESSIONSREQUEST
* Have most fields understood, but not all. Everything seems to work.
* o DPMSGCMD_REQUESTNEWPLAYERID & DPMSGCMD_NEWPLAYERIDREPLY
* Barely work. This needs to be completed for sessions to start.
* Barely works. This needs to be completed for sessions to start.
* o A small issue will be the fact that DirectX 6.1(ie. DirectPlay4)
* introduces a layer of functionality inside the DP objects which
* introduces a layer of functionality inside the DP objects which
* provide guaranteed protocol delivery. This is even if the native
* protocol, IPX or modem for instance, doesn't guarantee it. I'm going
* to leave this kind of implementation to as close to the end as
* possible. However, I will implement an abstraction layer, where
* possible, for this functionality. It will do nothing to start, but
* will require only the implementation of the guaranteness to give
* to leave this kind of implementation to as close to the end as
* possible. However, I will implement an abstraction layer, where
* possible, for this functionality. It will do nothing to start, but
* will require only the implementation of the guarantee to give
* final implementation.
*
* TODO:
@@ -41,31 +41,39 @@
* - Change RegEnumKeyEx enumeration pattern to allow error handling and to
* share registry implementation (or at least simplify).
* - Add in appropriate RegCloseKey calls for all the opening we're doing...
* - Fix all the buffer sizes for registry calls. They're off by one -
* - Fix all the buffer sizes for registry calls. They're off by one -
* but in a safe direction.
* - Fix race condition on interface destruction
* - Handles need to be correctly reference counted
* - Check if we need to deallocate any list objects when destroying
* - Check if we need to deallocate any list objects when destroying
* a dplay interface
* - RunApplication process spawning needs to have correct syncronization.
* - RunApplication process spawning needs to have correct synchronization.
* - Need to get inter lobby messages working.
* - Decypher dplay messages between applications and implement...
* - Decipher dplay messages between applications and implement...
* - Need to implement lobby session spawning.
* - Improve footprint and realtime blocking by setting up a separate data share
* between lobby application and client since there can be multiple apps per
* client. Also get rid of offset dependency by making data offset independent
* somehow.
*/
//#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#include <stdarg.h>
//#include "winerror.h"
//#include "windef.h"
//#include "winbase.h"
#include <windef.h>
#include <winbase.h>
#include <objbase.h>
#include <rpcproxy.h>
#include <wine/debug.h>
#include "dplayx_global.h"
WINE_DEFAULT_DEBUG_CHANNEL(dplay);
static HINSTANCE instance;
/* This is a globally exported variable at ordinal 6 of DPLAYX.DLL */
DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */
@@ -73,11 +81,12 @@ DWORD gdwDPlaySPRefCount = 0; /* FIXME: Should it be initialized here? */
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
TRACE( "(%p,%ld,%p)\n", hinstDLL, fdwReason, lpvReserved );
TRACE( "(%p,%d,%p)\n", hinstDLL, fdwReason, lpvReserved );
switch ( fdwReason )
{
case DLL_PROCESS_ATTACH:
instance = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
/* First instance perform construction of global processor data */
return DPLAYX_ConstructData();
@@ -102,10 +111,26 @@ HRESULT WINAPI DllCanUnloadNow(void)
HRESULT hr = ( gdwDPlaySPRefCount > 0 ) ? S_FALSE : S_OK;
/* FIXME: Should I be putting a check in for class factory objects
* as well
* as well?
*/
TRACE( ": returning 0x%08lx\n", hr );
TRACE( ": returning 0x%08x\n", hr );
return hr;
}
/***********************************************************************
* DllRegisterServer (DPLAYX.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( instance );
}
/***********************************************************************
* DllUnregisterServer (DPLAYX.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( instance );
}
+20 -24
View File
@@ -14,7 +14,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
* o Messaging interface required for both DirectPlay and DirectPlayLobby.
@@ -110,7 +110,7 @@ error:
static DWORD CALLBACK DPL_MSG_ThreadMain( LPVOID lpContext )
{
LPMSGTHREADINFO lpThreadInfo = (LPMSGTHREADINFO)lpContext;
LPMSGTHREADINFO lpThreadInfo = lpContext;
DWORD dwWaitResult;
TRACE( "Msg thread created. Waiting on app startup\n" );
@@ -119,7 +119,7 @@ static DWORD CALLBACK DPL_MSG_ThreadMain( LPVOID lpContext )
dwWaitResult = WaitForSingleObject( lpThreadInfo->hStart, 10000 /* 10 sec */ );
if( dwWaitResult == WAIT_TIMEOUT )
{
FIXME( "Should signal app/wait creation failure (0x%08lx)\n", dwWaitResult );
FIXME( "Should signal app/wait creation failure (0x%08x)\n", dwWaitResult );
goto end_of_thread;
}
@@ -131,14 +131,14 @@ static DWORD CALLBACK DPL_MSG_ThreadMain( LPVOID lpContext )
dwWaitResult = WaitForSingleObject( lpThreadInfo->hSettingRead, INFINITE );
if( dwWaitResult == WAIT_TIMEOUT )
{
ERR( "App Read connection setting timeout fail (0x%08lx)\n", dwWaitResult );
ERR( "App Read connection setting timeout fail (0x%08x)\n", dwWaitResult );
}
/* Close this handle as it's not needed anymore */
CloseHandle( lpThreadInfo->hSettingRead );
lpThreadInfo->hSettingRead = 0;
TRACE( "App created && intialized starting main message reception loop\n" );
TRACE( "App created && initialized starting main message reception loop\n" );
for ( ;; )
{
@@ -153,7 +153,7 @@ end_of_thread:
return 0;
}
/* DP messageing stuff */
/* DP messaging stuff */
static HANDLE DP_MSG_BuildAndLinkReplyStruct( IDirectPlay2Impl* This,
LPDP_MSG_REPLY_STRUCT_LIST lpReplyStructList,
WORD wReplyCommandId );
@@ -172,7 +172,7 @@ HANDLE DP_MSG_BuildAndLinkReplyStruct( IDirectPlay2Impl* This,
/* Insert into the message queue while locked */
EnterCriticalSection( &This->unk->DP_lock );
DPQ_INSERT( This->dp2->replysExpected, lpReplyStructList, replysExpected );
DPQ_INSERT( This->dp2->repliesExpected, lpReplyStructList, repliesExpected );
LeaveCriticalSection( &This->unk->DP_lock );
return lpReplyStructList->replyExpected.hReceipt;
@@ -225,7 +225,7 @@ HRESULT DP_MSG_SendRequestPlayerId( IDirectPlay2AImpl* This, DWORD dwFlags,
data.bSystemMessage = TRUE; /* Allow reply to be sent */
data.lpISP = This->dp2->spData.lpISP;
TRACE( "Asking for player id w/ dwFlags 0x%08lx\n",
TRACE( "Asking for player id w/ dwFlags 0x%08x\n",
lpMsgBody->dwFlags );
DP_MSG_ExpectReply( This, &data, DPMSG_DEFAULT_WAIT_TIME, DPMSGCMD_NEWPLAYERIDREPLY,
@@ -233,20 +233,20 @@ HRESULT DP_MSG_SendRequestPlayerId( IDirectPlay2AImpl* This, DWORD dwFlags,
}
/* Need to examine the data and extract the new player id */
if( !FAILED(hr) )
if( SUCCEEDED(hr) )
{
LPCDPMSG_NEWPLAYERIDREPLY lpcReply;
lpcReply = (LPCDPMSG_NEWPLAYERIDREPLY)lpMsg;
lpcReply = lpMsg;
*lpdpidAllocatedId = lpcReply->dpidNewPlayerId;
TRACE( "Received reply for id = 0x%08lx\n", lpcReply->dpidNewPlayerId );
TRACE( "Received reply for id = 0x%08x\n", lpcReply->dpidNewPlayerId );
/* FIXME: I think that the rest of the message has something to do
* with remote data for the player that perhaps I need to setup.
* However, with the information that is passed, all that it could
* be used for is a standardized intialization value, which I'm
* be used for is a standardized initialization value, which I'm
* guessing we can do without. Unless the message content is the same
* for several different messages?
*/
@@ -282,7 +282,7 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlay2AImpl* This, DPID dpidServer )
DWORD dwDataSize;
/* SP Player remote data needs to be propagated at some point - is this the point? */
IDirectPlaySP_GetSPPlayerData( This->dp2->spData.lpISP, 0, (LPVOID*)&lpPData, &dwDataSize, DPSET_REMOTE );
IDirectPlaySP_GetSPPlayerData( This->dp2->spData.lpISP, 0, &lpPData, &dwDataSize, DPSET_REMOTE );
ERR( "Player Data size is 0x%08lx\n"
"[%02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x]\n"
@@ -323,18 +323,14 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlay2AImpl* This, DPID dpidServer )
lpMsgBody->unknown4[3] = NS_GetNsMagic( This->dp2->lpNameServerData ) -
0x02000000;
TRACE( "Setting first magic to 0x%08lx\n", lpMsgBody->unknown4[3] );
TRACE( "Setting first magic to 0x%08x\n", lpMsgBody->unknown4[3] );
lpMsgBody->unknown4[4] = 0x0;
lpMsgBody->unknown4[5] = 0x0;
lpMsgBody->unknown4[6] = 0x0;
#if 0
lpMsgBody->unknown4[7] = NS_GetOtherMagic( This->dp2->lpNameServerData )
#else
lpMsgBody->unknown4[7] = NS_GetNsMagic( This->dp2->lpNameServerData );
#endif
TRACE( "Setting second magic to 0x%08lx\n", lpMsgBody->unknown4[7] );
TRACE( "Setting second magic to 0x%08x\n", lpMsgBody->unknown4[7] );
lpMsgBody->unknown4[8] = 0x0;
lpMsgBody->unknown4[9] = 0x0;
@@ -356,7 +352,7 @@ HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlay2AImpl* This, DPID dpidServer )
data.bSystemMessage = TRUE; /* Allow reply to be sent */
data.lpISP = This->dp2->spData.lpISP;
TRACE( "Sending forward player request with 0x%08lx\n", dpidServer );
TRACE( "Sending forward player request with 0x%08x\n", dpidServer );
lpMsg = DP_MSG_ExpectReply( This, &data,
DPMSG_WAIT_60_SECS,
@@ -393,7 +389,7 @@ LPVOID DP_MSG_ExpectReply( IDirectPlay2AImpl* This, LPDPSP_SENDDATA lpData,
hMsgReceipt = DP_MSG_BuildAndLinkReplyStruct( This, &replyStructList,
wReplyCommandId );
TRACE( "Sending msg and expecting cmd %u in reply within %lu ticks\n",
TRACE( "Sending msg and expecting cmd %u in reply within %u ticks\n",
wReplyCommandId, dwWaitTime );
hr = (*This->dp2->spData.lpCB->Send)( lpData );
@@ -409,7 +405,7 @@ LPVOID DP_MSG_ExpectReply( IDirectPlay2AImpl* This, LPDPSP_SENDDATA lpData,
dwWaitReturn = WaitForSingleObject( hMsgReceipt, dwWaitTime );
if( dwWaitReturn != WAIT_OBJECT_0 )
{
ERR( "Wait failed 0x%08lx\n", dwWaitReturn );
ERR( "Wait failed 0x%08x\n", dwWaitReturn );
return NULL;
}
@@ -437,7 +433,7 @@ void DP_MSG_ReplyReceived( IDirectPlay2AImpl* This, WORD wCommandId,
* avoid problems.
*/
EnterCriticalSection( &This->unk->DP_lock );
DPQ_REMOVE_ENTRY( This->dp2->replysExpected, replysExpected, replyExpected.wExpectedReply,\
DPQ_REMOVE_ENTRY( This->dp2->repliesExpected, repliesExpected, replyExpected.wExpectedReply,
==, wCommandId, lpReplyList );
LeaveCriticalSection( &This->unk->DP_lock );
@@ -502,7 +498,7 @@ void DP_MSG_ErrorReceived( IDirectPlay2AImpl* This, WORD wCommandId,
{
LPCDPMSG_FORWARDADDPLAYERNACK lpcErrorMsg;
lpcErrorMsg = (LPCDPMSG_FORWARDADDPLAYERNACK)lpMsgBody;
lpcErrorMsg = lpMsgBody;
ERR( "Received error message %u. Error is %s\n",
wCommandId, DPLAYX_HresultToString( lpcErrorMsg->errorCode) );
+7 -7
View File
@@ -13,7 +13,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DPLAYX_MESSAGES__
@@ -29,17 +29,17 @@
#include "dplay_global.h"
DWORD CreateLobbyMessageReceptionThread( HANDLE hNotifyEvent, HANDLE hStart,
HANDLE hDeath, HANDLE hConnRead );
HANDLE hDeath, HANDLE hConnRead ) DECLSPEC_HIDDEN;
HRESULT DP_MSG_SendRequestPlayerId( IDirectPlay2AImpl* This, DWORD dwFlags,
LPDPID lpdipidAllocatedId );
HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlay2AImpl* This, DPID dpidServer );
LPDPID lpdipidAllocatedId ) DECLSPEC_HIDDEN;
HRESULT DP_MSG_ForwardPlayerCreation( IDirectPlay2AImpl* This, DPID dpidServer ) DECLSPEC_HIDDEN;
void DP_MSG_ReplyReceived( IDirectPlay2AImpl* This, WORD wCommandId,
LPCVOID lpMsgBody, DWORD dwMsgBodySize );
LPCVOID lpMsgBody, DWORD dwMsgBodySize ) DECLSPEC_HIDDEN;
void DP_MSG_ErrorReceived( IDirectPlay2AImpl* This, WORD wCommandId,
LPCVOID lpMsgBody, DWORD dwMsgBodySize );
void DP_MSG_ToSelf( IDirectPlay2AImpl* This, DPID dpidSelf );
LPCVOID lpMsgBody, DWORD dwMsgBodySize ) DECLSPEC_HIDDEN;
void DP_MSG_ToSelf( IDirectPlay2AImpl* This, DPID dpidSelf ) DECLSPEC_HIDDEN;
/* Timings -> 1000 ticks/sec */
#define DPMSG_WAIT_5_SECS 5000
+4 -4
View File
@@ -14,7 +14,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
* o Linked list implementation for dplay/dplobby. Based off of the BSD
@@ -122,7 +122,7 @@ do { \
* elm - how to find the next element
* field - to be concatenated to rc to compare with fieldToCompare
* fieldToCompare - The value that we're comparing against
* compare_cb - Callback to invoke to determine if comparision should continue.
* compare_cb - Callback to invoke to determine if comparison should continue.
* Callback must be defined with DPQ_DECL_COMPARECB.
* rc - Variable to put the return code. Same type as (head).lpQHFirst
*/
@@ -174,7 +174,7 @@ do { \
* elm - how to find the next element
* field - to be concatenated to rc to compare with fieldToCompare
* fieldToCompare - The value that we're comparing against
* compare_cb - Callback to invoke to determine if comparision should continue.
* compare_cb - Callback to invoke to determine if comparison should continue.
* Callback must be defined with DPQ_DECL_COMPARECB.
* rc - Variable to put the return code. Same type as (head).lpQHFirst
*/
@@ -211,6 +211,6 @@ do \
#define DPQ_DECL_DELETECB( name, type ) void name( type elem )
/* Prototype of a method which just performs a HeapFree on the elem */
DPQ_DECL_DELETECB( cbDeleteElemFromHeap, LPVOID );
DPQ_DECL_DELETECB( cbDeleteElemFromHeap, LPVOID ) DECLSPEC_HIDDEN;
#endif /* __WINE_DPLAYX_QUEUE_H */
+82 -90
View File
@@ -14,7 +14,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
//#include <string.h>
@@ -48,9 +48,9 @@ typedef struct IDirectPlayLobby3Impl IDirectPlayLobby3WImpl;
/* Forward declarations for this module helper methods */
HRESULT DPL_CreateCompoundAddress ( LPCDPCOMPOUNDADDRESSELEMENT lpElements, DWORD dwElementCount,
LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface )DECLSPEC_HIDDEN;
HRESULT DPL_CreateAddress( REFGUID guidSP, REFGUID guidDataType, LPCVOID lpData, DWORD dwDataSize,
static HRESULT DPL_CreateAddress( REFGUID guidSP, REFGUID guidDataType, LPCVOID lpData, DWORD dwDataSize,
LPVOID lpAddress, LPDWORD lpdwAddressSize, BOOL bAnsiInterface );
@@ -58,11 +58,11 @@ HRESULT DPL_CreateAddress( REFGUID guidSP, REFGUID guidDataType, LPCVOID lpData,
extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
DWORD dwAddressSize, LPVOID lpContext );
static HRESULT WINAPI DPL_ConnectEx( IDirectPlayLobbyAImpl* This,
DWORD dwFlags, REFIID riid,
LPVOID* lplpDP, IUnknown* pUnk );
static HRESULT DPL_ConnectEx( IDirectPlayLobbyAImpl* This,
DWORD dwFlags, REFIID riid,
LPVOID* lplpDP, IUnknown* pUnk );
BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
static BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
LPHANDLE lphStart, LPHANDLE lphDeath,
LPHANDLE lphRead );
@@ -145,7 +145,7 @@ static const IDirectPlayLobby3Vtbl directPlayLobby3AVT;
static BOOL DPL_CreateIUnknown( LPVOID lpDPL )
{
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL;
IDirectPlayLobbyAImpl *This = lpDPL;
This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) );
if ( This->unk == NULL )
@@ -154,14 +154,16 @@ static BOOL DPL_CreateIUnknown( LPVOID lpDPL )
}
InitializeCriticalSection( &This->unk->DPL_lock );
This->unk->DPL_lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDirectPlayLobbyAImpl*->DirectPlayLobbyIUnknownData*->DPL_lock");
return TRUE;
}
static BOOL DPL_DestroyIUnknown( LPVOID lpDPL )
{
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL;
IDirectPlayLobbyAImpl *This = lpDPL;
This->unk->DPL_lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &This->unk->DPL_lock );
HeapFree( GetProcessHeap(), 0, This->unk );
@@ -170,7 +172,7 @@ static BOOL DPL_DestroyIUnknown( LPVOID lpDPL )
static BOOL DPL_CreateLobby1( LPVOID lpDPL )
{
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL;
IDirectPlayLobbyAImpl *This = lpDPL;
This->dpl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dpl) ) );
if ( This->dpl == NULL )
@@ -185,7 +187,7 @@ static BOOL DPL_CreateLobby1( LPVOID lpDPL )
static BOOL DPL_DestroyLobby1( LPVOID lpDPL )
{
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)lpDPL;
IDirectPlayLobbyAImpl *This = lpDPL;
if( This->dpl->dwMsgThread )
{
@@ -202,7 +204,7 @@ static BOOL DPL_DestroyLobby1( LPVOID lpDPL )
static BOOL DPL_CreateLobby2( LPVOID lpDPL )
{
IDirectPlayLobby2AImpl *This = (IDirectPlayLobby2AImpl *)lpDPL;
IDirectPlayLobby2AImpl *This = lpDPL;
This->dpl2 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dpl2) ) );
if ( This->dpl2 == NULL )
@@ -215,7 +217,7 @@ static BOOL DPL_CreateLobby2( LPVOID lpDPL )
static BOOL DPL_DestroyLobby2( LPVOID lpDPL )
{
IDirectPlayLobby2AImpl *This = (IDirectPlayLobby2AImpl *)lpDPL;
IDirectPlayLobby2AImpl *This = lpDPL;
HeapFree( GetProcessHeap(), 0, This->dpl2 );
@@ -224,7 +226,7 @@ static BOOL DPL_DestroyLobby2( LPVOID lpDPL )
static BOOL DPL_CreateLobby3( LPVOID lpDPL )
{
IDirectPlayLobby3AImpl *This = (IDirectPlayLobby3AImpl *)lpDPL;
IDirectPlayLobby3AImpl *This = lpDPL;
This->dpl3 = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->dpl3) ) );
if ( This->dpl3 == NULL )
@@ -237,7 +239,7 @@ static BOOL DPL_CreateLobby3( LPVOID lpDPL )
static BOOL DPL_DestroyLobby3( LPVOID lpDPL )
{
IDirectPlayLobby3AImpl *This = (IDirectPlayLobby3AImpl *)lpDPL;
IDirectPlayLobby3AImpl *This = lpDPL;
HeapFree( GetProcessHeap(), 0, This->dpl3 );
@@ -268,7 +270,6 @@ static BOOL DPL_DestroyLobby3( LPVOID lpDPL )
* successfully for a third interface, a query for the first interface
* through the pointer for the third interface must succeed.
*/
extern
HRESULT DPL_CreateInterface
( REFIID riid, LPVOID* ppvObj )
{
@@ -284,32 +285,32 @@ HRESULT DPL_CreateInterface
if( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
{
IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)*ppvObj;
IDirectPlayLobbyWImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobbyWVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
{
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)*ppvObj;
IDirectPlayLobbyAImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobbyAVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
{
IDirectPlayLobby2WImpl *This = (IDirectPlayLobby2WImpl *)*ppvObj;
IDirectPlayLobby2WImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobby2WVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
{
IDirectPlayLobby2AImpl *This = (IDirectPlayLobby2AImpl *)*ppvObj;
IDirectPlayLobby2AImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobby2AVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
{
IDirectPlayLobby3WImpl *This = (IDirectPlayLobby3WImpl *)*ppvObj;
IDirectPlayLobby3WImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobby3WVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
{
IDirectPlayLobby3AImpl *This = (IDirectPlayLobby3AImpl *)*ppvObj;
IDirectPlayLobby3AImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobby3AVT;
}
else
@@ -364,32 +365,32 @@ static HRESULT WINAPI DPL_QueryInterface
if( IsEqualGUID( &IID_IDirectPlayLobby, riid ) )
{
IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)*ppvObj;
IDirectPlayLobbyWImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobbyWVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobbyA, riid ) )
{
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)*ppvObj;
IDirectPlayLobbyAImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobbyAVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobby2, riid ) )
{
IDirectPlayLobby2WImpl *This = (IDirectPlayLobby2WImpl *)*ppvObj;
IDirectPlayLobby2WImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobby2WVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobby2A, riid ) )
{
IDirectPlayLobby2AImpl *This = (IDirectPlayLobby2AImpl *)*ppvObj;
IDirectPlayLobby2AImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobby2AVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobby3, riid ) )
{
IDirectPlayLobby3WImpl *This = (IDirectPlayLobby3WImpl *)*ppvObj;
IDirectPlayLobby3WImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobby3WVT;
}
else if( IsEqualGUID( &IID_IDirectPlayLobby3A, riid ) )
{
IDirectPlayLobby3AImpl *This = (IDirectPlayLobby3AImpl *)*ppvObj;
IDirectPlayLobby3AImpl *This = *ppvObj;
This->lpVtbl = &directPlayLobby3AVT;
}
else
@@ -419,7 +420,7 @@ static ULONG WINAPI DPL_AddRef
ulObjRefCount = InterlockedIncrement( &This->unk->ulObjRef );
ulInterfaceRefCount = InterlockedIncrement( &This->ulInterfaceRef );
TRACE( "ref count incremented to %lu:%lu for %p\n",
TRACE( "ref count incremented to %u:%u for %p\n",
ulInterfaceRefCount, ulObjRefCount, This );
return ulObjRefCount;
@@ -439,7 +440,7 @@ static ULONG WINAPI DPL_Release
ulObjRefCount = InterlockedDecrement( &This->unk->ulObjRef );
ulInterfaceRefCount = InterlockedDecrement( &This->ulInterfaceRef );
TRACE( "ref count decremented to %lu:%lu for %p\n",
TRACE( "ref count decremented to %u:%u for %p\n",
ulInterfaceRefCount, ulObjRefCount, This );
/* Deallocate if this is the last reference to the object */
@@ -468,7 +469,7 @@ static ULONG WINAPI DPL_Release
* Returns an IDirectPlay interface.
*
*/
static HRESULT WINAPI DPL_ConnectEx
static HRESULT DPL_ConnectEx
( IDirectPlayLobbyAImpl* This,
DWORD dwFlags,
REFIID riid,
@@ -480,7 +481,7 @@ static HRESULT WINAPI DPL_ConnectEx
DWORD dwConnSize = 0;
LPDPLCONNECTION lpConn;
FIXME("(%p)->(0x%08lx,%p,%p): semi stub\n", This, dwFlags, lplpDP, pUnk );
FIXME("(%p)->(0x%08x,%p,%p): semi stub\n", This, dwFlags, lplpDP, pUnk );
if( pUnk )
{
@@ -610,7 +611,7 @@ static HRESULT WINAPI IDirectPlayLobbyWImpl_CreateAddress
lpAddress, lpdwAddressSize, FALSE );
}
HRESULT DPL_CreateAddress(
static HRESULT DPL_CreateAddress(
REFGUID guidSP,
REFGUID guidDataType,
LPCVOID lpData,
@@ -622,7 +623,7 @@ HRESULT DPL_CreateAddress(
const DWORD dwNumAddElements = 2; /* Service Provide & address data type */
DPCOMPOUNDADDRESSELEMENT addressElements[ 2 /* dwNumAddElements */ ];
TRACE( "(%p)->(%p,%p,0x%08lx,%p,%p,%d)\n", guidSP, guidDataType, lpData, dwDataSize,
TRACE( "(%p)->(%p,%p,0x%08x,%p,%p,%d)\n", guidSP, guidDataType, lpData, dwDataSize,
lpAddress, lpdwAddressSize, bAnsiInterface );
addressElements[ 0 ].guidDataType = DPAID_ServiceProvider;
@@ -656,7 +657,7 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddress
{
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
TRACE("(%p)->(%p,%p,0x%08x,%p)\n", This, lpEnumAddressCallback, lpAddress,
dwAddressSize, lpContext );
return DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
@@ -671,14 +672,14 @@ static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumAddress
{
IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
TRACE("(%p)->(%p,%p,0x%08lx,%p)\n", This, lpEnumAddressCallback, lpAddress,
TRACE("(%p)->(%p,%p,0x%08x,%p)\n", This, lpEnumAddressCallback, lpAddress,
dwAddressSize, lpContext );
return DPL_EnumAddress( lpEnumAddressCallback, lpAddress, dwAddressSize, lpContext );
}
extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
DWORD dwAddressSize, LPVOID lpContext )
HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress,
DWORD dwAddressSize, LPVOID lpContext )
{
DWORD dwTotalSizeEnumerated = 0;
@@ -686,13 +687,13 @@ extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, L
while ( dwTotalSizeEnumerated < dwAddressSize )
{
const DPADDRESS* lpElements = (const DPADDRESS*)lpAddress;
const DPADDRESS* lpElements = lpAddress;
DWORD dwSizeThisEnumeration;
/* Invoke the enum method. If false is returned, stop enumeration */
if ( !lpEnumAddressCallback( &lpElements->guidDataType,
lpElements->dwDataSize,
(BYTE*)lpElements + sizeof( DPADDRESS ),
(const BYTE *)lpElements + sizeof( DPADDRESS ),
lpContext ) )
{
break;
@@ -727,14 +728,14 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumAddressTypes
char subKeyName[51];
FILETIME filetime;
TRACE(" (%p)->(%p,%p,%p,0x%08lx)\n", This, lpEnumAddressTypeCallback, guidSP, lpContext, dwFlags );
TRACE(" (%p)->(%p,%p,%p,0x%08x)\n", This, lpEnumAddressTypeCallback, guidSP, lpContext, dwFlags );
if( dwFlags != 0 )
{
return DPERR_INVALIDPARAMS;
}
if( !lpEnumAddressTypeCallback || !*lpEnumAddressTypeCallback )
if( !lpEnumAddressTypeCallback )
{
return DPERR_INVALIDPARAMS;
}
@@ -863,7 +864,7 @@ static HRESULT WINAPI IDirectPlayLobbyWImpl_EnumLocalApplications
{
IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
FIXME("(%p)->(%p,%p,0x%08lx):stub\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
FIXME("(%p)->(%p,%p,0x%08x):stub\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
return DPERR_OUTOFMEMORY;
}
@@ -883,14 +884,14 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_EnumLocalApplications
char subKeyName[51];
FILETIME filetime;
TRACE("(%p)->(%p,%p,0x%08lx)\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
TRACE("(%p)->(%p,%p,0x%08x)\n", This, lpEnumLocalAppCallback, lpContext, dwFlags );
if( dwFlags != 0 )
{
return DPERR_INVALIDPARAMS;
}
if( !lpEnumLocalAppCallback || !*lpEnumLocalAppCallback )
if( !lpEnumLocalAppCallback )
{
return DPERR_INVALIDPARAMS;
}
@@ -979,7 +980,7 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_GetConnectionSettings
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
HRESULT hr;
TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
TRACE("(%p)->(0x%08x,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
EnterCriticalSection( &This->unk->DPL_lock );
@@ -1002,7 +1003,7 @@ static HRESULT WINAPI IDirectPlayLobbyWImpl_GetConnectionSettings
IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
HRESULT hr;
TRACE("(%p)->(0x%08lx,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
TRACE("(%p)->(0x%08x,%p,%p)\n", This, dwAppID, lpData, lpdwDataSize );
EnterCriticalSection( &This->unk->DPL_lock );
@@ -1031,7 +1032,7 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_ReceiveLobbyMessage
LPDWORD lpdwDataSize )
{
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
FIXME(":stub %p %08x %08x %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
lpdwDataSize );
return DPERR_OUTOFMEMORY;
}
@@ -1045,7 +1046,7 @@ static HRESULT WINAPI IDirectPlayLobbyWImpl_ReceiveLobbyMessage
LPDWORD lpdwDataSize )
{
IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
FIXME(":stub %p %08lx %08lx %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
FIXME(":stub %p %08x %08x %p %p %p\n", This, dwFlags, dwAppID, lpdwMessageFlags, lpData,
lpdwDataSize );
return DPERR_OUTOFMEMORY;
}
@@ -1143,7 +1144,7 @@ static BOOL CALLBACK RunApplicationA_EnumLocalApplications
return TRUE; /* Keep enumerating, haven't found the application yet */
}
BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
static BOOL DPL_CreateAndSetLobbyHandles( DWORD dwDestProcessId, HANDLE hDestProcess,
LPHANDLE lphStart, LPHANDLE lphDeath,
LPHANDLE lphRead )
{
@@ -1212,7 +1213,7 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication
DWORD dwSuspendCount;
HANDLE hStart, hDeath, hSettingRead;
TRACE( "(%p)->(0x%08lx,%p,%p,%p)\n",
TRACE( "(%p)->(0x%08x,%p,%p,%p)\n",
This, dwFlags, lpdwAppID, lpConn, hReceiveEvent );
if( dwFlags != 0 )
@@ -1234,7 +1235,7 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication
/* Our callback function will fill up the enumData structure with all the information
required to start a new process */
IDirectPlayLobby_EnumLocalApplications( iface, RunApplicationA_EnumLocalApplications,
(LPVOID)(&enumData), 0 );
(&enumData), 0 );
/* First the application name */
strcpy( temp, enumData.lpszPath );
@@ -1287,7 +1288,7 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication
/* Reserve this global application id! */
if( !DPLAYX_CreateLobbyApplication( newProcessInfo.dwProcessId ) )
{
ERR( "Unable to create global application data for 0x%08lx\n",
ERR( "Unable to create global application data for 0x%08x\n",
newProcessInfo.dwProcessId );
}
@@ -1319,7 +1320,7 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_RunApplication
/* Unsuspend the process - should return the prev suspension count */
if( ( dwSuspendCount = ResumeThread( newProcessInfo.hThread ) ) != 1 )
{
ERR( "ResumeThread failed with 0x%08lx\n", dwSuspendCount );
ERR( "ResumeThread failed with 0x%08x\n", dwSuspendCount );
}
return DP_OK;
@@ -1333,7 +1334,7 @@ static HRESULT WINAPI IDirectPlayLobbyWImpl_RunApplication
HANDLE hReceiveEvent )
{
IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
FIXME( "(%p)->(0x%08lx,%p,%p,%p):stub\n", This, dwFlags, lpdwAppID, lpConn, (void *)hReceiveEvent );
FIXME( "(%p)->(0x%08x,%p,%p,%p):stub\n", This, dwFlags, lpdwAppID, lpConn, hReceiveEvent );
return DPERR_OUTOFMEMORY;
}
@@ -1380,13 +1381,13 @@ static HRESULT WINAPI IDirectPlayLobbyWImpl_SetConnectionSettings
IDirectPlayLobbyWImpl *This = (IDirectPlayLobbyWImpl *)iface;
HRESULT hr;
TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
TRACE("(%p)->(0x%08x,0x%08x,%p)\n", This, dwFlags, dwAppID, lpConn );
EnterCriticalSection( &This->unk->DPL_lock );
hr = DPLAYX_SetConnectionSettingsW( dwFlags, dwAppID, lpConn );
/* FIXME: Don't think that this is supposed to fail, but the docuementation
/* FIXME: Don't think that this is supposed to fail, but the documentation
is somewhat sketchy. I'll try creating a lobby application
for this... */
if( hr == DPERR_NOTLOBBIED )
@@ -1414,13 +1415,13 @@ static HRESULT WINAPI IDirectPlayLobbyAImpl_SetConnectionSettings
IDirectPlayLobbyAImpl *This = (IDirectPlayLobbyAImpl *)iface;
HRESULT hr;
TRACE("(%p)->(0x%08lx,0x%08lx,%p)\n", This, dwFlags, dwAppID, lpConn );
TRACE("(%p)->(0x%08x,0x%08x,%p)\n", This, dwFlags, dwAppID, lpConn );
EnterCriticalSection( &This->unk->DPL_lock );
hr = DPLAYX_SetConnectionSettingsA( dwFlags, dwAppID, lpConn );
/* FIXME: Don't think that this is supposed to fail, but the docuementation
/* FIXME: Don't think that this is supposed to fail, but the documentation
is somewhat sketchy. I'll try creating a lobby application
for this... */
if( hr == DPERR_NOTLOBBIED )
@@ -1494,7 +1495,7 @@ HRESULT DPL_CreateCompoundAddress
DWORD dwElements;
LPCDPCOMPOUNDADDRESSELEMENT lpOrigElements = lpElements;
TRACE("(%p,0x%08lx,%p,%p)\n", lpElements, dwElementCount, lpAddress, lpdwAddressSize );
TRACE("(%p,0x%08x,%p,%p)\n", lpElements, dwElementCount, lpAddress, lpdwAddressSize );
/* Parameter check */
if( ( lpElements == NULL ) ||
@@ -1570,9 +1571,9 @@ HRESULT DPL_CreateCompoundAddress
/* Add the total size chunk */
{
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
LPDPADDRESS lpdpAddress = lpAddress;
CopyMemory( &lpdpAddress->guidDataType, &DPAID_TotalSize, sizeof( GUID ) );
lpdpAddress->guidDataType = DPAID_TotalSize;
lpdpAddress->dwDataSize = sizeof( DWORD );
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
@@ -1589,10 +1590,9 @@ HRESULT DPL_CreateCompoundAddress
( IsEqualGUID( &lpElements->guidDataType, &DPAID_LobbyProvider ) )
)
{
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
LPDPADDRESS lpdpAddress = lpAddress;
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
sizeof( GUID ) );
lpdpAddress->guidDataType = lpElements->guidDataType;
lpdpAddress->dwDataSize = sizeof( GUID );
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
@@ -1604,16 +1604,13 @@ HRESULT DPL_CreateCompoundAddress
( IsEqualGUID( &lpElements->guidDataType, &DPAID_INet ) )
)
{
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
LPDPADDRESS lpdpAddress = lpAddress;
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
sizeof( GUID ) );
lpdpAddress->guidDataType = lpElements->guidDataType;
lpdpAddress->dwDataSize = lpElements->dwDataSize;
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
lstrcpynA( (LPSTR)lpAddress,
(LPCSTR)lpElements->lpData,
lpElements->dwDataSize );
lstrcpynA( lpAddress, lpElements->lpData, lpElements->dwDataSize );
lpAddress = (char *) lpAddress + lpElements->dwDataSize;
}
else if ( ( IsEqualGUID( &lpElements->guidDataType, &DPAID_PhoneW ) ) ||
@@ -1621,24 +1618,20 @@ HRESULT DPL_CreateCompoundAddress
( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetW ) )
)
{
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
LPDPADDRESS lpdpAddress = lpAddress;
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
sizeof( GUID ) );
lpdpAddress->guidDataType = lpElements->guidDataType;
lpdpAddress->dwDataSize = lpElements->dwDataSize;
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
lstrcpynW( (LPWSTR)lpAddress,
(LPCWSTR)lpElements->lpData,
lpElements->dwDataSize );
lstrcpynW( lpAddress, lpElements->lpData, lpElements->dwDataSize );
lpAddress = (char *) lpAddress + lpElements->dwDataSize * sizeof( WCHAR );
}
else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_INetPort ) )
{
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
LPDPADDRESS lpdpAddress = lpAddress;
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
sizeof( GUID ) );
lpdpAddress->guidDataType = lpElements->guidDataType;
lpdpAddress->dwDataSize = lpElements->dwDataSize;
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
@@ -1647,10 +1640,9 @@ HRESULT DPL_CreateCompoundAddress
}
else if ( IsEqualGUID( &lpElements->guidDataType, &DPAID_ComPort ) )
{
LPDPADDRESS lpdpAddress = (LPDPADDRESS)lpAddress;
LPDPADDRESS lpdpAddress = lpAddress;
CopyMemory( &lpdpAddress->guidDataType, &lpElements->guidDataType,
sizeof( GUID ) );
lpdpAddress->guidDataType = lpElements->guidDataType;
lpdpAddress->dwDataSize = lpElements->dwDataSize;
lpAddress = (char *) lpAddress + sizeof( DPADDRESS );
@@ -1712,9 +1704,9 @@ static HRESULT WINAPI IDirectPlayLobby3WImpl_WaitForConnectionSettings
( LPDIRECTPLAYLOBBY3 iface, DWORD dwFlags )
{
HRESULT hr = DP_OK;
BOOL bStartWait = (dwFlags & DPLWAIT_CANCEL) ? FALSE : TRUE;
BOOL bStartWait = !(dwFlags & DPLWAIT_CANCEL);
TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
TRACE( "(%p)->(0x%08x)\n", iface, dwFlags );
if( DPLAYX_WaitForConnectionSettings( bStartWait ) )
{
@@ -1729,9 +1721,9 @@ static HRESULT WINAPI IDirectPlayLobby3AImpl_WaitForConnectionSettings
( LPDIRECTPLAYLOBBY3A iface, DWORD dwFlags )
{
HRESULT hr = DP_OK;
BOOL bStartWait = (dwFlags & DPLWAIT_CANCEL) ? FALSE : TRUE;
BOOL bStartWait = !(dwFlags & DPLWAIT_CANCEL);
TRACE( "(%p)->(0x%08lx)\n", iface, dwFlags );
TRACE( "(%p)->(0x%08x)\n", iface, dwFlags );
if( DPLAYX_WaitForConnectionSettings( bStartWait ) )
{
@@ -1838,7 +1830,7 @@ static const IDirectPlayLobby2Vtbl directPlayLobby2AVT =
/* Note: Hack so we can reuse the old functions without compiler warnings */
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
# define XCAST(fun) (typeof(directPlayLobby2AVT.fun))
# define XCAST(fun) (typeof(directPlayLobby2WVT.fun))
#else
# define XCAST(fun) (void*)
#endif
@@ -1956,7 +1948,7 @@ HRESULT WINAPI DirectPlayLobbyCreateA( LPGUID lpGUIDDSP,
LPVOID lpData,
DWORD dwDataSize )
{
TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08x\n",
lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
/* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
@@ -1988,7 +1980,7 @@ HRESULT WINAPI DirectPlayLobbyCreateW( LPGUID lpGUIDDSP,
LPVOID lpData,
DWORD dwDataSize )
{
TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08lx\n",
TRACE("lpGUIDDSP=%p lplpDPL=%p lpUnk=%p lpData=%p dwDataSize=%08x\n",
lpGUIDDSP,lplpDPL,lpUnk,lpData,dwDataSize);
/* Parameter Check: lpGUIDSP, lpUnk & lpData must be NULL. dwDataSize must
+11 -9
View File
@@ -15,7 +15,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
//#include "winerror.h"
@@ -76,7 +76,7 @@ HRESULT DPLSP_CreateInterface( REFIID riid, LPVOID* ppvObj, IDirectPlay2Impl* dp
if( IsEqualGUID( &IID_IDPLobbySP, riid ) )
{
IDPLobbySPImpl *This = (IDPLobbySPImpl *)*ppvObj;
IDPLobbySPImpl *This = *ppvObj;
This->lpVtbl = &dpLobbySPVT;
}
else
@@ -109,7 +109,7 @@ HRESULT DPLSP_CreateInterface( REFIID riid, LPVOID* ppvObj, IDirectPlay2Impl* dp
static BOOL DPLSP_CreateIUnknown( LPVOID lpSP )
{
IDPLobbySPImpl *This = (IDPLobbySPImpl *)lpSP;
IDPLobbySPImpl *This = lpSP;
This->unk = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->unk) ) );
@@ -119,14 +119,16 @@ static BOOL DPLSP_CreateIUnknown( LPVOID lpSP )
}
InitializeCriticalSection( &This->unk->DPLSP_lock );
This->unk->DPLSP_lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IDPLobbySPImpl*->DPLobbySPIUnknownData*->DPLSP_lock");
return TRUE;
}
static BOOL DPLSP_DestroyIUnknown( LPVOID lpSP )
{
IDPLobbySPImpl *This = (IDPLobbySPImpl *)lpSP;
IDPLobbySPImpl *This = lpSP;
This->unk->DPLSP_lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &This->unk->DPLSP_lock );
HeapFree( GetProcessHeap(), 0, This->unk );
@@ -135,7 +137,7 @@ static BOOL DPLSP_DestroyIUnknown( LPVOID lpSP )
static BOOL DPLSP_CreateDPLobbySP( LPVOID lpSP, IDirectPlay2Impl* dp )
{
IDPLobbySPImpl *This = (IDPLobbySPImpl *)lpSP;
IDPLobbySPImpl *This = lpSP;
This->sp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->sp) ) );
@@ -167,7 +169,7 @@ static BOOL DPLSP_CreateDPLobbySP( LPVOID lpSP, IDirectPlay2Impl* dp )
static BOOL DPLSP_DestroyDPLobbySP( LPVOID lpSP )
{
IDPLobbySPImpl *This = (IDPLobbySPImpl *)lpSP;
IDPLobbySPImpl *This = lpSP;
HeapFree( GetProcessHeap(), 0, This->sp );
@@ -197,7 +199,7 @@ HRESULT WINAPI DPLSP_QueryInterface
if( IsEqualGUID( &IID_IDPLobbySP, riid ) )
{
IDPLobbySPImpl *This = (IDPLobbySPImpl *)*ppvObj;
IDPLobbySPImpl *This = *ppvObj;
This->lpVtbl = &dpLobbySPVT;
}
else
@@ -224,7 +226,7 @@ ULONG WINAPI DPLSP_AddRef
ulObjRefCount = InterlockedIncrement( &This->unk->ulObjRef );
ulInterfaceRefCount = InterlockedIncrement( &This->ulInterfaceRef );
TRACE( "ref count incremented to %lu:%lu for %p\n",
TRACE( "ref count incremented to %u:%u for %p\n",
ulInterfaceRefCount, ulObjRefCount, This );
return ulObjRefCount;
@@ -240,7 +242,7 @@ ULONG WINAPI DPLSP_Release
ulObjRefCount = InterlockedDecrement( &This->unk->ulObjRef );
ulInterfaceRefCount = InterlockedDecrement( &This->ulInterfaceRef );
TRACE( "ref count decremented to %lu:%lu for %p\n",
TRACE( "ref count decremented to %u:%u for %p\n",
ulInterfaceRefCount, ulObjRefCount, This );
/* Deallocate if this is the last reference to the object */
+7 -7
View File
@@ -13,7 +13,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_LOBBY_SP_H
@@ -70,14 +70,14 @@ typedef struct SPDATA_ADDREMOTEPLAYERTOGROUP
LPDPNAME lpName;
} SPDATA_ADDREMOTEPLAYERTOGROUP, *LPSPDATA_ADDREMOTEPLAYERTOGROUP;
typedef struct SPDATA_BUILDPARENTALHEIRARCHY
typedef struct SPDATA_BUILDPARENTALHIERARCHY
{
DWORD dwSize;
LPDPLOBBYSP lpISP;
DWORD dwGroupID;
DWORD dwMessage;
DWORD dwParentID;
} SPDATA_BUILDPARENTALHEIRARCHY, *LPSPDATA_BUILDPARENTALHEIRARCHY;
} SPDATA_BUILDPARENTALHIERARCHY, *LPSPDATA_BUILDPARENTALHIERARCHY;
typedef struct SPDATA_CLOSE
{
@@ -388,7 +388,7 @@ typedef struct SPDATA_STARTSESSIONCOMMAND
/* Prototypes for callbacks returned by DPLSPInit */
typedef HRESULT (WINAPI *LPSP_ADDGROUPTOGROUP)(LPSPDATA_ADDGROUPTOGROUP);
typedef HRESULT (WINAPI *LPSP_ADDPLAYERTOGROUP)(LPSPDATA_ADDPLAYERTOGROUP);
typedef HRESULT (WINAPI *LPSP_BUILDPARENTALHEIRARCHY)(LPSPDATA_BUILDPARENTALHEIRARCHY);
typedef HRESULT (WINAPI *LPSP_BUILDPARENTALHIERARCHY)(LPSPDATA_BUILDPARENTALHIERARCHY);
typedef HRESULT (WINAPI *LPSP_CLOSE)(LPSPDATA_CLOSE);
typedef HRESULT (WINAPI *LPSP_CREATEGROUP)(LPSPDATA_CREATEGROUP);
typedef HRESULT (WINAPI *LPSP_CREATEGROUPINGROUP)(LPSPDATA_CREATEGROUPINGROUP);
@@ -422,7 +422,7 @@ typedef struct SP_CALLBACKS
DWORD dwFlags;
LPSP_ADDGROUPTOGROUP AddGroupToGroup;
LPSP_ADDPLAYERTOGROUP AddPlayerToGroup;
LPSP_BUILDPARENTALHEIRARCHY BuildParentalHeirarchy;
LPSP_BUILDPARENTALHIERARCHY BuildParentalHierarchy;
LPSP_CLOSE Close;
LPSP_CREATEGROUP CreateGroup;
LPSP_CREATEGROUPINGROUP CreateGroupInGroup;
@@ -458,7 +458,7 @@ typedef struct SPDATA_INIT
} SPDATA_INIT, *LPSPDATA_INIT;
typedef HRESULT (WINAPI *LPSP_INIT)(LPSPDATA_INIT);
HRESULT WINAPI DPLSPInit(LPSPDATA_INIT);
HRESULT WINAPI DPLSPInit(LPSPDATA_INIT) DECLSPEC_HIDDEN;
/* Define the COM interface */
#define INTERFACE IDPLobbySP
@@ -515,6 +515,6 @@ DECLARE_INTERFACE_(IDPLobbySP,IUnknown)
/* This variable is exported from the DLL at ordinal 6 to be accessed by the
* SP directly. This is the same variable that the DP SP will use.
*/
extern DWORD gdwDPlaySPRefCount;
extern DWORD gdwDPlaySPRefCount DECLSPEC_HIDDEN;
#endif
+28 -62
View File
@@ -14,7 +14,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* NOTE: Methods with the NS_ prefix are name server methods */
@@ -67,50 +67,38 @@ struct NSCache
typedef struct NSCache NSCache, *lpNSCache;
/* Function prototypes */
DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData );
static DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData );
/* Name Server functions
* ---------------------
*/
void NS_SetLocalComputerAsNameServer( LPCDPSESSIONDESC2 lpsd, LPVOID lpNSInfo )
{
#if 0
/* FIXME: Remove this method? */
DPLAYX_SetLocalSession( lpsd );
#endif
lpNSCache lpCache = (lpNSCache)lpNSInfo;
lpCache->bNsIsLocal = TRUE;
}
void NS_SetRemoteComputerAsNameServer( LPCDPSESSIONDESC2 lpsd, LPVOID lpNSInfo )
{
lpNSCache lpCache = (lpNSCache)lpNSInfo;
lpCache->bNsIsLocal = FALSE;
}
static DPQ_DECL_COMPARECB( cbUglyPig, GUID )
{
return IsEqualGUID( elem1, elem2 );
}
/* Store the given NS remote address for future reference */
/* FIXME: LPDPMSG_ENUMSESSIONSREPLY should be const */
void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr,
DWORD dwHdrSize,
LPDPMSG_ENUMSESSIONSREPLY lpMsg,
LPVOID lpNSInfo )
void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr,
DWORD dwHdrSize,
LPCDPMSG_ENUMSESSIONSREPLY lpcMsg,
LPVOID lpNSInfo )
{
DWORD len;
lpNSCache lpCache = (lpNSCache)lpNSInfo;
lpNSCacheData lpCacheNode;
TRACE( "%p, %p, %p\n", lpcNSAddrHdr, lpMsg, lpNSInfo );
TRACE( "%p, %p, %p\n", lpcNSAddrHdr, lpcMsg, lpNSInfo );
/* See if we can find this session. If we can, remove it as it's a dup */
DPQ_REMOVE_ENTRY_CB( lpCache->first, next, data->guidInstance, cbUglyPig,
lpMsg->sd.guidInstance, lpCacheNode );
lpcMsg->sd.guidInstance, lpCacheNode );
if( lpCacheNode != NULL )
{
@@ -137,15 +125,16 @@ void NS_AddRemoteComputerAsNameServer( LPCVOID lpcNSAddrHdr,
if( lpCacheNode->data == NULL )
{
ERR( "no memory for SESSIONDESC2\n" );
HeapFree( GetProcessHeap(), 0, lpCacheNode );
return;
}
CopyMemory( lpCacheNode->data, &lpMsg->sd, sizeof( *lpCacheNode->data ) );
len = WideCharToMultiByte( CP_ACP, 0, (LPWSTR)(lpMsg+1), -1, NULL, 0, NULL, NULL );
if ((lpCacheNode->data->lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0, len )))
*lpCacheNode->data = lpcMsg->sd;
len = WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1, NULL, 0, NULL, NULL );
if ((lpCacheNode->data->u1.lpszSessionNameA = HeapAlloc( GetProcessHeap(), 0, len )))
{
WideCharToMultiByte( CP_ACP, 0, (LPWSTR)(lpMsg+1), -1,
lpCacheNode->data->lpszSessionNameA, len, NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, (LPCWSTR)(lpcMsg+1), -1,
lpCacheNode->data->u1.lpszSessionNameA, len, NULL, NULL );
}
lpCacheNode->dwTime = timeGetTime();
@@ -169,7 +158,7 @@ LPVOID NS_GetNSAddr( LPVOID lpNSInfo )
/* Ok. Cheat and don't search for the correct stuff just take the first.
* FIXME: In the future how are we to know what is _THE_ enum we used?
* This is going to have to go into dplay somehow. Perhaps it
* comes back with app server id for the join command! Oh...that
* comes back with app server id for the join command! Oh... that
* must be it. That would make this method obsolete once that's
* in place.
*/
@@ -185,19 +174,11 @@ LPVOID NS_GetNSAddr( LPVOID lpNSInfo )
/* Get the magic number associated with the Name Server */
DWORD NS_GetNsMagic( LPVOID lpNSInfo )
{
LPDWORD lpHdrInfo = (LPDWORD)NS_GetNSAddr( lpNSInfo );
LPDWORD lpHdrInfo = NS_GetNSAddr( lpNSInfo );
return lpHdrInfo[1];
}
/* Get the magic number associated with the non NS end */
DWORD NS_GetOtherMagic( LPVOID lpNSInfo )
{
lpNSCache lpCache = (lpNSCache)lpNSInfo;
return ((LPDWORD)lpCache->lpLocalAddrHdr)[1];
}
void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize )
{
lpNSCache lpCache = (lpNSCache)lpNSInfo;
@@ -212,7 +193,7 @@ void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize )
*/
HRESULT NS_SendSessionRequestBroadcast( LPCGUID lpcGuid,
DWORD dwFlags,
LPSPINITDATA lpSpData )
const SPINITDATA *lpSpData )
{
DPSP_ENUMSESSIONSDATA data;
@@ -227,7 +208,7 @@ HRESULT NS_SendSessionRequestBroadcast( LPCGUID lpcGuid,
data.lpMessage = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
data.dwMessageSize );
data.lpISP = lpSpData->lpISP;
data.bReturnStatus = (dwFlags & DPENUMSESSIONS_RETURNSTATUS) ? TRUE : FALSE;
data.bReturnStatus = (dwFlags & DPENUMSESSIONS_RETURNSTATUS) != 0;
lpMsg = (LPDPMSG_ENUMSESSIONSREQUEST)(((BYTE*)data.lpMessage)+lpSpData->dwSPHeaderSize);
@@ -240,13 +221,13 @@ HRESULT NS_SendSessionRequestBroadcast( LPCGUID lpcGuid,
lpMsg->dwPasswordSize = 0; /* FIXME: If enumerating passwords..? */
lpMsg->dwFlags = dwFlags;
CopyMemory( &lpMsg->guidApplication, lpcGuid, sizeof( *lpcGuid ) );
lpMsg->guidApplication = *lpcGuid;
return (lpSpData->lpCB->EnumSessions)( &data );
}
/* Delete a name server node which has been allocated on the heap */
DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData )
static DPQ_DECL_DELETECB( cbDeleteNSNodeFromHeap, lpNSCacheData )
{
/* NOTE: This proc doesn't deal with the walking pointer */
@@ -381,21 +362,13 @@ void NS_ReplyToEnumSessionsRequest( LPCVOID lpcMsg,
DWORD dwVariableSize;
DWORD dwVariableLen;
/* LPCDPMSG_ENUMSESSIONSREQUEST msg = (LPDPMSG_ENUMSESSIONSREQUEST)lpcMsg; */
BOOL bAnsi = TRUE; /* FIXME: This needs to be in the DPLAY interface */
FIXME( ": few fixed + need to check request for response\n" );
if (bAnsi)
{
dwVariableLen = MultiByteToWideChar( CP_ACP, 0,
lpDP->dp2->lpSessionDesc->lpszSessionNameA,
-1, NULL, 0 );
}
else
{
dwVariableLen = strlenW( lpDP->dp2->lpSessionDesc->lpszSessionName ) + 1;
}
/* FIXME: Should handle ANSI or WIDECHAR input. Currently just ANSI input */
FIXME( ": few fixed + need to check request for response, might need UNICODE input ability.\n" );
dwVariableLen = MultiByteToWideChar( CP_ACP, 0,
lpDP->dp2->lpSessionDesc->u1.lpszSessionNameA,
-1, NULL, 0 );
dwVariableSize = dwVariableLen * sizeof( WCHAR );
*lpdwReplySize = lpDP->dp2->spData.dwSPHeaderSize +
@@ -411,15 +384,8 @@ void NS_ReplyToEnumSessionsRequest( LPCVOID lpcMsg,
rmsg->envelope.wVersion = DPMSGVER_DP6;
CopyMemory( &rmsg->sd, lpDP->dp2->lpSessionDesc,
sizeof( lpDP->dp2->lpSessionDesc->dwSize ) );
lpDP->dp2->lpSessionDesc->dwSize );
rmsg->dwUnknown = 0x0000005c;
if( bAnsi )
{
MultiByteToWideChar( CP_ACP, 0, lpDP->dp2->lpSessionDesc->lpszSessionNameA, -1,
(LPWSTR)(rmsg+1), dwVariableLen );
}
else
{
strcpyW( (LPWSTR)(rmsg+1), lpDP->dp2->lpSessionDesc->lpszSessionName );
}
MultiByteToWideChar( CP_ACP, 0, lpDP->dp2->lpSessionDesc->u1.lpszSessionNameA, -1,
(LPWSTR)(rmsg+1), dwVariableLen );
}
+15 -17
View File
@@ -13,7 +13,7 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DPLAYX_NAMESERVER
@@ -28,34 +28,32 @@
#include "dplayx_messages.h"
//#include "dplay_global.h"
void NS_SetLocalComputerAsNameServer( LPCDPSESSIONDESC2 lpsd, LPVOID lpNSInfo );
void NS_SetRemoteComputerAsNameServer( LPCDPSESSIONDESC2 lpsd, LPVOID lpNSInfo );
void NS_SetLocalComputerAsNameServer( LPCDPSESSIONDESC2 lpsd, LPVOID lpNSInfo ) DECLSPEC_HIDDEN;
void NS_AddRemoteComputerAsNameServer( LPCVOID lpNSAddrHdr,
DWORD dwHdrSize,
LPDPMSG_ENUMSESSIONSREPLY lpMsg,
LPVOID lpNSInfo );
LPVOID NS_GetNSAddr( LPVOID lpNSInfo );
DWORD NS_GetNsMagic( LPVOID lpNSInfo );
DWORD NS_GetOtherMagic( LPVOID lpNSInfo );
void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize );
LPCDPMSG_ENUMSESSIONSREPLY lpcMsg,
LPVOID lpNSInfo ) DECLSPEC_HIDDEN;
LPVOID NS_GetNSAddr( LPVOID lpNSInfo ) DECLSPEC_HIDDEN;
DWORD NS_GetNsMagic( LPVOID lpNSInfo ) DECLSPEC_HIDDEN;
void NS_SetLocalAddr( LPVOID lpNSInfo, LPCVOID lpHdr, DWORD dwHdrSize ) DECLSPEC_HIDDEN;
void NS_ReplyToEnumSessionsRequest( LPCVOID lpcMsg,
LPVOID* lplpReplyData,
LPDWORD lpdwReplySize,
IDirectPlay2Impl* lpDP );
IDirectPlay2Impl* lpDP ) DECLSPEC_HIDDEN;
HRESULT NS_SendSessionRequestBroadcast( LPCGUID lpcGuid,
DWORD dwFlags,
LPSPINITDATA lpSpData );
const SPINITDATA *lpSpData ) DECLSPEC_HIDDEN;
BOOL NS_InitializeSessionCache( LPVOID* lplpNSInfo );
void NS_DeleteSessionCache( LPVOID lpNSInfo );
void NS_InvalidateSessionCache( LPVOID lpNSInfo );
BOOL NS_InitializeSessionCache( LPVOID* lplpNSInfo ) DECLSPEC_HIDDEN;
void NS_DeleteSessionCache( LPVOID lpNSInfo ) DECLSPEC_HIDDEN;
void NS_InvalidateSessionCache( LPVOID lpNSInfo ) DECLSPEC_HIDDEN;
void NS_ResetSessionEnumeration( LPVOID lpNSInfo );
LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo );
void NS_PruneSessionCache( LPVOID lpNSInfo );
void NS_ResetSessionEnumeration( LPVOID lpNSInfo ) DECLSPEC_HIDDEN;
LPDPSESSIONDESC2 NS_WalkSessions( LPVOID lpNSInfo ) DECLSPEC_HIDDEN;
void NS_PruneSessionCache( LPVOID lpNSInfo ) DECLSPEC_HIDDEN;
#endif /* __WINE_DPLAYX_NAMESERVER */
-560
View File
@@ -1,560 +0,0 @@
/*
* self-registerable dll functions for dplayx.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#include <stdarg.h>
//#include <string.h>
#include <windef.h>
#include <winbase.h>
//#include "winuser.h"
#include <winreg.h>
//#include "winerror.h"
//#include "dplay.h"
#include <dplobby.h>
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(dplayx);
/*
* 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 progid; /* can be NULL to omit */
LPCSTR viprogid; /* can be NULL to omit */
LPCSTR progid_extra; /* 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 curver_keyname[7] = {
'C', 'u', 'r', 'V', 'e', 'r', 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 WCHAR const viprogid_keyname[25] = {
'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p',
'e', 'n', 'd', 'e', 'n', 't', '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);
static LONG register_progid(WCHAR const *clsid,
char const *progid, char const *curver_progid,
char const *name, char const *extra);
static LONG recursive_delete_key(HKEY key);
static LONG recursive_delete_keyA(HKEY base, char const *name);
static LONG recursive_delete_keyW(HKEY base, WCHAR const *name);
/***********************************************************************
* 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) {
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) {
register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid);
if (res != ERROR_SUCCESS) goto error_close_iid_key;
}
if (list->ps_clsid32) {
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 = recursive_delete_keyW(interface_key, buf);
}
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->progid) {
res = register_key_defvalueA(clsid_key, progid_keyname,
list->progid);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
res = register_progid(buf, list->progid, NULL,
list->name, list->progid_extra);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
}
if (list->viprogid) {
res = register_key_defvalueA(clsid_key, viprogid_keyname,
list->viprogid);
if (res != ERROR_SUCCESS) goto error_close_clsid_key;
res = register_progid(buf, list->viprogid, list->progid,
list->name, list->progid_extra);
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 = recursive_delete_keyW(coclass_key, buf);
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
if (list->progid) {
res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->progid);
if (res != ERROR_SUCCESS) goto error_close_coclass_key;
}
if (list->viprogid) {
res = recursive_delete_keyA(HKEY_CLASSES_ROOT, list->viprogid);
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;
}
/***********************************************************************
* regsvr_progid
*/
static LONG register_progid(
WCHAR const *clsid,
char const *progid,
char const *curver_progid,
char const *name,
char const *extra)
{
LONG res;
HKEY progid_key;
res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0,
NULL, 0, KEY_READ | KEY_WRITE, NULL,
&progid_key, NULL);
if (res != ERROR_SUCCESS) return res;
if (name) {
res = RegSetValueExA(progid_key, NULL, 0, REG_SZ,
(CONST BYTE*)name, strlen(name) + 1);
if (res != ERROR_SUCCESS) goto error_close_progid_key;
}
if (clsid) {
res = register_key_defvalueW(progid_key, clsid_keyname, clsid);
if (res != ERROR_SUCCESS) goto error_close_progid_key;
}
if (curver_progid) {
res = register_key_defvalueA(progid_key, curver_keyname,
curver_progid);
if (res != ERROR_SUCCESS) goto error_close_progid_key;
}
if (extra) {
HKEY extra_key;
res = RegCreateKeyExA(progid_key, extra, 0,
NULL, 0, KEY_READ | KEY_WRITE, NULL,
&extra_key, NULL);
if (res == ERROR_SUCCESS)
RegCloseKey(extra_key);
}
error_close_progid_key:
RegCloseKey(progid_key);
return res;
}
/***********************************************************************
* recursive_delete_key
*/
static LONG recursive_delete_key(HKEY key)
{
LONG res;
WCHAR subkey_name[MAX_PATH];
DWORD cName;
HKEY subkey;
for (;;) {
cName = sizeof(subkey_name) / sizeof(WCHAR);
res = RegEnumKeyExW(key, 0, subkey_name, &cName,
NULL, NULL, NULL, NULL);
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) {
res = ERROR_SUCCESS; /* presumably we're done enumerating */
break;
}
res = RegOpenKeyExW(key, subkey_name, 0,
KEY_READ | KEY_WRITE, &subkey);
if (res == ERROR_FILE_NOT_FOUND) continue;
if (res != ERROR_SUCCESS) break;
res = recursive_delete_key(subkey);
RegCloseKey(subkey);
if (res != ERROR_SUCCESS) break;
}
if (res == ERROR_SUCCESS) res = RegDeleteKeyW(key, 0);
return res;
}
/***********************************************************************
* recursive_delete_keyA
*/
static LONG recursive_delete_keyA(HKEY base, char const *name)
{
LONG res;
HKEY key;
res = RegOpenKeyExA(base, name, 0, KEY_READ | KEY_WRITE, &key);
if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
if (res != ERROR_SUCCESS) return res;
res = recursive_delete_key(key);
RegCloseKey(key);
return res;
}
/***********************************************************************
* recursive_delete_keyW
*/
static LONG recursive_delete_keyW(HKEY base, WCHAR const *name)
{
LONG res;
HKEY key;
res = RegOpenKeyExW(base, name, 0, KEY_READ | KEY_WRITE, &key);
if (res == ERROR_FILE_NOT_FOUND) return ERROR_SUCCESS;
if (res != ERROR_SUCCESS) return res;
res = recursive_delete_key(key);
RegCloseKey(key);
return res;
}
/***********************************************************************
* coclass list
*/
static struct regsvr_coclass const coclass_list[] = {
{ &CLSID_DirectPlay,
"DirectPlay Object",
NULL,
"dplayx.dll",
"Both"
},
{ &CLSID_DirectPlayLobby,
"DirectPlayLobby Object",
NULL,
"dplayx.dll",
"Both"
},
{ NULL } /* list terminator */
};
/***********************************************************************
* interface list
*/
static struct regsvr_interface const interface_list[] = {
{ NULL } /* list terminator */
};
/***********************************************************************
* DllRegisterServer (DPLAYX.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
HRESULT hr;
TRACE("\n");
hr = register_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = register_interfaces(interface_list);
return hr;
}
/***********************************************************************
* DllUnregisterServer (DPLAYX.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
HRESULT hr;
TRACE("\n");
hr = unregister_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = unregister_interfaces(interface_list);
return hr;
}
+9 -7
View File
@@ -13,15 +13,17 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define WINE_OLESELFREGISTER
1 WINE_REGISTRY dplayx.rgs
#define WINE_FILEDESCRIPTION_STR "Wine DirectPlay"
#define WINE_FILENAME_STR "dplayx.dll"
#define WINE_FILEVERSION 5,3,0,900
#define WINE_FILEVERSION_STR "5.3.0.900"
#define WINE_PRODUCTVERSION 5,3,0,900
#define WINE_PRODUCTVERSION_STR "5.3"
#define WINE_FILEVERSION 5,3,1,904
#define WINE_FILEVERSION_STR "5.3.1.904"
#define WINE_PRODUCTVERSION 5,3,1,904
#define WINE_PRODUCTVERSION_STR "5.3.1.904"
#define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
#include "wine/wine_common_ver.rc"
#include <wine/wine_common_ver.rc>
+7 -7
View File
@@ -21,7 +21,7 @@ if((ARCH STREQUAL "i386") AND (NOT MSVC))
x86/common_x86.c
# x86/x86_xform.c
# x86/3dnow.c
# x86/sse.c
x86/sse.c
x86/common_x86_asm.S
x86/x86_xform2.S
x86/x86_xform3.S
@@ -33,17 +33,17 @@ if((ARCH STREQUAL "i386") AND (NOT MSVC))
x86/3dnow_xform3.S
x86/3dnow_xform4.S
x86/3dnow_normal.S
# x86/sse_xform1.S
# x86/sse_xform2.S
# x86/sse_xform3.S
# x86/sse_xform4.S
# x86/sse_normal.S
x86/sse_xform1.S
x86/sse_xform2.S
x86/sse_xform3.S
x86/sse_xform4.S
x86/sse_normal.S
x86/read_rgba_span_x86.S)
add_definitions(
-DUSE_X86_ASM
-DUSE_MMX_ASM
-DUSE_3DNOW_ASM
# -DUSE_SSE_ASM
-DUSE_SSE_ASM
)
endif()
+1 -1
View File
@@ -278,7 +278,7 @@ static HCERTCHAINENGINE CRYPTDLG_MakeEngine(CERT_VERIFY_CERTIFICATE_TRUST *cert)
{
trust = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0,
CERT_STORE_CREATE_NEW_FLAG, NULL);
if (root)
if (trust)
{
for (i = 0; i < cert->cTrustStores; i++)
CertAddStoreToCollection(trust, cert->rghstoreTrust[i], 0, 0);
-3
View File
@@ -27,8 +27,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(cryptdll);
static HMODULE CRYPTDLL_hModule;
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
@@ -39,7 +37,6 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
case DLL_PROCESS_ATTACH:
{
DisableThreadLibraryCalls(hinstDLL);
CRYPTDLL_hModule = hinstDLL;
break;
}
case DLL_PROCESS_DETACH:
+59 -85
View File
@@ -44,22 +44,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(cryptnet);
#define IS_INTOID(x) (((ULONG_PTR)(x) >> 16) == 0)
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
break;
case DLL_PROCESS_DETACH:
/* Do uninitialisation here */
break;
default: break;
}
return TRUE;
}
static const WCHAR cryptNet[] = { 'c','r','y','p','t','n','e','t','.',
'd','l','l',0 };
@@ -521,24 +505,26 @@ static BOOL CRYPT_GetObjectFromCache(LPCWSTR pszURL, PCRYPT_BLOB_ARRAY pObject,
TRACE("(%s, %p, %p)\n", debugstr_w(pszURL), pObject, pAuxInfo);
ret = GetUrlCacheEntryInfoW(pszURL, NULL, &size);
if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
RetrieveUrlCacheEntryFileW(pszURL, NULL, &size, 0);
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
return FALSE;
pCacheInfo = CryptMemAlloc(size);
if (!pCacheInfo)
{
pCacheInfo = CryptMemAlloc(size);
if (pCacheInfo)
ret = TRUE;
else
SetLastError(ERROR_OUTOFMEMORY);
SetLastError(ERROR_OUTOFMEMORY);
return FALSE;
}
if (ret && (ret = GetUrlCacheEntryInfoW(pszURL, pCacheInfo, &size)))
if ((ret = RetrieveUrlCacheEntryFileW(pszURL, pCacheInfo, &size, 0)))
{
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
if (CompareFileTime(&pCacheInfo->ExpireTime, &ft) >= 0)
{
HANDLE hFile = CreateFileW(pCacheInfo->lpszLocalFileName,
GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
HANDLE hFile = CreateFileW(pCacheInfo->lpszLocalFileName, GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
@@ -565,6 +551,7 @@ static BOOL CRYPT_GetObjectFromCache(LPCWSTR pszURL, PCRYPT_BLOB_ARRAY pObject,
DeleteUrlCacheEntryW(pszURL);
ret = FALSE;
}
UnlockUrlCacheEntryFileW(pszURL, 0);
}
CryptMemFree(pCacheInfo);
TRACE("returning %d\n", ret);
@@ -733,21 +720,24 @@ static void CRYPT_CacheURL(LPCWSTR pszURL, const CRYPT_BLOB_ARRAY *pObject,
DWORD dwRetrievalFlags, FILETIME expires)
{
WCHAR cacheFileName[MAX_PATH];
DWORD size = 0;
BOOL ret, create = FALSE;
HANDLE hCacheFile;
DWORD size = 0, entryType;
FILETIME ft;
GetUrlCacheEntryInfoW(pszURL, NULL, &size);
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
INTERNET_CACHE_ENTRY_INFOW *info = CryptMemAlloc(size);
if (info)
if (!info)
{
FILETIME ft;
ERR("out of memory\n");
return;
}
ret = GetUrlCacheEntryInfoW(pszURL, info, &size);
if (ret)
lstrcpyW(cacheFileName, info->lpszLocalFileName);
if (GetUrlCacheEntryInfoW(pszURL, info, &size))
{
lstrcpyW(cacheFileName, info->lpszLocalFileName);
/* Check if the existing cache entry is up to date. If it isn't,
* remove the existing cache entry, and create a new one with the
* new value.
@@ -755,51 +745,38 @@ static void CRYPT_CacheURL(LPCWSTR pszURL, const CRYPT_BLOB_ARRAY *pObject,
GetSystemTimeAsFileTime(&ft);
if (CompareFileTime(&info->ExpireTime, &ft) < 0)
{
create = TRUE;
DeleteUrlCacheEntryW(pszURL);
}
CryptMemFree(info);
}
else
ret = FALSE;
}
else
{
ret = CreateUrlCacheEntryW(pszURL, pObject->rgBlob[0].cbData, NULL,
cacheFileName, 0);
create = TRUE;
}
if (ret)
{
DWORD entryType;
FILETIME ft = { 0 };
if (create)
{
HANDLE hCacheFile = CreateFileW(cacheFileName, GENERIC_WRITE, 0,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hCacheFile != INVALID_HANDLE_VALUE)
else
{
DWORD bytesWritten;
WriteFile(hCacheFile, pObject->rgBlob[0].pbData,
pObject->rgBlob[0].cbData, &bytesWritten, NULL);
CloseHandle(hCacheFile);
info->ExpireTime = expires;
SetUrlCacheEntryInfoW(pszURL, info, CACHE_ENTRY_EXPTIME_FC);
CryptMemFree(info);
return;
}
else
ret = FALSE;
}
if (ret)
{
if (!(dwRetrievalFlags & CRYPT_STICKY_CACHE_RETRIEVAL))
entryType = NORMAL_CACHE_ENTRY;
else
entryType = STICKY_CACHE_ENTRY;
CommitUrlCacheEntryW(pszURL, cacheFileName, expires, ft, entryType,
NULL, 0, NULL, NULL);
}
CryptMemFree(info);
}
if (!CreateUrlCacheEntryW(pszURL, pObject->rgBlob[0].cbData, NULL, cacheFileName, 0))
return;
hCacheFile = CreateFileW(cacheFileName, GENERIC_WRITE, 0,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(hCacheFile == INVALID_HANDLE_VALUE)
return;
WriteFile(hCacheFile, pObject->rgBlob[0].pbData,
pObject->rgBlob[0].cbData, &size, NULL);
CloseHandle(hCacheFile);
if (!(dwRetrievalFlags & CRYPT_STICKY_CACHE_RETRIEVAL))
entryType = NORMAL_CACHE_ENTRY;
else
entryType = STICKY_CACHE_ENTRY;
memset(&ft, 0, sizeof(ft));
CommitUrlCacheEntryW(pszURL, cacheFileName, expires, ft, entryType,
NULL, 0, NULL, NULL);
}
static void CALLBACK CRYPT_InetStatusCallback(HINTERNET hInt,
@@ -966,18 +943,15 @@ static BOOL WINAPI HTTP_RetrieveEncodedObjectW(LPCWSTR pszURL,
else
ret = TRUE;
}
/* We don't set ret to TRUE in this block to avoid masking
* an error from HttpSendRequestExW.
*/
if (!HttpEndRequestW(hHttp, NULL, 0, (DWORD_PTR)context) &&
if (ret &&
!(ret = HttpEndRequestW(hHttp, NULL, 0, (DWORD_PTR)context)) &&
GetLastError() == ERROR_IO_PENDING)
{
if (WaitForSingleObject(context->event,
context->timeout) == WAIT_TIMEOUT)
{
SetLastError(ERROR_TIMEOUT);
ret = FALSE;
}
else
ret = TRUE;
}
if (ret)
ret = CRYPT_DownloadObject(dwRetrievalFlags, hHttp,
@@ -1056,8 +1030,8 @@ static BOOL WINAPI File_RetrieveEncodedObjectW(LPCWSTR pszURL,
/* Try to create the file directly - Wine handles / in pathnames */
lstrcpynW(path, components.lpszUrlPath,
components.dwUrlPathLength + 1);
hFile = CreateFileW(path, GENERIC_READ, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
/* Try again on the current drive */
@@ -1066,8 +1040,8 @@ static BOOL WINAPI File_RetrieveEncodedObjectW(LPCWSTR pszURL,
{
lstrcpynW(path + 2, components.lpszUrlPath,
components.dwUrlPathLength + 1);
hFile = CreateFileW(path, GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}
if (hFile == INVALID_HANDLE_VALUE)
{
@@ -1077,8 +1051,8 @@ static BOOL WINAPI File_RetrieveEncodedObjectW(LPCWSTR pszURL,
{
lstrcpynW(path + 2, components.lpszUrlPath,
components.dwUrlPathLength + 1);
hFile = CreateFileW(path, GENERIC_READ, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}
}
}
+5 -9
View File
@@ -299,7 +299,7 @@ static CERT_ENHKEY_USAGE *convert_usages_str_to_usage(LPSTR usageStr)
{
if (comma)
*comma = 0;
add_oid_to_usage(usage, ptr);
usage = add_oid_to_usage(usage, ptr);
}
}
return usage;
@@ -327,7 +327,7 @@ static CERT_ENHKEY_USAGE *create_advanced_filter(void)
{
PCCRYPT_OID_INFO *ptr;
for (ptr = usages; *ptr; ptr++)
for (ptr = usages; advancedUsage && *ptr; ptr++)
{
DWORD i;
BOOL disabled = FALSE;
@@ -338,7 +338,7 @@ static CERT_ENHKEY_USAGE *create_advanced_filter(void)
(*ptr)->pszOID))
disabled = TRUE;
if (!disabled)
add_oid_to_usage(advancedUsage,
advancedUsage = add_oid_to_usage(advancedUsage,
(LPSTR)(*ptr)->pszOID);
}
/* The individual strings are pointers to disabledUsagesStr,
@@ -1808,7 +1808,6 @@ static void add_icon_to_control(HWND hwnd, int id)
DWORD conn;
LPDATAOBJECT dataObject = NULL;
HBITMAP bitmap = NULL;
RECT rect;
STGMEDIUM stgm;
LPOLECLIENTSITE clientSite = NULL;
REOBJECT reObject;
@@ -1847,9 +1846,6 @@ static void add_icon_to_control(HWND hwnd, int id)
LR_DEFAULTSIZE | LR_LOADTRANSPARENT);
if (!bitmap)
goto end;
rect.left = rect.top = 0;
rect.right = GetSystemMetrics(SM_CXICON);
rect.bottom = GetSystemMetrics(SM_CYICON);
stgm.tymed = TYMED_GDI;
stgm.u.hBitmap = bitmap;
stgm.pUnkForRelease = NULL;
@@ -2844,7 +2840,7 @@ static const struct v1_field v1_fields[] = {
static void add_v1_fields(HWND hwnd, struct detail_data *data)
{
int i;
unsigned int i;
PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext;
/* The last item in v1_fields is the public key, which is not in the loop
@@ -3776,7 +3772,7 @@ static void show_edit_cert_properties_dialog(HWND parent,
static void free_detail_fields(struct detail_data *data)
{
DWORD i;
int i;
for (i = 0; i < data->cFields; i++)
HeapFree(GetProcessHeap(), 0, data->fields[i].detailed_value);
+4 -15
View File
@@ -12,28 +12,17 @@ add_library(hhctrl SHARED
help.c
hhctrl.c
index.c
regsvr.c
search.c
stream.c
webbrowser.c
hhctrl.rc
hhctrl.rc
${CMAKE_CURRENT_BINARY_DIR}/hhctrl.def)
add_typelib(hhctrl_tlb.idl)
set_source_files_properties(hhctrl.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/hhctrl_tlb.tlb)
set_module_type(hhctrl win32ocx)
target_link_libraries(hhctrl uuid wine itss_guid)
add_importlibs(hhctrl
advapi32
comctl32
shlwapi
ole32
oleaut32
user32
gdi32
msvcrt
kernel32
ntdll)
add_importlibs(hhctrl advapi32 comctl32 shlwapi ole32 oleaut32 user32 gdi32 msvcrt kernel32 ntdll)
add_dependencies(hhctrl wineheaders)
add_pch(hhctrl hhctrl.h)
add_cd_file(TARGET hhctrl DESTINATION reactos/system32 FOR all)
+242 -53
View File
@@ -20,6 +20,7 @@
*/
#include "hhctrl.h"
#include "stream.h"
#include <winreg.h>
#include <shlwapi.h>
@@ -27,10 +28,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
#define BLOCK_BITS 12
#define BLOCK_SIZE (1 << BLOCK_BITS)
#define BLOCK_MASK (BLOCK_SIZE-1)
/* Reads a string from the #STRINGS section in the CHM file */
static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
{
@@ -133,11 +130,21 @@ static BOOL ReadChmSystem(CHMInfo *chm)
heap_free(chm->defTitle);
chm->defTitle = strdupnAtoW(buf, entry.len);
break;
case 0x4:
/* TODO: Currently only the Locale ID is loaded from this field */
TRACE("Locale is: %d\n", *(LCID*)&buf[0]);
if(!GetLocaleInfoW(*(LCID*)&buf[0], LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER,
(WCHAR *)&chm->codePage, sizeof(chm->codePage)/sizeof(WCHAR)))
chm->codePage = CP_ACP;
break;
case 0x5:
TRACE("Default window is %s\n", debugstr_an(buf, entry.len));
TRACE("Window name is %s\n", debugstr_an(buf, entry.len));
chm->defWindow = strdupnAtoW(buf, entry.len);
break;
case 0x6:
TRACE("Compiled file is %s\n", debugstr_an(buf, entry.len));
heap_free(chm->compiledFile);
chm->compiledFile = strdupnAtoW(buf, entry.len);
break;
case 0x9:
TRACE("Version is %s\n", debugstr_an(buf, entry.len));
@@ -209,6 +216,107 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
return strdupAtoW(ret);
}
/*
* Tests if the file <chmfile>.<ext> exists, used for loading Indices, Table of Contents, etc.
* when these files are not available from the HH_WINTYPE structure.
*/
static WCHAR *FindHTMLHelpSetting(HHInfo *info, const WCHAR *extW)
{
static const WCHAR periodW[] = {'.',0};
IStorage *pStorage = info->pCHMInfo->pStorage;
IStream *pStream;
WCHAR *filename;
HRESULT hr;
filename = heap_alloc( (strlenW(info->pCHMInfo->compiledFile)
+ strlenW(periodW) + strlenW(extW) + 1) * sizeof(WCHAR) );
strcpyW(filename, info->pCHMInfo->compiledFile);
strcatW(filename, periodW);
strcatW(filename, extW);
hr = IStorage_OpenStream(pStorage, filename, NULL, STGM_READ, 0, &pStream);
if (FAILED(hr))
{
heap_free(filename);
return strdupAtoW("");
}
IStream_Release(pStream);
return filename;
}
static inline WCHAR *MergeChmString(LPCWSTR src, WCHAR **dst)
{
if(*dst == NULL)
*dst = strdupW(src);
return *dst;
}
void MergeChmProperties(HH_WINTYPEW *src, HHInfo *info, BOOL override)
{
DWORD unhandled_params = src->fsValidMembers & ~(HHWIN_PARAM_PROPERTIES|HHWIN_PARAM_STYLES
|HHWIN_PARAM_EXSTYLES|HHWIN_PARAM_RECT|HHWIN_PARAM_NAV_WIDTH
|HHWIN_PARAM_SHOWSTATE|HHWIN_PARAM_INFOTYPES|HHWIN_PARAM_TB_FLAGS
|HHWIN_PARAM_EXPANSION|HHWIN_PARAM_TABPOS|HHWIN_PARAM_TABORDER
|HHWIN_PARAM_HISTORY_COUNT|HHWIN_PARAM_CUR_TAB);
HH_WINTYPEW *dst = &info->WinType;
DWORD merge = override ? src->fsValidMembers : src->fsValidMembers & ~dst->fsValidMembers;
if (unhandled_params)
FIXME("Unsupported fsValidMembers fields: 0x%x\n", unhandled_params);
dst->fsValidMembers |= merge;
if (dst->cbStruct == 0)
{
/* If the structure has not been filled in yet then use all of the values */
dst->cbStruct = sizeof(HH_WINTYPEW);
merge = ~0;
}
if (merge & HHWIN_PARAM_PROPERTIES) dst->fsWinProperties = src->fsWinProperties;
if (merge & HHWIN_PARAM_STYLES) dst->dwStyles = src->dwStyles;
if (merge & HHWIN_PARAM_EXSTYLES) dst->dwExStyles = src->dwExStyles;
if (merge & HHWIN_PARAM_RECT) dst->rcWindowPos = src->rcWindowPos;
if (merge & HHWIN_PARAM_NAV_WIDTH) dst->iNavWidth = src->iNavWidth;
if (merge & HHWIN_PARAM_SHOWSTATE) dst->nShowState = src->nShowState;
if (merge & HHWIN_PARAM_INFOTYPES) dst->paInfoTypes = src->paInfoTypes;
if (merge & HHWIN_PARAM_TB_FLAGS) dst->fsToolBarFlags = src->fsToolBarFlags;
if (merge & HHWIN_PARAM_EXPANSION) dst->fNotExpanded = src->fNotExpanded;
if (merge & HHWIN_PARAM_TABPOS) dst->tabpos = src->tabpos;
if (merge & HHWIN_PARAM_TABORDER) memcpy(dst->tabOrder, src->tabOrder, sizeof(src->tabOrder));
if (merge & HHWIN_PARAM_HISTORY_COUNT) dst->cHistory = src->cHistory;
if (merge & HHWIN_PARAM_CUR_TAB) dst->curNavType = src->curNavType;
/*
* Note: We assume that hwndHelp, hwndCaller, hwndToolBar, hwndNavigation, and hwndHTML cannot be
* modified by the user. rcHTML and rcMinSize are not currently supported, so don't bother to copy them.
*/
dst->pszType = MergeChmString(src->pszType, &info->stringsW.pszType);
dst->pszFile = MergeChmString(src->pszFile, &info->stringsW.pszFile);
dst->pszToc = MergeChmString(src->pszToc, &info->stringsW.pszToc);
dst->pszIndex = MergeChmString(src->pszIndex, &info->stringsW.pszIndex);
dst->pszCaption = MergeChmString(src->pszCaption, &info->stringsW.pszCaption);
dst->pszHome = MergeChmString(src->pszHome, &info->stringsW.pszHome);
dst->pszJump1 = MergeChmString(src->pszJump1, &info->stringsW.pszJump1);
dst->pszJump2 = MergeChmString(src->pszJump2, &info->stringsW.pszJump2);
dst->pszUrlJump1 = MergeChmString(src->pszUrlJump1, &info->stringsW.pszUrlJump1);
dst->pszUrlJump2 = MergeChmString(src->pszUrlJump2, &info->stringsW.pszUrlJump2);
/* FIXME: pszCustomTabs is a list of multiple zero-terminated strings so ReadString won't
* work in this case
*/
#if 0
dst->pszCustomTabs = MergeChmString(src->pszCustomTabs, &info->pszCustomTabs);
#endif
}
static inline WCHAR *ConvertChmString(HHInfo *info, const WCHAR **str)
{
WCHAR *ret = NULL;
if(*str)
*str = ret = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)*str));
return ret;
}
/* Loads the HH_WINTYPE data from the CHM file
*
* FIXME: There may be more than one window type in the file, so
@@ -217,72 +325,94 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
BOOL LoadWinTypeFromCHM(HHInfo *info)
{
LARGE_INTEGER liOffset;
WCHAR *pszType = NULL, *pszFile = NULL, *pszToc = NULL, *pszIndex = NULL, *pszCaption = NULL;
WCHAR *pszHome = NULL, *pszJump1 = NULL, *pszJump2 = NULL, *pszUrlJump1 = NULL, *pszUrlJump2 = NULL;
IStorage *pStorage = info->pCHMInfo->pStorage;
IStream *pStream;
IStream *pStream = NULL;
HH_WINTYPEW wintype;
HRESULT hr;
DWORD cbRead;
BOOL ret = FALSE;
static const WCHAR null[] = {0};
static const WCHAR toc_extW[] = {'h','h','c',0};
static const WCHAR index_extW[] = {'h','h','k',0};
static const WCHAR windowsW[] = {'#','W','I','N','D','O','W','S',0};
hr = IStorage_OpenStream(pStorage, windowsW, NULL, STGM_READ, 0, &pStream);
if (FAILED(hr))
if (SUCCEEDED(hr))
{
/* jump past the #WINDOWS header */
liOffset.QuadPart = sizeof(DWORD) * 2;
hr = IStream_Seek(pStream, liOffset, STREAM_SEEK_SET, NULL);
if (FAILED(hr)) goto done;
/* read the HH_WINTYPE struct data */
hr = IStream_Read(pStream, &wintype, sizeof(wintype), &cbRead);
if (FAILED(hr)) goto done;
/* convert the #STRINGS offsets to actual strings */
pszType = ConvertChmString(info, &wintype.pszType);
pszFile = ConvertChmString(info, &wintype.pszFile);
pszToc = ConvertChmString(info, &wintype.pszToc);
pszIndex = ConvertChmString(info, &wintype.pszIndex);
pszCaption = ConvertChmString(info, &wintype.pszCaption);
pszHome = ConvertChmString(info, &wintype.pszHome);
pszJump1 = ConvertChmString(info, &wintype.pszJump1);
pszJump2 = ConvertChmString(info, &wintype.pszJump2);
pszUrlJump1 = ConvertChmString(info, &wintype.pszUrlJump1);
pszUrlJump2 = ConvertChmString(info, &wintype.pszUrlJump2);
}
else
{
/* no defined window types so use (hopefully) sane defaults */
static const WCHAR defaultwinW[] = {'d','e','f','a','u','l','t','w','i','n','\0'};
static const WCHAR null[] = {0};
memset((void*)&(info->WinType), 0, sizeof(info->WinType));
info->WinType.cbStruct=sizeof(info->WinType);
info->WinType.fUniCodeStrings=TRUE;
info->WinType.pszType=strdupW(defaultwinW);
info->WinType.pszToc = strdupW(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : null);
info->WinType.pszIndex = strdupW(null);
info->WinType.fsValidMembers=0;
info->WinType.fsWinProperties=HHWIN_PROP_TRI_PANE;
info->WinType.pszCaption=strdupW(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : null);
info->WinType.dwStyles=WS_POPUP;
info->WinType.dwExStyles=0;
info->WinType.nShowState=SW_SHOW;
info->WinType.pszFile=strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : null);
info->WinType.curNavType=HHWIN_NAVTYPE_TOC;
return TRUE;
memset(&wintype, 0, sizeof(wintype));
wintype.cbStruct = sizeof(wintype);
wintype.fUniCodeStrings = TRUE;
wintype.pszType = pszType = strdupW(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : defaultwinW);
wintype.pszToc = pszToc = strdupW(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : null);
wintype.pszIndex = pszIndex = strdupW(null);
wintype.fsValidMembers = 0;
wintype.fsWinProperties = HHWIN_PROP_TRI_PANE;
wintype.dwStyles = WS_POPUP;
wintype.dwExStyles = 0;
wintype.nShowState = SW_SHOW;
wintype.curNavType = HHWIN_NAVTYPE_TOC;
}
/* jump past the #WINDOWS header */
liOffset.QuadPart = sizeof(DWORD) * 2;
/* merge the new data with any pre-existing HH_WINTYPE structure */
MergeChmProperties(&wintype, info, FALSE);
if (!info->WinType.pszCaption)
info->WinType.pszCaption = info->stringsW.pszCaption = strdupW(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : null);
if (!info->WinType.pszFile)
info->WinType.pszFile = info->stringsW.pszFile = strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : null);
if (!info->WinType.pszToc)
info->WinType.pszToc = info->stringsW.pszToc = FindHTMLHelpSetting(info, toc_extW);
if (!info->WinType.pszIndex)
info->WinType.pszIndex = info->stringsW.pszIndex = FindHTMLHelpSetting(info, index_extW);
hr = IStream_Seek(pStream, liOffset, STREAM_SEEK_SET, NULL);
if (FAILED(hr)) goto done;
/* read the HH_WINTYPE struct data */
hr = IStream_Read(pStream, &info->WinType, sizeof(info->WinType), &cbRead);
if (FAILED(hr)) goto done;
/* convert the #STRINGS offsets to actual strings */
info->WinType.pszType = info->pszType = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszType));
info->WinType.pszCaption = info->pszCaption = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszCaption));
info->WinType.pszToc = info->pszToc = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszToc));
info->WinType.pszIndex = info->pszIndex = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszIndex));
info->WinType.pszFile = info->pszFile = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszFile));
info->WinType.pszHome = info->pszHome = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszHome));
info->WinType.pszJump1 = info->pszJump1 = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszJump1));
info->WinType.pszJump2 = info->pszJump2 = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszJump2));
info->WinType.pszUrlJump1 = info->pszUrlJump1 = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszUrlJump1));
info->WinType.pszUrlJump2 = info->pszUrlJump2 = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszUrlJump2));
/* FIXME: pszCustomTabs is a list of multiple zero-terminated strings so ReadString won't
* work in this case
*/
#if 0
info->WinType.pszCustomTabs = info->pszCustomTabs = CHM_ReadString(pChmInfo, (DWORD_PTR)info->WinType.pszCustomTabs);
#endif
heap_free(pszType);
heap_free(pszFile);
heap_free(pszToc);
heap_free(pszIndex);
heap_free(pszCaption);
heap_free(pszHome);
heap_free(pszJump1);
heap_free(pszJump2);
heap_free(pszUrlJump1);
heap_free(pszUrlJump2);
ret = TRUE;
done:
IStream_Release(pStream);
if (pStream)
IStream_Release(pStream);
return SUCCEEDED(hr);
return ret;
}
static LPCWSTR skip_schema(LPCWSTR url)
LPCWSTR skip_schema(LPCWSTR url)
{
static const WCHAR its_schema[] = {'i','t','s',':'};
static const WCHAR msits_schema[] = {'m','s','-','i','t','s',':'};
@@ -364,6 +494,62 @@ IStream *GetChmStream(CHMInfo *info, LPCWSTR parent_chm, ChmPath *chm_file)
return stream;
}
/*
* Retrieve a CHM document and parse the data from the <title> element to get the document's title.
*/
WCHAR *GetDocumentTitle(CHMInfo *info, LPCWSTR document)
{
strbuf_t node, node_name, content;
WCHAR *document_title = NULL;
IStream *str = NULL;
IStorage *storage;
stream_t stream;
HRESULT hres;
TRACE("%s\n", debugstr_w(document));
storage = info->pStorage;
if(!storage) {
WARN("Could not open storage to obtain the title for a document.\n");
return NULL;
}
IStorage_AddRef(storage);
hres = IStorage_OpenStream(storage, document, NULL, STGM_READ, 0, &str);
IStorage_Release(storage);
if(FAILED(hres))
WARN("Could not open stream: %08x\n", hres);
stream_init(&stream, str);
strbuf_init(&node);
strbuf_init(&content);
strbuf_init(&node_name);
while(next_node(&stream, &node)) {
get_node_name(&node, &node_name);
TRACE("%s\n", node.buf);
if(!strcasecmp(node_name.buf, "title")) {
if(next_content(&stream, &content) && content.len > 1)
{
document_title = strdupnAtoW(&content.buf[1], content.len-1);
FIXME("magic: %s\n", debugstr_w(document_title));
break;
}
}
strbuf_zero(&node);
}
strbuf_free(&node);
strbuf_free(&content);
strbuf_free(&node_name);
IStream_Release(str);
return document_title;
}
/* Opens the CHM file for reading */
CHMInfo *OpenCHM(LPCWSTR szFile)
{
@@ -374,6 +560,7 @@ CHMInfo *OpenCHM(LPCWSTR szFile)
if (!(ret = heap_alloc_zero(sizeof(CHMInfo))))
return NULL;
ret->codePage = CP_ACP;
if (!(ret->szFile = strdupW(szFile))) {
heap_free(ret);
@@ -427,10 +614,12 @@ CHMInfo *CloseCHM(CHMInfo *chm)
}
heap_free(chm->strings);
heap_free(chm->defWindow);
heap_free(chm->defTitle);
heap_free(chm->defTopic);
heap_free(chm->defToc);
heap_free(chm->szFile);
heap_free(chm->compiledFile);
heap_free(chm);
return NULL;
+38 -8
View File
@@ -1,5 +1,6 @@
/*
* Copyright 2007 Jacek Caban for CodeWeavers
* Copyright 2011 Owen Rudge for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,6 +22,7 @@
#include "hhctrl.h"
#include "stream.h"
#include "resource.h"
#include <wine/debug.h>
@@ -49,11 +51,11 @@ static void free_content_item(ContentItem *item)
}
}
static void parse_obj_node_param(ContentItem *item, ContentItem *hhc_root, const char *text)
static void parse_obj_node_param(ContentItem *item, ContentItem *hhc_root, const char *text, UINT code_page)
{
const char *ptr;
LPWSTR *param, merge;
int len, wlen;
int len;
ptr = get_attr(text, "name", &len);
if(!ptr) {
@@ -78,10 +80,21 @@ static void parse_obj_node_param(ContentItem *item, ContentItem *hhc_root, const
return;
}
wlen = MultiByteToWideChar(CP_ACP, 0, ptr, len, NULL, 0);
*param = heap_alloc((wlen+1)*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, ptr, len, *param, wlen);
(*param)[wlen] = 0;
/*
* "merge" parameter data (referencing another CHM file) can be incorporated into the "local" parameter
* by specifying the filename in the format:
* MS-ITS:file.chm::/local_path.htm
*/
if(param == &item->local && strstr(ptr, "::"))
{
const char *local = strstr(ptr, "::")+2;
int local_len = len-(local-ptr);
item->local = decode_html(local, local_len, code_page);
param = &merge;
}
*param = decode_html(ptr, len, code_page);
if(param == &merge) {
SetChmPath(&item->merge, hhc_root->merge.chm_file, merge);
@@ -139,7 +152,7 @@ static ContentItem *parse_sitemap_object(HHInfo *info, stream_t *stream, Content
if(!strcasecmp(node_name.buf, "/object"))
break;
if(!strcasecmp(node_name.buf, "param"))
parse_obj_node_param(item, hhc_root, node.buf);
parse_obj_node_param(item, hhc_root, node.buf, info->pCHMInfo->codePage);
strbuf_zero(&node);
}
@@ -255,10 +268,12 @@ static void insert_content_item(HWND hwnd, ContentItem *parent, ContentItem *ite
TVINSERTSTRUCTW tvis;
memset(&tvis, 0, sizeof(tvis));
tvis.u.item.mask = TVIF_TEXT|TVIF_PARAM;
tvis.u.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
tvis.u.item.cchTextMax = strlenW(item->name)+1;
tvis.u.item.pszText = item->name;
tvis.u.item.lParam = (LPARAM)item;
tvis.u.item.iImage = item->child ? HHTV_FOLDER : HHTV_DOCUMENT;
tvis.u.item.iSelectedImage = item->child ? HHTV_FOLDER : HHTV_DOCUMENT;
tvis.hParent = parent ? parent->id : 0;
tvis.hInsertAfter = TVI_LAST;
@@ -312,3 +327,18 @@ void ReleaseContent(HHInfo *info)
{
free_content_item(info->content);
}
void ActivateContentTopic(HWND hWnd, LPCWSTR filename, ContentItem *item)
{
if (lstrcmpiW(item->local, filename) == 0)
{
SendMessageW(hWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM) item->id);
return;
}
if (item->next)
ActivateContentTopic(hWnd, filename, item->next);
if (item->child)
ActivateContentTopic(hWnd, filename, item->child);
}
File diff suppressed because it is too large Load Diff
+281 -42
View File
@@ -21,6 +21,18 @@
#include <wine/debug.h>
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "htmlhelp.h"
#include "ole2.h"
#include "rpcproxy.h"
#define INIT_GUID
#include "hhctrl.h"
@@ -29,6 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
HINSTANCE hhctrl_hinstance;
BOOL hh_process = FALSE;
extern struct list window_list;
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("(%p,%d,%p)\n", hInstance, fdwReason, lpvReserved);
@@ -86,9 +100,41 @@ static const char *command_to_string(UINT command)
#undef X
}
static BOOL resolve_filename(const WCHAR *filename, WCHAR *fullname, DWORD buflen)
static BOOL resolve_filename(const WCHAR *filename, WCHAR *fullname, DWORD buflen, WCHAR **index, WCHAR **window)
{
const WCHAR *extra;
WCHAR chm_file[MAX_PATH];
static const WCHAR helpW[] = {'\\','h','e','l','p','\\',0};
static const WCHAR delimW[] = {':',':',0};
static const WCHAR delim2W[] = {'>',0};
filename = skip_schema(filename);
/* the format is "helpFile[::/index][>window]" */
if (index) *index = NULL;
if (window) *window = NULL;
extra = strstrW(filename, delim2W);
if (extra)
{
memcpy(chm_file, filename, (extra-filename)*sizeof(WCHAR));
chm_file[extra-filename] = 0;
filename = chm_file;
if (window)
*window = strdupW(extra+1);
}
extra = strstrW(filename, delimW);
if (extra)
{
if (filename != chm_file)
memcpy(chm_file, filename, (extra-filename)*sizeof(WCHAR));
chm_file[extra-filename] = 0;
filename = chm_file;
if (index)
*index = strdupW(extra+2);
}
GetFullPathNameW(filename, buflen, fullname, NULL);
if (GetFileAttributesW(fullname) == INVALID_FILE_ATTRIBUTES)
@@ -115,64 +161,116 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
{
case HH_DISPLAY_TOPIC:
case HH_DISPLAY_TOC:
case HH_DISPLAY_INDEX:
case HH_DISPLAY_SEARCH:{
static const WCHAR delimW[] = {':',':',0};
HHInfo *info;
BOOL res;
WCHAR chm_file[MAX_PATH];
const WCHAR *index;
FIXME("Not all HH cases handled correctly\n");
NMHDR nmhdr;
HHInfo *info = NULL;
WCHAR *window = NULL;
const WCHAR *index = NULL;
WCHAR *default_index = NULL;
int tab_index = TAB_CONTENTS;
if (!filename)
return NULL;
index = strstrW(filename, delimW);
if (index)
{
memcpy(chm_file, filename, (index-filename)*sizeof(WCHAR));
chm_file[index-filename] = 0;
filename = chm_file;
index += 2; /* advance beyond "::" for calling NavigateToChm() later */
}
if (!resolve_filename(filename, fullname, MAX_PATH))
if (!resolve_filename(filename, fullname, MAX_PATH, &default_index, &window))
{
WARN("can't find %s\n", debugstr_w(filename));
return 0;
}
index = default_index;
info = CreateHelpViewer(fullname);
if (window)
info = find_window(window);
info = CreateHelpViewer(info, fullname, caller);
if(!info)
{
heap_free(default_index);
heap_free(window);
return NULL;
}
if(!index)
index = info->WinType.pszFile;
if(!info->WinType.pszType)
info->WinType.pszType = info->stringsW.pszType = window;
else
heap_free(window);
/* called to load a specified topic */
switch(command)
{
case HH_DISPLAY_TOPIC:
case HH_DISPLAY_TOC:
if (data)
index = (const WCHAR *)data;
break;
}
res = NavigateToChm(info, info->pCHMInfo->szFile, index);
heap_free(default_index);
if(!res)
{
ReleaseHelpViewer(info);
return NULL;
}
switch(command)
{
case HH_DISPLAY_TOPIC:
case HH_DISPLAY_TOC:
tab_index = TAB_CONTENTS;
break;
case HH_DISPLAY_INDEX:
tab_index = TAB_INDEX;
if (data)
FIXME("Should select keyword '%s'.\n", debugstr_w((WCHAR *)data));
break;
case HH_DISPLAY_SEARCH:
tab_index = TAB_SEARCH;
if (data)
FIXME("Should display search specified by HH_FTS_QUERY structure.\n");
break;
}
/* open the requested tab */
memset(&nmhdr, 0, sizeof(nmhdr));
nmhdr.code = TCN_SELCHANGE;
SendMessageW(info->hwndTabCtrl, TCM_SETCURSEL, (WPARAM)info->tabs[tab_index].id, 0);
SendMessageW(info->WinType.hwndNavigation, WM_NOTIFY, 0, (LPARAM)&nmhdr);
return info->WinType.hwndHelp;
}
case HH_HELP_CONTEXT: {
HHInfo *info;
WCHAR *window = NULL;
HHInfo *info = NULL;
LPWSTR url;
if (!filename)
return NULL;
if (!resolve_filename(filename, fullname, MAX_PATH))
if (!resolve_filename(filename, fullname, MAX_PATH, NULL, &window))
{
WARN("can't find %s\n", debugstr_w(filename));
return 0;
}
info = CreateHelpViewer(fullname);
if (window)
info = find_window(window);
info = CreateHelpViewer(info, fullname, caller);
if(!info)
{
heap_free(window);
return NULL;
}
if(!info->WinType.pszType)
info->WinType.pszType = info->stringsW.pszType = window;
else
heap_free(window);
url = FindContextAlias(info->pCHMInfo, data);
if(!url)
@@ -195,6 +293,67 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
}
return 0;
}
case HH_CLOSE_ALL: {
HHInfo *info, *next;
LIST_FOR_EACH_ENTRY_SAFE(info, next, &window_list, HHInfo, entry)
{
TRACE("Destroying window %s.\n", debugstr_w(info->WinType.pszType));
ReleaseHelpViewer(info);
}
return 0;
}
case HH_SET_WIN_TYPE: {
HH_WINTYPEW *wintype = (HH_WINTYPEW *)data;
WCHAR *window = NULL;
HHInfo *info = NULL;
if (!filename && wintype->pszType)
window = strdupW(wintype->pszType);
else if (!filename || !resolve_filename(filename, fullname, MAX_PATH, NULL, &window) || !window)
{
WARN("can't find window name: %s\n", debugstr_w(filename));
return 0;
}
info = find_window(window);
if (!info)
{
info = heap_alloc_zero(sizeof(HHInfo));
info->WinType.pszType = info->stringsW.pszType = window;
list_add_tail(&window_list, &info->entry);
}
else
heap_free(window);
TRACE("Changing WINTYPE, fsValidMembers=0x%x\n", wintype->fsValidMembers);
MergeChmProperties(wintype, info, TRUE);
UpdateHelpWindow(info);
return 0;
}
case HH_GET_WIN_TYPE: {
HH_WINTYPEW *wintype = (HH_WINTYPEW *)data;
WCHAR *window = NULL;
HHInfo *info = NULL;
if (!filename || !resolve_filename(filename, fullname, MAX_PATH, NULL, &window) || !window)
{
WARN("can't find window name: %s\n", debugstr_w(filename));
return 0;
}
info = find_window(window);
if (!info)
{
WARN("Could not find window named %s.\n", debugstr_w(window));
heap_free(window);
return (HWND)~0;
}
TRACE("Retrieving WINTYPE for %s.\n", debugstr_w(window));
*wintype = info->WinType;
heap_free(window);
return 0;
}
default:
FIXME("HH case %s not handled.\n", command_to_string( command ));
}
@@ -202,21 +361,47 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
return 0;
}
static void wintypeAtoW(const HH_WINTYPEA *data, HH_WINTYPEW *wdata, struct wintype_stringsW *stringsW)
{
memcpy(wdata, data, sizeof(*data));
/* convert all of the ANSI strings to Unicode */
wdata->pszType = stringsW->pszType = strdupAtoW(data->pszType);
wdata->pszCaption = stringsW->pszCaption = strdupAtoW(data->pszCaption);
wdata->pszToc = stringsW->pszToc = strdupAtoW(data->pszToc);
wdata->pszIndex = stringsW->pszIndex = strdupAtoW(data->pszIndex);
wdata->pszFile = stringsW->pszFile = strdupAtoW(data->pszFile);
wdata->pszHome = stringsW->pszHome = strdupAtoW(data->pszHome);
wdata->pszJump1 = stringsW->pszJump1 = strdupAtoW(data->pszJump1);
wdata->pszJump2 = stringsW->pszJump2 = strdupAtoW(data->pszJump2);
wdata->pszUrlJump1 = stringsW->pszUrlJump1 = strdupAtoW(data->pszUrlJump1);
wdata->pszUrlJump2 = stringsW->pszUrlJump2 = strdupAtoW(data->pszUrlJump2);
wdata->pszCustomTabs = stringsW->pszCustomTabs = strdupAtoW(data->pszCustomTabs);
}
static void wintypeWtoA(const HH_WINTYPEW *wdata, HH_WINTYPEA *data, struct wintype_stringsA *stringsA)
{
memcpy(data, wdata, sizeof(*wdata));
/* convert all of the Unicode strings to ANSI */
data->pszType = stringsA->pszType = strdupWtoA(wdata->pszType);
data->pszCaption = stringsA->pszCaption = strdupWtoA(wdata->pszCaption);
data->pszToc = stringsA->pszToc = strdupWtoA(wdata->pszToc);
data->pszIndex = stringsA->pszFile = strdupWtoA(wdata->pszIndex);
data->pszFile = stringsA->pszFile = strdupWtoA(wdata->pszFile);
data->pszHome = stringsA->pszHome = strdupWtoA(wdata->pszHome);
data->pszJump1 = stringsA->pszJump1 = strdupWtoA(wdata->pszJump1);
data->pszJump2 = stringsA->pszJump2 = strdupWtoA(wdata->pszJump2);
data->pszUrlJump1 = stringsA->pszUrlJump1 = strdupWtoA(wdata->pszUrlJump1);
data->pszUrlJump2 = stringsA->pszUrlJump2 = strdupWtoA(wdata->pszUrlJump2);
data->pszCustomTabs = stringsA->pszCustomTabs = strdupWtoA(wdata->pszCustomTabs);
}
/******************************************************************
* HtmlHelpA (HHCTRL.OCX.14)
*/
HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data)
{
WCHAR *wfile = NULL, *wdata = NULL;
DWORD len;
HWND result;
if (filename)
{
len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
wfile = heap_alloc(len*sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len );
}
WCHAR *wfile = strdupAtoW( filename );
HWND result = 0;
if (data)
{
@@ -226,22 +411,46 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
case HH_DISPLAY_SEARCH:
case HH_DISPLAY_TEXT_POPUP:
case HH_GET_LAST_ERROR:
case HH_GET_WIN_TYPE:
case HH_KEYWORD_LOOKUP:
case HH_SET_WIN_TYPE:
case HH_SYNC:
FIXME("structures not handled yet\n");
break;
case HH_SET_WIN_TYPE:
{
struct wintype_stringsW stringsW;
HH_WINTYPEW wdata;
wintypeAtoW((HH_WINTYPEA *)data, &wdata, &stringsW);
result = HtmlHelpW( caller, wfile, command, (DWORD_PTR)&wdata );
wintype_stringsW_free(&stringsW);
goto done;
}
case HH_GET_WIN_TYPE:
{
HH_WINTYPEW wdata;
HHInfo *info;
result = HtmlHelpW( caller, wfile, command, (DWORD_PTR)&wdata );
if (!wdata.pszType) break;
info = find_window(wdata.pszType);
if (!info) break;
wintype_stringsA_free(&info->stringsA);
wintypeWtoA(&wdata, (HH_WINTYPEA *)data, &info->stringsA);
goto done;
}
case HH_DISPLAY_INDEX:
case HH_DISPLAY_TOPIC:
case HH_DISPLAY_TOC:
case HH_GET_WIN_HANDLE:
case HH_SAFE_DISPLAY_TOPIC:
len = MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, NULL, 0 );
wdata = heap_alloc(len*sizeof(WCHAR));
MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, wdata, len );
break;
{
WCHAR *wdata = strdupAtoW( (const char *)data );
result = HtmlHelpW( caller, wfile, command, (DWORD_PTR)wdata );
heap_free(wdata);
goto done;
}
case HH_CLOSE_ALL:
case HH_HELP_CONTEXT:
@@ -259,10 +468,9 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
}
}
result = HtmlHelpW( caller, wfile, command, wdata ? (DWORD_PTR)wdata : data );
result = HtmlHelpW( caller, wfile, command, data );
done:
heap_free(wfile);
heap_free(wdata);
return result;
}
@@ -275,6 +483,7 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
int len, buflen, mapid = -1;
WCHAR *filename;
char *endq = NULL;
HWND hwnd;
hh_process = TRUE;
@@ -295,6 +504,9 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
ptr += strlen("mapid")+1;
space = strchr(ptr, ' ');
/* command line ends without number */
if (!space)
return 0;
memcpy(idtxt, ptr, space-ptr);
idtxt[space-ptr] = '\0';
mapid = atoi(idtxt);
@@ -315,6 +527,11 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
len = endq - szCmdLine;
else
len = strlen(szCmdLine);
/* no filename given */
if (!len)
return 0;
buflen = MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, NULL, 0) + 1;
filename = heap_alloc(buflen * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szCmdLine, len, filename, buflen);
@@ -322,12 +539,18 @@ int WINAPI doWinMain(HINSTANCE hInstance, LPSTR szCmdLine)
/* Open a specific help topic */
if(mapid != -1)
HtmlHelpW(GetDesktopWindow(), filename, HH_HELP_CONTEXT, mapid);
hwnd = HtmlHelpW(GetDesktopWindow(), filename, HH_HELP_CONTEXT, mapid);
else
HtmlHelpW(GetDesktopWindow(), filename, HH_DISPLAY_TOPIC, 0);
hwnd = HtmlHelpW(GetDesktopWindow(), filename, HH_DISPLAY_TOPIC, 0);
heap_free(filename);
if (!hwnd)
{
ERR("Failed to open HTML Help file '%s'.\n", szCmdLine);
return 0;
}
while (GetMessageW(&msg, 0, 0, 0))
{
TranslateMessage(&msg);
@@ -345,3 +568,19 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
return CLASS_E_CLASSNOTAVAILABLE;
}
/***********************************************************************
* DllRegisterServer (HHCTRL.OCX.@)
*/
HRESULT WINAPI DllRegisterServer(void)
{
return __wine_register_resources( hhctrl_hinstance );
}
/***********************************************************************
* DllUnregisterServer (HHCTRL.OCX.@)
*/
HRESULT WINAPI DllUnregisterServer(void)
{
return __wine_unregister_resources( hhctrl_hinstance );
}
+89 -33
View File
@@ -44,6 +44,7 @@
#include <wine/itss.h>
#include <wine/unicode.h>
#include <wine/list.h>
#define WB_GOBACK 0
#define WB_GOFORWARD 1
@@ -51,6 +52,7 @@
#define WB_SEARCH 3
#define WB_REFRESH 4
#define WB_STOP 5
#define WB_PRINT 6
typedef struct {
LPWSTR chm_file;
@@ -105,15 +107,20 @@ typedef struct CHMInfo
char **strings;
DWORD strings_size;
WCHAR *compiledFile;
WCHAR *defWindow;
WCHAR *defTopic;
WCHAR *defTitle;
WCHAR *defToc;
UINT codePage;
} CHMInfo;
#define TAB_CONTENTS 0
#define TAB_INDEX 1
#define TAB_SEARCH 2
#define TAB_FAVORITES 3
#define TAB_NUMTABS TAB_FAVORITES
typedef struct {
HWND hwnd;
@@ -133,6 +140,38 @@ typedef struct {
HWND hwndContainer;
} SearchTab;
typedef struct {
HIMAGELIST hImageList;
} ContentsTab;
struct wintype_stringsW {
WCHAR *pszType;
WCHAR *pszCaption;
WCHAR *pszToc;
WCHAR *pszIndex;
WCHAR *pszFile;
WCHAR *pszHome;
WCHAR *pszJump1;
WCHAR *pszJump2;
WCHAR *pszUrlJump1;
WCHAR *pszUrlJump2;
WCHAR *pszCustomTabs;
};
struct wintype_stringsA {
char *pszType;
char *pszCaption;
char *pszToc;
char *pszIndex;
char *pszFile;
char *pszHome;
char *pszJump1;
char *pszJump2;
char *pszUrlJump1;
char *pszUrlJump2;
char *pszCustomTabs;
};
typedef struct {
IOleClientSite *client_site;
IWebBrowser2 *web_browser;
@@ -140,56 +179,60 @@ typedef struct {
HH_WINTYPEW WinType;
LPWSTR pszType;
LPWSTR pszCaption;
LPWSTR pszToc;
LPWSTR pszIndex;
LPWSTR pszFile;
LPWSTR pszHome;
LPWSTR pszJump1;
LPWSTR pszJump2;
LPWSTR pszUrlJump1;
LPWSTR pszUrlJump2;
LPWSTR pszCustomTabs;
struct wintype_stringsA stringsA;
struct wintype_stringsW stringsW;
struct list entry;
CHMInfo *pCHMInfo;
ContentItem *content;
IndexItem *index;
IndexPopup popup;
SearchTab search;
ContentsTab contents;
HWND hwndTabCtrl;
HWND hwndSizeBar;
HFONT hFont;
HHTab tabs[TAB_FAVORITES+1];
int viewer_initialized;
DWORD current_tab;
} HHInfo;
BOOL InitWebBrowser(HHInfo*,HWND);
void ReleaseWebBrowser(HHInfo*);
void ResizeWebBrowser(HHInfo*,DWORD,DWORD);
void DoPageAction(HHInfo*,DWORD);
BOOL InitWebBrowser(HHInfo*,HWND) DECLSPEC_HIDDEN;
void ReleaseWebBrowser(HHInfo*) DECLSPEC_HIDDEN;
void ResizeWebBrowser(HHInfo*,DWORD,DWORD) DECLSPEC_HIDDEN;
void DoPageAction(HHInfo*,DWORD) DECLSPEC_HIDDEN;
void InitContent(HHInfo*);
void ReleaseContent(HHInfo*);
void InitContent(HHInfo*) DECLSPEC_HIDDEN;
void ReleaseContent(HHInfo*) DECLSPEC_HIDDEN;
void ActivateContentTopic(HWND,LPCWSTR,ContentItem *) DECLSPEC_HIDDEN;
void InitIndex(HHInfo*);
void ReleaseIndex(HHInfo*);
void InitIndex(HHInfo*) DECLSPEC_HIDDEN;
void ReleaseIndex(HHInfo*) DECLSPEC_HIDDEN;
CHMInfo *OpenCHM(LPCWSTR szFile);
BOOL LoadWinTypeFromCHM(HHInfo *info);
CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
void SetChmPath(ChmPath*,LPCWSTR,LPCWSTR);
IStream *GetChmStream(CHMInfo*,LPCWSTR,ChmPath*);
LPWSTR FindContextAlias(CHMInfo*,DWORD);
CHMInfo *OpenCHM(LPCWSTR szFile) DECLSPEC_HIDDEN;
BOOL LoadWinTypeFromCHM(HHInfo *info) DECLSPEC_HIDDEN;
CHMInfo *CloseCHM(CHMInfo *pCHMInfo) DECLSPEC_HIDDEN;
void SetChmPath(ChmPath*,LPCWSTR,LPCWSTR) DECLSPEC_HIDDEN;
IStream *GetChmStream(CHMInfo*,LPCWSTR,ChmPath*) DECLSPEC_HIDDEN;
LPWSTR FindContextAlias(CHMInfo*,DWORD) DECLSPEC_HIDDEN;
WCHAR *GetDocumentTitle(CHMInfo*,LPCWSTR) DECLSPEC_HIDDEN;
HHInfo *CreateHelpViewer(LPCWSTR);
void ReleaseHelpViewer(HHInfo*);
BOOL NavigateToUrl(HHInfo*,LPCWSTR);
BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
HHInfo *CreateHelpViewer(HHInfo*,LPCWSTR,HWND) DECLSPEC_HIDDEN;
void ReleaseHelpViewer(HHInfo*) DECLSPEC_HIDDEN;
BOOL NavigateToUrl(HHInfo*,LPCWSTR) DECLSPEC_HIDDEN;
BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR) DECLSPEC_HIDDEN;
void MergeChmProperties(HH_WINTYPEW*,HHInfo*,BOOL) DECLSPEC_HIDDEN;
void UpdateHelpWindow(HHInfo *info) DECLSPEC_HIDDEN;
void InitSearch(HHInfo *info, const char *needle);
void ReleaseSearch(HHInfo *info);
void InitSearch(HHInfo *info, const char *needle) DECLSPEC_HIDDEN;
void ReleaseSearch(HHInfo *info) DECLSPEC_HIDDEN;
LPCWSTR skip_schema(LPCWSTR url) DECLSPEC_HIDDEN;
void wintype_stringsA_free(struct wintype_stringsA *stringsA) DECLSPEC_HIDDEN;
void wintype_stringsW_free(struct wintype_stringsW *stringsW) DECLSPEC_HIDDEN;
WCHAR *decode_html(const char *html_fragment, int html_fragment_len, UINT code_page) DECLSPEC_HIDDEN;
HHInfo *find_window(const WCHAR *window) DECLSPEC_HIDDEN;
/* memory allocation functions */
@@ -261,9 +304,22 @@ static inline LPWSTR strdupAtoW(LPCSTR str)
return strdupnAtoW(str, -1);
}
static inline LPSTR strdupWtoA(LPCWSTR str)
{
LPSTR ret;
DWORD len;
if(!str)
return NULL;
len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
ret = heap_alloc(len);
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, len, NULL, NULL);
return ret;
}
extern HINSTANCE hhctrl_hinstance;
extern BOOL hh_process;
extern HINSTANCE hhctrl_hinstance DECLSPEC_HIDDEN;
extern BOOL hh_process DECLSPEC_HIDDEN;
#endif
+19 -4
View File
@@ -2,6 +2,7 @@
* HTML Help resources
*
* Copyright 2005 James Hawkins
* Copyright 2011 Owen Rudge for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,10 +27,6 @@
//#include "htmlhelp.h"
//#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#include "version.rc"
#ifdef LANGUAGE_CS_CZ
#include "Cs.rc"
#endif
@@ -108,3 +105,21 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#include "Zh.rc"
#endif
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: hhtoolbar.bmp */
IDB_HHTOOLBAR BITMAP hhtoolbar.bmp
/* @makedep: hhtreeview.bmp */
IDB_HHTREEVIEW BITMAP hhtreeview.bmp
1 TYPELIB hhctrl_tlb.tlb
#define WINE_FILEDESCRIPTION_STR "Wine htmlhelp OCX"
#define WINE_FILENAME_STR "hhctrl.ocx"
#define WINE_FILEVERSION 5,2,3790,2744
#define WINE_FILEVERSION_STR "5.2.3790.2744"
#define WINE_PRODUCTVERSION 5,2,3790,2744
#define WINE_PRODUCTVERSION_STR "5.2.3790.2744"
#include <wine/wine_common_ver.rc>
+98
View File
@@ -0,0 +1,98 @@
/*
* Typelib for hhctrl
*
* Copyright 2010 Alexandre Julliard
*
* 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
*/
import "unknwn.idl";
import "objidl.idl";
import "oaidl.idl";
[
helpstring("HHCtrl 4.0 Type Library"),
version(4.0),
uuid(adb880a2-d8ff-11cf-9377-00aa003b7a11)
]
library HHCTRLLib
{
importlib("stdole2.tlb");
[
helpstring("IHHCtrl Interface"),
odl,
dual,
oleautomation,
uuid(adb880a1-d8ff-11cf-9377-00aa003b7a11)
]
interface IHHCtrl : IDispatch
{
/* FIXME */
}
[
helpstring("Event interface for HHCtrl"),
uuid(adb880a3-d8ff-11cf-9377-00aa003b7a11)
]
dispinterface _HHCtrlEvents
{
properties:
methods:
[id(0)] void Click(BSTR ParamString);
}
[
helpstring("HHCtrl Object"),
progid("Internet.HHCtrl.1"),
vi_progid("Internet.HHCtrl"),
threading(apartment),
version(1.0),
uuid(adb880a6-d8ff-11cf-9377-00aa003b7a11)
]
coclass OldHHCtrl1
{
[default] interface IHHCtrl;
[default, source] dispinterface _HHCtrlEvents;
}
[
helpstring("HHCtrl Object"),
progid("Internet.HHCtrl.1"),
vi_progid("Internet.HHCtrl"),
threading(apartment),
version(1.0),
uuid(41b23c28-488e-4e5c-ace2-bb0bbabe99e8)
]
coclass OldHHCtrl2
{
[default] interface IHHCtrl;
[default, source] dispinterface _HHCtrlEvents;
}
[
helpstring("HHCtrl Object"),
progid("Internet.HHCtrl.1"),
vi_progid("Internet.HHCtrl"),
threading(apartment),
version(1.0),
uuid(52a2aaae-085d-4187-97ea-8c30db990436)
]
coclass HHCtrl
{
[default] interface IHHCtrl;
[default, source] dispinterface _HHCtrlEvents;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

+36 -19
View File
@@ -54,6 +54,15 @@ static void fill_index_tree(HWND hwnd, IndexItem *item)
}
}
static void item_realloc(IndexItem *item, int num_items)
{
item->nItems = num_items;
item->items = heap_realloc(item->items, sizeof(IndexSubItem)*item->nItems);
item->items[item->nItems-1].name = NULL;
item->items[item->nItems-1].local = NULL;
item->itemFlags = 0x00;
}
/* Parse the attributes correspond to a list item, including sub-topics.
*
* Each list item has, at minimum, a param of type "keyword" and two
@@ -62,11 +71,11 @@ static void fill_index_tree(HWND hwnd, IndexItem *item)
* sub-topic then there isn't really a sub-topic, the index will jump
* directly to the requested item.
*/
static void parse_index_obj_node_param(IndexItem *item, const char *text)
static void parse_index_obj_node_param(IndexItem *item, const char *text, UINT code_page)
{
const char *ptr;
LPWSTR *param;
int len, wlen;
int len;
ptr = get_attr(text, "name", &len);
if(!ptr) {
@@ -77,19 +86,14 @@ static void parse_index_obj_node_param(IndexItem *item, const char *text)
/* Allocate a new sub-item, either on the first run or whenever a
* sub-topic has filled out both the "name" and "local" params.
*/
if(item->itemFlags == 0x11 && (!strncasecmp("name", ptr, len) || !strncasecmp("local", ptr, len))) {
item->nItems++;
item->items = heap_realloc(item->items, sizeof(IndexSubItem)*item->nItems);
item->items[item->nItems-1].name = NULL;
item->items[item->nItems-1].local = NULL;
item->itemFlags = 0x00;
}
if(item->itemFlags == 0x11 && (!strncasecmp("name", ptr, len) || !strncasecmp("local", ptr, len)))
item_realloc(item, item->nItems+1);
if(!strncasecmp("keyword", ptr, len)) {
param = &item->keyword;
}else if(!item->keyword && !strncasecmp("name", ptr, len)) {
/* Some HTML Help index files use an additional "name" parameter
* rather than the "keyword" parameter. In this case, the first
* occurance of the "name" parameter is the keyword.
* occurrence of the "name" parameter is the keyword.
*/
param = &item->keyword;
}else if(!strncasecmp("name", ptr, len)) {
@@ -109,10 +113,7 @@ static void parse_index_obj_node_param(IndexItem *item, const char *text)
return;
}
wlen = MultiByteToWideChar(CP_ACP, 0, ptr, len, NULL, 0);
*param = heap_alloc((wlen+1)*sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, ptr, len, *param, wlen);
(*param)[wlen] = 0;
*param = decode_html(ptr, len, code_page);
}
/* Parse the object tag corresponding to a list item.
@@ -140,7 +141,7 @@ static IndexItem *parse_index_sitemap_object(HHInfo *info, stream_t *stream)
TRACE("%s\n", node.buf);
if(!strcasecmp(node_name.buf, "param")) {
parse_index_obj_node_param(item, node.buf);
parse_index_obj_node_param(item, node.buf, info->pCHMInfo->codePage);
}else if(!strcasecmp(node_name.buf, "/object")) {
break;
}else {
@@ -194,6 +195,8 @@ static IndexItem *parse_li(HHInfo *info, stream_t *stream)
strbuf_zero(&node);
}
if(!ret)
FIXME("Failed to parse <li> tag!\n");
strbuf_free(&node);
strbuf_free(&node_name);
@@ -229,10 +232,23 @@ static void parse_hhindex(HHInfo *info, IStream *str, IndexItem *item)
TRACE("%s\n", node.buf);
if(!strcasecmp(node_name.buf, "li")) {
item->next = parse_li(info, &stream);
item->next->merge = item->merge;
item = item->next;
item->indentLevel = indent_level;
IndexItem *new_item;
new_item = parse_li(info, &stream);
if(new_item && item->keyword && strcmpW(new_item->keyword, item->keyword) == 0) {
int num_items = item->nItems;
item_realloc(item, num_items+1);
memcpy(&item->items[num_items], &new_item->items[0], sizeof(IndexSubItem));
heap_free(new_item->keyword);
heap_free(new_item->items);
heap_free(new_item);
} else if(new_item) {
item->next = new_item;
item->next->merge = item->merge;
item = item->next;
item->indentLevel = indent_level;
}
}else if(!strcasecmp(node_name.buf, "ul")) {
indent_level++;
}else if(!strcasecmp(node_name.buf, "/ul")) {
@@ -277,6 +293,7 @@ void ReleaseIndex(HHInfo *info)
IndexItem *item = info->index, *next;
int i;
if(!item) return;
/* Note: item->merge is identical for all items, only free once */
heap_free(item->merge.chm_file);
heap_free(item->merge.chm_index);
+21
View File
@@ -27,3 +27,24 @@
#define IDS_INDEX 2
#define IDS_SEARCH 3
#define IDS_FAVORITES 4
#define IDS_HIDETABS 5
#define IDS_SHOWTABS 6
#define MENU_POPUP 1
#define IDB_HHTOOLBAR 1000
/* IDB_HHTOOLBAR bitmaps: */
#define HHTB_STOP 0
#define HHTB_REFRESH 1
#define HHTB_HOME 2
#define HHTB_SYNC 3
#define HHTB_CONTRACT 4
#define HHTB_EXPAND 5
#define HHTB_NUMBITMAPS HHTB_EXPAND
#define IDB_HHTREEVIEW 1001
/* IDB_HHTREEVIEW bitmaps: */
#define HHTV_DOCUMENT 0
#define HHTV_FOLDER 1
#define HHTV_OPENFOLDER 2
#define HHTV_NUMBITMAPS HHTV_OPENFOLDER
+1
View File
@@ -193,6 +193,7 @@ static SearchItem *SearchCHM_Storage(SearchItem *item, IStorage *pStorage,
FIXME("Unhandled IStorage stream element.\n");
}
}
IEnumSTATSTG_Release(elem);
return item;
}
+2 -2
View File
@@ -40,7 +40,7 @@ void strbuf_free(strbuf_t *buf)
heap_free(buf->buf);
}
void strbuf_append(strbuf_t *buf, const char *data, int len)
static void strbuf_append(strbuf_t *buf, const char *data, int len)
{
if(buf->len+len > buf->size) {
buf->size = buf->len+len;
@@ -57,7 +57,7 @@ void stream_init(stream_t *stream, IStream *str)
stream->str = str;
}
BOOL stream_chr(stream_t *stream, strbuf_t *buf, char c)
static BOOL stream_chr(stream_t *stream, strbuf_t *buf, char c)
{
BOOL b = TRUE;
ULONG i;
+11 -11
View File
@@ -19,7 +19,9 @@
#ifndef HHCTRL_STREAM_H
#define HHCTRL_STREAM_H
#define BLOCK_SIZE 0x1000
#define BLOCK_BITS 12
#define BLOCK_SIZE (1 << BLOCK_BITS)
#define BLOCK_MASK (BLOCK_SIZE-1)
typedef struct {
char *buf;
@@ -34,15 +36,13 @@ typedef struct {
ULONG p;
} stream_t;
void strbuf_init(strbuf_t *buf);
void strbuf_zero(strbuf_t *buf);
void strbuf_free(strbuf_t *buf);
void strbuf_append(strbuf_t *buf, const char *data, int len);
void stream_init(stream_t *stream, IStream *str);
BOOL stream_chr(stream_t *stream, strbuf_t *buf, char c);
void get_node_name(strbuf_t *node, strbuf_t *name);
BOOL next_content(stream_t *stream, strbuf_t *buf);
BOOL next_node(stream_t *stream, strbuf_t *buf);
const char *get_attr(const char *node, const char *name, int *len);
void strbuf_init(strbuf_t *buf) DECLSPEC_HIDDEN;
void strbuf_zero(strbuf_t *buf) DECLSPEC_HIDDEN;
void strbuf_free(strbuf_t *buf) DECLSPEC_HIDDEN;
void stream_init(stream_t *stream, IStream *str) DECLSPEC_HIDDEN;
void get_node_name(strbuf_t *node, strbuf_t *name) DECLSPEC_HIDDEN;
BOOL next_content(stream_t *stream, strbuf_t *buf) DECLSPEC_HIDDEN;
BOOL next_node(stream_t *stream, strbuf_t *buf) DECLSPEC_HIDDEN;
const char *get_attr(const char *node, const char *name, int *len) DECLSPEC_HIDDEN;
#endif
+67 -49
View File
@@ -24,14 +24,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
typedef struct IOleClientSiteImpl
{
const IOleClientSiteVtbl *lpVtbl;
const IOleInPlaceSiteVtbl *lpvtblOleInPlaceSite;
const IOleInPlaceFrameVtbl *lpvtblOleInPlaceFrame;
const IDocHostUIHandlerVtbl *lpvtblDocHostUIHandler;
IOleClientSite IOleClientSite_iface;
IOleInPlaceSite IOleInPlaceSite_iface;
IOleInPlaceFrame IOleInPlaceFrame_iface;
IDocHostUIHandler IDocHostUIHandler_iface;
/* IOleClientSiteImpl data */
IOleObject *pBrowserObject;
@@ -41,32 +39,32 @@ typedef struct IOleClientSiteImpl
HWND hwndWindow;
} IOleClientSiteImpl;
#define CLIENTSITE(x) ((IOleClientSite*) &(x)->lpVtbl)
#define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpvtblDocHostUIHandler)
#define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpvtblOleInPlaceSite)
#define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpvtblOleInPlaceFrame)
static inline IOleClientSiteImpl *impl_from_IOleClientSite(IOleClientSite *iface)
{
return CONTAINING_RECORD(iface, IOleClientSiteImpl, IOleClientSite_iface);
}
static HRESULT STDMETHODCALLTYPE Site_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppvObj)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpVtbl, iface);
IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
*ppvObj = NULL;
if (IsEqualIID(riid, &IID_IUnknown)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppvObj);
*ppvObj = CLIENTSITE(This);
*ppvObj = &This->IOleClientSite_iface;
}else if(IsEqualIID(riid, &IID_IOleClientSite)) {
TRACE("(%p)->(IID_IOleClientSite %p)\n", This, ppvObj);
*ppvObj = CLIENTSITE(This);
*ppvObj = &This->IOleClientSite_iface;
}else if (IsEqualIID(riid, &IID_IOleInPlaceSite)) {
TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This, ppvObj);
*ppvObj = &(This->lpvtblOleInPlaceSite);
*ppvObj = &This->IOleInPlaceSite_iface;
}else if (IsEqualIID(riid, &IID_IOleInPlaceFrame)) {
TRACE("(%p)->(IID_IOleInPlaceFrame %p)\n", This, ppvObj);
*ppvObj = &(This->lpvtblOleInPlaceSite);
*ppvObj = &This->IOleInPlaceSite_iface;
}else if (IsEqualIID(riid, &IID_IDocHostUIHandler)) {
TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This, ppvObj);
*ppvObj = &(This->lpvtblDocHostUIHandler);
*ppvObj = &This->IDocHostUIHandler_iface;
}else {
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObj);
return E_NOINTERFACE;
@@ -78,7 +76,7 @@ static HRESULT STDMETHODCALLTYPE Site_QueryInterface(IOleClientSite *iface, REFI
static ULONG STDMETHODCALLTYPE Site_AddRef(IOleClientSite *iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpVtbl, iface);
IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
@@ -88,7 +86,7 @@ static ULONG STDMETHODCALLTYPE Site_AddRef(IOleClientSite *iface)
static ULONG STDMETHODCALLTYPE Site_Release(IOleClientSite *iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpVtbl, iface);
IOleClientSiteImpl *This = impl_from_IOleClientSite(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
@@ -144,25 +142,30 @@ static const IOleClientSiteVtbl MyIOleClientSiteTable =
Site_RequestNewObjectLayout
};
static inline IOleClientSiteImpl *impl_from_IDocHostUIHandler(IDocHostUIHandler *iface)
{
return CONTAINING_RECORD(iface, IOleClientSiteImpl, IDocHostUIHandler_iface);
}
static HRESULT STDMETHODCALLTYPE UI_QueryInterface(IDocHostUIHandler *iface, REFIID riid, LPVOID *ppvObj)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblDocHostUIHandler, iface);
IOleClientSiteImpl *This = impl_from_IDocHostUIHandler(iface);
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppvObj);
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppvObj);
}
static ULONG STDMETHODCALLTYPE UI_AddRef(IDocHostUIHandler *iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblDocHostUIHandler, iface);
IOleClientSiteImpl *This = impl_from_IDocHostUIHandler(iface);
return IOleClientSite_AddRef(CLIENTSITE(This));
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
}
static ULONG STDMETHODCALLTYPE UI_Release(IDocHostUIHandler * iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblDocHostUIHandler, iface);
IOleClientSiteImpl *This = impl_from_IDocHostUIHandler(iface);
return IOleClientSite_Release(CLIENTSITE(This));
return IOleClientSite_Release(&This->IOleClientSite_iface);
}
static HRESULT STDMETHODCALLTYPE UI_ShowContextMenu(IDocHostUIHandler *iface, DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved)
@@ -269,30 +272,35 @@ static const IDocHostUIHandlerVtbl MyIDocHostUIHandlerTable =
UI_FilterDataObject
};
static inline IOleClientSiteImpl *impl_from_IOleInPlaceSite(IOleInPlaceSite *iface)
{
return CONTAINING_RECORD(iface, IOleClientSiteImpl, IOleInPlaceSite_iface);
}
static HRESULT STDMETHODCALLTYPE InPlace_QueryInterface(IOleInPlaceSite *iface, REFIID riid, LPVOID *ppvObj)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppvObj);
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppvObj);
}
static ULONG STDMETHODCALLTYPE InPlace_AddRef(IOleInPlaceSite *iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
return IOleClientSite_AddRef(CLIENTSITE(This));
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
}
static ULONG STDMETHODCALLTYPE InPlace_Release(IOleInPlaceSite *iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
return IOleClientSite_Release(CLIENTSITE(This));
return IOleClientSite_Release(&This->IOleClientSite_iface);
}
static HRESULT STDMETHODCALLTYPE InPlace_GetWindow(IOleInPlaceSite *iface, HWND *lphwnd)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
*lphwnd = This->hwndWindow;
return S_OK;
@@ -320,10 +328,10 @@ static HRESULT STDMETHODCALLTYPE InPlace_OnUIActivate(IOleInPlaceSite *iface)
static HRESULT STDMETHODCALLTYPE InPlace_GetWindowContext(IOleInPlaceSite *iface, LPOLEINPLACEFRAME *lplpFrame, LPOLEINPLACEUIWINDOW *lplpDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
*lplpFrame = INPLACEFRAME(This);
IOleInPlaceFrame_AddRef(INPLACEFRAME(This));
*lplpFrame = &This->IOleInPlaceFrame_iface;
IOleInPlaceFrame_AddRef(&This->IOleInPlaceFrame_iface);
*lplpDoc = NULL;
@@ -362,7 +370,7 @@ static HRESULT STDMETHODCALLTYPE InPlace_DeactivateAndUndo(IOleInPlaceSite *ifac
static HRESULT STDMETHODCALLTYPE InPlace_OnPosRectChange(IOleInPlaceSite *iface, LPCRECT lprcPosRect)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceSite(iface);
IOleInPlaceObject *inplace;
if (IOleObject_QueryInterface(This->pBrowserObject, &IID_IOleInPlaceObject,
@@ -394,30 +402,35 @@ static const IOleInPlaceSiteVtbl MyIOleInPlaceSiteTable =
InPlace_OnPosRectChange
};
static inline IOleClientSiteImpl *impl_from_IOleInPlaceFrame(IOleInPlaceFrame *iface)
{
return CONTAINING_RECORD(iface, IOleClientSiteImpl, IOleInPlaceFrame_iface);
}
static HRESULT STDMETHODCALLTYPE Frame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, LPVOID *ppvObj)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceFrame(iface);
return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppvObj);
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppvObj);
}
static ULONG STDMETHODCALLTYPE Frame_AddRef(IOleInPlaceFrame *iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceFrame(iface);
return IOleClientSite_AddRef(CLIENTSITE(This));
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
}
static ULONG STDMETHODCALLTYPE Frame_Release(IOleInPlaceFrame *iface)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceFrame(iface);
return IOleClientSite_Release(CLIENTSITE(This));
return IOleClientSite_Release(&This->IOleClientSite_iface);
}
static HRESULT STDMETHODCALLTYPE Frame_GetWindow(IOleInPlaceFrame *iface, HWND *lphwnd)
{
ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface);
IOleClientSiteImpl *This = impl_from_IOleInPlaceFrame(iface);
*lphwnd = This->hwndWindow;
return S_OK;
@@ -625,17 +638,17 @@ BOOL InitWebBrowser(HHInfo *info, HWND hwndParent)
return FALSE;
iOleClientSiteImpl->ref = 1;
iOleClientSiteImpl->lpVtbl = &MyIOleClientSiteTable;
iOleClientSiteImpl->lpvtblOleInPlaceSite = &MyIOleInPlaceSiteTable;
iOleClientSiteImpl->lpvtblOleInPlaceFrame = &MyIOleInPlaceFrameTable;
iOleClientSiteImpl->IOleClientSite_iface.lpVtbl = &MyIOleClientSiteTable;
iOleClientSiteImpl->IOleInPlaceSite_iface.lpVtbl = &MyIOleInPlaceSiteTable;
iOleClientSiteImpl->IOleInPlaceFrame_iface.lpVtbl = &MyIOleInPlaceFrameTable;
iOleClientSiteImpl->hwndWindow = hwndParent;
iOleClientSiteImpl->lpvtblDocHostUIHandler = &MyIDocHostUIHandlerTable;
iOleClientSiteImpl->IDocHostUIHandler_iface.lpVtbl = &MyIDocHostUIHandlerTable;
hr = OleCreate(&CLSID_WebBrowser, &IID_IOleObject, OLERENDER_DRAW, 0,
(IOleClientSite *)iOleClientSiteImpl, &MyIStorage,
&iOleClientSiteImpl->IOleClientSite_iface, &MyIStorage,
(void **)&browserObject);
info->client_site = (IOleClientSite *)iOleClientSiteImpl;
info->client_site = &iOleClientSiteImpl->IOleClientSite_iface;
info->wb_object = browserObject;
if (FAILED(hr)) goto error;
@@ -649,7 +662,7 @@ BOOL InitWebBrowser(HHInfo *info, HWND hwndParent)
if (FAILED(hr)) goto error;
hr = IOleObject_DoVerb(browserObject, OLEIVERB_SHOW, NULL,
(IOleClientSite *)iOleClientSiteImpl,
&iOleClientSiteImpl->IOleClientSite_iface,
-1, hwndParent, &rc);
if (FAILED(hr)) goto error;
@@ -738,7 +751,12 @@ void DoPageAction(HHInfo *info, DWORD dwAction)
break;
case WB_REFRESH:
IWebBrowser2_Refresh(pWebBrowser2);
break;
case WB_STOP:
IWebBrowser2_Stop(pWebBrowser2);
break;
case WB_PRINT:
IWebBrowser2_ExecWB(pWebBrowser2, OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0);
break;
}
}
+1
View File
@@ -78,6 +78,7 @@ BaseExitThreadPoolThread(IN NTSTATUS ExitStatus)
{
/* Exit the thread */
ExitThread(ExitStatus);
return STATUS_SUCCESS;
}
BOOL
+30 -6
View File
@@ -2096,6 +2096,7 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
SAM_USER_FIXED_DATA FixedUserData;
PSAM_DB_OBJECT DomainObject;
PSAM_DB_OBJECT UserObject;
UCHAR LogonHours[23];
ULONG ulSize;
ULONG ulRid;
WCHAR szRid[9];
@@ -2349,7 +2350,21 @@ SamrCreateUserInDomain(IN SAMPR_HANDLE DomainHandle,
return Status;
}
/* FIXME: Set LogonHours attribute*/
/* Set LogonHours attribute*/
*((PUSHORT)LogonHours) = 168;
memset(&(LogonHours[2]), 0xff, 21);
Status = SampSetObjectAttribute(UserObject,
L"LogonHours",
REG_BINARY,
&LogonHours,
sizeof(LogonHours));
if (!NT_SUCCESS(Status))
{
TRACE("failed with status 0x%08lx\n", Status);
return Status;
}
/* FIXME: Set Groups attribute*/
/* Set LMPwd attribute*/
@@ -7098,6 +7113,16 @@ SampSetUserAll(PSAM_DB_OBJECT UserObject,
REG_SZ,
Buffer->All.Parameters.Buffer,
Buffer->All.Parameters.MaximumLength);
if (!NT_SUCCESS(Status))
goto done;
}
if (WhichFields & USER_ALL_LOGONHOURS)
{
Status = SampSetLogonHoursAttrbute(UserObject,
&Buffer->All.LogonHours);
if (!NT_SUCCESS(Status))
goto done;
}
if (WhichFields & (USER_ALL_PRIMARYGROUPID |
@@ -7144,7 +7169,6 @@ SampSetUserAll(PSAM_DB_OBJECT UserObject,
/*
FIXME:
USER_ALL_LOGONHOURS
USER_ALL_NTPASSWORDPRESENT
USER_ALL_LMPASSWORDPRESENT
USER_ALL_PASSWORDEXPIRED
@@ -7232,12 +7256,12 @@ SamrSetInformationUser(IN SAMPR_HANDLE UserHandle,
Status = SampSetUserPreferences(UserObject,
Buffer);
break;
/*
case UserLogonHoursInformation:
Status = SampSetUserLogonHours(UserObject,
Buffer);
Status = SampSetLogonHoursAttrbute(UserObject,
&Buffer->LogonHours.LogonHours);
break;
*/
case UserNameInformation:
Status = SampSetObjectAttribute(UserObject,
L"Name",
+24
View File
@@ -101,6 +101,30 @@ SampInitializeRegistry(VOID)
}
VOID
NTAPI
SamIFree_SAMPR_ENUMERATION_BUFFER(PSAMPR_ENUMERATION_BUFFER Ptr)
{
ULONG i;
if (Ptr != NULL)
{
if (Ptr->Buffer != NULL)
{
for (i = 0; i < Ptr->EntriesRead; i++)
{
if (Ptr->Buffer[i].Name.Buffer != NULL)
MIDL_user_free(Ptr->Buffer[i].Name.Buffer);
}
MIDL_user_free(Ptr->Buffer);
}
MIDL_user_free(Ptr);
}
}
VOID
NTAPI
SamIFree_SAMPR_PSID_ARRAY(PSAMPR_PSID_ARRAY Ptr)
+4
View File
@@ -328,6 +328,10 @@ SampSetUserPassword(IN PSAM_DB_OBJECT UserObject,
NTSTATUS
SampGetLogonHoursAttrbute(IN PSAM_DB_OBJECT UserObject,
IN OUT PSAMPR_LOGON_HOURS LogonHours);
NTSTATUS
SampSetLogonHoursAttrbute(IN PSAM_DB_OBJECT UserObject,
IN PSAMPR_LOGON_HOURS LogonHours);
/* EOF */
+5 -5
View File
@@ -20,7 +20,7 @@
@ stub SamIFree_SAMPR_ALIAS_INFO_BUFFER
@ stub SamIFree_SAMPR_DISPLAY_INFO_BUFFER
@ stub SamIFree_SAMPR_DOMAIN_INFO_BUFFER
@ stub SamIFree_SAMPR_ENUMERATION_BUFFER
@ stdcall SamIFree_SAMPR_ENUMERATION_BUFFER(ptr)
@ stub SamIFree_SAMPR_GET_GROUPS_BUFFER
@ stub SamIFree_SAMPR_GET_MEMBERS_BUFFER
@ stub SamIFree_SAMPR_GROUP_INFO_BUFFER
@@ -36,13 +36,13 @@
@ stub SamIGetBootKeyInformation
@ stub SamIGetDefaultAdministratorName
@ stub SamIGetFixedAttributes
@ stub SamIGetinterdomainTrustAccountPasswordsForUpgrade
@ stub SamIGetInterdomainTrustAccountPasswordsForUpgrade
@ stub SamIGetPrivateData
@ stub SamIGetResourceGroupmembershipsTransitive
@ stub SamIGetSerialNumberDomain
@ stub SamIGetuserLogonInformation
@ stub SamIGetuserLogonInformation2
@ stub SamIGetuserLogonInformationEx
@ stub SamIGetUserLogonInformation
@ stub SamIGetUserLogonInformation2
@ stub SamIGetUserLogonInformationEx
@ stub SamIImpersonateNullSession
@ stub SamIIncrementPerformanceCounter
@ stdcall SamIInitialize()
+44 -1
View File
@@ -584,7 +584,7 @@ done:
NTSTATUS
SampGetLogonHoursAttrbute(IN PSAM_DB_OBJECT UserObject,
IN PSAMPR_LOGON_HOURS LogonHours)
IN OUT PSAMPR_LOGON_HOURS LogonHours)
{
PUCHAR RawBuffer = NULL;
ULONG Length = 0;
@@ -651,4 +651,47 @@ done:
return Status;
}
NTSTATUS
SampSetLogonHoursAttrbute(IN PSAM_DB_OBJECT UserObject,
IN PSAMPR_LOGON_HOURS LogonHours)
{
PUCHAR RawBuffer = NULL;
ULONG BufferLength;
ULONG Length = 0;
NTSTATUS Status;
if (LogonHours->UnitsPerWeek > 0)
{
BufferLength = (((ULONG)LogonHours->UnitsPerWeek) + 7) / 8;
Length = BufferLength + sizeof(USHORT);
RawBuffer = midl_user_allocate(Length);
if (RawBuffer == NULL)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
goto done;
}
*((PUSHORT)RawBuffer) = LogonHours->UnitsPerWeek;
memcpy(&(RawBuffer[2]),
LogonHours->LogonHours,
BufferLength);
}
Status = SampSetObjectAttribute(UserObject,
L"LogonHours",
REG_BINARY,
RawBuffer,
Length);
done:
if (RawBuffer != NULL)
midl_user_free(RawBuffer);
return Status;
}
/* EOF */
+6 -6
View File
@@ -421,18 +421,18 @@ KspDisableEvent(
PKSEVENT_ENTRY EventEntry;
PLIST_ENTRY Entry;
/* get current irp stack location */
IoStack = IoGetCurrentIrpStackLocation(Ctx->Irp);
/* get event data */
EventData = (PKSEVENTDATA)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
if (!Ctx || !Ctx->List || !Ctx->FileObject || !Ctx->Irp)
{
/* invalid parameter */
return FALSE;
}
/* get current irp stack location */
IoStack = IoGetCurrentIrpStackLocation(Ctx->Irp);
/* get event data */
EventData = (PKSEVENTDATA)IoStack->Parameters.DeviceIoControl.Type3InputBuffer;
/* point to first entry */
Entry = Ctx->List->Flink;
+2 -1
View File
@@ -1177,7 +1177,8 @@ KsDefaultDeviceIoCompletion(
if (IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY &&
IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_METHOD &&
IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_PROPERTY)
IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_ENABLE_EVENT &&
IoStack->Parameters.DeviceIoControl.IoControlCode != IOCTL_KS_DISABLE_EVENT)
{
if (IoStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_KS_RESET_STATE)
{
+146
View File
@@ -0,0 +1,146 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS RTL8139 Driver
* FILE: include/8139.h
* PURPOSE: 8139 NIC definitions
*/
#pragma once
//Register addresses
#define R_MAC 0x00 //MAC address uses bytes 0-5, 6 and 7 are reserved
#define R_MCAST0 0x08 //Multicast registers
#define R_MCAST1 0x09 //Multicast registers
#define R_MCAST2 0x0A
#define R_MCAST3 0x0B
#define R_MCAST4 0x0C
#define R_MCAST5 0x0D
#define R_MCAST6 0x0E
#define R_MCAST7 0x0F
#define R_TXSTS0 0x10 //TX status, 0x10-0x13, 4 bytes
#define R_TXSTS1 0x14
#define R_TXSTS2 0x18
#define R_TXSTS3 0x1C
#define R_TXSAD0 0x20 //TX start address of descriptor 0
#define R_TXSAD1 0x24
#define R_TXSAD2 0x28
#define R_TXSAD3 0x2C
#define R_RXSA 0x30 //RX buffer start address
#define R_ERXBC 0x34 //Early RX byte count register
#define R_ERXSTS 0x36 //Early RX status register
#define R_CMD 0x37 //Command register
#define B_CMD_TXE 0x04 //Enable TX
#define B_CMD_RXE 0x08 //Enable RX
#define B_CMD_RST 0x10 //Reset bit
#define R_CAPR 0x38 //Current address of packet read
#define R_CBA 0x3A //Current buffer address
#define R_IM 0x3C //Interrupt mask register
#define R_IS 0x3E //Interrupt status register
#define R_TC 0x40 //Transmit configuration register
#define R_RC 0x44 //Receive configuration register
#define B_RC_AAP 0x01 //Accept all packets
#define B_RC_APM 0x02 //Accept packets sent to device MAC
#define B_RC_AM 0x04 //Accept multicast packets
#define B_RC_AB 0x08 //Accept broadcast packets
#define B_RC_AR 0x10 //Accept runt (smaller than 64bytes) packets
#define R_TCTR 0x48 //Timer counter register
#define R_MPC 0x4C //Missed packet counter
#define R_9346CR 0x50 //93C46 command register
#define R_CFG0 0x51 //Configuration register 0
#define R_CFG1 0x52
#define R_TINTR 0x54 //Timer interrupt register
#define R_MS 0x58 //Media status register
#define R_CFG3 0x59 //Configuration register 3
#define R_CFG4 0x5A //Configuration register 4
#define R_MINTS 0x5C //Multiple interrupt select
#define R_PCIID 0x5E //PCI Revision ID = 0x10
#define R_DTSTS 0x60 //TX status of all descriptors
#define R_BMC 0x62 //Basic mode control register
#define R_BMSTS 0x64 //Basic mode status register
#define R_ANA 0x66 //Auto-negotiation advertisement
#define R_ANLP 0x68 //Auto-negotiation link partner
#define R_ANEX 0x6A //Auto-negotiation expansion
#define R_DCTR 0x6C //Disconnect counter
#define R_FCSCTR 0x6E //False carrier sense counter
#define R_NWT 0x70 //N-way test register
#define R_RXERRCTR 0x72 //RX error counter
#define R_CSCFG 0x74 //CS configuration register
#define R_PHYP1 0x78 //PHY parameter 1
#define R_TWP 0x7C //Twister parameter
#define R_PHYP2 0x80 //PHY parameter 2
#define R_PCRC0 0x84 //Power management CRC for wakeup frame 0
#define R_PCRC1 0x85
#define R_PCRC2 0x86
#define R_PCRC3 0x87
#define R_PCRC4 0x88
#define R_PCRC5 0x89
#define R_PCRC6 0x8A
#define R_PCRC7 0x8B
#define R_WAKE0 0x8C //Power management wakeup frame 0
#define R_WAKE1 0x94
#define R_WAKE2 0x9C
#define R_WAKE3 0xA4
#define R_WAKE4 0xAC
#define R_WAKE5 0xB4
#define R_WAKE6 0xBC
#define R_WAKE7 0xC4
#define R_LSBCRC0 0xCC //LSB of the mask byte of wakeup frame 0 within offset 12 to 75
#define R_LSBCRC0 0xCD
#define R_LSBCRC0 0xCE
#define R_LSBCRC0 0xCF
#define R_LSBCRC0 0xD0
#define R_LSBCRC0 0xD1
#define R_LSBCRC0 0xD2
#define R_LSBCRC0 0xD3
#define R_CFG5 0xD8 //Configuration register 5
//EEPROM Control Bytes
#define EE_DATA_READ 0x01 //Chip data out
#define EE_DATA_WRITE 0x02 //Chip data in
#define EE_SHIFT_CLK 0x04 //Chip shift clock
#define EE_CS 0x08 //Chip select
#define EE_ENB 0x88 //Chip enable
//EEPROM Commands
#define EE_READ_CMD 0x06
/* NIC prepended structure to a received packet */
typedef struct _PACKET_HEADER {
UCHAR Status; /* See RSR_* constants */
UCHAR NextPacket; /* Pointer to next packet in chain */
USHORT PacketLength; /* Length of packet including this header */
} PACKET_HEADER, *PPACKET_HEADER;
#define IEEE_802_ADDR_LENGTH 6
/* Ethernet frame header */
typedef struct _ETH_HEADER {
UCHAR Destination[IEEE_802_ADDR_LENGTH];
UCHAR Source[IEEE_802_ADDR_LENGTH];
USHORT PayloadType;
} ETH_HEADER, *PETH_HEADER;
typedef struct _DISCARD_HEADER {
PACKET_HEADER HWHeader;
ETH_HEADER EthernetHeader;
} DISCARD_HEADER, *PDISCARD_HEADER;
#define NICDisableInterrupts(Adapter) { \
NDIS_DbgPrint(MAX_TRACE, ("NICDisableInterrupts()\n")); \
NdisRawWritePortUchar((Adapter)->IOBase + PG0_IMR, 0x00); \
}
#define NICEnableInterrupts(Adapter) { \
NDIS_DbgPrint(MAX_TRACE, ("NICEnableInterrupts() Mask (0x%X)\n", (Adapter)->InterruptMask)); \
NdisRawWritePortUchar((Adapter)->IOBase + PG0_IMR, (Adapter)->InterruptMask); \
}
VOID NTAPI MiniportHandleInterrupt(
IN NDIS_HANDLE MiniportAdapterContext);
/* EOF */
@@ -0,0 +1,82 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Novell Eagle 2000 driver
* FILE: include/debug.h
* PURPOSE: Debugging support macros
* DEFINES: DBG - Enable debug output
* NASSERT - Disable assertions
*/
#pragma once
#define NORMAL_MASK 0x000000FF
#define SPECIAL_MASK 0xFFFFFF00
#define MIN_TRACE 0x00000001
#define MID_TRACE 0x00000002
#define MAX_TRACE 0x00000003
#define DEBUG_MEMORY 0x00000100
#define DEBUG_ULTRA 0xFFFFFFFF
#if DBG
extern ULONG DebugTraceLevel;
#ifdef _MSC_VER
#define NDIS_DbgPrint(_t_, _x_) \
if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
DbgPrint("(%s:%d) ", __FILE__, __LINE__); \
DbgPrint _x_ ; \
}
#else /* _MSC_VER */
#define NDIS_DbgPrint(_t_, _x_) \
if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \
DbgPrint _x_ ; \
}
#endif /* _MSC_VER */
#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x))
#define ASSERT_IRQL_EQUAL(x) ASSERT(KeGetCurrentIrql() == (x))
#else /* DBG */
#define NDIS_DbgPrint(_t_, _x_)
#define ASSERT_IRQL(x)
#define ASSERT_IRQL_EQUAL(x)
/* #define ASSERT(x) */ /* ndis.h */
#endif /* DBG */
#define assert(x) ASSERT(x)
#define assert_irql(x) ASSERT_IRQL(x)
#ifdef _MSC_VER
#define UNIMPLEMENTED \
NDIS_DbgPrint(MIN_TRACE, ("The function at %s:%d is unimplemented, \
but come back another day.\n", __FILE__, __LINE__));
#else /* _MSC_VER */
#define UNIMPLEMENTED \
NDIS_DbgPrint(MIN_TRACE, ("%s at %s:%d is unimplemented, \
but come back another day.\n", __FUNCTION__, __FILE__, __LINE__));
#endif /* _MSC_VER */
#define CHECKPOINT \
do { NDIS_DbgPrint(MIN_TRACE, ("%s:%d\n", __FILE__, __LINE__)); } while(0);
/* EOF */
+247
View File
@@ -0,0 +1,247 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Novell Eagle 2000 driver
* FILE: include/ne2000.h
* PURPOSE: NE2000 driver definitions
*/
#define NDIS_MINIPORT_DRIVER 1
#define NDIS_LEGACY_MINIPORT 1
#define NDIS51_MINIPORT 1
#include <ndis.h>
#include <8139.h>
#include <debug.h>
/* Define NOCARD to test NDIS without a card */
//#define NOCARD
/* NE2000 sepcific constants */
#define NIC_DATA 0x10 /* Data register */
#define NIC_RESET 0x1F /* Reset register */
/* Global constants */
#define DRIVER_NDIS_MAJOR_VERSION 0x05
#define DRIVER_NDIS_MINOR_VERSION 0
#define DRIVER_DEFAULT_IO_BASE_ADDRESS 0x280 /* bochs default */
#define DRIVER_DEFAULT_INTERRUPT_NUMBER 9 /* bochs default */
#define DRIVER_DEFAULT_INTERRUPT_SHARED FALSE
#define DRIVER_DEFAULT_INTERRUPT_MODE NdisInterruptLatched
#define DRIVER_MAX_MULTICAST_LIST_SIZE 8
#define DRIVER_VENDOR_DESCRIPTION "RTL 8139 Adapter."
#define DRIVER_VENDOR_DRIVER_VERSION 0x0100 /* 1.0 */
#define DRIVER_FRAME_SIZE 1514 /* Size of an ethernet frame */
#define DRIVER_HEADER_SIZE 14 /* Size of an ethernet header */
#define DRIVER_LENGTH_OF_ADDRESS 6 /* Size of an ethernet address */
/* Maximum lookahead buffer size */
#define DRIVER_MAXIMUM_LOOKAHEAD (252 - DRIVER_HEADER_SIZE)
/* Size of a block in a buffer ring */
#define DRIVER_BLOCK_SIZE 256
/* Default number of transmit buffers */
#define DRIVER_DEFAULT_TX_BUFFER_COUNT 12
#define BUFFERS_PER_TX_BUF 1
/* Interrupt Mask Register value */
#define DRIVER_INTERRUPT_MASK IMR_ALLE - IMR_RDCE
/* Maximum number of interrupts handled per call to MiniportHandleInterrupt */
#define INTERRUPT_LIMIT 10
/* Global structures */
typedef struct _MINIPORT_RESERVED
{
PNDIS_PACKET Next;
} MINIPORT_RESERVED, *PMINIPORT_RESERVED;
#define RESERVED(Packet) ((PMINIPORT_RESERVED)((Packet)->MiniportReserved))
typedef UCHAR DRIVER_HARDWARE_ADDRESS[DRIVER_LENGTH_OF_ADDRESS];
/* Information about an adapter */
typedef struct _NIC_ADAPTER
{
/* Entry on global adapter list */
LIST_ENTRY ListEntry;
/* Adapter handle */
NDIS_HANDLE MiniportAdapterHandle;
/* NDIS interrupt object */
NDIS_MINIPORT_INTERRUPT Interrupt;
/* I/O base address and interrupt number of adapter */
ULONG_PTR IoBaseAddress;
ULONG InterruptLevel;
ULONG InterruptVector;
BOOLEAN InterruptShared;
KINTERRUPT_MODE InterruptMode;
/* Mapped address of the I/O base port */
PUCHAR IOBase;
/* TRUE if the NIC can transfer in word mode */
BOOLEAN WordMode;
/* Base address and size of the onboard memory window */
PUCHAR RamBase;
UINT RamSize;
/* Station Address PROM (SAPROM) */
UCHAR SAPROM[16];
/* Onboard ethernet address from the manufacturer */
DRIVER_HARDWARE_ADDRESS PermanentAddress;
/* Ethernet address currently in use */
DRIVER_HARDWARE_ADDRESS StationAddress;
/* Maximum number of multicast addresses this adapter supports */
ULONG MaxMulticastListSize;
/* List of multicast addresses in use */
DRIVER_HARDWARE_ADDRESS Addresses[DRIVER_MAX_MULTICAST_LIST_SIZE];
/* Current multicast address mask */
UCHAR MulticastAddressMask[8];
/* Masked interrupts (IMR value) */
ULONG InterruptMask;
/* Interrupts that have occurred */
UCHAR InterruptStatus;
/* Current packet filter */
ULONG PacketFilter;
/* Lookahead buffer */
UINT LookaheadSize;
UCHAR Lookahead[DRIVER_MAXIMUM_LOOKAHEAD + DRIVER_HEADER_SIZE];
/* Receive buffer ring */
UINT PageStart;
UINT PageStop;
UINT CurrentPage;
UINT NextPacket;
/* TRUE if there was a buffer overflow */
BOOLEAN BufferOverflow;
/* TRUE if an error occurred during reception of a packet */
BOOLEAN ReceiveError;
/* TRUE if an error occurred during transmission of a packet */
BOOLEAN TransmitError;
/* TRUE if a transmit interrupt is pending */
BOOLEAN TransmitPending;
/* Received packet header */
PACKET_HEADER PacketHeader;
/* Offset in onboard RAM of received packet */
ULONG PacketOffset;
/* TRUE if receive indications are done and should be completed */
BOOLEAN DoneIndicating;
/* Transmit buffers */
UINT TXStart; /* Start block of transmit buffer ring */
UINT TXCount; /* Number of blocks in transmit buffer ring */
UINT TXFree; /* Number of free transmit buffers */
UINT TXNext; /* Next buffer to use */
/* Length of packet. 0 means buffer is unused */
UINT TXSize[DRIVER_DEFAULT_TX_BUFFER_COUNT];
INT TXCurrent; /* Current buffer beeing transmitted. -1 means none */
/* Head of transmit queue */
PNDIS_PACKET TXQueueHead;
/* Tail of transmit queue */
PNDIS_PACKET TXQueueTail;
/* Statistics */
ULONG FrameAlignmentErrors;
ULONG CrcErrors;
ULONG MissedPackets;
/* Flags used for driver cleanup */
BOOLEAN IOPortRangeRegistered;
BOOLEAN InterruptRegistered;
BOOLEAN ShutdownHandlerRegistered;
} NIC_ADAPTER, *PNIC_ADAPTER;
/* Global driver information */
typedef struct _DRIVER_INFORMATION
{
NDIS_HANDLE NdisWrapperHandle; /* Returned from NdisInitializeWrapper */
NDIS_HANDLE NdisMacHandle; /* Returned from NdisRegisterMac */
LIST_ENTRY AdapterListHead; /* Adapters this driver control */
} DRIVER_INFORMATION, *PDRIVER_INFORMATION;
/* Global variable */
extern DRIVER_INFORMATION DriverInfo;
extern NDIS_PHYSICAL_ADDRESS HighestAcceptableMax;
/* Prototypes */
BOOLEAN NICCheck(
PNIC_ADAPTER Adapter);
NDIS_STATUS NICInitialize(
PNIC_ADAPTER Adapter);
NDIS_STATUS NICSetup(
PNIC_ADAPTER Adapter);
NDIS_STATUS NICStart(
PNIC_ADAPTER Adapter);
NDIS_STATUS NICStop(
PNIC_ADAPTER Adapter);
NDIS_STATUS NICReset(
PNIC_ADAPTER Adapter);
VOID NICUpdateCounters(
PNIC_ADAPTER Adapter);
VOID NICReadDataAlign(
PNIC_ADAPTER Adapter,
PUSHORT Target,
ULONG_PTR Source,
USHORT Length);
VOID NICWriteDataAlign(
PNIC_ADAPTER Adapter,
ULONG_PTR Target,
PUSHORT Source,
USHORT Length);
VOID NICReadData(
PNIC_ADAPTER Adapter,
PUCHAR Target,
ULONG_PTR Source,
USHORT Length);
VOID NICWriteData(
PNIC_ADAPTER Adapter,
ULONG_PTR Target,
PUCHAR Source,
USHORT Length);
VOID NICTransmit(
PNIC_ADAPTER Adapter);
/* EOF */
@@ -20,7 +20,6 @@ list(APPEND SOURCE
filter_wavecyclic.cpp
filter_wavepci.cpp
filter_wavert.cpp
guids.cpp
interrupt.cpp
irp.cpp
irpstream.cpp
@@ -1,91 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Kernel Streaming
* FILE: drivers/wdm/audio/backpln/portcls/guids.cpp
* PURPOSE: portcls guid mess
* PROGRAMMER: Johannes Anderwald
*/
#ifdef _MSC_VER
#define PUT_GUIDS_HERE
#endif
#include "private.hpp"
#ifndef _MSC_VER
const GUID CLSID_PortTopology = {0xb4c90a32L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID CLSID_PortMidi = {0xb4c90a43L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID CLSID_PortWaveCyclic = {0xb4c90a2aL, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID CLSID_PortWavePci = {0xb4c90a54L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID CLSID_PortDMus = {0xb7902fe9L, 0xfb0a, 0x11d1, {0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1}};
const GUID CLSID_PortWaveRT = {0xcc9be57a, 0xeb9e, 0x42b4, {0x94, 0xfc, 0xc, 0xad, 0x3d, 0xbc, 0xe7, 0xfa}};
const GUID IID_IMiniportDMus = {0xc096df9dL, 0xfb09, 0x11d1, {0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1}};
const GUID IID_IMiniportTopology = {0xb4c90a31L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IMiniportMidi = {0xb4c90a41L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IMiniportWavePci = {0xb4c90a52L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IPortTopology = {0xb4c90a30L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID CLSID_MiniportDriverDMusUART = {0xd3f0ce1c, 0xfffc, 0x11d1, {0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1}};
const GUID CLSID_MiniportDriverDMusUARTCapture = {0xd3f0ce1d, 0xfffc, 0x11d1, {0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1}};
const GUID CLSID_MiniportDriverUart = {0xb4c90ae1L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID CLSID_MiniportDriverFmSynth = {0xb4c90ae0L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID CLSID_MiniportDriverFmSynthWithVol = {0xe5a3c139L, 0xf0f2, 0x11d1, {0x81, 0xaf, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1}};
const GUID IID_IPort = {0xb4c90a25L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IDrmPort = {0x286D3DF8L, 0xCA22, 0x4E2E, {0xB9, 0xBC, 0x20, 0xB4, 0xF0, 0xE2, 0x01, 0xCE}};
const GUID IID_IDrmPort2 = {0x1ACCE59CL, 0x7311, 0x4B6B, {0x9F, 0xBA, 0xCC, 0x3B, 0xA5, 0x9A, 0xCD, 0xCE}};
const GUID IID_IInterruptSync = {0x22C6AC63L, 0x851B, 0x11D0, {0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE}};
const GUID IID_IPortWavePci = {0xb4c90a50L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IPortWavePciStream = {0xb4c90a51L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IPortMidi = {0xb4c90a40L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IPortDMus = {0xc096df9cL, 0xfb09, 0x11d1, {0x81, 0xb0, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1}};
const GUID IID_IAdapterPowerManagement = {0x793417D0L, 0x35FE, 0x11D1, {0xAD, 0x08, 0x00, 0xA0, 0xC9, 0x0A, 0xB1, 0xB0}};
const GUID IID_IMiniport = {0xb4c90a24, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IMiniportWaveCyclic = {0xb4c90a27L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IPortWaveCyclic = {0xb4c90a26L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
const GUID IID_IResourceList = {0x22C6AC60L, 0x851B, 0x11D0, {0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE}};
const GUID IID_IServiceGroup = {0x22C6AC65L, 0x851B, 0x11D0, {0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE}};
const GUID IID_IPinCount = {0x5dadb7dcL, 0xa2cb, 0x4540, {0xa4, 0xa8, 0x42, 0x5e, 0xe4, 0xae, 0x90, 0x51}};
const GUID IID_IPowerNotify = {0x3DD648B8L, 0x969F, 0x11D1, {0x95, 0xA9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID IID_IDmaChannelSlave = {0x22C6AC62L, 0x851B, 0x11D0, {0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE}};
const GUID IID_IDmaChannel = {0x22C6AC61L, 0x851B, 0x11D0, {0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE}};
const GUID IID_IRegistryKey = {0xE8DA4302l, 0xF304, 0x11D0, {0x95, 0x8B, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID IID_IServiceSink = {0x22C6AC64L, 0x851B, 0x11D0, {0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE}};
const GUID IID_IPortClsVersion = {0x7D89A7BBL, 0x869B, 0x4567, {0x8D, 0xBE, 0x1E, 0x16, 0x8C, 0xC8, 0x53, 0xDE}};
const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x46}};
const GUID IID_IPortEvents = {0xA80F29C4L, 0x5498, 0x11D2, {0x95, 0xD9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
const GUID IID_IMusicTechnology = {0x80396C3C, 0xCBCB, 0x409B, {0x9F, 0x65, 0x4F, 0x1E, 0x74, 0x67, 0xCD, 0xAF}};
const GUID KSNAME_PIN = {0x146F1A80, 0x4791, 0x11D0, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
const GUID IID_IDrmAudioStream = {0x1915c967, 0x3299, 0x48cb, {0xa3, 0xe4, 0x69, 0xfd, 0x1d, 0x1b, 0x30, 0x6e}};
//FIXME
//
const GUID KS_CATEGORY_AUDIO = {0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KS_CATEGORY_RENDER = {0x65E8773E, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KS_CATEGORY_CAPTURE = {0x65E8773D, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
const GUID KS_CATEGORY_TOPOLOGY = {0xDDA54A40, 0x1E4C, 0x11D1, {0xA0, 0x50, 0x40, 0x57, 0x05, 0xC1, 0x00, 0x00}};
///
/// undocumented guids
const GUID IID_ISubdevice = {0xB4C90A61, 0x5791, 0x11D0, {0x86, 0xF9, 0x00, 0xA0, 0xC9, 0x11, 0xB5, 0x44}};
const GUID IID_IIrpTarget = {0xB4C90A60, 0x5791, 0x11D0, {0xF9, 0x86, 0x00, 0xA0, 0xC9, 0x11, 0xB5, 0x44}};
const GUID IID_IIrpTargetFactory = {0xB4C90A62, 0x5791, 0x11D0, {0xF9, 0x86, 0x00, 0xA0, 0xC9, 0x11, 0xB5, 0x44}};
///
/// >= Vista GUIDs
///
const GUID IID_IPortWaveRT = {0x339ff909, 0x68a9, 0x4310, {0xb0, 0x9b, 0x27, 0x4e, 0x96, 0xee, 0x4c, 0xbd}};
const GUID IID_IPortWaveRTStream = {0x1809ce5a, 0x64bc, 0x4e62, {0xbd, 0x7d, 0x95, 0xbc, 0xe4, 0x3d, 0xe3, 0x93}};
const GUID IID_IMiniportWaveRT = {0x0f9fc4d6, 0x6061, 0x4f3c, {0xb1, 0xfc, 0x7, 0x5e, 0x35, 0xf7, 0x96, 0xa}};
const GUID IID_IMiniportWaveRTStream = {0x000ac9ab, 0xfaab, 0x4f3d, {0x94, 0x55, 0x6f, 0xf8, 0x30, 0x6a, 0x74, 0xa0}};
const GUID IID_IMiniportWaveRTStreamNotification = {0x23759128, 0x96f1, 0x423b, {0xab, 0x4d, 0x81, 0x63, 0x5b, 0xcf, 0x8c, 0xa1}};
const GUID IID_IUnregisterSubdevice = {0x16738177, 0xe199, 0x41f9, {0x9a, 0x87, 0xab, 0xb2, 0xa5, 0x43, 0x2f, 0x21}};
const GUID IID_IUnregisterPhysicalConnection = {0x6c38e231, 0x2a0d, 0x428d, {0x81, 0xf8, 0x07, 0xcc, 0x42, 0x8b, 0xb9, 0xa4}};
#endif
@@ -501,8 +501,6 @@ CPortPinWavePci::HandleKsProperty(
//UNICODE_STRING GuidString;
PIO_STACK_LOCATION IoStack;
IoStack = IoGetCurrentIrpStackLocation(Irp);
//DPRINT("IPortPinWave_HandleKsProperty entered\n");
IoStack = IoGetCurrentIrpStackLocation(Irp);
@@ -559,7 +557,7 @@ CPortPinWavePci::HandleKsStream(
if (m_Capture)
m_Position.WriteOffset += Data;
else
m_Position.WriteOffset += Data;
m_Position.PlayOffset += Data;
if (bFailed)
{
@@ -7,6 +7,7 @@
* Andrew Greenwood
*/
#include <initguid.h>
#include "private.hpp"
+23
View File
@@ -28,6 +28,29 @@ typedef union _DECLSPEC_INTRIN_TYPE _CRT_ALIGN(16) __m128
extern __m128 _mm_load_ss(float const*);
extern int _mm_cvt_ss2si(__m128);
#ifdef _MSC_VER
unsigned int _mm_getcsr(void);
#pragma intrinsic(_mm_getcsr)
void _mm_setcsr(unsigned int);
#pragma intrinsic(_mm_setcsr)
#else
/*
* We can't use __builtin_ia32_* functions,
* are they are only available with the -msse2 compiler switch
*/
__INTRIN_INLINE unsigned int _mm_getcsr(void)
{
unsigned int retval;
__asm__ __volatile__("stmxcsr %0" : "=m"(retval));
return retval;
}
__INTRIN_INLINE void _mm_setcsr(unsigned int val)
{
__asm__ __volatile__("ldmxcsr %0" : : "m"(val));
}
#endif
/* Alternate names */
#define _mm_cvtss_si32 _mm_cvt_ss2si
+19 -17
View File
@@ -11248,36 +11248,38 @@ void __PREfastPagedCodeLocked(void);
/* ULONG
* BYTE_OFFSET(
* IN PVOID Va)
* _In_ PVOID Va)
*/
#define BYTE_OFFSET(Va) \
((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
/* ULONG
* BYTES_TO_PAGES(
* IN ULONG Size)
* _In_ ULONG Size)
*
* Note: This needs to be like this to avoid overflows!
*/
#define BYTES_TO_PAGES(Size) \
(((Size) + PAGE_SIZE - 1) >> PAGE_SHIFT)
(((Size) >> PAGE_SHIFT) + (((Size) & (PAGE_SIZE - 1)) != 0))
/* PVOID
* PAGE_ALIGN(
* IN PVOID Va)
* _In_ PVOID Va)
*/
#define PAGE_ALIGN(Va) \
((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
/* ULONG_PTR
* ROUND_TO_PAGES(
* IN ULONG_PTR Size)
* _In_ ULONG_PTR Size)
*/
#define ROUND_TO_PAGES(Size) \
(((ULONG_PTR) (Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
/* ULONG
* ADDRESS_AND_SIZE_TO_SPAN_PAGES(
* IN PVOID Va,
* IN ULONG Size)
* _In_ PVOID Va,
* _In_ ULONG Size)
*/
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size) \
((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
@@ -11289,7 +11291,7 @@ void __PREfastPagedCodeLocked(void);
/*
* ULONG
* MmGetMdlByteCount(
* IN PMDL Mdl)
* _In_ PMDL Mdl)
*/
#define MmGetMdlByteCount(_Mdl) \
((_Mdl)->ByteCount)
@@ -11307,7 +11309,7 @@ void __PREfastPagedCodeLocked(void);
/*
* PPFN_NUMBER
* MmGetMdlPfnArray(
* IN PMDL Mdl)
* _In_ PMDL Mdl)
*/
#define MmGetMdlPfnArray(_Mdl) \
((PPFN_NUMBER) ((_Mdl) + 1))
@@ -11315,7 +11317,7 @@ void __PREfastPagedCodeLocked(void);
/*
* PVOID
* MmGetMdlVirtualAddress(
* IN PMDL Mdl)
* _In_ PMDL Mdl)
*/
#define MmGetMdlVirtualAddress(_Mdl) \
((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
@@ -11324,7 +11326,7 @@ void __PREfastPagedCodeLocked(void);
#define MmLockPagableCodeSection(Address) MmLockPagableDataSection(Address)
/* PVOID MmGetSystemAddressForMdl(
* IN PMDL Mdl);
* _In_ PMDL Mdl);
*/
#define MmGetSystemAddressForMdl(Mdl) \
(((Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \
@@ -11334,8 +11336,8 @@ void __PREfastPagedCodeLocked(void);
/* PVOID
* MmGetSystemAddressForMdlSafe(
* IN PMDL Mdl,
* IN MM_PAGE_PRIORITY Priority)
* _In_ PMDL Mdl,
* _In_ MM_PAGE_PRIORITY Priority)
*/
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
(((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
@@ -11347,9 +11349,9 @@ void __PREfastPagedCodeLocked(void);
/*
* VOID
* MmInitializeMdl(
* IN PMDL MemoryDescriptorList,
* IN PVOID BaseVa,
* IN SIZE_T Length)
* _In_ PMDL MemoryDescriptorList,
* _In_ PVOID BaseVa,
* _In_ SIZE_T Length)
*/
#define MmInitializeMdl(_MemoryDescriptorList, \
_BaseVa, \
@@ -11367,7 +11369,7 @@ void __PREfastPagedCodeLocked(void);
/*
* VOID
* MmPrepareMdlForReuse(
* IN PMDL Mdl)
* _In_ PMDL Mdl)
*/
#define MmPrepareMdlForReuse(_Mdl) \
{ \
+2 -2
View File
@@ -380,7 +380,7 @@ DECLARE_INTERFACE_(IDirectMusic,IUnknown)
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectMusic methods ***/
STDMETHOD(EnumPort)(THIS_ DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) PURE;
STDMETHOD(CreateMusicBuffer)(THIS_ LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER **ppBuffer, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(CreateMusicBuffer)(THIS_ LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER *ppBuffer, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(CreatePort)(THIS_ REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT *ppPort, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(EnumMasterClock)(THIS_ DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) PURE;
STDMETHOD(GetMasterClock)(THIS_ LPGUID pguidClock, struct IReferenceClock **ppReferenceClock) PURE;
@@ -421,7 +421,7 @@ DECLARE_INTERFACE_(IDirectMusic8,IDirectMusic)
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectMusic methods ***/
STDMETHOD(EnumPort)(THIS_ DWORD dwIndex, LPDMUS_PORTCAPS pPortCaps) PURE;
STDMETHOD(CreateMusicBuffer)(THIS_ LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER **ppBuffer, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(CreateMusicBuffer)(THIS_ LPDMUS_BUFFERDESC pBufferDesc, LPDIRECTMUSICBUFFER *ppBuffer, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(CreatePort)(THIS_ REFCLSID rclsidPort, LPDMUS_PORTPARAMS pPortParams, LPDIRECTMUSICPORT *ppPort, LPUNKNOWN pUnkOuter) PURE;
STDMETHOD(EnumMasterClock)(THIS_ DWORD dwIndex, LPDMUS_CLOCKINFO lpClockInfo) PURE;
STDMETHOD(GetMasterClock)(THIS_ LPGUID pguidClock, struct IReferenceClock **ppReferenceClock) PURE;
+210 -130
View File
@@ -1,157 +1,237 @@
/*
* DirectMusic Software Synth Definitions
*
* Copyright (C) 2003-2004 Rok Mandeljc
*
* This program 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 program 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 program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _DMUSICS_
#define _DMUSICS_
#ifndef __WINE_DMUSIC_SOFTWARESYNTH_H
#define __WINE_DMUSIC_SOFTWARESYNTH_H
#include "dmusicc.h"
#include <dmusicc.h>
#define REGSTR_PATH_SOFTWARESYNTHS "Software\\Microsoft\\DirectMusic\\SoftwareSynths"
/*****************************************************************************
* Registry path
*/
#define REGSTR_PATH_SOFTWARESYNTHS "Software\\Microsoft\\DirectMusic\\SoftwareSynths"
interface IDirectMusicSynth;
interface IDirectMusicSynthSink;
/*****************************************************************************
* Predeclare the interfaces
*/
/* IIDs */
DEFINE_GUID(IID_IDirectMusicSynth, 0x09823661,0x5c85,0x11d2,0xaf,0xa6,0x00,0xaa,0x00,0x24,0xd8,0xb6);
DEFINE_GUID(IID_IDirectMusicSynth8, 0x53cab625,0x2711,0x4c9f,0x9d,0xe7,0x1b,0x7f,0x92,0x5f,0x6f,0xc8);
DEFINE_GUID(IID_IDirectMusicSynthSink, 0x09823663,0x5c85,0x11d2,0xaf,0xa6,0x00,0xaa,0x00,0x24,0xd8,0xb6);
/* typedef definitions */
typedef struct IDirectMusicSynth *LPDIRECTMUSICSYNTH;
typedef struct IDirectMusicSynth8 *LPDIRECTMUSICSYNTH8;
typedef struct IDirectMusicSynthSink *LPDIRECTMUSICSYNTHSINK;
/* GUIDs - property set */
DEFINE_GUID(GUID_DMUS_PROP_SetSynthSink, 0x0a3a5ba5,0x37b6,0x11d2,0xb9,0xf9,0x00,0x00,0xf8,0x75,0xac,0x12);
DEFINE_GUID(GUID_DMUS_PROP_SinkUsesDSound, 0xbe208857,0x8952,0x11d2,0xba,0x1c,0x00,0x00,0xf8,0x75,0xac,0x12);
/*****************************************************************************
* Flags
*/
#define REFRESH_F_LASTBUFFER 0x1
/*****************************************************************************
* Structures
*/
#ifndef _DMUS_VOICE_STATE_DEFINED
#define _DMUS_VOICE_STATE_DEFINED
/* typedef definition */
typedef struct _DMUS_VOICE_STATE DMUS_VOICE_STATE, *LPDMUS_VOICE_STATE;
DEFINE_GUID(IID_IDirectMusicSynth, 0x9823661, 0x5C85, 0x11D2, 0xAF, 0xA6, 0x00, 0xAA, 0x00, 0x24, 0xD8, 0xB6);
DEFINE_GUID(IID_IDirectMusicSynth8, 0x53CAB625, 0x2711, 0x4C9F, 0x9D, 0xE7, 0x1B, 0x7F, 0x92, 0x5F, 0x6F, 0xC8);
DEFINE_GUID(IID_IDirectMusicSynthSink, 0x09823663, 0x5C85, 0x11D2, 0xAF, 0xA6, 0x00, 0xAA, 0x00, 0x24, 0xD8, 0xB6);
DEFINE_GUID(GUID_DMUS_PROP_SetSynthSink, 0x0A3A5BA5, 0x37B6, 0x11D2, 0xB9, 0xF9, 0x00, 0x00, 0xF8, 0x75, 0xAC, 0x12);
DEFINE_GUID(GUID_DMUS_PROP_SinkUsesDSound, 0xBE208857, 0x8952, 0x11D2, 0xBA, 0x1C, 0x00, 0x00, 0xF8, 0x75, 0xAC, 0x12);
/* actual structure */
struct _DMUS_VOICE_STATE {
BOOL bExists;
SAMPLE_POSITION spPosition;
};
#endif /* _DMUS_VOICE_STATE_DEFINED */
#define REFRESH_F_LASTBUFFER 0x00000001
typedef struct _DMUS_VOICE_STATE
/*****************************************************************************
* IDirectMusicSynth interface
*/
#define INTERFACE IDirectMusicSynth
DECLARE_INTERFACE_(IDirectMusicSynth,IUnknown)
{
BOOL bExists;
SAMPLE_POSITION spPosition;
} DMUS_VOICE_STATE;
#endif
#undef INTERFACE
#define INTERFACE IDirectMusicSynth
DECLARE_INTERFACE_(IDirectMusicSynth, IUnknown)
{
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
STDMETHOD(Close) (THIS) PURE;
STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE;
STDMETHOD(Download) (THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree ) PURE;
STDMETHOD(Unload) (THIS_ HANDLE hDownload, HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData ) PURE;
STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt,LPBYTE pbBuffer, DWORD cbBuffer) PURE;
STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE;
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
STDMETHOD(SetSynthSink) (THIS_ struct IDirectMusicSynthSink *pSynthSink) PURE;
STDMETHOD(Render) (THIS_ short *pBuffer, DWORD dwLength, LONGLONG llPosition) PURE;
STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE;
STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize) PURE;
STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE;
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectMusicSynth methods ***/
STDMETHOD(Open)(THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
STDMETHOD(Close)(THIS) PURE;
STDMETHOD(SetNumChannelGroups)(THIS_ DWORD dwGroups) PURE;
STDMETHOD(Download)(THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree) PURE;
STDMETHOD(Unload)(THIS_ HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData) PURE;
STDMETHOD(PlayBuffer)(THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE;
STDMETHOD(GetRunningStats)(THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
STDMETHOD(GetPortCaps)(THIS_ LPDMUS_PORTCAPS pCaps) PURE;
STDMETHOD(SetMasterClock)(THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(GetLatencyClock)(THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate)(THIS_ BOOL fEnable) PURE;
STDMETHOD(SetSynthSink)(THIS_ struct IDirectMusicSynthSink *pSynthSink) PURE;
STDMETHOD(Render)(THIS_ short *pBuffer, DWORD dwLength, LONGLONG llPosition) PURE;
STDMETHOD(SetChannelPriority)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE;
STDMETHOD(GetChannelPriority)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE;
STDMETHOD(GetFormat)(THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSiz) PURE;
STDMETHOD(GetAppend)(THIS_ DWORD *pdwAppend) PURE;
};
#undef INTERFACE
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectMusicSynth_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirectMusicSynth_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectMusicSynth_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicSynth_Open(p, a) (p)->lpVtbl->Open(p, a)
#define IDirectMusicSynth_Close(p) (p)->lpVtbl->Close(p)
#define IDirectMusicSynth_SetNumChannelGroups(p, a) (p)->lpVtbl->SetNumChannelGroups(p, a)
#define IDirectMusicSynth_Download(p, a, b, c) (p)->lpVtbl->Download(p, a, b, c)
#define IDirectMusicSynth_Unload(p, a, b, c) (p)->lpVtbl->Unload(p, a, b, c)
#define IDirectMusicSynth_PlayBuffer(p, a, b, c) (p)->lpVtbl->PlayBuffer(p, a, b, c)
#define IDirectMusicSynth_GetRunningStats(p, a) (p)->lpVtbl->GetRunningStats(p, a)
#define IDirectMusicSynth_GetPortCaps(p, a) (p)->lpVtbl->GetPortCaps(p, a)
#define IDirectMusicSynth_SetMasterClock(p, a) (p)->lpVtbl->SetMasterClock((p, a)
#define IDirectMusicSynth_GetLatencyClock(p, a) (p)->lpVtbl->GetLatencyClock(p, a)
#define IDirectMusicSynth_Activate(p, a) (p)->lpVtbl->Activate((p, a)
#define IDirectMusicSynth_SetSynthSink(p, a) (p)->lpVtbl->SetSynthSink(p, a)
#define IDirectMusicSynth_Render(p, a, b, c) (p)->lpVtbl->Render(p, a, b, c)
#define IDirectMusicSynth_SetChannelPriority(p, a, b, c) (p)->lpVtbl->SetChannelPriority(p, a, b, c)
#define IDirectMusicSynth_GetChannelPriority(p, a, b, c) (p)->lpVtbl->GetChannelPriority(p, a, b, c)
#define IDirectMusicSynth_GetFormat(p, a, b) (p)->lpVtbl->GetFormat(p, a, b)
#define IDirectMusicSynth_GetAppend(p, a) (p)->lpVtbl->GetAppend(p, a)
/*** IUnknown methods ***/
#define IDirectMusicSynth_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectMusicSynth_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectMusicSynth_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectMusicSynth methods ***/
#define IDirectMusicSynth_Open(p,a) (p)->lpVtbl->Open(p,a)
#define IDirectMusicSynth_Close(p) (p)->lpVtbl->Close(p)
#define IDirectMusicSynth_SetNumChannelGroups(p,a) (p)->lpVtbl->SetNumChannelGroups(p,a)
#define IDirectMusicSynth_Download(p,a,b,c) (p)->lpVtbl->Download(p,a,b,c)
#define IDirectMusicSynth_Unload(p,a,b,c) (p)->lpVtbl->Unload(p,a,b,c)
#define IDirectMusicSynth_PlayBuffer(p,a,b,c) (p)->lpVtbl->PlayBuffer(p,a,b,c)
#define IDirectMusicSynth_GetRunningStats(p,a) (p)->lpVtbl->GetRunningStats(p,a)
#define IDirectMusicSynth_GetPortCaps(p,a) (p)->lpVtbl->GetPortCaps(p,a)
#define IDirectMusicSynth_SetMasterClock(p,a) (p)->lpVtbl->SetMasterClock(p,a)
#define IDirectMusicSynth_GetLatencyClock(p,a) (p)->lpVtbl->GetLatencyClock(p,a)
#define IDirectMusicSynth_Activate(p,a) (p)->lpVtbl->Activate(p,a)
#define IDirectMusicSynth_SetSynthSink(p,a) (p)->lpVtbl->SetSynthSink(p,a)
#define IDirectMusicSynth_Render(p,a,b,c) (p)->lpVtbl->Render(p,a,b,c)
#define IDirectMusicSynth_SetChannelPriority(p,a,b,c) (p)->lpVtbl->SetChannelPriority(p,a,b,c)
#define IDirectMusicSynth_GetChannelPriority(p,a,b,c) (p)->lpVtbl->GetChannelPriority(p,a,b,c)
#define IDirectMusicSynth_GetFormat(p,a,b) (p)->lpVtbl->GetFormat(p,a,b)
#define IDirectMusicSynth_GetAppend(p,a) (p)->lpVtbl->GetAppend(p,a)
#endif
#define INTERFACE IDirectMusicSynth8
DECLARE_INTERFACE_(IDirectMusicSynth8, IDirectMusicSynth)
/*****************************************************************************
* IDirectMusicSynth8 interface
*/
#define INTERFACE IDirectMusicSynth8
DECLARE_INTERFACE_(IDirectMusicSynth8,IDirectMusicSynth)
{
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
STDMETHOD(Open) (THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
STDMETHOD(Close) (THIS) PURE;
STDMETHOD(SetNumChannelGroups) (THIS_ DWORD dwGroups) PURE;
STDMETHOD(Download) (THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree ) PURE;
STDMETHOD(Unload) (THIS_ HANDLE hDownload, HRESULT ( CALLBACK *lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData ) PURE;
STDMETHOD(PlayBuffer) (THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE;
STDMETHOD(GetRunningStats) (THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
STDMETHOD(GetPortCaps) (THIS_ LPDMUS_PORTCAPS pCaps) PURE;
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
STDMETHOD(SetSynthSink) (THIS_ struct IDirectMusicSynthSink *pSynthSink) PURE;
STDMETHOD(Render) (THIS_ short *pBuffer, DWORD dwLength, LONGLONG llPosition) PURE;
STDMETHOD(SetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE;
STDMETHOD(GetChannelPriority) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE;
STDMETHOD(GetFormat) (THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSize) PURE;
STDMETHOD(GetAppend) (THIS_ DWORD* pdwAppend) PURE;
STDMETHOD(PlayVoice) (THIS_ REFERENCE_TIME rt, DWORD dwVoiceId, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwDLId, long prPitch, long vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart, SAMPLE_TIME stLoopEnd) PURE;
STDMETHOD(StopVoice) (THIS_ REFERENCE_TIME rt, DWORD dwVoiceId ) PURE;
STDMETHOD(GetVoiceState) (THIS_ DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[] ) PURE;
STDMETHOD(Refresh) (THIS_ DWORD dwDownloadID, DWORD dwFlags) PURE;
STDMETHOD(AssignChannelToBuses) (THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwBuses, DWORD cBuses) PURE;
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectMusicSynth methods ***/
STDMETHOD(Open)(THIS_ LPDMUS_PORTPARAMS pPortParams) PURE;
STDMETHOD(Close)(THIS) PURE;
STDMETHOD(SetNumChannelGroups)(THIS_ DWORD dwGroups) PURE;
STDMETHOD(Download)(THIS_ LPHANDLE phDownload, LPVOID pvData, LPBOOL pbFree) PURE;
STDMETHOD(Unload)(THIS_ HANDLE hDownload, HRESULT (CALLBACK* lpFreeHandle)(HANDLE,HANDLE), HANDLE hUserData) PURE;
STDMETHOD(PlayBuffer)(THIS_ REFERENCE_TIME rt, LPBYTE pbBuffer, DWORD cbBuffer) PURE;
STDMETHOD(GetRunningStats)(THIS_ LPDMUS_SYNTHSTATS pStats) PURE;
STDMETHOD(GetPortCaps)(THIS_ LPDMUS_PORTCAPS pCaps) PURE;
STDMETHOD(SetMasterClock)(THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(GetLatencyClock)(THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate)(THIS_ BOOL fEnable) PURE;
STDMETHOD(SetSynthSink)(THIS_ struct IDirectMusicSynthSink *pSynthSink) PURE;
STDMETHOD(Render)(THIS_ short *pBuffer, DWORD dwLength, LONGLONG llPosition) PURE;
STDMETHOD(SetChannelPriority)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, DWORD dwPriority) PURE;
STDMETHOD(GetChannelPriority)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwPriority) PURE;
STDMETHOD(GetFormat)(THIS_ LPWAVEFORMATEX pWaveFormatEx, LPDWORD pdwWaveFormatExSiz) PURE;
STDMETHOD(GetAppend)(THIS_ DWORD *pdwAppend) PURE;
/*** IDirectMusicSynth8 methods ***/
STDMETHOD(PlayVoice)(THIS_ REFERENCE_TIME rt, DWORD dwVoiceId, DWORD dwChannelGroup, DWORD dwChannel, DWORD dwDLId, LONG prPitch, LONG vrVolume, SAMPLE_TIME stVoiceStart, SAMPLE_TIME stLoopStart, SAMPLE_TIME stLoopEnd) PURE;
STDMETHOD(StopVoice)(THIS_ REFERENCE_TIME rt, DWORD dwVoiceId) PURE;
STDMETHOD(GetVoiceState)(THIS_ DWORD dwVoice[], DWORD cbVoice, DMUS_VOICE_STATE dwVoiceState[]) PURE;
STDMETHOD(Refresh)(THIS_ DWORD dwDownloadID, DWORD dwFlags) PURE;
STDMETHOD(AssignChannelToBuses)(THIS_ DWORD dwChannelGroup, DWORD dwChannel, LPDWORD pdwBuses, DWORD cBuses) PURE;
};
#undef INTERFACE
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
#define IDirectMusicSynth8_QueryInterface(p, a, b) (p)->lpVtbl->QueryInterface(p, a, b)
#define IDirectMusicSynth8_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectMusicSynth8_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicSynth8_Open(p, a) (p)->lpVtbl->Open(p, a)
#define IDirectMusicSynth8_Close(p) (p)->lpVtbl->Close(p)
#define IDirectMusicSynth8_SetNumChannelGroups(p, a) (p)->lpVtbl->SetNumChannelGroups(p, a)
#define IDirectMusicSynth8_Download(p, a, b, c) (p)->lpVtbl->Download(p, a, b, c)
#define IDirectMusicSynth8_Unload(p, a, b, c) (p)->lpVtbl->Unload(p, a, b, c)
#define IDirectMusicSynth8_PlayBuffer(p, a, b, c) (p)->lpVtbl->PlayBuffer(p, a, b, c)
#define IDirectMusicSynth8_GetRunningStats(p, a) (p)->lpVtbl->GetRunningStats(p, a)
#define IDirectMusicSynth8_GetPortCaps(p, a) (p)->lpVtbl->GetPortCaps(p, a)
#define IDirectMusicSynth8_SetMasterClock(p, a) (p)->lpVtbl->SetMasterClock((p, a)
#define IDirectMusicSynth8_GetLatencyClock(p, a) (p)->lpVtbl->GetLatencyClock(p, a)
#define IDirectMusicSynth8_Activate(p, a) (p)->lpVtbl->Activate((p, a)
#define IDirectMusicSynth8_SetSynthSink(p, a) (p)->lpVtbl->SetSynthSink(p, a)
#define IDirectMusicSynth8_Render(p, a, b, c) (p)->lpVtbl->Render(p, a, b, c)
#define IDirectMusicSynth8_SetChannelPriority(p, a, b, c) (p)->lpVtbl->SetChannelPriority(p, a, b, c)
#define IDirectMusicSynth8_GetChannelPriority(p, a, b, c) (p)->lpVtbl->GetChannelPriority(p, a, b, c)
#define IDirectMusicSynth8_GetFormat(p, a, b) (p)->lpVtbl->GetFormat(p, a, b)
#define IDirectMusicSynth8_GetAppend(p, a) (p)->lpVtbl->GetAppend(p, a)
#define IDirectMusicSynth8_PlayVoice(p, a, b, c, d, e, f, g, h, i, j) (p)->lpVtbl->PlayVoice(p, a, b, c, d, e, f, g, h, i, j)
#define IDirectMusicSynth8_StopVoice(p, a, b) (p)->lpVtbl->StopVoice(p, a, b)
#define IDirectMusicSynth8_GetVoiceState(p, a, b, c) (p)->lpVtbl->GetVoiceState(p, a, b, c)
#define IDirectMusicSynth8_Refresh(p, a, b) (p)->lpVtbl->Refresh(p, a, b)
#define IDirectMusicSynth8_AssignChannelToBuses(p, a, b, c, d) (p)->lpVtbl->AssignChannelToBuses(p, a, b, c, d)
/*** IUnknown methods ***/
#define IDirectMusicSynth8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectMusicSynth8_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectMusicSynth8_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectMusicSynth methods ***/
#define IDirectMusicSynth8_Open(p,a) (p)->lpVtbl->Open(p,a)
#define IDirectMusicSynth8_Close(p) (p)->lpVtbl->Close(p)
#define IDirectMusicSynth8_SetNumChannelGroups(p,a) (p)->lpVtbl->SetNumChannelGroups(p,a)
#define IDirectMusicSynth8_Download(p,a,b,c) (p)->lpVtbl->Download(p,a,b,c)
#define IDirectMusicSynth8_Unload(p,a,b,c) (p)->lpVtbl->Unload(p,a,b,c)
#define IDirectMusicSynth8_PlayBuffer(p,a,b,c) (p)->lpVtbl->PlayBuffer(p,a,b,c)
#define IDirectMusicSynth8_GetRunningStats(p,a) (p)->lpVtbl->GetRunningStats(p,a)
#define IDirectMusicSynth8_GetPortCaps(p,a) (p)->lpVtbl->GetPortCaps(p,a)
#define IDirectMusicSynth8_SetMasterClock(p,a) (p)->lpVtbl->SetMasterClock(p,a)
#define IDirectMusicSynth8_GetLatencyClock(p,a) (p)->lpVtbl->GetLatencyClock(p,a)
#define IDirectMusicSynth8_Activate(p,a) (p)->lpVtbl->Activate(p,a)
#define IDirectMusicSynth8_SetSynthSink(p,a) (p)->lpVtbl->SetSynthSink(p,a)
#define IDirectMusicSynth8_Render(p,a,b,c) (p)->lpVtbl->Render(p,a,b,c)
#define IDirectMusicSynth8_SetChannelPriority(p,a,b,c) (p)->lpVtbl->SetChannelPriority(p,a,b,c)
#define IDirectMusicSynth8_GetChannelPriority(p,a,b,c) (p)->lpVtbl->GetChannelPriority(p,a,b,c)
#define IDirectMusicSynth8_GetFormat(p,a,b) (p)->lpVtbl->GetFormat(p,a,b)
#define IDirectMusicSynth8_GetAppend(p,a) (p)->lpVtbl->GetAppend(p,a)
/*** IDirectMusicSynth8 methods ***/
#define IDirectMusicSynth8_PlayVoice(p,a,b,c,d,e,f,g,h,i,j) (p)->lpVtbl->PlayVoice(p,a,b,c,d,e,f,g,h,i,j)
#define IDirectMusicSynth8_StopVoice(p,a,b) (p)->lpVtbl->StopVoice(p,a,b)
#define IDirectMusicSynth8_GetVoiceState(p,a,b,c) (p)->lpVtbl->GetVoiceState(p,a,b,c)
#define IDirectMusicSynth8_Refresh(p,a,b) (p)->lpVtbl->Refresh(p,a,b)
#define IDirectMusicSynth8_AssignChannelToBuses(p,a,b,c,d) (p)->lpVtbl->AssignChannelToBuses(p,a,b,c,d)
#endif
#define INTERFACE IDirectMusicSynthSink
DECLARE_INTERFACE_(IDirectMusicSynthSink, IUnknown)
/*****************************************************************************
* IDirectMusicSynthSink interface
*/
#define INTERFACE IDirectMusicSynthSink
DECLARE_INTERFACE_(IDirectMusicSynthSink,IUnknown)
{
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
STDMETHOD(Init) (THIS_ IDirectMusicSynth *pSynth) PURE;
STDMETHOD(SetMasterClock) (THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(GetLatencyClock) (THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate) (THIS_ BOOL fEnable) PURE;
STDMETHOD(SampleToRefTime) (THIS_ LONGLONG llSampleTime, REFERENCE_TIME *prfTime) PURE;
STDMETHOD(RefTimeToSample) (THIS_ REFERENCE_TIME rfTime, LONGLONG *pllSampleTime) PURE;
STDMETHOD(SetDirectSound) (THIS_ LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE;
STDMETHOD(GetDesiredBufferSize) (THIS_ LPDWORD pdwBufferSizeInSamples) PURE;
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IDirectMusicSynthSink methods ***/
STDMETHOD(Init)(THIS_ IDirectMusicSynth *pSynth) PURE;
STDMETHOD(SetMasterClock)(THIS_ IReferenceClock *pClock) PURE;
STDMETHOD(GetLatencyClock)(THIS_ IReferenceClock **ppClock) PURE;
STDMETHOD(Activate)(THIS_ BOOL fEnable) PURE;
STDMETHOD(SampleToRefTime)(THIS_ LONGLONG llSampleTime, REFERENCE_TIME *prfTime) PURE;
STDMETHOD(RefTimeToSample)(THIS_ REFERENCE_TIME rfTime, LONGLONG *pllSampleTime) PURE;
STDMETHOD(SetDirectSound)(THIS_ LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer) PURE;
STDMETHOD(GetDesiredBufferSize)(THIS_ LPDWORD pdwBufferSizeInSamples) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IDirectMusicSynthSink_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IDirectMusicSynthSink_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IDirectMusicSynthSink_Release(p) (p)->lpVtbl->Release(p)
/*** IDirectMusicSynth methods ***/
#define IDirectMusicSynthSink_Init(p,a) (p)->lpVtbl->Init(p,a)
#define IDirectMusicSynthSink_SetMasterClock(p,a) (p)->lpVtbl->SetMasterClock(p,a)
#define IDirectMusicSynthSink_GetLatencyClock(p,a) (p)->lpVtbl->GetLatencyClock(p,a)
#define IDirectMusicSynthSink_Activate(p,a) (p)->lpVtbl->Activate(p,a)
#define IDirectMusicSynthSink_SampleToRefTime(p,a,b) (p)->lpVtbl->SampleToRefTime(p,a,b)
#define IDirectMusicSynthSink_RefTimeToSample(p,a,b) (p)->lpVtbl->RefTimeToSample(p,a,b)
#define IDirectMusicSynthSink_SetDirectSound(p,a,b) (p)->lpVtbl->SetDirectSound(p,a,b)
#define IDirectMusicSynthSink_GetDesiredBufferSize(p,a) (p)->lpVtbl->GetDesiredBufferSize(p,a)
#endif
#endif /* __WINE_DMUSIC_SOFTWARESYNTH_H */
+97 -45
View File
@@ -1,58 +1,110 @@
/*
* dmksctrl.h
* Definition of IKsControl
*
* Contributors:
* Created by Johannes Anderwald
* Copyright (C) 2012 Christian Costa
*
* THIS SOFTWARE IS NOT COPYRIGHTED
* 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 source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* 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
*/
#ifndef _IKsControl_
#define _IKsControl_
#ifndef _DMKSCTRL_
#define _DMKSCTRL_
#include <pshpack8.h>
#include <objbase.h>
#ifndef _KS_
#define _KS_
typedef struct {
union {
struct {
GUID Set;
ULONG Id;
ULONG Flags;
} DUMMYSTRUCTNAME;
LONGLONG Alignment;
} DUMMYUNIONNAME;
} KSIDENTIFIER, *PKSIDENTIFIER;
typedef KSIDENTIFIER KSPROPERTY, *PKSPROPERTY, KSMETHOD, *PKSMETHOD, KSEVENT, *PKSEVENT;
#define KSMETHOD_TYPE_NONE 0x00000000
#define KSMETHOD_TYPE_READ 0x00000001
#define KSMETHOD_TYPE_WRITE 0x00000002
#define KSMETHOD_TYPE_MODIFY 0x00000003
#define KSMETHOD_TYPE_SOURCE 0x00000004
#define KSMETHOD_TYPE_SEND 0x00000001
#define KSMETHOD_TYPE_SETSUPPORT 0x00000100
#define KSMETHOD_TYPE_BASICSUPPORT 0x00000200
#define KSPROPERTY_TYPE_GET 0x00000001
#define KSPROPERTY_TYPE_SET 0x00000002
#define KSPROPERTY_TYPE_SETSUPPORT 0x00000100
#define KSPROPERTY_TYPE_BASICSUPPORT 0x00000200
#define KSPROPERTY_TYPE_RELATIONS 0x00000400
#define KSPROPERTY_TYPE_SERIALIZESET 0x00000800
#define KSPROPERTY_TYPE_UNSERIALIZESET 0x00001000
#define KSPROPERTY_TYPE_SERIALIZERAW 0x00002000
#define KSPROPERTY_TYPE_UNSERIALIZERAW 0x00004000
#define KSPROPERTY_TYPE_SERIALIZESIZE 0x00008000
#define KSPROPERTY_TYPE_DEFAULTVALUES 0x00010000
#define KSPROPERTY_TYPE_TOPOLOGY 0x10000000
#undef INTERFACE
#define INTERFACE IKsControl
DECLARE_INTERFACE_(IKsControl, IUnknown)
DECLARE_INTERFACE_(IKsControl,IUnknown)
{
/* IUnknown */
STDMETHOD(QueryInterface) (THIS_ REFIID, LPVOID FAR *) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*IKsControl*/
STDMETHOD(KsProperty)(
THIS_
IN PKSPROPERTY Property,
IN ULONG PropertyLength,
IN OUT LPVOID PropertyData,
IN ULONG DataLength,
OUT ULONG* BytesReturned
) PURE;
STDMETHOD(KsMethod)(
THIS_
IN PKSMETHOD Method,
IN ULONG MethodLength,
IN OUT LPVOID MethodData,
IN ULONG DataLength,
OUT ULONG* BytesReturned
) PURE;
STDMETHOD(KsEvent)(
THIS_
IN PKSEVENT Event OPTIONAL,
IN ULONG EventLength,
IN OUT LPVOID EventData,
IN ULONG DataLength,
OUT ULONG* BytesReturned
) PURE;
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
STDMETHOD_(ULONG,Release)(THIS) PURE;
/*** IKsControl methods ***/
STDMETHOD(KsProperty)(THIS_ PKSPROPERTY Property, ULONG PropertyLength, LPVOID PropertyData,
ULONG DataLength, ULONG* BytesReturned) PURE;
STDMETHOD(KsMethod)(THIS_ PKSMETHOD Method, ULONG MethodLength, LPVOID MethodData,
ULONG DataLength, ULONG* BytesReturned) PURE;
STDMETHOD(KsEvent)(THIS_ PKSEVENT Event, ULONG EventLength, LPVOID EventData,
ULONG DataLength, ULONG* BytesReturned) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IKsControl_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IKsControl_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IKsControl_Release(p) (p)->lpVtbl->Release(p)
/*** IKsControl methods ***/
#define IKsControl_KsProperty(p,a,b,c,d,e) (p)->lpVtbl->KsProperty(p,a,b,c,d,e)
#define IKsControl_KsMethod(p,a,b,c,d,e) (p)->lpVtbl->KsMethod(p,a,b,c,d,e)
#define IKsControl_KsEvent(p,a,b,c,d,e) (p)->lpVtbl->KsEvent(p,a,b,c,d,e)
#endif
#endif /* _KS_ */
#include <poppack.h>
DEFINE_GUID(IID_IKsControl, 0x28f54685, 0x06fd, 0x11d2, 0xb2, 0x7a, 0x00, 0xa0, 0xc9, 0x22, 0x31, 0x96);
#ifndef _KSMEDIA_
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_MIDI, 0x1d262760, 0xe957, 0x11cf, 0xa5, 0xd6, 0x28, 0xdb, 0x04, 0xc1, 0x00, 0x00);
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_DIRECTMUSIC, 0x1a82f8bc, 0x3f8b, 0x11d2, 0xb7, 0x74, 0x00, 0x60, 0x08, 0x33, 0x16, 0xc1);
#endif
#endif /* _DMKSCTRL_ */
+23 -10
View File
@@ -13,7 +13,7 @@
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DPLAY_H
@@ -192,18 +192,16 @@ typedef struct tagDPNAME
{
LPWSTR lpszShortName;
LPSTR lpszShortNameA;
};
} DUMMYUNIONNAME1;
union /*playerLongName */ /* Player's formal/real name */
{
LPWSTR lpszLongName;
LPSTR lpszLongNameA;
};
} DUMMYUNIONNAME2;
} DPNAME, *LPDPNAME;
#define DPLONGNAMELEN 52
#define DPSHORTNAMELEN 20
#define DPSESSIONNAMELEN 32
@@ -244,13 +242,13 @@ typedef struct tagDPSESSIONDESC2
{
LPWSTR lpszSessionName;
LPSTR lpszSessionNameA;
};
} DUMMYUNIONNAME1;
union /* Optional password */
{
LPWSTR lpszPassword;
LPSTR lpszPasswordA;
};
} DUMMYUNIONNAME2;
DWORD dwReserved1;
DWORD dwReserved2;
@@ -260,8 +258,6 @@ typedef struct tagDPSESSIONDESC2
DWORD dwUser3;
DWORD dwUser4;
} DPSESSIONDESC2, *LPDPSESSIONDESC2;
typedef const DPSESSIONDESC2* LPCDPSESSIONDESC2;
#define DPOPEN_JOIN 0x00000001
@@ -279,6 +275,9 @@ typedef const DPSESSIONDESC2* LPCDPSESSIONDESC2;
#define DPSESSION_PASSWORDREQUIRED 0x00000400
#define DPSESSION_MULTICASTSERVER 0x00000800
#define DPSESSION_CLIENTSERVER 0x00001000
#define DPSESSION_DIRECTPLAYPROTOCOL 0x00002000
#define DPSESSION_NOPRESERVEORDER 0x00004000
#define DPSESSION_OPTIMIZELATENCY 0x00008000
typedef struct tagDPLCONNECTION
{
@@ -396,7 +395,7 @@ typedef BOOL (CALLBACK *LPDPENUMSESSIONSCALLBACK)(
extern HRESULT WINAPI DirectPlayEnumerateA( LPDPENUMDPCALLBACKA, LPVOID );
extern HRESULT WINAPI DirectPlayEnumerateW( LPDPENUMDPCALLBACKW, LPVOID );
extern HRESULT WINAPI DirectPlayCreate( LPGUID lpGUID, LPDIRECTPLAY2 *lplpDP, IUnknown *pUnk);
extern HRESULT WINAPI DirectPlayCreate( LPGUID lpGUID, LPDIRECTPLAY *lplpDP, IUnknown *pUnk );
typedef BOOL (CALLBACK *LPDPENUMPLAYERSCALLBACK)(
DPID dpId,
@@ -1065,6 +1064,20 @@ DECLARE_INTERFACE_(IDirectPlay4,IDirectPlay3)
/* DirectPlay::Connect */
#define DPCONNECT_RETURNSTATUS (DPENUMSESSIONS_RETURNSTATUS)
/* DirectPlay::GetCaps and DirectPlay::GetPlayerCaps */
#define DPCAPS_ISHOST 0x00000002
#define DPCAPS_GROUPOPTIMIZED 0x00000008
#define DPCAPS_KEEPALIVEOPTIMIZED 0x00000010
#define DPCAPS_GUARANTEEDOPTIMIZED 0x00000020
#define DPCAPS_GUARANTEEDSUPPORTED 0x00000040
#define DPCAPS_SIGNINGSUPPORTED 0x00000080
#define DPCAPS_ENCRYPTIONSUPPORTED 0x00000100
#define DPPLAYERCAPS_LOCAL 0x00000800
#define DPCAPS_ASYNCCANCELSUPPORTED 0x00001000
#define DPCAPS_ASYNCCANCELALLSUPPORTED 0x00002000
#define DPCAPS_SENDTIMEOUTSUPPORTED 0x00004000
#define DPCAPS_SENDPRIORITYSUPPORTED 0x00008000
#define DPCAPS_ASYNCSUPPORTED 0x00010000
/** DirectPlay system messages **/
+3 -15
View File
@@ -85,21 +85,9 @@ typedef PVOID PKSWORKER;
#define DEFINE_GUIDSTRUCT(guid, name) struct __declspec(uuid(guid)) name
#define DEFINE_GUIDNAMED(name) __uuidof(struct name)
#else
extern "C++" {
template<typename T> const GUID &__mingw_uuidof();
}
#define DEFINE_GUIDSTRUCT(guid, name) \
struct __guid ## name; \
extern "C++" { \
template<> inline const GUID &__mingw_uuidof<__guid ## name>() { \
static const IID iid = {STATICGUIDOF(name)}; \
return iid; \
} \
template<> inline const GUID &__mingw_uuidof<__guid ## name *>() { \
return __mingw_uuidof<__guid ## name>(); \
} \
}
#define DEFINE_GUIDNAMED(name) __mingw_uuidof<__guid ## name>()
#define DEFINE_GUIDSTRUCT(guid, name) \
extern const DECLSPEC_SELECTANY GUID __uuid__##name={STATIC_##name};
#define DEFINE_GUIDNAMED(name) __uuid__##name
#endif
#else
#define DEFINE_GUIDSTRUCT(guid, name) DEFINE_GUIDEX(name)
@@ -13,23 +13,19 @@
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_DIRECT_PLAY_SP_H
#define __WINE_DIRECT_PLAY_SP_H
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#include <stdarg.h>
//#include <stdarg.h>
//#include "windef.h"
#include <winbase.h>
//#include "winuser.h"
//#include "dplay.h"
#include <dplobby.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "dplay.h"
#include "dplobby.h"
/* GUID for IDirectPlaySP {0C9F6360-CC61-11cf-ACEC-00AA006886E3} */
DEFINE_GUID(IID_IDirectPlaySP, 0xc9f6360, 0xcc61, 0x11cf, 0xac, 0xec, 0x0, 0xaa, 0x0, 0x68, 0x86, 0xe3);
+19 -17
View File
@@ -45,36 +45,38 @@ $if (_WDMDDK_)
/* ULONG
* BYTE_OFFSET(
* IN PVOID Va)
* _In_ PVOID Va)
*/
#define BYTE_OFFSET(Va) \
((ULONG) ((ULONG_PTR) (Va) & (PAGE_SIZE - 1)))
/* ULONG
* BYTES_TO_PAGES(
* IN ULONG Size)
* _In_ ULONG Size)
*
* Note: This needs to be like this to avoid overflows!
*/
#define BYTES_TO_PAGES(Size) \
(((Size) + PAGE_SIZE - 1) >> PAGE_SHIFT)
(((Size) >> PAGE_SHIFT) + (((Size) & (PAGE_SIZE - 1)) != 0))
/* PVOID
* PAGE_ALIGN(
* IN PVOID Va)
* _In_ PVOID Va)
*/
#define PAGE_ALIGN(Va) \
((PVOID) ((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
/* ULONG_PTR
* ROUND_TO_PAGES(
* IN ULONG_PTR Size)
* _In_ ULONG_PTR Size)
*/
#define ROUND_TO_PAGES(Size) \
(((ULONG_PTR) (Size) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
/* ULONG
* ADDRESS_AND_SIZE_TO_SPAN_PAGES(
* IN PVOID Va,
* IN ULONG Size)
* _In_ PVOID Va,
* _In_ ULONG Size)
*/
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size) \
((ULONG) ((((ULONG_PTR) (_Va) & (PAGE_SIZE - 1)) \
@@ -86,7 +88,7 @@ $if (_WDMDDK_)
/*
* ULONG
* MmGetMdlByteCount(
* IN PMDL Mdl)
* _In_ PMDL Mdl)
*/
#define MmGetMdlByteCount(_Mdl) \
((_Mdl)->ByteCount)
@@ -104,7 +106,7 @@ $if (_WDMDDK_)
/*
* PPFN_NUMBER
* MmGetMdlPfnArray(
* IN PMDL Mdl)
* _In_ PMDL Mdl)
*/
#define MmGetMdlPfnArray(_Mdl) \
((PPFN_NUMBER) ((_Mdl) + 1))
@@ -112,7 +114,7 @@ $if (_WDMDDK_)
/*
* PVOID
* MmGetMdlVirtualAddress(
* IN PMDL Mdl)
* _In_ PMDL Mdl)
*/
#define MmGetMdlVirtualAddress(_Mdl) \
((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset))
@@ -121,7 +123,7 @@ $if (_WDMDDK_)
#define MmLockPagableCodeSection(Address) MmLockPagableDataSection(Address)
/* PVOID MmGetSystemAddressForMdl(
* IN PMDL Mdl);
* _In_ PMDL Mdl);
*/
#define MmGetSystemAddressForMdl(Mdl) \
(((Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA | \
@@ -131,8 +133,8 @@ $if (_WDMDDK_)
/* PVOID
* MmGetSystemAddressForMdlSafe(
* IN PMDL Mdl,
* IN MM_PAGE_PRIORITY Priority)
* _In_ PMDL Mdl,
* _In_ MM_PAGE_PRIORITY Priority)
*/
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority) \
(((_Mdl)->MdlFlags & (MDL_MAPPED_TO_SYSTEM_VA \
@@ -144,9 +146,9 @@ $if (_WDMDDK_)
/*
* VOID
* MmInitializeMdl(
* IN PMDL MemoryDescriptorList,
* IN PVOID BaseVa,
* IN SIZE_T Length)
* _In_ PMDL MemoryDescriptorList,
* _In_ PVOID BaseVa,
* _In_ SIZE_T Length)
*/
#define MmInitializeMdl(_MemoryDescriptorList, \
_BaseVa, \
@@ -164,7 +166,7 @@ $if (_WDMDDK_)
/*
* VOID
* MmPrepareMdlForReuse(
* IN PMDL Mdl)
* _In_ PMDL Mdl)
*/
#define MmPrepareMdlForReuse(_Mdl) \
{ \
+1 -1
View File
@@ -787,7 +787,7 @@ static BOOL parse_expect_no_attr(xmlbuf_t* xmlbuf, BOOL* end)
while (next_xml_attr(xmlbuf, &attr_name, &attr_value, &error, end))
{
attr_nameU = xmlstr2unicode(&attr_name);
attr_valueU = xmlstr2unicode(&attr_name);
attr_valueU = xmlstr2unicode(&attr_value);
DPRINT1( "unexpected attr %wZ=%wZ\n", &attr_nameU,
&attr_valueU);
}
+1 -1
View File
@@ -322,7 +322,7 @@ static BOOL update_threadlocinfo_category(LCID lcid, unsigned short cp,
len += GetLocaleInfoA(lcid, LOCALE_SENGCOUNTRY
|LOCALE_NOUSEROVERRIDE, &buf[len], 256-len);
buf[len-1] = '.';
sprintf(buf+len, "%d", cp);
sprintf(buf+len, "%u", cp);
len += strlen(buf+len)+1;
loc->locinfo->lc_category[category].locale = MSVCRT_malloc(len);
+1 -1
View File
@@ -35,7 +35,7 @@ _assert (
(msvcrt_error_mode == _OUT_TO_STDERR))
{
/* Print 'Assertion failed: x<y, file foo.c, line 45' to stderr */
fprintf(stderr, "Assertion failed: %s, file %s, line %d\n", exp, file, line);
fprintf(stderr, "Assertion failed: %s, file %s, line %u\n", exp, file, line);
abort();
}
+1 -1
View File
@@ -418,7 +418,7 @@ __mingw_invalidParameterHandler (const wchar_t * __UNUSED_PARAM_1(expression),
uintptr_t __UNUSED_PARAM(pReserved))
{
#ifdef __MINGW_SHOW_INVALID_PARAMETER_EXCEPTION
wprintf(L"Invalid parameter detected in function %s. File: %s Line: %d\n", function, file, line);
wprintf(L"Invalid parameter detected in function %s. File: %s Line: %u\n", function, file, line);
wprintf(L"Expression: %s\n", expression);
#endif
}
+8 -8
View File
@@ -30,9 +30,9 @@ The following libraries are shared with Wine.
reactos/dll/directx/amstream # Synced to Wine-1.3.37
reactos/dll/directx/dinput # Synced to Wine-20090208
reactos/dll/directx/dinput8 # Synced to Wine-20090208
reactos/dll/directx/dmusic # Synced to Wine-1_1_23
reactos/dll/directx/dplay # Synced to Wine-0_9_5
reactos/dll/directx/dplayx # Synced to Wine-0_9_5
reactos/dll/directx/dmusic # Synced to Wine-1.5.26
reactos/dll/directx/dplay # Synced to Wine-1.5.26
reactos/dll/directx/dplayx # Synced to Wine-1.5.26
reactos/dll/directx/dxdiagn # Synced to Wine-0_9_5
reactos/dll/directx/msdmo # Autosync
reactos/dll/directx/qedit # Autosync
@@ -53,17 +53,17 @@ reactos/dll/win32/comdlg32 # Synced to Wine 1.3.37
reactos/dll/win32/compstui # Synced to Wine-1.5.19
reactos/dll/win32/credui # Synced to Wine-1.5.4
reactos/dll/win32/crypt32 # Synced to Wine-1.5.26
reactos/dll/win32/cryptdlg # Synced to Wine-1.5.4
reactos/dll/win32/cryptdll # Synced to Wine-1.5.4
reactos/dll/win32/cryptnet # Synced to Wine-1.3.37
reactos/dll/win32/cryptui # Synced to Wine-1.5.4
reactos/dll/win32/cryptdlg # Synced to Wine-1.5.26
reactos/dll/win32/cryptdll # Synced to Wine-1.5.26
reactos/dll/win32/cryptnet # Synced to Wine-1.5.26
reactos/dll/win32/cryptui # Synced to Wine-1.5.26
reactos/dll/win32/dbghelp # Synced to Wine-1.3.37
reactos/dll/win32/dciman32 # Synced to Wine-1.5.19
reactos/dll/win32/dwmapi # Synced to Wine-1.5.19
reactos/dll/win32/faultrep # Synced to Wine-1.5.4
reactos/dll/win32/fusion # Synced to Wine-1.5.4
reactos/dll/win32/gdiplus # Synced to Wine-1.5.4
reactos/dll/win32/hhctrl.ocx # Autosync
reactos/dll/win32/hhctrl.ocx # Synced to Wine-1.5.26
reactos/dll/win32/hlink # Synced to Wine-1.5.4
reactos/dll/win32/hnetcfg # Synced to Wine-1.5.4
reactos/dll/win32/httpapi # Synced to Wine-1.5.4
+1 -1
View File
@@ -756,7 +756,7 @@ KiTrap07Handler(IN PKTRAP_FRAME TrapFrame)
//Ke386SaveFpuState(NpxSaveArea);
/* Update NPX state */
Thread->NpxState = NPX_STATE_NOT_LOADED;
NpxThread->NpxState = NPX_STATE_NOT_LOADED;
}
/* Load FPU state */
+1 -1
View File
@@ -4081,7 +4081,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
//
// Make sure that this address range actually fits within the VAD for it
//
if (((StartingAddress >> PAGE_SHIFT) < FoundVad->StartingVpn) &&
if (((StartingAddress >> PAGE_SHIFT) < FoundVad->StartingVpn) ||
((EndingAddress >> PAGE_SHIFT) > FoundVad->EndingVpn))
{
DPRINT1("Address range does not fit into the VAD\n");
+1 -1
View File
@@ -103,7 +103,7 @@ IntGetScrollBarRect (PWND Wnd, INT nBar, RECTL *lprect)
case SB_VERT:
if(Wnd->ExStyle & WS_EX_LEFTSCROLLBAR)
{
lprect->right = lprect->right;;
lprect->right = lprect->left;
lprect->left -= UserGetSystemMetrics(SM_CXVSCROLL);
}
else