2582
|
1 /* to compile: gcc -o qtxload qtxload.c ../libloader.a -lpthread -ldl -ggdb ../../cpudetect.o */
|
|
2
|
2501
|
3 #include <stdio.h>
|
2796
|
4 #include <stdlib.h>
|
|
5 #include <string.h>
|
|
6
|
2501
|
7 #include "qtxsdk/components.h"
|
2778
|
8 #include "qtxsdk/select.h"
|
2501
|
9
|
2778
|
10 #define DEF_DISPATCHER(name) ComponentResult (*##name)(ComponentParameters *, void **)
|
2501
|
11
|
|
12 /* ilyen egy sima komponens */
|
|
13 ComponentResult ComponentDummy(
|
2778
|
14 ComponentParameters *params,
|
2501
|
15 void **globals,
|
|
16 DEF_DISPATCHER(ComponentDispatch))
|
|
17 {
|
|
18 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n",
|
|
19 params, globals, ComponentDispatch);
|
|
20 printf(" Dummy: global datas: %p\n", *globals);
|
|
21 printf(" Dummy: returning 0\n");
|
|
22 return(0);
|
|
23 }
|
|
24
|
2796
|
25 char *get_path(char* x){ return strdup(x);}
|
|
26
|
3935
|
27 void* LoadLibraryA(char* name);
|
2796
|
28 void* GetProcAddress(void* handle,char* func);
|
|
29
|
|
30 #define __stdcall __attribute__((__stdcall__))
|
|
31 #define __cdecl __attribute__((__cdecl__))
|
|
32 #define APIENTRY
|
2501
|
33
|
3935
|
34 unsigned int* x_table[0x00001837];
|
|
35
|
2796
|
36 int main(int argc, char *argv[]){
|
2501
|
37 void *handler;
|
3935
|
38 ComponentResult (*
|
2796
|
39 dispatcher)(ComponentParameters *params, Globals glob);
|
|
40 ComponentResult ret;
|
|
41 ComponentParameters *params;
|
|
42 ComponentDescription desc;
|
|
43 void *globals=NULL;
|
|
44 unsigned int esp=0;
|
3935
|
45 int i;
|
2501
|
46
|
|
47 Setup_LDT_Keeper();
|
3935
|
48 handler = LoadLibraryA("/usr/lib/win32/QuickTime.qts");
|
2768
|
49 dispatcher = GetProcAddress(handler, "SorensonYUV9Dispatcher");
|
2796
|
50 // handler = expLoadLibraryA("/usr/lib/win32/On2_VP3.qtx");
|
|
51 // dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
|
2501
|
52 printf("handler: %p, dispatcher: %p\n", handler, dispatcher);
|
2796
|
53
|
3935
|
54 printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher"));
|
|
55
|
2796
|
56 desc.componentType=0;
|
|
57 desc.componentSubType=0;
|
|
58 desc.componentManufacturer=0;
|
|
59 desc.componentFlags=0;
|
|
60 desc.componentFlagsMask=0;
|
2501
|
61
|
2796
|
62 params = malloc(sizeof(ComponentParameters)+2048);
|
2501
|
63
|
2796
|
64 params->flags = 0;
|
3935
|
65 params->paramSize = 0;
|
|
66 params->what = kComponentRegisterSelect;
|
|
67 ret = dispatcher(params, &globals);
|
|
68 printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals);
|
|
69
|
|
70 // memset(x_table,12,4*0x00001837);
|
|
71
|
|
72 //for(i=0;i<=255;i++){
|
|
73 params->flags = 0;
|
|
74 params->paramSize = 4; //sizeof(params->params[0]);
|
|
75 params->params[0] = 0x820000; //0x820000|i; //(i<<16)|0x24; //0x820024;
|
2778
|
76
|
2796
|
77 // params->what = kComponentVersionSelect;
|
|
78 // params->what = kComponentRegisterSelect;
|
|
79 params->what = kComponentOpenSelect;
|
|
80 // params->what = kComponentCanDoSelect;
|
2778
|
81
|
2796
|
82 printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
|
|
83 params->flags, params->paramSize, params->what, params->params[0]);
|
2778
|
84
|
3935
|
85 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
|
86 // printf("ESP=%p\n",esp);
|
|
87
|
|
88 *((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack?
|
|
89
|
|
90 printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]);
|
2778
|
91
|
2796
|
92 ret = dispatcher(params, &globals);
|
|
93
|
3935
|
94 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
|
95 // printf("ESP=%p\n",esp);
|
2778
|
96
|
3935
|
97 printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals);
|
|
98 // if(ret!=-3000) break;
|
|
99 //}
|
|
100
|
|
101 // for(i=0;i<0x00001837;i++)
|
|
102 // if(x_table[i]) printf("x_table[0x%X] = %p\n",i,x_table[i]);
|
2501
|
103
|
2796
|
104 Restore_LDT_Keeper();
|
|
105 exit(0);
|
|
106 //return 0;
|
2501
|
107 }
|