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"
|
|
5
|
|
6 #define DEF_DISPATCHER(name) ComponentResult (*##name)(struct ComponentParameters *, void **)
|
|
7
|
|
8 /* ilyen egy sima komponens */
|
|
9 ComponentResult ComponentDummy(
|
|
10 struct ComponentParameters *params,
|
|
11 void **globals,
|
|
12 DEF_DISPATCHER(ComponentDispatch))
|
|
13 {
|
|
14 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n",
|
|
15 params, globals, ComponentDispatch);
|
|
16 printf(" Dummy: global datas: %p\n", *globals);
|
|
17 printf(" Dummy: returning 0\n");
|
|
18 return(0);
|
|
19 }
|
|
20
|
|
21 char *get_path()
|
|
22 {
|
|
23 return(".");
|
|
24 }
|
|
25
|
2582
|
26 main(int argc, char *argv[])
|
2501
|
27 {
|
|
28 void *handler;
|
|
29 void *dispatcher;
|
|
30
|
|
31 Setup_LDT_Keeper();
|
|
32
|
2768
|
33 handler = expLoadLibraryA("/usr/lib/win32/QuickTime.qts");
|
|
34 dispatcher = GetProcAddress(handler, "SorensonYUV9Dispatcher");
|
2501
|
35 printf("handler: %p, dispatcher: %p\n", handler, dispatcher);
|
|
36
|
|
37 {
|
|
38 ComponentResult ret;
|
|
39 int (*dispatcher_func)(void *, void *);
|
2502
|
40 struct ComponentParameters *params;
|
2501
|
41 void *globals;
|
|
42
|
2502
|
43 dispatcher_func = dispatcher;
|
|
44
|
2501
|
45 globals = malloc(sizeof(long));
|
|
46 (long)*(void **)globals = 0x2001;
|
|
47
|
2502
|
48 params = malloc(sizeof(struct ComponentParameters));
|
|
49
|
2582
|
50 params->flags = 2;
|
2502
|
51 params->paramSize = sizeof(params);
|
2582
|
52 params->what = atoi(argv[1]);
|
2502
|
53 params->params[0] = 0x1984;
|
2501
|
54 /* 0x1000100f will load QuickTime.qts */
|
|
55 /* 0x10001014 will use SendMessageA */
|
|
56 /* 0x10001019 returns 0 */
|
|
57 /* 0x1000101e will load QuickTime.qts */
|
|
58 /* 0x10001028 returns params' addr */
|
|
59 /* 0x1000102d is a dialog */
|
|
60 /* 0x10001032 returns 20001 => CDVersion */
|
|
61 /* 0x10001069 returns 8a */
|
2582
|
62 /* 0x100010b4 probarly init ?? */
|
2501
|
63 printf("params: flags: %d, paramSize: %d, what: %d\n",
|
2502
|
64 params->flags, params->paramSize, params->what);
|
|
65 printf("params[0] = %x\n", params->params[0]);
|
2582
|
66 ret = dispatcher_func(params, globals);
|
2501
|
67 printf("CDComponentDispatch(%p, %p) => %x\n",
|
|
68 ¶ms, globals, ret);
|
|
69 free(globals);
|
2502
|
70 free(params);
|
2501
|
71 }
|
|
72
|
|
73 Restore_LDT_Keeper();
|
|
74 }
|