changeset 2796:8671d43c1078

still sig11
author arpi
date Sat, 10 Nov 2001 18:06:47 +0000
parents 51bb2caa5f2a
children 4c9966c2b2ed
files loader/qtx/qtxload.c
diffstat 1 files changed, 47 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/loader/qtx/qtxload.c	Sat Nov 10 15:01:47 2001 +0000
+++ b/loader/qtx/qtxload.c	Sat Nov 10 18:06:47 2001 +0000
@@ -1,6 +1,9 @@
 /* to compile: gcc -o qtxload qtxload.c ../libloader.a -lpthread -ldl -ggdb ../../cpudetect.o */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include "qtxsdk/components.h"
 #include "qtxsdk/select.h"
 
@@ -19,55 +22,63 @@
     return(0);
 }
 
-char *get_path()
-{
-    return(".");
-}
+char *get_path(char* x){  return strdup(x);}
+
+void* expLoadLibraryA(char* name);
+void* GetProcAddress(void* handle,char* func);
+
+#define __stdcall __attribute__((__stdcall__))
+#define __cdecl   __attribute__((__cdecl__))
+#define APIENTRY 
 
-main(int argc, char *argv[])
-{
+int main(int argc, char *argv[]){
     void *handler;
-    ComponentResult (*
-dispatcher)(ComponentParameters *params, void* glob);
+    ComponentResult (APIENTRY *
+dispatcher)(ComponentParameters *params, Globals glob);
+    ComponentResult ret;
+    ComponentParameters *params;
+    ComponentDescription desc;
+    void *globals=NULL;
+    unsigned int esp=0;
 
     Setup_LDT_Keeper();
-    
     handler = expLoadLibraryA("/usr/lib/win32/QuickTime.qts");
     dispatcher = GetProcAddress(handler, "SorensonYUV9Dispatcher");
+//    handler = expLoadLibraryA("/usr/lib/win32/On2_VP3.qtx");
+//    dispatcher = GetProcAddress(handler, "CDComponentDispatcher");
     printf("handler: %p, dispatcher: %p\n", handler, dispatcher);
+
+    desc.componentType=0;
+    desc.componentSubType=0;
+    desc.componentManufacturer=0;
+    desc.componentFlags=0;
+    desc.componentFlagsMask=0;
     
-    {
-	ComponentResult ret;
-	ComponentParameters *params;
-	void *globals;
-	
-	globals = malloc(sizeof(long));
-	(long)*(void **)globals = 0x2001;
+    params = malloc(sizeof(ComponentParameters)+2048);
 
-	params = malloc(sizeof(ComponentParameters));
-
-	params->flags = 0;
-	params->paramSize = sizeof(params);
-	params->what = kComponentVersionSelect;
-	// params->what = kComponentRegisterSelect;
-	// params->what = kComponentOpenSelect;
-	// params->what = -5; //atoi(argv[1]);
+    params->flags = 0;
+    params->paramSize = sizeof(params->params[0]);
+    params->params[0] = 0x12345678;
 
-	params->params[0] = 0x1984;
+    // params->what = kComponentVersionSelect;
+    // params->what = kComponentRegisterSelect;
+    params->what = kComponentOpenSelect;
+    // params->what = kComponentCanDoSelect;
 
-	printf("params: flags: %d, paramSize: %d, what: %d\n",
-	    params->flags, params->paramSize, params->what);
-	printf("params[0] = %x\n", params->params[0]);
+    printf("params: flags: %d, paramSize: %d, what: %d, params[0] = %x\n",
+        params->flags, params->paramSize, params->what, params->params[0]);
 
-	ret = dispatcher(params, globals);
+    __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
+    printf("ESP=%p\n",esp);
 
-	printf("!!! CDComponentDispatch() => %x\n",ret);
+    ret = dispatcher(params, &globals);
+
+    __asm__ __volatile__ ("movl %%esp, %0\n\t" : "=a" (esp) :: "memory" );
+    printf("ESP=%p\n",esp);
 
-//	printf("!!! CDComponentDispatch(%p, %p) => %x\n",
-//	    &params, globals, ret);
-//	free(globals);
-//	free(params);
-    }
+    printf("!!! CDComponentDispatch() => 0x%X  glob=%p\n",ret,globals);
     
-//    Restore_LDT_Keeper();
+    Restore_LDT_Keeper();
+    exit(0);
+    //return 0;
 }