procedure
TForm1
.
FormCreate(Sender: TObject);
var
hDSound:
Cardinal
;
pDirectSoundCreate:
Pointer
;
hWinmm:
Cardinal
;
pmidiStreamOpen:
Pointer
;
pwaveOutWrite:
Pointer
;
lp:
Cardinal
;
begin
hDSound := LoadLibrary(
'DSound.dll'
);
if
hDSound >
0
then
pDirectSoundCreate := GetProcAddress(hDSound,
'DirectSoundCreate'
);
if
pDirectSoundCreate <>
nil
then
begin
VirtualProtect(pDirectSoundCreate,
3
, PAGE_EXECUTE_READWRITE, lp);
Move(#
$C2
#
$0C
#
$00
, pDirectSoundCreate^,
3
);
end
;
hWinmm := LoadLibrary(
'Winmm.dll'
);
if
hWinmm >
0
then
pmidiStreamOpen := GetProcAddress(hWinmm,
'midiStreamOpen'
);
if
pmidiStreamOpen <>
nil
then
begin
VirtualProtect(pmidiStreamOpen,
3
, PAGE_EXECUTE_READWRITE, lp);
Move(#
$C2
#
$04
#
$00
, pmidiStreamOpen^,
3
);
end
;
if
hWinmm >
0
then
pwaveOutWrite := GetProcAddress(hWinmm,
'waveOutWrite'
);
if
pwaveOutWrite <>
nil
then
begin
VirtualProtect(pwaveOutWrite,
3
, PAGE_EXECUTE_READWRITE, lp);
Move(#
$C2
#
$0C
#
$00
, pwaveOutWrite^,
3
);
end
;
end
;