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
|
|
|
|
2001-11-10 18:06:47 +00:00
|
|
|
void* expLoadLibraryA(char* name);
|
|
|
|
void* GetProcAddress(void* handle,char* func);
|
|
|
|
|
|
|
|
#define __stdcall __attribute__((__stdcall__))
|
|
|
|
#define __cdecl __attribute__((__cdecl__))
|
|
|
|
#define APIENTRY
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]){
|
2001-10-27 17:45:27 +00:00
|
|
|
void *handler;
|
2001-11-10 18:06:47 +00:00
|
|
|
ComponentResult (APIENTRY *
|
|
|
|
dispatcher)(ComponentParameters *params, Globals glob);
|
|
|
|
ComponentResult ret;
|
|
|
|
ComponentParameters *params;
|
|
|
|
ComponentDescription desc;
|
|
|
|
void *globals=NULL;
|
|
|
|
unsigned int esp=0;
|
2001-10-27 17:45:27 +00:00
|
|
|
|
|
|
|
Setup_LDT_Keeper();
|
2001-11-08 15:23:22 +00:00
|
|
|
handler = expLoadLibraryA("/usr/lib/win32/QuickTime.qts");
|
|
|
|
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
|
|
|
|
|
|
|
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;
|
|
|
|
params->paramSize = sizeof(params->params[0]);
|
|
|
|
params->params[0] = 0x12345678;
|
|
|
|
|
|
|
|
// 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]);
|
|
|
|
|
|
|
|
__asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
|
|
|
printf("ESP=%p\n",esp);
|
|
|
|
|
|
|
|
ret = dispatcher(params, &globals);
|
|
|
|
|
|
|
|
__asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
|
|
|
printf("ESP=%p\n",esp);
|
|
|
|
|
|
|
|
printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals);
|
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
|
|
|
}
|