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
|
8268
|
36 static OSErr (*InitializeQTML)(long flags);
|
|
37
|
2796
|
38 int main(int argc, char *argv[]){
|
2501
|
39 void *handler;
|
8268
|
40 void *handler2;
|
|
41 void* theqtdp=NULL;
|
|
42 void* compcall=NULL;
|
|
43 void* compcallws=NULL;
|
3935
|
44 ComponentResult (*
|
2796
|
45 dispatcher)(ComponentParameters *params, Globals glob);
|
|
46 ComponentResult ret;
|
|
47 ComponentParameters *params;
|
|
48 ComponentDescription desc;
|
|
49 void *globals=NULL;
|
|
50 unsigned int esp=0;
|
3935
|
51 int i;
|
2501
|
52
|
8268
|
53 mp_msg_init();
|
|
54 mp_msg_set_level(10);
|
|
55
|
2501
|
56 Setup_LDT_Keeper();
|
8268
|
57 printf("loading qts\n");
|
|
58 // handler = LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime.qts");
|
|
59 handler = LoadLibraryA("QuickTime.qts");
|
|
60 theqtdp = GetProcAddress(handler, "theQuickTimeDispatcher");
|
|
61 compcall = GetProcAddress(handler, "_CallComponent");
|
|
62 compcallws = GetProcAddress(handler, "_CallComponentFunctionWithStorage");
|
|
63
|
|
64 InitializeQTML = 0x6299e590;//GetProcAddress(handler, "InitializeQTML");
|
|
65 InitializeQTML(6+16);
|
|
66
|
|
67 printf("loading svq3\n");
|
|
68 handler2= LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime/QuickTimeEssentials.qtx");
|
|
69 printf("done\n");
|
|
70 dispatcher = GetProcAddress(handler2, "SMD_ComponentDispatch");
|
2796
|
71 // handler = expLoadLibraryA("/usr/lib/win32/On2_VP3.qtx");
|
|
72 // dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
|
8268
|
73 printf("handler: %p, dispatcher: %p theqtdp: %p\n", handler, dispatcher, theqtdp);
|
|
74
|
|
75 // printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher"));
|
2796
|
76
|
8268
|
77 // patch svq3 dll:
|
|
78 *((void**)0x63214c98) = NULL;
|
|
79 *((void**)0x63214c9c) = theqtdp; // theQt...
|
|
80 *((void**)0x63214ca0) = compcall; //0xdeadbeef; //dispatcher; // CallCOmponent_ptr
|
|
81 *((void**)0x63214ca4) = compcallws; //0xdeadbef2; //dispatcher; // CallComponentWithStorage_ptr
|
3935
|
82
|
2796
|
83 desc.componentType=0;
|
|
84 desc.componentSubType=0;
|
|
85 desc.componentManufacturer=0;
|
|
86 desc.componentFlags=0;
|
|
87 desc.componentFlagsMask=0;
|
2501
|
88
|
2796
|
89 params = malloc(sizeof(ComponentParameters)+2048);
|
2501
|
90
|
2796
|
91 params->flags = 0;
|
8268
|
92 params->paramSize = 4;
|
|
93 params->what = kComponentOpenSelect;
|
|
94 params->params[0] = 0x830000; //0x820000|i; //(i<<16)|0x24; //0x820024;
|
3935
|
95 ret = dispatcher(params, &globals);
|
|
96 printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals);
|
|
97
|
|
98 // memset(x_table,12,4*0x00001837);
|
|
99
|
|
100 //for(i=0;i<=255;i++){
|
2778
|
101
|
2796
|
102 // params->what = kComponentVersionSelect;
|
|
103 // params->what = kComponentRegisterSelect;
|
8268
|
104 // params->what = kComponentOpenSelect;
|
2796
|
105 // params->what = kComponentCanDoSelect;
|
2778
|
106
|
2796
|
107 printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
|
|
108 params->flags, params->paramSize, params->what, params->params[0]);
|
2778
|
109
|
3935
|
110 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
|
111 // printf("ESP=%p\n",esp);
|
|
112
|
|
113 *((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack?
|
|
114
|
|
115 printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]);
|
2778
|
116
|
2796
|
117 ret = dispatcher(params, &globals);
|
|
118
|
3935
|
119 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
|
|
120 // printf("ESP=%p\n",esp);
|
2778
|
121
|
3935
|
122 printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals);
|
|
123 // if(ret!=-3000) break;
|
|
124 //}
|
|
125
|
|
126 // for(i=0;i<0x00001837;i++)
|
|
127 // if(x_table[i]) printf("x_table[0x%X] = %p\n",i,x_table[i]);
|
2501
|
128
|
2796
|
129 Restore_LDT_Keeper();
|
|
130 exit(0);
|
|
131 //return 0;
|
2501
|
132 }
|