move more dlls

svn path=/trunk/; revision=21025
This commit is contained in:
Ged Murphy 2006-02-17 00:04:10 +00:00
parent d3d484148f
commit 0443356e34
225 changed files with 73087 additions and 0 deletions

View file

@ -0,0 +1,19 @@
; File generated automatically from lzexpand/lz32.spec; do not edit!
LIBRARY lz32.dll
EXPORTS
CopyLZFile@8=KERNEL32.CopyLZFile
GetExpandedNameA@8=KERNEL32.GetExpandedNameA
GetExpandedNameW@8=KERNEL32.GetExpandedNameW
LZClose@4=KERNEL32.LZClose
;LZCloseFile
LZCopy@8=KERNEL32.LZCopy
;LZCreateFileW
LZDone@0=KERNEL32.LZDone
LZInit@4=KERNEL32.LZInit
LZOpenFileA@12=KERNEL32.LZOpenFileA
LZOpenFileW@12=KERNEL32.LZOpenFileW
LZRead@12=KERNEL32.LZRead
LZSeek@12=KERNEL32.LZSeek
LZStart@0=KERNEL32.LZStart

View file

@ -0,0 +1,5 @@
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "Lempel-Ziv Expander\0"
#define REACTOS_STR_INTERNAL_NAME "lz32\0"
#define REACTOS_STR_ORIGINAL_FILENAME "lz32.dll\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,10 @@
<module name="lz32" type="win32dll" baseaddress="${BASEADDRESS_LZ32}" installbase="system32" installname="lz32.dll">
<importlibrary definition="lz32.def" />
<include base="lz32">.</include>
<define name="_DISABLE_TIDENTS" />
<define name="__USE_W32API" />
<library>ntdll</library>
<library>kernel32</library>
<file>lzexpand_main.c</file>
<file>lz32.rc</file>
</module>

View file

@ -0,0 +1,29 @@
/*
* LZ Decompression functions
*
* Copyright 1996 Marcus Meissner
*
* 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
*/
#include "windows.h"
BOOL STDCALL
DllMain(HANDLE hDll,
DWORD dwReason,
LPVOID lpReserved)
{
return TRUE;
}

View file

@ -0,0 +1,182 @@
/*
* MAPI Default IMalloc implementation
*
* Copyright 2004 Jon Griffiths
*
* 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
*/
#include <stdarg.h>
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "winerror.h"
#include "winternl.h"
#include "objbase.h"
#include "shlwapi.h"
#include "mapiutil.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
static const IMallocVtbl MAPI_IMalloc_vt;
typedef struct
{
const IMallocVtbl *lpVtbl;
LONG lRef;
} MAPI_IMALLOC;
static MAPI_IMALLOC MAPI_IMalloc = { &MAPI_IMalloc_vt, 0u };
extern LONG MAPI_ObjectCount; /* In mapi32_main.c */
/*************************************************************************
* MAPIGetDefaultMalloc@0 (MAPI32.59)
*
* Get the default MAPI IMalloc interface.
*
* PARAMS
* None.
*
* RETURNS
* A pointer to the MAPI default allocator.
*/
LPMALLOC WINAPI MAPIGetDefaultMalloc(void)
{
TRACE("()\n");
IMalloc_AddRef((LPMALLOC)&MAPI_IMalloc);
return (LPMALLOC)&MAPI_IMalloc;
}
/**************************************************************************
* IMAPIMalloc_QueryInterface
*/
static HRESULT WINAPI IMAPIMalloc_fnQueryInterface(LPMALLOC iface, REFIID refiid,
LPVOID *ppvObj)
{
TRACE("(%s,%p)\n", debugstr_guid(refiid), ppvObj);
if (IsEqualIID(refiid, &IID_IUnknown) ||
IsEqualIID(refiid, &IID_IMalloc))
{
*ppvObj = (LPMALLOC) &MAPI_IMalloc;
TRACE("Returning IMalloc (%p)\n", *ppvObj);
return S_OK;
}
TRACE("Returning E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/**************************************************************************
* IMAPIMalloc_AddRef
*/
static ULONG WINAPI IMAPIMalloc_fnAddRef(LPMALLOC iface)
{
TRACE("(%p)\n", iface);
InterlockedIncrement(&MAPI_ObjectCount);
return 1u;
}
/**************************************************************************
* IMAPIMalloc_Release
*/
static ULONG WINAPI IMAPIMalloc_fnRelease(LPMALLOC iface)
{
TRACE("(%p)\n", iface);
InterlockedDecrement(&MAPI_ObjectCount);
return 1u;
}
/**************************************************************************
* IMAPIMalloc_Alloc
*/
static LPVOID WINAPI IMAPIMalloc_fnAlloc(LPMALLOC iface, DWORD cb)
{
TRACE("(%p)->(%ld)\n", iface, cb);
return LocalAlloc(LMEM_FIXED, cb);
}
/**************************************************************************
* IMAPIMalloc_Realloc
*/
static LPVOID WINAPI IMAPIMalloc_fnRealloc(LPMALLOC iface, LPVOID pv, DWORD cb)
{
TRACE("(%p)->(%p, %ld)\n", iface, pv, cb);
if (!pv)
return LocalAlloc(LMEM_FIXED, cb);
if (cb)
return LocalReAlloc((HANDLE) pv, cb, LMEM_MOVEABLE);
LocalFree((HANDLE) pv);
return NULL;
}
/**************************************************************************
* IMAPIMalloc_Free
*/
static void WINAPI IMAPIMalloc_fnFree(LPMALLOC iface, LPVOID pv)
{
TRACE("(%p)->(%p)\n", iface, pv);
LocalFree((HANDLE) pv);
}
/**************************************************************************
* IMAPIMalloc_GetSize
*/
static DWORD WINAPI IMAPIMalloc_fnGetSize(LPMALLOC iface, LPVOID pv)
{
TRACE("(%p)->(%p)\n", iface, pv);
return LocalSize((HANDLE) pv);
}
/**************************************************************************
* IMAPIMalloc_DidAlloc
*/
static INT WINAPI IMAPIMalloc_fnDidAlloc(LPMALLOC iface, LPVOID pv)
{
TRACE("(%p)->(%p)\n", iface, pv);
return -1;
}
/**************************************************************************
* IMAPIMalloc_HeapMinimize
*/
static void WINAPI IMAPIMalloc_fnHeapMinimize(LPMALLOC iface)
{
TRACE("(%p)\n", iface);
}
static const IMallocVtbl MAPI_IMalloc_vt =
{
IMAPIMalloc_fnQueryInterface,
IMAPIMalloc_fnAddRef,
IMAPIMalloc_fnRelease,
IMAPIMalloc_fnAlloc,
IMAPIMalloc_fnRealloc,
IMAPIMalloc_fnFree,
IMAPIMalloc_fnGetSize,
IMAPIMalloc_fnDidAlloc,
IMAPIMalloc_fnHeapMinimize
};

View file

@ -0,0 +1,191 @@
8 stub @
10 stdcall MAPILogonEx(long ptr ptr long ptr)
11 stdcall MAPILogonEx@20(long ptr ptr long ptr) MAPILogonEx
12 stdcall MAPIAllocateBuffer(long ptr)
13 stdcall MAPIAllocateBuffer@8(long ptr) MAPIAllocateBuffer
14 stdcall MAPIAllocateMore(long ptr ptr)
15 stdcall MAPIAllocateMore@12(long ptr ptr) MAPIAllocateMore
16 stdcall MAPIFreeBuffer(ptr)
17 stdcall MAPIFreeBuffer@4(ptr) MAPIFreeBuffer
18 stub MAPIAdminProfiles
19 stub MAPIAdminProfiles@8
20 stdcall MAPIInitialize(ptr)
21 stdcall MAPIInitialize@4(ptr) MAPIInitialize
22 stdcall MAPIUninitialize()
23 stdcall MAPIUninitialize@0() MAPIUninitialize
24 stub PRProviderInit
25 stub LAUNCHWIZARD
26 stub LaunchWizard@20
27 stub DllGetClassObject
28 stdcall -private DllCanUnloadNow()
29 stub MAPIOpenFormMgr
30 stub MAPIOpenFormMgr@8
31 stub MAPIOpenLocalFormContainer
32 stub MAPIOpenLocalFormContainer@4
33 stdcall ScInitMapiUtil@4(long) ScInitMapiUtil
34 stdcall DeinitMapiUtil@0() DeinitMapiUtil
35 stub ScGenerateMuid@4
36 stub HrAllocAdviseSink@12
41 stdcall WrapProgress@20(ptr ptr ptr ptr ptr) WrapProgress
42 stdcall HrThisThreadAdviseSink@8(ptr ptr) HrThisThreadAdviseSink
43 stub ScBinFromHexBounded@12
44 stdcall FBinFromHex@8(ptr ptr) FBinFromHex
45 stdcall HexFromBin@12(ptr long ptr) HexFromBin
46 stub BuildDisplayTable@40
47 stdcall SwapPlong@8(ptr long) SwapPlong
48 stdcall SwapPword@8(ptr long) SwapPword
49 stub MAPIInitIdle@4
50 stub MAPIDeinitIdle@0
51 stub InstallFilterHook@4
52 stub FtgRegisterIdleRoutine@20
53 stub EnableIdleRoutine@8
54 stub DeregisterIdleRoutine@4
55 stub ChangeIdleRoutine@28
59 stdcall MAPIGetDefaultMalloc@0() MAPIGetDefaultMalloc
60 stdcall CreateIProp@24(ptr ptr ptr ptr ptr ptr) CreateIProp
61 stub CreateTable@36
62 stdcall MNLS_lstrlenW@4(wstr) MNLS_lstrlenW
63 stdcall MNLS_lstrcmpW@8(wstr wstr) MNLS_lstrcmpW
64 stdcall MNLS_lstrcpyW@8(ptr wstr) MNLS_lstrcpyW
65 stdcall MNLS_CompareStringW@24(long wstr wstr) MNLS_CompareStringW
66 stdcall MNLS_MultiByteToWideChar@24(long long str long ptr long) kernel32.MultiByteToWideChar
67 stdcall MNLS_WideCharToMultiByte@32(long long wstr long ptr long ptr ptr) kernel32.WideCharToMultiByte
68 stdcall MNLS_IsBadStringPtrW@8(ptr long) kernel32.IsBadStringPtrW
72 stdcall FEqualNames@8(ptr ptr) FEqualNames
73 stub WrapStoreEntryID@24
74 stdcall IsBadBoundedStringPtr@8(ptr long) IsBadBoundedStringPtr
75 stub HrQueryAllRows@24
76 stdcall PropCopyMore@16(ptr ptr ptr ptr) PropCopyMore
77 stdcall UlPropSize@4(ptr) UlPropSize
78 stdcall FPropContainsProp@12(ptr ptr long) FPropContainsProp
79 stdcall FPropCompareProp@12(ptr long ptr) FPropCompareProp
80 stdcall LPropCompareProp@8(ptr ptr) LPropCompareProp
81 stub HrAddColumns@16
82 stub HrAddColumnsEx@20
121 stdcall -ret64 FtAddFt@16(double double) MAPI32_FtAddFt
122 stub FtAdcFt@20
123 stdcall -ret64 FtSubFt@16(double double) MAPI32_FtSubFt
124 stdcall -ret64 FtMulDw@12(long double) MAPI32_FtMulDw
125 stdcall -ret64 FtMulDwDw@8(long long) MAPI32_FtMulDwDw
126 stdcall -ret64 FtNegFt@8(double) MAPI32_FtNegFt
127 stub FtDivFtBogus@20
128 stdcall UlAddRef@4(ptr) UlAddRef
129 stdcall UlRelease@4(ptr) UlRelease
130 stdcall SzFindCh@8(str long) shlwapi.StrChrA
131 stdcall SzFindLastCh@8(str str long) shlwapi.StrRChrA
132 stdcall SzFindSz@8(str str) shlwapi.StrStrA
133 stdcall UFromSz@4(str) UFromSz
135 stdcall HrGetOneProp@12(ptr long ptr) HrGetOneProp
136 stdcall HrSetOneProp@8(ptr ptr) HrSetOneProp
137 stdcall FPropExists@8(ptr long) FPropExists
138 stdcall PpropFindProp@12(ptr long long) PpropFindProp
139 stdcall FreePadrlist@4(ptr) FreePadrlist
140 stdcall FreeProws@4(ptr) FreeProws
141 stub HrSzFromEntryID@12
142 stub HrEntryIDFromSz@12
143 stub HrComposeEID@28
144 stub HrDecomposeEID@28
145 stub HrComposeMsgID@24
146 stub HrDecomposeMsgID@24
147 stdcall OpenStreamOnFile@24(ptr ptr ptr ptr ptr ptr) OpenStreamOnFile
148 stdcall OpenStreamOnFile(ptr ptr ptr ptr ptr ptr)
149 stub OpenTnefStream@28
150 stub OpenTnefStream
151 stub OpenTnefStreamEx@32
152 stub OpenTnefStreamEx
153 stub GetTnefStreamCodepage@12
154 stub GetTnefStreamCodepage
155 stdcall UlFromSzHex@4(ptr) UlFromSzHex
156 stub UNKOBJ_ScAllocate@12
157 stub UNKOBJ_ScAllocateMore@16
158 stub UNKOBJ_Free@8
159 stub UNKOBJ_FreeRows@8
160 stub UNKOBJ_ScCOAllocate@12
161 stub UNKOBJ_ScCOReallocate@12
162 stub UNKOBJ_COFree@8
163 stub UNKOBJ_ScSzFromIdsAlloc@20
164 stub ScCountNotifications@12
165 stub ScCopyNotifications@16
166 stub ScRelocNotifications@20
170 stdcall ScCountProps@12(long ptr ptr) ScCountProps
171 stdcall ScCopyProps@16(long ptr ptr ptr) ScCopyProps
172 stdcall ScRelocProps@20(long ptr ptr ptr ptr) ScRelocProps
173 stdcall LpValFindProp@12(long long ptr) LpValFindProp
174 stdcall ScDupPropset@16(long ptr ptr ptr) ScDupPropset
175 stdcall FBadRglpszA@8(ptr long) FBadRglpszA
176 stdcall FBadRglpszW@8(ptr long) FBadRglpszW
177 stdcall FBadRowSet@4(ptr) FBadRowSet
178 stub FBadRglpNameID@8
179 stdcall FBadPropTag@4(long) FBadPropTag
180 stdcall FBadRow@4(ptr) FBadRow
181 stdcall FBadProp@4(ptr) FBadProp
182 stdcall FBadColumnSet@4(ptr) FBadColumnSet
183 stub RTFSync@12
184 stub RTFSync
185 stub WrapCompressedRTFStream@12
186 stub WrapCompressedRTFStream
187 stub __ValidateParameters@8
188 stub __CPPValidateParameters@8
189 stub FBadSortOrderSet@4
190 stdcall FBadEntryList@4(ptr) FBadEntryList
191 stub FBadRestriction@4
192 stub ScUNCFromLocalPath@12
193 stub ScLocalPathFromUNC@12
194 stub HrIStorageFromStream@16
195 stub HrValidateIPMSubtree@20
196 stub OpenIMsgSession@12
197 stub CloseIMsgSession@4
198 stub OpenIMsgOnIStg@44
199 stub SetAttribIMsgOnIStg@16
200 stub GetAttribIMsgOnIStg@12
201 stub MapStorageSCode@4
202 stub ScMAPIXFromCMC
203 stub ScMAPIXFromSMAPI
204 stub EncodeID@12
205 stub FDecodeID@12
206 stub CchOfEncoding@4
207 stdcall CbOfEncoded@4(ptr) CbOfEncoded
208 stub MAPISendDocuments
209 stdcall MAPILogon(long ptr ptr long long ptr)
210 stub MAPILogoff
211 stub MAPISendMail
212 stub MAPISaveMail
213 stub MAPIReadMail
214 stub MAPIFindNext
215 stub MAPIDeleteMail
217 stub MAPIAddress
218 stub MAPIDetails
219 stub MAPIResolveName
220 stub BMAPISendMail
221 stub BMAPISaveMail
222 stub BMAPIReadMail
223 stub BMAPIGetReadMail
224 stub BMAPIFindNext
225 stub BMAPIAddress
226 stub BMAPIGetAddress
227 stub BMAPIDetails
228 stub BMAPIResolveName
229 stub cmc_act_on
230 stub cmc_free
231 stub cmc_list
232 stub cmc_logoff
233 stub cmc_logon
234 stub cmc_look_up
235 stdcall cmc_query_configuration( long long ptr ptr )
236 stub cmc_read
237 stub cmc_send
238 stub cmc_send_documents
239 stub HrDispatchNotifications@4
241 stub HrValidateParameters@8
244 stub ScCreateConversationIndex@16
246 stub HrGetOmiProvidersFlags
247 stub HrGetOmiProvidersFlags@8
248 stub HrSetOmiProvidersFlagsInvalid
249 stub HrSetOmiProvidersFlagsInvalid@4
250 stub GetOutlookVersion
251 stub GetOutlookVersion@0
252 stub FixMAPI
253 stub FixMAPI@0
# This entry point is sometimes used to detect if the mapi dll came from Outlook
#254 stub FGetComponentPath
#255 stub FGetComponentPath@20

View file

@ -0,0 +1,19 @@
<module name="mapi32" type="win32dll" baseaddress="${BASEADDRESS_MAPI32}" installbase="system32" installname="mapi32.dll">
<importlibrary definition="mapi32.spec.def" />
<include base="mapi32">.</include>
<include base="ReactOS">include/wine</include>
<define name="__USE_W32API" />
<define name="_WIN32_WINNT">0x501</define>
<define name="__WINESRC__" />
<library>ntdll</library>
<library>kernel32</library>
<library>shlwapi</library>
<library>wine</library>
<library>uuid</library>
<library>advapi32</library>
<file>mapi32_main.c</file>
<file>imalloc.c</file>
<file>prop.c</file>
<file>util.c</file>
<file>mapi32.spec</file>
</module>

View file

@ -0,0 +1,94 @@
/*
* MAPI basics
*
* Copyright 2001 CodeWeavers Inc.
*
* 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
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "objbase.h"
#include "mapix.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
LONG MAPI_ObjectCount = 0;
/***********************************************************************
* DllMain (MAPI32.init)
*/
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
{
TRACE("(%p,%ld,%p)\n", hinstDLL, fdwReason, fImpLoad);
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
break;
case DLL_PROCESS_DETACH:
TRACE("DLL_PROCESS_DETACH: %ld objects remaining\n", MAPI_ObjectCount);
break;
}
return TRUE;
}
/***********************************************************************
* DllCanUnloadNow (MAPI32.28)
*
* Determine if this dll can be unloaded from the callers address space.
*
* PARAMS
* None.
*
* RETURNS
* S_OK, if the dll can be unloaded,
* S_FALSE, otherwise.
*/
HRESULT WINAPI DllCanUnloadNow(void)
{
return MAPI_ObjectCount == 0 ? S_OK : S_FALSE;
}
HRESULT WINAPI MAPIInitialize ( LPVOID lpMapiInit )
{
ERR("Stub\n");
return MAPI_E_NOT_INITIALIZED;
}
ULONG WINAPI MAPILogon(ULONG ulUIParam, LPSTR lpszProfileName, LPSTR
lpszPassword, FLAGS flFlags, ULONG ulReserver, LPLHANDLE lplhSession)
{
ERR("Stub\n");
return MAPI_E_LOGON_FAILED;
}
HRESULT WINAPI MAPILogonEx(ULONG_PTR ulUIParam, LPWSTR lpszProfileName,
LPWSTR lpszPassword, ULONG flFlags,
LPMAPISESSION *lppSession)
{
ERR("Stub\n");
return MAPI_E_LOGON_FAILED;
}
VOID WINAPI MAPIUninitialize(void)
{
ERR("Stub\n");
}

2549
reactos/dll/mapi32/prop.c Normal file

File diff suppressed because it is too large Load diff

823
reactos/dll/mapi32/util.c Normal file
View file

@ -0,0 +1,823 @@
/*
* MAPI Utility functions
*
* Copyright 2004 Jon Griffiths
*
* 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
*/
#include <stdarg.h>
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "winerror.h"
#include "winternl.h"
#include "objbase.h"
#include "shlwapi.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "mapival.h"
#include "xcmc.h"
WINE_DEFAULT_DEBUG_CHANNEL(mapi);
static const BYTE digitsToHex[] = {
0,1,2,3,4,5,6,7,8,9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,10,11,12,13,14,15,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,10,11,12,13,
14,15 };
/**************************************************************************
* ScInitMapiUtil (MAPI32.33)
*
* Initialise Mapi utility functions.
*
* PARAMS
* ulReserved [I] Reserved, pass 0.
*
* RETURNS
* Success: S_OK. Mapi utility functions may be called.
* Failure: MAPI_E_INVALID_PARAMETER, if ulReserved is not 0.
*
* NOTES
* Your application does not need to call this function unless it does not
* call MAPIInitialize()/MAPIUninitialize().
*/
SCODE WINAPI ScInitMapiUtil(ULONG ulReserved)
{
FIXME("(0x%08lx)stub!\n", ulReserved);
if (ulReserved)
return MAPI_E_INVALID_PARAMETER;
return S_OK;
}
/**************************************************************************
* DeinitMapiUtil (MAPI32.34)
*
* Uninitialise Mapi utility functions.
*
* PARAMS
* None.
*
* RETURNS
* Nothing.
*
* NOTES
* Your application does not need to call this function unless it does not
* call MAPIInitialize()/MAPIUninitialize().
*/
VOID WINAPI DeinitMapiUtil(void)
{
FIXME("()stub!\n");
}
typedef LPVOID *LPMAPIALLOCBUFFER;
/**************************************************************************
* MAPIAllocateBuffer (MAPI32.12)
* MAPIAllocateBuffer@8 (MAPI32.13)
*
* Allocate a block of memory.
*
* PARAMS
* cbSize [I] Size of the block to allocate in bytes
* lppBuffer [O] Destination for pointer to allocated memory
*
* RETURNS
* Success: S_OK. *lppBuffer is filled with a pointer to a memory block of
* length cbSize bytes.
* Failure: MAPI_E_INVALID_PARAMETER, if lppBuffer is NULL.
* MAPI_E_NOT_ENOUGH_MEMORY, if the memory allocation fails.
*
* NOTES
* Memory allocated with this function should be freed with MAPIFreeBuffer().
* Further allocations of memory may be linked to the pointer returned using
* MAPIAllocateMore(). Linked allocations are freed when the initial pointer
* is feed.
*/
SCODE WINAPI MAPIAllocateBuffer(ULONG cbSize, LPVOID *lppBuffer)
{
LPMAPIALLOCBUFFER lpBuff;
TRACE("(%ld,%p)\n", cbSize, lppBuffer);
if (!lppBuffer)
return E_INVALIDARG;
lpBuff = HeapAlloc(GetProcessHeap(), 0, cbSize + sizeof(*lpBuff));
if (!lpBuff)
return MAPI_E_NOT_ENOUGH_MEMORY;
TRACE("initial allocation:%p, returning %p\n", lpBuff, lpBuff + 1);
*lpBuff++ = NULL;
*lppBuffer = lpBuff;
return S_OK;
}
/**************************************************************************
* MAPIAllocateMore (MAPI32.14)
* MAPIAllocateMore@12 (MAPI32.15)
*
* Allocate a block of memory linked to a previous allocation.
*
* PARAMS
* cbSize [I] Size of the block to allocate in bytes
* lpOrig [I] Initial allocation to link to, from MAPIAllocateBuffer()
* lppBuffer [O] Destination for pointer to allocated memory
*
* RETURNS
* Success: S_OK. *lppBuffer is filled with a pointer to a memory block of
* length cbSize bytes.
* Failure: MAPI_E_INVALID_PARAMETER, if lpOrig or lppBuffer is invalid.
* MAPI_E_NOT_ENOUGH_MEMORY, if memory allocation fails.
*
* NOTES
* Memory allocated with this function and stored in *lppBuffer is freed
* when lpOrig is passed to MAPIFreeBuffer(). It should not be freed independently.
*/
SCODE WINAPI MAPIAllocateMore(ULONG cbSize, LPVOID lpOrig, LPVOID *lppBuffer)
{
LPMAPIALLOCBUFFER lpBuff = lpOrig;
TRACE("(%ld,%p,%p)\n", cbSize, lpOrig, lppBuffer);
if (!lppBuffer || !lpBuff || !--lpBuff)
return E_INVALIDARG;
/* Find the last allocation in the chain */
while (*lpBuff)
{
TRACE("linked:%p->%p\n", lpBuff, *lpBuff);
lpBuff = *lpBuff;
}
if (SUCCEEDED(MAPIAllocateBuffer(cbSize, lppBuffer)))
{
*lpBuff = ((LPMAPIALLOCBUFFER)*lppBuffer) - 1;
TRACE("linking %p->%p\n", lpBuff, *lpBuff);
}
return *lppBuffer ? S_OK : MAPI_E_NOT_ENOUGH_MEMORY;
}
/**************************************************************************
* MAPIFreeBuffer (MAPI32.16)
* MAPIFreeBuffer@4 (MAPI32.17)
*
* Free a block of memory and any linked allocations associated with it.
*
* PARAMS
* lpBuffer [I] Memory to free, returned from MAPIAllocateBuffer()
*
* RETURNS
* S_OK.
*/
ULONG WINAPI MAPIFreeBuffer(LPVOID lpBuffer)
{
LPMAPIALLOCBUFFER lpBuff = lpBuffer;
TRACE("(%p)\n", lpBuffer);
if (lpBuff && --lpBuff)
{
while (lpBuff)
{
LPVOID lpFree = lpBuff;
lpBuff = *lpBuff;
TRACE("linked:%p->%p, freeing %p\n", lpFree, lpBuff, lpFree);
HeapFree(GetProcessHeap(), 0, lpFree);
}
}
return S_OK;
}
/**************************************************************************
* WrapProgress@20 (MAPI32.41)
*/
HRESULT WINAPI WrapProgress(PVOID unk1, PVOID unk2, PVOID unk3, PVOID unk4, PVOID unk5)
{
/* Native does not implement this function */
return MAPI_E_NO_SUPPORT;
}
/*************************************************************************
* HrThisThreadAdviseSink@8 (MAPI32.42)
*
* Ensure that an advise sink is only notified in its originating thread.
*
* PARAMS
* lpSink [I] IMAPIAdviseSink interface to be protected
* lppNewSink [I] Destination for wrapper IMAPIAdviseSink interface
*
* RETURNS
* Success: S_OK. *lppNewSink contains a new sink to use in place of lpSink.
* Failure: E_INVALIDARG, if any parameter is invalid.
*/
HRESULT WINAPI HrThisThreadAdviseSink(LPMAPIADVISESINK lpSink, LPMAPIADVISESINK* lppNewSink)
{
FIXME("(%p,%p)semi-stub\n", lpSink, lppNewSink);
if (!lpSink || !lppNewSink)
return E_INVALIDARG;
/* Don't wrap the sink for now, just copy it */
*lppNewSink = lpSink;
IMAPIAdviseSink_AddRef(lpSink);
return S_OK;
}
/*************************************************************************
* FBinFromHex (MAPI32.44)
*
* Create an array of binary data from a string.
*
* PARAMS
* lpszHex [I] String to convert to binary data
* lpOut [O] Destination for resulting binary data
*
* RETURNS
* Success: TRUE. lpOut contains the decoded binary data.
* Failure: FALSE, if lpszHex does not represent a binary string.
*
* NOTES
* - lpOut must be at least half the length of lpszHex in bytes.
* - Although the Mapi headers prototype this function as both
* Ascii and Unicode, there is only one (Ascii) implementation. This
* means that lpszHex is treated as an Ascii string (i.e. a single NUL
* character in the byte stream terminates the string).
*/
BOOL WINAPI FBinFromHex(LPWSTR lpszHex, LPBYTE lpOut)
{
LPSTR lpStr = (LPSTR)lpszHex;
TRACE("(%p,%p)\n", lpszHex, lpOut);
while (*lpStr)
{
if (lpStr[0] < '0' || lpStr[0] > 'f' || digitsToHex[lpStr[0] - '0'] == 0xff ||
lpStr[1] < '0' || lpStr[1] > 'f' || digitsToHex[lpStr[1] - '0'] == 0xff)
return FALSE;
*lpOut++ = (digitsToHex[lpStr[0] - '0'] << 4) | digitsToHex[lpStr[1] - '0'];
lpStr += 2;
}
return TRUE;
}
/*************************************************************************
* HexFromBin (MAPI32.45)
*
* Create a string from an array of binary data.
*
* PARAMS
* lpHex [I] Binary data to convert to string
* iCount [I] Length of lpHex in bytes
* lpszOut [O] Destination for resulting hex string
*
* RETURNS
* Nothing.
*
* NOTES
* - lpszOut must be at least 2 * iCount + 1 bytes characters long.
* - Although the Mapi headers prototype this function as both
* Ascii and Unicode, there is only one (Ascii) implementation. This
* means that the resulting string is not properly NUL terminated
* if the caller expects it to be a Unicode string.
*/
void WINAPI HexFromBin(LPBYTE lpHex, int iCount, LPWSTR lpszOut)
{
static const char hexDigits[] = { "0123456789ABCDEF" };
LPSTR lpStr = (LPSTR)lpszOut;
TRACE("(%p,%d,%p)\n", lpHex, iCount, lpszOut);
while (iCount-- > 0)
{
*lpStr++ = hexDigits[*lpHex >> 4];
*lpStr++ = hexDigits[*lpHex & 0xf];
lpHex++;
}
*lpStr = '\0';
}
/*************************************************************************
* SwapPlong@8 (MAPI32.47)
*
* Swap the bytes in a ULONG array.
*
* PARAMS
* lpData [O] Array to swap bytes in
* ulLen [I] Number of ULONG element to swap the bytes of
*
* RETURNS
* Nothing.
*/
VOID WINAPI SwapPlong(PULONG lpData, ULONG ulLen)
{
ULONG i;
for (i = 0; i < ulLen; i++)
lpData[i] = RtlUlongByteSwap(lpData[i]);
}
/*************************************************************************
* SwapPword@8 (MAPI32.48)
*
* Swap the bytes in a USHORT array.
*
* PARAMS
* lpData [O] Array to swap bytes in
* ulLen [I] Number of USHORT element to swap the bytes of
*
* RETURNS
* Nothing.
*/
VOID WINAPI SwapPword(PUSHORT lpData, ULONG ulLen)
{
ULONG i;
for (i = 0; i < ulLen; i++)
lpData[i] = RtlUshortByteSwap(lpData[i]);
}
/**************************************************************************
* MNLS_lstrlenW@4 (MAPI32.62)
*
* Calculate the length of a Unicode string.
*
* PARAMS
* lpszStr [I] String to calculate the length of
*
* RETURNS
* The length of lpszStr in Unicode characters.
*/
ULONG WINAPI MNLS_lstrlenW(LPCWSTR lpszStr)
{
TRACE("(%s)\n", debugstr_w(lpszStr));
return strlenW(lpszStr);
}
/*************************************************************************
* MNLS_lstrcmpW@8 (MAPI32.63)
*
* Compare two Unicode strings.
*
* PARAMS
* lpszLeft [I] First string to compare
* lpszRight [I] Second string to compare
*
* RETURNS
* An integer less than, equal to or greater than 0, indicating that
* lpszLeft is less than, the same, or greater than lpszRight.
*/
INT WINAPI MNLS_lstrcmpW(LPCWSTR lpszLeft, LPCWSTR lpszRight)
{
TRACE("(%s,%s)\n", debugstr_w(lpszLeft), debugstr_w(lpszRight));
return strcmpW(lpszLeft, lpszRight);
}
/*************************************************************************
* MNLS_lstrcpyW@8 (MAPI32.64)
*
* Copy a Unicode string to another string.
*
* PARAMS
* lpszDest [O] Destination string
* lpszSrc [I] Source string
*
* RETURNS
* The length lpszDest in Unicode characters.
*/
ULONG WINAPI MNLS_lstrcpyW(LPWSTR lpszDest, LPCWSTR lpszSrc)
{
ULONG len;
TRACE("(%p,%s)\n", lpszDest, debugstr_w(lpszSrc));
len = (strlenW(lpszSrc) + 1) * sizeof(WCHAR);
memcpy(lpszDest, lpszSrc, len);
return len;
}
/*************************************************************************
* MNLS_CompareStringW@12 (MAPI32.65)
*
* Compare two Unicode strings.
*
* PARAMS
* dwCp [I] Code page for the comparison
* lpszLeft [I] First string to compare
* lpszRight [I] Second string to compare
*
* RETURNS
* CSTR_LESS_THAN, CSTR_EQUAL or CSTR_GREATER_THAN, indicating that
* lpszLeft is less than, the same, or greater than lpszRight.
*/
INT WINAPI MNLS_CompareStringW(DWORD dwCp, LPCWSTR lpszLeft, LPCWSTR lpszRight)
{
INT ret;
TRACE("0x%08lx,%s,%s\n", dwCp, debugstr_w(lpszLeft), debugstr_w(lpszRight));
ret = MNLS_lstrcmpW(lpszLeft, lpszRight);
return ret < 0 ? CSTR_LESS_THAN : ret ? CSTR_GREATER_THAN : CSTR_EQUAL;
}
/**************************************************************************
* FEqualNames@8 (MAPI32.72)
*
* Compare two Mapi names.
*
* PARAMS
* lpName1 [I] First name to compare to lpName2
* lpName2 [I] Second name to compare to lpName1
*
* RETURNS
* TRUE, if the names are the same,
* FALSE, Otherwise.
*/
BOOL WINAPI FEqualNames(LPMAPINAMEID lpName1, LPMAPINAMEID lpName2)
{
TRACE("(%p,%p)\n", lpName1, lpName2);
if (!lpName1 || !lpName2 ||
!IsEqualGUID(lpName1->lpguid, lpName2->lpguid) ||
lpName1->ulKind != lpName2->ulKind)
return FALSE;
if (lpName1->ulKind == MNID_STRING)
return !strcmpW(lpName1->Kind.lpwstrName, lpName2->Kind.lpwstrName);
return lpName1->Kind.lID == lpName2->Kind.lID ? TRUE : FALSE;
}
/**************************************************************************
* IsBadBoundedStringPtr@8 (MAPI32.71)
*
* Determine if a string pointer is valid.
*
* PARAMS
* lpszStr [I] String to check
* ulLen [I] Maximum length of lpszStr
*
* RETURNS
* TRUE, if lpszStr is invalid or longer than ulLen,
* FALSE, otherwise.
*/
BOOL WINAPI IsBadBoundedStringPtr(LPCSTR lpszStr, ULONG ulLen)
{
if (!lpszStr || IsBadStringPtrA(lpszStr, -1) || strlen(lpszStr) >= ulLen)
return TRUE;
return FALSE;
}
/**************************************************************************
* FtAddFt@16 (MAPI32.121)
*
* Add two FILETIME's together.
*
* PARAMS
* ftLeft [I] FILETIME to add to ftRight
* ftRight [I] FILETIME to add to ftLeft
*
* RETURNS
* The sum of ftLeft and ftRight
*/
LONGLONG WINAPI MAPI32_FtAddFt(FILETIME ftLeft, FILETIME ftRight)
{
LONGLONG *pl = (LONGLONG*)&ftLeft, *pr = (LONGLONG*)&ftRight;
return *pl + *pr;
}
/**************************************************************************
* FtSubFt@16 (MAPI32.123)
*
* Subtract two FILETIME's together.
*
* PARAMS
* ftLeft [I] Initial FILETIME
* ftRight [I] FILETIME to subtract from ftLeft
*
* RETURNS
* The remainder after ftRight is subtracted from ftLeft.
*/
LONGLONG WINAPI MAPI32_FtSubFt(FILETIME ftLeft, FILETIME ftRight)
{
LONGLONG *pl = (LONGLONG*)&ftLeft, *pr = (LONGLONG*)&ftRight;
return *pr - *pl;
}
/**************************************************************************
* FtMulDw@12 (MAPI32.124)
*
* Multiply a FILETIME by a DWORD.
*
* PARAMS
* dwLeft [I] DWORD to multiply with ftRight
* ftRight [I] FILETIME to multiply with dwLeft
*
* RETURNS
* The product of dwLeft and ftRight
*/
LONGLONG WINAPI MAPI32_FtMulDw(DWORD dwLeft, FILETIME ftRight)
{
LONGLONG *pr = (LONGLONG*)&ftRight;
return (LONGLONG)dwLeft * (*pr);
}
/**************************************************************************
* FtMulDwDw@8 (MAPI32.125)
*
* Multiply two DWORD, giving the result as a FILETIME.
*
* PARAMS
* dwLeft [I] DWORD to multiply with dwRight
* dwRight [I] DWORD to multiply with dwLeft
*
* RETURNS
* The product of ftMultiplier and ftMultiplicand as a FILETIME.
*/
LONGLONG WINAPI MAPI32_FtMulDwDw(DWORD dwLeft, DWORD dwRight)
{
return (LONGLONG)dwLeft * (LONGLONG)dwRight;
}
/**************************************************************************
* FtNegFt@8 (MAPI32.126)
*
* Negate a FILETIME.
*
* PARAMS
* ft [I] FILETIME to negate
*
* RETURNS
* The negation of ft.
*/
LONGLONG WINAPI MAPI32_FtNegFt(FILETIME ft)
{
LONGLONG *p = (LONGLONG*)&ft;
return - *p;
}
/**************************************************************************
* UlAddRef@4 (MAPI32.128)
*
* Add a reference to an object.
*
* PARAMS
* lpUnk [I] Object to add a reference to.
*
* RETURNS
* The new reference count of the object, or 0 if lpUnk is NULL.
*
* NOTES
* See IUnknown_AddRef.
*/
ULONG WINAPI UlAddRef(void *lpUnk)
{
TRACE("(%p)\n", lpUnk);
if (!lpUnk)
return 0UL;
return IUnknown_AddRef((LPUNKNOWN)lpUnk);
}
/**************************************************************************
* UlRelease@4 (MAPI32.129)
*
* Remove a reference from an object.
*
* PARAMS
* lpUnk [I] Object to remove reference from.
*
* RETURNS
* The new reference count of the object, or 0 if lpUnk is NULL. If lpUnk is
* non-NULL and this function returns 0, the object pointed to by lpUnk has
* been released.
*
* NOTES
* See IUnknown_Release.
*/
ULONG WINAPI UlRelease(void *lpUnk)
{
TRACE("(%p)\n", lpUnk);
if (!lpUnk)
return 0UL;
return IUnknown_Release((LPUNKNOWN)lpUnk);
}
/**************************************************************************
* UFromSz@4 (MAPI32.133)
*
* Read an integer from a string
*
* PARAMS
* lpszStr [I] String to read the integer from.
*
* RETURNS
* Success: The integer read from lpszStr.
* Failure: 0, if the first character in lpszStr is not 0-9.
*
* NOTES
* This function does not accept whitespace and stops at the first non-digit
* character.
*/
UINT WINAPI UFromSz(LPCSTR lpszStr)
{
ULONG ulRet = 0;
TRACE("(%s)\n", debugstr_a(lpszStr));
if (lpszStr)
{
while (*lpszStr >= '0' && *lpszStr <= '9')
{
ulRet = ulRet * 10 + (*lpszStr - '0');
lpszStr = CharNextA(lpszStr);
}
}
return ulRet;
}
/*************************************************************************
* OpenStreamOnFile@24 (MAPI32.147)
*
* Create a stream on a file.
*
* PARAMS
* lpAlloc [I] Memory allocation function
* lpFree [I] Memory free function
* ulFlags [I] Flags controlling the opening process
* lpszPath [I] Path of file to create stream on
* lpszPrefix [I] Prefix of the temporary file name (if ulFlags includes SOF_UNIQUEFILENAME)
* lppStream [O] Destination for created stream
*
* RETURNS
* Success: S_OK. lppStream contains the new stream object
* Failure: E_INVALIDARG if any parameter is invalid, or an HRESULT error code
* describing the error.
*/
HRESULT WINAPI OpenStreamOnFile(LPALLOCATEBUFFER lpAlloc, LPFREEBUFFER lpFree,
ULONG ulFlags, LPWSTR lpszPath, LPWSTR lpszPrefix,
LPSTREAM *lppStream)
{
WCHAR szBuff[MAX_PATH];
DWORD dwMode = STGM_READWRITE, dwAttributes = 0;
HRESULT hRet;
TRACE("(%p,%p,0x%08lx,%s,%s,%p)\n", lpAlloc, lpFree, ulFlags,
debugstr_a((LPSTR)lpszPath), debugstr_a((LPSTR)lpszPrefix), lppStream);
if (lppStream)
*lppStream = NULL;
if (ulFlags & SOF_UNIQUEFILENAME)
{
FIXME("Should generate a temporary name\n");
return E_INVALIDARG;
}
if (!lpszPath || !lppStream)
return E_INVALIDARG;
/* FIXME: Should probably munge mode and attributes, and should handle
* Unicode arguments (I assume MAPI_UNICODE is set in ulFlags if
* we are being passed Unicode strings; MSDN doesn't say).
* This implementation is just enough for Outlook97 to start.
*/
MultiByteToWideChar(CP_ACP, 0, (LPSTR)lpszPath, -1, szBuff, MAX_PATH);
hRet = SHCreateStreamOnFileEx(szBuff, dwMode, dwAttributes, TRUE,
NULL, lppStream);
return hRet;
}
/*************************************************************************
* UlFromSzHex@4 (MAPI32.155)
*
* Read an integer from a hexadecimal string.
*
* PARAMS
* lpSzHex [I] String containing the hexadecimal number to read
*
* RETURNS
* Success: The number represented by lpszHex.
* Failure: 0, if lpszHex does not contain a hex string.
*
* NOTES
* This function does not accept whitespace and stops at the first non-hex
* character.
*/
ULONG WINAPI UlFromSzHex(LPCWSTR lpszHex)
{
LPSTR lpStr = (LPSTR)lpszHex;
ULONG ulRet = 0;
TRACE("(%s)\n", debugstr_a(lpStr));
while (*lpStr)
{
if (lpStr[0] < '0' || lpStr[0] > 'f' || digitsToHex[lpStr[0] - '0'] == 0xff ||
lpStr[1] < '0' || lpStr[1] > 'f' || digitsToHex[lpStr[1] - '0'] == 0xff)
break;
ulRet = ulRet * 16 + ((digitsToHex[lpStr[0] - '0'] << 4) | digitsToHex[lpStr[1] - '0']);
lpStr += 2;
}
return ulRet;
}
/************************************************************************
* FBadEntryList@4 (MAPI32.190)
*
* Determine is an entry list is invalid.
*
* PARAMS
* lpEntryList [I] List to check
*
* RETURNS
* TRUE, if lpEntryList is invalid,
* FALSE, otherwise.
*/
BOOL WINAPI FBadEntryList(LPENTRYLIST lpEntryList)
{
ULONG i;
if (IsBadReadPtr(lpEntryList, sizeof(*lpEntryList)) ||
IsBadReadPtr(lpEntryList->lpbin,
lpEntryList->cValues * sizeof(*lpEntryList->lpbin)))
return TRUE;
for (i = 0; i < lpEntryList->cValues; i++)
if(IsBadReadPtr(lpEntryList->lpbin[i].lpb, lpEntryList->lpbin[i].cb))
return TRUE;
return FALSE;
}
/*************************************************************************
* CbOfEncoded@4 (MAPI32.207)
*
* Return the length of an encoded string.
*
* PARAMS
* lpSzEnc [I] Encoded string to get the length of.
*
* RETURNS
* The length of the encoded string in bytes.
*/
ULONG WINAPI CbOfEncoded(LPCSTR lpszEnc)
{
ULONG ulRet = 0;
TRACE("(%s)\n", debugstr_a(lpszEnc));
if (lpszEnc)
ulRet = (((strlen(lpszEnc) | 3) >> 2) + 1) * 3;
return ulRet;
}
/*************************************************************************
* cmc_query_configuration (MAPI32.235)
*
* Retrieves the configuration information for the installed CMC
*
* PARAMS
* session [I] MAPI session handle
* item [I] Enumerated variable that identifies which
* configuration information is being requested
* reference [O] Buffer where configuration information is written
* config_extensions[I/O] Path of file to create stream on
*
* RETURNS
* A CMD define
*/
CMC_return_code WINAPI cmc_query_configuration(
CMC_session_id session,
CMC_enum item,
CMC_buffer reference,
CMC_extension *config_extensions)
{
FIXME("stub");
return CMC_E_NOT_SUPPORTED;
}

106
reactos/dll/mmdrv/auxil.c Normal file
View file

@ -0,0 +1,106 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Multimedia
* FILE: lib/mmdrv/auxil.c
* PURPOSE: Multimedia User Mode Driver
* PROGRAMMER: Andrew Greenwood
* Aleksey Bragin
* UPDATE HISTORY:
* Mar 16, 2004: Created skeleton implementation
*/
#include "mmdrv.h"
#include "wave.h"
#define NDEBUG
#include <debug.h>
APIENTRY DWORD auxMessage(UINT dwId,
UINT uMessage,
DWORD dwUser,
DWORD dwParam1,
DWORD dwParam2)
{
MMRESULT Result;
AUX_DD_VOLUME Volume;
DPRINT("auxMessage\n");
// the following cases are documented by DDK
switch (uMessage)
{
case AUXDM_GETDEVCAPS:
DPRINT("AUXDM_GETDEVCAPS");
return GetDeviceCapabilities(dwId, AuxDevice, (LPBYTE)dwParam1, (DWORD)dwParam2);
case AUXDM_GETNUMDEVS:
DPRINT("AUXDM_GETNUMDEVS");
return GetDeviceCount(AuxDevice);
case AUXDM_GETVOLUME:
DPRINT("AUXDM_GETVOLUME");
Result = AuxGetAudio(dwId, (PBYTE) &Volume, sizeof(Volume));
if (Result == MMSYSERR_NOERROR)
{
*(LPDWORD)dwParam1 = (DWORD)MAKELONG(HIWORD(Volume.Left), HIWORD(Volume.Right));
}
return Result;
case AUXDM_SETVOLUME:
DPRINT("AUXDM_SETVOLUME");
Volume.Right = HIWORD(dwParam1) << 16;
Volume.Left = LOWORD(dwParam1) << 16;
return AuxSetAudio(dwId, (PBYTE)&Volume, sizeof(Volume));
}
return MMSYSERR_NOERROR;
}
DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume)
{
HANDLE DeviceHandle;
MMRESULT Result;
DWORD BytesReturned;
Result = OpenDevice(AuxDevice, dwID, &DeviceHandle, GENERIC_READ);
if (Result != MMSYSERR_NOERROR)
return Result;
Result = DeviceIoControl(DeviceHandle, IOCTL_AUX_GET_VOLUME, NULL, 0, (LPVOID)pVolume, sizeVolume,
&BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus();
CloseHandle(DeviceHandle);
return Result;
}
DWORD AuxSetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume)
{
HANDLE DeviceHandle;
MMRESULT Result;
DWORD BytesReturned;
Result = OpenDevice(AuxDevice, dwID, &DeviceHandle, GENERIC_READ);
if (Result != MMSYSERR_NOERROR)
return Result;
Result = DeviceIoControl(DeviceHandle, IOCTL_AUX_SET_VOLUME, (LPVOID)pVolume, sizeVolume, NULL, 0,
&BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus();
CloseHandle(DeviceHandle);
return Result;
}

136
reactos/dll/mmdrv/entry.c Normal file
View file

@ -0,0 +1,136 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Multimedia
* FILE: lib/mmdrv/entry.c
* PURPOSE: Multimedia User Mode Driver
* PROGRAMMER: Andrew Greenwood
* Aleksey Bragin
* UPDATE HISTORY:
* Jan 30, 2004: Imported into ReactOS tree (Greenwood)
* Mar 16, 2004: Cleaned up a bit (Bragin)
*/
#include "mmdrv.h"
#define NDEBUG
#include <debug.h>
#define EXPORT __declspec(dllexport)
CRITICAL_SECTION DriverSection;
APIENTRY LONG DriverProc(DWORD DriverID, HANDLE DriverHandle, UINT Message,
LONG Param1, LONG Param2)
{
DPRINT("DriverProc\n");
// HINSTANCE Module;
switch(Message)
{
case DRV_LOAD :
DPRINT("DRV_LOAD\n");
return TRUE; // dont need to do any more
/*
Module = GetDriverModuleHandle(DriverHandle);
// Create our process heap
Heap = GetProcessHeap();
if (Heap == NULL)
return FALSE;
DisableThreadLibraryCalls(Module);
InitializeCriticalSection(&CS);
//
// Load our device list
//
// if (sndFindDevices() != MMSYSERR_NOERROR) {
// DeleteCriticalSection(&mmDrvCritSec);
// return FALSE;
// }
return TRUE;
*/
// return 1L;
case DRV_FREE :
DPRINT("DRV_FREE\n");
// TerminateMidi();
// TerminateWave();
// DeleteCriticalSection(&CS);
return 1L;
case DRV_OPEN :
DPRINT("DRV_OPEN\n");
return 1L;
case DRV_CLOSE :
DPRINT("DRV_CLOSE\n");
return 1L;
case DRV_ENABLE :
DPRINT("DRV_ENABLE\n");
return 1L;
case DRV_DISABLE :
DPRINT("DRV_DISABLE\n");
return 1L;
case DRV_QUERYCONFIGURE :
DPRINT("DRV_QUERYCONFIGURE\n");
return 0L;
case DRV_CONFIGURE :
DPRINT("DRV_CONFIGURE\n");
return 0L;
case DRV_INSTALL :
DPRINT("DRV_INSTALL\n");
return DRVCNF_RESTART;
default :
DPRINT("?\n");
return DefDriverProc(DriverID, DriverHandle, Message, Param1, Param2);
};
}
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
{
DPRINT("DllMain called!\n");
if (Reason == DLL_PROCESS_ATTACH)
{
DisableThreadLibraryCalls(hInstance);
// Create our heap
Heap = HeapCreate(0, 800, 0);
if (Heap == NULL)
return FALSE;
InitializeCriticalSection(&CS);
// OK to do this now??
FindDevices();
}
else if (Reason == DLL_PROCESS_DETACH)
{
// We need to do cleanup here...
// TerminateMidi();
// TerminateWave();
DeleteCriticalSection(&CS);
HeapDestroy(Heap);
}
return TRUE;
}
/* EOF */

357
reactos/dll/mmdrv/midi.c Normal file
View file

@ -0,0 +1,357 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Multimedia
* FILE: lib/mmdrv/midi.c
* PURPOSE: Multimedia User Mode Driver
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Jan 30, 2004: Imported into ReactOS tree
*/
#include "mmdrv.h"
#include "wave.h"
#define NDEBUG
#include <debug.h>
// MIDI device instance information
//
#define LOCAL_DATA_SIZE 20
typedef struct _LOCALMIDIHDR {
OVERLAPPED Ovl;
DWORD BytesReturned;
struct _LOCALMIDIHDR *lpNext;
BOOL Done;
PVOID pClient;
// MIDI_DD_INPUT_DATA MidiData;
BYTE ExtraData[LOCAL_DATA_SIZE - sizeof(ULONG)];
} LOCALMIDIHDR, *PLOCALMIDIHDR;
#define LOCAL_MIDI_BUFFERS 8
typedef struct {
BOOL fMidiInStarted;
DWORD dwMsg;
DWORD dwCurData;
BYTE status;
BOOLEAN fSysex;
BOOLEAN Bad;
BYTE bBytesLeft;
BYTE bBytePos;
DWORD dwCurTime;
DWORD dwMsgTime;
PLOCALMIDIHDR DeviceQueue;
LOCALMIDIHDR
Bufs[LOCAL_MIDI_BUFFERS];
} LOCALMIDIDATA, *PLOCALMIDIDATA;
typedef struct tag_MIDIALLOC {
struct tag_MIDIALLOC *Next; // Chain of devices
UINT DeviceNumber; // Number of device
UINT DeviceType; // MidiInput or MidiOutput
DWORD dwCallback; // client's callback
DWORD dwInstance; // client's instance data
HMIDI hMidi; // handle for stream
HANDLE DeviceHandle; // Midi device handle
LPMIDIHDR lpMIQueue; // Buffers sent to device
// This is only required so that
// CLOSE knows when things have
// really finished.
// notify. This is only accessed
// on the device thread and its
// apcs so does not need any
// synchronized access.
HANDLE Event; // Event for driver syncrhonization
// and notification of auxiliary
// task operation completion.
// MIDITHREADFUNCTION AuxFunction; // Function for thread to perform
union {
LPMIDIHDR pHdr; // Buffer to pass in aux task
ULONG State; // State to set
struct {
ULONG Function; // IOCTL to use
PBYTE pData; // Data to set or get
ULONG DataLen; // Length of data
} GetSetData;
} AuxParam;
// 0 means terminate task.
HANDLE ThreadHandle; // Handle for termination ONLY
HANDLE AuxEvent1; // Aux thread waits on this
HANDLE AuxEvent2; // Aux thread caller waits on this
DWORD AuxReturnCode; // Return code from Aux task
DWORD dwFlags; // Open flags
PLOCALMIDIDATA Mid; // Extra midi input structures
int l; // Helper global for modMidiLength
} MIDIALLOC, *PMIDIALLOC;
PMIDIALLOC MidiHandleList; // Our chain of wave handles
static DWORD OpenMidiDevice(UINT DeviceType, DWORD ID, DWORD User, DWORD Param1, DWORD Param2)
{
PMIDIALLOC pClient = NULL;
MMRESULT Result = MMSYSERR_NOERROR;
// Check ID?
DPRINT("OpenMidiDevice()\n");
switch(DeviceType)
{
case MidiOutDevice :
pClient = (PMIDIALLOC) HeapAlloc(Heap, 0, sizeof(MIDIALLOC));
if ( pClient ) memset(pClient, 0, sizeof(MIDIALLOC));
break;
case MidiInDevice :
pClient = (PMIDIALLOC) HeapAlloc(Heap, 0, sizeof(MIDIALLOC) + sizeof(LOCALMIDIDATA));
if ( pClient ) memset(pClient, 0, sizeof(MIDIALLOC) + sizeof(LOCALMIDIDATA));
break;
};
if ( !pClient )
return MMSYSERR_NOMEM;
if (DeviceType == MidiInDevice)
{
int i;
pClient->Mid = (PLOCALMIDIDATA)(pClient + 1);
for (i = 0 ;i < LOCAL_MIDI_BUFFERS ; i++)
{
pClient->Mid->Bufs[i].pClient = pClient;
}
}
pClient->DeviceType = DeviceType;
pClient->dwCallback = ((LPMIDIOPENDESC)Param1)->dwCallback;
pClient->dwInstance = ((LPMIDIOPENDESC)Param1)->dwInstance;
pClient->hMidi = ((LPMIDIOPENDESC)Param1)->hMidi;
pClient->dwFlags = Param2;
Result = OpenDevice(DeviceType, ID, &pClient->DeviceHandle, (GENERIC_READ | GENERIC_WRITE));
if ( Result != MMSYSERR_NOERROR )
{
// cleanup
return Result;
}
pClient->Event = CreateEvent(NULL, FALSE, FALSE, NULL);
if ( !pClient->Event )
{
// cleanup
return MMSYSERR_NOMEM;
}
if (DeviceType == MidiInDevice)
{
pClient->AuxEvent1 = CreateEvent(NULL, FALSE, FALSE, NULL);
if (pClient->AuxEvent1 == NULL)
{
// cleanup
return MMSYSERR_NOMEM;
}
pClient->AuxEvent2 = CreateEvent(NULL, FALSE, FALSE, NULL);
if (pClient->AuxEvent2 == NULL)
{
// cleanup
return MMSYSERR_NOMEM;
}
// TaskCreate
WaitForSingleObject(pClient->AuxEvent2, INFINITE);
}
PMIDIALLOC *pUserHandle;
pUserHandle = (PMIDIALLOC*) User;
*pUserHandle = pClient;
// callback
return MMSYSERR_NOERROR;
}
static DWORD WriteMidi(PBYTE pData, ULONG Length, PMIDIALLOC pClient)
{
DWORD BytesReturned;
DPRINT("IOCTL_MIDI_PLAY == %d [%x]\n", IOCTL_MIDI_PLAY, IOCTL_MIDI_PLAY);
if ( !DeviceIoControl(pClient->DeviceHandle, IOCTL_MIDI_PLAY, (PVOID)pData,
Length, NULL, 0, &BytesReturned, NULL))
return TranslateStatus();
return MMSYSERR_NOERROR;
}
static int GetMidiLength(PMIDIALLOC pClient, BYTE b)
{
if (b >= 0xF8)
{
// Realtime message - leave running status
return 1; // Write one byte
}
switch (b)
{
case 0xF0: case 0xF4: case 0xF5: case 0xF6: case 0xF7:
pClient->l = 1;
return pClient->l;
case 0xF1: case 0xF3:
pClient->l = 2;
return pClient->l;
case 0xF2:
pClient->l = 3;
return pClient->l;
}
switch (b & 0xF0)
{
case 0x80: case 0x90: case 0xA0: case 0xB0: case 0xE0:
pClient->l = 3;
return pClient->l;
case 0xC0: case 0xD0:
pClient->l = 2;
return pClient->l;
}
return (pClient->l - 1); // uses previous value if data byte (running status)
}
/* ----------------------------------------------------------------------------
Exported functions
----------------------------------------------------------------------------- */
APIENTRY DWORD midMessage(DWORD dwId, DWORD dwMessage, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
{
DPRINT("midMessage\n");
return MMSYSERR_NOERROR;
switch (dwMessage) {
case MIDM_GETNUMDEVS:
DPRINT("MIDM_GETNUMDEVS");
return GetDeviceCount(MidiInDevice);
case MIDM_GETDEVCAPS:
DPRINT("MIDM_GETDEVCAPS");
return GetDeviceCapabilities(dwId, MidiInDevice, (LPBYTE)dwParam1, (DWORD)dwParam2);
case MIDM_OPEN:
DPRINT("MIDM_OPEN");
return MMSYSERR_NOERROR;
case MIDM_CLOSE:
DPRINT("MIDM_CLOSE");
return MMSYSERR_NOERROR;
case MIDM_ADDBUFFER:
DPRINT("MIDM_ADDBUFFER");
return MMSYSERR_NOERROR;
case MIDM_STOP:
DPRINT("MIDM_PAUSE");
return MMSYSERR_NOERROR;
case MIDM_START:
DPRINT("MIDM_RESTART");
return MMSYSERR_NOERROR;
case MIDM_RESET:
DPRINT("MIDM_RESET");
return MMSYSERR_NOERROR;
default:
return MMSYSERR_NOTSUPPORTED;
}
// the function should never get to this point
//FIXME: Would it be wise to assert here?
return MMSYSERR_NOTSUPPORTED;
}
APIENTRY DWORD modMessage(DWORD ID, DWORD Message, DWORD User, DWORD Param1, DWORD Param2)
{
DPRINT("modMessage\n");
switch(Message)
{
case MODM_GETNUMDEVS:
DPRINT("MODM_GETNUMDEVS == %d\n", (int)GetDeviceCount(MidiOutDevice));
return GetDeviceCount(MidiOutDevice);
case MODM_GETDEVCAPS:
DPRINT("MODM_GETDEVCAPS");
return GetDeviceCapabilities(ID, MidiOutDevice, (LPBYTE)Param1, (DWORD)Param2);
case MODM_OPEN :
return OpenMidiDevice(MidiOutDevice, ID, User, Param1, Param2);
case MODM_CLOSE:
DPRINT("MODM_CLOSE");
return MMSYSERR_NOTSUPPORTED;
case MODM_DATA:
DPRINT("MODM_DATA");
int i;
BYTE b[4];
for (i = 0; i < 4; i ++) {
b[i] = (BYTE)(Param1 % 256);
Param1 /= 256;
}
return WriteMidi(b, GetMidiLength((PMIDIALLOC)User, b[0]),
(PMIDIALLOC)User);
case MODM_LONGDATA:
DPRINT("MODM_LONGDATA");
return MMSYSERR_NOTSUPPORTED;
case MODM_RESET:
DPRINT("MODM_RESET");
return MMSYSERR_NOTSUPPORTED;
case MODM_SETVOLUME:
DPRINT("MODM_SETVOLUME");
return MMSYSERR_NOTSUPPORTED;
case MODM_GETVOLUME:
DPRINT("MODM_GETVOLUME");
return MMSYSERR_NOTSUPPORTED;
case MODM_CACHEPATCHES:
DPRINT("MODM_CACHEPATCHES");
return MMSYSERR_NOTSUPPORTED;
case MODM_CACHEDRUMPATCHES:
DPRINT("MODM_CACHEDRUMPATCHES");
return MMSYSERR_NOTSUPPORTED;
};
return MMSYSERR_NOTSUPPORTED;
}

471
reactos/dll/mmdrv/mmddk.h Normal file
View file

@ -0,0 +1,471 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*****************************************************************************
* Copyright 1998, Luiz Otavio L. Zorzella
* 1999, Eric Pouech
*
* Purpose: multimedia declarations (external to WINMM & MMSYSTEM DLLs
* for other DLLs (MCI, drivers...))
*
* 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
*
*****************************************************************************
*/
#ifndef __MMDDK_H
#define __MMDDK_H
#include <mmsystem.h>
#include <winbase.h>
typedef VOID (TASKCALLBACK) (DWORD dwInst);
typedef TASKCALLBACK FAR *LPTASKCALLBACK;
UINT APIENTRY mmTaskCreate(LPTASKCALLBACK lpfn, HANDLE FAR * lph, DWORD dwInst);
VOID APIENTRY mmTaskBlock(DWORD h);
BOOL APIENTRY mmTaskSignal(DWORD h);
VOID APIENTRY mmTaskYield(VOID);
DWORD APIENTRY mmGetCurrentTask(VOID);
#define MAX_MIDIINDRV (16)
/* For now I'm making 16 the maximum number of midi devices one can
* have. This should be more than enough for everybody. But as a purist,
* I intend to make it unbounded in the future, as soon as I figure
* a good way to do so.
*/
#define MAX_MIDIOUTDRV (16)
/* ==================================
* Multimedia DDK compatible part
* ================================== */
#include <pshpack1.h>
#define DRVM_INIT 100
#define DRVM_EXIT 101
#define DRVM_DISABLE 102
#define DRVM_ENABLE 103
/* messages that have IOCTL format
* dw1 = NULL or handle
* dw2 = NULL or ptr to DRVM_IOCTL_DATA
* return is MMRESULT
*/
#define DRVM_IOCTL 0x100
#define DRVM_ADD_THRU (DRVM_IOCTL+1)
#define DRVM_REMOVE_THRU (DRVM_IOCTL+2)
#define DRVM_IOCTL_LAST (DRVM_IOCTL+5)
typedef struct {
DWORD dwSize; /* size of this structure */
DWORD dwCmd; /* IOCTL command code, 0x80000000 and above reserved for system */
} DRVM_IOCTL_DATA, *LPDRVM_IOCTL_DATA;
/* command code ranges for dwCmd field of DRVM_IOCTL message
* - codes from 0 to 0x7FFFFFFF are user defined
* - codes from 0x80000000 to 0xFFFFFFFF are reserved for future definition by microsoft
*/
#define DRVM_IOCTL_CMD_USER 0x00000000L
#define DRVM_IOCTL_CMD_SYSTEM 0x80000000L
#define DRVM_MAPPER 0x2000
#define DRVM_USER 0x4000
#define DRVM_MAPPER_STATUS (DRVM_MAPPER+0)
#define DRVM_MAPPER_RECONFIGURE (DRVM_MAPPER+1)
#define DRVM_MAPPER_PREFERRED_GET (DRVM_MAPPER+21)
#define DRVM_MAPPER_CONSOLEVOICECOM_GET (DRVM_MAPPER+23)
#define DRV_QUERYDRVENTRY (DRV_RESERVED + 1)
#define DRV_QUERYDEVNODE (DRV_RESERVED + 2)
#define DRV_QUERYNAME (DRV_RESERVED + 3)
#define DRV_QUERYDRIVERIDS (DRV_RESERVED + 4)
#define DRV_QUERYMAPPABLE (DRV_RESERVED + 5)
#define DRV_QUERYMODULE (DRV_RESERVED + 9)
#define DRV_PNPINSTALL (DRV_RESERVED + 11)
#define DRV_QUERYDEVICEINTERFACE (DRV_RESERVED + 12)
#define DRV_QUERYDEVICEINTERFACESIZE (DRV_RESERVED + 13)
#define DRV_QUERYSTRINGID (DRV_RESERVED + 14)
#define DRV_QUERYSTRINGIDSIZE (DRV_RESERVED + 15)
#define DRV_QUERYIDFROMSTRINGID (DRV_RESERVED + 16)
#ifdef __WINESRC__
#define DRV_QUERYDSOUNDIFACE (DRV_RESERVED + 20)
#define DRV_QUERYDSOUNDDESC (DRV_RESERVED + 21)
#define DRV_QUERYDSOUNDGUID (DRV_RESERVED + 22)
#endif
#define WODM_INIT DRVM_INIT
#define WODM_GETNUMDEVS 3
#define WODM_GETDEVCAPS 4
#define WODM_OPEN 5
#define WODM_CLOSE 6
#define WODM_PREPARE 7
#define WODM_UNPREPARE 8
#define WODM_WRITE 9
#define WODM_PAUSE 10
#define WODM_RESTART 11
#define WODM_RESET 12
#define WODM_GETPOS 13
#define WODM_GETPITCH 14
#define WODM_SETPITCH 15
#define WODM_GETVOLUME 16
#define WODM_SETVOLUME 17
#define WODM_GETPLAYBACKRATE 18
#define WODM_SETPLAYBACKRATE 19
#define WODM_BREAKLOOP 20
#define WODM_PREFERRED 21
#define WODM_MAPPER_STATUS (DRVM_MAPPER_STATUS + 0)
#define WAVEOUT_MAPPER_STATUS_DEVICE 0
#define WAVEOUT_MAPPER_STATUS_MAPPED 1
#define WAVEOUT_MAPPER_STATUS_FORMAT 2
#define WODM_BUSY 21
#define WIDM_INIT DRVM_INIT
#define WIDM_GETNUMDEVS 50
#define WIDM_GETDEVCAPS 51
#define WIDM_OPEN 52
#define WIDM_CLOSE 53
#define WIDM_PREPARE 54
#define WIDM_UNPREPARE 55
#define WIDM_ADDBUFFER 56
#define WIDM_START 57
#define WIDM_STOP 58
#define WIDM_RESET 59
#define WIDM_GETPOS 60
#define WIDM_PREFERRED 61
#define WIDM_MAPPER_STATUS (DRVM_MAPPER_STATUS + 0)
#define WAVEIN_MAPPER_STATUS_DEVICE 0
#define WAVEIN_MAPPER_STATUS_MAPPED 1
#define WAVEIN_MAPPER_STATUS_FORMAT 2
#define MODM_INIT DRVM_INIT
#define MODM_GETNUMDEVS 1
#define MODM_GETDEVCAPS 2
#define MODM_OPEN 3
#define MODM_CLOSE 4
#define MODM_PREPARE 5
#define MODM_UNPREPARE 6
#define MODM_DATA 7
#define MODM_LONGDATA 8
#define MODM_RESET 9
#define MODM_GETVOLUME 10
#define MODM_SETVOLUME 11
#define MODM_CACHEPATCHES 12
#define MODM_CACHEDRUMPATCHES 13
#define MIDM_INIT DRVM_INIT
#define MIDM_GETNUMDEVS 53
#define MIDM_GETDEVCAPS 54
#define MIDM_OPEN 55
#define MIDM_CLOSE 56
#define MIDM_PREPARE 57
#define MIDM_UNPREPARE 58
#define MIDM_ADDBUFFER 59
#define MIDM_START 60
#define MIDM_STOP 61
#define MIDM_RESET 62
#define AUXM_INIT DRVM_INIT
#define AUXDM_GETNUMDEVS 3
#define AUXDM_GETDEVCAPS 4
#define AUXDM_GETVOLUME 5
#define AUXDM_SETVOLUME 6
#define MXDM_INIT DRVM_INIT
#define MXDM_USER DRVM_USER
#define MXDM_MAPPER DRVM_MAPPER
#define MXDM_GETNUMDEVS 1
#define MXDM_GETDEVCAPS 2
#define MXDM_OPEN 3
#define MXDM_CLOSE 4
#define MXDM_GETLINEINFO 5
#define MXDM_GETLINECONTROLS 6
#define MXDM_GETCONTROLDETAILS 7
#define MXDM_SETCONTROLDETAILS 8
/* pre-defined joystick types */
#define JOY_HW_NONE 0
#define JOY_HW_CUSTOM 1
#define JOY_HW_2A_2B_GENERIC 2
#define JOY_HW_2A_4B_GENERIC 3
#define JOY_HW_2B_GAMEPAD 4
#define JOY_HW_2B_FLIGHTYOKE 5
#define JOY_HW_2B_FLIGHTYOKETHROTTLE 6
#define JOY_HW_3A_2B_GENERIC 7
#define JOY_HW_3A_4B_GENERIC 8
#define JOY_HW_4B_GAMEPAD 9
#define JOY_HW_4B_FLIGHTYOKE 10
#define JOY_HW_4B_FLIGHTYOKETHROTTLE 11
#define JOY_HW_LASTENTRY 12
/* calibration flags */
#define JOY_ISCAL_XY 0x00000001l /* XY are calibrated */
#define JOY_ISCAL_Z 0x00000002l /* Z is calibrated */
#define JOY_ISCAL_R 0x00000004l /* R is calibrated */
#define JOY_ISCAL_U 0x00000008l /* U is calibrated */
#define JOY_ISCAL_V 0x00000010l /* V is calibrated */
#define JOY_ISCAL_POV 0x00000020l /* POV is calibrated */
/* point of view constants */
#define JOY_POV_NUMDIRS 4
#define JOY_POVVAL_FORWARD 0
#define JOY_POVVAL_BACKWARD 1
#define JOY_POVVAL_LEFT 2
#define JOY_POVVAL_RIGHT 3
/* Specific settings for joystick hardware */
#define JOY_HWS_HASZ 0x00000001l /* has Z info? */
#define JOY_HWS_HASPOV 0x00000002l /* point of view hat present */
#define JOY_HWS_POVISBUTTONCOMBOS 0x00000004l /* pov done through combo of buttons */
#define JOY_HWS_POVISPOLL 0x00000008l /* pov done through polling */
#define JOY_HWS_ISYOKE 0x00000010l /* joystick is a flight yoke */
#define JOY_HWS_ISGAMEPAD 0x00000020l /* joystick is a game pad */
#define JOY_HWS_ISCARCTRL 0x00000040l /* joystick is a car controller */
/* X defaults to J1 X axis */
#define JOY_HWS_XISJ1Y 0x00000080l /* X is on J1 Y axis */
#define JOY_HWS_XISJ2X 0x00000100l /* X is on J2 X axis */
#define JOY_HWS_XISJ2Y 0x00000200l /* X is on J2 Y axis */
/* Y defaults to J1 Y axis */
#define JOY_HWS_YISJ1X 0x00000400l /* Y is on J1 X axis */
#define JOY_HWS_YISJ2X 0x00000800l /* Y is on J2 X axis */
#define JOY_HWS_YISJ2Y 0x00001000l /* Y is on J2 Y axis */
/* Z defaults to J2 Y axis */
#define JOY_HWS_ZISJ1X 0x00002000l /* Z is on J1 X axis */
#define JOY_HWS_ZISJ1Y 0x00004000l /* Z is on J1 Y axis */
#define JOY_HWS_ZISJ2X 0x00008000l /* Z is on J2 X axis */
/* POV defaults to J2 Y axis, if it is not button based */
#define JOY_HWS_POVISJ1X 0x00010000l /* pov done through J1 X axis */
#define JOY_HWS_POVISJ1Y 0x00020000l /* pov done through J1 Y axis */
#define JOY_HWS_POVISJ2X 0x00040000l /* pov done through J2 X axis */
/* R defaults to J2 X axis */
#define JOY_HWS_HASR 0x00080000l /* has R (4th axis) info */
#define JOY_HWS_RISJ1X 0x00100000l /* R done through J1 X axis */
#define JOY_HWS_RISJ1Y 0x00200000l /* R done through J1 Y axis */
#define JOY_HWS_RISJ2Y 0x00400000l /* R done through J2 X axis */
/* U & V for future hardware */
#define JOY_HWS_HASU 0x00800000l /* has U (5th axis) info */
#define JOY_HWS_HASV 0x01000000l /* has V (6th axis) info */
/* Usage settings */
#define JOY_US_HASRUDDER 0x00000001l /* joystick configured with rudder */
#define JOY_US_PRESENT 0x00000002l /* is joystick actually present? */
#define JOY_US_ISOEM 0x00000004l /* joystick is an OEM defined type */
/* struct for storing x,y, z, and rudder values */
typedef struct joypos_tag {
DWORD dwX;
DWORD dwY;
DWORD dwZ;
DWORD dwR;
DWORD dwU;
DWORD dwV;
} JOYPOS, *LPJOYPOS;
/* struct for storing ranges */
typedef struct joyrange_tag {
JOYPOS jpMin;
JOYPOS jpMax;
JOYPOS jpCenter;
} JOYRANGE,*LPJOYRANGE;
typedef struct joyreguservalues_tag {
DWORD dwTimeOut; /* value at which to timeout joystick polling */
JOYRANGE jrvRanges; /* range of values app wants returned for axes */
JOYPOS jpDeadZone; /* area around center to be considered
as "dead". specified as a percentage
(0-100). Only X & Y handled by system driver */
} JOYREGUSERVALUES, *LPJOYREGUSERVALUES;
typedef struct joyreghwsettings_tag {
DWORD dwFlags;
DWORD dwNumButtons; /* number of buttons */
} JOYREGHWSETTINGS, *LPJOYHWSETTINGS;
/* range of values returned by the hardware (filled in by calibration) */
typedef struct joyreghwvalues_tag {
JOYRANGE jrvHardware; /* values returned by hardware */
DWORD dwPOVValues[JOY_POV_NUMDIRS];/* POV values returned by hardware */
DWORD dwCalFlags; /* what has been calibrated */
} JOYREGHWVALUES, *LPJOYREGHWVALUES;
/* hardware configuration */
typedef struct joyreghwconfig_tag {
JOYREGHWSETTINGS hws; /* hardware settings */
DWORD dwUsageSettings;/* usage settings */
JOYREGHWVALUES hwv; /* values returned by hardware */
DWORD dwType; /* type of joystick */
DWORD dwReserved; /* reserved for OEM drivers */
} JOYREGHWCONFIG, *LPJOYREGHWCONFIG;
/* joystick calibration info structure */
typedef struct joycalibrate_tag {
UINT wXbase;
UINT wXdelta;
UINT wYbase;
UINT wYdelta;
UINT wZbase;
UINT wZdelta;
} JOYCALIBRATE;
typedef JOYCALIBRATE *LPJOYCALIBRATE;
/* prototype for joystick message function */
typedef UINT (CALLBACK * JOYDEVMSGPROC)(DWORD dwID, UINT uMessage, LPARAM lParam1, LPARAM lParam2);
typedef JOYDEVMSGPROC *LPJOYDEVMSGPROC;
/* messages sent to joystick driver's DriverProc() function */
#define JDD_GETNUMDEVS (DRV_RESERVED + 0x0001)
#define JDD_GETDEVCAPS (DRV_RESERVED + 0x0002)
#define JDD_GETPOS (DRV_RESERVED + 0x0101)
#define JDD_SETCALIBRATION (DRV_RESERVED + 0x0102)
#define JDD_CONFIGCHANGED (DRV_RESERVED + 0x0103)
#define JDD_GETPOSEX (DRV_RESERVED + 0x0104)
#define MCI_MAX_DEVICE_TYPE_LENGTH 80
#define MCI_FALSE (MCI_STRING_OFFSET + 19)
#define MCI_TRUE (MCI_STRING_OFFSET + 20)
#define MCI_FORMAT_RETURN_BASE MCI_FORMAT_MILLISECONDS_S
#define MCI_FORMAT_MILLISECONDS_S (MCI_STRING_OFFSET + 21)
#define MCI_FORMAT_HMS_S (MCI_STRING_OFFSET + 22)
#define MCI_FORMAT_MSF_S (MCI_STRING_OFFSET + 23)
#define MCI_FORMAT_FRAMES_S (MCI_STRING_OFFSET + 24)
#define MCI_FORMAT_SMPTE_24_S (MCI_STRING_OFFSET + 25)
#define MCI_FORMAT_SMPTE_25_S (MCI_STRING_OFFSET + 26)
#define MCI_FORMAT_SMPTE_30_S (MCI_STRING_OFFSET + 27)
#define MCI_FORMAT_SMPTE_30DROP_S (MCI_STRING_OFFSET + 28)
#define MCI_FORMAT_BYTES_S (MCI_STRING_OFFSET + 29)
#define MCI_FORMAT_SAMPLES_S (MCI_STRING_OFFSET + 30)
#define MCI_FORMAT_TMSF_S (MCI_STRING_OFFSET + 31)
#define MCI_VD_FORMAT_TRACK_S (MCI_VD_OFFSET + 5)
#define WAVE_FORMAT_PCM_S (MCI_WAVE_OFFSET + 0)
#define WAVE_MAPPER_S (MCI_WAVE_OFFSET + 1)
#define MCI_SEQ_MAPPER_S (MCI_SEQ_OFFSET + 5)
#define MCI_SEQ_FILE_S (MCI_SEQ_OFFSET + 6)
#define MCI_SEQ_MIDI_S (MCI_SEQ_OFFSET + 7)
#define MCI_SEQ_SMPTE_S (MCI_SEQ_OFFSET + 8)
#define MCI_SEQ_FORMAT_SONGPTR_S (MCI_SEQ_OFFSET + 9)
#define MCI_SEQ_NONE_S (MCI_SEQ_OFFSET + 10)
#define MIDIMAPPER_S (MCI_SEQ_OFFSET + 11)
#define MCI_RESOURCE_RETURNED 0x00010000 /* resource ID */
#define MCI_COLONIZED3_RETURN 0x00020000 /* colonized ID, 3 bytes data */
#define MCI_COLONIZED4_RETURN 0x00040000 /* colonized ID, 4 bytes data */
#define MCI_INTEGER_RETURNED 0x00080000 /* integer conversion needed */
#define MCI_RESOURCE_DRIVER 0x00100000 /* driver owns returned resource */
#define MCI_NO_COMMAND_TABLE 0xFFFF
#define MCI_COMMAND_HEAD 0
#define MCI_STRING 1
#define MCI_INTEGER 2
#define MCI_END_COMMAND 3
#define MCI_RETURN 4
#define MCI_FLAG 5
#define MCI_END_COMMAND_LIST 6
#define MCI_RECT 7
#define MCI_CONSTANT 8
#define MCI_END_CONSTANT 9
#define MAKEMCIRESOURCE(wRet, wRes) MAKELRESULT((wRet), (wRes))
typedef struct {
DWORD dwCallback;
DWORD dwInstance;
HMIDIOUT hMidi;
DWORD dwFlags;
} PORTALLOC, *LPPORTALLOC;
typedef struct {
HWAVE hWave;
LPWAVEFORMATEX lpFormat;
DWORD dwCallback;
DWORD dwInstance;
UINT uMappedDeviceID;
DWORD dnDevNode;
} WAVEOPENDESC, *LPWAVEOPENDESC;
typedef struct {
DWORD dwStreamID;
WORD wDeviceID;
} MIDIOPENSTRMID;
typedef struct {
HMIDI hMidi;
DWORD dwCallback;
DWORD dwInstance;
DWORD dnDevNode;
DWORD cIds;
MIDIOPENSTRMID rgIds;
} MIDIOPENDESC, *LPMIDIOPENDESC;
typedef struct tMIXEROPENDESC
{
HMIXEROBJ hmx;
LPVOID pReserved0;
DWORD dwCallback;
DWORD dwInstance;
} MIXEROPENDESC, *LPMIXEROPENDESC;
typedef struct {
UINT wDeviceID; /* device ID */
LPSTR lpstrParams; /* parameter string for entry in SYSTEM.INI */
UINT wCustomCommandTable; /* custom command table (0xFFFF if none) * filled in by the driver */
UINT wType; /* driver type (filled in by the driver) */
} MCI_OPEN_DRIVER_PARMSA, *LPMCI_OPEN_DRIVER_PARMSA;
typedef struct {
UINT wDeviceID; /* device ID */
LPWSTR lpstrParams; /* parameter string for entry in SYSTEM.INI */
UINT wCustomCommandTable; /* custom command table (0xFFFF if none) * filled in by the driver */
UINT wType; /* driver type (filled in by the driver) */
} MCI_OPEN_DRIVER_PARMSW, *LPMCI_OPEN_DRIVER_PARMSW;
//DECL_WINELIB_TYPE_AW(MCI_OPEN_DRIVER_PARMS)
//DECL_WINELIB_TYPE_AW(LPMCI_OPEN_DRIVER_PARMS)
DWORD WINAPI mciGetDriverData(UINT uDeviceID);
BOOL WINAPI mciSetDriverData(UINT uDeviceID, DWORD dwData);
UINT WINAPI mciDriverYield(UINT uDeviceID);
BOOL WINAPI mciDriverNotify(HWND hwndCallback, UINT uDeviceID,
UINT uStatus);
UINT WINAPI mciLoadCommandResource(HINSTANCE hInstance,
LPCWSTR lpResName, UINT uType);
BOOL WINAPI mciFreeCommandResource(UINT uTable);
#define DCB_NULL 0x0000
#define DCB_WINDOW 0x0001 /* dwCallback is a HWND */
#define DCB_TASK 0x0002 /* dwCallback is a HTASK */
#define DCB_FUNCTION 0x0003 /* dwCallback is a FARPROC */
#define DCB_EVENT 0x0005 /* dwCallback is an EVENT Handler */
#define DCB_TYPEMASK 0x0007
#define DCB_NOSWITCH 0x0008 /* don't switch stacks for callback */
BOOL WINAPI DriverCallback(DWORD dwCallBack, UINT uFlags, HDRVR hDev,
UINT wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2);
#ifdef __WINESRC__
#define WAVE_DIRECTSOUND 0x0080
#endif
#include <poppack.h>
#endif /* __MMDDK_H */

94
reactos/dll/mmdrv/mmdef.h Normal file
View file

@ -0,0 +1,94 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: lib/mmdrv/mmdef.h
* PURPOSE: Multimedia Definitions (for mmdrv.dll)
* PROGRAMMER: Andrew Greenwood
*
*/
#ifndef __INCLUDES_MMDEF_H__
#define __INCLUDES_MMDEF_H__
//#define UNICODE
#define EXPORT __declspec(dllexport)
//#include <stdio.h>
//#include <windows.h>
//#include <mmsystem.h>
//#include <mmddk.h>
// This needs to be done to get winioctl.h to work:
//typedef unsigned __int64 DWORD64, *PDWORD64;
//#include <winioctl.h>
//#include "mmddk.h"
#define SOUND_MAX_DEVICE_NAME 1024 // GUESSWORK
#define SOUND_MAX_DEVICES 256 // GUESSWORK
// If the root is \Device and the Device type is
// WaveIn and the device number is 2, the full name is \Device\WaveIn2
#define WAVE_IN_DEVICE_NAME "\\Device\\WaveIn"
#define WAVE_IN_DEVICE_NAME_U L"\\Device\\WaveIn"
#define WAVE_OUT_DEVICE_NAME "\\Device\\WaveOut"
#define WAVE_OUT_DEVICE_NAME_U L"\\Device\\WaveOut"
#define MIDI_IN_DEVICE_NAME "\\Device\\MidiIn"
#define MIDI_IN_DEVICE_NAME_U L"\\Device\\MidiIn"
#define MIDI_OUT_DEVICE_NAME "\\Device\\MidiOut"
#define MIDI_OUT_DEVICE_NAME_U L"\\Device\\MidiOut"
#define AUX_DEVICE_NAME "\\Device\\MMAux"
#define AUX_DEVICE_NAME_U L"\\Device\\MMAux"
#define IOCTL_SOUND_BASE FILE_DEVICE_SOUND
#define IOCTL_WAVE_BASE 0x0000
#define IOCTL_MIDI_BASE 0x0080
#define IOCTL_AUX_BASE 0x0100
// Wave device driver IOCTLs
#define IOCTL_WAVE_QUERY_FORMAT CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_WAVE_SET_FORMAT CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0002, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_CAPABILITIES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_WAVE_SET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0004, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0005, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_POSITION CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0006, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_SET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_WAVE_GET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_WAVE_SET_PITCH CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_PITCH CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000A, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_SET_PLAYBACK_RATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000B, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_PLAYBACK_RATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000C, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_PLAY CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000D, METHOD_IN_DIRECT, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_RECORD CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000E, METHOD_OUT_DIRECT, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_BREAK_LOOP CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000F, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_SET_LOW_PRIORITY CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0010, METHOD_BUFFERED, FILE_WRITE_ACCESS)
// MIDI device driver IOCTLs
#define IOCTL_MIDI_GET_CAPABILITIES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MIDI_SET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0002, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_GET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0003, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_SET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MIDI_GET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MIDI_PLAY CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0006, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_RECORD CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0007, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_CACHE_PATCHES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0008, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_CACHE_DRUM_PATCHES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
// AUX device driver IOCTLs
#define IOCTL_AUX_GET_CAPABILITIES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_AUX_SET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_AUX_GET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_SOUND_GET_CHANGED_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
#endif

View file

@ -0,0 +1,14 @@
; $Id$
;
; mmdrv.def
;
; ReactOS Operating System
;
LIBRARY mmdrv.dll
EXPORTS
DriverProc@20
widMessage@20
wodMessage@20
midMessage@20
modMessage@20
auxMessage@20

118
reactos/dll/mmdrv/mmdrv.h Normal file
View file

@ -0,0 +1,118 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Multimedia
* FILE: lib/mmdrv/mmdrv.h
* PURPOSE: Multimedia User Mode Driver (header)
* PROGRAMMER: Andrew Greenwood
* Aleksey Bragin
* UPDATE HISTORY:
* Jan 30, 2004: Imported into ReactOS tree
*/
#ifndef __INCLUDES_MMDRV_H__
#define __INCLUDES_MMDRV_H__
//#define UNICODE
#define EXPORT __declspec(dllexport)
#include <stdio.h>
#include <windows.h>
#include <mmsystem.h>
#include <mmddk.h>
// This needs to be done to get winioctl.h to work:
//typedef unsigned __int64 DWORD64, *PDWORD64;
#include <winioctl.h>
//#include "mmddk.h"
#include "mmdef.h"
ULONG DbgPrint(PCH Format, ...);
/*
#define SOUND_MAX_DEVICE_NAME 1024 // GUESSWORK
#define SOUND_MAX_DEVICES 256 // GUESSWORK
*/
// If the root is \Device and the Device type is
// WaveIn and the device number is 2, the full name is \Device\WaveIn2
#define WAVE_IN_DEVICE_NAME "\\Device\\WaveIn"
#define WAVE_IN_DEVICE_NAME_U L"\\Device\\WaveIn"
#define WAVE_OUT_DEVICE_NAME "\\Device\\WaveOut"
#define WAVE_OUT_DEVICE_NAME_U L"\\Device\\WaveOut"
#define MIDI_IN_DEVICE_NAME "\\Device\\MidiIn"
#define MIDI_IN_DEVICE_NAME_U L"\\Device\\MidiIn"
#define MIDI_OUT_DEVICE_NAME "\\Device\\MidiOut"
#define MIDI_OUT_DEVICE_NAME_U L"\\Device\\MidiOut"
#define AUX_DEVICE_NAME "\\Device\\MMAux"
#define AUX_DEVICE_NAME_U L"\\Device\\MMAux"
/*
#define IOCTL_SOUND_BASE FILE_DEVICE_SOUND
#define IOCTL_WAVE_BASE 0x0000
#define IOCTL_MIDI_BASE 0x0080
// Wave device driver IOCTLs
#define IOCTL_WAVE_QUERY_FORMAT CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_WAVE_SET_FORMAT CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0002, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_CAPABILITIES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_WAVE_SET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0004, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0005, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_POSITION CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0006, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_SET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0007, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_WAVE_GET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0008, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_WAVE_SET_PITCH CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_PITCH CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000A, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_SET_PLAYBACK_RATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000B, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_GET_PLAYBACK_RATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000C, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_PLAY CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000D, METHOD_IN_DIRECT, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_RECORD CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000E, METHOD_OUT_DIRECT, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_BREAK_LOOP CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x000F, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_WAVE_SET_LOW_PRIORITY CTL_CODE(IOCTL_SOUND_BASE, IOCTL_WAVE_BASE + 0x0010, METHOD_BUFFERED, FILE_WRITE_ACCESS)
// MIDI device driver IOCTLs
#define IOCTL_MIDI_GET_CAPABILITIES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MIDI_SET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0002, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_GET_STATE CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0003, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_SET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MIDI_GET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_MIDI_PLAY CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0006, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_RECORD CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0007, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_CACHE_PATCHES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0008, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_CACHE_DRUM_PATCHES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
*/
CRITICAL_SECTION CS; // Serialize access to device lists
HANDLE Heap;
enum {
InvalidDevice,
WaveInDevice,
WaveOutDevice,
MidiInDevice,
MidiOutDevice,
AuxDevice
};
MMRESULT OpenDevice(UINT DeviceType, DWORD ID, PHANDLE pDeviceHandle,
DWORD Access);
MMRESULT FindDevices();
DWORD GetDeviceCount(UINT DeviceType);
DWORD TranslateStatus(void);
#endif

View file

@ -0,0 +1,15 @@
<module name="mmdrv" type="win32dll" baseaddress="${BASEADDRESS_MMDRV}" installbase="system32" installname="mmdrv.dll">
<importlibrary definition="mmdrv.def" />
<include base="mmdrv">.</include>
<define name="__USE_W32API" />
<define name="UNICODE" />
<define name="_UNICODE" />
<library>ntdll</library>
<library>kernel32</library>
<library>winmm</library>
<file>auxil.c</file>
<file>entry.c</file>
<file>midi.c</file>
<file>utils.c</file>
<file>wave.c</file>
</module>

230
reactos/dll/mmdrv/utils.c Normal file
View file

@ -0,0 +1,230 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Multimedia
* FILE: lib/mmdrv/utils.c
* PURPOSE: Multimedia User Mode Driver (utility functions)
* PROGRAMMER: Andrew Greenwood
* UPDATE HISTORY:
* Jan 30, 2004: Imported into ReactOS tree
*/
#include "mmdrv.h"
#define NDEBUG
#include <debug.h>
typedef struct _DEVICE_LIST
{
struct _DEVICE_LIST *Next;
DWORD DeviceType;
ULONG CardIndex;
PVOID DeviceInstanceData;
ULONG DeviceInstanceDataSize;
WCHAR Name[1];
} DEVICE_LIST, *PDEVICE_LIST;
PDEVICE_LIST DeviceList;
DWORD TranslateStatus(void)
{
switch(GetLastError())
{
case NO_ERROR :
case ERROR_IO_PENDING :
return MMSYSERR_NOERROR;
case ERROR_BUSY :
return MMSYSERR_ALLOCATED;
case ERROR_NOT_SUPPORTED :
case ERROR_INVALID_FUNCTION :
return MMSYSERR_NOTSUPPORTED;
case ERROR_NOT_ENOUGH_MEMORY :
return MMSYSERR_NOMEM;
case ERROR_ACCESS_DENIED :
return MMSYSERR_BADDEVICEID;
case ERROR_INSUFFICIENT_BUFFER :
return MMSYSERR_INVALPARAM;
default :
return MMSYSERR_ERROR;
};
}
MMRESULT OpenDevice(UINT DeviceType, DWORD ID, PHANDLE pDeviceHandle,
DWORD Access)
{
DPRINT("OpenDevice()\n");
WCHAR DeviceName[SOUND_MAX_DEVICE_NAME];
*pDeviceHandle = INVALID_HANDLE_VALUE;
if (ID > SOUND_MAX_DEVICES)
return MMSYSERR_BADDEVICEID;
switch(DeviceType)
{
case WaveOutDevice :
wsprintf(DeviceName, L"\\\\.%ls%d", WAVE_OUT_DEVICE_NAME_U + strlen("\\Device"), ID);
break;
case WaveInDevice :
wsprintf(DeviceName, L"\\\\.%ls%d", WAVE_IN_DEVICE_NAME_U + strlen("\\Device"), ID);
break;
case MidiOutDevice :
wsprintf(DeviceName, L"\\\\.%ls%d", MIDI_OUT_DEVICE_NAME_U + strlen("\\Device"), ID);
break;
case MidiInDevice :
wsprintf(DeviceName, L"\\\\.%ls%d", MIDI_IN_DEVICE_NAME_U + strlen("\\Device"), ID);
break;
case AuxDevice :
wsprintf(DeviceName, L"\\\\.%ls%d", AUX_DEVICE_NAME_U + strlen("\\Device"), ID);
break;
default :
DPRINT("No Auido Device Found");
return MMSYSERR_BADDEVICEID; /* Maybe we should change error code */
};
DPRINT("Attempting to open %S\n", DeviceName);
*pDeviceHandle = CreateFile(DeviceName, Access, FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, Access != GENERIC_READ ? FILE_FLAG_OVERLAPPED : 0,
NULL);
DPRINT("DeviceHandle == 0x%x\n", (int)*pDeviceHandle);
if (pDeviceHandle == INVALID_HANDLE_VALUE)
return TranslateStatus();
return MMSYSERR_NOERROR;
}
// DEVICE LIST MANAGEMENT
BOOL AddDeviceToList(PDEVICE_LIST* pList, DWORD DeviceType, DWORD CardIndex,
LPWSTR Name)
{
PDEVICE_LIST pNewDevice;
DPRINT("AddDeviceToList()\n");
pNewDevice = (PDEVICE_LIST) HeapAlloc(Heap, 0,
sizeof(DEVICE_LIST) + lstrlen(Name) * sizeof(WCHAR));
if ( !pNewDevice )
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
pNewDevice->DeviceType = DeviceType;
pNewDevice->CardIndex = CardIndex;
lstrcpy(pNewDevice->Name, Name);
pNewDevice->DeviceInstanceData = NULL;
pNewDevice->Next = *pList;
*pList = pNewDevice;
DPRINT("Success!\n");
return TRUE;
}
VOID FreeDeviceList()
{
PDEVICE_LIST pDevice;
DPRINT("FreeDeviceList()\n");
while (DeviceList)
{
pDevice = DeviceList;
DeviceList = pDevice->Next;
if (pDevice->DeviceInstanceData)
HeapFree(Heap, 0, (LPVOID)pDevice->DeviceInstanceData);
HeapFree(Heap, 0, (LPSTR)pDevice);
}
}
MMRESULT FindDevices()
{
// DWORD Index;
// HKEY DriverKey;
DPRINT("Finding devices\n");
// DriverKey = OpenParametersKey();
// see drvutil.c of MS DDK for how this SHOULD be done...
SHORT i;
HANDLE h;
WCHAR DeviceName[SOUND_MAX_DEVICE_NAME];
for (i=0; OpenDevice(WaveOutDevice, i, &h, GENERIC_READ) == MMSYSERR_NOERROR; i++)
{
wsprintf(DeviceName, L"WaveOut%d\0", i);
CloseHandle(h);
AddDeviceToList(&DeviceList, WaveOutDevice, 0, DeviceName);
}
for (i=0; OpenDevice(WaveInDevice, i, &h, GENERIC_READ) == MMSYSERR_NOERROR; i++)
{
wsprintf(DeviceName, L"WaveIn%d\0", i);
CloseHandle(h);
AddDeviceToList(&DeviceList, WaveInDevice, 0, DeviceName);
}
for (i=0; OpenDevice(MidiOutDevice, i, &h, GENERIC_READ) == MMSYSERR_NOERROR; i++)
{
wsprintf(DeviceName, L"MidiOut%d\0", i);
CloseHandle(h);
AddDeviceToList(&DeviceList, MidiOutDevice, 0, DeviceName);
}
for (i=0; OpenDevice(MidiInDevice, i, &h, GENERIC_READ) == MMSYSERR_NOERROR; i++)
{
wsprintf(DeviceName, L"MidiIn%d\0", i);
CloseHandle(h);
AddDeviceToList(&DeviceList, MidiInDevice, 0, DeviceName);
}
for (i=0; OpenDevice(AuxDevice, i, &h, GENERIC_READ) == MMSYSERR_NOERROR; i++)
{
wsprintf(DeviceName, L"Aux%d\0", i);
CloseHandle(h);
AddDeviceToList(&DeviceList, AuxDevice, 0, DeviceName);
}
// MIDI Out 0: MPU-401 UART
// AddDeviceToList(&DeviceList, MidiOutDevice, 0, L"MidiOut0");
// Wave Out 0: Sound Blaster 16 (ok?)
// AddDeviceToList(&DeviceList, WaveOutDevice, 0, L"WaveOut0");
return MMSYSERR_NOERROR; // ok?
}
DWORD GetDeviceCount(UINT DeviceType)
{
int i;
PDEVICE_LIST List;
for (List = DeviceList, i = 0; List != NULL; List = List->Next)
if (List->DeviceType == DeviceType)
i ++;
return i;
}

1048
reactos/dll/mmdrv/wave.c Normal file

File diff suppressed because it is too large Load diff

92
reactos/dll/mmdrv/wave.h Normal file
View file

@ -0,0 +1,92 @@
// FIXME: Should be moved somewhere else?
typedef struct _WAVE_DD_VOLUME {
ULONG Left;
ULONG Right;
} WAVE_DD_VOLUME, *PWAVE_DD_VOLUME;
// driver
#define WAVE_DD_STOP 0x0001
#define WAVE_DD_PLAY 0x0002 // output devices only
#define WAVE_DD_RECORD 0x0003 // input devices only
#define WAVE_DD_RESET 0x0004
// ioctl
#define WAVE_DD_IDLE 0x0000
#define WAVE_DD_STOPPED 0x0001 // stopped
#define WAVE_DD_PLAYING 0x0002 // output devices only
#define WAVE_DD_RECORDING 0x0003 // input devices only
typedef enum {
WaveThreadInvalid,
WaveThreadAddBuffer,
WaveThreadSetState,
WaveThreadSetData,
WaveThreadGetData,
WaveThreadBreakLoop,
WaveThreadClose,
WaveThreadTerminate
} WAVETHREADFUNCTION;
// WARNING: MS code below!!
typedef struct {
OVERLAPPED Ovl;
LPWAVEHDR WaveHdr;
} WAVEOVL, *PWAVEOVL;
// WARNING: MS code below!!
// per allocation structure for wave
typedef struct tag_WAVEALLOC {
struct tag_WAVEALLOC *Next; // Chaining
UINT DeviceNumber; // Which device
UINT DeviceType; // WaveInput or WaveOutput
DWORD dwCallback; // client's callback
DWORD dwInstance; // client's instance data
DWORD dwFlags; // Open flags
HWAVE hWave; // handle for stream
HANDLE hDev; // Wave device handle
LPWAVEHDR DeviceQueue; // Buffers queued by application
LPWAVEHDR NextBuffer; // Next buffer to send to device
DWORD BufferPosition; // How far we're into a large buffer
DWORD BytesOutstanding;
// Bytes being processed by device
LPWAVEHDR LoopHead; // Start of loop if any
DWORD LoopCount; // Number more loops to go
WAVEOVL DummyWaveOvl; // For break loop
//
HANDLE Event; // Event for driver syncrhonization
// and notification of auxiliary
// task operation completion.
WAVETHREADFUNCTION AuxFunction; // Function for thread to perform
union {
LPWAVEHDR pHdr; // Buffer to pass in aux task
ULONG State; // State to set
struct {
ULONG Function; // IOCTL to use
PBYTE pData; // Data to set or get
ULONG DataLen; // Length of data
} GetSetData;
} AuxParam;
// 0 means terminate task.
HANDLE AuxEvent1; // Aux thread waits on this
HANDLE AuxEvent2; // Caller of Aux thread waits on this
HANDLE ThreadHandle; // Handle for thread termination ONLY
MMRESULT AuxReturnCode; // Return code from Aux task
}WAVEALLOC, *PWAVEALLOC;
/* Misc should move to own header */
MMRESULT GetDeviceCapabilities(DWORD ID, UINT DeviceType,
LPBYTE pCaps, DWORD Size);
DWORD AuxGetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume);
DWORD AuxSetAudio(DWORD dwID, PBYTE pVolume, DWORD sizeVolume);
typedef struct _AUX_DD_VOLUME {
ULONG Left;
ULONG Right;
} AUX_DD_VOLUME, *PAUX_DD_VOLUME;

View file

@ -0,0 +1,22 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = mpr.dll
IMPORTLIB = libmpr.$(IMPLIBEXT)
IMPORTS = user32 advapi32 kernel32
EXTRALIBS = $(LIBUNICODE)
C_SRCS = \
auth.c \
mpr_main.c \
multinet.c \
nps.c \
pwcache.c \
wnet.c
RC_SRCS = mpr.rc
@MAKE_DLL_RULES@
### Dependencies:

95
reactos/dll/mpr/auth.c Normal file
View file

@ -0,0 +1,95 @@
/*
* MPR Authentication and Logon functions
*
* Copyright 1999 Ulrich Weigand
*
* 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
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnetwk.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mpr);
/*****************************************************************
* WNetLogoffA [MPR.@]
*/
DWORD WINAPI WNetLogoffA( LPCSTR lpProvider, HWND hwndOwner )
{
FIXME( "(%s, %p): stub\n", debugstr_a(lpProvider), hwndOwner );
SetLastError(WN_NO_NETWORK);
return WN_NO_NETWORK;
}
/*****************************************************************
* WNetLogoffW [MPR.@]
*/
DWORD WINAPI WNetLogoffW( LPCWSTR lpProvider, HWND hwndOwner )
{
FIXME( "(%s, %p): stub\n", debugstr_w(lpProvider), hwndOwner );
SetLastError(WN_NO_NETWORK);
return WN_NO_NETWORK;
}
/*****************************************************************
* WNetLogonA [MPR.@]
*/
DWORD WINAPI WNetLogonA( LPCSTR lpProvider, HWND hwndOwner )
{
FIXME( "(%s, %p): stub\n", debugstr_a(lpProvider), hwndOwner );
SetLastError(WN_NO_NETWORK);
return WN_NO_NETWORK;
}
/*****************************************************************
* WNetLogonW [MPR.@]
*/
DWORD WINAPI WNetLogonW( LPCWSTR lpProvider, HWND hwndOwner )
{
FIXME( "(%s, %p): stub\n", debugstr_w(lpProvider), hwndOwner );
SetLastError(WN_NO_NETWORK);
return WN_NO_NETWORK;
}
/*****************************************************************
* WNetVerifyPasswordA [MPR.@]
*/
DWORD WINAPI WNetVerifyPasswordA( LPCSTR lpszPassword, BOOL *pfMatch )
{
FIXME( "(%p, %p): stub\n", lpszPassword, pfMatch );
SetLastError(WN_NO_NETWORK);
return WN_NO_NETWORK;
}
/*****************************************************************
* WNetVerifyPasswordW [MPR.@]
*/
DWORD WINAPI WNetVerifyPasswordW( LPCWSTR lpszPassword, BOOL *pfMatch )
{
FIXME( "(%p, %p): stub\n", lpszPassword, pfMatch );
SetLastError(WN_NO_NETWORK);
return WN_NO_NETWORK;
}

42
reactos/dll/mpr/mpr.rc Normal file
View file

@ -0,0 +1,42 @@
/*
* MPR dll resources
*
* Copyright (C) 2004 Juan Lang
*
* 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
*/
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "mprres.h"
#include "version.rc"
#include "mpr_Bg.rc"
#include "mpr_Cs.rc"
#include "mpr_De.rc"
#include "mpr_En.rc"
#include "mpr_Es.rc"
#include "mpr_Fr.rc"
#include "mpr_It.rc"
#include "mpr_Ja.rc"
#include "mpr_Ko.rc"
#include "mpr_Nl.rc"
#include "mpr_No.rc"
#include "mpr_Pt.rc"
#include "mpr_Ru.rc"
#include "mpr_Sv.rc"
#include "mpr_Hu.rc"
#include "mpr_Uk.rc"

114
reactos/dll/mpr/mpr.spec Normal file
View file

@ -0,0 +1,114 @@
# ordinal exports
1 stub @
2 stub @
3 stub @
4 stub @
5 stub @
6 stub @
7 stub @
8 stub @
9 stub @
12 stub @
13 stub @
14 stub @
15 stub @
16 stub @
17 stub @
18 stub @
19 stub @
20 stub @
21 stub @
22 stdcall @(long) MPR_Alloc
23 stdcall @(ptr long) MPR_ReAlloc
24 stdcall @(ptr) MPR_Free
25 stdcall @(ptr long) _MPR_25
@ stdcall -private DllCanUnloadNow()
@ stub DllGetClassObject
@ stdcall MultinetGetConnectionPerformanceA(ptr ptr)
@ stdcall MultinetGetConnectionPerformanceW(ptr ptr)
@ stdcall MultinetGetErrorTextA(long ptr long)
@ stdcall MultinetGetErrorTextW(long ptr long)
@ stdcall NPSAuthenticationDialogA(ptr)
@ stdcall NPSCopyStringA(str ptr ptr)
@ stdcall NPSDeviceGetNumberA(str ptr ptr)
@ stdcall NPSDeviceGetStringA(long long ptr long)
@ stdcall NPSGetProviderHandleA(ptr)
@ stdcall NPSGetProviderNameA(long ptr)
@ stdcall NPSGetSectionNameA(long ptr)
@ stdcall NPSNotifyGetContextA(ptr)
@ stdcall NPSNotifyRegisterA(long ptr)
@ stdcall NPSSetCustomTextA(str)
@ stdcall NPSSetExtendedErrorA(long str)
@ stub PwdChangePasswordA
@ stub PwdChangePasswordW
@ stub PwdGetPasswordStatusA
@ stub PwdGetPasswordStatusW
@ stub PwdSetPasswordStatusA
@ stub PwdSetPasswordStatusW
@ stdcall WNetAddConnection2A(ptr str str long)
@ stdcall WNetAddConnection2W(ptr wstr wstr long)
@ stdcall WNetAddConnection3A(long ptr str str long)
@ stdcall WNetAddConnection3W(long ptr wstr wstr long)
@ stdcall WNetAddConnectionA(str str str)
@ stdcall WNetAddConnectionW(wstr wstr wstr)
@ stdcall WNetCachePassword(str long str long long long)
@ stdcall WNetCancelConnection2A(str long long)
@ stdcall WNetCancelConnection2W(wstr long long)
@ stdcall WNetCancelConnectionA(str long)
@ stdcall WNetCancelConnectionW(wstr long)
@ stdcall WNetCloseEnum(long)
@ stdcall WNetConnectionDialog1A(ptr)
@ stdcall WNetConnectionDialog1W(ptr)
@ stdcall WNetConnectionDialog(long long)
@ stdcall WNetDisconnectDialog1A(ptr)
@ stdcall WNetDisconnectDialog1W(ptr)
@ stdcall WNetDisconnectDialog(long long)
@ stdcall WNetEnumCachedPasswords(str long long ptr long)
@ stdcall WNetEnumResourceA(long ptr ptr ptr)
@ stdcall WNetEnumResourceW(long ptr ptr ptr)
@ stub WNetFMXEditPerm
@ stub WNetFMXGetPermCaps
@ stub WNetFMXGetPermHelp
@ stub WNetFormatNetworkNameA
@ stub WNetFormatNetworkNameW
@ stdcall WNetGetCachedPassword(ptr long ptr ptr long)
@ stdcall WNetGetConnectionA(str ptr ptr)
@ stdcall WNetGetConnectionW(wstr ptr ptr)
@ stub WNetGetDirectoryTypeA
@ stub WNetGetHomeDirectoryA
@ stub WNetGetHomeDirectoryW
@ stdcall WNetGetLastErrorA(ptr ptr long ptr long)
@ stdcall WNetGetLastErrorW(ptr ptr long ptr long)
@ stdcall WNetGetNetworkInformationA(str ptr)
@ stdcall WNetGetNetworkInformationW(wstr ptr)
@ stub WNetGetPropertyTextA
@ stdcall WNetGetProviderNameA(long ptr ptr)
@ stdcall WNetGetProviderNameW(long ptr ptr)
@ stdcall WNetGetResourceInformationA(ptr ptr ptr ptr)
@ stdcall WNetGetResourceInformationW(ptr ptr ptr ptr)
@ stdcall WNetGetResourceParentA(ptr ptr ptr)
@ stdcall WNetGetResourceParentW(ptr ptr ptr)
@ stdcall WNetGetUniversalNameA (str long ptr ptr)
@ stdcall WNetGetUniversalNameW (wstr long ptr ptr)
@ stdcall WNetGetUserA(str ptr ptr)
@ stdcall WNetGetUserW(wstr wstr ptr)
@ stdcall WNetLogoffA(str long)
@ stdcall WNetLogoffW(wstr long)
@ stdcall WNetLogonA(str long)
@ stub WNetLogonNotify
@ stdcall WNetLogonW(wstr long)
@ stdcall WNetOpenEnumA(long long long ptr ptr)
@ stdcall WNetOpenEnumW(long long long ptr ptr)
@ stub WNetPasswordChangeNotify
@ stub WNetPropertyDialogA
@ stdcall WNetRemoveCachedPassword(long long long)
@ stub WNetRestoreConnection
@ stdcall WNetRestoreConnectionA(long str)
@ stdcall WNetRestoreConnectionW(long wstr)
@ stdcall WNetSetConnectionA(str long ptr)
@ stdcall WNetSetConnectionW(wstr long ptr)
@ stdcall WNetUseConnectionA(long ptr str str long str ptr ptr)
@ stdcall WNetUseConnectionW(long ptr wstr wstr long wstr ptr ptr)
@ stdcall WNetVerifyPasswordA(str ptr)
@ stdcall WNetVerifyPasswordW(wstr ptr)

25
reactos/dll/mpr/mpr.xml Normal file
View file

@ -0,0 +1,25 @@
<module name="mpr" type="win32dll" baseaddress="${BASEADDRESS_MPR}" installbase="system32" installname="mpr.dll" allowwarnings="true">
<importlibrary definition="mpr.spec.def" />
<include base="mpr">.</include>
<include base="ReactOS">include/wine</include>
<define name="UNICODE" />
<define name="_UNICODE" />
<define name="__REACTOS__" />
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x501</define>
<library>wine</library>
<library>ntdll</library>
<library>kernel32</library>
<library>advapi32</library>
<library>user32</library>
<file>auth.c</file>
<file>mpr_main.c</file>
<file>multinet.c</file>
<file>nps.c</file>
<file>pwcache.c</file>
<file>wnet.c</file>
<file>mpr.rc</file>
<file>mpr.spec</file>
</module>

46
reactos/dll/mpr/mpr_Bg.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR Bulgarian resource
*
* Copyright 2005 Milko Krachounov
*
* 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
*/
LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Öÿëàòà ìðåæà"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Âúâåäåòå ìðåæîâà ïàðîëà"
FONT 8, "MS Shell Dlg"
{
LTEXT "Âúâåäåòå âàøåòî ïîòðåáèòåëñêî èìå è ïàðîëà:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Ïðîêñè", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "Ïîòðåáèòåë", -1, 40, 66, 50, 10
LTEXT "Ïàðîëà", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "&Save this password (Insecure)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Îòìåíè", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

46
reactos/dll/mpr/mpr_Cs.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* Czech MPR dll resources
* Copyright (C) 2004 Juan Lang
* Copyright (C) 2004, 2005 David Kredba
*
* 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
*/
LANGUAGE LANG_CZECH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Celá sí»"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Zadání sí»ového hesla"
FONT 8, "MS Shell Dlg"
{
LTEXT "Prosím zadejte své u¾ivatelské jméno a heslo:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Proxy", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "U¾ivatel", -1, 40, 66, 50, 10
LTEXT "Heslo", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "&Ulo¾it toto heslo (Není bezpeèné) ?", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Zru¹it", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

46
reactos/dll/mpr/mpr_De.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR dll resources
*
* Copyright (C) 2004 Henning Gerhardt
*
* 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
*/
LANGUAGE LANG_GERMAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Gesamtes Netzwerk"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Netzwerkkennung eingeben"
FONT 8, "MS Shell Dlg"
{
LTEXT "Bitte geben Sie Benutzernamen und Kennwort ein:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Proxy", -1, 40, 26, 50, 10
/* LTEXT "Bereich", -1, 40, 46, 50, 10 */
LTEXT "Benutzername", -1, 40, 66, 50, 10
LTEXT "Kennwort", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "Dieses Kennwort speichern (unsicher)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Abbrechen", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

46
reactos/dll/mpr/mpr_En.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR dll resources
*
* Copyright (C) 2004 Juan Lang
*
* 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
*/
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Entire Network"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Enter Network Password"
FONT 8, "MS Shell Dlg"
{
LTEXT "Please enter your username and password:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Proxy", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "User", -1, 40, 66, 50, 10
LTEXT "Password", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "&Save this password (Insecure)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Cancel", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

46
reactos/dll/mpr/mpr_Es.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR dll Spanish resources
*
* Copyright (C) 2004, 2005 José Manuel Ferrer Ortiz
*
* 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
*/
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Toda la red"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Introduzca contraseña de red"
FONT 8, "MS Shell Dlg"
{
LTEXT "Por favor, introduzca su nombre de usuario y contraseña:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Proxy", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "Usuario", -1, 40, 66, 50, 10
LTEXT "Contraseña", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "&Guardar esta contraseña (Inseguro)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Aceptar", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Cancelar", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

47
reactos/dll/mpr/mpr_Fr.rc Normal file
View file

@ -0,0 +1,47 @@
/*
* MPR dll resources
* French language support
*
* Copyright (C) 2005 Jonathan Ernst
*
* 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
*/
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Le réseau entier"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Entrez le mot de passe réseau"
FONT 8, "MS Shell Dlg"
{
LTEXT "Veuillez saisir votre nom d'utilisateur et votre mot de passe:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Proxy", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "Utilisateur", -1, 40, 66, 50, 10
LTEXT "Mot de passe", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "&Enregistrer ce mot de passe (risqué)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Annuler", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

47
reactos/dll/mpr/mpr_Hu.rc Normal file
View file

@ -0,0 +1,47 @@
/*
* MPR dll resources
*
* Copyright (C) 2004 Juan Lang
* Copyright (C) 2005 Gergely Risko
*
* 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
*/
LANGUAGE LANG_HUNGARIAN, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Teljes álózat"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Hálózati Bejelentkezés"
FONT 8, "MS Shell Dlg"
{
LTEXT "Írd be a felhasználó nevet és jelszót:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Proxy", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "Felhasználó", -1, 40, 66, 50, 10
LTEXT "Jelszó", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "Jelszó &mentése (Nem biztonságos)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Mégse", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

26
reactos/dll/mpr/mpr_It.rc Normal file
View file

@ -0,0 +1,26 @@
/*
* MPR dll Italian resources
*
* Copyright 2004 Ivan Leo Puoti
*
* 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
*/
LANGUAGE LANG_ITALIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Tutta la rete"
}

46
reactos/dll/mpr/mpr_Ja.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR dll resources
*
* Copyright (C) 2004 Hajime Segawa
*
* 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
*/
LANGUAGE LANG_JAPANESE, SUBLANG_NEUTRAL
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "ネットワーク全体"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "ネットワークパスワードの入力"
FONT 9, "MS UI Gothic"
{
LTEXT "ユーザー名とパスワードを入力して下さい:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "プロキシ", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "ユーザ名", -1, 40, 66, 50, 10
LTEXT "パスワード", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "パスワードを保存する(&S) (安全ではありません)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "キャンセル", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

47
reactos/dll/mpr/mpr_Ko.rc Normal file
View file

@ -0,0 +1,47 @@
/*
* MPR dll resources
*
* Copyright (C) 2004 Juan Lang
* Copyright 2005 YunSong Hwang
*
* 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
*/
LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "전체 네트워크"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "네트워크 암호 입력"
FONT 8, "MS Shell Dlg"
{
LTEXT "당신의 사용자이름과 암호를 입력하시오:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "프록시", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "사용자", -1, 40, 66, 50, 10
LTEXT "암호", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "암호 저장(&S) (Insecure)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "확인", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "취소", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

26
reactos/dll/mpr/mpr_Nl.rc Normal file
View file

@ -0,0 +1,26 @@
/*
* Dutch resources for MPR
*
* Copyright (C) 2004 Hans Leidekker
*
* 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
*/
LANGUAGE LANG_DUTCH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Gehele netwerk"
}

46
reactos/dll/mpr/mpr_No.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR dll resources for Norwegian Bokmål
*
* Copyright (C) 2005 Alexander N. Sørnes <alex@thehandofagony.com>
*
* 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
*/
LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Hele nettverket"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Skriv inn nettverkspassord"
FONT 8, "MS Shell Dlg"
{
LTEXT "Skriv inn brukernavnet og passordet ditt:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Mellomtjener", -1, 40, 26, 50, 10
/* LTEXT "Område", -1, 40, 46, 50, 10 */
LTEXT "Bruker", -1, 40, 66, 50, 10
LTEXT "Passord", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "Lagre dette pa&ssordet (usikkert)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Avbryt", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

46
reactos/dll/mpr/mpr_Pt.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR dll resources
*
* Copyright (C) 2004 Marcelo Duarte
*
* 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
*/
LANGUAGE LANG_PORTUGUESE, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Toda a rede"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Entre a senha da rede"
FONT 8, "MS Shell Dlg"
{
LTEXT "Por favor, entre como o nome de usuário e a senha:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Proxy", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "Usuário", -1, 40, 66, 50, 10
LTEXT "Senha", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "&Salvar esta senha (Inseguro)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Cancelar", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

46
reactos/dll/mpr/mpr_Ru.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR dll resources
*
* Copyright (C) 2005 Mikhail Y. Zvyozdochkin
*
* 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
*/
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Âñÿ ñåòü"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Ââåäèòå Ñåòåâîé Ïàðîëü"
FONT 8, "MS Shell Dlg"
{
LTEXT "Ïîæàëóéñòà, ââåäèòå Âàøè èìÿ è ïàðîëü:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Ïðîêñè-ñåðâåð", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "Èìÿ ïîëüçîâàòåëÿ", -1, 40, 66, 50, 10
LTEXT "Ïàðîëü", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "&Ñîõðàíèòü ïàðîëü (íåáåçîïàñíî)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Îòìåíà", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

46
reactos/dll/mpr/mpr_Sv.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR dll Swedish resources
*
* Copyright (C) 2005 Andreas Bjerkeholt
*
* 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
*/
LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Hela nätverket"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Ange nätverkslösenord"
FONT 8, "MS Shell Dlg"
{
LTEXT "Ange ditt användarnamn och lösenord:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Proxy", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "Användare", -1, 40, 66, 50, 10
LTEXT "Lösenord", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "&Spara detta lösenord (Osäkert)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Avbryt", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

46
reactos/dll/mpr/mpr_Uk.rc Normal file
View file

@ -0,0 +1,46 @@
/*
* MPR dll resources (Ukrainian)
*
* Copyright 2006 Artem Reznikov
*
* 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
*/
LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT
STRINGTABLE DISCARDABLE
{
IDS_ENTIRENETWORK "Âñÿ Ìåðåæà"
}
IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Ââåä³òü Ìåðåæíèé Ïàðîëü"
FONT 8, "MS Shell Dlg"
{
LTEXT "Áóäü ëàñêà, ââåä³òü Âàø³ ³ì'ÿ òà ïàðîëü:", IDC_EXPLAIN, 40, 6, 150, 15
LTEXT "Ïðîêñ³", -1, 40, 26, 50, 10
/* LTEXT "Realm", -1, 40, 46, 50, 10 */
LTEXT "Êîðèñòóâà÷", -1, 40, 66, 50, 10
LTEXT "Ïàðîëü", -1, 40, 86, 50, 10
LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
CHECKBOX "&Çáåðåãòè öåé ïàðîëü (íåáåçïå÷íî)", IDC_SAVEPASSWORD,
80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
PUSHBUTTON "Ñêàñóâàòè", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
}

101
reactos/dll/mpr/mpr_main.c Normal file
View file

@ -0,0 +1,101 @@
/*
* MPR undocumented functions
*
* Copyright 1999 Ulrich Weigand
*
* 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
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "winnetwk.h"
#include "wine/debug.h"
#include "wnetpriv.h"
WINE_DEFAULT_DEBUG_CHANNEL(mpr);
/*
* FIXME: The following routines should use a private heap ...
*/
/*****************************************************************
* @ [MPR.22]
*/
LPVOID WINAPI MPR_Alloc( DWORD dwSize )
{
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize );
}
/*****************************************************************
* @ [MPR.23]
*/
LPVOID WINAPI MPR_ReAlloc( LPVOID lpSrc, DWORD dwSize )
{
if ( lpSrc )
return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, lpSrc, dwSize );
else
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize );
}
/*****************************************************************
* @ [MPR.24]
*/
BOOL WINAPI MPR_Free( LPVOID lpMem )
{
if ( lpMem )
return HeapFree( GetProcessHeap(), 0, lpMem );
else
return FALSE;
}
/*****************************************************************
* @ [MPR.25]
*/
BOOL WINAPI _MPR_25( LPBYTE lpMem, INT len )
{
FIXME( "(%p, %d): stub\n", lpMem, len );
return FALSE;
}
/*****************************************************************
* DllCanUnloadNow [MPR.@]
*/
HRESULT WINAPI DllCanUnloadNow(void)
{
FIXME("Stub\n");
return S_OK;
}
/*****************************************************************
* DllMain [MPR.init]
*/
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls( hinstDLL );
wnetInit(hinstDLL);
break;
case DLL_PROCESS_DETACH:
wnetFree();
break;
}
return TRUE;
}

32
reactos/dll/mpr/mprres.h Normal file
View file

@ -0,0 +1,32 @@
/*
* Copyright (C) 2004 Juan Lang
*
* 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
*/
#ifndef __WINE_MPRRES_H__
#define __WINE_MPRRES_H__
#define IDS_ENTIRENETWORK 1
#define IDD_PROXYDLG 0x400
#define IDC_PROXY 0x401
#define IDC_REALM 0x402
#define IDC_USERNAME 0x403
#define IDC_PASSWORD 0x404
#define IDC_SAVEPASSWORD 0x405
#define IDC_EXPLAIN 0x406
#endif /* ndef __WINE_MPRRES_H__ */

View file

@ -0,0 +1,81 @@
/*
* MPR Multinet functions
*
* Copyright 1999 Ulrich Weigand
*
* 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
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnetwk.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mpr);
/*****************************************************************
* MultinetGetConnectionPerformanceA [MPR.@]
*
* RETURNS
* Success: NO_ERROR
* Failure: ERROR_NOT_SUPPORTED, ERROR_NOT_CONNECTED,
* ERROR_NO_NET_OR_BAD_PATH, ERROR_BAD_DEVICE,
* ERROR_BAD_NET_NAME, ERROR_INVALID_PARAMETER,
* ERROR_NO_NETWORK, ERROR_EXTENDED_ERROR
*/
DWORD WINAPI MultinetGetConnectionPerformanceA(
LPNETRESOURCEA lpNetResource,
LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct )
{
FIXME( "(%p, %p): stub\n", lpNetResource, lpNetConnectInfoStruct );
SetLastError(WN_NO_NETWORK);
return WN_NO_NETWORK;
}
/*****************************************************************
* MultinetGetConnectionPerformanceW [MPR.@]
*/
DWORD WINAPI MultinetGetConnectionPerformanceW(
LPNETRESOURCEW lpNetResource,
LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct )
{
FIXME( "(%p, %p): stub\n", lpNetResource, lpNetConnectInfoStruct );
SetLastError(WN_NO_NETWORK);
return WN_NO_NETWORK;
}
/*****************************************************************
* MultinetGetErrorTextA [MPR.@]
*/
DWORD WINAPI MultinetGetErrorTextA( DWORD x, DWORD y, DWORD z )
{
FIXME( "(%lx, %lx, %lx): stub\n", x, y, z );
return 0;
}
/*****************************************************************
* MultinetGetErrorTextW [MPR.@]
*/
DWORD WINAPI MultinetGetErrorTextW( DWORD x, DWORD y, DWORD z )
{
FIXME( "(%lx, %lx, %lx ): stub\n", x, y, z );
return 0;
}

153
reactos/dll/mpr/netspi.h Normal file
View file

@ -0,0 +1,153 @@
/*
* MPR - Network provider services
* Warning: this file apparently existed as part of the Win98 DDK. Some of
* the declarations in it conflict with those in the Platform SDK's npapi.h,
* therefore this header was made private. Don't try to include both headers.
*
* Copyright (C) 1999 Ulrich Weigand
*
* 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
*/
#ifndef _NETSPI_H_
#define _NETSPI_H_
#include "windef.h"
#include "winnetwk.h"
/*
* Note: The Unicode variants of all these routines/structures
* apparently don't exist, at least not in Win95 ...
*/
#define HPROVIDER LPVOID
typedef HPROVIDER *PHPROVIDER;
typedef struct
{
DWORD cbStructure;
HWND hwndOwner;
LPCSTR lpResource;
LPSTR lpUsername;
DWORD cbUsername;
LPSTR lpPassword;
DWORD cbPassword;
LPSTR lpOrgUnit;
DWORD cbOrgUnit;
LPCSTR lpOUTitle;
LPCSTR lpExplainText;
LPCSTR lpDefaultUserName;
DWORD dwFlags;
} AUTHDLGSTRUCTA, *LPAUTHDLGSTRUCTA;
DECL_WINELIB_TYPE_AW(AUTHDLGSTRUCT)
DECL_WINELIB_TYPE_AW(LPAUTHDLGSTRUCT)
#define AUTHDLG_ENABLECACHE 0x00000001
#define AUTHDLG_CHECKCACHE 0x00000002
#define AUTHDLG_CACHEINVALID 0x00000004
#define AUTHDLG_USE_DEFAULT_NAME 0x00000008
#define AUTHDLG_CHECKDEFAULT_NAME 0x00000010
#define AUTHDLG_LOGON 0x00000020
#define AUTHDLG_ENABLECACHE 0x00000001
#define AUTHDLG_CHECKCACHE 0x00000002
#define AUTHDLG_CACHEINVALID 0x00000004
#define AUTHDLG_USE_DEFAULT_NAME 0x00000008
#define AUTHDLG_CHECKDEFAULT_NAME 0x00000010
#define AUTHDLG_LOGON 0x00000020
DWORD WINAPI NPSAuthenticationDialogA(LPAUTHDLGSTRUCTA);
#define NPSAuthenticationDialog WINELIB_NAME_AW(NPSAuthenticationDialog)
DWORD WINAPI NPSGetProviderHandleA(PHPROVIDER);
#define NPSGetProviderHandle WINELIB_NAME_AW(NPSGetProviderHandle)
DWORD WINAPI NPSGetProviderNameA(HPROVIDER,LPCSTR *);
#define NPSGetProviderName WINELIB_NAME_AW(NPSGetProviderName)
DWORD WINAPI NPSGetSectionNameA(HPROVIDER,LPCSTR *lpszSectionName);
#define NPSGetSectionName WINELIB_NAME_AW(NPSGetSectionName)
DWORD WINAPI NPSSetExtendedErrorA(DWORD,LPSTR);
#define NPSSetExtendedError WINELIB_NAME_AW(NPSSetExtendedError)
VOID WINAPI NPSSetCustomTextA(LPSTR);
#define NPSSetCustomText WINELIB_NAME_AW(NPSSetCustomText)
DWORD WINAPI NPSCopyStringA(LPCSTR,LPVOID,LPDWORD);
#define NPSCopyString WINELIB_NAME_AW(NPSCopyString)
DWORD WINAPI NPSDeviceGetNumberA(LPSTR,LPDWORD,LPDWORD);
#define NPSDeviceGetNumber WINELIB_NAME_AW(NPSDeviceGetNumber)
DWORD WINAPI NPSDeviceGetStringA(DWORD,DWORD,LPSTR,LPDWORD);
#define NPSDeviceGetString WINELIB_NAME_AW(NPSDeviceGetString)
enum NOTIFYTYPE { NotifyAddConnection,
NotifyCancelConnection,
NotifyGetConnectionPerformance };
#define NOTIFY_PRE 0x00
#define NOTIFY_POST 0x01
typedef struct
{
DWORD cbStructure;
DWORD dwNotifyStatus;
DWORD dwOperationStatus;
LPVOID lpNPContext;
} NOTIFYINFO, *LPNOTIFYINFO;
typedef struct
{
DWORD cbStructure;
HWND hwndOwner;
NETRESOURCEA NetResource;
DWORD dwAddFlags;
LPSTR lpAccessName;
LPDWORD lpBufferSize;
DWORD dwResult;
DWORD dwAddContext;
} NOTIFYADDA, *LPNOTIFYADDA;
#define CONNECT_CTXT_RESTORE 0x00000001
#define CONNECT_CTXT_GLOBAL 0x00000002
#define CONNECT_CTXT_PROVIDER 0x00000004
#define CONNECT_CTXT_SINGLE 0x00000008
typedef struct
{
DWORD cbStructure;
LPSTR lpName;
LPSTR lpProvider;
DWORD dwFlags;
BOOL fForce;
} NOTIFYCANCELA, *LPNOTIFYCANCELA;
typedef struct
{
DWORD cbStructure;
LPSTR lpRemoteName;
LPSTR lpProviderName;
LPNETCONNECTINFOSTRUCT lpNetConnectInfo;
} NOTIFYPERFORMANCEA, *LPNOTIFYPERFORMANCEA;
typedef DWORD (CALLBACK *NOTIFYCALLBACK)(LPNOTIFYINFO,LPVOID);
DWORD WINAPI NPSNotifyRegisterA(enum NOTIFYTYPE,NOTIFYCALLBACK);
#define NPSNotifyRegister WINELIB_NAME_AW(NPSNotifyRegister)
LPVOID WINAPI NPSNotifyGetContextA(NOTIFYCALLBACK);
#define NPSNotifyGetContext WINELIB_NAME_AW(NPSNotifyGetContext)
#endif /* _NETSPI_H_ */

213
reactos/dll/mpr/nps.c Normal file
View file

@ -0,0 +1,213 @@
/*
* MPR Network Provider Services functions
*
* Copyright 1999 Ulrich Weigand
* Copyright 2004 Mike McCormack for CodeWeavers Inc.
*
* 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
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "netspi.h"
#include "wine/debug.h"
#include "winerror.h"
WINE_DEFAULT_DEBUG_CHANNEL(mpr);
#include "wine/unicode.h"
#include "mprres.h"
/***********************************************************************
* NPS_ProxyPasswordDialog
*/
static INT_PTR WINAPI NPS_ProxyPasswordDialog(
HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
HWND hitem;
LPAUTHDLGSTRUCTA lpAuthDlgStruct;
if( uMsg == WM_INITDIALOG )
{
TRACE("WM_INITDIALOG (%08lx)\n", lParam);
/* save the parameter list */
lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam;
SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );
if( lpAuthDlgStruct->lpExplainText )
{
hitem = GetDlgItem( hdlg, IDC_EXPLAIN );
SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText );
}
/* extract the Realm from the proxy response and show it */
if( lpAuthDlgStruct->lpResource )
{
hitem = GetDlgItem( hdlg, IDC_REALM );
SetWindowTextA( hitem, lpAuthDlgStruct->lpResource );
}
return TRUE;
}
lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA );
switch( uMsg )
{
case WM_COMMAND:
if( wParam == IDOK )
{
WCHAR username[0x20], password[0x20];
username[0] = 0;
hitem = GetDlgItem( hdlg, IDC_USERNAME );
if( hitem )
GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername );
password[0] = 0;
hitem = GetDlgItem( hdlg, IDC_PASSWORD );
if( hitem )
GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword );
EndDialog( hdlg, WN_SUCCESS );
return TRUE;
}
if( wParam == IDCANCEL )
{
EndDialog( hdlg, WN_CANCEL );
return TRUE;
}
break;
}
return FALSE;
}
/*****************************************************************
* NPSAuthenticationDialogA [MPR.@]
*/
DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct )
{
HMODULE hwininet = GetModuleHandleA( "mpr.dll" );
TRACE("%p\n", lpAuthDlgStruct);
if( !lpAuthDlgStruct )
return WN_BAD_POINTER;
if( lpAuthDlgStruct->cbStructure < sizeof *lpAuthDlgStruct )
return WN_BAD_POINTER;
TRACE("%s %s %s\n",lpAuthDlgStruct->lpResource,
lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText);
return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ),
lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog,
(LPARAM) lpAuthDlgStruct );
}
/*****************************************************************
* NPSGetProviderHandleA [MPR.@]
*/
DWORD WINAPI NPSGetProviderHandleA( PHPROVIDER phProvider )
{
FIXME( "(%p): stub\n", phProvider );
return WN_NOT_SUPPORTED;
}
/*****************************************************************
* NPSGetProviderNameA [MPR.@]
*/
DWORD WINAPI NPSGetProviderNameA( HPROVIDER hProvider, LPCSTR *lpszProviderName )
{
FIXME( "(%p, %p): stub\n", hProvider, lpszProviderName );
return WN_NOT_SUPPORTED;
}
/*****************************************************************
* NPSGetSectionNameA [MPR.@]
*/
DWORD WINAPI NPSGetSectionNameA( HPROVIDER hProvider, LPCSTR *lpszSectionName )
{
FIXME( "(%p, %p): stub\n", hProvider, lpszSectionName );
return WN_NOT_SUPPORTED;
}
/*****************************************************************
* NPSSetExtendedErrorA [MPR.@]
*/
DWORD WINAPI NPSSetExtendedErrorA( DWORD NetSpecificError, LPSTR lpExtendedErrorText )
{
FIXME( "(%08lx, %s): stub\n", NetSpecificError, debugstr_a(lpExtendedErrorText) );
return WN_NOT_SUPPORTED;
}
/*****************************************************************
* NPSSetCustomTextA [MPR.@]
*/
VOID WINAPI NPSSetCustomTextA( LPSTR lpCustomErrorText )
{
FIXME( "(%s): stub\n", debugstr_a(lpCustomErrorText) );
}
/*****************************************************************
* NPSCopyStringA [MPR.@]
*/
DWORD WINAPI NPSCopyStringA( LPCSTR lpString, LPVOID lpBuffer, LPDWORD lpdwBufferSize )
{
FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpString), lpBuffer, lpdwBufferSize );
return WN_NOT_SUPPORTED;
}
/*****************************************************************
* NPSDeviceGetNumberA [MPR.@]
*/
DWORD WINAPI NPSDeviceGetNumberA( LPSTR lpLocalName, LPDWORD lpdwNumber, LPDWORD lpdwType )
{
FIXME( "(%s, %p, %p): stub\n", debugstr_a(lpLocalName), lpdwNumber, lpdwType );
return WN_NOT_SUPPORTED;
}
/*****************************************************************
* NPSDeviceGetStringA [MPR.@]
*/
DWORD WINAPI NPSDeviceGetStringA( DWORD dwNumber, DWORD dwType, LPSTR lpLocalName, LPDWORD lpdwBufferSize )
{
FIXME( "(%ld, %ld, %p, %p): stub\n", dwNumber, dwType, lpLocalName, lpdwBufferSize );
return WN_NOT_SUPPORTED;
}
/*****************************************************************
* NPSNotifyRegisterA [MPR.@]
*/
DWORD WINAPI NPSNotifyRegisterA( enum NOTIFYTYPE NotifyType, NOTIFYCALLBACK pfNotifyCallBack )
{
FIXME( "(%d, %p): stub\n", NotifyType, pfNotifyCallBack );
return WN_NOT_SUPPORTED;
}
/*****************************************************************
* NPSNotifyGetContextA [MPR.@]
*/
LPVOID WINAPI NPSNotifyGetContextA( NOTIFYCALLBACK pfNotifyCallBack )
{
FIXME( "(%p): stub\n", pfNotifyCallBack );
return NULL;
}

319
reactos/dll/mpr/pwcache.c Normal file
View file

@ -0,0 +1,319 @@
/*
* MPR Password Cache functions
*
* Copyright 1999 Ulrich Weigand
* Copyright 2003,2004 Mike McCormack for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winnetwk.h"
#include "winreg.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mpr);
static const char mpr_key[] = "Software\\Wine\\Wine\\Mpr\\";
static inline BYTE hex( BYTE x )
{
if( x <= 9 )
return x + '0';
return x + 'A' - 10;
}
static inline CHAR ctox( CHAR x )
{
if( ( x >= '0' ) && ( x <= '9' ) )
return x - '0';
if( ( x >= 'A' ) && ( x <= 'F' ) )
return x - 'A' + 10;
if( ( x >= 'a' ) && ( x <= 'a' ) )
return x - 'a' + 10;
return -1;
}
static LPSTR MPR_GetValueName( LPSTR pbResource, WORD cbResource, BYTE nType )
{
LPSTR name;
DWORD i;
name = HeapAlloc( GetProcessHeap(), 0, 6+cbResource*2 );
if( name )
sprintf( name, "X-%02X-", nType );
for(i=0; i<cbResource; i++)
{
name[5+i*2]=hex((pbResource[i]&0xf0)>>4);
name[6+i*2]=hex(pbResource[i]&0x0f);
}
name[5+i*2]=0;
TRACE( "Value is %s\n", name );
return name;
}
/**************************************************************************
* WNetCachePassword [MPR.@] Saves password in cache
*
* NOTES
* only the parameter count is verifyed
*
* ---- everything below this line might be wrong (js) -----
* RETURNS
* Success: WN_SUCCESS
* Failure: WN_ACCESS_DENIED, WN_BAD_PASSWORD, WN_BADVALUE, WN_NET_ERROR,
* WN_NOT_SUPPORTED, WN_OUT_OF_MEMORY
*/
DWORD WINAPI WNetCachePassword(
LPSTR pbResource, /* [in] Name of workgroup, computer, or resource */
WORD cbResource, /* [in] Size of name */
LPSTR pbPassword, /* [in] Buffer containing password */
WORD cbPassword, /* [in] Size of password */
BYTE nType, /* [in] Type of password to cache */
WORD x)
{
HKEY hkey;
DWORD r;
LPSTR valname;
WARN( "(%p(%s), %d, %p(%s), %d, %d, 0x%08x): totally insecure\n",
pbResource, debugstr_a(pbResource), cbResource,
pbPassword, debugstr_a(pbPassword), cbPassword,
nType, x );
/* @@ Wine registry key: HKCU\Software\Wine\Wine\Mpr */
r = RegCreateKeyA( HKEY_CURRENT_USER, mpr_key, &hkey );
if( r )
return WN_ACCESS_DENIED;
valname = MPR_GetValueName( pbResource, cbResource, nType );
if( valname )
{
r = RegSetValueExA( hkey, valname, 0, REG_BINARY,
(LPBYTE)pbPassword, cbPassword );
if( r )
r = WN_CANCEL;
else
r = WN_SUCCESS;
HeapFree( GetProcessHeap(), 0, valname );
}
else
r = WN_OUT_OF_MEMORY;
RegCloseKey( hkey );
return r;
}
/*****************************************************************
* WNetRemoveCachedPassword [MPR.@]
*/
UINT WINAPI WNetRemoveCachedPassword(
LPSTR pbResource, /* [in] resource ID to delete */
WORD cbResource, /* [in] number of bytes in the resource ID */
BYTE nType ) /* [in] Type of the resource to delete */
{
HKEY hkey;
DWORD r;
LPSTR valname;
WARN( "(%p(%s), %d, %d): totally insecure\n",
pbResource, debugstr_a(pbResource), cbResource, nType );
/* @@ Wine registry key: HKCU\Software\Wine\Wine\Mpr */
r = RegCreateKeyA( HKEY_CURRENT_USER, mpr_key, &hkey );
if( r )
return WN_ACCESS_DENIED;
valname = MPR_GetValueName( pbResource, cbResource, nType );
if( valname )
{
r = RegDeleteValueA( hkey, valname );
if( r )
r = WN_ACCESS_DENIED;
else
r = WN_SUCCESS;
HeapFree( GetProcessHeap(), 0, valname );
}
else
r = WN_OUT_OF_MEMORY;
return r;
}
/*****************************************************************
* WNetGetCachedPassword [MPR.@] Retrieves password from cache
*
* NOTES
* the stub seems to be wrong:
* arg1: ptr 0x40xxxxxx -> (no string)
* arg2: len 36
* arg3: ptr 0x40xxxxxx -> (no string)
* arg4: ptr 0x40xxxxxx -> 0xc8
* arg5: type? 4
*
* ---- everything below this line might be wrong (js) -----
* RETURNS
* Success: WN_SUCCESS
* Failure: WN_ACCESS_DENIED, WN_BAD_PASSWORD, WN_BAD_VALUE,
* WN_NET_ERROR, WN_NOT_SUPPORTED, WN_OUT_OF_MEMORY
*/
DWORD WINAPI WNetGetCachedPassword(
LPSTR pbResource, /* [in] Name of workgroup, computer, or resource */
WORD cbResource, /* [in] Size of name */
LPSTR pbPassword, /* [out] Buffer to receive password */
LPWORD pcbPassword, /* [out] Receives size of password */
BYTE nType) /* [in] Type of password to retrieve */
{
HKEY hkey;
DWORD r, type = 0, sz;
LPSTR valname;
WARN( "(%p(%s), %d, %p, %p, %d): totally insecure\n",
pbResource, debugstr_a(pbResource), cbResource,
pbPassword, pcbPassword, nType );
memset( pbPassword, 0, *pcbPassword);
/* @@ Wine registry key: HKCU\Software\Wine\Wine\Mpr */
r = RegCreateKeyA( HKEY_CURRENT_USER, mpr_key, &hkey );
if( r )
return WN_ACCESS_DENIED;
valname = MPR_GetValueName( pbResource, cbResource, nType );
if( valname )
{
sz = *pcbPassword;
r = RegQueryValueExA( hkey, valname, 0, &type, (LPBYTE)pbPassword, &sz );
*pcbPassword = sz;
if( r )
r = WN_CANCEL;
else
r = WN_SUCCESS;
HeapFree( GetProcessHeap(), 0, valname );
}
else
r = WN_OUT_OF_MEMORY;
return r;
}
/*******************************************************************
* WNetEnumCachedPasswords [MPR.@]
*
* NOTES
* the parameter count is verifyed
*
* This function is a huge security risk, as virii and such can use
* it to grab all the passwords in the cache. It's bad enough to
* store the passwords (insecurely).
*
* bpPrefix and cbPrefix are used to filter the returned passwords
* the first cbPrefix bytes of the password resource identifier
* should match the same number of bytes in bpPrefix
*
* RETURNS
* Success: WN_SUCCESS (even if no entries were enumerated)
* Failure: WN_ACCESS_DENIED, WN_BAD_PASSWORD, WN_BAD_VALUE,
* WN_NET_ERROR, WN_NOT_SUPPORTED, WN_OUT_OF_MEMORY
*/
UINT WINAPI WNetEnumCachedPasswords(
LPSTR pbPrefix, /* [in] prefix to filter cache entries */
WORD cbPrefix, /* [in] number of bytes in Prefix substring */
BYTE nType, /* [in] match the Type ID of the entry */
ENUMPASSWORDPROC enumPasswordProc, /* [in] callback function */
DWORD param) /* [in] parameter passed to enum function */
{
HKEY hkey;
DWORD r, type, val_sz, data_sz, i, j, size;
PASSWORD_CACHE_ENTRY *entry;
CHAR val[256], prefix[6];
WARN( "(%s, %d, %d, %p, 0x%08lx) totally insecure\n",
debugstr_an(pbPrefix,cbPrefix), cbPrefix,
nType, enumPasswordProc, param );
/* @@ Wine registry key: HKCU\Software\Wine\Wine\Mpr */
r = RegCreateKeyA( HKEY_CURRENT_USER, mpr_key, &hkey );
if( r )
return WN_ACCESS_DENIED;
sprintf(prefix, "X-%02X-", nType );
i = 0;
for( i=0; ; i++ )
{
val_sz = sizeof val;
data_sz = 0;
type = 0;
val[0] = 0;
r = RegEnumValueA( hkey, i, val, &val_sz, NULL, &type, NULL, &data_sz );
if( r != ERROR_SUCCESS )
break;
if( type != REG_BINARY )
continue;
/* check the value is in the format we expect */
if( val_sz < sizeof prefix )
continue;
if( memcmp( prefix, val, 5 ) )
continue;
/* decode the value */
for(j=5; j<val_sz; j+=2 )
{
CHAR hi = ctox( val[j] ), lo = ctox( val[j+1] );
if( ( hi < 0 ) || ( lo < 0 ) )
break;
val[(j-5)/2] = (hi<<4) | lo;
}
/* find the decoded length */
val_sz = (j - 5)/2;
val[val_sz]=0;
if( val_sz < cbPrefix )
continue;
/* check the prefix matches */
if( memcmp(val, pbPrefix, cbPrefix) )
continue;
/* read the value data */
size = sizeof *entry - sizeof entry->abResource[0] + val_sz + data_sz;
entry = HeapAlloc( GetProcessHeap(), 0, sizeof *entry + val_sz + data_sz );
memcpy( entry->abResource, val, val_sz );
entry->cbEntry = size;
entry->cbResource = val_sz;
entry->cbPassword = data_sz;
entry->iEntry = i;
entry->nType = nType;
r = RegEnumValueA( hkey, i, NULL, &val_sz, NULL, &type,
&entry->abResource[val_sz], &data_sz );
if( r == ERROR_SUCCESS )
enumPasswordProc( entry, param );
HeapFree( GetProcessHeap(), 0, entry );
}
RegCloseKey( hkey );
return WN_SUCCESS;
}

View file

@ -0,0 +1,28 @@
/*
* MPR dll version resources
*
* Copyright (C) 2004 Juan Lang
*
* 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 WINE_FILEDESCRIPTION_STR "Wine Multiprotocol Router Library"
#define WINE_FILENAME_STR "mpr.dll"
#define WINE_FILEVERSION 5,0,2195,6611
#define WINE_FILEVERSION_STR "5.00.2195.6611"
#define WINE_PRODUCTVERSION 5,0,2195,6611
#define WINE_PRODUCTVERSION_STR "5.00.2195.6611"
#include "wine/wine_common_ver.rc"

2038
reactos/dll/mpr/wnet.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,27 @@
/*
* WNet private definitions
*
* Copyright (C) 2004 Juan Lang
*
* 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
*/
#ifndef __WNET_PRIV_H__
#define __WNET_PRIV_H__
void wnetInit(HINSTANCE hInstDll);
void wnetFree(void);
#endif /* ndef __WNET_PRIV_H__ */

View file

@ -0,0 +1,29 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = msacm32.dll
IMPORTS = winmm user32 advapi32 kernel32
ALTNAMES = msacm.dll
SPEC_SRCS16 = $(ALTNAMES:.dll=.spec)
C_SRCS = \
driver.c \
filter.c \
format.c \
internal.c \
msacm32_main.c \
pcmconverter.c \
stream.c
C_SRCS16 = \
msacm_main.c
RC_SRCS = msacm.rc
SUBDIRS = tests
@MAKE_DLL_RULES@
### Dependencies:

493
reactos/dll/msacm/driver.c Normal file
View file

@ -0,0 +1,493 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
* 1999 Eric Pouech
*
* 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
*/
#include "config.h"
#include "wine/port.h"
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winreg.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
/***********************************************************************
* acmDriverAddA (MSACM32.@)
*/
MMRESULT WINAPI acmDriverAddA(PHACMDRIVERID phadid, HINSTANCE hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
{
TRACE("(%p, %p, %08lx, %08lx, %08lx)\n",
phadid, hinstModule, lParam, dwPriority, fdwAdd);
if (!phadid) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
/* Check if any unknown flags */
if (fdwAdd &
~(ACM_DRIVERADDF_FUNCTION|ACM_DRIVERADDF_NOTIFYHWND|
ACM_DRIVERADDF_GLOBAL)) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
/* Check if any incompatible flags */
if ((fdwAdd & ACM_DRIVERADDF_FUNCTION) &&
(fdwAdd & ACM_DRIVERADDF_NOTIFYHWND)) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
/* FIXME: in fact, should GetModuleFileName(hinstModule) and do a
* LoadDriver on it, to be sure we can call SendDriverMessage on the
* hDrvr handle.
*/
*phadid = (HACMDRIVERID) MSACM_RegisterDriver(NULL, NULL, hinstModule);
/* FIXME: lParam, dwPriority and fdwAdd ignored */
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmDriverAddW (MSACM32.@)
* FIXME
* Not implemented
*/
MMRESULT WINAPI acmDriverAddW(PHACMDRIVERID phadid, HINSTANCE hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
{
FIXME("(%p, %p, %ld, %ld, %ld): stub\n",
phadid, hinstModule, lParam, dwPriority, fdwAdd);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverClose (MSACM32.@)
*/
MMRESULT WINAPI acmDriverClose(HACMDRIVER had, DWORD fdwClose)
{
PWINE_ACMDRIVER pad;
PWINE_ACMDRIVERID padid;
PWINE_ACMDRIVER* tpad;
TRACE("(%p, %08lx)\n", had, fdwClose);
if (fdwClose) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
pad = MSACM_GetDriver(had);
if (!pad) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
padid = pad->obj.pACMDriverID;
/* remove driver from list */
for (tpad = &(padid->pACMDriverList); *tpad; *tpad = (*tpad)->pNextACMDriver) {
if (*tpad == pad) {
*tpad = (*tpad)->pNextACMDriver;
break;
}
}
/* close driver if it has been opened */
if (pad->hDrvr && !padid->hInstModule)
CloseDriver(pad->hDrvr, 0, 0);
HeapFree(MSACM_hHeap, 0, pad);
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmDriverDetailsA (MSACM32.@)
*/
MMRESULT WINAPI acmDriverDetailsA(HACMDRIVERID hadid, PACMDRIVERDETAILSA padd, DWORD fdwDetails)
{
MMRESULT mmr;
ACMDRIVERDETAILSW addw;
TRACE("(%p, %p, %08lx)\n", hadid, padd, fdwDetails);
if (!padd) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
if (padd->cbStruct < 4) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
addw.cbStruct = sizeof(addw);
mmr = acmDriverDetailsW(hadid, &addw, fdwDetails);
if (mmr == 0) {
ACMDRIVERDETAILSA padda;
padda.fccType = addw.fccType;
padda.fccComp = addw.fccComp;
padda.wMid = addw.wMid;
padda.wPid = addw.wPid;
padda.vdwACM = addw.vdwACM;
padda.vdwDriver = addw.vdwDriver;
padda.fdwSupport = addw.fdwSupport;
padda.cFormatTags = addw.cFormatTags;
padda.cFilterTags = addw.cFilterTags;
padda.hicon = addw.hicon;
WideCharToMultiByte( CP_ACP, 0, addw.szShortName, -1, padda.szShortName,
sizeof(padda.szShortName), NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, addw.szLongName, -1, padda.szLongName,
sizeof(padda.szLongName), NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, addw.szCopyright, -1, padda.szCopyright,
sizeof(padda.szCopyright), NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, addw.szLicensing, -1, padda.szLicensing,
sizeof(padda.szLicensing), NULL, NULL );
WideCharToMultiByte( CP_ACP, 0, addw.szFeatures, -1, padda.szFeatures,
sizeof(padda.szFeatures), NULL, NULL );
memcpy(padd, &padda, min(padd->cbStruct, sizeof(*padd)));
}
return mmr;
}
/***********************************************************************
* acmDriverDetailsW (MSACM32.@)
*/
MMRESULT WINAPI acmDriverDetailsW(HACMDRIVERID hadid, PACMDRIVERDETAILSW padd, DWORD fdwDetails)
{
HACMDRIVER acmDrvr;
MMRESULT mmr;
TRACE("(%p, %p, %08lx)\n", hadid, padd, fdwDetails);
if (!padd) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
if (padd->cbStruct < 4) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
if (fdwDetails) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
mmr = acmDriverOpen(&acmDrvr, hadid, 0);
if (mmr == MMSYSERR_NOERROR) {
ACMDRIVERDETAILSW paddw;
mmr = (MMRESULT)MSACM_Message(acmDrvr, ACMDM_DRIVER_DETAILS, (LPARAM)&paddw, 0);
acmDriverClose(acmDrvr, 0);
memcpy(padd, &paddw, min(padd->cbStruct, sizeof(*padd)));
}
return mmr;
}
/***********************************************************************
* acmDriverEnum (MSACM32.@)
*/
MMRESULT WINAPI acmDriverEnum(ACMDRIVERENUMCB fnCallback, DWORD dwInstance, DWORD fdwEnum)
{
PWINE_ACMDRIVERID padid;
DWORD fdwSupport;
TRACE("(%p, %08lx, %08lx)\n", fnCallback, dwInstance, fdwEnum);
if (!fnCallback) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
if (fdwEnum & ~(ACM_DRIVERENUMF_NOLOCAL|ACM_DRIVERENUMF_DISABLED)) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
fdwSupport = padid->fdwSupport;
if (padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) {
if (fdwEnum & ACM_DRIVERENUMF_DISABLED)
fdwSupport |= ACMDRIVERDETAILS_SUPPORTF_DISABLED;
else
continue;
}
if (!(*fnCallback)((HACMDRIVERID)padid, dwInstance, fdwSupport))
break;
}
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmDriverID (MSACM32.@)
*/
MMRESULT WINAPI acmDriverID(HACMOBJ hao, PHACMDRIVERID phadid, DWORD fdwDriverID)
{
PWINE_ACMOBJ pao;
TRACE("(%p, %p, %08lx)\n", hao, phadid, fdwDriverID);
if (fdwDriverID) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE);
if (!pao) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
if (!phadid) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
*phadid = (HACMDRIVERID) pao->pACMDriverID;
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmDriverMessage (MSACM32.@)
*
*/
LRESULT WINAPI acmDriverMessage(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
{
TRACE("(%p, %04x, %08lx, %08lx\n", had, uMsg, lParam1, lParam2);
if ((uMsg >= ACMDM_USER && uMsg < ACMDM_RESERVED_LOW) ||
uMsg == ACMDM_DRIVER_ABOUT ||
uMsg == DRV_QUERYCONFIGURE ||
uMsg == DRV_CONFIGURE)
return MSACM_Message(had, uMsg, lParam1, lParam2);
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
/***********************************************************************
* acmDriverOpen (MSACM32.@)
*/
MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen)
{
PWINE_ACMDRIVERID padid;
PWINE_ACMDRIVER pad = NULL;
MMRESULT ret;
TRACE("(%p, %p, %08lu)\n", phad, hadid, fdwOpen);
if (!phad) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
if (fdwOpen) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
padid = MSACM_GetDriverID(hadid);
if (!padid) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
pad = HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVER));
if (!pad) {
WARN("no memory\n");
return MMSYSERR_NOMEM;
}
pad->obj.dwType = WINE_ACMOBJ_DRIVER;
pad->obj.pACMDriverID = padid;
if (!(pad->hDrvr = (HDRVR)padid->hInstModule))
{
ACMDRVOPENDESCW adod;
int len;
/* this is not an externally added driver... need to actually load it */
if (!padid->pszDriverAlias)
{
ret = MMSYSERR_ERROR;
goto gotError;
}
adod.cbStruct = sizeof(adod);
adod.fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
adod.fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
adod.dwVersion = acmGetVersion();
adod.dwFlags = fdwOpen;
adod.dwError = 0;
len = strlen("Drivers32") + 1;
adod.pszSectionName = HeapAlloc(MSACM_hHeap, 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, "Drivers32", -1, (LPWSTR)adod.pszSectionName, len);
adod.pszAliasName = padid->pszDriverAlias;
adod.dnDevNode = 0;
pad->hDrvr = OpenDriver(padid->pszDriverAlias, NULL, (DWORD)&adod);
HeapFree(MSACM_hHeap, 0, (LPWSTR)adod.pszSectionName);
if (!pad->hDrvr)
{
ret = adod.dwError;
goto gotError;
}
}
/* insert new pad at beg of list */
pad->pNextACMDriver = padid->pACMDriverList;
padid->pACMDriverList = pad;
/* FIXME: Create a WINE_ACMDRIVER32 */
*phad = (HACMDRIVER)pad;
TRACE("'%s' => %08lx\n", debugstr_w(padid->pszDriverAlias), (DWORD)pad);
return MMSYSERR_NOERROR;
gotError:
WARN("failed: ret = %08x\n", ret);
if (pad && !pad->hDrvr)
HeapFree(MSACM_hHeap, 0, pad);
return ret;
}
/***********************************************************************
* acmDriverPriority (MSACM32.@)
*/
MMRESULT WINAPI acmDriverPriority(HACMDRIVERID hadid, DWORD dwPriority, DWORD fdwPriority)
{
PWINE_ACMDRIVERID padid;
CHAR szSubKey[17];
CHAR szBuffer[256];
LONG lBufferLength = sizeof(szBuffer);
LONG lError;
HKEY hPriorityKey;
DWORD dwPriorityCounter;
TRACE("(%p, %08lx, %08lx)\n", hadid, dwPriority, fdwPriority);
padid = MSACM_GetDriverID(hadid);
if (!padid) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
/* Check for unknown flags */
if (fdwPriority &
~(ACM_DRIVERPRIORITYF_ENABLE|ACM_DRIVERPRIORITYF_DISABLE|
ACM_DRIVERPRIORITYF_BEGIN|ACM_DRIVERPRIORITYF_END)) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
/* Check for incompatible flags */
if ((fdwPriority & ACM_DRIVERPRIORITYF_ENABLE) &&
(fdwPriority & ACM_DRIVERPRIORITYF_DISABLE)) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
/* Check for incompatible flags */
if ((fdwPriority & ACM_DRIVERPRIORITYF_BEGIN) &&
(fdwPriority & ACM_DRIVERPRIORITYF_END)) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
lError = RegOpenKeyA(HKEY_CURRENT_USER,
"Software\\Microsoft\\Multimedia\\"
"Audio Compression Manager\\Priority v4.00",
&hPriorityKey
);
/* FIXME: Create key */
if (lError != ERROR_SUCCESS) {
WARN("RegOpenKeyA failed\n");
return MMSYSERR_ERROR;
}
for (dwPriorityCounter = 1; ; dwPriorityCounter++) {
snprintf(szSubKey, 17, "Priority%ld", dwPriorityCounter);
lError = RegQueryValueA(hPriorityKey, szSubKey, szBuffer, &lBufferLength);
if (lError != ERROR_SUCCESS)
break;
FIXME("(%p, %ld, %ld): stub (partial)\n",
hadid, dwPriority, fdwPriority);
break;
}
RegCloseKey(hPriorityKey);
WARN("RegQueryValueA failed\n");
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverRemove (MSACM32.@)
*/
MMRESULT WINAPI acmDriverRemove(HACMDRIVERID hadid, DWORD fdwRemove)
{
PWINE_ACMDRIVERID padid;
TRACE("(%p, %08lx)\n", hadid, fdwRemove);
padid = MSACM_GetDriverID(hadid);
if (!padid) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
if (fdwRemove) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
MSACM_UnregisterDriver(padid);
return MMSYSERR_NOERROR;
}

454
reactos/dll/msacm/filter.c Normal file
View file

@ -0,0 +1,454 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
*
* 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
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winerror.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
/***********************************************************************
* acmFilterChooseA (MSACM32.@)
*/
MMRESULT WINAPI acmFilterChooseA(PACMFILTERCHOOSEA pafltrc)
{
FIXME("(%p): stub\n", pafltrc);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFilterChooseW (MSACM32.@)
*/
MMRESULT WINAPI acmFilterChooseW(PACMFILTERCHOOSEW pafltrc)
{
FIXME("(%p): stub\n", pafltrc);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFilterDetailsA (MSACM32.@)
*/
MMRESULT WINAPI acmFilterDetailsA(HACMDRIVER had, PACMFILTERDETAILSA pafd,
DWORD fdwDetails)
{
ACMFILTERDETAILSW afdw;
MMRESULT mmr;
memset(&afdw, 0, sizeof(afdw));
afdw.cbStruct = sizeof(afdw);
afdw.dwFilterIndex = pafd->dwFilterIndex;
afdw.dwFilterTag = pafd->dwFilterTag;
afdw.pwfltr = pafd->pwfltr;
afdw.cbwfltr = pafd->cbwfltr;
mmr = acmFilterDetailsW(had, &afdw, fdwDetails);
if (mmr == MMSYSERR_NOERROR) {
pafd->dwFilterTag = afdw.dwFilterTag;
pafd->fdwSupport = afdw.fdwSupport;
WideCharToMultiByte( CP_ACP, 0, afdw.szFilter, -1, pafd->szFilter,
sizeof(pafd->szFilter), NULL, NULL );
}
return mmr;
}
/***********************************************************************
* acmFilterDetailsW (MSACM32.@)
*/
MMRESULT WINAPI acmFilterDetailsW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
DWORD fdwDetails)
{
MMRESULT mmr;
ACMFILTERTAGDETAILSA aftd;
TRACE("(%p, %p, %ld)\n", had, pafd, fdwDetails);
memset(&aftd, 0, sizeof(aftd));
aftd.cbStruct = sizeof(aftd);
if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM;
switch (fdwDetails) {
case ACM_FILTERDETAILSF_FILTER:
if (pafd->dwFilterTag != pafd->pwfltr->dwFilterTag) {
mmr = MMSYSERR_INVALPARAM;
break;
}
if (had == NULL) {
PWINE_ACMDRIVERID padid;
mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS,
(LPARAM)pafd, (LPARAM)fdwDetails);
acmDriverClose(had, 0);
if (mmr == MMSYSERR_NOERROR) break;
}
}
} else {
mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS, (LPARAM)pafd, fdwDetails);
}
break;
case ACM_FILTERDETAILSF_INDEX:
/* should check pafd->dwFilterIndex < aftd->cStandardFilters */
mmr = MSACM_Message(had, ACMDM_FILTER_DETAILS, (LPARAM)pafd, fdwDetails);
break;
default:
WARN("Unknown fdwDetails %08lx\n", fdwDetails);
mmr = MMSYSERR_INVALFLAG;
break;
}
TRACE("=> %d\n", mmr);
return mmr;
}
struct MSACM_FilterEnumWtoA_Instance {
PACMFILTERDETAILSA pafda;
DWORD dwInstance;
ACMFILTERENUMCBA fnCallback;
};
static BOOL CALLBACK MSACM_FilterEnumCallbackWtoA(HACMDRIVERID hadid,
PACMFILTERDETAILSW pafdw,
DWORD dwInstance,
DWORD fdwSupport)
{
struct MSACM_FilterEnumWtoA_Instance* pafei;
pafei = (struct MSACM_FilterEnumWtoA_Instance*)dwInstance;
pafei->pafda->dwFilterIndex = pafdw->dwFilterIndex;
pafei->pafda->dwFilterTag = pafdw->dwFilterTag;
pafei->pafda->fdwSupport = pafdw->fdwSupport;
WideCharToMultiByte( CP_ACP, 0, pafdw->szFilter, -1, pafei->pafda->szFilter,
sizeof(pafei->pafda->szFilter), NULL, NULL );
return (pafei->fnCallback)(hadid, pafei->pafda,
pafei->dwInstance, fdwSupport);
}
/***********************************************************************
* acmFilterEnumA (MSACM32.@)
*/
MMRESULT WINAPI acmFilterEnumA(HACMDRIVER had, PACMFILTERDETAILSA pafda,
ACMFILTERENUMCBA fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
ACMFILTERDETAILSW afdw;
struct MSACM_FilterEnumWtoA_Instance afei;
memset(&afdw, 0, sizeof(afdw));
afdw.cbStruct = sizeof(afdw);
afdw.dwFilterIndex = pafda->dwFilterIndex;
afdw.dwFilterTag = pafda->dwFilterTag;
afdw.pwfltr = pafda->pwfltr;
afdw.cbwfltr = pafda->cbwfltr;
afei.pafda = pafda;
afei.dwInstance = dwInstance;
afei.fnCallback = fnCallback;
return acmFilterEnumW(had, &afdw, MSACM_FilterEnumCallbackWtoA,
(DWORD)&afei, fdwEnum);
}
static BOOL MSACM_FilterEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had,
PACMFILTERDETAILSW pafd,
ACMFILTERENUMCBW fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
ACMFILTERTAGDETAILSW aftd;
int i, j;
for (i = 0; i < padid->cFilterTags; i++) {
memset(&aftd, 0, sizeof(aftd));
aftd.cbStruct = sizeof(aftd);
aftd.dwFilterTagIndex = i;
if (acmFilterTagDetailsW(had, &aftd, ACM_FILTERTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)
continue;
if ((fdwEnum & ACM_FILTERENUMF_DWFILTERTAG) &&
aftd.dwFilterTag != pafd->pwfltr->dwFilterTag)
continue;
for (j = 0; j < aftd.cStandardFilters; j++) {
pafd->dwFilterIndex = j;
pafd->dwFilterTag = aftd.dwFilterTag;
if (acmFilterDetailsW(had, pafd, ACM_FILTERDETAILSF_INDEX) != MMSYSERR_NOERROR)
continue;
if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
return FALSE;
}
}
return TRUE;
}
/***********************************************************************
* acmFilterEnumW (MSACM32.@)
*/
MMRESULT WINAPI acmFilterEnumW(HACMDRIVER had, PACMFILTERDETAILSW pafd,
ACMFILTERENUMCBW fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
PWINE_ACMDRIVERID padid;
BOOL ret;
TRACE("(%p, %p, %p, %ld, %ld)\n",
had, pafd, fnCallback, dwInstance, fdwEnum);
if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM;
if (fdwEnum & ~(ACM_FILTERENUMF_DWFILTERTAG))
FIXME("Unsupported fdwEnum values\n");
if (had) {
HACMDRIVERID hadid;
if (acmDriverID((HACMOBJ)had, &hadid, 0) != MMSYSERR_NOERROR)
return MMSYSERR_INVALHANDLE;
MSACM_FilterEnumHelper(MSACM_GetDriverID(hadid), had, pafd,
fnCallback, dwInstance, fdwEnum);
return MMSYSERR_NOERROR;
}
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
continue;
ret = MSACM_FilterEnumHelper(padid, had, pafd,
fnCallback, dwInstance, fdwEnum);
acmDriverClose(had, 0);
if (!ret) break;
}
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmFilterTagDetailsA (MSACM32.@)
*/
MMRESULT WINAPI acmFilterTagDetailsA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda,
DWORD fdwDetails)
{
ACMFILTERTAGDETAILSW aftdw;
MMRESULT mmr;
memset(&aftdw, 0, sizeof(aftdw));
aftdw.cbStruct = sizeof(aftdw);
aftdw.dwFilterTagIndex = paftda->dwFilterTagIndex;
aftdw.dwFilterTag = paftda->dwFilterTag;
mmr = acmFilterTagDetailsW(had, &aftdw, fdwDetails);
if (mmr == MMSYSERR_NOERROR) {
paftda->dwFilterTag = aftdw.dwFilterTag;
paftda->dwFilterTagIndex = aftdw.dwFilterTagIndex;
paftda->cbFilterSize = aftdw.cbFilterSize;
paftda->fdwSupport = aftdw.fdwSupport;
paftda->cStandardFilters = aftdw.cStandardFilters;
WideCharToMultiByte( CP_ACP, 0, aftdw.szFilterTag, -1, paftda->szFilterTag,
sizeof(paftda->szFilterTag), NULL, NULL );
}
return mmr;
}
/***********************************************************************
* acmFilterTagDetailsW (MSACM32.@)
*/
MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd,
DWORD fdwDetails)
{
PWINE_ACMDRIVERID padid;
MMRESULT mmr;
TRACE("(%p, %p, %ld)\n", had, paftd, fdwDetails);
if (fdwDetails & ~(ACM_FILTERTAGDETAILSF_FILTERTAG|ACM_FILTERTAGDETAILSF_INDEX|
ACM_FILTERTAGDETAILSF_LARGESTSIZE))
return MMSYSERR_INVALFLAG;
switch (fdwDetails) {
case ACM_FILTERTAGDETAILSF_FILTERTAG:
if (had == NULL) {
mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails);
acmDriverClose(had, 0);
if (mmr == MMSYSERR_NOERROR) break;
}
}
} else {
mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails);
}
break;
case ACM_FILTERTAGDETAILSF_INDEX:
/* FIXME should check paftd->dwFilterTagIndex < add.cFilterTags */
mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails);
break;
case ACM_FILTERTAGDETAILSF_LARGESTSIZE:
if (had == NULL) {
ACMFILTERTAGDETAILSW tmp;
DWORD ft = paftd->dwFilterTag;
mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
memset(&tmp, 0, sizeof(tmp));
tmp.cbStruct = sizeof(tmp);
tmp.dwFilterTag = ft;
if (MSACM_Message(had, ACMDM_FILTERTAG_DETAILS,
(LPARAM)&tmp, fdwDetails) == MMSYSERR_NOERROR) {
if (mmr == ACMERR_NOTPOSSIBLE ||
paftd->cbFilterSize < tmp.cbFilterSize) {
*paftd = tmp;
mmr = MMSYSERR_NOERROR;
}
}
acmDriverClose(had, 0);
}
}
} else {
mmr = MSACM_Message(had, ACMDM_FILTERTAG_DETAILS, (LPARAM)paftd, fdwDetails);
}
break;
default:
WARN("Unsupported fdwDetails=%08lx\n", fdwDetails);
mmr = MMSYSERR_ERROR;
}
if (mmr == MMSYSERR_NOERROR &&
paftd->dwFilterTag == WAVE_FORMAT_PCM && paftd->szFilterTag[0] == 0)
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFilterTag,
sizeof(paftd->szFilterTag)/sizeof(WCHAR) );
return mmr;
}
struct MSACM_FilterTagEnumWtoA_Instance {
PACMFILTERTAGDETAILSA paftda;
DWORD dwInstance;
ACMFILTERTAGENUMCBA fnCallback;
};
static BOOL CALLBACK MSACM_FilterTagEnumCallbackWtoA(HACMDRIVERID hadid,
PACMFILTERTAGDETAILSW paftdw,
DWORD dwInstance,
DWORD fdwSupport)
{
struct MSACM_FilterTagEnumWtoA_Instance* paftei;
paftei = (struct MSACM_FilterTagEnumWtoA_Instance*)dwInstance;
paftei->paftda->dwFilterTagIndex = paftdw->dwFilterTagIndex;
paftei->paftda->dwFilterTag = paftdw->dwFilterTag;
paftei->paftda->cbFilterSize = paftdw->cbFilterSize;
paftei->paftda->fdwSupport = paftdw->fdwSupport;
paftei->paftda->cStandardFilters = paftdw->cStandardFilters;
WideCharToMultiByte( CP_ACP, 0, paftdw->szFilterTag, -1, paftei->paftda->szFilterTag,
sizeof(paftei->paftda->szFilterTag), NULL, NULL );
return (paftei->fnCallback)(hadid, paftei->paftda,
paftei->dwInstance, fdwSupport);
}
/***********************************************************************
* acmFilterTagEnumA (MSACM32.@)
*/
MMRESULT WINAPI acmFilterTagEnumA(HACMDRIVER had, PACMFILTERTAGDETAILSA paftda,
ACMFILTERTAGENUMCBA fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
ACMFILTERTAGDETAILSW aftdw;
struct MSACM_FilterTagEnumWtoA_Instance aftei;
memset(&aftdw, 0, sizeof(aftdw));
aftdw.cbStruct = sizeof(aftdw);
aftdw.dwFilterTagIndex = paftda->dwFilterTagIndex;
aftdw.dwFilterTag = paftda->dwFilterTag;
aftei.paftda = paftda;
aftei.dwInstance = dwInstance;
aftei.fnCallback = fnCallback;
return acmFilterTagEnumW(had, &aftdw, MSACM_FilterTagEnumCallbackWtoA,
(DWORD)&aftei, fdwEnum);
}
/***********************************************************************
* acmFilterTagEnumW (MSACM32.@)
*/
MMRESULT WINAPI acmFilterTagEnumW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd,
ACMFILTERTAGENUMCBW fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
PWINE_ACMDRIVERID padid;
int i;
TRACE("(%p, %p, %p, %ld, %ld)\n",
had, paftd, fnCallback, dwInstance, fdwEnum);
if (paftd->cbStruct < sizeof(*paftd)) return MMSYSERR_INVALPARAM;
if (had) FIXME("had != NULL, not supported\n");
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {
for (i = 0; i < padid->cFilterTags; i++) {
paftd->dwFilterTagIndex = i;
if (acmFilterTagDetailsW(had, paftd, ACM_FILTERTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) {
padid = NULL;
break;
}
}
}
}
acmDriverClose(had, 0);
}
return MMSYSERR_NOERROR;
}

858
reactos/dll/msacm/format.c Normal file
View file

@ -0,0 +1,858 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
* 2000 Eric Pouech
*
* 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
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
static PACMFORMATCHOOSEA afc;
struct MSACM_FillFormatData {
HWND hWnd;
#define WINE_ACMFF_TAG 0
#define WINE_ACMFF_FORMAT 1
#define WINE_ACMFF_WFX 2
int mode;
char szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
PACMFORMATCHOOSEA afc;
DWORD ret;
};
static BOOL CALLBACK MSACM_FillFormatTagsCB(HACMDRIVERID hadid,
PACMFORMATTAGDETAILSA paftd,
DWORD dwInstance, DWORD fdwSupport)
{
struct MSACM_FillFormatData* affd = (struct MSACM_FillFormatData*)dwInstance;
switch (affd->mode) {
case WINE_ACMFF_TAG:
if (SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
CB_FINDSTRINGEXACT,
(WPARAM)-1, (LPARAM)paftd->szFormatTag) == CB_ERR)
SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
CB_ADDSTRING, 0, (DWORD)paftd->szFormatTag);
break;
case WINE_ACMFF_FORMAT:
if (strcmp(affd->szFormatTag, paftd->szFormatTag) == 0) {
HACMDRIVER had;
if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {
ACMFORMATDETAILSA afd;
int i, idx;
MMRESULT mmr;
char buffer[ACMFORMATDETAILS_FORMAT_CHARS+16];
afd.cbStruct = sizeof(afd);
afd.dwFormatTag = paftd->dwFormatTag;
afd.pwfx = HeapAlloc(MSACM_hHeap, 0, paftd->cbFormatSize);
if (!afd.pwfx) return FALSE;
afd.pwfx->wFormatTag = paftd->dwFormatTag;
afd.pwfx->cbSize = paftd->cbFormatSize;
afd.cbwfx = paftd->cbFormatSize;
for (i = 0; i < paftd->cStandardFormats; i++) {
afd.dwFormatIndex = i;
mmr = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX);
if (mmr == MMSYSERR_NOERROR) {
strncpy(buffer, afd.szFormat, ACMFORMATTAGDETAILS_FORMATTAG_CHARS);
for (idx = strlen(buffer);
idx < ACMFORMATTAGDETAILS_FORMATTAG_CHARS; idx++)
buffer[idx] = ' ';
wsprintfA(buffer + ACMFORMATTAGDETAILS_FORMATTAG_CHARS,
"%d Ko/s",
(afd.pwfx->nAvgBytesPerSec + 512) / 1024);
SendDlgItemMessageA(affd->hWnd,
IDD_ACMFORMATCHOOSE_CMB_FORMAT,
CB_ADDSTRING, 0, (DWORD)buffer);
}
}
acmDriverClose(had, 0);
SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT,
CB_SETCURSEL, 0, 0);
HeapFree(MSACM_hHeap, 0, afd.pwfx);
}
}
break;
case WINE_ACMFF_WFX:
if (strcmp(affd->szFormatTag, paftd->szFormatTag) == 0) {
HACMDRIVER had;
if (acmDriverOpen(&had, hadid, 0) == MMSYSERR_NOERROR) {
ACMFORMATDETAILSA afd;
afd.cbStruct = sizeof(afd);
afd.dwFormatTag = paftd->dwFormatTag;
afd.pwfx = affd->afc->pwfx;
afd.cbwfx = affd->afc->cbwfx;
afd.dwFormatIndex = SendDlgItemMessageA(affd->hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT,
CB_GETCURSEL, 0, 0);
affd->ret = acmFormatDetailsA(had, &afd, ACM_FORMATDETAILSF_INDEX);
acmDriverClose(had, 0);
return TRUE;
}
}
break;
default:
FIXME("Unknown mode (%d)\n", affd->mode);
break;
}
return TRUE;
}
static BOOL MSACM_FillFormatTags(HWND hWnd)
{
ACMFORMATTAGDETAILSA aftd;
struct MSACM_FillFormatData affd;
memset(&aftd, 0, sizeof(aftd));
aftd.cbStruct = sizeof(aftd);
affd.hWnd = hWnd;
affd.mode = WINE_ACMFF_TAG;
acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, CB_SETCURSEL, 0, 0);
return TRUE;
}
static BOOL MSACM_FillFormat(HWND hWnd)
{
ACMFORMATTAGDETAILSA aftd;
struct MSACM_FillFormatData affd;
SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_RESETCONTENT, 0, 0);
memset(&aftd, 0, sizeof(aftd));
aftd.cbStruct = sizeof(aftd);
affd.hWnd = hWnd;
affd.mode = WINE_ACMFF_FORMAT;
SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
CB_GETLBTEXT,
SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
CB_GETCURSEL, 0, 0),
(DWORD)affd.szFormatTag);
acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_SETCURSEL, 0, 0);
return TRUE;
}
static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEA afc)
{
ACMFORMATTAGDETAILSA aftd;
struct MSACM_FillFormatData affd;
memset(&aftd, 0, sizeof(aftd));
aftd.cbStruct = sizeof(aftd);
affd.hWnd = hWnd;
affd.mode = WINE_ACMFF_WFX;
affd.afc = afc;
affd.ret = MMSYSERR_NOERROR;
SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
CB_GETLBTEXT,
SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
CB_GETCURSEL, 0, 0),
(DWORD)affd.szFormatTag);
acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
return affd.ret;
}
static INT_PTR CALLBACK FormatChooseDlgProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam)
{
TRACE("hwnd=%p msg=%i 0x%08x 0x%08lx\n", hWnd, msg, wParam, lParam );
switch (msg) {
case WM_INITDIALOG:
afc = (PACMFORMATCHOOSEA)lParam;
MSACM_FillFormatTags(hWnd);
MSACM_FillFormat(hWnd);
if ((afc->fdwStyle & ~(ACMFORMATCHOOSE_STYLEF_CONTEXTHELP|
ACMFORMATCHOOSE_STYLEF_SHOWHELP)) != 0)
FIXME("Unsupported style %08lx\n", ((PACMFORMATCHOOSEA)lParam)->fdwStyle);
if (!(afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP))
ShowWindow(GetDlgItem(hWnd, IDD_ACMFORMATCHOOSE_BTN_HELP), SW_HIDE);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
EndDialog(hWnd, MSACM_GetWFX(hWnd, afc));
return TRUE;
case IDCANCEL:
EndDialog(hWnd, ACMERR_CANCELED);
return TRUE;
case IDD_ACMFORMATCHOOSE_CMB_FORMATTAG:
switch (HIWORD(wParam)) {
case CBN_SELCHANGE:
MSACM_FillFormat(hWnd);
break;
default:
TRACE("Dropped dlgNotif (fmtTag): 0x%08x 0x%08lx\n",
HIWORD(wParam), lParam);
break;
}
break;
case IDD_ACMFORMATCHOOSE_BTN_HELP:
if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_SHOWHELP)
SendMessageA(afc->hwndOwner,
RegisterWindowMessageA(ACMHELPMSGSTRINGA), 0L, 0L);
break;
default:
TRACE("Dropped dlgCmd: ctl=%d ntf=0x%04x 0x%08lx\n",
LOWORD(wParam), HIWORD(wParam), lParam);
break;
}
break;
case WM_CONTEXTMENU:
if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP)
SendMessageA(afc->hwndOwner,
RegisterWindowMessageA(ACMHELPMSGCONTEXTMENUA),
wParam, lParam);
break;
#if defined(WM_CONTEXTHELP)
case WM_CONTEXTHELP:
if (afc->fdwStyle & ACMFORMATCHOOSE_STYLEF_CONTEXTHELP)
SendMessageA(afc->hwndOwner,
RegisterWindowMessageA(ACMHELPMSGCONTEXTHELPA),
wParam, lParam);
break;
#endif
default:
TRACE("Dropped dlgMsg: hwnd=%p msg=%i 0x%08x 0x%08lx\n",
hWnd, msg, wParam, lParam );
break;
}
return FALSE;
}
/***********************************************************************
* acmFormatChooseA (MSACM32.@)
*/
MMRESULT WINAPI acmFormatChooseA(PACMFORMATCHOOSEA pafmtc)
{
return DialogBoxParamA(MSACM_hInstance32, MAKEINTRESOURCEA(DLG_ACMFORMATCHOOSE_ID),
pafmtc->hwndOwner, FormatChooseDlgProc, (INT)pafmtc);
}
/***********************************************************************
* acmFormatChooseW (MSACM32.@)
*/
MMRESULT WINAPI acmFormatChooseW(PACMFORMATCHOOSEW pafmtc)
{
FIXME("(%p): stub\n", pafmtc);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFormatDetailsA (MSACM32.@)
*/
MMRESULT WINAPI acmFormatDetailsA(HACMDRIVER had, PACMFORMATDETAILSA pafd,
DWORD fdwDetails)
{
ACMFORMATDETAILSW afdw;
MMRESULT mmr;
memset(&afdw, 0, sizeof(afdw));
afdw.cbStruct = sizeof(afdw);
afdw.dwFormatIndex = pafd->dwFormatIndex;
afdw.dwFormatTag = pafd->dwFormatTag;
afdw.pwfx = pafd->pwfx;
afdw.cbwfx = pafd->cbwfx;
mmr = acmFormatDetailsW(had, &afdw, fdwDetails);
if (mmr == MMSYSERR_NOERROR) {
pafd->dwFormatTag = afdw.dwFormatTag;
pafd->fdwSupport = afdw.fdwSupport;
WideCharToMultiByte( CP_ACP, 0, afdw.szFormat, -1,
pafd->szFormat, sizeof(pafd->szFormat), NULL, NULL );
}
return mmr;
}
/***********************************************************************
* acmFormatDetailsW (MSACM32.@)
*/
MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails)
{
MMRESULT mmr;
static const WCHAR fmt1[] = {'%','d',' ','H','z',0};
static const WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0};
ACMFORMATTAGDETAILSA aftd;
TRACE("(%p, %p, %ld)\n", had, pafd, fdwDetails);
memset(&aftd, 0, sizeof(aftd));
aftd.cbStruct = sizeof(aftd);
if (pafd->cbStruct < sizeof(*pafd)) return MMSYSERR_INVALPARAM;
switch (fdwDetails) {
case ACM_FORMATDETAILSF_FORMAT:
if (pafd->dwFormatTag != pafd->pwfx->wFormatTag) {
mmr = MMSYSERR_INVALPARAM;
break;
}
if (had == NULL) {
PWINE_ACMDRIVERID padid;
mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
acmDriverClose(had, 0);
if (mmr == MMSYSERR_NOERROR) break;
}
}
} else {
mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
}
break;
case ACM_FORMATDETAILSF_INDEX:
/* should check pafd->dwFormatIndex < aftd->cStandardFormats */
mmr = MSACM_Message(had, ACMDM_FORMAT_DETAILS, (LPARAM)pafd, fdwDetails);
break;
default:
WARN("Unknown fdwDetails %08lx\n", fdwDetails);
mmr = MMSYSERR_INVALFLAG;
break;
}
if (mmr == MMSYSERR_NOERROR && pafd->szFormat[0] == (WCHAR)0) {
wsprintfW(pafd->szFormat, fmt1, pafd->pwfx->nSamplesPerSec);
if (pafd->pwfx->wBitsPerSample) {
wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2,
pafd->pwfx->wBitsPerSample);
}
MultiByteToWideChar( CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,
pafd->szFormat + strlenW(pafd->szFormat),
sizeof(pafd->szFormat)/sizeof(WCHAR) - strlenW(pafd->szFormat) );
}
TRACE("=> %d\n", mmr);
return mmr;
}
struct MSACM_FormatEnumWtoA_Instance {
PACMFORMATDETAILSA pafda;
DWORD dwInstance;
ACMFORMATENUMCBA fnCallback;
};
static BOOL CALLBACK MSACM_FormatEnumCallbackWtoA(HACMDRIVERID hadid,
PACMFORMATDETAILSW pafdw,
DWORD dwInstance,
DWORD fdwSupport)
{
struct MSACM_FormatEnumWtoA_Instance* pafei;
pafei = (struct MSACM_FormatEnumWtoA_Instance*)dwInstance;
pafei->pafda->dwFormatIndex = pafdw->dwFormatIndex;
pafei->pafda->dwFormatTag = pafdw->dwFormatTag;
pafei->pafda->fdwSupport = pafdw->fdwSupport;
WideCharToMultiByte( CP_ACP, 0, pafdw->szFormat, -1,
pafei->pafda->szFormat, sizeof(pafei->pafda->szFormat), NULL, NULL );
return (pafei->fnCallback)(hadid, pafei->pafda,
pafei->dwInstance, fdwSupport);
}
/***********************************************************************
* acmFormatEnumA (MSACM32.@)
*/
MMRESULT WINAPI acmFormatEnumA(HACMDRIVER had, PACMFORMATDETAILSA pafda,
ACMFORMATENUMCBA fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
ACMFORMATDETAILSW afdw;
struct MSACM_FormatEnumWtoA_Instance afei;
if (!pafda)
return MMSYSERR_INVALPARAM;
if (pafda->cbStruct < sizeof(*pafda))
return MMSYSERR_INVALPARAM;
memset(&afdw, 0, sizeof(afdw));
afdw.cbStruct = sizeof(afdw);
afdw.dwFormatIndex = pafda->dwFormatIndex;
afdw.dwFormatTag = pafda->dwFormatTag;
afdw.pwfx = pafda->pwfx;
afdw.cbwfx = pafda->cbwfx;
afei.pafda = pafda;
afei.dwInstance = dwInstance;
afei.fnCallback = fnCallback;
return acmFormatEnumW(had, &afdw, MSACM_FormatEnumCallbackWtoA,
(DWORD)&afei, fdwEnum);
}
/***********************************************************************
* acmFormatEnumW (MSACM32.@)
*/
static BOOL MSACM_FormatEnumHelper(PWINE_ACMDRIVERID padid, HACMDRIVER had,
PACMFORMATDETAILSW pafd, PWAVEFORMATEX pwfxRef,
ACMFORMATENUMCBW fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
ACMFORMATTAGDETAILSW aftd;
int i, j;
for (i = 0; i < padid->cFormatTags; i++) {
memset(&aftd, 0, sizeof(aftd));
aftd.cbStruct = sizeof(aftd);
aftd.dwFormatTagIndex = i;
if (acmFormatTagDetailsW(had, &aftd, ACM_FORMATTAGDETAILSF_INDEX) != MMSYSERR_NOERROR)
continue;
if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) && aftd.dwFormatTag != pwfxRef->wFormatTag)
continue;
for (j = 0; j < aftd.cStandardFormats; j++) {
pafd->dwFormatIndex = j;
pafd->dwFormatTag = aftd.dwFormatTag;
if (acmFormatDetailsW(had, pafd, ACM_FORMATDETAILSF_INDEX) != MMSYSERR_NOERROR)
continue;
if ((fdwEnum & ACM_FORMATENUMF_NCHANNELS) &&
pafd->pwfx->nChannels != pwfxRef->nChannels)
continue;
if ((fdwEnum & ACM_FORMATENUMF_NSAMPLESPERSEC) &&
pafd->pwfx->nSamplesPerSec != pwfxRef->nSamplesPerSec)
continue;
if ((fdwEnum & ACM_FORMATENUMF_WBITSPERSAMPLE) &&
pafd->pwfx->wBitsPerSample != pwfxRef->wBitsPerSample)
continue;
if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
!(pafd->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_HARDWARE))
continue;
/* more checks to be done on fdwEnum */
if (!(fnCallback)((HACMDRIVERID)padid, pafd, dwInstance, padid->fdwSupport))
return FALSE;
}
/* the "formats" used by the filters are also reported */
}
return TRUE;
}
/**********************************************************************/
MMRESULT WINAPI acmFormatEnumW(HACMDRIVER had, PACMFORMATDETAILSW pafd,
ACMFORMATENUMCBW fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
PWINE_ACMDRIVERID padid;
WAVEFORMATEX wfxRef;
BOOL ret;
TRACE("(%p, %p, %p, %ld, %ld)\n",
had, pafd, fnCallback, dwInstance, fdwEnum);
if (!pafd)
return MMSYSERR_INVALPARAM;
if (pafd->cbStruct < sizeof(*pafd))
return MMSYSERR_INVALPARAM;
if (fdwEnum & (ACM_FORMATENUMF_WFORMATTAG|ACM_FORMATENUMF_NCHANNELS|
ACM_FORMATENUMF_NSAMPLESPERSEC|ACM_FORMATENUMF_WBITSPERSAMPLE|
ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST))
wfxRef = *pafd->pwfx;
if ((fdwEnum & ACM_FORMATENUMF_HARDWARE) &&
!(fdwEnum & (ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT)))
return MMSYSERR_INVALPARAM;
if ((fdwEnum & ACM_FORMATENUMF_WFORMATTAG) &&
(pafd->dwFormatTag != pafd->pwfx->wFormatTag))
return MMSYSERR_INVALPARAM;
if (fdwEnum & (ACM_FORMATENUMF_CONVERT|ACM_FORMATENUMF_SUGGEST|
ACM_FORMATENUMF_INPUT|ACM_FORMATENUMF_OUTPUT))
FIXME("Unsupported fdwEnum values %08lx\n", fdwEnum);
if (had) {
HACMDRIVERID hadid;
if (acmDriverID((HACMOBJ)had, &hadid, 0) != MMSYSERR_NOERROR)
return MMSYSERR_INVALHANDLE;
MSACM_FormatEnumHelper(MSACM_GetDriverID(hadid), had, pafd, &wfxRef,
fnCallback, dwInstance, fdwEnum);
return MMSYSERR_NOERROR;
}
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
continue;
ret = MSACM_FormatEnumHelper(padid, had, pafd, &wfxRef,
fnCallback, dwInstance, fdwEnum);
acmDriverClose(had, 0);
if (!ret) break;
}
return MMSYSERR_NOERROR;
}
/***********************************************************************
* acmFormatSuggest (MSACM32.@)
*/
MMRESULT WINAPI acmFormatSuggest(HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
PWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest)
{
ACMDRVFORMATSUGGEST adfg;
MMRESULT mmr;
TRACE("(%p, %p, %p, %ld, %ld)\n",
had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest);
if (fdwSuggest & ~(ACM_FORMATSUGGESTF_NCHANNELS|ACM_FORMATSUGGESTF_NSAMPLESPERSEC|
ACM_FORMATSUGGESTF_WBITSPERSAMPLE|ACM_FORMATSUGGESTF_WFORMATTAG))
return MMSYSERR_INVALFLAG;
adfg.cbStruct = sizeof(adfg);
adfg.fdwSuggest = fdwSuggest;
adfg.pwfxSrc = pwfxSrc;
adfg.cbwfxSrc = (pwfxSrc->wFormatTag == WAVE_FORMAT_PCM) ?
sizeof(WAVEFORMATEX) : (sizeof(WAVEFORMATEX) + pwfxSrc->cbSize);
adfg.pwfxDst = pwfxDst;
adfg.cbwfxDst = cbwfxDst;
if (had == NULL) {
PWINE_ACMDRIVERID padid;
/* MS doc says: ACM finds the best suggestion.
* Well, first found will be the "best"
*/
mmr = ACMERR_NOTPOSSIBLE;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != MMSYSERR_NOERROR)
continue;
if (MSACM_Message(had, ACMDM_FORMAT_SUGGEST, (LPARAM)&adfg, 0L) == MMSYSERR_NOERROR) {
mmr = MMSYSERR_NOERROR;
break;
}
acmDriverClose(had, 0);
}
} else {
mmr = MSACM_Message(had, ACMDM_FORMAT_SUGGEST, (LPARAM)&adfg, 0L);
}
return mmr;
}
/***********************************************************************
* acmFormatTagDetailsA (MSACM32.@)
*/
MMRESULT WINAPI acmFormatTagDetailsA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda,
DWORD fdwDetails)
{
ACMFORMATTAGDETAILSW aftdw;
MMRESULT mmr;
memset(&aftdw, 0, sizeof(aftdw));
aftdw.cbStruct = sizeof(aftdw);
aftdw.dwFormatTagIndex = paftda->dwFormatTagIndex;
aftdw.dwFormatTag = paftda->dwFormatTag;
mmr = acmFormatTagDetailsW(had, &aftdw, fdwDetails);
if (mmr == MMSYSERR_NOERROR) {
paftda->dwFormatTag = aftdw.dwFormatTag;
paftda->dwFormatTagIndex = aftdw.dwFormatTagIndex;
paftda->cbFormatSize = aftdw.cbFormatSize;
paftda->fdwSupport = aftdw.fdwSupport;
paftda->cStandardFormats = aftdw.cStandardFormats;
WideCharToMultiByte( CP_ACP, 0, aftdw.szFormatTag, -1, paftda->szFormatTag,
sizeof(paftda->szFormatTag), NULL, NULL );
}
return mmr;
}
/***********************************************************************
* acmFormatTagDetailsW (MSACM32.@)
*/
MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
DWORD fdwDetails)
{
PWINE_ACMDRIVERID padid;
MMRESULT mmr = ACMERR_NOTPOSSIBLE;
TRACE("(%p, %p, %ld)\n", had, paftd, fdwDetails);
if (fdwDetails & ~(ACM_FORMATTAGDETAILSF_FORMATTAG|ACM_FORMATTAGDETAILSF_INDEX|
ACM_FORMATTAGDETAILSF_LARGESTSIZE))
return MMSYSERR_INVALFLAG;
switch (fdwDetails) {
case ACM_FORMATTAGDETAILSF_FORMATTAG:
if (had == NULL) {
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
MSACM_FindFormatTagInCache(padid, paftd->dwFormatTag, NULL) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
acmDriverClose(had, 0);
if (mmr == MMSYSERR_NOERROR) break;
}
}
} else {
PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
if (pad && MSACM_FindFormatTagInCache(pad->obj.pACMDriverID, paftd->dwFormatTag, NULL))
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
}
break;
case ACM_FORMATTAGDETAILSF_INDEX:
if (had != NULL) {
PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
if (pad && paftd->dwFormatTagIndex < pad->obj.pACMDriverID->cFormatTags)
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
}
break;
case ACM_FORMATTAGDETAILSF_LARGESTSIZE:
if (had == NULL) {
ACMFORMATTAGDETAILSW tmp;
DWORD ft = paftd->dwFormatTag;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == 0) {
memset(&tmp, 0, sizeof(tmp));
tmp.cbStruct = sizeof(tmp);
tmp.dwFormatTag = ft;
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
(LPARAM)&tmp, fdwDetails) == MMSYSERR_NOERROR) {
if (mmr == ACMERR_NOTPOSSIBLE ||
paftd->cbFormatSize < tmp.cbFormatSize) {
*paftd = tmp;
mmr = MMSYSERR_NOERROR;
}
}
acmDriverClose(had, 0);
}
}
} else {
mmr = MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)paftd, fdwDetails);
}
break;
default:
WARN("Unsupported fdwDetails=%08lx\n", fdwDetails);
mmr = MMSYSERR_ERROR;
}
if (mmr == MMSYSERR_NOERROR &&
paftd->dwFormatTag == WAVE_FORMAT_PCM && paftd->szFormatTag[0] == 0)
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
return mmr;
}
struct MSACM_FormatTagEnumWtoA_Instance {
PACMFORMATTAGDETAILSA paftda;
DWORD dwInstance;
ACMFORMATTAGENUMCBA fnCallback;
};
static BOOL CALLBACK MSACM_FormatTagEnumCallbackWtoA(HACMDRIVERID hadid,
PACMFORMATTAGDETAILSW paftdw,
DWORD dwInstance,
DWORD fdwSupport)
{
struct MSACM_FormatTagEnumWtoA_Instance* paftei;
paftei = (struct MSACM_FormatTagEnumWtoA_Instance*)dwInstance;
paftei->paftda->dwFormatTagIndex = paftdw->dwFormatTagIndex;
paftei->paftda->dwFormatTag = paftdw->dwFormatTag;
paftei->paftda->cbFormatSize = paftdw->cbFormatSize;
paftei->paftda->fdwSupport = paftdw->fdwSupport;
paftei->paftda->cStandardFormats = paftdw->cStandardFormats;
WideCharToMultiByte( CP_ACP, 0, paftdw->szFormatTag, -1, paftei->paftda->szFormatTag,
sizeof(paftei->paftda->szFormatTag), NULL, NULL );
return (paftei->fnCallback)(hadid, paftei->paftda,
paftei->dwInstance, fdwSupport);
}
/***********************************************************************
* acmFormatTagEnumA (MSACM32.@)
*/
MMRESULT WINAPI acmFormatTagEnumA(HACMDRIVER had, PACMFORMATTAGDETAILSA paftda,
ACMFORMATTAGENUMCBA fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
ACMFORMATTAGDETAILSW aftdw;
struct MSACM_FormatTagEnumWtoA_Instance aftei;
if (!paftda)
return MMSYSERR_INVALPARAM;
if (paftda->cbStruct < sizeof(*paftda))
return MMSYSERR_INVALPARAM;
if (fdwEnum != 0)
return MMSYSERR_INVALFLAG;
memset(&aftdw, 0, sizeof(aftdw));
aftdw.cbStruct = sizeof(aftdw);
aftdw.dwFormatTagIndex = paftda->dwFormatTagIndex;
aftdw.dwFormatTag = paftda->dwFormatTag;
aftei.paftda = paftda;
aftei.dwInstance = dwInstance;
aftei.fnCallback = fnCallback;
return acmFormatTagEnumW(had, &aftdw, MSACM_FormatTagEnumCallbackWtoA,
(DWORD)&aftei, fdwEnum);
}
/***********************************************************************
* acmFormatTagEnumW (MSACM32.@)
*/
MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance,
DWORD fdwEnum)
{
PWINE_ACMDRIVERID padid;
int i;
BOOL bPcmDone = FALSE;
TRACE("(%p, %p, %p, %ld, %ld)\n",
had, paftd, fnCallback, dwInstance, fdwEnum);
if (!paftd)
return MMSYSERR_INVALPARAM;
if (paftd->cbStruct < sizeof(*paftd))
return MMSYSERR_INVALPARAM;
if (fdwEnum != 0)
return MMSYSERR_INVALFLAG;
/* (WS) MSDN info page says that if had != 0, then we should find
* the specific driver to get its tags from. Therefore I'm removing
* the FIXME call and adding a search block below. It also seems
* that the lack of this functionality was the responsible for
* codecs to be multiply and incorrectly listed.
*/
/* if (had) FIXME("had != NULL, not supported\n"); */
if (had) {
if (acmDriverID((HACMOBJ)had, (HACMDRIVERID *)&padid, 0) != MMSYSERR_NOERROR)
return MMSYSERR_INVALHANDLE;
for (i = 0; i < padid->cFormatTags; i++) {
paftd->dwFormatTagIndex = i;
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
if (paftd->szFormatTag[0] == 0)
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
/* (WS) I'm preserving this PCM hack since it seems to be
* correct. Please notice this block was borrowed from
* below.
*/
if (bPcmDone) continue;
bPcmDone = TRUE;
}
if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport))
return MMSYSERR_NOERROR;
}
}
}
/* if had==0 then search for the first suitable driver */
else {
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
/* should check for codec only */
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
acmDriverOpen(&had, (HACMDRIVERID)padid, 0) == MMSYSERR_NOERROR) {
for (i = 0; i < padid->cFormatTags; i++) {
paftd->dwFormatTagIndex = i;
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS,
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
if (paftd->szFormatTag[0] == 0)
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
/* FIXME (EPP): I'm not sure this is the correct
* algorithm (should make more sense to apply the same
* for all already loaded formats, but this will do
* for now
*/
if (bPcmDone) continue;
bPcmDone = TRUE;
}
if (!(fnCallback)((HACMDRIVERID)padid, paftd, dwInstance, padid->fdwSupport)) {
acmDriverClose(had, 0);
return MMSYSERR_NOERROR;
}
}
}
}
acmDriverClose(had, 0);
}
}
return MMSYSERR_NOERROR;
}

View file

@ -0,0 +1,12 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = imaadp32.acm
IMPORTS = winmm user32 kernel32
C_SRCS = imaadp32.c
@MAKE_DLL_RULES@
### Dependencies:

View file

@ -0,0 +1 @@
@ stdcall DriverProc (long long long long long) ADPCM_DriverProc

View file

@ -0,0 +1,938 @@
/*
* IMA ADPCM handling
*
* Copyright (C) 2001,2002 Eric Pouech
*
*
* 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
*/
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wine/debug.h"
/* see http://www.pcisys.net/~melanson/codecs/adpcm.txt for the details */
WINE_DEFAULT_DEBUG_CHANNEL(adpcm);
/***********************************************************************
* ADPCM_drvOpen
*/
static DWORD ADPCM_drvOpen(LPCSTR str)
{
return 1;
}
/***********************************************************************
* ADPCM_drvClose
*/
static DWORD ADPCM_drvClose(DWORD dwDevID)
{
return 1;
}
typedef struct tagAcmAdpcmData
{
void (*convert)(PACMDRVSTREAMINSTANCE adsi,
const unsigned char*, LPDWORD, unsigned char*, LPDWORD);
/* IMA encoding only */
BYTE stepIndexL;
BYTE stepIndexR;
/* short sample; */
} AcmAdpcmData;
/* table to list all supported formats... those are the basic ones. this
* also helps given a unique index to each of the supported formats
*/
typedef struct
{
int nChannels;
int nBits;
int rate;
} Format;
static Format PCM_Formats[] =
{
{1, 8, 8000}, {2, 8, 8000}, {1, 16, 8000}, {2, 16, 8000},
{1, 8, 11025}, {2, 8, 11025}, {1, 16, 11025}, {2, 16, 11025},
{1, 8, 22050}, {2, 8, 22050}, {1, 16, 22050}, {2, 16, 22050},
{1, 8, 44100}, {2, 8, 44100}, {1, 16, 44100}, {2, 16, 44100},
};
static Format ADPCM_Formats[] =
{
{1, 4, 8000}, {2, 4, 8000}, {1, 4, 11025}, {2, 4, 11025},
{1, 4, 22050}, {2, 4, 22050}, {1, 4, 44100}, {2, 4, 44100},
};
#define NUM_PCM_FORMATS (sizeof(PCM_Formats) / sizeof(PCM_Formats[0]))
#define NUM_ADPCM_FORMATS (sizeof(ADPCM_Formats) / sizeof(ADPCM_Formats[0]))
/***********************************************************************
* ADPCM_GetFormatIndex
*/
static DWORD ADPCM_GetFormatIndex(LPWAVEFORMATEX wfx)
{
int i, hi;
Format* fmts;
switch (wfx->wFormatTag)
{
case WAVE_FORMAT_PCM:
hi = NUM_PCM_FORMATS;
fmts = PCM_Formats;
break;
case WAVE_FORMAT_IMA_ADPCM:
hi = NUM_ADPCM_FORMATS;
fmts = ADPCM_Formats;
break;
default:
return 0xFFFFFFFF;
}
for (i = 0; i < hi; i++)
{
if (wfx->nChannels == fmts[i].nChannels &&
wfx->nSamplesPerSec == fmts[i].rate &&
wfx->wBitsPerSample == fmts[i].nBits)
return i;
}
return 0xFFFFFFFF;
}
/***********************************************************************
* R16
*
* Read a 16 bit sample (correctly handles endianess)
*/
static inline short R16(const unsigned char* src)
{
return (short)((unsigned short)src[0] | ((unsigned short)src[1] << 8));
}
/***********************************************************************
* W16
*
* Write a 16 bit sample (correctly handles endianess)
*/
static inline void W16(unsigned char* dst, short s)
{
dst[0] = LOBYTE(s);
dst[1] = HIBYTE(s);
}
/* IMA (or DVI) APDCM codec routines */
static const unsigned IMA_StepTable[89] =
{
7, 8, 9, 10, 11, 12, 13, 14,
16, 17, 19, 21, 23, 25, 28, 31,
34, 37, 41, 45, 50, 55, 60, 66,
73, 80, 88, 97, 107, 118, 130, 143,
157, 173, 190, 209, 230, 253, 279, 307,
337, 371, 408, 449, 494, 544, 598, 658,
724, 796, 876, 963, 1060, 1166, 1282, 1411,
1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024,
3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484,
7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794,
32767
};
static const int IMA_IndexTable[16] =
{
-1, -1, -1, -1, 2, 4, 6, 8,
-1, -1, -1, -1, 2, 4, 6, 8
};
static inline void clamp_step_index(int* stepIndex)
{
if (*stepIndex < 0 ) *stepIndex = 0;
if (*stepIndex > 88) *stepIndex = 88;
}
static inline void clamp_sample(int* sample)
{
if (*sample < -32768) *sample = -32768;
if (*sample > 32767) *sample = 32767;
}
static inline void process_nibble(unsigned char code, int* stepIndex, int* sample)
{
unsigned step;
int diff;
code &= 0x0F;
step = IMA_StepTable[*stepIndex];
diff = step >> 3;
if (code & 1) diff += step >> 2;
if (code & 2) diff += step >> 1;
if (code & 4) diff += step;
if (code & 8) *sample -= diff;
else *sample += diff;
clamp_sample(sample);
*stepIndex += IMA_IndexTable[code];
clamp_step_index(stepIndex);
}
static inline unsigned char generate_nibble(int in, int* stepIndex, int* sample)
{
int effdiff, diff = in - *sample;
unsigned step;
unsigned char code;
if (diff < 0)
{
diff = -diff;
code = 8;
}
else
{
code = 0;
}
step = IMA_StepTable[*stepIndex];
effdiff = (step >> 3);
if (diff >= step)
{
code |= 4;
diff -= step;
effdiff += step;
}
step >>= 1;
if (diff >= step)
{
code |= 2;
diff -= step;
effdiff += step;
}
step >>= 1;
if (diff >= step)
{
code |= 1;
effdiff += step;
}
if (code & 8) *sample -= effdiff;
else *sample += effdiff;
clamp_sample(sample);
*stepIndex += IMA_IndexTable[code];
clamp_step_index(stepIndex);
return code;
}
static void cvtSSima16K(PACMDRVSTREAMINSTANCE adsi,
const unsigned char* src, LPDWORD nsrc,
unsigned char* dst, LPDWORD ndst)
{
int i;
int sampleL, sampleR;
int stepIndexL, stepIndexR;
int nsamp_blk = ((LPIMAADPCMWAVEFORMAT)adsi->pwfxSrc)->wSamplesPerBlock;
int nsamp;
/* compute the number of entire blocks we can decode...
* it's the min of the number of entire blocks in source buffer and the number
* of entire blocks in destination buffer
*/
DWORD nblock = min(*nsrc / adsi->pwfxSrc->nBlockAlign,
*ndst / (nsamp_blk * 2 * 2));
*nsrc = nblock * adsi->pwfxSrc->nBlockAlign;
*ndst = nblock * (nsamp_blk * 2 * 2);
nsamp_blk--; /* remove the sample in block header */
for (; nblock > 0; nblock--)
{
const unsigned char* in_src = src;
/* handle headers first */
sampleL = R16(src);
stepIndexL = (unsigned)*(src + 2);
clamp_step_index(&stepIndexL);
src += 4;
W16(dst, sampleL); dst += 2;
sampleR = R16(src);
stepIndexR = (unsigned)*(src + 2);
clamp_step_index(&stepIndexR);
src += 4;
W16(dst, sampleR); dst += 2;
for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 8)
{
for (i = 0; i < 4; i++)
{
process_nibble(*src, &stepIndexL, &sampleL);
W16(dst + (2 * i + 0) * 4 + 0, sampleL);
process_nibble(*src++ >> 4, &stepIndexL, &sampleL);
W16(dst + (2 * i + 1) * 4 + 0, sampleL);
}
for (i = 0; i < 4; i++)
{
process_nibble(*src , &stepIndexR, &sampleR);
W16(dst + (2 * i + 0) * 4 + 2, sampleR);
process_nibble(*src++ >>4, &stepIndexR, &sampleR);
W16(dst + (2 * i + 1) * 4 + 2, sampleR);
}
dst += 32;
}
/* we have now to realign the source pointer on block */
src = in_src + adsi->pwfxSrc->nBlockAlign;
}
}
static void cvtMMima16K(PACMDRVSTREAMINSTANCE adsi,
const unsigned char* src, LPDWORD nsrc,
unsigned char* dst, LPDWORD ndst)
{
int sample;
int stepIndex;
int nsamp_blk = ((LPIMAADPCMWAVEFORMAT)adsi->pwfxSrc)->wSamplesPerBlock;
int nsamp;
/* compute the number of entire blocks we can decode...
* it's the min of the number of entire blocks in source buffer and the number
* of entire blocks in destination buffer
*/
DWORD nblock = min(*nsrc / adsi->pwfxSrc->nBlockAlign,
*ndst / (nsamp_blk * 2));
*nsrc = nblock * adsi->pwfxSrc->nBlockAlign;
*ndst = nblock * nsamp_blk * 2;
nsamp_blk--; /* remove the sample in block header */
for (; nblock > 0; nblock--)
{
const unsigned char* in_src = src;
/* handle header first */
sample = R16(src);
stepIndex = (unsigned)*(src + 2);
clamp_step_index(&stepIndex);
src += 4;
W16(dst, sample); dst += 2;
for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 2)
{
process_nibble(*src, &stepIndex, &sample);
W16(dst, sample); dst += 2;
process_nibble(*src++ >> 4, &stepIndex, &sample);
W16(dst, sample); dst += 2;
}
/* we have now to realign the source pointer on block */
src = in_src + adsi->pwfxSrc->nBlockAlign;
}
}
static void cvtSS16imaK(PACMDRVSTREAMINSTANCE adsi,
const unsigned char* src, LPDWORD nsrc,
unsigned char* dst, LPDWORD ndst)
{
int stepIndexL, stepIndexR;
int sampleL, sampleR;
BYTE code1, code2;
int nsamp_blk = ((LPIMAADPCMWAVEFORMAT)adsi->pwfxDst)->wSamplesPerBlock;
int i, nsamp;
/* compute the number of entire blocks we can decode...
* it's the min of the number of entire blocks in source buffer and the number
* of entire blocks in destination buffer
*/
DWORD nblock = min(*nsrc / (nsamp_blk * 2 * 2),
*ndst / adsi->pwfxDst->nBlockAlign);
*nsrc = nblock * (nsamp_blk * 2 * 2);
*ndst = nblock * adsi->pwfxDst->nBlockAlign;
stepIndexL = ((AcmAdpcmData*)adsi->dwDriver)->stepIndexL;
stepIndexR = ((AcmAdpcmData*)adsi->dwDriver)->stepIndexR;
nsamp_blk--; /* so that we won't count the sample in header while filling the block */
for (; nblock > 0; nblock--)
{
char* in_dst = dst;
/* generate header */
sampleL = R16(src); src += 2;
W16(dst, sampleL); dst += 2;
*dst = (unsigned char)(unsigned)stepIndexL;
dst += 2;
sampleR = R16(src); src += 2;
W16(dst, sampleR); dst += 2;
*dst = (unsigned char)(unsigned)stepIndexR;
dst += 2;
for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 8)
{
for (i = 0; i < 4; i++)
{
code1 = generate_nibble(R16(src + (2 * i + 0) * 2 + 0),
&stepIndexL, &sampleL);
code2 = generate_nibble(R16(src + (2 * i + 1) * 2 + 0),
&stepIndexL, &sampleL);
*dst++ = (code1 << 4) | code2;
}
for (i = 0; i < 4; i++)
{
code1 = generate_nibble(R16(src + (2 * i + 0) * 2 + 1),
&stepIndexR, &sampleR);
code2 = generate_nibble(R16(src + (2 * i + 1) * 2 + 1),
&stepIndexR, &sampleR);
*dst++ = (code1 << 4) | code2;
}
src += 32;
}
dst = in_dst + adsi->pwfxDst->nBlockAlign;
}
((AcmAdpcmData*)adsi->dwDriver)->stepIndexL = stepIndexL;
((AcmAdpcmData*)adsi->dwDriver)->stepIndexR = stepIndexR;
}
static void cvtMM16imaK(PACMDRVSTREAMINSTANCE adsi,
const unsigned char* src, LPDWORD nsrc,
unsigned char* dst, LPDWORD ndst)
{
int stepIndex;
int sample;
BYTE code1, code2;
int nsamp_blk = ((LPIMAADPCMWAVEFORMAT)adsi->pwfxDst)->wSamplesPerBlock;
int nsamp;
/* compute the number of entire blocks we can decode...
* it's the min of the number of entire blocks in source buffer and the number
* of entire blocks in destination buffer
*/
DWORD nblock = min(*nsrc / (nsamp_blk * 2),
*ndst / adsi->pwfxDst->nBlockAlign);
*nsrc = nblock * (nsamp_blk * 2);
*ndst = nblock * adsi->pwfxDst->nBlockAlign;
stepIndex = ((AcmAdpcmData*)adsi->dwDriver)->stepIndexL;
nsamp_blk--; /* so that we won't count the sample in header while filling the block */
for (; nblock > 0; nblock--)
{
char* in_dst = dst;
/* generate header */
/* FIXME: what about the last effective sample from previous block ??? */
/* perhaps something like:
* sample += R16(src);
* clamp_sample(sample);
* and with :
* + saving the sample in adsi->dwDriver when all blocks are done
+ + reset should set the field in adsi->dwDriver to 0 too
*/
sample = R16(src); src += 2;
W16(dst, sample); dst += 2;
*dst = (unsigned char)(unsigned)stepIndex;
dst += 2;
for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 2)
{
code1 = generate_nibble(R16(src), &stepIndex, &sample);
src += 2;
code2 = generate_nibble(R16(src), &stepIndex, &sample);
src += 2;
*dst++ = (code1 << 4) | code2;
}
dst = in_dst + adsi->pwfxDst->nBlockAlign;
}
((AcmAdpcmData*)adsi->dwDriver)->stepIndexL = stepIndex;
}
/***********************************************************************
* ADPCM_DriverDetails
*
*/
static LRESULT ADPCM_DriverDetails(PACMDRIVERDETAILSW add)
{
add->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
add->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
add->wMid = 0xFF;
add->wPid = 0x00;
add->vdwACM = 0x01000000;
add->vdwDriver = 0x01000000;
add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
add->cFormatTags = 2; /* PCM, IMA ADPCM */
add->cFilterTags = 0;
add->hicon = NULL;
MultiByteToWideChar( CP_ACP, 0, "WINE-ADPCM", -1,
add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Wine IMA ADPCM converter", -1,
add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1,
add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1,
add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) );
add->szFeatures[0] = 0;
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_FormatTagDetails
*
*/
static LRESULT ADPCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
{
static WCHAR szPcm[]={'P','C','M',0};
static WCHAR szImaAdPcm[]={'I','M','A',' ','A','d','P','C','M',0};
switch (dwQuery)
{
case ACM_FORMATTAGDETAILSF_INDEX:
if (aftd->dwFormatTagIndex >= 2) return ACMERR_NOTPOSSIBLE;
break;
case ACM_FORMATTAGDETAILSF_LARGESTSIZE:
if (aftd->dwFormatTag == WAVE_FORMAT_UNKNOWN)
{
aftd->dwFormatTagIndex = 1; /* WAVE_FORMAT_IMA_ADPCM is bigger than PCM */
break;
}
/* fall thru */
case ACM_FORMATTAGDETAILSF_FORMATTAG:
switch (aftd->dwFormatTag)
{
case WAVE_FORMAT_PCM: aftd->dwFormatTagIndex = 0; break;
case WAVE_FORMAT_IMA_ADPCM: aftd->dwFormatTagIndex = 1; break;
default: return ACMERR_NOTPOSSIBLE;
}
break;
default:
WARN("Unsupported query %08lx\n", dwQuery);
return MMSYSERR_NOTSUPPORTED;
}
aftd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
switch (aftd->dwFormatTagIndex)
{
case 0:
aftd->dwFormatTag = WAVE_FORMAT_PCM;
aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
aftd->cStandardFormats = NUM_PCM_FORMATS;
lstrcpyW(aftd->szFormatTag, szPcm);
break;
case 1:
aftd->dwFormatTag = WAVE_FORMAT_IMA_ADPCM;
aftd->cbFormatSize = sizeof(IMAADPCMWAVEFORMAT);
aftd->cStandardFormats = NUM_ADPCM_FORMATS;
lstrcpyW(aftd->szFormatTag, szImaAdPcm);
break;
}
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_FormatDetails
*
*/
static LRESULT ADPCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
{
switch (dwQuery)
{
case ACM_FORMATDETAILSF_FORMAT:
if (ADPCM_GetFormatIndex(afd->pwfx) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
break;
case ACM_FORMATDETAILSF_INDEX:
afd->pwfx->wFormatTag = afd->dwFormatTag;
switch (afd->dwFormatTag)
{
case WAVE_FORMAT_PCM:
if (afd->dwFormatIndex >= NUM_PCM_FORMATS) return ACMERR_NOTPOSSIBLE;
afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels;
afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate;
afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits;
/* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not accessible
* afd->pwfx->cbSize = 0;
*/
afd->pwfx->nBlockAlign =
(afd->pwfx->nChannels * afd->pwfx->wBitsPerSample) / 8;
afd->pwfx->nAvgBytesPerSec =
afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign;
break;
case WAVE_FORMAT_IMA_ADPCM:
if (afd->dwFormatIndex >= NUM_ADPCM_FORMATS) return ACMERR_NOTPOSSIBLE;
afd->pwfx->nChannels = ADPCM_Formats[afd->dwFormatIndex].nChannels;
afd->pwfx->nSamplesPerSec = ADPCM_Formats[afd->dwFormatIndex].rate;
afd->pwfx->wBitsPerSample = ADPCM_Formats[afd->dwFormatIndex].nBits;
afd->pwfx->nBlockAlign = 1024;
/* we got 4 bits per sample */
afd->pwfx->nAvgBytesPerSec =
(afd->pwfx->nSamplesPerSec * 4) / 8;
if (afd->cbwfx >= sizeof(WAVEFORMATEX))
afd->pwfx->cbSize = sizeof(WORD);
if (afd->cbwfx >= sizeof(IMAADPCMWAVEFORMAT))
((IMAADPCMWAVEFORMAT*)afd->pwfx)->wSamplesPerBlock = (1024 - 4 * afd->pwfx->nChannels) * (2 / afd->pwfx->nChannels) + 1;
break;
default:
WARN("Unsupported tag %08lx\n", afd->dwFormatTag);
return MMSYSERR_INVALPARAM;
}
break;
default:
WARN("Unsupported query %08lx\n", dwQuery);
return MMSYSERR_NOTSUPPORTED;
}
afd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
afd->szFormat[0] = 0; /* let MSACM format this for us... */
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_FormatSuggest
*
*/
static LRESULT ADPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
{
/* some tests ... */
if (adfs->cbwfxSrc < sizeof(PCMWAVEFORMAT) ||
adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) ||
ADPCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
/* FIXME: should do those tests against the real size (according to format tag */
/* If no suggestion for destination, then copy source value */
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS))
adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC))
adfs->pwfxDst->nSamplesPerSec = adfs->pwfxSrc->nSamplesPerSec;
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE))
{
if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
adfs->pwfxDst->wBitsPerSample = 4;
else
adfs->pwfxDst->wBitsPerSample = 16;
}
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG))
{
if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
adfs->pwfxDst->wFormatTag = WAVE_FORMAT_IMA_ADPCM;
else
adfs->pwfxDst->wFormatTag = WAVE_FORMAT_PCM;
}
/* check if result is ok */
if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
/* recompute other values */
switch (adfs->pwfxDst->wFormatTag)
{
case WAVE_FORMAT_PCM:
adfs->pwfxDst->nBlockAlign = (adfs->pwfxDst->nChannels * adfs->pwfxDst->wBitsPerSample) / 8;
adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * adfs->pwfxDst->nBlockAlign;
break;
case WAVE_FORMAT_IMA_ADPCM:
adfs->pwfxDst->nBlockAlign = 1024;
/* FIXME: not handling header overhead */
adfs->pwfxDst->nAvgBytesPerSec = ((adfs->pwfxDst->nSamplesPerSec * 4) / 8) * adfs->pwfxSrc->nChannels;
((IMAADPCMWAVEFORMAT*)adfs->pwfxDst)->wSamplesPerBlock = (1024 - 4 * adfs->pwfxSrc->nChannels) * (2 / adfs->pwfxSrc->nChannels) + 1;
TRACE("setting spb=%u\n", ((IMAADPCMWAVEFORMAT*)adfs->pwfxDst)->wSamplesPerBlock);
break;
default:
FIXME("\n");
break;
}
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_Reset
*
*/
static void ADPCM_Reset(PACMDRVSTREAMINSTANCE adsi, AcmAdpcmData* aad)
{
aad->stepIndexL = aad->stepIndexR = 0;
}
/***********************************************************************
* ADPCM_StreamOpen
*
*/
static LRESULT ADPCM_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
{
AcmAdpcmData* aad;
unsigned nspb;
assert(!(adsi->fdwOpen & ACM_STREAMOPENF_ASYNC));
if (ADPCM_GetFormatIndex(adsi->pwfxSrc) == 0xFFFFFFFF ||
ADPCM_GetFormatIndex(adsi->pwfxDst) == 0xFFFFFFFF)
return ACMERR_NOTPOSSIBLE;
aad = HeapAlloc(GetProcessHeap(), 0, sizeof(AcmAdpcmData));
if (aad == 0) return MMSYSERR_NOMEM;
adsi->dwDriver = (DWORD)aad;
if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
goto theEnd;
}
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_IMA_ADPCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
/* resampling or mono <=> stereo not available
* ADPCM algo only define 16 bit per sample output
*/
if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec ||
adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels ||
adsi->pwfxDst->wBitsPerSample != 16)
goto theEnd;
nspb = ((LPIMAADPCMWAVEFORMAT)adsi->pwfxSrc)->wSamplesPerBlock;
TRACE("spb=%u\n", nspb);
/* we check that in a block, after the header, samples are present on
* 4-sample packet pattern
* we also check that the block alignement is bigger than the expected size
*/
if (((nspb - 1) & 3) != 0) goto theEnd;
if ((((nspb - 1) / 2) + 4) * adsi->pwfxSrc->nChannels < adsi->pwfxSrc->nBlockAlign)
goto theEnd;
/* adpcm decoding... */
if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 2)
aad->convert = cvtSSima16K;
if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 1)
aad->convert = cvtMMima16K;
}
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_IMA_ADPCM)
{
if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec ||
adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels ||
adsi->pwfxSrc->wBitsPerSample != 16)
goto theEnd;
nspb = ((LPIMAADPCMWAVEFORMAT)adsi->pwfxDst)->wSamplesPerBlock;
TRACE("spb=%u\n", nspb);
/* we check that in a block, after the header, samples are present on
* 4-sample packet pattern
* we also check that the block alignement is bigger than the expected size
*/
if (((nspb - 1) & 3) != 0) goto theEnd;
if ((((nspb - 1) / 2) + 4) * adsi->pwfxDst->nChannels < adsi->pwfxDst->nBlockAlign)
goto theEnd;
/* adpcm coding... */
if (adsi->pwfxSrc->wBitsPerSample == 16 && adsi->pwfxSrc->nChannels == 2)
aad->convert = cvtSS16imaK;
if (adsi->pwfxSrc->wBitsPerSample == 16 && adsi->pwfxSrc->nChannels == 1)
aad->convert = cvtMM16imaK;
}
else goto theEnd;
ADPCM_Reset(adsi, aad);
return MMSYSERR_NOERROR;
theEnd:
HeapFree(GetProcessHeap(), 0, aad);
adsi->dwDriver = 0L;
return MMSYSERR_NOTSUPPORTED;
}
/***********************************************************************
* ADPCM_StreamClose
*
*/
static LRESULT ADPCM_StreamClose(PACMDRVSTREAMINSTANCE adsi)
{
HeapFree(GetProcessHeap(), 0, (void*)adsi->dwDriver);
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_round
*
*/
static inline DWORD ADPCM_round(DWORD a, DWORD b, DWORD c)
{
assert(a && b && c);
/* to be sure, always return an entire number of c... */
return ((double)a * (double)b + (double)c - 1) / (double)c;
}
/***********************************************************************
* ADPCM_StreamSize
*
*/
static LRESULT ADPCM_StreamSize(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMSIZE adss)
{
switch (adss->fdwSize)
{
case ACM_STREAMSIZEF_DESTINATION:
/* cbDstLength => cbSrcLength */
if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_IMA_ADPCM)
{
/* don't take block overhead into account, doesn't matter too much */
adss->cbSrcLength = adss->cbDstLength * 4;
}
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_IMA_ADPCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
FIXME("misses the block header overhead\n");
adss->cbSrcLength = 256 + adss->cbDstLength / 4;
}
else
{
return MMSYSERR_NOTSUPPORTED;
}
break;
case ACM_STREAMSIZEF_SOURCE:
/* cbSrcLength => cbDstLength */
if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_IMA_ADPCM)
{
FIXME("misses the block header overhead\n");
adss->cbDstLength = 256 + adss->cbSrcLength / 4;
}
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_IMA_ADPCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
/* don't take block overhead into account, doesn't matter too much */
adss->cbDstLength = adss->cbSrcLength * 4;
}
else
{
return MMSYSERR_NOTSUPPORTED;
}
break;
default:
WARN("Unsupported query %08lx\n", adss->fdwSize);
return MMSYSERR_NOTSUPPORTED;
}
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_StreamConvert
*
*/
static LRESULT ADPCM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER adsh)
{
AcmAdpcmData* aad = (AcmAdpcmData*)adsi->dwDriver;
DWORD nsrc = adsh->cbSrcLength;
DWORD ndst = adsh->cbDstLength;
if (adsh->fdwConvert &
~(ACM_STREAMCONVERTF_BLOCKALIGN|
ACM_STREAMCONVERTF_END|
ACM_STREAMCONVERTF_START))
{
FIXME("Unsupported fdwConvert (%08lx), ignoring it\n", adsh->fdwConvert);
}
/* ACM_STREAMCONVERTF_BLOCKALIGN
* currently all conversions are block aligned, so do nothing for this flag
* ACM_STREAMCONVERTF_END
* no pending data, so do nothing for this flag
*/
if ((adsh->fdwConvert & ACM_STREAMCONVERTF_START))
{
ADPCM_Reset(adsi, aad);
}
aad->convert(adsi, adsh->pbSrc, &nsrc, adsh->pbDst, &ndst);
adsh->cbSrcLengthUsed = nsrc;
adsh->cbDstLengthUsed = ndst;
return MMSYSERR_NOERROR;
}
/**************************************************************************
* ADPCM_DriverProc [exported]
*/
LRESULT CALLBACK ADPCM_DriverProc(DWORD dwDevID, HDRVR hDriv, UINT wMsg,
LPARAM dwParam1, LPARAM dwParam2)
{
TRACE("(%08lx %08lx %04x %08lx %08lx);\n",
dwDevID, (DWORD)hDriv, wMsg, dwParam1, dwParam2);
switch (wMsg)
{
case DRV_LOAD: return 1;
case DRV_FREE: return 1;
case DRV_OPEN: return ADPCM_drvOpen((LPSTR)dwParam1);
case DRV_CLOSE: return ADPCM_drvClose(dwDevID);
case DRV_ENABLE: return 1;
case DRV_DISABLE: return 1;
case DRV_QUERYCONFIGURE: return 1;
case DRV_CONFIGURE: MessageBoxA(0, "MSACM IMA ADPCM filter !", "Wine Driver", MB_OK); return 1;
case DRV_INSTALL: return DRVCNF_RESTART;
case DRV_REMOVE: return DRVCNF_RESTART;
case ACMDM_DRIVER_NOTIFY:
/* no caching from other ACM drivers is done so far */
return MMSYSERR_NOERROR;
case ACMDM_DRIVER_DETAILS:
return ADPCM_DriverDetails((PACMDRIVERDETAILSW)dwParam1);
case ACMDM_FORMATTAG_DETAILS:
return ADPCM_FormatTagDetails((PACMFORMATTAGDETAILSW)dwParam1, dwParam2);
case ACMDM_FORMAT_DETAILS:
return ADPCM_FormatDetails((PACMFORMATDETAILSW)dwParam1, dwParam2);
case ACMDM_FORMAT_SUGGEST:
return ADPCM_FormatSuggest((PACMDRVFORMATSUGGEST)dwParam1);
case ACMDM_STREAM_OPEN:
return ADPCM_StreamOpen((PACMDRVSTREAMINSTANCE)dwParam1);
case ACMDM_STREAM_CLOSE:
return ADPCM_StreamClose((PACMDRVSTREAMINSTANCE)dwParam1);
case ACMDM_STREAM_SIZE:
return ADPCM_StreamSize((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMSIZE)dwParam2);
case ACMDM_STREAM_CONVERT:
return ADPCM_StreamConvert((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMHEADER)dwParam2);
case ACMDM_HARDWARE_WAVE_CAPS_INPUT:
case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT:
/* this converter is not a hardware driver */
case ACMDM_FILTERTAG_DETAILS:
case ACMDM_FILTER_DETAILS:
/* this converter is not a filter */
case ACMDM_STREAM_RESET:
/* only needed for asynchronous driver... we aren't, so just say it */
return MMSYSERR_NOTSUPPORTED;
case ACMDM_STREAM_PREPARE:
case ACMDM_STREAM_UNPREPARE:
/* nothing special to do here... so don't do anything */
return MMSYSERR_NOERROR;
default:
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
}
return 0;
}

View file

@ -0,0 +1,417 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
* 1999 Eric Pouech
*
* 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
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "winreg.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
/**********************************************************************/
HANDLE MSACM_hHeap = NULL;
PWINE_ACMDRIVERID MSACM_pFirstACMDriverID = NULL;
PWINE_ACMDRIVERID MSACM_pLastACMDriverID = NULL;
#if 0
/***********************************************************************
* MSACM_DumpCache
*/
static void MSACM_DumpCache(PWINE_ACMDRIVERID padid)
{
unsigned i;
TRACE("cFilterTags=%lu cFormatTags=%lu fdwSupport=%08lx\n",
padid->cFilterTags, padid->cFormatTags, padid->fdwSupport);
for (i = 0; i < padid->cache->cFormatTags; i++) {
TRACE("\tdwFormatTag=%lu cbwfx=%lu\n",
padid->aFormatTag[i].dwFormatTag, padid->aFormatTag[i].cbwfx);
}
}
#endif
/***********************************************************************
* MSACM_FindFormatTagInCache [internal]
*
* Returns TRUE is the format tag fmtTag is present in the cache.
* If so, idx is set to its index.
*/
BOOL MSACM_FindFormatTagInCache(WINE_ACMDRIVERID* padid, DWORD fmtTag, LPDWORD idx)
{
unsigned i;
for (i = 0; i < padid->cFormatTags; i++) {
if (padid->aFormatTag[i].dwFormatTag == fmtTag) {
if (idx) *idx = i;
return TRUE;
}
}
return FALSE;
}
/***********************************************************************
* MSACM_FillCache
*/
static BOOL MSACM_FillCache(PWINE_ACMDRIVERID padid)
{
HACMDRIVER had = 0;
int ntag;
ACMDRIVERDETAILSW add;
ACMFORMATTAGDETAILSW aftd;
if (acmDriverOpen(&had, (HACMDRIVERID)padid, 0) != 0)
return FALSE;
padid->aFormatTag = NULL;
add.cbStruct = sizeof(add);
if (MSACM_Message(had, ACMDM_DRIVER_DETAILS, (LPARAM)&add, 0))
goto errCleanUp;
if (add.cFormatTags > 0) {
padid->aFormatTag = HeapAlloc(MSACM_hHeap, HEAP_ZERO_MEMORY,
add.cFormatTags * sizeof(padid->aFormatTag[0]));
if (!padid->aFormatTag) goto errCleanUp;
}
padid->cFormatTags = add.cFormatTags;
padid->cFilterTags = add.cFilterTags;
padid->fdwSupport = add.fdwSupport;
aftd.cbStruct = sizeof(aftd);
for (ntag = 0; ntag < add.cFormatTags; ntag++) {
aftd.dwFormatTagIndex = ntag;
if (MSACM_Message(had, ACMDM_FORMATTAG_DETAILS, (LPARAM)&aftd, ACM_FORMATTAGDETAILSF_INDEX)) {
TRACE("IIOs (%s)\n", debugstr_w(padid->pszDriverAlias));
goto errCleanUp;
}
padid->aFormatTag[ntag].dwFormatTag = aftd.dwFormatTag;
padid->aFormatTag[ntag].cbwfx = aftd.cbFormatSize;
}
acmDriverClose(had, 0);
return TRUE;
errCleanUp:
if (had) acmDriverClose(had, 0);
HeapFree(MSACM_hHeap, 0, padid->aFormatTag);
padid->aFormatTag = NULL;
return FALSE;
}
/***********************************************************************
* MSACM_GetRegistryKey
*/
static LPWSTR MSACM_GetRegistryKey(const WINE_ACMDRIVERID* padid)
{
static const WCHAR baseKey[] = {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
'A','u','d','i','o','C','o','m','p','r','e','s','s','i','o','n','M','a','n','a','g','e','r','\\',
'D','r','i','v','e','r','C','a','c','h','e','\\','\0'};
LPWSTR ret;
int len;
if (!padid->pszDriverAlias) {
ERR("No alias needed for registry entry\n");
return NULL;
}
len = strlenW(baseKey);
ret = HeapAlloc(MSACM_hHeap, 0, (len + strlenW(padid->pszDriverAlias) + 1) * sizeof(WCHAR));
if (!ret) return NULL;
strcpyW(ret, baseKey);
strcpyW(ret + len, padid->pszDriverAlias);
CharLowerW(ret + len);
return ret;
}
/***********************************************************************
* MSACM_ReadCache
*/
static BOOL MSACM_ReadCache(PWINE_ACMDRIVERID padid)
{
LPWSTR key = MSACM_GetRegistryKey(padid);
HKEY hKey;
DWORD type, size;
if (!key) return FALSE;
padid->aFormatTag = NULL;
if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
goto errCleanUp;
size = sizeof(padid->cFormatTags);
if (RegQueryValueExA(hKey, "cFormatTags", 0, &type, (void*)&padid->cFormatTags, &size))
goto errCleanUp;
size = sizeof(padid->cFilterTags);
if (RegQueryValueExA(hKey, "cFilterTags", 0, &type, (void*)&padid->cFilterTags, &size))
goto errCleanUp;
size = sizeof(padid->fdwSupport);
if (RegQueryValueExA(hKey, "fdwSupport", 0, &type, (void*)&padid->fdwSupport, &size))
goto errCleanUp;
if (padid->cFormatTags > 0) {
size = padid->cFormatTags * sizeof(padid->aFormatTag[0]);
padid->aFormatTag = HeapAlloc(MSACM_hHeap, HEAP_ZERO_MEMORY, size);
if (!padid->aFormatTag) goto errCleanUp;
if (RegQueryValueExA(hKey, "aFormatTagCache", 0, &type, (void*)padid->aFormatTag, &size))
goto errCleanUp;
}
HeapFree(MSACM_hHeap, 0, key);
return TRUE;
errCleanUp:
HeapFree(MSACM_hHeap, 0, key);
HeapFree(MSACM_hHeap, 0, padid->aFormatTag);
padid->aFormatTag = NULL;
RegCloseKey(hKey);
return FALSE;
}
/***********************************************************************
* MSACM_WriteCache
*/
static BOOL MSACM_WriteCache(PWINE_ACMDRIVERID padid)
{
LPWSTR key = MSACM_GetRegistryKey(padid);
HKEY hKey;
if (!key) return FALSE;
if (RegCreateKeyW(HKEY_LOCAL_MACHINE, key, &hKey))
goto errCleanUp;
if (RegSetValueExA(hKey, "cFormatTags", 0, REG_DWORD, (void*)&padid->cFormatTags, sizeof(DWORD)))
goto errCleanUp;
if (RegSetValueExA(hKey, "cFilterTags", 0, REG_DWORD, (void*)&padid->cFilterTags, sizeof(DWORD)))
goto errCleanUp;
if (RegSetValueExA(hKey, "fdwSupport", 0, REG_DWORD, (void*)&padid->fdwSupport, sizeof(DWORD)))
goto errCleanUp;
if (RegSetValueExA(hKey, "aFormatTagCache", 0, REG_BINARY,
(void*)padid->aFormatTag,
padid->cFormatTags * sizeof(padid->aFormatTag[0])))
goto errCleanUp;
HeapFree(MSACM_hHeap, 0, key);
return TRUE;
errCleanUp:
HeapFree(MSACM_hHeap, 0, key);
return FALSE;
}
/***********************************************************************
* MSACM_RegisterDriver()
*/
PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileName,
HINSTANCE hinstModule)
{
PWINE_ACMDRIVERID padid;
TRACE("(%s, %s, %p)\n",
debugstr_w(pszDriverAlias), debugstr_w(pszFileName), hinstModule);
padid = (PWINE_ACMDRIVERID) HeapAlloc(MSACM_hHeap, 0, sizeof(WINE_ACMDRIVERID));
padid->obj.dwType = WINE_ACMOBJ_DRIVERID;
padid->obj.pACMDriverID = padid;
padid->pszDriverAlias = NULL;
if (pszDriverAlias)
{
padid->pszDriverAlias = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszDriverAlias)+1) * sizeof(WCHAR) );
strcpyW( padid->pszDriverAlias, pszDriverAlias );
}
padid->pszFileName = NULL;
if (pszFileName)
{
padid->pszFileName = HeapAlloc( MSACM_hHeap, 0, (strlenW(pszFileName)+1) * sizeof(WCHAR) );
strcpyW( padid->pszFileName, pszFileName );
}
padid->hInstModule = hinstModule;
padid->pACMDriverList = NULL;
padid->pNextACMDriverID = NULL;
padid->pPrevACMDriverID = MSACM_pLastACMDriverID;
if (MSACM_pLastACMDriverID)
MSACM_pLastACMDriverID->pNextACMDriverID = padid;
MSACM_pLastACMDriverID = padid;
if (!MSACM_pFirstACMDriverID)
MSACM_pFirstACMDriverID = padid;
/* disable the driver if we cannot load the cache */
if (!MSACM_ReadCache(padid) && !MSACM_FillCache(padid)) {
WARN("Couldn't load cache for ACM driver (%s)\n", debugstr_w(pszFileName));
MSACM_UnregisterDriver(padid);
return NULL;
}
return padid;
}
/***********************************************************************
* MSACM_RegisterAllDrivers()
*/
void MSACM_RegisterAllDrivers(void)
{
static const WCHAR msacm32[] = {'m','s','a','c','m','3','2','.','d','l','l','\0'};
static const WCHAR msacmW[] = {'M','S','A','C','M','.'};
static const WCHAR drv32[] = {'d','r','i','v','e','r','s','3','2','\0'};
static const WCHAR sys[] = {'s','y','s','t','e','m','.','i','n','i','\0'};
static const WCHAR drvkey[] = {'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'W','i','n','d','o','w','s',' ','N','T','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'D','r','i','v','e','r','s','3','2','\0'};
DWORD i, cnt = 0, bufLen, lRet;
WCHAR buf[2048], *name, *s;
FILETIME lastWrite;
HKEY hKey;
/* FIXME: What if the user edits system.ini while the program is running?
* Does Windows handle that? */
if (MSACM_pFirstACMDriverID) return;
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
if (lRet == ERROR_SUCCESS) {
RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
for (i = 0; i < cnt; i++) {
bufLen = sizeof(buf) / sizeof(buf[0]);
lRet = RegEnumKeyExW(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
if (lRet != ERROR_SUCCESS) continue;
if (strncmpiW(buf, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
if (!(name = strchrW(buf, '='))) continue;
*name = 0;
MSACM_RegisterDriver(buf, name + 1, 0);
}
RegCloseKey( hKey );
}
if (GetPrivateProfileSectionW(drv32, buf, sizeof(buf)/sizeof(buf[0]), sys))
{
for(s = buf; *s; s += strlenW(s) + 1)
{
if (strncmpiW(s, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
if (!(name = strchrW(s, '='))) continue;
*name = 0;
MSACM_RegisterDriver(s, name + 1, 0);
*name = '=';
}
}
MSACM_RegisterDriver(msacm32, msacm32, 0);
}
/***********************************************************************
* MSACM_UnregisterDriver()
*/
PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
{
PWINE_ACMDRIVERID pNextACMDriverID;
while (p->pACMDriverList)
acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);
if (p->pszDriverAlias)
HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
if (p->pszFileName)
HeapFree(MSACM_hHeap, 0, p->pszFileName);
HeapFree(MSACM_hHeap, 0, p->aFormatTag);
if (p == MSACM_pFirstACMDriverID)
MSACM_pFirstACMDriverID = p->pNextACMDriverID;
if (p == MSACM_pLastACMDriverID)
MSACM_pLastACMDriverID = p->pPrevACMDriverID;
if (p->pPrevACMDriverID)
p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID;
if (p->pNextACMDriverID)
p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID;
pNextACMDriverID = p->pNextACMDriverID;
HeapFree(MSACM_hHeap, 0, p);
return pNextACMDriverID;
}
/***********************************************************************
* MSACM_UnregisterAllDrivers()
*/
void MSACM_UnregisterAllDrivers(void)
{
PWINE_ACMDRIVERID p = MSACM_pFirstACMDriverID;
while (p) {
MSACM_WriteCache(p);
p = MSACM_UnregisterDriver(p);
}
}
/***********************************************************************
* MSACM_GetObj()
*/
PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type)
{
PWINE_ACMOBJ pao = (PWINE_ACMOBJ)hObj;
if (pao == NULL || IsBadReadPtr(pao, sizeof(WINE_ACMOBJ)) ||
((type != WINE_ACMOBJ_DONTCARE) && (type != pao->dwType)))
return NULL;
return pao;
}
/***********************************************************************
* MSACM_GetDriverID()
*/
PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID)
{
return (PWINE_ACMDRIVERID)MSACM_GetObj((HACMOBJ)hDriverID, WINE_ACMOBJ_DRIVERID);
}
/***********************************************************************
* MSACM_GetDriver()
*/
PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver)
{
return (PWINE_ACMDRIVER)MSACM_GetObj((HACMOBJ)hDriver, WINE_ACMOBJ_DRIVER);
}
/***********************************************************************
* MSACM_Message()
*/
MMRESULT MSACM_Message(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
{
PWINE_ACMDRIVER pad = MSACM_GetDriver(had);
return pad ? SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2) : MMSYSERR_INVALHANDLE;
}

View file

@ -0,0 +1,36 @@
/*
* Top level resource file for MS ACM
*
* Copyright 2000 Eric Pouech
*
* 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
*/
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wineacm.h"
#include "msacm_En.rc"
#include "msacm_De.rc"
#include "msacm_Es.rc"
#include "msacm_Fr.rc"
#include "msacm_It.rc"
#include "msacm_Ja.rc"
#include "msacm_Nl.rc"
#include "msacm_Pt.rc"
#include "msacm_Ru.rc"
#include "msacm_Sv.rc"
#include "msacm_Hu.rc"

View file

@ -0,0 +1,40 @@
1 stub WEP
2 stub DRIVERPROC
3 stub ___EXPORTEDSTUB
7 pascal acmGetVersion() acmGetVersion16
8 pascal -ret16 acmMetrics(word word ptr) acmMetrics16
10 pascal -ret16 acmDriverEnum(ptr long long) acmDriverEnum16
11 pascal -ret16 acmDriverDetails(word ptr long) acmDriverDetails16
12 pascal -ret16 acmDriverAdd(ptr word long long long) acmDriverAdd16
13 pascal -ret16 acmDriverRemove(word long) acmDriverRemove16
14 pascal -ret16 acmDriverOpen(ptr word long) acmDriverOpen16
15 pascal -ret16 acmDriverClose(word long) acmDriverClose16
16 pascal acmDriverMessage(word word long long) acmDriverMessage16
17 pascal -ret16 acmDriverID(word ptr long) acmDriverID16
18 pascal -ret16 acmDriverPriority(word long long) acmDriverPriority16
30 pascal -ret16 acmFormatTagDetails(word ptr long) acmFormatTagDetails16
31 pascal -ret16 acmFormatTagEnum(word ptr ptr long long) acmFormatTagEnum16
40 pascal -ret16 acmFormatChoose(ptr) acmFormatChoose16
41 pascal -ret16 acmFormatDetails(word ptr long) acmFormatDetails16
42 pascal -ret16 acmFormatEnum(word ptr ptr long long) acmFormatEnum16
45 pascal -ret16 acmFormatSuggest(word ptr ptr long long) acmFormatSuggest16
50 pascal -ret16 acmFilterTagDetails(word ptr long) acmFilterTagDetails16
51 pascal -ret16 acmFilterTagEnum(word ptr ptr long long) acmFilterTagEnum16
60 pascal -ret16 acmFilterChoose(ptr) acmFilterChoose16
61 pascal -ret16 acmFilterDetails(word ptr long) acmFilterDetails16
62 pascal -ret16 acmFilterEnum(word ptr ptr long long) acmFilterEnum16
70 pascal -ret16 acmStreamOpen(ptr word ptr ptr ptr long long long) acmStreamOpen16
71 pascal -ret16 acmStreamClose(word long) acmStreamClose16
72 pascal -ret16 acmStreamSize(word long ptr long) acmStreamSize16
75 pascal -ret16 acmStreamConvert(word ptr long) acmStreamConvert16
76 pascal -ret16 acmStreamReset(word long) acmStreamReset16
77 pascal -ret16 acmStreamPrepareHeader(word ptr long) acmStreamPrepareHeader16
78 pascal -ret16 acmStreamUnprepareHeader(word ptr long) acmStreamUnprepareHeader16
150 stub ACMAPPLICATIONEXIT
175 stub ACMHUGEPAGELOCK
176 stub ACMHUGEPAGEUNLOCK
200 stub ACMOPENCONVERSION
201 stub ACMCLOSECONVERSION
202 stub ACMCONVERT
203 stub ACMCHOOSEFORMAT
255 pascal DllEntryPoint(long word word word long word) MSACM_DllEntryPoint

View file

View file

@ -0,0 +1,46 @@
@ stdcall acmDriverAddA(ptr long long long long)
@ stdcall acmDriverAddW(ptr long long long long)
@ stdcall acmDriverClose(long long)
@ stdcall acmDriverDetailsA(long ptr long)
@ stdcall acmDriverDetailsW(long ptr long)
@ stdcall acmDriverEnum(ptr long long)
@ stdcall acmDriverID(long ptr long)
@ stdcall acmDriverMessage(long long long long)
@ stdcall acmDriverOpen(ptr long long)
@ stdcall acmDriverPriority(long long long)
@ stdcall acmDriverRemove(long long)
@ stdcall acmFilterChooseA(ptr)
@ stdcall acmFilterChooseW(ptr)
@ stdcall acmFilterDetailsA(long ptr long)
@ stdcall acmFilterDetailsW(long ptr long)
@ stdcall acmFilterEnumA(long ptr ptr long long)
@ stdcall acmFilterEnumW(long ptr ptr long long)
@ stdcall acmFilterTagDetailsA(long ptr long)
@ stdcall acmFilterTagDetailsW(long ptr long)
@ stdcall acmFilterTagEnumA(long ptr ptr long long)
@ stdcall acmFilterTagEnumW(long ptr ptr long long)
@ stdcall acmFormatChooseA(ptr)
@ stdcall acmFormatChooseW(ptr)
@ stdcall acmFormatDetailsA(long ptr long)
@ stdcall acmFormatDetailsW(long ptr long)
@ stdcall acmFormatEnumA(long ptr ptr long long)
@ stdcall acmFormatEnumW(long ptr ptr long long)
@ stdcall acmFormatSuggest(long ptr ptr long long)
@ stdcall acmFormatTagDetailsA(long ptr long)
@ stdcall acmFormatTagDetailsW(long ptr long)
@ stdcall acmFormatTagEnumA(long ptr ptr long long)
@ stdcall acmFormatTagEnumW(long ptr ptr long long)
@ stdcall acmGetVersion()
@ stub acmMessage32
@ stdcall acmMetrics(long long ptr)
@ stdcall acmStreamClose(long long)
@ stdcall acmStreamConvert(long ptr long)
@ stdcall acmStreamMessage(long long long long)
@ stdcall acmStreamOpen(ptr long ptr ptr ptr long long long)
@ stdcall acmStreamPrepareHeader(long ptr long)
@ stdcall acmStreamReset(long long)
@ stdcall acmStreamSize(long long ptr long)
@ stdcall acmStreamUnprepareHeader(long ptr long)
# this is wine only
@ stdcall DriverProc(long long long long long) PCM_DriverProc

View file

@ -0,0 +1,26 @@
<module name="msacm32" type="win32dll" baseaddress="${BASEADDRESS_MSACM32}" installbase="system32" installname="msacm32.dll">
<importlibrary definition="msacm32.spec.def" />
<include base="msacm32">.</include>
<include base="ReactOS">include/wine</include>
<define name="UNICODE" />
<define name="_UNICODE" />
<define name="__REACTOS__" />
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x501</define>
<library>wine</library>
<library>ntdll</library>
<library>kernel32</library>
<library>advapi32</library>
<library>user32</library>
<library>winmm</library>
<file>driver.c</file>
<file>filter.c</file>
<file>format.c</file>
<file>internal.c</file>
<file>msacm32_main.c</file>
<file>pcmconverter.c</file>
<file>stream.c</file>
<file>msacm32.spec</file>
</module>

View file

@ -0,0 +1,233 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
* 1999 Eric Pouech
*
* 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
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/debug.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
/**********************************************************************/
HINSTANCE MSACM_hInstance32 = 0;
/***********************************************************************
* DllMain (MSACM32.init)
*/
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
TRACE("%p 0x%lx %p\n", hInstDLL, fdwReason, lpvReserved);
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstDLL);
MSACM_hHeap = HeapCreate(0, 0x10000, 0);
MSACM_hInstance32 = hInstDLL;
MSACM_RegisterAllDrivers();
break;
case DLL_PROCESS_DETACH:
MSACM_UnregisterAllDrivers();
HeapDestroy(MSACM_hHeap);
MSACM_hHeap = NULL;
MSACM_hInstance32 = NULL;
break;
default:
break;
}
return TRUE;
}
/***********************************************************************
* XRegThunkEntry (MSACM32.1)
* FIXME
* No documentation found.
*/
/***********************************************************************
* acmGetVersion (MSACM32.@)
*/
DWORD WINAPI acmGetVersion(void)
{
OSVERSIONINFOA version;
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
if (!GetVersionExA( &version ))
return 0x04030000;
switch (version.dwPlatformId) {
case VER_PLATFORM_WIN32_NT:
return 0x04000565; /* 4.0.1381 */
default:
FIXME("%lx not supported\n", version.dwPlatformId);
case VER_PLATFORM_WIN32_WINDOWS:
return 0x04030000; /* 4.3.0 */
}
}
/***********************************************************************
* acmMessage32 (MSACM32.35)
* FIXME
* No documentation found.
*/
/***********************************************************************
* acmMetrics (MSACM32.@)
*/
MMRESULT WINAPI acmMetrics(HACMOBJ hao, UINT uMetric, LPVOID pMetric)
{
PWINE_ACMOBJ pao = MSACM_GetObj(hao, WINE_ACMOBJ_DONTCARE);
BOOL bLocal = TRUE;
PWINE_ACMDRIVERID padid;
DWORD val = 0;
int i;
MMRESULT mmr = MMSYSERR_NOERROR;
TRACE("(%p, %d, %p);\n", hao, uMetric, pMetric);
#define CheckLocal(padid) (!bLocal || ((padid)->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_LOCAL))
switch (uMetric) {
case ACM_METRIC_COUNT_DRIVERS:
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
if (hao) return MMSYSERR_INVALHANDLE;
if (!pMetric) return MMSYSERR_INVALPARAM;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_COUNT_CODECS:
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_CODECS:
if (hao) return MMSYSERR_INVALHANDLE;
if (!pMetric) return MMSYSERR_INVALPARAM;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC) &&
CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_COUNT_CONVERTERS:
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
if (hao) return MMSYSERR_INVALHANDLE;
if (!pMetric) return MMSYSERR_INVALPARAM;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER) &&
CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_COUNT_FILTERS:
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_FILTERS:
if (hao) return MMSYSERR_INVALHANDLE;
if (!pMetric) return MMSYSERR_INVALPARAM;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) &&
(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER) &&
CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_COUNT_DISABLED:
bLocal = FALSE;
/* fall through */
case ACM_METRIC_COUNT_LOCAL_DISABLED:
if (hao) return MMSYSERR_INVALHANDLE;
if (!pMetric) return MMSYSERR_INVALPARAM;
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID)
if ((padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) && CheckLocal(padid))
val++;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_MAX_SIZE_FORMAT:
if (hao == NULL) {
for (padid = MSACM_pFirstACMDriverID; padid; padid = padid->pNextACMDriverID) {
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
for (i = 0; i < padid->cFormatTags; i++) {
if (val < padid->aFormatTag[i].cbwfx)
val = padid->aFormatTag[i].cbwfx;
}
}
}
} else if (pao != NULL) {
switch (pao->dwType) {
case WINE_ACMOBJ_DRIVER:
case WINE_ACMOBJ_DRIVERID:
padid = pao->pACMDriverID;
break;
default:
return MMSYSERR_INVALHANDLE;
}
if (!(padid->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED)) {
for (i = 0; i < padid->cFormatTags; i++) {
if (val < padid->aFormatTag[i].cbwfx)
val = padid->aFormatTag[i].cbwfx;
}
}
} else {
return MMSYSERR_INVALHANDLE;
}
if (!pMetric) return MMSYSERR_INVALPARAM;
*(LPDWORD)pMetric = val;
break;
case ACM_METRIC_COUNT_HARDWARE:
if (hao) return MMSYSERR_INVALHANDLE;
if (!pMetric) return MMSYSERR_INVALPARAM;
*(LPDWORD)pMetric = 0;
FIXME("ACM_METRIC_COUNT_HARDWARE not implemented\n");
break;
case ACM_METRIC_HARDWARE_WAVE_INPUT:
case ACM_METRIC_HARDWARE_WAVE_OUTPUT:
case ACM_METRIC_MAX_SIZE_FILTER:
case ACM_METRIC_DRIVER_SUPPORT:
case ACM_METRIC_DRIVER_PRIORITY:
default:
FIXME("(%p, %d, %p): stub\n", hao, uMetric, pMetric);
mmr = MMSYSERR_NOTSUPPORTED;
}
return mmr;
}

View file

@ -0,0 +1,56 @@
/*
* German resource file for MS ACM
*
* by Friedrich Stange (dj_smith_reactos@online.de)
*
* 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
*/
LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Sound auswahl"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Name:", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Speichern als...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
PUSHBUTTON "&Löschen", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Eigenschaften:", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "Abbrechen", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "&Hilfe", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,56 @@
/*
* English resource file for MS ACM
*
* Copyright 2000 Eric Pouech
*
* 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
*/
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Sound Selection"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Name:", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Save As...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
PUSHBUTTON "&Remove", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Attributes:", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "Cancel", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "&Help", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,56 @@
/*
* Spanish resource file for MS ACM
*
* Copyright 2004 José Manuel Ferrer Ortiz
*
* 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
*/
LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Selección de sonido"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Nombre:", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Guardar como...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
PUSHBUTTON "&Eliminar", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "&Formato:", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "A&tributos:", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "Aceptar", IDOK, 48, 80, 40, 14
PUSHBUTTON "Cancelar", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "&Ayuda", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,57 @@
/*
* French resource file for MS ACM
*
* Copyright 2000 Eric Pouech
* Copyright 2003 Vincent Béron
*
* 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
*/
LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Sélection du son"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Nom :", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Enregistrer sous...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
PUSHBUTTON "&Retirer", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "&Format :", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Attributs :", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "Annuler", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "&Aide", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,57 @@
/*
* Hungarian resource file for MS ACM
*
* Copyright 2000 Eric Pouech
* Copyright 2005 Gergely Risko
*
* 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
*/
LANGUAGE LANG_HUNGARIAN, SUBLANG_NEUTRAL
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Hang Kiválasztása"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Név:", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Mentés másként...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
/* NOT TRANSLATED */ PUSHBUTTON "&Remove", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "&Formátum:", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Attribútumok:", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "Mégse", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "&Súgó", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,57 @@
/*
* Italian resource file for MS ACM
*
* Copyright 2000 Eric Pouech
* Copyright 2003 Ivan Leo Puoti
*
* 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
*/
LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Selezione dell'audio"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Nome:", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Salva con nome...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
PUSHBUTTON "&Rimuovi", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "&Formato:", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Attributi:", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "Anulla", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "&Aiuto", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,56 @@
/*
* Japanese resource file for MS ACM
*
* Copyright 2000 Hajime Segawa
*
* 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
*/
LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "サウンドの選択"
FONT 9, "MS UI Gothic"
BEGIN
LTEXT "名前(&N):", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "名前を付けて保存(&S)...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
PUSHBUTTON "削除(&R)", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "フォーマット(&F):", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "属性(&A):", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "キャンセル", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "ヘルプ(&H)", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,56 @@
/*
* msacm (Dutch resources)
*
* Copyright 2003 Hans Leidekker
*
* 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
*/
LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Geluidskeuze"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Naam:", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Opslaan als...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
PUSHBUTTON "&Verwijderen", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "&Formaat:", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Attributen:", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "Annuleren", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "&Help", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,56 @@
/*
* Portuguese resource file for MS ACM
*
* Copyright 2003 Marcelo Duarte
*
* 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
*/
LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Seleção de som"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Nome:", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Salvar como...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
PUSHBUTTON "&Remover", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "&Formato:", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Atributos:", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "Cancelar", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "Aj&uda", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,57 @@
/*
* Russian resource file for MS ACM
*
* Copyright 2005 Mikhail Y. Zvyozdochkin
*
* 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
*/
LANGUAGE LANG_RUSSIAN, SUBLANG_NEUTRAL
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 234, 101
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Âûáîð çâóêà"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Èìÿ:", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Ñîõð&àíèòü êàê...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 58, 14
PUSHBUTTON "&Óäàëèòü", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 187, 14, 38, 14
LTEXT "&Ôîðìàò:", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 177, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Ñâîéñòâà:", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 177, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 177, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "Îòìåíà", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "Ñ&ïðàâêà", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,56 @@
/*
* Swedish resource file for MS ACM
*
* Copyright 2005 Anders Bergh
*
* 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
*/
LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL
DLG_ACMFORMATCHOOSE_ID DIALOG DISCARDABLE 10, 20, 225, 100
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Ljudval"
FONT 8, "MS Shell Dlg"
BEGIN
LTEXT "&Namn:", -1, 5, 5, 115, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_CUSTOM, 5, 15, 115, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "&Spara som...", IDD_ACMFORMATCHOOSE_BTN_SETNAME, 125, 14, 45, 14
PUSHBUTTON "&Ta bort", IDD_ACMFORMATCHOOSE_BTN_DELNAME, 175, 14, 45, 14
LTEXT "&Format:", -1, 5, 41, 44, 8, NOT WS_GROUP
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMATTAG, 50, 39, 170, 60,
CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "&Attribut:", -1, 5, 59, 44, 8, NOT WS_GROUP
#if 0
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP |
CBS_OWNERDRAWFIXED | CBS_HASSTRINGS
#else
COMBOBOX IDD_ACMFORMATCHOOSE_CMB_FORMAT, 50, 57, 170, 60,
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
#endif
DEFPUSHBUTTON "OK", IDOK, 48, 80, 40, 14
PUSHBUTTON "Avbryt", IDCANCEL, 92, 80, 40, 14
PUSHBUTTON "&Hjälp", IDD_ACMFORMATCHOOSE_BTN_HELP, 136, 80, 40, 14
END

View file

@ -0,0 +1,463 @@
/*
* MSACM library
*
* Copyright 1998 Patrik Stridvall
*
* 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
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
/**************************************************************************
* DllEntryPoint (MSACM.255)
*
* MSACM DLL entry point
*
*/
BOOL WINAPI MSACM_DllEntryPoint(DWORD fdwReason, HINSTANCE16 hinstDLL, WORD ds,
WORD wHeapSize, DWORD dwReserved1, WORD wReserved2)
{
static HANDLE hndl;
TRACE("0x%x 0x%lx\n", hinstDLL, fdwReason);
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
if (!hndl && !(hndl = LoadLibraryA("MSACM32.DLL"))) {
ERR("Could not load sibling MsAcm32.dll\n");
return FALSE;
}
break;
case DLL_PROCESS_DETACH:
FreeLibrary(hndl);
hndl = 0;
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
/***********************************************************************
* acmGetVersion (MSACM.7)
*/
DWORD WINAPI acmGetVersion16(void)
{
return acmGetVersion();
}
/***********************************************************************
* acmMetrics (MSACM.8)
*/
MMRESULT16 WINAPI acmMetrics16(
HACMOBJ16 hao, UINT16 uMetric, LPVOID pMetric)
{
FIXME("(0x%04x, %d, %p): semi-stub\n", hao, uMetric, pMetric);
if(!hao) return acmMetrics(0, uMetric, pMetric);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverEnum (MSACM.10)
*/
MMRESULT16 WINAPI acmDriverEnum16(
ACMDRIVERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum)
{
FIXME("(%p, %ld, %ld): stub\n",
fnCallback, dwInstance, fdwEnum
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverDetails (MSACM.11)
*/
MMRESULT16 WINAPI acmDriverDetails16(
HACMDRIVERID16 hadid, LPACMDRIVERDETAILS16 padd, DWORD fdwDetails)
{
FIXME("(0x%04x, %p, %ld): stub\n", hadid, padd, fdwDetails);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverAdd (MSACM.12)
*/
MMRESULT16 WINAPI acmDriverAdd16(
LPHACMDRIVERID16 phadid, HINSTANCE16 hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd)
{
FIXME("(%p, 0x%04x, %ld, %ld, %ld): stub\n",
phadid, hinstModule, lParam, dwPriority, fdwAdd
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverRemove (MSACM.13)
*/
MMRESULT16 WINAPI acmDriverRemove16(
HACMDRIVERID16 hadid, DWORD fdwRemove)
{
FIXME("(0x%04x, %ld): stub\n", hadid, fdwRemove);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverOpen (MSACM.14)
*/
MMRESULT16 WINAPI acmDriverOpen16(
LPHACMDRIVER16 phad, HACMDRIVERID16 hadid, DWORD fdwOpen)
{
FIXME("(%p, 0x%04x, %ld): stub\n", phad, hadid, fdwOpen);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverClose (MSACM.15)
*/
MMRESULT16 WINAPI acmDriverClose16(
HACMDRIVER16 had, DWORD fdwClose)
{
FIXME("(0x%04x, %ld): stub\n", had, fdwClose);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverMessage (MSACM.16)
*/
LRESULT WINAPI acmDriverMessage16(
HACMDRIVER16 had, UINT16 uMsg, LPARAM lParam1, LPARAM lParam2)
{
FIXME("(0x%04x, %d, %ld, %ld): stub\n",
had, uMsg, lParam1, lParam2
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/***********************************************************************
* acmDriverID (MSACM.17)
*/
MMRESULT16 WINAPI acmDriverID16(
HACMOBJ16 hao, LPHACMDRIVERID16 phadid, DWORD fdwDriverID)
{
FIXME("(0x%04x, %p, %ld): stub\n", hao, phadid, fdwDriverID);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmDriverPriority (MSACM.18)
*/
MMRESULT16 WINAPI acmDriverPriority16(
HACMDRIVERID16 hadid, DWORD dwPriority, DWORD fdwPriority)
{
FIXME("(0x%04x, %ld, %ld): stub\n",
hadid, dwPriority, fdwPriority
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFormatTagDetails (MSACM.30)
*/
MMRESULT16 WINAPI acmFormatTagDetails16(
HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, DWORD fdwDetails)
{
FIXME("(0x%04x, %p, %ld): stub\n", had, paftd, fdwDetails);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFormatTagEnum (MSACM.31)
*/
MMRESULT16 WINAPI acmFormatTagEnum16(
HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd,
ACMFORMATTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum)
{
FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n",
had, paftd, fnCallback, dwInstance, fdwEnum
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFormatChoose (MSACM.40)
*/
MMRESULT16 WINAPI acmFormatChoose16(
LPACMFORMATCHOOSE16 pafmtc)
{
FIXME("(%p): stub\n", pafmtc);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFormatDetails (MSACM.41)
*/
MMRESULT16 WINAPI acmFormatDetails16(
HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, DWORD fdwDetails)
{
FIXME("(0x%04x, %p, %ld): stub\n", had, pafd, fdwDetails);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFormatEnum (MSACM.42)
*/
MMRESULT16 WINAPI acmFormatEnum16(
HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd,
ACMFORMATENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum)
{
FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n",
had, pafd, fnCallback, dwInstance, fdwEnum
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFormatSuggest (MSACM.45)
*/
MMRESULT16 WINAPI acmFormatSuggest16(
HACMDRIVER16 had, LPWAVEFORMATEX pwfxSrc,
LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest)
{
FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n",
had, pwfxSrc, pwfxDst, cbwfxDst, fdwSuggest
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFilterTagDetails (MSACM.50)
*/
MMRESULT16 WINAPI acmFilterTagDetails16(
HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, DWORD fdwDetails)
{
FIXME("(0x%04x, %p, %ld): stub\n", had, paftd, fdwDetails);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFilterTagEnum (MSACM.51)
*/
MMRESULT16 WINAPI acmFilterTagEnum16(
HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd,
ACMFILTERTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum)
{
FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n",
had, paftd, fnCallback, dwInstance, fdwEnum
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFilterChoose (MSACM.60)
*/
MMRESULT16 WINAPI acmFilterChoose16(
LPACMFILTERCHOOSE16 pafltrc)
{
FIXME("(%p): stub\n", pafltrc);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFilterDetails (MSACM.61)
*/
MMRESULT16 WINAPI acmFilterDetails16(
HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, DWORD fdwDetails)
{
FIXME("(0x%04x, %p, %ld): stub\n", had, pafd, fdwDetails);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmFilterEnum (MSACM.62)
*/
MMRESULT16 WINAPI acmFilterEnum16(
HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd,
ACMFILTERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum)
{
FIXME("(0x%04x, %p, %p, %ld, %ld): stub\n",
had, pafd, fnCallback, dwInstance, fdwEnum
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmStreamOpen (MSACM.70)
*/
MMRESULT16 WINAPI acmStreamOpen16(
LPHACMSTREAM16 phas, HACMDRIVER16 had,
LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst,
LPWAVEFILTER pwfltr, DWORD dwCallback,
DWORD dwInstance, DWORD fdwOpen)
{
FIXME("(%p, 0x%04x, %p, %p, %p, %ld, %ld, %ld): stub\n",
phas, had, pwfxSrc, pwfxDst, pwfltr,
dwCallback, dwInstance, fdwOpen
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmStreamClose (MSACM.71)
*/
MMRESULT16 WINAPI acmStreamClose16(
HACMSTREAM16 has, DWORD fdwClose)
{
FIXME("(0x%04x, %ld): stub\n", has, fdwClose);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmStreamSize (MSACM.72)
*/
MMRESULT16 WINAPI acmStreamSize16(
HACMSTREAM16 has, DWORD cbInput,
LPDWORD pdwOutputBytes, DWORD fdwSize)
{
FIXME("(0x%04x, %ld, %p, %ld): stub\n",
has, cbInput, pdwOutputBytes, fdwSize
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmStreamConvert (MSACM.75)
*/
MMRESULT16 WINAPI acmStreamConvert16(
HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwConvert)
{
FIXME("(0x%04x, %p, %ld): stub\n", has, pash, fdwConvert);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmStreamReset (MSACM.76)
*/
MMRESULT16 WINAPI acmStreamReset16(
HACMSTREAM16 has, DWORD fdwReset)
{
FIXME("(0x%04x, %ld): stub\n", has, fdwReset);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmStreamPrepareHeader (MSACM.77)
*/
MMRESULT16 WINAPI acmStreamPrepareHeader16(
HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwPrepare)
{
FIXME("(0x%04x, %p, %ld): stub\n", has, pash, fdwPrepare);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmStreamUnprepareHeader (MSACM.78)
*/
MMRESULT16 WINAPI acmStreamUnprepareHeader16(
HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwUnprepare)
{
FIXME("(0x%04x, %p, %ld): stub\n",
has, pash, fdwUnprepare
);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* ACMAPPLICATIONEXIT (MSACM.150)
* FIXME
* No documentation found.
*/
/***********************************************************************
* ACMHUGEPAGELOCK (MSACM.175)
*FIXME
* No documentation found.
*/
/***********************************************************************
* ACMHUGEPAGEUNLOCK (MSACM.176)
* FIXME
* No documentation found.
*/
/***********************************************************************
* ACMOPENCONVERSION (MSACM.200)
* FIXME
* No documentation found.
*/
/***********************************************************************
* ACMCLOSECONVERSION (MSACM.201)
* FIXME
* No documentation found.
*/
/***********************************************************************
* ACMCONVERT (MSACM.202)
* FIXME
* No documentation found.
*/
/***********************************************************************
* ACMCHOOSEFORMAT (MSACM.203)
* FIXME
* No documentation found.
*/

View file

@ -0,0 +1,12 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = msadp32.acm
IMPORTS = winmm user32 kernel32
C_SRCS = msadp32.c
@MAKE_DLL_RULES@
### Dependencies:

View file

@ -0,0 +1 @@
@ stdcall DriverProc (long long long long long) ADPCM_DriverProc

View file

@ -0,0 +1,781 @@
/*
* MS ADPCM handling
*
* Copyright (C) 2002 Eric Pouech
*
*
* 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
*/
#include <assert.h>
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wine/debug.h"
/* see http://www.pcisys.net/~melanson/codecs/adpcm.txt for the details */
WINE_DEFAULT_DEBUG_CHANNEL(adpcm);
/***********************************************************************
* ADPCM_drvOpen
*/
static DWORD ADPCM_drvOpen(LPCSTR str)
{
return 1;
}
/***********************************************************************
* ADPCM_drvClose
*/
static DWORD ADPCM_drvClose(DWORD dwDevID)
{
return 1;
}
typedef struct tagAcmAdpcmData
{
void (*convert)(PACMDRVSTREAMINSTANCE adsi,
const unsigned char*, LPDWORD, unsigned char*, LPDWORD);
} AcmAdpcmData;
/* table to list all supported formats... those are the basic ones. this
* also helps given a unique index to each of the supported formats
*/
typedef struct
{
int nChannels;
int nBits;
int rate;
} Format;
static Format PCM_Formats[] =
{
{1, 8, 8000}, {2, 8, 8000}, {1, 16, 8000}, {2, 16, 8000},
{1, 8, 11025}, {2, 8, 11025}, {1, 16, 11025}, {2, 16, 11025},
{1, 8, 22050}, {2, 8, 22050}, {1, 16, 22050}, {2, 16, 22050},
{1, 8, 44100}, {2, 8, 44100}, {1, 16, 44100}, {2, 16, 44100},
};
static Format ADPCM_Formats[] =
{
{1, 4, 8000}, {2, 4, 8000}, {1, 4, 11025}, {2, 4, 11025},
{1, 4, 22050}, {2, 4, 22050}, {1, 4, 44100}, {2, 4, 44100},
};
#define NUM_PCM_FORMATS (sizeof(PCM_Formats) / sizeof(PCM_Formats[0]))
#define NUM_ADPCM_FORMATS (sizeof(ADPCM_Formats) / sizeof(ADPCM_Formats[0]))
static int MS_Delta[] =
{
230, 230, 230, 230, 307, 409, 512, 614,
768, 614, 512, 409, 307, 230, 230, 230
};
static ADPCMCOEFSET MSADPCM_CoeffSet[] =
{
{256, 0}, {512, -256}, {0, 0}, {192, 64}, {240, 0}, {460, -208}, {392, -232}
};
/***********************************************************************
* ADPCM_GetFormatIndex
*/
static DWORD ADPCM_GetFormatIndex(WAVEFORMATEX* wfx)
{
int i, hi;
Format* fmts;
switch (wfx->wFormatTag)
{
case WAVE_FORMAT_PCM:
hi = NUM_PCM_FORMATS;
fmts = PCM_Formats;
break;
case WAVE_FORMAT_ADPCM:
hi = NUM_ADPCM_FORMATS;
fmts = ADPCM_Formats;
break;
default:
return 0xFFFFFFFF;
}
for (i = 0; i < hi; i++)
{
if (wfx->nChannels == fmts[i].nChannels &&
wfx->nSamplesPerSec == fmts[i].rate &&
wfx->wBitsPerSample == fmts[i].nBits)
return i;
}
return 0xFFFFFFFF;
}
static void init_wfx_adpcm(ADPCMWAVEFORMAT* awfx)
{
register WAVEFORMATEX* pwfx = &awfx->wfx;
/* we assume wFormatTag, nChannels, nSamplesPerSec and wBitsPerSample
* have been initialized... */
if (pwfx->wFormatTag != WAVE_FORMAT_ADPCM) {FIXME("wrong FT\n"); return;}
if (ADPCM_GetFormatIndex(pwfx) == 0xFFFFFFFF) {FIXME("wrong fmt\n"); return;}
switch (pwfx->nSamplesPerSec)
{
case 8000: pwfx->nBlockAlign = 256; break;
case 11025: pwfx->nBlockAlign = 256; break;
case 22050: pwfx->nBlockAlign = 512; break;
default:
case 44100: pwfx->nBlockAlign = 1024; break;
}
pwfx->cbSize = 2 * sizeof(WORD) + 7 * sizeof(ADPCMCOEFSET);
/* 7 is the size of the block head (which contains two samples) */
awfx->wSamplesPerBlock = (pwfx->nBlockAlign - (7 * pwfx->nChannels)) * (2 / pwfx->nChannels) + 2;
pwfx->nAvgBytesPerSec = (pwfx->nSamplesPerSec * pwfx->nBlockAlign) / awfx->wSamplesPerBlock;
awfx->wNumCoef = 7;
memcpy(awfx->aCoef, MSADPCM_CoeffSet, 7 * sizeof(ADPCMCOEFSET));
}
/***********************************************************************
* R16
*
* Read a 16 bit sample (correctly handles endianess)
*/
static inline short R16(const unsigned char* src)
{
return (short)((unsigned short)src[0] | ((unsigned short)src[1] << 8));
}
/***********************************************************************
* W16
*
* Write a 16 bit sample (correctly handles endianess)
*/
static inline void W16(unsigned char* dst, short s)
{
dst[0] = LOBYTE(s);
dst[1] = HIBYTE(s);
}
static inline void clamp_sample(int* sample)
{
if (*sample < -32768) *sample = -32768;
if (*sample > 32767) *sample = 32767;
}
static inline void process_nibble(unsigned nibble, int* idelta,
int* sample1, int* sample2,
const ADPCMCOEFSET* coeff)
{
int sample;
int snibble;
/* nibble is in fact a signed 4 bit integer => propagate sign if needed */
snibble = (nibble & 0x08) ? (nibble - 16) : nibble;
sample = ((*sample1 * coeff->iCoef1) + (*sample2 * coeff->iCoef2)) / 256 +
snibble * *idelta;
clamp_sample(&sample);
*sample2 = *sample1;
*sample1 = sample;
*idelta = ((MS_Delta[nibble] * *idelta) / 256);
if (*idelta < 16) *idelta = 16;
}
static void cvtSSms16K(PACMDRVSTREAMINSTANCE adsi,
const unsigned char* src, LPDWORD nsrc,
unsigned char* dst, LPDWORD ndst)
{
int ideltaL, ideltaR;
int sample1L, sample2L;
int sample1R, sample2R;
ADPCMCOEFSET coeffL, coeffR;
int nsamp;
int nsamp_blk = ((ADPCMWAVEFORMAT*)adsi->pwfxSrc)->wSamplesPerBlock;
DWORD nblock = min(*nsrc / adsi->pwfxSrc->nBlockAlign,
*ndst / (nsamp_blk * 2 * 2));
*nsrc = nblock * adsi->pwfxSrc->nBlockAlign;
*ndst = nblock * nsamp_blk * 2 * 2;
nsamp_blk -= 2; /* see below for samples from block head */
for (; nblock > 0; nblock--)
{
const unsigned char* in_src = src;
assert(*src <= 6);
coeffL = MSADPCM_CoeffSet[*src++];
assert(*src <= 6);
coeffR = MSADPCM_CoeffSet[*src++];
ideltaL = R16(src); src += 2;
ideltaR = R16(src); src += 2;
sample1L = R16(src); src += 2;
sample1R = R16(src); src += 2;
sample2L = R16(src); src += 2;
sample2R = R16(src); src += 2;
/* store samples from block head */
W16(dst, sample2L); dst += 2;
W16(dst, sample2R); dst += 2;
W16(dst, sample1L); dst += 2;
W16(dst, sample1R); dst += 2;
for (nsamp = nsamp_blk; nsamp > 0; nsamp--)
{
process_nibble(*src >> 4, &ideltaL, &sample1L, &sample2L, &coeffL);
W16(dst, sample1L); dst += 2;
process_nibble(*src++ & 0x0F, &ideltaR, &sample1R, &sample2R, &coeffR);
W16(dst, sample1R); dst += 2;
}
src = in_src + adsi->pwfxSrc->nBlockAlign;
}
}
static void cvtMMms16K(PACMDRVSTREAMINSTANCE adsi,
const unsigned char* src, LPDWORD nsrc,
unsigned char* dst, LPDWORD ndst)
{
int idelta;
int sample1, sample2;
ADPCMCOEFSET coeff;
int nsamp;
int nsamp_blk = ((ADPCMWAVEFORMAT*)adsi->pwfxSrc)->wSamplesPerBlock;
DWORD nblock = min(*nsrc / adsi->pwfxSrc->nBlockAlign,
*ndst / (nsamp_blk * 2));
*nsrc = nblock * adsi->pwfxSrc->nBlockAlign;
*ndst = nblock * nsamp_blk * 2;
nsamp_blk -= 2; /* see below for samples from block head */
for (; nblock > 0; nblock--)
{
const unsigned char* in_src = src;
assert(*src <= 6);
coeff = MSADPCM_CoeffSet[*src++];
idelta = R16(src); src += 2;
sample1 = R16(src); src += 2;
sample2 = R16(src); src += 2;
/* store samples from block head */
W16(dst, sample2); dst += 2;
W16(dst, sample1); dst += 2;
for (nsamp = nsamp_blk; nsamp > 0; nsamp -= 2)
{
process_nibble(*src >> 4, &idelta, &sample1, &sample2, &coeff);
W16(dst, sample1); dst += 2;
process_nibble(*src++ & 0x0F, &idelta, &sample1, &sample2, &coeff);
W16(dst, sample1); dst += 2;
}
src = in_src + adsi->pwfxSrc->nBlockAlign;
}
}
#if 0
static void cvtSS16msK(PACMDRVSTREAMINSTANCE adsi,
const unsigned char* src, LPDWORD nsrc,
unsigned char* dst, LPDWORD ndst)
{
}
static void cvtMM16msK(PACMDRVSTREAMINSTANCE adsi,
const unsigned char* src, LPDWORD nsrc,
unsigned char* dst, LPDWORD ndst)
{
}
#endif
/***********************************************************************
* ADPCM_DriverDetails
*
*/
static LRESULT ADPCM_DriverDetails(PACMDRIVERDETAILSW add)
{
add->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
add->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
add->wMid = 0xFF;
add->wPid = 0x00;
add->vdwACM = 0x01000000;
add->vdwDriver = 0x01000000;
add->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
add->cFormatTags = 2; /* PCM, MS ADPCM */
add->cFilterTags = 0;
add->hicon = NULL;
MultiByteToWideChar( CP_ACP, 0, "WINE-MS ADPCM", -1,
add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Wine MS ADPCM converter", -1,
add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1,
add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1,
add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) );
add->szFeatures[0] = 0;
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_FormatTagDetails
*
*/
static LRESULT ADPCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
{
static WCHAR szPcm[]={'P','C','M',0};
static WCHAR szMsAdPcm[]={'M','S',' ','A','d','P','C','M',0};
switch (dwQuery)
{
case ACM_FORMATTAGDETAILSF_INDEX:
if (aftd->dwFormatTagIndex >= 2) return ACMERR_NOTPOSSIBLE;
break;
case ACM_FORMATTAGDETAILSF_LARGESTSIZE:
if (aftd->dwFormatTag == WAVE_FORMAT_UNKNOWN)
{
aftd->dwFormatTagIndex = 1; /* WAVE_FORMAT_ADPCM is bigger than PCM */
break;
}
/* fall thru */
case ACM_FORMATTAGDETAILSF_FORMATTAG:
switch (aftd->dwFormatTag)
{
case WAVE_FORMAT_PCM: aftd->dwFormatTagIndex = 0; break;
case WAVE_FORMAT_ADPCM: aftd->dwFormatTagIndex = 1; break;
default: return ACMERR_NOTPOSSIBLE;
}
break;
default:
WARN("Unsupported query %08lx\n", dwQuery);
return MMSYSERR_NOTSUPPORTED;
}
aftd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
switch (aftd->dwFormatTagIndex)
{
case 0:
aftd->dwFormatTag = WAVE_FORMAT_PCM;
aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
aftd->cStandardFormats = NUM_PCM_FORMATS;
lstrcpyW(aftd->szFormatTag, szPcm);
break;
case 1:
aftd->dwFormatTag = WAVE_FORMAT_ADPCM;
aftd->cbFormatSize = sizeof(ADPCMWAVEFORMAT) + (7 - 1) * sizeof(ADPCMCOEFSET);
aftd->cStandardFormats = NUM_ADPCM_FORMATS;
lstrcpyW(aftd->szFormatTag, szMsAdPcm);
break;
}
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_FormatDetails
*
*/
static LRESULT ADPCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
{
switch (dwQuery)
{
case ACM_FORMATDETAILSF_FORMAT:
if (ADPCM_GetFormatIndex(afd->pwfx) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
break;
case ACM_FORMATDETAILSF_INDEX:
afd->pwfx->wFormatTag = afd->dwFormatTag;
switch (afd->dwFormatTag)
{
case WAVE_FORMAT_PCM:
if (afd->dwFormatIndex >= NUM_PCM_FORMATS) return ACMERR_NOTPOSSIBLE;
afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels;
afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate;
afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits;
/* native MSACM uses a PCMWAVEFORMAT structure, so cbSize is not accessible
* afd->pwfx->cbSize = 0;
*/
afd->pwfx->nBlockAlign =
(afd->pwfx->nChannels * afd->pwfx->wBitsPerSample) / 8;
afd->pwfx->nAvgBytesPerSec =
afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign;
break;
case WAVE_FORMAT_ADPCM:
if (afd->dwFormatIndex >= NUM_ADPCM_FORMATS) return ACMERR_NOTPOSSIBLE;
if (afd->cbwfx < sizeof(ADPCMWAVEFORMAT) + (7 - 1) * sizeof(ADPCMCOEFSET))
return ACMERR_NOTPOSSIBLE;
afd->pwfx->nChannels = ADPCM_Formats[afd->dwFormatIndex].nChannels;
afd->pwfx->nSamplesPerSec = ADPCM_Formats[afd->dwFormatIndex].rate;
afd->pwfx->wBitsPerSample = ADPCM_Formats[afd->dwFormatIndex].nBits;
init_wfx_adpcm((ADPCMWAVEFORMAT*)afd->pwfx);
break;
default:
WARN("Unsupported tag %08lx\n", afd->dwFormatTag);
return MMSYSERR_INVALPARAM;
}
break;
default:
WARN("Unsupported query %08lx\n", dwQuery);
return MMSYSERR_NOTSUPPORTED;
}
afd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CODEC;
afd->szFormat[0] = 0; /* let MSACM format this for us... */
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_FormatSuggest
*
*/
static LRESULT ADPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
{
/* some tests ... */
if (adfs->cbwfxSrc < sizeof(PCMWAVEFORMAT) ||
adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) ||
ADPCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
/* FIXME: should do those tests against the real size (according to format tag */
/* If no suggestion for destination, then copy source value */
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS))
adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC))
adfs->pwfxDst->nSamplesPerSec = adfs->pwfxSrc->nSamplesPerSec;
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE))
{
if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
adfs->pwfxDst->wBitsPerSample = 4;
else
adfs->pwfxDst->wBitsPerSample = 16;
}
if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG))
{
if (adfs->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM)
adfs->pwfxDst->wFormatTag = WAVE_FORMAT_ADPCM;
else
adfs->pwfxDst->wFormatTag = WAVE_FORMAT_PCM;
}
/* check if result is ok */
if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
/* recompute other values */
switch (adfs->pwfxDst->wFormatTag)
{
case WAVE_FORMAT_PCM:
adfs->pwfxDst->nBlockAlign = (adfs->pwfxDst->nChannels * adfs->pwfxDst->wBitsPerSample) / 8;
adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * adfs->pwfxDst->nBlockAlign;
break;
case WAVE_FORMAT_ADPCM:
init_wfx_adpcm((ADPCMWAVEFORMAT*)adfs->pwfxDst);
break;
default:
FIXME("\n");
break;
}
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_Reset
*
*/
static void ADPCM_Reset(PACMDRVSTREAMINSTANCE adsi, AcmAdpcmData* aad)
{
}
/***********************************************************************
* ADPCM_StreamOpen
*
*/
static LRESULT ADPCM_StreamOpen(PACMDRVSTREAMINSTANCE adsi)
{
AcmAdpcmData* aad;
assert(!(adsi->fdwOpen & ACM_STREAMOPENF_ASYNC));
if (ADPCM_GetFormatIndex(adsi->pwfxSrc) == 0xFFFFFFFF ||
ADPCM_GetFormatIndex(adsi->pwfxDst) == 0xFFFFFFFF)
return ACMERR_NOTPOSSIBLE;
aad = HeapAlloc(GetProcessHeap(), 0, sizeof(AcmAdpcmData));
if (aad == 0) return MMSYSERR_NOMEM;
adsi->dwDriver = (DWORD)aad;
if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
goto theEnd;
}
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
/* resampling or mono <=> stereo not available
* ADPCM algo only define 16 bit per sample output
*/
if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec ||
adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels ||
adsi->pwfxDst->wBitsPerSample != 16)
goto theEnd;
#if 0
{
unsigned int nspb = ((IMAADPCMWAVEFORMAT*)adsi->pwfxSrc)->wSamplesPerBlock;
FIXME("spb=%u\n", nspb);
/* we check that in a block, after the header, samples are present on
* 4-sample packet pattern
* we also check that the block alignement is bigger than the expected size
*/
if (((nspb - 1) & 3) != 0) goto theEnd;
if ((((nspb - 1) / 2) + 4) * adsi->pwfxSrc->nChannels < adsi->pwfxSrc->nBlockAlign)
goto theEnd;
}
#endif
/* adpcm decoding... */
if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 2)
aad->convert = cvtSSms16K;
if (adsi->pwfxDst->wBitsPerSample == 16 && adsi->pwfxDst->nChannels == 1)
aad->convert = cvtMMms16K;
}
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_ADPCM)
{
if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec ||
adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels ||
adsi->pwfxSrc->wBitsPerSample != 16)
goto theEnd;
#if 0
nspb = ((IMAADPCMWAVEFORMAT*)adsi->pwfxDst)->wSamplesPerBlock;
FIXME("spb=%u\n", nspb);
/* we check that in a block, after the header, samples are present on
* 4-sample packet pattern
* we also check that the block alignement is bigger than the expected size
*/
if (((nspb - 1) & 3) != 0) goto theEnd;
if ((((nspb - 1) / 2) + 4) * adsi->pwfxDst->nChannels < adsi->pwfxDst->nBlockAlign)
goto theEnd;
#endif
#if 0
/* adpcm coding... */
if (adsi->pwfxSrc->wBitsPerSample == 16 && adsi->pwfxSrc->nChannels == 2)
aad->convert = cvtSS16msK;
if (adsi->pwfxSrc->wBitsPerSample == 16 && adsi->pwfxSrc->nChannels == 1)
aad->convert = cvtMM16msK;
#endif
FIXME("We don't support encoding yet\n");
goto theEnd;
}
else goto theEnd;
ADPCM_Reset(adsi, aad);
return MMSYSERR_NOERROR;
theEnd:
HeapFree(GetProcessHeap(), 0, aad);
adsi->dwDriver = 0L;
return MMSYSERR_NOTSUPPORTED;
}
/***********************************************************************
* ADPCM_StreamClose
*
*/
static LRESULT ADPCM_StreamClose(PACMDRVSTREAMINSTANCE adsi)
{
HeapFree(GetProcessHeap(), 0, (void*)adsi->dwDriver);
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_round
*
*/
static inline DWORD ADPCM_round(DWORD a, DWORD b, DWORD c)
{
assert(a && b && c);
/* to be sure, always return an entire number of c... */
return ((double)a * (double)b + (double)c - 1) / (double)c;
}
/***********************************************************************
* ADPCM_StreamSize
*
*/
static LRESULT ADPCM_StreamSize(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMSIZE adss)
{
switch (adss->fdwSize)
{
case ACM_STREAMSIZEF_DESTINATION:
/* cbDstLength => cbSrcLength */
if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_ADPCM)
{
/* don't take block overhead into account, doesn't matter too much */
adss->cbSrcLength = adss->cbDstLength * 4;
}
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
FIXME("misses the block header overhead\n");
adss->cbSrcLength = 256 + adss->cbDstLength / 4;
}
else
{
return MMSYSERR_NOTSUPPORTED;
}
break;
case ACM_STREAMSIZEF_SOURCE:
/* cbSrcLength => cbDstLength */
if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_ADPCM)
{
FIXME("misses the block header overhead\n");
adss->cbDstLength = 256 + adss->cbSrcLength / 4;
}
else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_ADPCM &&
adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM)
{
/* don't take block overhead into account, doesn't matter too much */
adss->cbDstLength = adss->cbSrcLength * 4;
}
else
{
return MMSYSERR_NOTSUPPORTED;
}
break;
default:
WARN("Unsupported query %08lx\n", adss->fdwSize);
return MMSYSERR_NOTSUPPORTED;
}
return MMSYSERR_NOERROR;
}
/***********************************************************************
* ADPCM_StreamConvert
*
*/
static LRESULT ADPCM_StreamConvert(PACMDRVSTREAMINSTANCE adsi, PACMDRVSTREAMHEADER adsh)
{
AcmAdpcmData* aad = (AcmAdpcmData*)adsi->dwDriver;
DWORD nsrc = adsh->cbSrcLength;
DWORD ndst = adsh->cbDstLength;
if (adsh->fdwConvert &
~(ACM_STREAMCONVERTF_BLOCKALIGN|
ACM_STREAMCONVERTF_END|
ACM_STREAMCONVERTF_START))
{
FIXME("Unsupported fdwConvert (%08lx), ignoring it\n", adsh->fdwConvert);
}
/* ACM_STREAMCONVERTF_BLOCKALIGN
* currently all conversions are block aligned, so do nothing for this flag
* ACM_STREAMCONVERTF_END
* no pending data, so do nothing for this flag
*/
if ((adsh->fdwConvert & ACM_STREAMCONVERTF_START))
{
ADPCM_Reset(adsi, aad);
}
aad->convert(adsi, adsh->pbSrc, &nsrc, adsh->pbDst, &ndst);
adsh->cbSrcLengthUsed = nsrc;
adsh->cbDstLengthUsed = ndst;
return MMSYSERR_NOERROR;
}
/**************************************************************************
* ADPCM_DriverProc [exported]
*/
LRESULT CALLBACK ADPCM_DriverProc(DWORD dwDevID, HDRVR hDriv, UINT wMsg,
LPARAM dwParam1, LPARAM dwParam2)
{
TRACE("(%08lx %08lx %04x %08lx %08lx);\n",
dwDevID, (DWORD)hDriv, wMsg, dwParam1, dwParam2);
switch (wMsg)
{
case DRV_LOAD: return 1;
case DRV_FREE: return 1;
case DRV_OPEN: return ADPCM_drvOpen((LPSTR)dwParam1);
case DRV_CLOSE: return ADPCM_drvClose(dwDevID);
case DRV_ENABLE: return 1;
case DRV_DISABLE: return 1;
case DRV_QUERYCONFIGURE: return 1;
case DRV_CONFIGURE: MessageBoxA(0, "MSACM MS ADPCM filter !", "Wine Driver", MB_OK); return 1;
case DRV_INSTALL: return DRVCNF_RESTART;
case DRV_REMOVE: return DRVCNF_RESTART;
case ACMDM_DRIVER_NOTIFY:
/* no caching from other ACM drivers is done so far */
return MMSYSERR_NOERROR;
case ACMDM_DRIVER_DETAILS:
return ADPCM_DriverDetails((PACMDRIVERDETAILSW)dwParam1);
case ACMDM_FORMATTAG_DETAILS:
return ADPCM_FormatTagDetails((PACMFORMATTAGDETAILSW)dwParam1, dwParam2);
case ACMDM_FORMAT_DETAILS:
return ADPCM_FormatDetails((PACMFORMATDETAILSW)dwParam1, dwParam2);
case ACMDM_FORMAT_SUGGEST:
return ADPCM_FormatSuggest((PACMDRVFORMATSUGGEST)dwParam1);
case ACMDM_STREAM_OPEN:
return ADPCM_StreamOpen((PACMDRVSTREAMINSTANCE)dwParam1);
case ACMDM_STREAM_CLOSE:
return ADPCM_StreamClose((PACMDRVSTREAMINSTANCE)dwParam1);
case ACMDM_STREAM_SIZE:
return ADPCM_StreamSize((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMSIZE)dwParam2);
case ACMDM_STREAM_CONVERT:
return ADPCM_StreamConvert((PACMDRVSTREAMINSTANCE)dwParam1, (PACMDRVSTREAMHEADER)dwParam2);
case ACMDM_HARDWARE_WAVE_CAPS_INPUT:
case ACMDM_HARDWARE_WAVE_CAPS_OUTPUT:
/* this converter is not a hardware driver */
case ACMDM_FILTERTAG_DETAILS:
case ACMDM_FILTER_DETAILS:
/* this converter is not a filter */
case ACMDM_STREAM_RESET:
/* only needed for asynchronous driver... we aren't, so just say it */
return MMSYSERR_NOTSUPPORTED;
case ACMDM_STREAM_PREPARE:
case ACMDM_STREAM_UNPREPARE:
/* nothing special to do here... so don't do anything */
return MMSYSERR_NOERROR;
default:
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
}
return 0;
}

File diff suppressed because it is too large Load diff

478
reactos/dll/msacm/stream.c Normal file
View file

@ -0,0 +1,478 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* MSACM32 library
*
* Copyright 1998 Patrik Stridvall
* 1999 Eric Pouech
*
* 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
*/
/* TODO
* + asynchronous conversion is not implemented
* + callback/notification
* * acmStreamMessage
* + properly close ACM streams
*/
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/debug.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
#include "msacmdrv.h"
#include "wineacm.h"
WINE_DEFAULT_DEBUG_CHANNEL(msacm);
static PWINE_ACMSTREAM ACM_GetStream(HACMSTREAM has)
{
TRACE("(%p)\n", has);
return (PWINE_ACMSTREAM)has;
}
/***********************************************************************
* acmStreamClose (MSACM32.@)
*/
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
{
PWINE_ACMSTREAM was;
MMRESULT ret;
TRACE("(%p, %ld)\n", has, fdwClose);
if ((was = ACM_GetStream(has)) == NULL) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CLOSE, (DWORD)&was->drvInst, 0);
if (ret == MMSYSERR_NOERROR) {
if (was->hAcmDriver)
acmDriverClose(was->hAcmDriver, 0L);
HeapFree(MSACM_hHeap, 0, was);
}
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamConvert (MSACM32.@)
*/
MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash,
DWORD fdwConvert)
{
PWINE_ACMSTREAM was;
MMRESULT ret = MMSYSERR_NOERROR;
PACMDRVSTREAMHEADER padsh;
TRACE("(%p, %p, %ld)\n", has, pash, fdwConvert);
if ((was = ACM_GetStream(has)) == NULL) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED)) {
WARN("unprepared header\n");
return ACMERR_UNPREPARED;
}
/* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
* size. some fields are private to msacm internals, and are exposed
* in ACMSTREAMHEADER in the dwReservedDriver array
*/
padsh = (PACMDRVSTREAMHEADER)pash;
/* check that pointers have not been modified */
if (padsh->pbPreparedSrc != padsh->pbSrc ||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
padsh->pbPreparedDst != padsh->pbDst ||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
padsh->fdwConvert = fdwConvert;
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_CONVERT, (DWORD)&was->drvInst, (DWORD)padsh);
if (ret == MMSYSERR_NOERROR) {
padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_DONE;
}
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamMessage (MSACM32.@)
*/
MMRESULT WINAPI acmStreamMessage(HACMSTREAM has, UINT uMsg, LPARAM lParam1,
LPARAM lParam2)
{
FIXME("(%p, %u, %ld, %ld): stub\n", has, uMsg, lParam1, lParam2);
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return MMSYSERR_ERROR;
}
/***********************************************************************
* acmStreamOpen (MSACM32.@)
*/
MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc,
PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD dwCallback,
DWORD dwInstance, DWORD fdwOpen)
{
PWINE_ACMSTREAM was;
PWINE_ACMDRIVER wad;
MMRESULT ret;
int wfxSrcSize;
int wfxDstSize;
WAVEFORMATEX wfxSrc, wfxDst;
TRACE("(%p, %p, %p, %p, %p, %ld, %ld, %ld)\n",
phas, had, pwfxSrc, pwfxDst, pwfltr, dwCallback, dwInstance, fdwOpen);
/* NOTE: pwfxSrc and/or pwfxDst can point to a structure smaller than
* WAVEFORMATEX so don't use them directly when not sure */
if (pwfxSrc->wFormatTag == WAVE_FORMAT_PCM) {
memcpy(&wfxSrc, pwfxSrc, sizeof(PCMWAVEFORMAT));
wfxSrc.wBitsPerSample = pwfxSrc->wBitsPerSample;
wfxSrc.cbSize = 0;
pwfxSrc = &wfxSrc;
}
if (pwfxDst->wFormatTag == WAVE_FORMAT_PCM) {
memcpy(&wfxDst, pwfxDst, sizeof(PCMWAVEFORMAT));
wfxDst.wBitsPerSample = pwfxDst->wBitsPerSample;
wfxDst.cbSize = 0;
pwfxDst = &wfxDst;
}
TRACE("src [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n",
pwfxSrc->wFormatTag, pwfxSrc->nChannels, pwfxSrc->nSamplesPerSec, pwfxSrc->nAvgBytesPerSec,
pwfxSrc->nBlockAlign, pwfxSrc->wBitsPerSample, pwfxSrc->cbSize);
TRACE("dst [wFormatTag=%u, nChannels=%u, nSamplesPerSec=%lu, nAvgBytesPerSec=%lu, nBlockAlign=%u, wBitsPerSample=%u, cbSize=%u]\n",
pwfxDst->wFormatTag, pwfxDst->nChannels, pwfxDst->nSamplesPerSec, pwfxDst->nAvgBytesPerSec,
pwfxDst->nBlockAlign, pwfxDst->wBitsPerSample, pwfxDst->cbSize);
/* (WS) In query mode, phas should be NULL. If it is not, then instead
* of returning an error we are making sure it is NULL, preventing some
* applications that pass garbage for phas from crashing.
*/
if (fdwOpen & ACM_STREAMOPENF_QUERY) phas = NULL;
if (pwfltr && (pwfxSrc->wFormatTag != pwfxDst->wFormatTag)) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
wfxSrcSize = wfxDstSize = sizeof(WAVEFORMATEX);
if (pwfxSrc->wFormatTag != WAVE_FORMAT_PCM) wfxSrcSize += pwfxSrc->cbSize;
if (pwfxDst->wFormatTag != WAVE_FORMAT_PCM) wfxDstSize += pwfxDst->cbSize;
was = HeapAlloc(MSACM_hHeap, 0, sizeof(*was) + wfxSrcSize + wfxDstSize +
((pwfltr) ? sizeof(WAVEFILTER) : 0));
if (was == NULL) {
WARN("no memory\n");
return MMSYSERR_NOMEM;
}
was->drvInst.cbStruct = sizeof(was->drvInst);
was->drvInst.pwfxSrc = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was));
memcpy(was->drvInst.pwfxSrc, pwfxSrc, wfxSrcSize);
was->drvInst.pwfxDst = (PWAVEFORMATEX)((LPSTR)was + sizeof(*was) + wfxSrcSize);
memcpy(was->drvInst.pwfxDst, pwfxDst, wfxDstSize);
if (pwfltr) {
was->drvInst.pwfltr = (PWAVEFILTER)((LPSTR)was + sizeof(*was) + wfxSrcSize + wfxDstSize);
memcpy(was->drvInst.pwfltr, pwfltr, sizeof(WAVEFILTER));
} else {
was->drvInst.pwfltr = NULL;
}
was->drvInst.dwCallback = dwCallback;
was->drvInst.dwInstance = dwInstance;
was->drvInst.fdwOpen = fdwOpen;
was->drvInst.fdwDriver = 0L;
was->drvInst.dwDriver = 0L;
/* real value will be stored once ACMDM_STREAM_OPEN succeeds */
was->drvInst.has = 0L;
if (had) {
if (!(wad = MSACM_GetDriver(had))) {
ret = MMSYSERR_INVALPARAM;
goto errCleanUp;
}
was->obj.dwType = WINE_ACMOBJ_STREAM;
was->obj.pACMDriverID = wad->obj.pACMDriverID;
was->pDrv = wad;
was->hAcmDriver = 0; /* not to close it in acmStreamClose */
ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
if (ret != MMSYSERR_NOERROR)
goto errCleanUp;
} else {
PWINE_ACMDRIVERID wadi;
ret = ACMERR_NOTPOSSIBLE;
for (wadi = MSACM_pFirstACMDriverID; wadi; wadi = wadi->pNextACMDriverID) {
if ((wadi->fdwSupport & ACMDRIVERDETAILS_SUPPORTF_DISABLED) ||
!MSACM_FindFormatTagInCache(wadi, pwfxSrc->wFormatTag, NULL) ||
!MSACM_FindFormatTagInCache(wadi, pwfxDst->wFormatTag, NULL))
continue;
ret = acmDriverOpen(&had, (HACMDRIVERID)wadi, 0L);
if (ret != MMSYSERR_NOERROR)
continue;
if ((wad = MSACM_GetDriver(had)) != 0) {
was->obj.dwType = WINE_ACMOBJ_STREAM;
was->obj.pACMDriverID = wad->obj.pACMDriverID;
was->pDrv = wad;
was->hAcmDriver = had;
ret = SendDriverMessage(wad->hDrvr, ACMDM_STREAM_OPEN, (DWORD)&was->drvInst, 0L);
TRACE("%s => %08x\n", debugstr_w(wadi->pszDriverAlias), ret);
if (ret == MMSYSERR_NOERROR) {
if (fdwOpen & ACM_STREAMOPENF_QUERY) {
acmDriverClose(had, 0L);
}
break;
}
}
/* no match, close this acm driver and try next one */
acmDriverClose(had, 0L);
}
if (ret != MMSYSERR_NOERROR) {
ret = ACMERR_NOTPOSSIBLE;
goto errCleanUp;
}
}
ret = MMSYSERR_NOERROR;
was->drvInst.has = (HACMSTREAM)was;
if (!(fdwOpen & ACM_STREAMOPENF_QUERY)) {
if (phas)
*phas = (HACMSTREAM)was;
TRACE("=> (%d)\n", ret);
return ret;
}
errCleanUp:
if (phas)
*phas = NULL;
HeapFree(MSACM_hHeap, 0, was);
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamPrepareHeader (MSACM32.@)
*/
MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
DWORD fdwPrepare)
{
PWINE_ACMSTREAM was;
MMRESULT ret = MMSYSERR_NOERROR;
PACMDRVSTREAMHEADER padsh;
TRACE("(%p, %p, %ld)\n", has, pash, fdwPrepare);
if ((was = ACM_GetStream(has)) == NULL) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
if (fdwPrepare)
ret = MMSYSERR_INVALFLAG;
if (pash->fdwStatus & ACMSTREAMHEADER_STATUSF_DONE)
return MMSYSERR_NOERROR;
/* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
* size. some fields are private to msacm internals, and are exposed
* in ACMSTREAMHEADER in the dwReservedDriver array
*/
padsh = (PACMDRVSTREAMHEADER)pash;
padsh->fdwConvert = fdwPrepare;
padsh->padshNext = NULL;
padsh->fdwDriver = padsh->dwDriver = 0L;
padsh->fdwPrepared = 0;
padsh->dwPrepared = 0;
padsh->pbPreparedSrc = 0;
padsh->cbPreparedSrcLength = 0;
padsh->pbPreparedDst = 0;
padsh->cbPreparedDstLength = 0;
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_PREPARE, (DWORD)&was->drvInst, (DWORD)padsh);
if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) {
ret = MMSYSERR_NOERROR;
padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE);
padsh->fdwStatus |= ACMSTREAMHEADER_STATUSF_PREPARED;
padsh->fdwPrepared = padsh->fdwStatus;
padsh->dwPrepared = 0;
padsh->pbPreparedSrc = padsh->pbSrc;
padsh->cbPreparedSrcLength = padsh->cbSrcLength;
padsh->pbPreparedDst = padsh->pbDst;
padsh->cbPreparedDstLength = padsh->cbDstLength;
} else {
padsh->fdwPrepared = 0;
padsh->dwPrepared = 0;
padsh->pbPreparedSrc = 0;
padsh->cbPreparedSrcLength = 0;
padsh->pbPreparedDst = 0;
padsh->cbPreparedDstLength = 0;
}
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamReset (MSACM32.@)
*/
MMRESULT WINAPI acmStreamReset(HACMSTREAM has, DWORD fdwReset)
{
PWINE_ACMSTREAM was;
MMRESULT ret = MMSYSERR_NOERROR;
TRACE("(%p, %ld)\n", has, fdwReset);
if (fdwReset) {
WARN("invalid flag\n");
ret = MMSYSERR_INVALFLAG;
} else if ((was = ACM_GetStream(has)) == NULL) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
} else if (was->drvInst.fdwOpen & ACM_STREAMOPENF_ASYNC) {
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_RESET, (DWORD)&was->drvInst, 0);
}
TRACE("=> (%d)\n", ret);
return ret;
}
/***********************************************************************
* acmStreamSize (MSACM32.@)
*/
MMRESULT WINAPI acmStreamSize(HACMSTREAM has, DWORD cbInput,
LPDWORD pdwOutputBytes, DWORD fdwSize)
{
PWINE_ACMSTREAM was;
ACMDRVSTREAMSIZE adss;
MMRESULT ret;
TRACE("(%p, %ld, %p, %ld)\n", has, cbInput, pdwOutputBytes, fdwSize);
if ((was = ACM_GetStream(has)) == NULL) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
if ((fdwSize & ~ACM_STREAMSIZEF_QUERYMASK) != 0) {
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
*pdwOutputBytes = 0L;
switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) {
case ACM_STREAMSIZEF_DESTINATION:
adss.cbDstLength = cbInput;
adss.cbSrcLength = 0;
break;
case ACM_STREAMSIZEF_SOURCE:
adss.cbSrcLength = cbInput;
adss.cbDstLength = 0;
break;
default:
WARN("invalid flag\n");
return MMSYSERR_INVALFLAG;
}
adss.cbStruct = sizeof(adss);
adss.fdwSize = fdwSize;
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_SIZE,
(DWORD)&was->drvInst, (DWORD)&adss);
if (ret == MMSYSERR_NOERROR) {
switch (fdwSize & ACM_STREAMSIZEF_QUERYMASK) {
case ACM_STREAMSIZEF_DESTINATION:
*pdwOutputBytes = adss.cbSrcLength;
break;
case ACM_STREAMSIZEF_SOURCE:
*pdwOutputBytes = adss.cbDstLength;
break;
}
}
TRACE("=> (%d) [%lu]\n", ret, *pdwOutputBytes);
return ret;
}
/***********************************************************************
* acmStreamUnprepareHeader (MSACM32.@)
*/
MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash,
DWORD fdwUnprepare)
{
PWINE_ACMSTREAM was;
MMRESULT ret = MMSYSERR_NOERROR;
PACMDRVSTREAMHEADER padsh;
TRACE("(%p, %p, %ld)\n", has, pash, fdwUnprepare);
if ((was = ACM_GetStream(has)) == NULL) {
WARN("invalid handle\n");
return MMSYSERR_INVALHANDLE;
}
if (!pash || pash->cbStruct < sizeof(ACMSTREAMHEADER)) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
if (!(pash->fdwStatus & ACMSTREAMHEADER_STATUSF_PREPARED)) {
WARN("unprepared header\n");
return ACMERR_UNPREPARED;
}
/* Note: the ACMSTREAMHEADER and ACMDRVSTREAMHEADER structs are of same
* size. some fields are private to msacm internals, and are exposed
* in ACMSTREAMHEADER in the dwReservedDriver array
*/
padsh = (PACMDRVSTREAMHEADER)pash;
/* check that pointers have not been modified */
if (padsh->pbPreparedSrc != padsh->pbSrc ||
padsh->cbPreparedSrcLength < padsh->cbSrcLength ||
padsh->pbPreparedDst != padsh->pbDst ||
padsh->cbPreparedDstLength < padsh->cbDstLength) {
WARN("invalid parameter\n");
return MMSYSERR_INVALPARAM;
}
padsh->fdwConvert = fdwUnprepare;
ret = SendDriverMessage(was->pDrv->hDrvr, ACMDM_STREAM_UNPREPARE, (DWORD)&was->drvInst, (DWORD)padsh);
if (ret == MMSYSERR_NOERROR || ret == MMSYSERR_NOTSUPPORTED) {
ret = MMSYSERR_NOERROR;
padsh->fdwStatus &= ~(ACMSTREAMHEADER_STATUSF_DONE|ACMSTREAMHEADER_STATUSF_INQUEUE|ACMSTREAMHEADER_STATUSF_PREPARED);
}
TRACE("=> (%d)\n", ret);
return ret;
}

363
reactos/dll/msacm/wineacm.h Normal file
View file

@ -0,0 +1,363 @@
/* -*- tab-width: 8; c-basic-offset: 4 -*- */
/*
* Copyright 2000 Eric Pouech
*
* 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
*/
#ifndef __WINE_WINEACM_H
#define __WINE_WINEACM_H
#ifndef __REACTOS__
#include "wine/windef16.h"
//#include "wine/mmsystem16.h"
/***********************************************************************
* Win16 definitions
*/
typedef BOOL16 (CALLBACK *ACMDRIVERENUMCB16)(
HACMDRIVERID16 hadid, DWORD dwInstance, DWORD fdwSupport
);
typedef UINT (CALLBACK *ACMFILTERCHOOSEHOOKPROC16)(
HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
);
typedef UINT16 (CALLBACK *ACMFORMATCHOOSEHOOKPROC16)(
HWND16 hwnd, UINT16 uMsg, WPARAM16 wParam, LPARAM lParam
);
typedef struct _ACMDRIVERDETAILS16
{
DWORD cbStruct;
FOURCC fccType;
FOURCC fccComp;
WORD wMid;
WORD wPid;
DWORD vdwACM;
DWORD vdwDriver;
DWORD fdwSupport;
DWORD cFormatTags;
DWORD cFilterTags;
HICON16 hicon;
CHAR szShortName[ACMDRIVERDETAILS_SHORTNAME_CHARS];
CHAR szLongName[ACMDRIVERDETAILS_LONGNAME_CHARS];
CHAR szCopyright[ACMDRIVERDETAILS_COPYRIGHT_CHARS];
CHAR szLicensing[ACMDRIVERDETAILS_LICENSING_CHARS];
CHAR szFeatures[ACMDRIVERDETAILS_FEATURES_CHARS];
} ACMDRIVERDETAILS16, *NPACMDRIVERDETAILS16, *LPACMDRIVERDETAILS16;
typedef struct _ACMFILTERCHOOSE16
{
DWORD cbStruct;
DWORD fdwStyle;
HWND16 hwndOwner;
LPWAVEFILTER pwfltr;
DWORD cbwfltr;
LPCSTR pszTitle;
char szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
char szFilter[ACMFILTERDETAILS_FILTER_CHARS];
LPSTR pszName;
DWORD cchName;
DWORD fdwEnum;
LPWAVEFILTER pwfltrEnum;
HINSTANCE16 hInstance;
LPCSTR pszTemplateName;
LPARAM lCustData;
ACMFILTERCHOOSEHOOKPROC16 pfnHook;
} ACMFILTERCHOOSE16, *NPACMFILTERCHOOSE16, *LPACMFILTERCHOOSE16;
typedef struct _ACMFILTERDETAILS16
{
DWORD cbStruct;
DWORD dwFilterIndex;
DWORD dwFilterTag;
DWORD fdwSupport;
LPWAVEFILTER pwfltr;
DWORD cbwfltr;
CHAR szFilter[ACMFILTERDETAILS_FILTER_CHARS];
} ACMFILTERDETAILS16, *NPACMFILTERDETAILS16, *LPACMFILTERDETAILS16;
typedef struct _ACMFILTERTAGDETAILS16
{
DWORD cbStruct;
DWORD dwFilterTagIndex;
DWORD dwFilterTag;
DWORD cbFilterSize;
DWORD fdwSupport;
DWORD cStandardFilters;
CHAR szFilterTag[ACMFILTERTAGDETAILS_FILTERTAG_CHARS];
} ACMFILTERTAGDETAILS16, *NPACMFILTERTAGDETAILS16, *LPACMFILTERTAGDETAILS16;
typedef struct _ACMFORMATCHOOSE16
{
DWORD cbStruct;
DWORD fdwStyle;
HWND16 hwndOwner;
LPWAVEFORMATEX pwfx;
DWORD cbwfx;
LPCSTR pszTitle;
CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
LPSTR pszName;
DWORD cchName;
DWORD fdwEnum;
LPWAVEFORMATEX pwfxEnum;
HINSTANCE16 hInstance;
LPCSTR pszTemplateName;
LPARAM lCustData;
ACMFORMATCHOOSEHOOKPROC16 pfnHook;
} ACMFORMATCHOOSE16, *NPACMFORMATCHOOSE16, *LPACMFORMATCHOOSE16;
typedef struct _ACMFORMATDETAILS16
{
DWORD cbStruct;
DWORD dwFormatIndex;
DWORD dwFormatTag;
DWORD fdwSupport;
LPWAVEFORMATEX pwfx;
DWORD cbwfx;
CHAR szFormat[ACMFORMATDETAILS_FORMAT_CHARS];
} ACMFORMATDETAILS16, *NPACMFORMATDETAILS16, *LPACMFORMATDETAILS16;
typedef struct _ACMFORMATTAGDETAILS16
{
DWORD cbStruct;
DWORD dwFormatTagIndex;
DWORD dwFormatTag;
DWORD cbFormatSize;
DWORD fdwSupport;
DWORD cStandardFormats;
CHAR szFormatTag[ACMFORMATTAGDETAILS_FORMATTAG_CHARS];
} ACMFORMATTAGDETAILS16, *NPACMFORMATTAGDETAILS16, *LPACMFORMATTAGDETAILS16;
typedef ACMSTREAMHEADER ACMSTREAMHEADER16, *NPACMSTREAMHEADER16, *LPACMSTREAMHEADER16;
typedef BOOL16 (CALLBACK *ACMFILTERENUMCB16)(
HACMDRIVERID16 hadid, LPACMFILTERDETAILS16 pafd,
DWORD dwInstance, DWORD fdwSupport
);
typedef BOOL16 (CALLBACK *ACMFILTERTAGENUMCB16)(
HACMDRIVERID16 hadid, LPACMFILTERTAGDETAILS16 paftd,
DWORD dwInstance, DWORD fdwSupport
);
typedef BOOL16 (CALLBACK *ACMFORMATENUMCB16)(
HACMDRIVERID16 hadid, LPACMFORMATDETAILS16 pafd,
DWORD dwInstance, DWORD fdwSupport
);
typedef BOOL16 (CALLBACK *ACMFORMATTAGENUMCB16)(
HACMDRIVERID16 hadid, LPACMFORMATTAGDETAILS16 paftd,
DWORD dwInstance, DWORD fdwSupport
);
/***********************************************************************
* Functions - Win16
*/
DWORD WINAPI acmGetVersion16(
);
MMRESULT16 WINAPI acmMetrics16(
HACMOBJ16 hao, UINT16 uMetric, LPVOID pMetric
);
MMRESULT16 WINAPI acmDriverEnum16(
ACMDRIVERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
);
MMRESULT16 WINAPI acmDriverDetails16(
HACMDRIVERID16 hadid, LPACMDRIVERDETAILS16 padd, DWORD fdwDetails
);
MMRESULT16 WINAPI acmDriverAdd16(
LPHACMDRIVERID16 phadid, HINSTANCE16 hinstModule,
LPARAM lParam, DWORD dwPriority, DWORD fdwAdd
);
MMRESULT16 WINAPI acmDriverRemove16(
HACMDRIVERID16 hadid, DWORD fdwRemove
);
MMRESULT16 WINAPI acmDriverOpen16(
LPHACMDRIVER16 phad, HACMDRIVERID16 hadid, DWORD fdwOpen
);
MMRESULT16 WINAPI acmDriverClose16(
HACMDRIVER16 had, DWORD fdwClose
);
LRESULT WINAPI acmDriverMessage16(
HACMDRIVER16 had, UINT16 uMsg, LPARAM lParam1, LPARAM lParam2
);
MMRESULT16 WINAPI acmDriverID16(
HACMOBJ16 hao, LPHACMDRIVERID16 phadid, DWORD fdwDriverID
);
MMRESULT16 WINAPI acmDriverPriority16(
HACMDRIVERID16 hadid, DWORD dwPriority, DWORD fdwPriority
);
MMRESULT16 WINAPI acmFormatTagDetails16(
HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd, DWORD fdwDetails
);
MMRESULT16 WINAPI acmFormatTagEnum16(
HACMDRIVER16 had, LPACMFORMATTAGDETAILS16 paftd,
ACMFORMATTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
);
MMRESULT16 WINAPI acmFormatChoose16(
LPACMFORMATCHOOSE16 pafmtc
);
MMRESULT16 WINAPI acmFormatDetails16(
HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd, DWORD fdwDetails
);
MMRESULT16 WINAPI acmFormatEnum16(
HACMDRIVER16 had, LPACMFORMATDETAILS16 pafd,
ACMFORMATENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
);
MMRESULT16 WINAPI acmFormatSuggest16(
HACMDRIVER16 had, LPWAVEFORMATEX pwfxSrc,
LPWAVEFORMATEX pwfxDst, DWORD cbwfxDst, DWORD fdwSuggest
);
MMRESULT16 WINAPI acmFilterTagDetails16(
HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd, DWORD fdwDetails
);
MMRESULT16 WINAPI acmFilterTagEnum16(
HACMDRIVER16 had, LPACMFILTERTAGDETAILS16 paftd,
ACMFILTERTAGENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
);
MMRESULT16 WINAPI acmFilterChoose16(
LPACMFILTERCHOOSE16 pafltrc
);
MMRESULT16 WINAPI acmFilterDetails16(
HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd, DWORD fdwDetails
);
MMRESULT16 WINAPI acmFilterEnum16(
HACMDRIVER16 had, LPACMFILTERDETAILS16 pafd,
ACMFILTERENUMCB16 fnCallback, DWORD dwInstance, DWORD fdwEnum
);
MMRESULT16 WINAPI acmStreamOpen16(
LPHACMSTREAM16 phas, HACMDRIVER16 had,
LPWAVEFORMATEX pwfxSrc, LPWAVEFORMATEX pwfxDst,
LPWAVEFILTER pwfltr, DWORD dwCallback,
DWORD dwInstance, DWORD fdwOpen
);
MMRESULT16 WINAPI acmStreamClose16(
HACMSTREAM16 has, DWORD fdwClose
);
MMRESULT16 WINAPI acmStreamSize16(
HACMSTREAM16 has, DWORD cbInput,
LPDWORD pdwOutputBytes, DWORD fdwSize
);
MMRESULT16 WINAPI acmStreamConvert16(
HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwConvert
);
MMRESULT16 WINAPI acmStreamReset16(
HACMSTREAM16 has, DWORD fdwReset
);
MMRESULT16 WINAPI acmStreamPrepareHeader16(
HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwPrepare
);
MMRESULT16 WINAPI acmStreamUnprepareHeader16(
HACMSTREAM16 has, LPACMSTREAMHEADER16 pash, DWORD fdwUnprepare
);
#endif
/***********************************************************************
* Wine specific - Win32
*/
typedef struct _WINE_ACMDRIVERID *PWINE_ACMDRIVERID;
typedef struct _WINE_ACMDRIVER *PWINE_ACMDRIVER;
#define WINE_ACMOBJ_DONTCARE 0x5EED0000
#define WINE_ACMOBJ_DRIVERID 0x5EED0001
#define WINE_ACMOBJ_DRIVER 0x5EED0002
#define WINE_ACMOBJ_STREAM 0x5EED0003
typedef struct _WINE_ACMOBJ
{
DWORD dwType;
PWINE_ACMDRIVERID pACMDriverID;
} WINE_ACMOBJ, *PWINE_ACMOBJ;
typedef struct _WINE_ACMDRIVER
{
WINE_ACMOBJ obj;
HDRVR hDrvr;
PWINE_ACMDRIVER pNextACMDriver;
} WINE_ACMDRIVER;
typedef struct _WINE_ACMSTREAM
{
WINE_ACMOBJ obj;
PWINE_ACMDRIVER pDrv;
ACMDRVSTREAMINSTANCE drvInst;
HACMDRIVER hAcmDriver;
} WINE_ACMSTREAM, *PWINE_ACMSTREAM;
typedef struct _WINE_ACMDRIVERID
{
WINE_ACMOBJ obj;
LPWSTR pszDriverAlias;
LPWSTR pszFileName;
HINSTANCE hInstModule; /* NULL if global */
PWINE_ACMDRIVER pACMDriverList;
PWINE_ACMDRIVERID pNextACMDriverID;
PWINE_ACMDRIVERID pPrevACMDriverID;
/* information about the driver itself, either gotten from registry or driver itself */
DWORD cFilterTags;
DWORD cFormatTags;
DWORD fdwSupport;
struct {
DWORD dwFormatTag;
DWORD cbwfx;
}* aFormatTag;
} WINE_ACMDRIVERID;
/* From internal.c */
extern HANDLE MSACM_hHeap;
extern PWINE_ACMDRIVERID MSACM_pFirstACMDriverID;
extern PWINE_ACMDRIVERID MSACM_pLastACMDriverID;
extern PWINE_ACMDRIVERID MSACM_RegisterDriver(LPCWSTR pszDriverAlias, LPCWSTR pszFileName,
HINSTANCE hinstModule);
extern void MSACM_RegisterAllDrivers(void);
extern PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p);
extern void MSACM_UnregisterAllDrivers(void);
extern PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID);
extern PWINE_ACMDRIVER MSACM_GetDriver(HACMDRIVER hDriver);
extern PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type);
extern MMRESULT MSACM_Message(HACMDRIVER, UINT, LPARAM, LPARAM);
extern BOOL MSACM_FindFormatTagInCache(WINE_ACMDRIVERID*, DWORD, LPDWORD);
/* From msacm32.c */
extern HINSTANCE MSACM_hInstance32;
/* From pcmcnvtr.c */
LRESULT CALLBACK PCM_DriverProc(DWORD dwDevID, HDRVR hDriv, UINT wMsg,
LPARAM dwParam1, LPARAM dwParam2);
/* Dialog box templates */
#include "msacmdlg.h"
#endif /* __WINE_WINEACM_H */

View file

@ -0,0 +1,67 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Ancillary Function Driver DLL
* FILE: include/debug.h
* PURPOSE: Debugging support macros
* DEFINES: DBG - Enable debug output
* NASSERT - Disable assertions
*/
#ifndef __DEBUG_H
#define __DEBUG_H
#define NORMAL_MASK 0x000000FF
#define SPECIAL_MASK 0xFFFFFF00
#define MIN_TRACE 0x00000001
#define MID_TRACE 0x00000002
#define MAX_TRACE 0x00000003
#define DEBUG_CHECK 0x00000100
#define DEBUG_ULTRA 0xFFFFFFFF
#ifdef ASSERT
#undef ASSERT
#endif
#ifdef DBG
extern DWORD DebugTraceLevel;
#define AFD_DbgPrint(_t_, _x_) \
if (((DebugTraceLevel & NORMAL_MASK) >= _t_) || \
((DebugTraceLevel & _t_) > NORMAL_MASK)) { \
DbgPrint("(%hS:%d)(%hS) ", __FILE__, __LINE__, __FUNCTION__); \
DbgPrint _x_; \
}
#ifdef NASSERT
#define ASSERT(x)
#else /* NASSERT */
#define ASSERT(x) if (!(x)) { AFD_DbgPrint(MIN_TRACE, ("Assertion "#x" failed at %s:%d\n", __FILE__, __LINE__)); ExitProcess(0); }
#endif /* NASSERT */
#else /* DBG */
#define AFD_DbgPrint(_t_, _x_)
#define ASSERT_IRQL(x)
#define ASSERT(x)
#endif /* DBG */
#ifdef assert
#undef assert
#endif
#define assert(x) ASSERT(x)
#define UNIMPLEMENTED \
AFD_DbgPrint(MIN_TRACE, ("is unimplemented, please try again later.\n"));
#define CHECKPOINT \
AFD_DbgPrint(DEBUG_CHECK, ("\n"));
#define CP CHECKPOINT
#endif /* __DEBUG_H */
/* EOF */

View file

@ -0,0 +1,73 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Ancillary Function Driver DLL
* FILE: include/helpers.h
* PURPOSE: Definitions for helper DLL management
*/
#ifndef __HELPERS_H
#define __HELPERS_H
//#include <msafd.h>
typedef struct _HELPER_DATA {
LIST_ENTRY Helpers;
LONG RefCount;
HANDLE hInstance;
INT MinWSAddressLength;
INT MaxWSAddressLength;
INT MinTDIAddressLength;
INT MaxTDIAddressLength;
BOOLEAN UseDelayedAcceptance;
PWINSOCK_MAPPING Mapping;
PWSH_OPEN_SOCKET WSHOpenSocket;
PWSH_OPEN_SOCKET2 WSHOpenSocket2;
PWSH_JOIN_LEAF WSHJoinLeaf;
PWSH_NOTIFY WSHNotify;
PWSH_GET_SOCKET_INFORMATION WSHGetSocketInformation;
PWSH_SET_SOCKET_INFORMATION WSHSetSocketInformation;
PWSH_GET_SOCKADDR_TYPE WSHGetSockaddrType;
PWSH_GET_WILDCARD_SOCKEADDR WSHGetWildcardSockaddr;
PWSH_GET_BROADCAST_SOCKADDR WSHGetBroadcastSockaddr;
PWSH_ADDRESS_TO_STRING WSHAddressToString;
PWSH_STRING_TO_ADDRESS WSHStringToAddress;
PWSH_IOCTL WSHIoctl;
WCHAR TransportName[1];
} HELPER_DATA, *PHELPER_DATA;
int SockLoadHelperDll(
PWSTR TransportName,
PWINSOCK_MAPPING Mapping,
PHELPER_DATA *HelperDllData
);
int SockLoadTransportMapping(
PWSTR TransportName,
PWINSOCK_MAPPING *Mapping
);
int SockLoadTransportList(
PWSTR *TransportList
);
BOOL SockIsTripleInMapping(
PWINSOCK_MAPPING Mapping,
INT AddressFamily,
INT SocketType,
INT Protocol
);
int SockGetTdiName(
PINT AddressFamily,
PINT SocketType,
PINT Protocol,
GROUP Group,
DWORD Flags,
PUNICODE_STRING TransportName,
PVOID *HelperDllContext,
PHELPER_DATA *HelperDllData,
PDWORD Events
);
#endif /* __HELPERS_H */
/* EOF */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,229 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Ancillary Function Driver DLL
* FILE: misc/event.c
* PURPOSE: Event handling
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Alex Ionescu (alex@relsoft.net)
* REVISIONS:
* CSH 15/06-2001 Created
* Alex 16/07/2004 - Complete Rewrite
*/
#include <msafd.h>
#include <debug.h>
int
WSPAPI
WSPEventSelect(
SOCKET Handle,
WSAEVENT hEventObject,
long lNetworkEvents,
LPINT lpErrno)
{
IO_STATUS_BLOCK IOSB;
AFD_EVENT_SELECT_INFO EventSelectInfo;
PSOCKET_INFORMATION Socket = NULL;
NTSTATUS Status;
ULONG BlockMode;
HANDLE SockEvent;
Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE,
NULL, 1, FALSE );
if( !NT_SUCCESS(Status) ) return -1;
/* Get the Socket Structure associate to this Socket*/
Socket = GetSocketStructure(Handle);
/* Set Socket to Non-Blocking */
BlockMode = 1;
SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL);
Socket->SharedData.NonBlocking = TRUE;
/* Deactivate Async Select if there is one */
if (Socket->EventObject) {
Socket->SharedData.hWnd = NULL;
Socket->SharedData.wMsg = 0;
Socket->SharedData.AsyncEvents = 0;
Socket->SharedData.SequenceNumber++; // This will kill Async Select after the next completion
}
/* Set Structure Info */
EventSelectInfo.EventObject = hEventObject;
EventSelectInfo.Events = 0;
/* Set Events to wait for */
if (lNetworkEvents & FD_READ) {
EventSelectInfo.Events |= AFD_EVENT_RECEIVE;
}
if (lNetworkEvents & FD_WRITE) {
EventSelectInfo.Events |= AFD_EVENT_SEND;
}
if (lNetworkEvents & FD_OOB) {
EventSelectInfo.Events |= AFD_EVENT_OOB_RECEIVE;
}
if (lNetworkEvents & FD_ACCEPT) {
EventSelectInfo.Events |= AFD_EVENT_ACCEPT;
}
if (lNetworkEvents & FD_CONNECT) {
EventSelectInfo.Events |= AFD_EVENT_CONNECT | AFD_EVENT_CONNECT_FAIL;
}
if (lNetworkEvents & FD_CLOSE) {
EventSelectInfo.Events |= AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT;
}
if (lNetworkEvents & FD_QOS) {
EventSelectInfo.Events |= AFD_EVENT_QOS;
}
if (lNetworkEvents & FD_GROUP_QOS) {
EventSelectInfo.Events |= AFD_EVENT_GROUP_QOS;
}
/* Send IOCTL */
Status = NtDeviceIoControlFile((HANDLE)Handle,
SockEvent,
NULL,
NULL,
&IOSB,
IOCTL_AFD_EVENT_SELECT,
&EventSelectInfo,
sizeof(EventSelectInfo),
NULL,
0);
AFD_DbgPrint(MID_TRACE,("AFD: %x\n", Status));
/* Wait for return */
if (Status == STATUS_PENDING) {
WaitForSingleObject(SockEvent, INFINITE);
}
AFD_DbgPrint(MID_TRACE,("Waited\n"));
NtClose( SockEvent );
AFD_DbgPrint(MID_TRACE,("Closed event\n"));
/* Set Socket Data*/
Socket->EventObject = hEventObject;
Socket->NetworkEvents = lNetworkEvents;
AFD_DbgPrint(MID_TRACE,("Leaving\n"));
return 0;
}
INT
WSPAPI
WSPEnumNetworkEvents(
IN SOCKET Handle,
IN WSAEVENT hEventObject,
OUT LPWSANETWORKEVENTS lpNetworkEvents,
OUT LPINT lpErrno)
{
AFD_ENUM_NETWORK_EVENTS_INFO EnumReq;
IO_STATUS_BLOCK IOSB;
PSOCKET_INFORMATION Socket = NULL;
NTSTATUS Status;
HANDLE SockEvent;
AFD_DbgPrint(MID_TRACE,("Called (lpNetworkEvents %x)\n", lpNetworkEvents));
Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE,
NULL, 1, FALSE );
if( !NT_SUCCESS(Status) ) {
AFD_DbgPrint(MID_TRACE,("Could not make an event %x\n", Status));
return -1;
}
/* Get the Socket Structure associate to this Socket*/
Socket = GetSocketStructure(Handle);
EnumReq.Event = hEventObject;
/* Send IOCTL */
Status = NtDeviceIoControlFile((HANDLE)Handle,
SockEvent,
NULL,
NULL,
&IOSB,
IOCTL_AFD_ENUM_NETWORK_EVENTS,
&EnumReq,
sizeof(EnumReq),
NULL,
0);
AFD_DbgPrint(MID_TRACE,("AFD: %x\n", Status));
/* Wait for return */
if (Status == STATUS_PENDING) {
WaitForSingleObject(SockEvent, INFINITE);
Status = STATUS_SUCCESS;
}
AFD_DbgPrint(MID_TRACE,("Waited\n"));
NtClose( SockEvent );
AFD_DbgPrint(MID_TRACE,("Closed event\n"));
AFD_DbgPrint(MID_TRACE,("About to touch struct at %x (%d)\n",
lpNetworkEvents, sizeof(*lpNetworkEvents)));
lpNetworkEvents->lNetworkEvents = 0;
AFD_DbgPrint(MID_TRACE,("Zeroed struct\n"));
/* Set Events to wait for */
if (EnumReq.PollEvents & AFD_EVENT_RECEIVE) {
lpNetworkEvents->lNetworkEvents |= FD_READ;
}
if (EnumReq.PollEvents & AFD_EVENT_SEND) {
lpNetworkEvents->lNetworkEvents |= FD_WRITE;
}
if (EnumReq.PollEvents & AFD_EVENT_OOB_RECEIVE) {
lpNetworkEvents->lNetworkEvents |= FD_OOB;
}
if (EnumReq.PollEvents & AFD_EVENT_ACCEPT) {
lpNetworkEvents->lNetworkEvents |= FD_ACCEPT;
}
if (EnumReq.PollEvents &
(AFD_EVENT_CONNECT | AFD_EVENT_CONNECT_FAIL)) {
lpNetworkEvents->lNetworkEvents |= FD_CONNECT;
}
if (EnumReq.PollEvents &
(AFD_EVENT_DISCONNECT | AFD_EVENT_ABORT)) {
lpNetworkEvents->lNetworkEvents |= FD_CLOSE;
}
if (EnumReq.PollEvents & AFD_EVENT_QOS) {
lpNetworkEvents->lNetworkEvents |= FD_QOS;
}
if (EnumReq.PollEvents & AFD_EVENT_GROUP_QOS) {
lpNetworkEvents->lNetworkEvents |= FD_GROUP_QOS;
}
if( NT_SUCCESS(Status) ) *lpErrno = 0;
else *lpErrno = WSAEINVAL;
AFD_DbgPrint(MID_TRACE,("Leaving\n"));
return 0;
}
/* EOF */

View file

@ -0,0 +1,520 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Ancillary Function Driver DLL
* FILE: misc/helpers.c
* PURPOSE: Helper DLL management
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Alex Ionescu (alex@relsoft.net)
* REVISIONS:
* CSH 01/09-2000 Created
* Alex 16/07/2004 - Complete Rewrite
*/
#include <msafd.h>
#include <debug.h>
CRITICAL_SECTION HelperDLLDatabaseLock;
LIST_ENTRY HelperDLLDatabaseListHead;
INT
SockGetTdiName(
PINT AddressFamily,
PINT SocketType,
PINT Protocol,
GROUP Group,
DWORD Flags,
PUNICODE_STRING TransportName,
PVOID *HelperDllContext,
PHELPER_DATA *HelperDllData,
PDWORD Events)
{
PHELPER_DATA HelperData;
PWSTR Transports;
PWSTR Transport;
PWINSOCK_MAPPING Mapping;
PLIST_ENTRY Helpers;
INT Status;
AFD_DbgPrint(MID_TRACE,("Called\n"));
/* Check in our Current Loaded Helpers */
for (Helpers = SockHelpersListHead.Flink;
Helpers != &SockHelpersListHead;
Helpers = Helpers->Flink ) {
HelperData = CONTAINING_RECORD(Helpers, HELPER_DATA, Helpers);
/* See if this Mapping works for us */
if (SockIsTripleInMapping (HelperData->Mapping,
*AddressFamily,
*SocketType,
*Protocol)) {
/* Call the Helper Dll function get the Transport Name */
if (HelperData->WSHOpenSocket2 == NULL ) {
/* DLL Doesn't support WSHOpenSocket2, call the old one */
HelperData->WSHOpenSocket(AddressFamily,
SocketType,
Protocol,
TransportName,
HelperDllContext,
Events
);
} else {
HelperData->WSHOpenSocket2(AddressFamily,
SocketType,
Protocol,
Group,
Flags,
TransportName,
HelperDllContext,
Events
);
}
/* Return the Helper Pointers */
*HelperDllData = HelperData;
return NO_ERROR;
}
}
/* Get the Transports available */
Status = SockLoadTransportList(&Transports);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Can't get transport list\n"));
return Status;
}
/* Loop through each transport until we find one that can satisfy us */
for (Transport = Transports;
*Transports != 0;
Transport += wcslen(Transport) + 1) {
AFD_DbgPrint(MID_TRACE, ("Transport: %S\n", Transports));
/* See what mapping this Transport supports */
Status = SockLoadTransportMapping(Transport, &Mapping);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Can't get mapping\n"));
HeapFree(GlobalHeap, 0, Transports);
return Status;
}
/* See if this Mapping works for us */
if (SockIsTripleInMapping(Mapping, *AddressFamily, *SocketType, *Protocol)) {
/* It does, so load the DLL associated with it */
Status = SockLoadHelperDll(Transport, Mapping, &HelperData);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Can't load helper DLL\n"));
HeapFree(GlobalHeap, 0, Transports);
HeapFree(GlobalHeap, 0, Mapping);
return Status;
}
/* Call the Helper Dll function get the Transport Name */
if (HelperData->WSHOpenSocket2 == NULL) {
/* DLL Doesn't support WSHOpenSocket2, call the old one */
HelperData->WSHOpenSocket(AddressFamily,
SocketType,
Protocol,
TransportName,
HelperDllContext,
Events
);
} else {
HelperData->WSHOpenSocket2(AddressFamily,
SocketType,
Protocol,
Group,
Flags,
TransportName,
HelperDllContext,
Events
);
}
/* Return the Helper Pointers */
*HelperDllData = HelperData;
/* We actually cache these ... the can't be freed yet */
/*HeapFree(GlobalHeap, 0, Transports);*/
/*HeapFree(GlobalHeap, 0, Mapping);*/
return NO_ERROR;
}
HeapFree(GlobalHeap, 0, Mapping);
}
HeapFree(GlobalHeap, 0, Transports);
return WSAEINVAL;
}
INT
SockLoadTransportMapping(
PWSTR TransportName,
PWINSOCK_MAPPING *Mapping)
{
PWSTR TransportKey;
HKEY KeyHandle;
ULONG MappingSize;
LONG Status;
AFD_DbgPrint(MID_TRACE,("Called: TransportName %ws\n", TransportName));
/* Allocate a Buffer */
TransportKey = HeapAlloc(GlobalHeap, 0, (54 + wcslen(TransportName)) * sizeof(WCHAR));
/* Check for error */
if (TransportKey == NULL) {
AFD_DbgPrint(MIN_TRACE, ("Buffer allocation failed\n"));
return WSAEINVAL;
}
/* Generate the right key name */
wcscpy(TransportKey, L"System\\CurrentControlSet\\Services\\");
wcscat(TransportKey, TransportName);
wcscat(TransportKey, L"\\Parameters\\Winsock");
/* Open the Key */
Status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TransportKey, 0, KEY_READ, &KeyHandle);
/* We don't need the Transport Key anymore */
HeapFree(GlobalHeap, 0, TransportKey);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Error reading transport mapping registry\n"));
return WSAEINVAL;
}
/* Find out how much space we need for the Mapping */
Status = RegQueryValueExW(KeyHandle, L"Mapping", NULL, NULL, NULL, &MappingSize);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Error reading transport mapping registry\n"));
return WSAEINVAL;
}
/* Allocate Memory for the Mapping */
*Mapping = HeapAlloc(GlobalHeap, 0, MappingSize);
/* Check for error */
if (*Mapping == NULL) {
AFD_DbgPrint(MIN_TRACE, ("Buffer allocation failed\n"));
return WSAEINVAL;
}
/* Read the Mapping */
Status = RegQueryValueExW(KeyHandle, L"Mapping", NULL, NULL, (LPBYTE)*Mapping, &MappingSize);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Error reading transport mapping registry\n"));
HeapFree(GlobalHeap, 0, *Mapping);
return WSAEINVAL;
}
/* Close key and return */
RegCloseKey(KeyHandle);
return 0;
}
INT
SockLoadTransportList(
PWSTR *TransportList)
{
ULONG TransportListSize;
HKEY KeyHandle;
LONG Status;
AFD_DbgPrint(MID_TRACE,("Called\n"));
/* Open the Transports Key */
Status = RegOpenKeyExW (HKEY_LOCAL_MACHINE,
L"SYSTEM\\CurrentControlSet\\Services\\Winsock\\Parameters",
0,
KEY_READ,
&KeyHandle);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Error reading transport list registry\n"));
return WSAEINVAL;
}
/* Get the Transport List Size */
Status = RegQueryValueExW(KeyHandle,
L"Transports",
NULL,
NULL,
NULL,
&TransportListSize);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Error reading transport list registry\n"));
return WSAEINVAL;
}
/* Allocate Memory for the Transport List */
*TransportList = HeapAlloc(GlobalHeap, 0, TransportListSize);
/* Check for error */
if (*TransportList == NULL) {
AFD_DbgPrint(MIN_TRACE, ("Buffer allocation failed\n"));
return WSAEINVAL;
}
/* Get the Transports */
Status = RegQueryValueExW (KeyHandle,
L"Transports",
NULL,
NULL,
(LPBYTE)*TransportList,
&TransportListSize);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Error reading transport list registry\n"));
HeapFree(GlobalHeap, 0, *TransportList);
return WSAEINVAL;
}
/* Close key and return */
RegCloseKey(KeyHandle);
return 0;
}
INT
SockLoadHelperDll(
PWSTR TransportName,
PWINSOCK_MAPPING Mapping,
PHELPER_DATA *HelperDllData)
{
PHELPER_DATA HelperData;
PWSTR HelperDllName;
PWSTR FullHelperDllName;
ULONG HelperDllNameSize;
PWSTR HelperKey;
HKEY KeyHandle;
ULONG DataSize;
LONG Status;
/* Allocate space for the Helper Structure and TransportName */
HelperData = HeapAlloc(GlobalHeap, 0, sizeof(*HelperData) + (wcslen(TransportName) + 1) * sizeof(WCHAR));
/* Check for error */
if (HelperData == NULL) {
AFD_DbgPrint(MIN_TRACE, ("Buffer allocation failed\n"));
return WSAEINVAL;
}
/* Allocate Space for the Helper DLL Key */
HelperKey = HeapAlloc(GlobalHeap, 0, (54 + wcslen(TransportName)) * sizeof(WCHAR));
/* Check for error */
if (HelperKey == NULL) {
AFD_DbgPrint(MIN_TRACE, ("Buffer allocation failed\n"));
HeapFree(GlobalHeap, 0, HelperData);
return WSAEINVAL;
}
/* Generate the right key name */
wcscpy(HelperKey, L"System\\CurrentControlSet\\Services\\");
wcscat(HelperKey, TransportName);
wcscat(HelperKey, L"\\Parameters\\Winsock");
/* Open the Key */
Status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, HelperKey, 0, KEY_READ, &KeyHandle);
HeapFree(GlobalHeap, 0, HelperKey);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Error reading helper DLL parameters\n"));
HeapFree(GlobalHeap, 0, HelperData);
return WSAEINVAL;
}
/* Read Size of SockAddr Structures */
DataSize = sizeof(HelperData->MinWSAddressLength);
HelperData->MinWSAddressLength = 16;
RegQueryValueExW (KeyHandle,
L"MinSockaddrLength",
NULL,
NULL,
(LPBYTE)&HelperData->MinWSAddressLength,
&DataSize);
DataSize = sizeof(HelperData->MinWSAddressLength);
HelperData->MaxWSAddressLength = 16;
RegQueryValueExW (KeyHandle,
L"MaxSockaddrLength",
NULL,
NULL,
(LPBYTE)&HelperData->MaxWSAddressLength,
&DataSize);
/* Size of TDI Structures */
HelperData->MinTDIAddressLength = HelperData->MinWSAddressLength + 6;
HelperData->MaxTDIAddressLength = HelperData->MaxWSAddressLength + 6;
/* Read Delayed Acceptance Setting */
DataSize = sizeof(DWORD);
HelperData->UseDelayedAcceptance = FALSE;
RegQueryValueExW (KeyHandle,
L"UseDelayedAcceptance",
NULL,
NULL,
(LPBYTE)&HelperData->UseDelayedAcceptance,
&DataSize);
/* Allocate Space for the Helper DLL Names */
HelperDllName = HeapAlloc(GlobalHeap, 0, 512);
/* Check for error */
if (HelperDllName == NULL) {
AFD_DbgPrint(MIN_TRACE, ("Buffer allocation failed\n"));
HeapFree(GlobalHeap, 0, HelperData);
return WSAEINVAL;
}
FullHelperDllName = HeapAlloc(GlobalHeap, 0, 512);
/* Check for error */
if (FullHelperDllName == NULL) {
AFD_DbgPrint(MIN_TRACE, ("Buffer allocation failed\n"));
HeapFree(GlobalHeap, 0, HelperDllName);
HeapFree(GlobalHeap, 0, HelperData);
return WSAEINVAL;
}
/* Get the name of the Helper DLL*/
DataSize = 512;
Status = RegQueryValueExW (KeyHandle,
L"HelperDllName",
NULL,
NULL,
(LPBYTE)HelperDllName,
&DataSize);
/* Check for error */
if (Status) {
AFD_DbgPrint(MIN_TRACE, ("Error reading helper DLL parameters\n"));
HeapFree(GlobalHeap, 0, FullHelperDllName);
HeapFree(GlobalHeap, 0, HelperDllName);
HeapFree(GlobalHeap, 0, HelperData);
return WSAEINVAL;
}
/* Get the Full name, expanding Environment Strings */
HelperDllNameSize = ExpandEnvironmentStringsW (HelperDllName,
FullHelperDllName,
256);
/* Load the DLL */
HelperData->hInstance = LoadLibraryW(FullHelperDllName);
HeapFree(GlobalHeap, 0, HelperDllName);
HeapFree(GlobalHeap, 0, FullHelperDllName);
if (HelperData->hInstance == NULL) {
AFD_DbgPrint(MIN_TRACE, ("Error loading helper DLL\n"));
HeapFree(GlobalHeap, 0, HelperData);
return WSAEINVAL;
}
/* Close Key */
RegCloseKey(KeyHandle);
/* Get the Pointers to the Helper Routines */
HelperData->WSHOpenSocket = (PWSH_OPEN_SOCKET)
GetProcAddress(HelperData->hInstance,
"WSHOpenSocket");
HelperData->WSHOpenSocket2 = (PWSH_OPEN_SOCKET2)
GetProcAddress(HelperData->hInstance,
"WSHOpenSocket2");
HelperData->WSHJoinLeaf = (PWSH_JOIN_LEAF)
GetProcAddress(HelperData->hInstance,
"WSHJoinLeaf");
HelperData->WSHNotify = (PWSH_NOTIFY)
GetProcAddress(HelperData->hInstance, "WSHNotify");
HelperData->WSHGetSocketInformation = (PWSH_GET_SOCKET_INFORMATION)
GetProcAddress(HelperData->hInstance,
"WSHGetSocketInformation");
HelperData->WSHSetSocketInformation = (PWSH_SET_SOCKET_INFORMATION)
GetProcAddress(HelperData->hInstance,
"WSHSetSocketInformation");
HelperData->WSHGetSockaddrType = (PWSH_GET_SOCKADDR_TYPE)
GetProcAddress(HelperData->hInstance,
"WSHGetSockaddrType");
HelperData->WSHGetWildcardSockaddr = (PWSH_GET_WILDCARD_SOCKEADDR)
GetProcAddress(HelperData->hInstance,
"WSHGetWildcardSockaddr");
HelperData->WSHGetBroadcastSockaddr = (PWSH_GET_BROADCAST_SOCKADDR)
GetProcAddress(HelperData->hInstance,
"WSHGetBroadcastSockaddr");
HelperData->WSHAddressToString = (PWSH_ADDRESS_TO_STRING)
GetProcAddress(HelperData->hInstance,
"WSHAddressToString");
HelperData->WSHStringToAddress = (PWSH_STRING_TO_ADDRESS)
GetProcAddress(HelperData->hInstance,
"WSHStringToAddress");
HelperData->WSHIoctl = (PWSH_IOCTL)
GetProcAddress(HelperData->hInstance,
"WSHIoctl");
/* Save the Mapping Structure and transport name */
HelperData->Mapping = Mapping;
wcscpy(HelperData->TransportName, TransportName);
/* Increment Reference Count */
HelperData->RefCount = 1;
/* Add it to our list */
InsertHeadList(&SockHelpersListHead, &HelperData->Helpers);
/* Return Pointers */
*HelperDllData = HelperData;
return 0;
}
BOOL
SockIsTripleInMapping(
PWINSOCK_MAPPING Mapping,
INT AddressFamily,
INT SocketType,
INT Protocol)
{
/* The Windows version returns more detailed information on which of the 3 parameters failed...we should do this later */
ULONG Row;
AFD_DbgPrint(MID_TRACE,("Called, Mapping rows = %d\n", Mapping->Rows));
/* Loop through Mapping to Find a matching one */
for (Row = 0; Row < Mapping->Rows; Row++) {
AFD_DbgPrint(MID_TRACE,("Examining: row %d: AF %d type %d proto %d\n",
Row,
(INT)Mapping->Mapping[Row].AddressFamily,
(INT)Mapping->Mapping[Row].SocketType,
(INT)Mapping->Mapping[Row].Protocol));
/* Check of all three values Match */
if (((INT)Mapping->Mapping[Row].AddressFamily == AddressFamily) &&
((INT)Mapping->Mapping[Row].SocketType == SocketType) &&
((INT)Mapping->Mapping[Row].Protocol == Protocol)) {
AFD_DbgPrint(MID_TRACE,("Found\n"));
return TRUE;
}
}
AFD_DbgPrint(MID_TRACE,("Not found\n"));
return FALSE;
}
/* EOF */

View file

@ -0,0 +1,620 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Ancillary Function Driver DLL
* FILE: misc/sndrcv.c
* PURPOSE: Send/receive routines
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* Alex Ionescu (alex@relsoft.net)
* REVISIONS:
* CSH 01/09-2000 Created
* Alex 16/07/2004 - Complete Rewrite
*/
#include <msafd.h>
#include <debug.h>
INT
WSPAPI
WSPAsyncSelect(
IN SOCKET Handle,
IN HWND hWnd,
IN UINT wMsg,
IN LONG lEvent,
OUT LPINT lpErrno)
{
PSOCKET_INFORMATION Socket = NULL;
PASYNC_DATA AsyncData;
NTSTATUS Status;
ULONG BlockMode;
/* Get the Socket Structure associated to this Socket */
Socket = GetSocketStructure(Handle);
/* Allocate the Async Data Structure to pass on to the Thread later */
AsyncData = HeapAlloc(GetProcessHeap(), 0, sizeof(*AsyncData));
/* Change the Socket to Non Blocking */
BlockMode = 1;
SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL);
Socket->SharedData.NonBlocking = TRUE;
/* Deactive WSPEventSelect */
if (Socket->SharedData.AsyncEvents) {
WSPEventSelect(Handle, NULL, 0, NULL);
}
/* Create the Asynch Thread if Needed */
SockCreateOrReferenceAsyncThread();
/* Open a Handle to AFD's Async Helper */
SockGetAsyncSelectHelperAfdHandle();
/* Store Socket Data */
Socket->SharedData.hWnd = hWnd;
Socket->SharedData.wMsg = wMsg;
Socket->SharedData.AsyncEvents = lEvent;
Socket->SharedData.AsyncDisabledEvents = 0;
Socket->SharedData.SequenceNumber++;
/* Return if there are no more Events */
if ((Socket->SharedData.AsyncEvents & (~Socket->SharedData.AsyncDisabledEvents)) == 0) {
HeapFree(GetProcessHeap(), 0, AsyncData);
return 0;
}
/* Set up the Async Data */
AsyncData->ParentSocket = Socket;
AsyncData->SequenceNumber = Socket->SharedData.SequenceNumber;
/* Begin Async Select by using I/O Completion */
Status = NtSetIoCompletion(SockAsyncCompletionPort,
(PVOID)&SockProcessQueuedAsyncSelect,
AsyncData,
0,
0);
/* Return */
return ERROR_SUCCESS;
}
int
WSPAPI
WSPRecv(
SOCKET Handle,
LPWSABUF lpBuffers,
DWORD dwBufferCount,
LPDWORD lpNumberOfBytesRead,
LPDWORD ReceiveFlags,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
LPWSATHREADID lpThreadId,
LPINT lpErrno)
{
PIO_STATUS_BLOCK IOSB;
IO_STATUS_BLOCK DummyIOSB;
AFD_RECV_INFO RecvInfo;
NTSTATUS Status;
PVOID APCContext;
PVOID APCFunction;
HANDLE Event;
HANDLE SockEvent;
PSOCKET_INFORMATION Socket;
AFD_DbgPrint(MID_TRACE,("Called (%x)\n", Handle));
/* Get the Socket Structure associate to this Socket*/
Socket = GetSocketStructure(Handle);
Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE,
NULL, 1, FALSE );
if( !NT_SUCCESS(Status) ) return -1;
/* Set up the Receive Structure */
RecvInfo.BufferArray = (PAFD_WSABUF)lpBuffers;
RecvInfo.BufferCount = dwBufferCount;
RecvInfo.TdiFlags = 0;
RecvInfo.AfdFlags = Socket->SharedData.NonBlocking ? AFD_IMMEDIATE : 0;
/* Set the TDI Flags */
if (*ReceiveFlags == 0) {
RecvInfo.TdiFlags |= TDI_RECEIVE_NORMAL;
} else {
if (*ReceiveFlags & MSG_OOB) {
RecvInfo.TdiFlags |= TDI_RECEIVE_EXPEDITED;
} else {
RecvInfo.TdiFlags |= TDI_RECEIVE_NORMAL;
}
if (*ReceiveFlags & MSG_PEEK) {
RecvInfo.TdiFlags |= TDI_RECEIVE_PEEK;
}
if (*ReceiveFlags & MSG_PARTIAL) {
RecvInfo.TdiFlags |= TDI_RECEIVE_NORMAL;
}
}
/* Verifiy if we should use APC */
if (lpOverlapped == NULL) {
/* Not using Overlapped structure, so use normal blocking on event */
APCContext = NULL;
APCFunction = NULL;
Event = SockEvent;
IOSB = &DummyIOSB;
} else {
if (lpCompletionRoutine == NULL) {
/* Using Overlapped Structure, but no Completition Routine, so no need for APC */
APCContext = lpOverlapped;
APCFunction = NULL;
Event = lpOverlapped->hEvent;
} else {
/* Using Overlapped Structure and a Completition Routine, so use an APC */
APCFunction = NULL; // should be a private io completition function inside us
APCContext = lpCompletionRoutine;
RecvInfo.AfdFlags = AFD_SKIP_FIO;
}
IOSB = (PIO_STATUS_BLOCK)&lpOverlapped->Internal;
RecvInfo.AfdFlags |= AFD_OVERLAPPED;
}
IOSB->Status = STATUS_PENDING;
/* Send IOCTL */
Status = NtDeviceIoControlFile((HANDLE)Handle,
SockEvent,
APCFunction,
APCContext,
IOSB,
IOCTL_AFD_RECV,
&RecvInfo,
sizeof(RecvInfo),
NULL,
0);
/* Wait for completition of not overlapped */
if (Status == STATUS_PENDING && lpOverlapped == NULL) {
/* It's up to the protocol to time out recv. We must wait
* until the protocol decides it's had enough. */
WaitForSingleObject(SockEvent, INFINITE);
Status = IOSB->Status;
}
NtClose( SockEvent );
AFD_DbgPrint(MID_TRACE,("Status %x Information %d\n",
Status, IOSB->Information));
/* Return the Flags */
*ReceiveFlags = 0;
switch (Status) {
case STATUS_RECEIVE_EXPEDITED: *ReceiveFlags = MSG_OOB; break;
case STATUS_RECEIVE_PARTIAL_EXPEDITED:
*ReceiveFlags = MSG_PARTIAL | MSG_OOB; break;
case STATUS_RECEIVE_PARTIAL: *ReceiveFlags = MSG_PARTIAL; break;
}
/* Re-enable Async Event */
if (*ReceiveFlags == MSG_OOB) {
SockReenableAsyncSelectEvent(Socket, FD_OOB);
} else {
SockReenableAsyncSelectEvent(Socket, FD_READ);
}
return MsafdReturnWithErrno
( Status, lpErrno, IOSB->Information, lpNumberOfBytesRead );
}
int
WSPAPI
WSPRecvFrom(
SOCKET Handle,
LPWSABUF lpBuffers,
DWORD dwBufferCount,
LPDWORD lpNumberOfBytesRead,
LPDWORD ReceiveFlags,
struct sockaddr *SocketAddress,
int *SocketAddressLength,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
LPWSATHREADID lpThreadId,
LPINT lpErrno)
{
PIO_STATUS_BLOCK IOSB;
IO_STATUS_BLOCK DummyIOSB;
AFD_RECV_INFO_UDP RecvInfo;
NTSTATUS Status;
PVOID APCContext;
PVOID APCFunction;
HANDLE Event;
HANDLE SockEvent;
PSOCKET_INFORMATION Socket;
/* Get the Socket Structure associate to this Socket*/
Socket = GetSocketStructure(Handle);
Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE,
NULL, 1, FALSE );
if( !NT_SUCCESS(Status) ) return -1;
/* Set up the Receive Structure */
RecvInfo.BufferArray = (PAFD_WSABUF)lpBuffers;
RecvInfo.BufferCount = dwBufferCount;
RecvInfo.TdiFlags = 0;
RecvInfo.AfdFlags = Socket->SharedData.NonBlocking ? AFD_IMMEDIATE : 0;
RecvInfo.AddressLength = SocketAddressLength;
RecvInfo.Address = SocketAddress;
/* Set the TDI Flags */
if (*ReceiveFlags == 0) {
RecvInfo.TdiFlags |= TDI_RECEIVE_NORMAL;
} else {
if (*ReceiveFlags & MSG_OOB) {
RecvInfo.TdiFlags |= TDI_RECEIVE_EXPEDITED;
} else {
RecvInfo.TdiFlags |= TDI_RECEIVE_NORMAL;
}
if (*ReceiveFlags & MSG_PEEK) {
RecvInfo.TdiFlags |= TDI_RECEIVE_PEEK;
}
if (*ReceiveFlags & MSG_PARTIAL) {
RecvInfo.TdiFlags |= TDI_RECEIVE_NORMAL;
}
}
/* Verifiy if we should use APC */
if (lpOverlapped == NULL) {
/* Not using Overlapped structure, so use normal blocking on event */
APCContext = NULL;
APCFunction = NULL;
Event = SockEvent;
IOSB = &DummyIOSB;
} else {
if (lpCompletionRoutine == NULL) {
/* Using Overlapped Structure, but no Completition Routine, so no need for APC */
APCContext = lpOverlapped;
APCFunction = NULL;
Event = lpOverlapped->hEvent;
} else {
/* Using Overlapped Structure and a Completition Routine, so use an APC */
APCFunction = NULL; // should be a private io completition function inside us
APCContext = lpCompletionRoutine;
RecvInfo.AfdFlags = AFD_SKIP_FIO;
}
IOSB = (PIO_STATUS_BLOCK)&lpOverlapped->Internal;
RecvInfo.AfdFlags |= AFD_OVERLAPPED;
}
IOSB->Status = STATUS_PENDING;
/* Send IOCTL */
Status = NtDeviceIoControlFile((HANDLE)Handle,
SockEvent,
APCFunction,
APCContext,
IOSB,
IOCTL_AFD_RECV_DATAGRAM,
&RecvInfo,
sizeof(RecvInfo),
NULL,
0);
/* Wait for completition of not overlapped */
if (Status == STATUS_PENDING && lpOverlapped == NULL) {
WaitForSingleObject(SockEvent, INFINITE); // BUGBUG, shouldn wait infintely for receive...
Status = IOSB->Status;
}
NtClose( SockEvent );
/* Return the Flags */
*ReceiveFlags = 0;
switch (Status) {
case STATUS_RECEIVE_EXPEDITED: *ReceiveFlags = MSG_OOB; break;
case STATUS_RECEIVE_PARTIAL_EXPEDITED:
*ReceiveFlags = MSG_PARTIAL | MSG_OOB; break;
case STATUS_RECEIVE_PARTIAL: *ReceiveFlags = MSG_PARTIAL; break;
}
/* Re-enable Async Event */
SockReenableAsyncSelectEvent(Socket, FD_READ);
return MsafdReturnWithErrno
( Status, lpErrno, IOSB->Information, lpNumberOfBytesRead );
}
int
WSPAPI
WSPSend(
SOCKET Handle,
LPWSABUF lpBuffers,
DWORD dwBufferCount,
LPDWORD lpNumberOfBytesSent,
DWORD iFlags,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
LPWSATHREADID lpThreadId,
LPINT lpErrno)
{
PIO_STATUS_BLOCK IOSB;
IO_STATUS_BLOCK DummyIOSB;
AFD_SEND_INFO SendInfo;
NTSTATUS Status;
PVOID APCContext;
PVOID APCFunction;
HANDLE Event;
HANDLE SockEvent;
PSOCKET_INFORMATION Socket;
/* Get the Socket Structure associate to this Socket*/
Socket = GetSocketStructure(Handle);
Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE,
NULL, 1, FALSE );
if( !NT_SUCCESS(Status) ) return -1;
AFD_DbgPrint(MID_TRACE,("Called\n"));
/* Set up the Send Structure */
SendInfo.BufferArray = (PAFD_WSABUF)lpBuffers;
SendInfo.BufferCount = dwBufferCount;
SendInfo.TdiFlags = 0;
SendInfo.AfdFlags = Socket->SharedData.NonBlocking ? AFD_IMMEDIATE : 0;
/* Set the TDI Flags */
if (iFlags) {
if (iFlags & MSG_OOB) {
SendInfo.TdiFlags |= TDI_SEND_EXPEDITED;
}
if (iFlags & MSG_PARTIAL) {
SendInfo.TdiFlags |= TDI_SEND_PARTIAL;
}
}
/* Verifiy if we should use APC */
if (lpOverlapped == NULL) {
/* Not using Overlapped structure, so use normal blocking on event */
APCContext = NULL;
APCFunction = NULL;
Event = SockEvent;
IOSB = &DummyIOSB;
} else {
if (lpCompletionRoutine == NULL) {
/* Using Overlapped Structure, but no Completition Routine, so no need for APC */
APCContext = lpOverlapped;
APCFunction = NULL;
Event = lpOverlapped->hEvent;
} else {
/* Using Overlapped Structure and a Completition Routine, so use an APC */
APCFunction = NULL; // should be a private io completition function inside us
APCContext = lpCompletionRoutine;
SendInfo.AfdFlags = AFD_SKIP_FIO;
}
IOSB = (PIO_STATUS_BLOCK)&lpOverlapped->Internal;
SendInfo.AfdFlags |= AFD_OVERLAPPED;
}
IOSB->Status = STATUS_PENDING;
/* Send IOCTL */
Status = NtDeviceIoControlFile((HANDLE)Handle,
SockEvent,
APCFunction,
APCContext,
IOSB,
IOCTL_AFD_SEND,
&SendInfo,
sizeof(SendInfo),
NULL,
0);
/* Wait for completition of not overlapped */
if (Status == STATUS_PENDING && lpOverlapped == NULL) {
WaitForSingleObject(SockEvent, INFINITE); // BUGBUG, shouldn wait infintely for send...
Status = IOSB->Status;
}
NtClose( SockEvent );
if (Status == STATUS_PENDING) {
AFD_DbgPrint(MID_TRACE,("Leaving (Pending)\n"));
return WSA_IO_PENDING;
}
/* Re-enable Async Event */
SockReenableAsyncSelectEvent(Socket, FD_WRITE);
AFD_DbgPrint(MID_TRACE,("Leaving (Success, %d)\n", IOSB->Information));
return MsafdReturnWithErrno
( Status, lpErrno, IOSB->Information, lpNumberOfBytesSent );
}
int
WSPAPI
WSPSendTo(
SOCKET Handle,
LPWSABUF lpBuffers,
DWORD dwBufferCount,
LPDWORD lpNumberOfBytesSent,
DWORD iFlags,
const struct sockaddr *SocketAddress,
int SocketAddressLength,
LPWSAOVERLAPPED lpOverlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
LPWSATHREADID lpThreadId,
LPINT lpErrno)
{
PIO_STATUS_BLOCK IOSB;
IO_STATUS_BLOCK DummyIOSB;
AFD_SEND_INFO_UDP SendInfo;
NTSTATUS Status;
PVOID APCContext;
PVOID APCFunction;
HANDLE Event;
PTRANSPORT_ADDRESS RemoteAddress;
UCHAR TdiBuffer[0x16];
PSOCKADDR BindAddress;
INT BindAddressLength;
HANDLE SockEvent;
PSOCKET_INFORMATION Socket;
/* Get the Socket Structure associate to this Socket*/
Socket = GetSocketStructure(Handle);
Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE,
NULL, 1, FALSE );
if( !NT_SUCCESS(Status) ) return -1;
/* Bind us First */
if (Socket->SharedData.State == SocketOpen) {
/* Get the Wildcard Address */
BindAddressLength = Socket->HelperData->MaxWSAddressLength;
BindAddress = HeapAlloc(GlobalHeap, 0, BindAddressLength);
Socket->HelperData->WSHGetWildcardSockaddr (Socket->HelperContext,
BindAddress,
&BindAddressLength);
/* Bind it */
WSPBind(Handle, BindAddress, BindAddressLength, NULL);
}
/* Set up Address in TDI Format */
RemoteAddress = (PTRANSPORT_ADDRESS)TdiBuffer;
RemoteAddress->TAAddressCount = 1;
RemoteAddress->Address[0].AddressLength = SocketAddressLength - sizeof(SocketAddress->sa_family);
RtlCopyMemory(&RemoteAddress->Address[0].AddressType, SocketAddress, SocketAddressLength);
/* Set up Structure */
SendInfo.BufferArray = (PAFD_WSABUF)lpBuffers;
SendInfo.AfdFlags = Socket->SharedData.NonBlocking ? AFD_IMMEDIATE : 0;
SendInfo.BufferCount = dwBufferCount;
SendInfo.RemoteAddress = RemoteAddress;
SendInfo.SizeOfRemoteAddress = Socket->HelperData->MaxTDIAddressLength;
/* Verifiy if we should use APC */
if (lpOverlapped == NULL) {
/* Not using Overlapped structure, so use normal blocking on event */
APCContext = NULL;
APCFunction = NULL;
Event = SockEvent;
IOSB = &DummyIOSB;
} else {
if (lpCompletionRoutine == NULL) {
/* Using Overlapped Structure, but no Completition Routine, so no need for APC */
APCContext = lpOverlapped;
APCFunction = NULL;
Event = lpOverlapped->hEvent;
} else {
/* Using Overlapped Structure and a Completition Routine, so use an APC */
APCFunction = NULL; // should be a private io completition function inside us
APCContext = lpCompletionRoutine;
SendInfo.AfdFlags = AFD_SKIP_FIO;
}
IOSB = (PIO_STATUS_BLOCK)&lpOverlapped->Internal;
SendInfo.AfdFlags |= AFD_OVERLAPPED;
}
/* Send IOCTL */
Status = NtDeviceIoControlFile((HANDLE)Handle,
SockEvent,
APCFunction,
APCContext,
IOSB,
IOCTL_AFD_SEND_DATAGRAM,
&SendInfo,
sizeof(SendInfo),
NULL,
0);
/* Wait for completition of not overlapped */
if (Status == STATUS_PENDING && lpOverlapped == NULL) {
WaitForSingleObject(SockEvent, INFINITE); // BUGBUG, shouldn wait infintely for send...
Status = IOSB->Status;
}
NtClose( SockEvent );
if (Status == STATUS_PENDING) {
return WSA_IO_PENDING;
}
/* Re-enable Async Event */
SockReenableAsyncSelectEvent(Socket, FD_WRITE);
return MsafdReturnWithErrno
( Status, lpErrno, IOSB->Information, lpNumberOfBytesSent );
}
INT
WSPAPI
WSPRecvDisconnect(
IN SOCKET s,
OUT LPWSABUF lpInboundDisconnectData,
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return 0;
}
INT
WSPAPI
WSPSendDisconnect(
IN SOCKET s,
IN LPWSABUF lpOutboundDisconnectData,
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return 0;
}
/* EOF */

View file

@ -0,0 +1,134 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Ancillary Function Driver DLL
* FILE: misc/stubs.c
* PURPOSE: Stubs
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
* REVISIONS:
* CSH 01/09-2000 Created
*/
#include <msafd.h>
#include <debug.h>
INT
WSPAPI
WSPAddressToString(
IN LPSOCKADDR lpsaAddress,
IN DWORD dwAddressLength,
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
OUT LPWSTR lpszAddressString,
IN OUT LPDWORD lpdwAddressStringLength,
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return 0;
}
INT
WSPAPI
WSPCancelBlockingCall(
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return 0;
}
INT
WSPAPI
WSPDuplicateSocket(
IN SOCKET s,
IN DWORD dwProcessId,
OUT LPWSAPROTOCOL_INFOW lpProtocolInfo,
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return 0;
}
BOOL
WSPAPI
WSPGetOverlappedResult(
IN SOCKET s,
IN LPWSAOVERLAPPED lpOverlapped,
OUT LPDWORD lpcbTransfer,
IN BOOL fWait,
OUT LPDWORD lpdwFlags,
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return FALSE;
}
BOOL
WSPAPI
WSPGetQOSByName(
IN SOCKET s,
IN OUT LPWSABUF lpQOSName,
OUT LPQOS lpQOS,
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return FALSE;
}
SOCKET
WSPAPI
WSPJoinLeaf(
IN SOCKET s,
IN CONST SOCKADDR *name,
IN INT namelen,
IN LPWSABUF lpCallerData,
OUT LPWSABUF lpCalleeData,
IN LPQOS lpSQOS,
IN LPQOS lpGQOS,
IN DWORD dwFlags,
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return (SOCKET)0;
}
INT
WSPAPI
WSPSetSockOpt(
IN SOCKET s,
IN INT level,
IN INT optname,
IN CONST CHAR FAR* optval,
IN INT optlen,
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return 0;
}
INT
WSPAPI
WSPStringToAddress(
IN LPWSTR AddressString,
IN INT AddressFamily,
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
OUT LPSOCKADDR lpAddress,
IN OUT LPINT lpAddressLength,
OUT LPINT lpErrno)
{
UNIMPLEMENTED
return 0;
}
/* EOF */

View file

@ -0,0 +1,8 @@
; MSAFD.DLL - Ancillary Function Driver DLL
LIBRARY msafd.dll
EXPORTS
WSPStartup@76
; EOF

475
reactos/dll/msafd/msafd.h Executable file
View file

@ -0,0 +1,475 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Ancillary Function Driver DLL
* FILE: include/msafd.h
* PURPOSE: Ancillary Function Driver DLL header
*/
#ifndef __MSAFD_H
#define __MSAFD_H
#include <stdio.h>
#include <stdlib.h>
#define WIN32_NO_STATUS
#include <windows.h>
#include <winsock2.h>
#include <ws2spi.h>
#define NTOS_MODE_USER
#include <ndk/ntndk.h>
/* This includes ntsecapi.h so it needs to come after the NDK */
#include <wsahelp.h>
#include <tdi.h>
#include <afd/shared.h>
#include <helpers.h>
extern HANDLE GlobalHeap;
extern WSPUPCALLTABLE Upcalls;
extern LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest;
extern LIST_ENTRY SockHelpersListHead;
extern HANDLE SockEvent;
extern HANDLE SockAsyncCompletionPort;
extern BOOLEAN SockAsyncSelectCalled;
typedef enum _SOCKET_STATE {
SocketOpen,
SocketBound,
SocketBoundUdp,
SocketConnected,
SocketClosed
} SOCKET_STATE, *PSOCKET_STATE;
typedef struct _SOCK_SHARED_INFO {
SOCKET_STATE State;
INT AddressFamily;
INT SocketType;
INT Protocol;
INT SizeOfLocalAddress;
INT SizeOfRemoteAddress;
struct linger LingerData;
ULONG SendTimeout;
ULONG RecvTimeout;
ULONG SizeOfRecvBuffer;
ULONG SizeOfSendBuffer;
struct {
BOOLEAN Listening:1;
BOOLEAN Broadcast:1;
BOOLEAN Debug:1;
BOOLEAN OobInline:1;
BOOLEAN ReuseAddresses:1;
BOOLEAN ExclusiveAddressUse:1;
BOOLEAN NonBlocking:1;
BOOLEAN DontUseWildcard:1;
BOOLEAN ReceiveShutdown:1;
BOOLEAN SendShutdown:1;
BOOLEAN UseDelayedAcceptance:1;
BOOLEAN UseSAN:1;
}; // Flags
DWORD CreateFlags;
DWORD CatalogEntryId;
DWORD ServiceFlags1;
DWORD ProviderFlags;
GROUP GroupID;
DWORD GroupType;
INT GroupPriority;
INT SocketLastError;
HWND hWnd;
LONG Unknown;
DWORD SequenceNumber;
UINT wMsg;
LONG AsyncEvents;
LONG AsyncDisabledEvents;
} SOCK_SHARED_INFO, *PSOCK_SHARED_INFO;
typedef struct _SOCKET_INFORMATION {
ULONG RefCount;
SOCKET Handle;
SOCK_SHARED_INFO SharedData;
DWORD HelperEvents;
PHELPER_DATA HelperData;
PVOID HelperContext;
PSOCKADDR LocalAddress;
PSOCKADDR RemoteAddress;
HANDLE TdiAddressHandle;
HANDLE TdiConnectionHandle;
PVOID AsyncData;
HANDLE EventObject;
LONG NetworkEvents;
CRITICAL_SECTION Lock;
PVOID SanData;
BOOL TrySAN;
SOCKADDR WSLocalAddress;
SOCKADDR WSRemoteAddress;
} SOCKET_INFORMATION, *PSOCKET_INFORMATION;
typedef struct _SOCKET_CONTEXT {
SOCK_SHARED_INFO SharedData;
ULONG SizeOfHelperData;
ULONG Padding;
SOCKADDR LocalAddress;
SOCKADDR RemoteAddress;
/* Plus Helper Data */
} SOCKET_CONTEXT, *PSOCKET_CONTEXT;
typedef struct _ASYNC_DATA {
PSOCKET_INFORMATION ParentSocket;
DWORD SequenceNumber;
IO_STATUS_BLOCK IoStatusBlock;
AFD_POLL_INFO AsyncSelectInfo;
} ASYNC_DATA, *PASYNC_DATA;
SOCKET
WSPAPI
WSPAccept(
IN SOCKET s,
OUT LPSOCKADDR addr,
IN OUT LPINT addrlen,
IN LPCONDITIONPROC lpfnCondition,
IN DWORD dwCallbackData,
OUT LPINT lpErrno);
INT
WSPAPI
WSPAddressToString(
IN LPSOCKADDR lpsaAddress,
IN DWORD dwAddressLength,
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
OUT LPWSTR lpszAddressString,
IN OUT LPDWORD lpdwAddressStringLength,
OUT LPINT lpErrno);
INT
WSPAPI
WSPAsyncSelect(
IN SOCKET s,
IN HWND hWnd,
IN UINT wMsg,
IN LONG lEvent,
OUT LPINT lpErrno);
INT
WSPAPI WSPBind(
IN SOCKET s,
IN CONST SOCKADDR *name,
IN INT namelen,
OUT LPINT lpErrno);
INT
WSPAPI
WSPCancelBlockingCall(
OUT LPINT lpErrno);
INT
WSPAPI
WSPCleanup(
OUT LPINT lpErrno);
INT
WSPAPI
WSPCloseSocket(
IN SOCKET s,
OUT LPINT lpErrno);
INT
WSPAPI
WSPConnect(
IN SOCKET s,
IN CONST SOCKADDR *name,
IN INT namelen,
IN LPWSABUF lpCallerData,
OUT LPWSABUF lpCalleeData,
IN LPQOS lpSQOS,
IN LPQOS lpGQOS,
OUT LPINT lpErrno);
INT
WSPAPI
WSPDuplicateSocket(
IN SOCKET s,
IN DWORD dwProcessId,
OUT LPWSAPROTOCOL_INFOW lpProtocolInfo,
OUT LPINT lpErrno);
INT
WSPAPI
WSPEnumNetworkEvents(
IN SOCKET s,
IN WSAEVENT hEventObject,
OUT LPWSANETWORKEVENTS lpNetworkEvents,
OUT LPINT lpErrno);
INT
WSPAPI
WSPEventSelect(
IN SOCKET s,
IN WSAEVENT hEventObject,
IN LONG lNetworkEvents,
OUT LPINT lpErrno);
BOOL
WSPAPI
WSPGetOverlappedResult(
IN SOCKET s,
IN LPWSAOVERLAPPED lpOverlapped,
OUT LPDWORD lpcbTransfer,
IN BOOL fWait,
OUT LPDWORD lpdwFlags,
OUT LPINT lpErrno);
INT
WSPAPI
WSPGetPeerName(
IN SOCKET s,
OUT LPSOCKADDR name,
IN OUT LPINT namelen,
OUT LPINT lpErrno);
BOOL
WSPAPI
WSPGetQOSByName(
IN SOCKET s,
IN OUT LPWSABUF lpQOSName,
OUT LPQOS lpQOS,
OUT LPINT lpErrno);
INT
WSPAPI
WSPGetSockName(
IN SOCKET s,
OUT LPSOCKADDR name,
IN OUT LPINT namelen,
OUT LPINT lpErrno);
INT
WSPAPI
WSPGetSockOpt(
IN SOCKET s,
IN INT level,
IN INT optname,
OUT CHAR FAR* optval,
IN OUT LPINT optlen,
OUT LPINT lpErrno);
INT
WSPAPI
WSPIoctl(
IN SOCKET s,
IN DWORD dwIoControlCode,
IN LPVOID lpvInBuffer,
IN DWORD cbInBuffer,
OUT LPVOID lpvOutBuffer,
IN DWORD cbOutBuffer,
OUT LPDWORD lpcbBytesReturned,
IN LPWSAOVERLAPPED lpOverlapped,
IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
IN LPWSATHREADID lpThreadId,
OUT LPINT lpErrno);
SOCKET
WSPAPI
WSPJoinLeaf(
IN SOCKET s,
IN CONST SOCKADDR *name,
IN INT namelen,
IN LPWSABUF lpCallerData,
OUT LPWSABUF lpCalleeData,
IN LPQOS lpSQOS,
IN LPQOS lpGQOS,
IN DWORD dwFlags,
OUT LPINT lpErrno);
INT
WSPAPI
WSPListen(
IN SOCKET s,
IN INT backlog,
OUT LPINT lpErrno);
INT
WSPAPI
WSPRecv(
IN SOCKET s,
IN OUT LPWSABUF lpBuffers,
IN DWORD dwBufferCount,
OUT LPDWORD lpNumberOfBytesRecvd,
IN OUT LPDWORD lpFlags,
IN LPWSAOVERLAPPED lpOverlapped,
IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
IN LPWSATHREADID lpThreadId,
OUT LPINT lpErrno);
INT
WSPAPI
WSPRecvDisconnect(
IN SOCKET s,
OUT LPWSABUF lpInboundDisconnectData,
OUT LPINT lpErrno);
INT
WSPAPI
WSPRecvFrom(
IN SOCKET s,
IN OUT LPWSABUF lpBuffers,
IN DWORD dwBufferCount,
OUT LPDWORD lpNumberOfBytesRecvd,
IN OUT LPDWORD lpFlags,
OUT LPSOCKADDR lpFrom,
IN OUT LPINT lpFromlen,
IN LPWSAOVERLAPPED lpOverlapped,
IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
IN LPWSATHREADID lpThreadId,
OUT LPINT lpErrno);
INT
WSPAPI
WSPSelect(
IN INT nfds,
IN OUT LPFD_SET readfds,
IN OUT LPFD_SET writefds,
IN OUT LPFD_SET exceptfds,
IN CONST LPTIMEVAL timeout,
OUT LPINT lpErrno);
INT
WSPAPI
WSPSend(
IN SOCKET s,
IN LPWSABUF lpBuffers,
IN DWORD dwBufferCount,
OUT LPDWORD lpNumberOfBytesSent,
IN DWORD dwFlags,
IN LPWSAOVERLAPPED lpOverlapped,
IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
IN LPWSATHREADID lpThreadId,
OUT LPINT lpErrno);
INT
WSPAPI
WSPSendDisconnect(
IN SOCKET s,
IN LPWSABUF lpOutboundDisconnectData,
OUT LPINT lpErrno);
INT
WSPAPI
WSPSendTo(
IN SOCKET s,
IN LPWSABUF lpBuffers,
IN DWORD dwBufferCount,
OUT LPDWORD lpNumberOfBytesSent,
IN DWORD dwFlags,
IN CONST SOCKADDR *lpTo,
IN INT iTolen,
IN LPWSAOVERLAPPED lpOverlapped,
IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
IN LPWSATHREADID lpThreadId,
OUT LPINT lpErrno);
INT
WSPAPI
WSPSetSockOpt(
IN SOCKET s,
IN INT level,
IN INT optname,
IN CONST CHAR FAR* optval,
IN INT optlen,
OUT LPINT lpErrno);
INT
WSPAPI
WSPShutdown(
IN SOCKET s,
IN INT how,
OUT LPINT lpErrno);
SOCKET
WSPAPI
WSPSocket(
IN INT af,
IN INT type,
IN INT protocol,
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
IN GROUP g,
IN DWORD dwFlags,
OUT LPINT lpErrno);
INT
WSPAPI
WSPStringToAddress(
IN LPWSTR AddressString,
IN INT AddressFamily,
IN LPWSAPROTOCOL_INFOW lpProtocolInfo,
OUT LPSOCKADDR lpAddress,
IN OUT LPINT lpAddressLength,
OUT LPINT lpErrno);
PSOCKET_INFORMATION GetSocketStructure(
SOCKET Handle
);
VOID DeleteSocketStructure( SOCKET Handle );
int GetSocketInformation(
PSOCKET_INFORMATION Socket,
ULONG AfdInformationClass,
PULONG Ulong OPTIONAL,
PLARGE_INTEGER LargeInteger OPTIONAL
);
int SetSocketInformation(
PSOCKET_INFORMATION Socket,
ULONG AfdInformationClass,
PULONG Ulong OPTIONAL,
PLARGE_INTEGER LargeInteger OPTIONAL
);
int CreateContext(
PSOCKET_INFORMATION Socket
);
int SockAsyncThread(
PVOID ThreadParam
);
VOID
SockProcessAsyncSelect(
PSOCKET_INFORMATION Socket,
PASYNC_DATA AsyncData
);
VOID
SockAsyncSelectCompletionRoutine(
PVOID Context,
PIO_STATUS_BLOCK IoStatusBlock
);
BOOLEAN
SockCreateOrReferenceAsyncThread(
VOID
);
BOOLEAN SockGetAsyncSelectHelperAfdHandle(
VOID
);
VOID SockProcessQueuedAsyncSelect(
PVOID Context,
PIO_STATUS_BLOCK IoStatusBlock
);
VOID
SockReenableAsyncSelectEvent (
IN PSOCKET_INFORMATION Socket,
IN ULONG Event
);
DWORD MsafdReturnWithErrno( NTSTATUS Status, LPINT Errno, DWORD Received,
LPDWORD ReturnedBytes );
typedef VOID (*PASYNC_COMPLETION_ROUTINE)(PVOID Context, PIO_STATUS_BLOCK IoStatusBlock);
#endif /* __MSAFD_H */
/* EOF */

View file

@ -0,0 +1,5 @@
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "Ancillary Function Driver DLL\0"
#define REACTOS_STR_INTERNAL_NAME "msafd\0"
#define REACTOS_STR_ORIGINAL_FILENAME "msafd.dll\0"
#include <reactos/version.rc>

View file

@ -0,0 +1,20 @@
<module name="msafd" type="win32dll" baseaddress="${BASEADDRESS_MSAFD}" installbase="system32" installname="msafd.dll">
<importlibrary definition="msafd.def" />
<include base="msafd">include</include>
<define name="UNICODE" />
<define name="_UNICODE" />
<define name="__REACTOS__" />
<define name="__USE_W32API" />
<pch>msafd.h</pch>
<library>ntdll</library>
<library>kernel32</library>
<library>advapi32</library>
<directory name="misc">
<file>dllmain.c</file>
<file>event.c</file>
<file>helpers.c</file>
<file>sndrcv.c</file>
<file>stubs.c</file>
</directory>
<file>msafd.rc</file>
</module>

562
reactos/dll/msgina/msgina.c Normal file
View file

@ -0,0 +1,562 @@
/*
* ReactOS kernel
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id$
*
* PROJECT: ReactOS msgina.dll
* FILE: lib/msgina/msgina.c
* PURPOSE: ReactOS Logon GINA DLL
* PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
* UPDATE HISTORY:
* 24-11-2003 Created
*/
#include <windows.h>
#include <winwlx.h>
#include "msgina.h"
#include "resource.h"
#include <wine/debug.h>
extern HINSTANCE hDllInstance;
typedef struct _DISPLAYSTATUSMSG
{
PGINA_CONTEXT Context;
HDESK hDesktop;
DWORD dwOptions;
PWSTR pTitle;
PWSTR pMessage;
HANDLE StartupEvent;
} DISPLAYSTATUSMSG, *PDISPLAYSTATUSMSG;
INT_PTR CALLBACK
LoggedOnDlgProc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDYES:
case IDNO:
{
EndDialog(hwndDlg, LOWORD(wParam));
break;
}
}
return FALSE;
}
case WM_INITDIALOG:
{
SetFocus(GetDlgItem(hwndDlg, IDNO));
break;
}
case WM_CLOSE:
{
EndDialog(hwndDlg, IDNO);
return TRUE;
}
}
return FALSE;
}
/*
* @implemented
*/
BOOL WINAPI
WlxNegotiate(
DWORD dwWinlogonVersion,
PDWORD pdwDllVersion)
{
if(!pdwDllVersion || (dwWinlogonVersion < GINA_VERSION))
return FALSE;
*pdwDllVersion = GINA_VERSION;
return TRUE;
}
/*
* @implemented
*/
BOOL WINAPI
WlxInitialize(
LPWSTR lpWinsta,
HANDLE hWlx,
PVOID pvReserved,
PVOID pWinlogonFunctions,
PVOID *pWlxContext)
{
PGINA_CONTEXT pgContext;
pgContext = (PGINA_CONTEXT)LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, sizeof(GINA_CONTEXT));
if(!pgContext)
return FALSE;
/* return the context to winlogon */
*pWlxContext = (PVOID)pgContext;
pgContext->hDllInstance = hDllInstance;
/* save pointer to dispatch table */
pgContext->pWlxFuncs = (PWLX_DISPATCH_VERSION)pWinlogonFunctions;
/* save the winlogon handle used to call the dispatch functions */
pgContext->hWlx = hWlx;
/* save window station */
pgContext->station = lpWinsta;
/* clear status window handle */
pgContext->hStatusWindow = 0;
/* notify winlogon that we will use the default SAS */
pgContext->pWlxFuncs->WlxUseCtrlAltDel(hWlx);
return TRUE;
}
/*
* @implemented
*/
BOOL WINAPI
WlxStartApplication(
PVOID pWlxContext,
PWSTR pszDesktopName,
PVOID pEnvironment,
PWSTR pszCmdLine)
{
PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
STARTUPINFO si;
PROCESS_INFORMATION pi;
BOOL Ret;
si.cb = sizeof(STARTUPINFO);
si.lpReserved = NULL;
si.lpTitle = pszCmdLine;
si.dwX = si.dwY = si.dwXSize = si.dwYSize = 0L;
si.dwFlags = 0;
si.wShowWindow = SW_SHOW;
si.lpReserved2 = NULL;
si.cbReserved2 = 0;
si.lpDesktop = pszDesktopName;
Ret = CreateProcessAsUser(pgContext->UserToken,
NULL,
pszCmdLine,
NULL,
NULL,
FALSE,
CREATE_UNICODE_ENVIRONMENT,
pEnvironment,
NULL,
&si,
&pi);
VirtualFree(pEnvironment, 0, MEM_RELEASE);
return Ret;
}
/*
* @implemented
*/
BOOL WINAPI
WlxActivateUserShell(
PVOID pWlxContext,
PWSTR pszDesktopName,
PWSTR pszMprLogonScript,
PVOID pEnvironment)
{
PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
STARTUPINFO si;
PROCESS_INFORMATION pi;
HKEY hKey;
DWORD BufSize, ValueType;
WCHAR pszUserInitApp[MAX_PATH];
WCHAR pszExpUserInitApp[MAX_PATH];
BOOL Ret;
/* get the path of userinit */
if(RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\ReactOS\\Windows NT\\CurrentVersion\\Winlogon",
0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS)
{ERR("GINA: Failed: 1\n");
VirtualFree(pEnvironment, 0, MEM_RELEASE);
return FALSE;
}
BufSize = MAX_PATH * sizeof(WCHAR);
if((RegQueryValueEx(hKey, L"Userinit", NULL, &ValueType, (LPBYTE)pszUserInitApp,
&BufSize) != ERROR_SUCCESS) ||
!((ValueType == REG_SZ) || (ValueType == REG_EXPAND_SZ)))
{ERR("GINA: Failed: 2\n");
RegCloseKey(hKey);
VirtualFree(pEnvironment, 0, MEM_RELEASE);
return FALSE;
}
RegCloseKey(hKey);
/* start userinit */
/* FIXME - allow to start more applications that are comma-separated */
si.cb = sizeof(STARTUPINFO);
si.lpReserved = NULL;
si.lpTitle = L"userinit";
si.dwX = si.dwY = si.dwXSize = si.dwYSize = 0;
si.dwFlags = 0;
si.wShowWindow = SW_SHOW;
si.lpReserved2 = NULL;
si.cbReserved2 = 0;
si.lpDesktop = pszDesktopName;
ExpandEnvironmentStrings(pszUserInitApp, pszExpUserInitApp, MAX_PATH);
Ret = CreateProcessAsUser(pgContext->UserToken,
pszExpUserInitApp,
NULL,
NULL,
NULL,
FALSE,
CREATE_UNICODE_ENVIRONMENT,
pEnvironment,
NULL,
&si,
&pi);
if(!Ret) ERR("GINA: Failed: 3\n");
VirtualFree(pEnvironment, 0, MEM_RELEASE);
return Ret;
}
/*
* @implemented
*/
int WINAPI
WlxLoggedOnSAS(
PVOID pWlxContext,
DWORD dwSasType,
PVOID pReserved)
{
PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
int SasAction = WLX_SAS_ACTION_NONE;
switch(dwSasType)
{
case WLX_SAS_TYPE_CTRL_ALT_DEL:
{
int Result;
/* display "Are you sure you want to log off?" dialog */
Result = pgContext->pWlxFuncs->WlxDialogBoxParam(pgContext->hWlx,
pgContext->hDllInstance,
(LPTSTR)IDD_LOGOFF_DLG,
NULL,
LoggedOnDlgProc,
(LPARAM)pgContext);
if(Result == IDOK)
{
SasAction = WLX_SAS_ACTION_LOCK_WKSTA;
}
break;
}
case WLX_SAS_TYPE_SC_INSERT:
{
FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_INSERT not supported!\n");
break;
}
case WLX_SAS_TYPE_SC_REMOVE:
{
FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_SC_REMOVE not supported!\n");
break;
}
case WLX_SAS_TYPE_TIMEOUT:
{
FIXME("WlxLoggedOnSAS: SasType WLX_SAS_TYPE_TIMEOUT not supported!\n");
break;
}
default:
{
WARN("WlxLoggedOnSAS: Unknown SasType: 0x%x\n", dwSasType);
break;
}
}
return SasAction;
}
BOOL
CALLBACK
StatusMessageWindowProc(
HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
PDISPLAYSTATUSMSG msg = (PDISPLAYSTATUSMSG)lParam;
if(!msg)
return FALSE;
msg->Context->hStatusWindow = hwndDlg;
if(msg->pTitle)
SetWindowText(hwndDlg, msg->pTitle);
SetDlgItemText(hwndDlg, IDC_STATUSLABEL, msg->pMessage);
if(!msg->Context->SignaledStatusWindowCreated)
{
msg->Context->SignaledStatusWindowCreated = TRUE;
SetEvent(msg->StartupEvent);
}
break;
}
}
return FALSE;
}
DWORD WINAPI
StartupWindowThread(LPVOID lpParam)
{
HDESK OldDesk;
PDISPLAYSTATUSMSG msg = (PDISPLAYSTATUSMSG)lpParam;
OldDesk = GetThreadDesktop(GetCurrentThreadId());
if(!SetThreadDesktop(msg->hDesktop))
{
HeapFree(GetProcessHeap(), 0, lpParam);
return FALSE;
}
DialogBoxParam(hDllInstance,
MAKEINTRESOURCE(IDD_STATUSWINDOW),
0,
StatusMessageWindowProc,
(LPARAM)lpParam);
SetThreadDesktop(OldDesk);
msg->Context->hStatusWindow = 0;
msg->Context->SignaledStatusWindowCreated = FALSE;
HeapFree(GetProcessHeap(), 0, lpParam);
return TRUE;
}
/*
* @implemented
*/
BOOL WINAPI
WlxDisplayStatusMessage(
PVOID pWlxContext,
HDESK hDesktop,
DWORD dwOptions,
PWSTR pTitle,
PWSTR pMessage)
{
PDISPLAYSTATUSMSG msg;
HANDLE Thread;
DWORD ThreadId;
PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
if(!pgContext->hStatusWindow)
{
msg = (PDISPLAYSTATUSMSG)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DISPLAYSTATUSMSG));
if(!msg)
return FALSE;
msg->Context = pgContext;
msg->dwOptions = dwOptions;
msg->pTitle = pTitle;
msg->pMessage = pMessage;
msg->hDesktop = hDesktop;
msg->StartupEvent = CreateEvent(NULL,
TRUE,
FALSE,
NULL);
if(!msg->StartupEvent)
return FALSE;
Thread = CreateThread(NULL,
0,
StartupWindowThread,
(PVOID)msg,
0,
&ThreadId);
if(Thread)
{
CloseHandle(Thread);
WaitForSingleObject(msg->StartupEvent, INFINITE);
CloseHandle(msg->StartupEvent);
return TRUE;
}
return FALSE;
}
if(pTitle)
SetWindowText(pgContext->hStatusWindow, pTitle);
SetDlgItemText(pgContext->hStatusWindow, IDC_STATUSLABEL, pMessage);
return TRUE;
}
/*
* @implemented
*/
BOOL WINAPI
WlxRemoveStatusMessage(
PVOID pWlxContext)
{
PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
if(pgContext->hStatusWindow)
{
EndDialog(pgContext->hStatusWindow, 0);
pgContext->hStatusWindow = 0;
}
return TRUE;
}
/*
* @implemented
*/
VOID WINAPI
WlxDisplaySASNotice(
PVOID pWlxContext)
{
PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
pgContext->pWlxFuncs->WlxSasNotify(pgContext->hWlx, WLX_SAS_TYPE_CTRL_ALT_DEL);
}
static PWSTR
DuplicationString(PWSTR Str)
{
DWORD cb;
PWSTR NewStr;
cb = (wcslen(Str) + 1) * sizeof(WCHAR);
if((NewStr = LocalAlloc(LMEM_FIXED, cb)))
{
memcpy(NewStr, Str, cb);
}
return NewStr;
}
/*
* @unimplemented
*/
int WINAPI
WlxLoggedOutSAS(
PVOID pWlxContext,
DWORD dwSasType,
PLUID pAuthenticationId,
PSID pLogonSid,
PDWORD pdwOptions,
PHANDLE phToken,
PWLX_MPR_NOTIFY_INFO pNprNotifyInfo,
PVOID *pProfile)
{
PGINA_CONTEXT pgContext = (PGINA_CONTEXT)pWlxContext;
TOKEN_STATISTICS Stats;
DWORD cbStats;
if(!phToken)
{
WARN("msgina: phToken == NULL!\n");
return WLX_SAS_ACTION_NONE;
}
if(!LogonUser(L"Administrator", NULL, L"Secrect",
LOGON32_LOGON_INTERACTIVE, /* FIXME - use LOGON32_LOGON_UNLOCK instead! */
LOGON32_PROVIDER_DEFAULT,
phToken))
{
WARN("msgina: Logonuser() failed\n");
return WLX_SAS_ACTION_NONE;
}
if(!(*phToken))
{
WARN("msgina: *phToken == NULL!\n");
return WLX_SAS_ACTION_NONE;
}
pgContext->UserToken =*phToken;
*pdwOptions = 0;
*pProfile =NULL;
if(!GetTokenInformation(*phToken,
TokenStatistics,
(PVOID)&Stats,
sizeof(TOKEN_STATISTICS),
&cbStats))
{
WARN("msgina: Couldn't get Autentication id from user token!\n");
return WLX_SAS_ACTION_NONE;
}
*pAuthenticationId = Stats.AuthenticationId;
pNprNotifyInfo->pszUserName = DuplicationString(L"Administrator");
pNprNotifyInfo->pszDomain = NULL;
pNprNotifyInfo->pszPassword = DuplicationString(L"Secret");
pNprNotifyInfo->pszOldPassword = NULL;
return WLX_SAS_ACTION_LOGON;
}
BOOL STDCALL
DllMain(
HINSTANCE hinstDLL,
DWORD dwReason,
LPVOID lpvReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
/* fall through */
case DLL_THREAD_ATTACH:
hDllInstance = hinstDLL;
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View file

@ -0,0 +1,55 @@
LIBRARY msgina.dll
EXPORTS
;MSGINA.1@0
;MSGINA.2@0
;MSGINA.3@0
;MSGINA.4@0
;MSGINA.5@0
;MSGINA.6@0
;MSGINA.7@0
;MSGINA.8@0
;MSGINA.9@0
;MSGINA.10@0
;MSGINA.11@0
;MSGINA.12@0
;MSGINA.13@0
;MSGINA.14@0
;MSGINA.15@0
;MSGINA.16@0
;MSGINA.17@0
;MSGINA.18@0
;MSGINA.19@0
;MSGINA.20@0
;MSGINA.21@0
;MSGINA.22@0
;MSGINA.23@0
;MSGINA.24@0
;MSGINA.25@0
;MSGINA.26@0
;MSGINA.27@0
;MSGINA.28@0
ShellShutdownDialog@12
WlxActivateUserShell@16
WlxDisplayLockedNotice@4
WlxDisplaySASNotice@4
WlxInitialize@20
WlxIsLockOk@4
WlxIsLogoffOk@4
WlxLoggedOnSAS@12
WlxLoggedOutSAS@32
WlxLogoff@4
WlxNegotiate@8
WlxShutdown@8
WlxWkstaLockedSAS@8
WlxScreenSaverNotify@8
WlxStartApplication@16
WlxDisplayStatusMessage@20
WlxGetStatusMessage@16
WlxNetworkProviderLoad@8
;WlxReconnectNotify@0
WlxRemoveStatusMessage@4
WlxDisconnectNotify@4
WlxGetConsoleSwitchCredentials@8
; EOF

View file

@ -0,0 +1,22 @@
#ifndef __MSGINA_H
#define __MSGINA_H
#define GINA_VERSION (WLX_VERSION_1_3)
#define PWLX_DISPATCH_VERSION PWLX_DISPATCH_VERSION_1_3
typedef struct {
HANDLE hWlx;
LPWSTR station;
PWLX_DISPATCH_VERSION pWlxFuncs;
HANDLE hDllInstance;
HANDLE UserToken;
HWND hStatusWindow;
BOOL SignaledStatusWindowCreated;
} GINA_CONTEXT, *PGINA_CONTEXT;
HINSTANCE hDllInstance;
#endif /* __MSGINA_H */
/* EOF */

View file

@ -0,0 +1,34 @@
#include <windows.h>
#include "resource.h"
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Logon GINA DLL\0"
#define REACTOS_STR_INTERNAL_NAME "msgina\0"
#define REACTOS_STR_ORIGINAL_FILENAME "msgina.dll\0"
#include <reactos/version.rc>
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDI_LOGOFFICON ICON "resources/ico_logoff.ico"
IDD_LOGOFF_DLG DIALOG 0, 0, 188, 60
STYLE DS_FIXEDSYS | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Log Off ReactOS"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Sans Serif"
{
ICON IDI_LOGOFFICON, IDC_LOGOFFICON, 7, 7, 21, 21, SS_ICON | WS_CHILD | WS_VISIBLE
LTEXT "Are you sure you want to log off?", -1, 35, 16, 146, 8, SS_LEFT | WS_CHILD | WS_VISIBLE | WS_GROUP
PUSHBUTTON "&Log Off", 1, 41, 39, 50, 14, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "&No", 2, 95, 39, 50, 14, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP
}
IDD_STATUSWINDOW DIALOG 0, 0, 274, 26
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Please wait..."
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Sans Serif"
{
LTEXT "", IDC_STATUSLABEL, 7, 8, 234, 12, SS_ENDELLIPSIS
}

View file

@ -0,0 +1,16 @@
<module name="msgina" type="win32dll" baseaddress="${BASEADDRESS_MSGINA}" installbase="system32" installname="msgina.dll">
<importlibrary definition="msgina.def" />
<include base="msgina">.</include>
<include base="msgina">include</include>
<define name="UNICODE" />
<define name="_UNICODE" />
<define name="__REACTOS__" />
<define name="__USE_W32API" />
<library>ntdll</library>
<library>kernel32</library>
<library>advapi32</library>
<library>user32</library>
<file>msgina.c</file>
<file>stubs.c</file>
<file>msgina.rc</file>
</module>

View file

@ -0,0 +1,14 @@
#ifndef __MSGINA_RESOURCE_H
#define __MSGINA_RESOURCE_H
#define IDD_LOGOFF_DLG 2250
#define IDD_STATUSWINDOW 2450
#define IDC_LOGOFFICON 21
#define IDC_STATUSLABEL 2451
#define IDI_LOGOFFICON 2251
#endif /* __MSGINA_RESOURCE_H */
/* EOF */

Some files were not shown because too many files have changed in this diff Show more