comparison loader/qtx/qtxload.c @ 2778:720190b369c6

fixes?
author arpi
date Fri, 09 Nov 2001 03:26:48 +0000
parents a0b454046396
children 8671d43c1078
comparison
equal deleted inserted replaced
2777:7c43c3829868 2778:720190b369c6
1 /* to compile: gcc -o qtxload qtxload.c ../libloader.a -lpthread -ldl -ggdb ../../cpudetect.o */ 1 /* to compile: gcc -o qtxload qtxload.c ../libloader.a -lpthread -ldl -ggdb ../../cpudetect.o */
2 2
3 #include <stdio.h> 3 #include <stdio.h>
4 #include "qtxsdk/components.h" 4 #include "qtxsdk/components.h"
5 #include "qtxsdk/select.h"
5 6
6 #define DEF_DISPATCHER(name) ComponentResult (*##name)(struct ComponentParameters *, void **) 7 #define DEF_DISPATCHER(name) ComponentResult (*##name)(ComponentParameters *, void **)
7 8
8 /* ilyen egy sima komponens */ 9 /* ilyen egy sima komponens */
9 ComponentResult ComponentDummy( 10 ComponentResult ComponentDummy(
10 struct ComponentParameters *params, 11 ComponentParameters *params,
11 void **globals, 12 void **globals,
12 DEF_DISPATCHER(ComponentDispatch)) 13 DEF_DISPATCHER(ComponentDispatch))
13 { 14 {
14 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n", 15 printf("ComponentDummy(params: %p, globals: %p, dispatcher: %p) called!\n",
15 params, globals, ComponentDispatch); 16 params, globals, ComponentDispatch);
24 } 25 }
25 26
26 main(int argc, char *argv[]) 27 main(int argc, char *argv[])
27 { 28 {
28 void *handler; 29 void *handler;
29 void *dispatcher; 30 ComponentResult (*
31 dispatcher)(ComponentParameters *params, void* glob);
30 32
31 Setup_LDT_Keeper(); 33 Setup_LDT_Keeper();
32 34
33 handler = expLoadLibraryA("/usr/lib/win32/QuickTime.qts"); 35 handler = expLoadLibraryA("/usr/lib/win32/QuickTime.qts");
34 dispatcher = GetProcAddress(handler, "SorensonYUV9Dispatcher"); 36 dispatcher = GetProcAddress(handler, "SorensonYUV9Dispatcher");
35 printf("handler: %p, dispatcher: %p\n", handler, dispatcher); 37 printf("handler: %p, dispatcher: %p\n", handler, dispatcher);
36 38
37 { 39 {
38 ComponentResult ret; 40 ComponentResult ret;
39 int (*dispatcher_func)(void *, void *); 41 ComponentParameters *params;
40 struct ComponentParameters *params;
41 void *globals; 42 void *globals;
42
43 dispatcher_func = dispatcher;
44 43
45 globals = malloc(sizeof(long)); 44 globals = malloc(sizeof(long));
46 (long)*(void **)globals = 0x2001; 45 (long)*(void **)globals = 0x2001;
47 46
48 params = malloc(sizeof(struct ComponentParameters)); 47 params = malloc(sizeof(ComponentParameters));
49 48
50 params->flags = 2; 49 params->flags = 0;
51 params->paramSize = sizeof(params); 50 params->paramSize = sizeof(params);
52 params->what = atoi(argv[1]); 51 params->what = kComponentVersionSelect;
52 // params->what = kComponentRegisterSelect;
53 // params->what = kComponentOpenSelect;
54 // params->what = -5; //atoi(argv[1]);
55
53 params->params[0] = 0x1984; 56 params->params[0] = 0x1984;
54 /* 0x1000100f will load QuickTime.qts */ 57
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 */
62 /* 0x100010b4 probarly init ?? */
63 printf("params: flags: %d, paramSize: %d, what: %d\n", 58 printf("params: flags: %d, paramSize: %d, what: %d\n",
64 params->flags, params->paramSize, params->what); 59 params->flags, params->paramSize, params->what);
65 printf("params[0] = %x\n", params->params[0]); 60 printf("params[0] = %x\n", params->params[0]);
66 ret = dispatcher_func(params, globals); 61
67 printf("CDComponentDispatch(%p, %p) => %x\n", 62 ret = dispatcher(params, globals);
68 &params, globals, ret); 63
69 free(globals); 64 printf("!!! CDComponentDispatch() => %x\n",ret);
70 free(params); 65
66 // printf("!!! CDComponentDispatch(%p, %p) => %x\n",
67 // &params, globals, ret);
68 // free(globals);
69 // free(params);
71 } 70 }
72 71
73 Restore_LDT_Keeper(); 72 // Restore_LDT_Keeper();
74 } 73 }