2582
|
1 /* to compile: gcc -o qtxload qtxload.c ../libloader.a -lpthread -ldl -ggdb ../../cpudetect.o */
|
|
2
|
2501
|
3 #include <stdio.h>
|
|
4 #include "qtxsdk/components.h"
|
2778
|
5 #include "qtxsdk/select.h"
|
2501
|
6
|
2778
|
7 #define DEF_DISPATCHER(name) ComponentResult (*##name)(ComponentParameters *, void **)
|
2501
|
8
|
|
9 /* ilyen egy sima komponens */
|
|
10 ComponentResult ComponentDummy(
|
2778
|
11 ComponentParameters *params,
|
2501
|
12 void **globals,
|
|
13 DEF_DISPATCHER(ComponentDispatch))
|
|
14 {
|
|
15 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n",
|
|
16 params, globals, ComponentDispatch);
|
|
17 printf(" Dummy: global datas: %p\n", *globals);
|
|
18 printf(" Dummy: returning 0\n");
|
|
19 return(0);
|
|
20 }
|
|
21
|
|
22 char *get_path()
|
|
23 {
|
|
24 return(".");
|
|
25 }
|
|
26
|
2582
|
27 main(int argc, char *argv[])
|
2501
|
28 {
|
|
29 void *handler;
|
2778
|
30 ComponentResult (*
|
|
31 dispatcher)(ComponentParameters *params, void* glob);
|
2501
|
32
|
|
33 Setup_LDT_Keeper();
|
|
34
|
2768
|
35 handler = expLoadLibraryA("/usr/lib/win32/QuickTime.qts");
|
|
36 dispatcher = GetProcAddress(handler, "SorensonYUV9Dispatcher");
|
2501
|
37 printf("handler: %p, dispatcher: %p\n", handler, dispatcher);
|
|
38
|
|
39 {
|
|
40 ComponentResult ret;
|
2778
|
41 ComponentParameters *params;
|
2501
|
42 void *globals;
|
|
43
|
|
44 globals = malloc(sizeof(long));
|
|
45 (long)*(void **)globals = 0x2001;
|
|
46
|
2778
|
47 params = malloc(sizeof(ComponentParameters));
|
2502
|
48
|
2778
|
49 params->flags = 0;
|
2502
|
50 params->paramSize = sizeof(params);
|
2778
|
51 params->what = kComponentVersionSelect;
|
|
52 // params->what = kComponentRegisterSelect;
|
|
53 // params->what = kComponentOpenSelect;
|
|
54 // params->what = -5; //atoi(argv[1]);
|
|
55
|
2502
|
56 params->params[0] = 0x1984;
|
2778
|
57
|
2501
|
58 printf("params: flags: %d, paramSize: %d, what: %d\n",
|
2502
|
59 params->flags, params->paramSize, params->what);
|
|
60 printf("params[0] = %x\n", params->params[0]);
|
2778
|
61
|
|
62 ret = dispatcher(params, globals);
|
|
63
|
|
64 printf("!!! CDComponentDispatch() => %x\n",ret);
|
|
65
|
|
66 // printf("!!! CDComponentDispatch(%p, %p) => %x\n",
|
|
67 // ¶ms, globals, ret);
|
|
68 // free(globals);
|
|
69 // free(params);
|
2501
|
70 }
|
|
71
|
2778
|
72 // Restore_LDT_Keeper();
|
2501
|
73 }
|