Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ebcbdb9c
Commit
ebcbdb9c
authored
Oct 20, 2009
by
Eric Pouech
Committed by
Alexandre Julliard
Oct 21, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winmm: Simplify mciLoadCommandResource by dropping 16bit module support.
parent
dd26bee1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
87 deletions
+45
-87
mci.c
dlls/winmm/mci.c
+26
-29
mci16.c
dlls/winmm/mci16.c
+19
-0
mmsystem.c
dlls/winmm/mmsystem.c
+0
-56
winemm.h
dlls/winmm/winemm.h
+0
-2
No files found.
dlls/winmm/mci.c
View file @
ebcbdb9c
...
...
@@ -84,6 +84,7 @@ static const WCHAR wszSystemIni[] = {'s','y','s','t','e','m','.','i','n','i',0};
static
WINE_MCIDRIVER
*
MciDrivers
;
static
UINT
WINAPI
MCI_DefYieldProc
(
MCIDEVICEID
wDevID
,
DWORD
data
);
static
UINT
MCI_SetCommandTable
(
HGLOBAL
hMem
,
UINT
uDevType
);
/* dup a string and uppercase it */
static
inline
LPWSTR
str_dup_upper
(
LPCWSTR
str
)
...
...
@@ -581,6 +582,7 @@ static DWORD MCI_GetDevTypeFromFileName(LPCWSTR fileName, LPWSTR buf, UINT len)
typedef
struct
tagWINE_MCICMDTABLE
{
UINT
uDevType
;
HGLOBAL
hMem
;
const
BYTE
*
lpTable
;
UINT
nVerbs
;
/* number of verbs in command table */
LPCWSTR
*
aVerbs
;
/* array of verbs to speed up the verb look up process */
...
...
@@ -694,7 +696,7 @@ static UINT MCI_GetCommandTable(UINT uDevType)
if
(
hRsrc
)
hMem
=
LoadResource
(
hWinMM32Instance
,
hRsrc
);
if
(
hMem
)
{
uTbl
=
MCI_SetCommandTable
(
LockResource
(
hMem
)
,
uDevType
);
uTbl
=
MCI_SetCommandTable
(
hMem
,
uDevType
);
}
else
{
WARN
(
"No command table found in resource %p[%s]
\n
"
,
hWinMM32Instance
,
debugstr_w
(
str
));
...
...
@@ -707,7 +709,7 @@ static UINT MCI_GetCommandTable(UINT uDevType)
/**************************************************************************
* MCI_SetCommandTable [internal]
*/
UINT
MCI_SetCommandTable
(
void
*
table
,
UINT
uDevType
)
static
UINT
MCI_SetCommandTable
(
HGLOBAL
hMem
,
UINT
uDevType
)
{
int
uTbl
;
static
BOOL
bInitDone
=
FALSE
;
...
...
@@ -721,7 +723,7 @@ UINT MCI_SetCommandTable(void *table, UINT uDevType)
bInitDone
=
TRUE
;
MCI_GetCommandTable
(
0
);
}
TRACE
(
"(%p, %u)
\n
"
,
table
,
uDevType
);
TRACE
(
"(%p, %u)
\n
"
,
hMem
,
uDevType
);
for
(
uTbl
=
0
;
uTbl
<
MAX_MCICMDTABLE
;
uTbl
++
)
{
if
(
!
S_MciCmdTable
[
uTbl
].
lpTable
)
{
const
BYTE
*
lmem
;
...
...
@@ -730,7 +732,8 @@ UINT MCI_SetCommandTable(void *table, UINT uDevType)
WORD
count
;
S_MciCmdTable
[
uTbl
].
uDevType
=
uDevType
;
S_MciCmdTable
[
uTbl
].
lpTable
=
table
;
S_MciCmdTable
[
uTbl
].
lpTable
=
LockResource
(
hMem
);
S_MciCmdTable
[
uTbl
].
hMem
=
hMem
;
if
(
TRACE_ON
(
mci
))
{
MCI_DumpCommandTable
(
uTbl
);
...
...
@@ -771,21 +774,6 @@ UINT MCI_SetCommandTable(void *table, UINT uDevType)
}
/**************************************************************************
* MCI_DeleteCommandTable [internal]
*/
BOOL
MCI_DeleteCommandTable
(
UINT
uTbl
,
BOOL
delete
)
{
if
(
uTbl
>=
MAX_MCICMDTABLE
||
!
S_MciCmdTable
[
uTbl
].
lpTable
)
return
FALSE
;
if
(
delete
)
HeapFree
(
GetProcessHeap
(),
0
,
(
void
*
)
S_MciCmdTable
[
uTbl
].
lpTable
);
S_MciCmdTable
[
uTbl
].
lpTable
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
S_MciCmdTable
[
uTbl
].
aVerbs
);
S_MciCmdTable
[
uTbl
].
aVerbs
=
0
;
return
TRUE
;
}
/**************************************************************************
* MCI_UnLoadMciDriver [internal]
*/
static
BOOL
MCI_UnLoadMciDriver
(
LPWINE_MCIDRIVER
wmd
)
...
...
@@ -1539,9 +1527,9 @@ BOOL WINAPI mciExecute(LPCSTR lpstrCommand)
*/
UINT
WINAPI
mciLoadCommandResource
(
HINSTANCE
hInst
,
LPCWSTR
resNameW
,
UINT
type
)
{
HRSRC
hRsrc
=
0
;
H
GLOBAL
hMem
;
UINT16
ret
=
MCI_NO_COMMAND_TABLE
;
UINT
ret
=
MCI_NO_COMMAND_TABLE
;
H
RSRC
hRsrc
=
0
;
HGLOBAL
hMem
;
TRACE
(
"(%p, %s, %d)!
\n
"
,
hInst
,
debugstr_w
(
resNameW
),
type
);
...
...
@@ -1563,13 +1551,13 @@ UINT WINAPI mciLoadCommandResource(HINSTANCE hInst, LPCWSTR resNameW, UINT type)
}
#endif
}
if
(
!
(
hRsrc
=
FindResourceW
(
hInst
,
resNameW
,
(
LPWSTR
)
RT_RCDATA
)))
{
WARN
(
"No command table found in resource
\n
"
);
}
else
if
((
hMem
=
LoadResource
(
hInst
,
hRsrc
)))
{
ret
=
MCI_SetCommandTable
(
LockResource
(
hMem
),
type
);
}
else
{
WARN
(
"Couldn't load resource.
\n
"
);
if
((
hRsrc
=
FindResourceW
(
hInst
,
resNameW
,
(
LPWSTR
)
RT_RCDATA
))
&&
(
hMem
=
LoadResource
(
hInst
,
hRsrc
)))
{
ret
=
MCI_SetCommandTable
(
hMem
,
type
);
FreeResource
(
hMem
);
}
else
WARN
(
"No command table found in module for %s
\n
"
,
debugstr_w
(
resNameW
));
TRACE
(
"=> %04x
\n
"
,
ret
);
return
ret
;
}
...
...
@@ -1581,7 +1569,16 @@ BOOL WINAPI mciFreeCommandResource(UINT uTable)
{
TRACE
(
"(%08x)!
\n
"
,
uTable
);
return
MCI_DeleteCommandTable
(
uTable
,
FALSE
);
if
(
uTable
>=
MAX_MCICMDTABLE
||
!
S_MciCmdTable
[
uTable
].
lpTable
)
return
FALSE
;
FreeResource
(
S_MciCmdTable
[
uTable
].
hMem
);
S_MciCmdTable
[
uTable
].
hMem
=
NULL
;
S_MciCmdTable
[
uTable
].
lpTable
=
NULL
;
HeapFree
(
GetProcessHeap
(),
0
,
S_MciCmdTable
[
uTable
].
aVerbs
);
S_MciCmdTable
[
uTable
].
aVerbs
=
0
;
S_MciCmdTable
[
uTable
].
nVerbs
=
0
;
return
TRUE
;
}
/**************************************************************************
...
...
dlls/winmm/mci16.c
View file @
ebcbdb9c
...
...
@@ -323,3 +323,22 @@ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet,
{
return
mciSendStringA
(
lpstrCommand
,
lpstrRet
,
uRetLen
,
HWND_32
(
hwndCallback
));
}
/**************************************************************************
* mciLoadCommandResource [MMSYSTEM.705]
*/
UINT16
WINAPI
mciLoadCommandResource16
(
HINSTANCE16
hInst
,
LPCSTR
resname
,
UINT16
type
)
{
TRACE
(
"(%04x, %s, %x)!
\n
"
,
hInst
,
resname
,
type
);
return
MCI_NO_COMMAND_TABLE
;
}
/**************************************************************************
* mciFreeCommandResource [MMSYSTEM.713]
*/
BOOL16
WINAPI
mciFreeCommandResource16
(
UINT16
uTable
)
{
TRACE
(
"(%04x)!
\n
"
,
uTable
);
return
FALSE
;
}
dlls/winmm/mmsystem.c
View file @
ebcbdb9c
...
...
@@ -2509,62 +2509,6 @@ MMRESULT16 WINAPI timeEndPeriod16(UINT16 wPeriod)
return
timeEndPeriod
(
wPeriod
);
}
/**************************************************************************
* mciLoadCommandResource [MMSYSTEM.705]
*/
UINT16
WINAPI
mciLoadCommandResource16
(
HINSTANCE16
hInst
,
LPCSTR
resname
,
UINT16
type
)
{
HRSRC16
res
;
HGLOBAL16
handle
;
const
BYTE
*
ptr16
;
BYTE
*
ptr32
;
unsigned
pos
=
0
,
size
=
1024
,
len
;
const
char
*
str
;
DWORD
flg
;
WORD
eid
;
UINT16
ret
=
MCIERR_OUT_OF_MEMORY
;
if
(
!
(
res
=
FindResource16
(
hInst
,
resname
,
(
LPSTR
)
RT_RCDATA
)))
return
MCI_NO_COMMAND_TABLE
;
if
(
!
(
handle
=
LoadResource16
(
hInst
,
res
)))
return
MCI_NO_COMMAND_TABLE
;
ptr16
=
LockResource16
(
handle
);
/* converting the 16 bit resource table into a 32W one */
if
((
ptr32
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
)))
{
do
{
str
=
(
LPCSTR
)
ptr16
;
ptr16
+=
strlen
(
str
)
+
1
;
flg
=
*
(
const
DWORD
*
)
ptr16
;
eid
=
*
(
const
WORD
*
)(
ptr16
+
sizeof
(
DWORD
));
ptr16
+=
sizeof
(
DWORD
)
+
sizeof
(
WORD
);
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
)
*
sizeof
(
WCHAR
);
if
(
pos
+
len
+
sizeof
(
DWORD
)
+
sizeof
(
WORD
)
>
size
)
{
while
(
pos
+
len
*
sizeof
(
WCHAR
)
+
sizeof
(
DWORD
)
+
sizeof
(
WORD
)
>
size
)
size
+=
1024
;
ptr32
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
ptr32
,
size
);
if
(
!
ptr32
)
goto
the_end
;
}
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
(
LPWSTR
)(
ptr32
+
pos
),
len
/
sizeof
(
WCHAR
));
*
(
DWORD
*
)(
ptr32
+
pos
+
len
)
=
flg
;
*
(
WORD
*
)(
ptr32
+
pos
+
len
+
sizeof
(
DWORD
))
=
eid
;
pos
+=
len
+
sizeof
(
DWORD
)
+
sizeof
(
WORD
);
}
while
(
eid
!=
MCI_END_COMMAND_LIST
);
}
the_end:
FreeResource16
(
handle
);
if
(
ptr32
)
ret
=
MCI_SetCommandTable
(
ptr32
,
type
);
return
ret
;
}
/**************************************************************************
* mciFreeCommandResource [MMSYSTEM.713]
*/
BOOL16
WINAPI
mciFreeCommandResource16
(
UINT16
uTable
)
{
TRACE
(
"(%04x)!
\n
"
,
uTable
);
return
MCI_DeleteCommandTable
(
uTable
,
TRUE
);
}
/* ###################################################
* # JOYSTICK #
* ###################################################
...
...
dlls/winmm/winemm.h
View file @
ebcbdb9c
...
...
@@ -197,8 +197,6 @@ void MMDRV_InstallMap(unsigned int, MMDRV_MAPFUNC, MMDRV_UNMAPFUNC,
const
char
*
MCI_MessageToString
(
UINT
wMsg
);
DWORD
MCI_SendCommand
(
UINT
wDevID
,
UINT16
wMsg
,
DWORD_PTR
dwParam1
,
DWORD_PTR
dwParam2
);
UINT
MCI_SetCommandTable
(
void
*
table
,
UINT
uDevType
);
BOOL
MCI_DeleteCommandTable
(
UINT
uTbl
,
BOOL
delete
);
LPWSTR
MCI_strdupAtoW
(
LPCSTR
str
);
LPSTR
MCI_strdupWtoA
(
LPCWSTR
str
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment