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
2251fbc3
Commit
2251fbc3
authored
Jan 28, 2001
by
Eric Pouech
Committed by
Alexandre Julliard
Jan 28, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified memory allocation for asynchronous MCI message handling.
parent
15a3d774
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
25 deletions
+7
-25
mcimidi.c
dlls/winmm/mciseq/mcimidi.c
+4
-13
mciwave.c
dlls/winmm/mciwave/mciwave.c
+3
-12
No files found.
dlls/winmm/mciseq/mcimidi.c
View file @
2251fbc3
...
...
@@ -81,7 +81,6 @@ struct SCA {
UINT
wMsg
;
DWORD
dwParam1
;
DWORD
dwParam2
;
BOOL
allocatedCopy
;
};
/* EPP DWORD WINAPI mciSendCommandA(UINT wDevID, UINT wMsg, DWORD dwParam1, DWORD dwParam2); */
...
...
@@ -99,8 +98,6 @@ static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
ret
=
mciSendCommandA
(
sca
->
wDevID
,
sca
->
wMsg
,
sca
->
dwParam1
|
MCI_WAIT
,
sca
->
dwParam2
);
TRACE
(
"In thread after async command (%08x,%u,%08lx,%08lx)
\n
"
,
sca
->
wDevID
,
sca
->
wMsg
,
sca
->
dwParam1
,
sca
->
dwParam2
);
if
(
sca
->
allocatedCopy
)
HeapFree
(
GetProcessHeap
(),
0
,
(
LPVOID
)
sca
->
dwParam2
);
HeapFree
(
GetProcessHeap
(),
0
,
sca
);
ExitThread
(
ret
);
WARN
(
"Should not happen ? what's wrong
\n
"
);
...
...
@@ -114,7 +111,7 @@ static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
static
DWORD
MCI_SendCommandAsync
(
UINT
wDevID
,
UINT
wMsg
,
DWORD
dwParam1
,
DWORD
dwParam2
,
UINT
size
)
{
struct
SCA
*
sca
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
SCA
));
struct
SCA
*
sca
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
SCA
)
+
size
);
if
(
sca
==
0
)
return
MCIERR_OUT_OF_MEMORY
;
...
...
@@ -123,20 +120,14 @@ static DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
sca
->
wMsg
=
wMsg
;
sca
->
dwParam1
=
dwParam1
;
if
(
size
)
{
sca
->
dwParam2
=
(
DWORD
)
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
sca
->
dwParam2
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
sca
);
return
MCIERR_OUT_OF_MEMORY
;
}
sca
->
allocatedCopy
=
TRUE
;
if
(
size
&&
dwParam2
)
{
sca
->
dwParam2
=
(
DWORD
)
sca
+
sizeof
(
struct
SCA
);
/* copy structure passed by program in dwParam2 to be sure
* we can still use it whatever the program does
*/
memcpy
((
LPVOID
)
sca
->
dwParam2
,
(
LPVOID
)
dwParam2
,
size
);
}
else
{
sca
->
dwParam2
=
dwParam2
;
sca
->
allocatedCopy
=
FALSE
;
}
if
(
CreateThread
(
NULL
,
0
,
MCI_SCAStarter
,
sca
,
0
,
NULL
)
==
0
)
{
...
...
@@ -403,7 +394,7 @@ static DWORD MIDI_mciReadMTrk(WINE_MCIMIDI* wmm, MCI_MIDITRACK* mmt)
}
break
;
case
0x03
:
if
(
wmm
->
lpstr
Copyright
)
{
if
(
wmm
->
lpstr
Name
)
{
WARN
(
"Two names (%s|%s)
\n
"
,
wmm
->
lpstrName
,
buf
);
}
else
{
wmm
->
lpstrName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
buf
)
+
1
);
...
...
dlls/winmm/mciwave/mciwave.c
View file @
2251fbc3
...
...
@@ -53,7 +53,6 @@ struct SCA {
UINT
wMsg
;
DWORD
dwParam1
;
DWORD
dwParam2
;
BOOL
allocatedCopy
;
};
/**************************************************************************
...
...
@@ -69,8 +68,6 @@ static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
ret
=
mciSendCommandA
(
sca
->
wDevID
,
sca
->
wMsg
,
sca
->
dwParam1
|
MCI_WAIT
,
sca
->
dwParam2
);
TRACE
(
"In thread after async command (%08x,%u,%08lx,%08lx)
\n
"
,
sca
->
wDevID
,
sca
->
wMsg
,
sca
->
dwParam1
,
sca
->
dwParam2
);
if
(
sca
->
allocatedCopy
)
HeapFree
(
GetProcessHeap
(),
0
,
(
LPVOID
)
sca
->
dwParam2
);
HeapFree
(
GetProcessHeap
(),
0
,
sca
);
ExitThread
(
ret
);
WARN
(
"Should not happen ? what's wrong
\n
"
);
...
...
@@ -84,7 +81,7 @@ static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
static
DWORD
MCI_SendCommandAsync
(
UINT
wDevID
,
UINT
wMsg
,
DWORD
dwParam1
,
DWORD
dwParam2
,
UINT
size
)
{
struct
SCA
*
sca
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
SCA
));
struct
SCA
*
sca
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
struct
SCA
)
+
size
);
if
(
sca
==
0
)
return
MCIERR_OUT_OF_MEMORY
;
...
...
@@ -93,20 +90,14 @@ static DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
sca
->
wMsg
=
wMsg
;
sca
->
dwParam1
=
dwParam1
;
if
(
size
)
{
sca
->
dwParam2
=
(
DWORD
)
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
if
(
sca
->
dwParam2
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
sca
);
return
MCIERR_OUT_OF_MEMORY
;
}
sca
->
allocatedCopy
=
TRUE
;
if
(
size
&&
dwParam2
)
{
sca
->
dwParam2
=
(
DWORD
)
sca
+
sizeof
(
struct
SCA
);
/* copy structure passed by program in dwParam2 to be sure
* we can still use it whatever the program does
*/
memcpy
((
LPVOID
)
sca
->
dwParam2
,
(
LPVOID
)
dwParam2
,
size
);
}
else
{
sca
->
dwParam2
=
dwParam2
;
sca
->
allocatedCopy
=
FALSE
;
}
if
(
CreateThread
(
NULL
,
0
,
MCI_SCAStarter
,
sca
,
0
,
NULL
)
==
0
)
{
...
...
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