annotate loader/qtx/qtxload.c @ 26538:1b05ff23d572

Remove calls to Restore_LDT_Keeper, exit() is called immediately afterwards anyway. The calls were missing parameters and caused compilation failures.
author diego
date Mon, 28 Apr 2008 13:07:01 +0000
parents 4120a65789a8
children 0fdf04b07ecb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2501
alex
parents:
diff changeset
1 #include <stdio.h>
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
2 #include <stdlib.h>
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
3 #include <string.h>
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
4
2501
alex
parents:
diff changeset
5 #include "qtxsdk/components.h"
2778
arpi
parents: 2768
diff changeset
6 #include "qtxsdk/select.h"
26537
4120a65789a8 Add missing ldt_keeper.h #include; this fixes a bunch of implicit declaration
diego
parents: 26530
diff changeset
7 #include "ldt_keeper.h"
26530
59466c2ce1f0 Add missing #include, fixes the warning:
diego
parents: 26528
diff changeset
8 #include "mp_msg.h"
2501
alex
parents:
diff changeset
9
alex
parents:
diff changeset
10 /* ilyen egy sima komponens */
alex
parents:
diff changeset
11 ComponentResult ComponentDummy(
2778
arpi
parents: 2768
diff changeset
12 ComponentParameters *params,
2501
alex
parents:
diff changeset
13 void **globals,
25589
276d47411414 Fix compilation by replacing a broken macro with in-place code.
diego
parents: 18889
diff changeset
14 ComponentResult (*ComponentDispatch)(ComponentParameters *, void **))
2501
alex
parents:
diff changeset
15 {
alex
parents:
diff changeset
16 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n",
alex
parents:
diff changeset
17 params, globals, ComponentDispatch);
alex
parents:
diff changeset
18 printf(" Dummy: global datas: %p\n", *globals);
alex
parents:
diff changeset
19 printf(" Dummy: returning 0\n");
alex
parents:
diff changeset
20 return(0);
alex
parents:
diff changeset
21 }
alex
parents:
diff changeset
22
18889
e60c8c7399d2 get_path as const, patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents: 16194
diff changeset
23 char *get_path(const char* x){ return strdup(x);}
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
24
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
25 void* LoadLibraryA(char* name);
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
26 void* GetProcAddress(void* handle,char* func);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
27
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
28 #define __stdcall __attribute__((__stdcall__))
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
29 #define __cdecl __attribute__((__cdecl__))
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
30 #define APIENTRY
2501
alex
parents:
diff changeset
31
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
32 unsigned int* x_table[0x00001837];
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
33
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
34 static OSErr (*InitializeQTML)(long flags);
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
35
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
36 int main(int argc, char *argv[]){
2501
alex
parents:
diff changeset
37 void *handler;
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
38 void *handler2;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
39 void* theqtdp=NULL;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
40 void* compcall=NULL;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
41 void* compcallws=NULL;
16194
167342641f0b Remove stray MSDOS linebreaks
ivo
parents: 8268
diff changeset
42 ComponentResult (*dispatcher)(ComponentParameters *params, Globals glob);
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
43 ComponentResult ret;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
44 ComponentParameters *params;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
45 ComponentDescription desc;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
46 void *globals=NULL;
26528
da85ae10987e Comment out variables only used in commented-out code, fixes the warnings:
diego
parents: 25794
diff changeset
47 //unsigned int esp=0;
da85ae10987e Comment out variables only used in commented-out code, fixes the warnings:
diego
parents: 25794
diff changeset
48 //int i;
2501
alex
parents:
diff changeset
49
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
50 mp_msg_init();
25590
62959db3a504 Comment out non-existing mp_msg_set_level function to fix linking.
diego
parents: 25589
diff changeset
51 //mp_msg_set_level(10);
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
52
2501
alex
parents:
diff changeset
53 Setup_LDT_Keeper();
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
54 printf("loading qts\n");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
55 // handler = LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime.qts");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
56 handler = LoadLibraryA("QuickTime.qts");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
57 theqtdp = GetProcAddress(handler, "theQuickTimeDispatcher");
25794
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 25593
diff changeset
58 compcall = GetProcAddress(handler, "CallComponent");
2c8cdb9123b8 Fix a ton of illegal identifiers. Identifiers starting with __ or _ and a
diego
parents: 25593
diff changeset
59 compcallws = GetProcAddress(handler, "CallComponentFunctionWithStorage");
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
60
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
61 InitializeQTML = 0x6299e590;//GetProcAddress(handler, "InitializeQTML");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
62 InitializeQTML(6+16);
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
63
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
64 printf("loading svq3\n");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
65 handler2= LoadLibraryA("/root/.wine/fake_windows/Windows/System/QuickTime/QuickTimeEssentials.qtx");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
66 printf("done\n");
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
67 dispatcher = GetProcAddress(handler2, "SMD_ComponentDispatch");
25593
96ce0ca753ff /usr/lib/win32 --> /usr/local/lib/codecs
diego
parents: 25592
diff changeset
68 // handler = expLoadLibraryA("/usr/local/lib/codecs/On2_VP3.qtx");
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
69 // dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
70 printf("handler: %p, dispatcher: %p theqtdp: %p\n", handler, dispatcher, theqtdp);
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
71
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
72 // printf("theQuickTimeDispatcher = %p\n",GetProcAddress(handler, "theQuickTimeDispatcher"));
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
73
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
74 // patch svq3 dll:
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
75 *((void**)0x63214c98) = NULL;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
76 *((void**)0x63214c9c) = theqtdp; // theQt...
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
77 *((void**)0x63214ca0) = compcall; //0xdeadbeef; //dispatcher; // CallCOmponent_ptr
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
78 *((void**)0x63214ca4) = compcallws; //0xdeadbef2; //dispatcher; // CallComponentWithStorage_ptr
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
79
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
80 desc.componentType=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
81 desc.componentSubType=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
82 desc.componentManufacturer=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
83 desc.componentFlags=0;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
84 desc.componentFlagsMask=0;
2501
alex
parents:
diff changeset
85
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
86 params = malloc(sizeof(ComponentParameters)+2048);
2501
alex
parents:
diff changeset
87
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
88 params->flags = 0;
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
89 params->paramSize = 4;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
90 params->what = kComponentOpenSelect;
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
91 params->params[0] = 0x830000; //0x820000|i; //(i<<16)|0x24; //0x820024;
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
92 ret = dispatcher(params, &globals);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
93 printf("!!! CDComponentDispatch() => 0x%X glob=%p\n",ret,globals);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
94
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
95 // memset(x_table,12,4*0x00001837);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
96
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
97 //for(i=0;i<=255;i++){
2778
arpi
parents: 2768
diff changeset
98
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
99 // params->what = kComponentVersionSelect;
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
100 // params->what = kComponentRegisterSelect;
8268
a85040e4b1a0 some new experiments
arpi
parents: 3935
diff changeset
101 // params->what = kComponentOpenSelect;
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
102 // params->what = kComponentCanDoSelect;
2778
arpi
parents: 2768
diff changeset
103
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
104 printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
105 params->flags, params->paramSize, params->what, params->params[0]);
2778
arpi
parents: 2768
diff changeset
106
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
107 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
108 // printf("ESP=%p\n",esp);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
109
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
110 *((void**)0x62b7d640) = &x_table[0]; //malloc(0x00001837 * 4); // ugly hack?
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
111
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
112 printf("params=%p &glob=%p x_table=%p\n",params,&globals, &x_table[0]);
2778
arpi
parents: 2768
diff changeset
113
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
114 ret = dispatcher(params, &globals);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
115
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
116 // __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
117 // printf("ESP=%p\n",esp);
2778
arpi
parents: 2768
diff changeset
118
3935
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
119 printf("!!! CDComponentDispatch() => %d glob=%p\n",ret,globals);
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
120 // if(ret!=-3000) break;
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
121 //}
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
122
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
123 // for(i=0;i<0x00001837;i++)
422d65c712a0 more mess
arpi
parents: 2796
diff changeset
124 // if(x_table[i]) printf("x_table[0x%X] = %p\n",i,x_table[i]);
26538
1b05ff23d572 Remove calls to Restore_LDT_Keeper, exit() is called immediately afterwards
diego
parents: 26537
diff changeset
125
2796
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
126 exit(0);
8671d43c1078 still sig11
arpi
parents: 2778
diff changeset
127 //return 0;
2501
alex
parents:
diff changeset
128 }