2001-10-30 23:20:31 +00:00
|
|
|
/* to compile: gcc -o qtxload qtxload.c ../libloader.a -lpthread -ldl -ggdb ../../cpudetect.o */
|
|
|
|
|
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"
|
2001-10-27 17:45:27 +00:00
|
|
|
|
2001-11-09 03:26:48 +00:00
|
|
|
#define DEF_DISPATCHER(name) ComponentResult (*##name)(ComponentParameters *, void **)
|
2001-10-27 17:45:27 +00:00
|
|
|
|
|
|
|
/* ilyen egy sima komponens */
|
|
|
|
ComponentResult ComponentDummy(
|
2001-11-09 03:26:48 +00:00
|
|
|
ComponentParameters *params,
|
2001-10-27 17:45:27 +00:00
|
|
|
void **globals,
|
|
|
|
DEF_DISPATCHER(ComponentDispatch))
|
|
|
|
{
|
|
|
|
printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n",
|
|
|
|
params, globals, ComponentDispatch);
|
|
|
|
printf(" Dummy: global datas: %p\n", *globals);
|
|
|
|
printf(" Dummy: returning 0\n");
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
2001-11-10 18:06:47 +00:00
|
|
|
char *get_path(char* x){ return strdup(x);}
|
2001-10-27 17:45:27 +00:00
|
|
|
|
2002-01-01 23:18:17 +00:00
|
|
|
void* LoadLibraryA(char* name);
|
2001-11-10 18:06:47 +00:00
|
|
|
void* GetProcAddress(void* handle,char* func);
|
|
|
|
|
|
|
|
#define __stdcall __attribute__((__stdcall__))
|
|
|
|
#define __cdecl __attribute__((__cdecl__))
|
|
|
|
#define APIENTRY
|
|
|
|
|
2002-01-01 23:18:17 +00:00
|
|
|
unsigned int* x_table[0x00001837];
|
|
|
|
|
2001-11-10 18:06:47 +00:00
|
|
|
int main(int argc, char *argv[]){
|
2001-10-27 17:45:27 +00:00
|
|
|
void *handler;
|
2002-01-01 23:18:17 +00:00
|
|
|
ComponentResult (*
|
2001-11-10 18:06:47 +00:00
|
|
|
dispatcher)(ComponentParameters *params, Globals glob);
|
|
|
|
ComponentResult ret;
|
|
|
|
ComponentParameters *params;
|
|
|
|
ComponentDescription desc;
|
|
|
|
void *globals=NULL;
|
|
|
|
unsigned int esp=0;
|
2002-01-01 23:18:17 +00:00
|
|
|
int i;
|
2001-10-27 17:45:27 +00:00
|
|
|
|
|
|
|
Setup_LDT_Keeper();
|
2002-01-01 23:18:17 +00:00
|
|
|
handler = LoadLibraryA("/usr/lib/win32/QuickTime.qts");
|
2001-11-08 15:23:22 +00:00
|
|
|
dispatcher = GetProcAddress(handler, "SorensonYUV9Dispatcher");
|
2001-11-10 18:06:47 +00:00
|
|
|
// handler = expLoadLibraryA("/usr/lib/win32/On2_VP3.qtx");
|
|
|
|
// dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
|
2001-10-27 17:45:27 +00:00
|
|
|
printf("handler: %p, dispatcher: %p\n", handler, dispatcher);
|
2001-11-10 18:06:47 +00:00
|
|
|
|
2002-01-01 23:18:17 +00:00
|
|
|
printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher"));
|
|
|
|
|
2001-11-10 18:06:47 +00:00
|
|
|
desc.componentType=0;
|
|
|
|
desc.componentSubType=0;
|
|
|
|
desc.componentManufacturer=0;
|
|
|
|
desc.componentFlags=0;
|
|
|
|
desc.componentFlagsMask=0;
|
2001-10-27 17:45:27 +00:00
|
|
|
|
2001-11-10 18:06:47 +00:00
|
|
|
params = malloc(sizeof(ComponentParameters)+2048);
|
|
|
|
|
|
|
|
params->flags = 0;
|
2002-01-01 23:18:17 +00:00
|
|
|
params->paramSize = 0;
|
|
|
|
params->what = kComponentRegisterSelect;
|
|
|
|
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++){
|
|
|
|
params->flags = 0;
|
|
|
|
params->paramSize = 4; //sizeof(params->params[0]);
|
|
|
|
params->params[0] = 0x820000; //0x820000|i; //(i<<16)|0x24; //0x820024;
|
2001-11-10 18:06:47 +00:00
|
|
|
|
|
|
|
// params->what = kComponentVersionSelect;
|
|
|
|
// params->what = kComponentRegisterSelect;
|
|
|
|
params->what = kComponentOpenSelect;
|
|
|
|
// params->what = kComponentCanDoSelect;
|
|
|
|
|
|
|
|
printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
|
|
|
|
params->flags, params->paramSize, params->what, params->params[0]);
|
|
|
|
|
2002-01-01 23:18:17 +00:00
|
|
|
// __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
|
|
|
// 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);
|
|
|
|
|
2002-01-01 23:18:17 +00:00
|
|
|
// __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
|
|
|
// 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]);
|
2001-10-27 17:45:27 +00:00
|
|
|
|
2001-11-10 18:06:47 +00:00
|
|
|
Restore_LDT_Keeper();
|
|
|
|
exit(0);
|
|
|
|
//return 0;
|
2001-10-27 17:45:27 +00:00
|
|
|
}
|