2010-02-03 08:32:35 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer 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.
|
|
|
|
*
|
|
|
|
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2001-10-27 17:45:27 +00:00
|
|
|
#include <stdio.h>
|
2001-11-10 18:06:47 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2001-10-27 17:45:27 +00:00
|
|
|
#include "qtxsdk/components.h"
|
2001-11-09 03:26:48 +00:00
|
|
|
#include "qtxsdk/select.h"
|
2010-01-04 20:32:23 +00:00
|
|
|
#include "loader/ldt_keeper.h"
|
2010-06-14 11:30:59 +00:00
|
|
|
#include "loader/wine/winbase.h"
|
2008-04-28 12:03:52 +00:00
|
|
|
#include "mp_msg.h"
|
2001-10-27 17:45:27 +00:00
|
|
|
|
2002-01-01 23:18:17 +00:00
|
|
|
unsigned int* x_table[0x00001837];
|
|
|
|
|
2002-11-24 21:43:17 +00:00
|
|
|
static OSErr (*InitializeQTML)(long flags);
|
|
|
|
|
2009-02-17 12:00:43 +00:00
|
|
|
int main(void) {
|
2001-10-27 17:45:27 +00:00
|
|
|
void *handler;
|
2002-11-24 21:43:17 +00:00
|
|
|
void *handler2;
|
|
|
|
void* theqtdp=NULL;
|
|
|
|
void* compcall=NULL;
|
|
|
|
void* compcallws=NULL;
|
2005-08-10 22:48:32 +00:00
|
|
|
ComponentResult (*dispatcher)(ComponentParameters *params, Globals glob);
|
2001-11-10 18:06:47 +00:00
|
|
|
ComponentResult ret;
|
|
|
|
ComponentParameters *params;
|
|
|
|
ComponentDescription desc;
|
|
|
|
void *globals=NULL;
|
2008-04-28 11:57:38 +00:00
|
|
|
//unsigned int esp=0;
|
|
|
|
//int i;
|
2001-10-27 17:45:27 +00:00
|
|
|
|
2002-11-24 21:43:17 +00:00
|
|
|
mp_msg_init();
|
2008-01-06 11:56:03 +00:00
|
|
|
//mp_msg_set_level(10);
|
2002-11-24 21:43:17 +00:00
|
|
|
|
2001-10-27 17:45:27 +00:00
|
|
|
Setup_LDT_Keeper();
|
2002-11-24 21:43:17 +00:00
|
|
|
printf("loading qts\n");
|
|
|
|
// handler = LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime.qts");
|
|
|
|
handler = LoadLibraryA("QuickTime.qts");
|
|
|
|
theqtdp = GetProcAddress(handler, "theQuickTimeDispatcher");
|
2008-01-20 17:16:39 +00:00
|
|
|
compcall = GetProcAddress(handler, "CallComponent");
|
|
|
|
compcallws = GetProcAddress(handler, "CallComponentFunctionWithStorage");
|
2002-11-24 21:43:17 +00:00
|
|
|
|
|
|
|
InitializeQTML = 0x6299e590;//GetProcAddress(handler, "InitializeQTML");
|
|
|
|
InitializeQTML(6+16);
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2002-11-24 21:43:17 +00:00
|
|
|
printf("loading svq3\n");
|
|
|
|
handler2= LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime/QuickTimeEssentials.qtx");
|
|
|
|
printf("done\n");
|
|
|
|
dispatcher = GetProcAddress(handler2, "SMD_ComponentDispatch");
|
2008-01-06 12:22:56 +00:00
|
|
|
// handler = expLoadLibraryA("/usr/local/lib/codecs/On2_VP3.qtx");
|
2001-11-10 18:06:47 +00:00
|
|
|
// dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
|
2002-11-24 21:43:17 +00:00
|
|
|
printf("handler: %p, dispatcher: %p theqtdp: %p\n", handler, dispatcher, theqtdp);
|
|
|
|
|
|
|
|
// printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher"));
|
2001-11-10 18:06:47 +00:00
|
|
|
|
2002-11-24 21:43:17 +00:00
|
|
|
// patch svq3 dll:
|
|
|
|
*((void**)0x63214c98) = NULL;
|
|
|
|
*((void**)0x63214c9c) = theqtdp; // theQt...
|
|
|
|
*((void**)0x63214ca0) = compcall; //0xdeadbeef; //dispatcher; // CallCOmponent_ptr
|
|
|
|
*((void**)0x63214ca4) = compcallws; //0xdeadbef2; //dispatcher; // CallComponentWithStorage_ptr
|
2002-01-01 23:18:17 +00:00
|
|
|
|
2001-11-10 18:06:47 +00:00
|
|
|
desc.componentType=0;
|
|
|
|
desc.componentSubType=0;
|
|
|
|
desc.componentManufacturer=0;
|
|
|
|
desc.componentFlags=0;
|
|
|
|
desc.componentFlagsMask=0;
|
2009-05-13 02:58:57 +00:00
|
|
|
|
2001-11-10 18:06:47 +00:00
|
|
|
params = malloc(sizeof(ComponentParameters)+2048);
|
|
|
|
|
|
|
|
params->flags = 0;
|
2002-11-24 21:43:17 +00:00
|
|
|
params->paramSize = 4;
|
|
|
|
params->what = kComponentOpenSelect;
|
|
|
|
params->params[0] = 0x830000; //0x820000|i; //(i<<16)|0x24; //0x820024;
|
2002-01-01 23:18:17 +00:00
|
|
|
ret = dispatcher(params, &globals);
|
|
|
|
printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals);
|
|
|
|
|
|
|
|
// memset(x_table,12,4*0x00001837);
|
|
|
|
|
|
|
|
//for(i=0;i<=255;i++){
|
2001-11-10 18:06:47 +00:00
|
|
|
|
|
|
|
// params->what = kComponentVersionSelect;
|
|
|
|
// params->what = kComponentRegisterSelect;
|
2002-11-24 21:43:17 +00:00
|
|
|
// params->what = kComponentOpenSelect;
|
2001-11-10 18:06:47 +00:00
|
|
|
// params->what = kComponentCanDoSelect;
|
|
|
|
|
|
|
|
printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
|
|
|
|
params->flags, params->paramSize, params->what, params->params[0]);
|
|
|
|
|
2008-10-16 20:17:56 +00:00
|
|
|
// __asm__ volatile ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
2002-01-01 23:18:17 +00:00
|
|
|
// printf("ESP=%p\n",esp);
|
|
|
|
|
|
|
|
*((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack?
|
|
|
|
|
|
|
|
printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]);
|
2001-11-10 18:06:47 +00:00
|
|
|
|
|
|
|
ret = dispatcher(params, &globals);
|
|
|
|
|
2008-10-16 20:17:56 +00:00
|
|
|
// __asm__ volatile ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
2002-01-01 23:18:17 +00:00
|
|
|
// printf("ESP=%p\n",esp);
|
2001-11-10 18:06:47 +00:00
|
|
|
|
2002-01-01 23:18:17 +00:00
|
|
|
printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals);
|
|
|
|
// if(ret!=-3000) break;
|
|
|
|
//}
|
|
|
|
|
|
|
|
// for(i=0;i<0x00001837;i++)
|
|
|
|
// if(x_table[i]) printf("x_table[0x%X] = %p\n",i,x_table[i]);
|
2008-04-28 13:07:01 +00:00
|
|
|
|
2001-11-10 18:06:47 +00:00
|
|
|
exit(0);
|
|
|
|
//return 0;
|
2001-10-27 17:45:27 +00:00
|
|
|
}
|